I need to output an Interrupt 1h. (RTC).
But I don't know how to print RTC in console. Should I use interrupt 10h, or is there another way?
I already tried to find some in google, and I applied the interrupt 10 directly as below.
mov ah 0x02
int 0x1a
But it's not working. I know that the code is poor.
Please give me some help. If you can make example for me, I'd really appreciate it.
Looking at docs for int 0x10
, we see a number of functions. You didn't specify which you tried to use, but let's look at ah=0x0e:
Expects: AH 0eH
AL character to write
BL (graphics modes only) foreground color number
The 'character to write' is the ascii value of the character we want to display. So for example if you want to write the character '7', you would put the ascii value for it (55 aka 0x37) into al
. Just putting 0x7 into al
would be the ascii character for BEL (and would make the speaker beep).
So, what if you want to print the number 1234? Well, you would need to call this function 4 times, with each of 49, 50, 51, 52.
I know, you're wondering if there is some way to output a string? Sure. For example there is INT 0x10, ax=0x1300. However, you STILL need to turn 1234 into the appropriate ascii characters, then call the BIOS function to output the string you have created.
Isn't there some sort of printf("%d")
that does that conversion for me? Not in the BIOS. BIOS functions are designed to be very low level. That's (part of) WHY there are operating systems, C runtime libraries, etc, so that people don't have to write all this junk.
If you don't want to write such a function yourself, there are asm 'libraries' out there that have collections of routines for performing this type of thing.