Browse Source

Try command: keyprint

special_first_anniversary_edition
Jakob Kjær-Kammersgaard 8 years ago
parent
commit
8418935b5d
  1. 41
      bare-bones-bootloader/bootloader.nasm

41
bare-bones-bootloader/bootloader.nasm

@ -165,6 +165,16 @@ printCRLF:
int 0x10 int 0x10
ret ret
printSpace:
mov ax, 0xE20
int 0x10
ret
printALChar:
mov ah, 0xE
int 0x10
ret
; Routine for outputting string in 'si' register to screen ; Routine for outputting string in 'si' register to screen
print: print:
mov ah, 0xE ; Specify 'int 0x10' 'teletype output' function mov ah, 0xE ; Specify 'int 0x10' 'teletype output' function
@ -284,20 +294,25 @@ wait_for_key_os:
lea si, [.os_command_buffer] lea si, [.os_command_buffer]
lea di, [.compare_with_dumpmem] lea di, [.compare_with_dumpmem]
call stringcompare call stringcompare
jne .no_str jne .not_dumpmem
call printCRLF
call printCRLF call printCRLF
lea si, [start_sing_os] lea si, [start_sing_os]
mov cx, 512 mov cx, 512
call dumpmem call dumpmem
.not_dumpmem:
lea di, [.compare_with_keyprint]
call stringcompare
jne .no_str
call printCRLF call printCRLF
call printCRLF call keyprint
.no_str: .no_str:
mov si, command_line mov si, command_line
call print_os call print_os
jmp .return_enter jmp .return_enter
.compare_with_dumpmem db 'dumpmem', 0 .compare_with_dumpmem db 'dumpmem', 0
.compare_with_keyprint db 'keyprint', 0
.end: .end:
mov si, exit_message mov si, exit_message
@ -341,6 +356,26 @@ wait_for_key_os:
.os_str_full db 13, 10, 'Buffer is full', 13, 10, 0 .os_str_full db 13, 10, 'Buffer is full', 13, 10, 0
keyprint:
pusha
.keyprint_loop:
mov ax, 0x1000 ; BIOS call to wait for key
int 0x16
cmp ax, 0x11b ; ESC key
je .end_keyprint
call dumpax
mov bx, ax
mov ax, 0xe20
int 0x10 ; print space
mov al, bl
int 0x10 ; print char
call printCRLF
jmp .keyprint_loop
.end_keyprint:
popa
ret
dumpax_os: dumpax_os:
pusha ; save registers pusha ; save registers
mov bx, ax mov bx, ax

Loading…
Cancel
Save