Download presentation
Presentation is loading. Please wait.
1
Lecture 19
2
#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;
3
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();
4
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(); }
5
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);
6
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"); }
7
void interrupt (. oldint)(); void interrupt newint(); unsigned int far
void interrupt (*oldint)(); void interrupt newint(); unsigned int far * scr = (unsigned int far *)0xb ; 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); }
8
#include <bios. h> #include <dos
#include <bios.h> #include <dos.h> void interrupt newint70(); void interrupt (*oldint70)(); unsigned int far *scr = (unsigned int far *)0xb ; unsigned char ASCIItoBCD(char hi, char lo) { hi = hi - 0x30; lo = lo - 0x30; hi = hi << 4; hi = hi | lo; return hi; }
9
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);
10
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);
11
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)(); }
16
INT 11H INT 12H Determining Systems Information INT 11H
used to get hardware environment info. On Entry call 11H On Exit AX = System Info.
18
INT 12H Determining Systems Information INT 15H/88H
used for memory interfaced. INT 15H/88H Returns = No. of KB above 1MB mark.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.