I'm using x86 to make a cat program, hoping to turn it into a basic OS. I copied the starter code from MikeOS, and added some stuff of my own. It works fine with qemu, but when actually using a USB with the code copied to it, the computer clicks every time I press a key. Any ideas?
BITS 16
start:
mov ax, 07C0h ; Set up 4K stack space after this bootloader
add ax, 288 ; (4096 + 512) / 16 bytes per paragraph
mov ss, ax
mov sp, 4096
mov ax, 07C0h ; Set data segment to where we're loaded
mov ds, ax
mov si, text_string ; Put string position into SI
call print_string ; Call our string-printing routine
typel:
mov ah, 00h ; Set mode to read from keyboard
int 16h ; Read from keyboard
mov ah, 0Eh ; Set up printing
int 10h ; Print
jmp typel ; Typing loop
text_string db 'Starting SR|02',10,13,7,0
print_string: ; Routine: output string in SI to screen
mov ah, 0Eh ; int 10h 'print char' function
.repeat:
lodsb ; Get character from string
cmp al, 0
je .done ; If char is zero, end of string
int 10h ; Otherwise, print it
jmp .repeat
.done:
ret
times 510-($-$$) db 0 ; Pad remainder of boot sector with 0s
dw 0xAA55 ; The standard PC boot signature
Using American Megatrends Inc. Version: 1504