





Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!






#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)) = (((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), ((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; 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);
#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; 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(); 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); 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)(); }
th