Lecture 19.

Slides:



Advertisements
Similar presentations
Computer Programming Spring-2007
Advertisements

LINKED LIST, STACKS AND QUEUES Saras M Srivastava, PGT – Comp. Sc. Kendriya Vidyalaya TengaValley.
For(int i = 1; i
Programming In C++ Spring Semester 2013 Practice 1-3 Lectures Programming In C++, Lecture 3 By Umer Rana.
Lecture # 12. PIC Printer Interface Printer IRQ7 INT ACK Printer Interface.
CSC469 Tutorial2 Inline assembly, cycle counters, Gnuplot, LaTeX
CCCC 8 CCCC CCCC 8 CCCC.
LCS Non-Dynamic Version int function lcs (x, y, i, j) begin if (i = 0) or (j = 0) return 0; else if (x[i] = y[j]) return lcs(x, y, i-1, j-1)+1; else return.
Templated Functions. Overloading vs Templating  Overloaded functions allow multiple functions with the same name.
Sort the given string, without using string handling functions.
CCCC CCCC CCCC CCCC.
Flow Diagram: Push flags, CS, IP Pop IP,CS,flags Push AX,BX,CX,DX,ES,DS,SI,DI,BP POP BP,DI,SI,DS,ES,DX,CX,BX,AX.
BY Kamran Yousaf Application of Computer Graphics and Animation Using C++ Language.
A program example is given below to input date and display on the screen by write a class ‘ date ‘ # include Class date { Private: Int y, m, d ; Publice.
COMP 171 Data Structures and Algorithms Tutorial 1 Template and STL.
1 The UNIX date command myclock.cpp example The C/C++ time() and ctime() functions myclock2.cpp example Inline function definitions Inline class member.
Another Example: #include<BIOS.H> #include<DOS.H>
Course Title Object Oriented Programming with C++ Course instructor ADEEL ANJUM Chapter No: 05 ARRAY 1 BY ADEEL ANJUM (MSc-cs, CCNA,WEB DEVELOPER) 1.
Passing Structure to function.  structure to function structure to function  Passing structure to function in C Passing structure to function in C 
Lecture 27. Extended Read Service used for extended read is int 13h/42h On Entry AH=42H DL=drive # DS:SI= far address of Disk address packet On Exit If.
ECE 103 Engineering Programming Chapter 53 Generic Algorithms Herbert G. Mayer, PSU CS Status 6/4/2014 Initial content copied verbatim from ECE 103 material.
Free Phone $25 a month 100 minutes then 35c per min Free Phone $25 a month 100 minutes then 35c per min Free Phone $20 a month 75 minutes then 25c per.
10H Interrupt. Option 0H – Sets video mode. Registers used: – AH = 0H – AL = Video Mode. 3H - CGA Color text of 80X25 7H - Monochrome text of 80X25 Ex:
Time Vocabulary Do you have the time to review? Analog Clock A device for measuring time by moving hands around a circle for showing hours, minutes,
Introduction to Programming Lecture 40. Class Class is a user defined data type.
ROM BIOS Chapter 9. The ROM BIOS PC computer come with a set od built in routines collectively called the ROM BIOS. These routines are permanent part.
Print Row Function void PrintRow(float x[ ][4],int i) { int j; for(j=0;j
Int fact (int n) { If (n == 0) return 1; else return n * fact (n – 1); } 5 void main () { Int Sum; : Sum = fact (5); : } Factorial Program Using Recursion.
Project Assignment Snake Game/Car Acceleration Meter Min 10 Pages 10 min Presentation Max 5 group members Submitting Date: lab 2:Dec 27, 2014 Lab 3: Dec.
Lecture #15 ARRAYS By Shahid Naseem (Lecturer). 2 ARRAYS DEFINITION An array is a sequence of objects of same data type. The objects in an array are also.
Lecture 26.
Object Access m1.write(44); m2.write(m2.read() +1); std::cout
C++ CODES PART#04 1 COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT.
Lecture 15. Modem Controller Register 4310 DTR 0 = Polling Operator 1 = Interrupts Enabled RTS 1 =Self Test 0 =Normal.
Computer Graphics Lecture 04 Point Taqdees A. Siddiqi
#include <dos. h> void interrupt(
Ex-1 #include <stdio.h> struct sample { int a=0; char b='A';
1st prog! Q: Read a char – from a keyboard & display it at the beginning of the next line! ====== A.
ACCEL SOFTWARE AND TECHNOLOGIES LTD.
Decisions Chapter 4.
LESSON 3 IO, Variables and Operators
Example 19 Measuring Pulse Widths Using Interrupts
Do you have the time to review?
CSCI206 - Computer Organization & Programming
Example 21H/42H: handle = open("c:\\abc.txt",O_RDONLY);
CS-401 Computer Architecture Assembly Language Programming
Time Revision.
Tejalal Choudhary “C Programming from Scratch” Pointers
The slides must be understood in Lecture 5
Medical Dosage Calculations A Dimensional Analysis Approach
Lecture 22.
Andy Wang Object Oriented Programming in C++ COP 3330
A Question of Maths Instructions: Choose a number to answer a question
Interrupt Mechanism Interrupt Compared With Procedures Call MyProc
Lecture 10.
Lecture 16.
Introduction to Programming
Little Endian vs. Big Endian (Intel vs. Motorola)
unsigned char far *scr=0xb ;
Lecture # 11.
Unit:08 Software Interrupts
TicTacToe 過三關 使用者可按 XO X char gb[3][3]; gb[0][1] gb[0][0] gb[0][2]
An object travels 40 miles in 2 hrs. Calculate its speed?
Lecture 17.
Andy Wang Object Oriented Programming in C++ COP 3330
Do you have the time to review?
Introduction to Programming
Lecture 24.
CS-401 Computer Architecture & Assembly Language Programming
UNITS OF TIME QUESTIONS.
Presentation transcript:

Lecture 19

#include <bios. h> #include <dos. h> void main () { #include <bios.h> #include <dos.h> void main () { unsigned int cen,yrs,mons,days; _AH =4; geninterrupt(0x1a); cen=_CH; yrs=_CL; mons=_DH; days=_DL; cen = cen <<4; *((unsigned char *)(&cen)) = (*((unsigned char *)(&cen))) >>4; cen = cen + 0x3030;

mons = mons <<4;. ((unsigned char. )(&mons)) =. ( mons = mons <<4; *((unsigned char *)(&mons)) = (*((unsigned char *)(&mons))) >>4; mons = mons + 0x3030; yrs = yrs <<4; *((unsigned char *)(&yrs)) = (*((unsigned char *)(&yrs))) >>4; yrs = yrs + 0x3030; days = days <<4; *((unsigned char *)(&days)) = (*((unsigned char *)(&days))) >>4; days = days + 0x3030; clrscr();

printf("%c%c-%c%c-%c%c%c%c",. (((unsigned char. )(&days))+1), printf("%c%c-%c%c-%c%c%c%c", *(((unsigned char*)(&days))+1), *((unsigned char*)(&days)), *(((unsigned char*)(&mons))+1), *((unsigned char*)(&mons)), *(((unsigned char*)(&cen))+1), *((unsigned char*)(&cen)), *(((unsigned char*)(&yrs))+1), *((unsigned char*)(&yrs))); getch(); }

unsigned char ASCIItoBCD(char hi, char lo) {. hi = hi - 0x30; unsigned char ASCIItoBCD(char hi, char lo) { hi = hi - 0x30; lo = lo - 0x30; hi = hi << 4; hi = hi | lo; return hi; } void main () { unsigned char yrs,mons,days,cen; char ch1, ch2; puts("\nEnter the century to update: "); ch1=getche(); ch2=getche(); cen = ASCIItoBCD(ch1, ch2);

puts("\nEnter the yrs to update: ");. ch1=getche();. ch2=getche(); puts("\nEnter the yrs to update: "); ch1=getche(); ch2=getche(); yrs = ASCIItoBCD(ch1, ch2); puts("\nEnter the month to update: "); ch1=getche(); ch2=getche(); mons = ASCIItoBCD(ch1, ch2); puts("\nEnter the days to update: "); ch1=getche(); ch2=getche(); days = ASCIItoBCD(ch1, ch2); _CH = cen;_CL=yrs;_DH= mons; _DL=days; _AH =5; geninterrupt(0x1a); puts("Date Updated"); }

void interrupt (. oldint)(); void interrupt newint(); unsigned int far void interrupt (*oldint)(); void interrupt newint(); unsigned int far * scr = (unsigned int far *)0xb8000000; void main () { oldint = getvect(0x4a); setvect(0x4a, newint); _AH=6; _CH =0x23; _CL=0x50; _DH=0; geninterrupt(0x1a); keep(0,1000); } void interrupt newint() { *scr=0x7041; sound(0x21ff); }

#include <bios. h> #include <dos #include <bios.h> #include <dos.h> void interrupt newint70(); void interrupt (*oldint70)(); unsigned int far *scr = (unsigned int far *)0xb8000000; unsigned char ASCIItoBCD(char hi, char lo) { hi = hi - 0x30; lo = lo - 0x30; hi = hi << 4; hi = hi | lo; return hi; }

void main (void) {. int temp;. unsigned char hrs,mins,secs; void main (void) { int temp; unsigned char hrs,mins,secs; char ch1, ch2; puts("\nEnter the hours to update: "); ch1=getche(); ch2=getch(); hrs = ASCIItoBCD(ch1, ch2); puts("\nEnter the minutes to update: "); ch1=getche(); ch2=getch(); mins = ASCIItoBCD(ch1, ch2);

puts("\nEnter the seconds to update: ");. ch1=getche();. ch2=getch(); puts("\nEnter the seconds to update: "); ch1=getche(); ch2=getch(); secs = ASCIItoBCD(ch1, ch2); outportb(0x70,1); outportb(0x71,secs); outportb(0x70,3); outportb(0x71,mins); outportb(0x70,5); outportb(0x71,hrs); outportb(0x70,0x0b);

temp = inport(0x71);. temp = temp | 0x70;. outportb(0x70,0x0b); temp = inport(0x71); temp = temp | 0x70; outportb(0x70,0x0b); outportb(0x71,temp); oldint70 = getvect(0x70); setvect(0x70, newint70); keep(0,1000); } void interrupt newint70() { outportb(0x70,0x0c); if (( inport(0x71) & 0x20) == 0x20) sound(0x21ff); *scr=0x7041; (*oldint70)(); }

INT 11H INT 12H Determining Systems Information INT 11H used to get hardware environment info. On Entry call 11H On Exit AX = System Info.

INT 12H Determining Systems Information INT 15H/88H used for memory interfaced. INT 15H/88H Returns = No. of KB above 1MB mark.