is that when i make a simple kernel that only prints a message everything's going fine. However, when i implement reading from the keyboard, nothing happens (only a blinking cursor appears). Here's my code
boot.asm
Code: Select all
; I used Daniel's tutor at os resources as a template
[BITS 16]
[ORG 0]
start:
mov ax,0x7C0
mov ds,ax
mov ax,0x0000
mov ss,ax
mov sp,0xFFFF
reset_drive:
mov ax, 0
mov dl, 0
int 13h
jc reset_drive
read:
mov ax,1000h ; ES:BX = 1000:0000
mov es,ax
mov bx,0 ;
mov ah,2 ; Load disk data to ES:BX
mov al,5 ; Load 5 sectors
mov ch,0 ; Cylinder=0
mov cl,2 ; Sector=2
mov dh,0 ; Head=0
mov dl,0 ; Drive=0
int 13h ; Read!
jc read ; ERROR => Try again
mov ax,0x1000
mov ds,ax
jmp 1000h:0000 ; Jump to the program
times 510-($-$$) db 0
dw 0AA55h
Code: Select all
[BITS 16]
setcursor: ; note i also tried it out without the setcursor function but with ;no success
mov ah,02
mov bh,00
mov dx,0x0100
int 10h
Main:
mov si,welcome
call print ; print welcome message
mov ax,0E0Ah; line feed
int 10h
mainloop:
call callpromt
call getcommand
print:
lodsb
cmp al,0
je printend
mov ah,0Eh
mov bh, 0Fh
mov bl, 0
int 10h
jmp print
printend:
ret
callpromt:
mov si,unixpromt
call print
;some data
welcome db 'Welcome to my Os!',0,13,10
unixpromt db 13,'root@default#',0
commandbuffer: times 10 db 0
getcommand:
mov di,commandbuffer
mov cx,10
mov dx,di
jmp get
get:
xor ax,ax
int 16h
cmp al,13
je carriage
cmp al,8
je backspace
mov bx,di
sub bx,dx
cmp bx,cx
mov ah,0Eh
mov bx,0x0001
int 10h
stosb
jmp get
backspace:
cmp di,commandbuffer
jbe get
dec di
mov al,8
mov ah,0Eh
mov bx,0x0001; go back cursor
int 10h
mov al,32 ; print a space
mov ah,0Eh
mov bx,0x0001
int 10h
mov al,8 ; go back again
mov ah,0Eh
mov bx,0x0001
int 10h
jmp get
carriage:
xor al,al
mov ax,0E0Ah
int 10h
call callpromt
jmp getcommand
; just print another promt and try again. No command processing for now