I've played around a little with nasm and bootstrapping. The following compiles to a binary which can be placed in the boot sector of a floppy with
Code: Select all
nasm -f bin -o boot.bin boot.asm
1) Instead of calling interrupts, I would like to print the output by writing to the video memory
2) I would also like to get all scancodes: also the extended ones (f-keys, and so on)...also i would like to get the scan codes of the key releases, not only of the presses
3) I would also like to write the input routine myself instead of using the interrupt...just for the learning experience...is there any resource on how to do all this??
thanks
Martin
Code: Select all
boot.asm
BITS 16
jmp 07C0h:start
start:
mov ax, cs
mov ds, ax
rept:
mov si, txt1
call printstring
mov ah, 0h
int 16h
mov si, txt2
call printstring
call printuns
jmp rept
;routine printstring: will print zero-terminated string from ds:si.
printstring:
pusha
pushf
mov bx, 7 ;use the right page
mov ah, 0Eh
nxtprintstring:
lodsb
or al, al
jz endprintstring
int 10h
jmp nxtprintstring
endprintstring:
popf
popa
ret
;routine printuns: will print unsigned integer in al
printuns:
pusha
pushf
mov bh, al
mov dl, 10
mov bl, 100
nxtprintuns:
and ax, 0000000011111111b
div bl
or al, 00110000b ;converting to ascii
mov ah, 0Eh
int 10h
and al, 00001111b ;converting back from ascii
mul bl
sub bh, al
mov al, bl
div dl
jz endprintuns
mov bl, al
mov al, bh
jmp nxtprintuns
endprintuns:
popf
popa
ret
txt1:
db 0ah, 0dh, 'Press a key! ',0
txt2:
db 'I scanned: ',0
times 510-($-$$) db 0 ; Fill the file with 0's
dw 0AA55h ; En