Hello everyone, Im new in assembly language. I would like to ask your help to teach me how to convert the below C language into tasm language. thank you very much.
#include <stdio.h>
#include <dos.h>
main()
{
unsigned int year;
unsigned char month;
unsigned char day;
union REGS regin,regout;
clrscr();
regin.h.ah=0x2A;
/* intdos(®in,®out);*/ int86(0x21,®in,®out);
day=regout.h.dh;
year=regout.x.cx;
printf("Today's date is: %d-%d-%d\n",month,day,year);
return(0);
}
for this regarding DOS interrupt int21h u can refer any DOS or BIOS interrupt manuals, that clearly will explain u what are all the register that got affected after an interrupt in invoked. For printing the final result on the display you need to first of all convert the packed decimal value returned in any general purpose register in to proper string, just by dividing the entire decimal value by 10 and extracting the remainder to find out the character. Later u can use some other DOS int services or BIOS Display related services (int 10h) to display the actual character in the screen positioned.
-------------------------------
here is how it will look like.
-------------------------------
under data section you need to define the below mentioned things.
________________________________________________________
year dw 0
month db 0
day db 0
________________________________________________________
clrscr();
// Garni - for clearing the screen u can use any of the display set mode BIOS services.
regin.h.ah=0x2A;
// Garni - mov ah,2ah
/* intdos(®in,®out);*/ int86(0x21,®in,®out);
// Garni - int 21h
day=regout.h.dh;
// Garni - mov day,dh
year=regout.x.cx;
// Garni - mov year,cx
printf("Today's date is: %d-%d-%d\n",month,day,year);
// Garni - take care of printing the value as explained above.
return(0);
// Garni - for terminating the exe and for telling DOS the exe statsu we have another DOS service, refer to DOS and BIOS interrupt service manuals.