Recently, I've been trying to implement a DOS compatibility layer into my OS; I'm hoping to begin this task by emulating the DOS interrupts 20h and 21h. I found on the Real mode assembly IV
(http://wiki.osdev.org/Real_mode_assembly_IV) page they describe creating your own IVT handlers which was ideal for what I am trying to do. I did get it working but I had a question about
why it worked, not how.
The reason why I ask is because, originally I had this code (for simplicity's sake I just assumed this was a bootloader):
Code: Select all
org 7C00h
start:
mov ax, 7C00h
mov ds, ax
mov es, ax
mov fs, ax
xor ax, ax
xor bx, bx
mov es, ax
mov al, 21h
mov bl, 4h
mul bx
mov bx, ax
mov word [es:bx], handler
add bx, 2
mov [es:bx], fs
mov ax, 7C00h
mov es, ax
int 21h
cli
hlt
handler:
mov ah, 0Eh
mov al, 'A'
int 10h
iret
Code: Select all
mov [es:bx], fs
I did however change the code to this:
Code: Select all
mov word [es:bx], 0h
I am still a bit unsure of this could some perhaps help shed some light on this for me?
Thanks in advance