Rombios services

I need to make an program with basic I/O (print on screen, read from the keybord), but without any OS (so i cant use syscalls), so I guess I have to use rombios services

Does anyone knows where i can find a list with an explanation of them, a tutorial, or something I can start with?

Thanks in advace
[318 byte] By [Tico86] at [2007-11-20 5:35:29]
# 1 Re: Rombios services
For reading keyboard input you'll have to use interrupt 0x16 and for printing on screen by using BIOS video services interrupt 0x10.

For instance, have a look at this code snippet from the bootstrapper of an operating system I'm working on (MASM syntax):

; If DH is nonzero this procedure was called and control is to be returned upon completion of it.
; Otherwise this procedure was jumped to and it must hang upon completion.
; SI holds the offset of the appropriate error message string + 1.
DisplayError:
MOV BX, 0007h ; Default page, white font color.
MOV AH, 0Eh ; Print character function.
PUSH SI ; Store the error message string pointer on the stack.
MOV SI, OFFSET szErrPrefix+7D00h
@@:
LODSB
CMP AL, 00h
JE @F
INT 10h ; Print "ERROR: ".
JMP @B
@@:
POP SI ; Restore the error message string pointer.
DisplayError_Hang:
DEC SI
DisplayError_Msg:
LODSB
CMP AL, 00h
JNE @F ; If this isn't the terminating zero yet, print another character.
CMP DH, 00h
JE DisplayError_Hang ; Hang in an infinite loop if control is not to be returned to the calling procedure.
XOR DH, DH
RET ; Return control otherwise.
@@:
INT 10h ; Print the appropriate error message string.
JMP DisplayError_Msg ; Print next character.

A decent reference for interrupts is this (http://www.delorie.com/djgpp/doc/rbinter/ix/).

Remember that if you're having your code be called by the MBR or you're placing your code in the first block on your hard disk itself (where the MBR is normally) it'll always be loaded at offset 0x7C00 and in real mode.
Segments are normally set to a zero offset, but if you're going to change them to more easily reference data or anything keep in mind that in real mode a segment ought to be a 16-bit memory offset and that the CPU expands it to 20-bit, effectively suffixing your offset value with an additional zero.

Good luck with it. ;)
Lars-NL at 2007-11-10 3:55:13 >
# 2 Re: Rombios services
Your post was very usefull. Thank you.
Tico86 at 2007-11-10 3:56:21 >