I started on making a bootloader from scratch in FASM. I just made a basic input. But I don't know how to do something.
This is my code:
start:
mov ax, 07C0h
add ax, 288
mov ss, ax
mov sp, 4096
mov ax, 07C0h
mov ds, ax
mov si, text_string
call print_string
jmp read ; infinite loop of reading!
text_string db '<HammerOS> : Booted up!', 13, 10, 0
read:
mov ah,0h ;get character from keyboard
int 16h ;and store it in AL
mov ah,0eh ;Display a character in AL
int 10h ;aka, echo it
jmp read
have_read_txt:
mov si, AL
call print_string
print_string:
mov ah, 0Eh
.repeat:
lodsb
cmp al, 0
je .done
int 10h
jmp .repeat
.done:
ret
times 510-($-$$) db 0
dw 0xAA55
What it does it it accepts input on console, but when I press enter I want to check the content of the input and based on that I want to do stuff.
Also, I want the cursor to go to the next line. Now if I press enter the text will write over the same line.
In place where you get the char and then write it on screen you will also need to store the char in some memory buffer.
When you detect 'enter' key by comparing AL with 'enter' key code, which should be 13 or 10, you need to analyze your buffer and do stuff. List of ascii codes here ; may be usefull.
If you want to move your cursor, take a look at int 10h (which you already use) description: BIOS interrupt call .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.