Hallo,
ich habe versucht einen Handler fuer das Keyboard zu setzen, doch leider klappt dies irgendwie nicht. (keyboard_handler wird nie aufgerufen)
Ein weiteres Problem ist, dass nach dem call show_info der Kernel irgendwie haengen bleibt und ich kann mir nichts ausdenken, was dazu fuehren koennte. Eine unmittelbare Ausgabe auf den Bildschirm nach call show_info funktioniert nicht, d.h das jmp _continue nach call show_info wird gar nicht erst aufgerufen.
Code:
mov ax, 0x1000 ;update segment register...
mov ds, ax
mov es, ax
init0:
mov si,s_noos_init0
call noos_putstr
mov bl, 0x05
mov si, s_noos_logo
call noos_printf
mov bl, 0x02
mov si, s_noos_jmp_good
call noos_printf
call noos_inc_line
call noos_reset_line
mov bl, 0x05
mov si, s_noos_logo
call noos_printf
mov bl, 0x02
mov si, s_noos_step1
call noos_printf
call noos_inc_line
call noos_reset_line
push dx
push es
xor ax, ax
mov es, ax
cli
mov word [es:0x21*4], _int0x021
mov [es:0x21*4+2], cs
mov word[ds:(9*4) ], keyboard_handler ;Offset
mov word[ds:(9*4)+2], 0 ;Segment
sti
pop es
pop dx
mov bl, 0x05
mov si, s_noos_logo
mov dl, 0x03
int 0x021
mov bl, 0x02
mov si, s_noos_step2
mov dl, 0x03
int 0x021
mov dl, 0x07
int 0x021
mov dl, 0x08
int 0x021
mov bl, 0x05
mov si, s_noos_logo
mov dl, 0x03
int 0x021
mov bl, 0x02
mov si, s_noos_step3
mov dl, 0x03
int 0x021
mov dl, 0x07
int 0x021
mov dl, 0x08
int 0x021
mov bl, 0x05
mov si, s_noos_logo
mov dl, 0x03
int 0x021
mov bl, 0x02
mov si, s_noos_step4
mov dl, 0x03
int 0x021
mov dl, 0x09
int 0x021
mov bl, 0x06
mov dl, 0x03
int 0x021
mov dl, 0x07
int 0x021
mov dl, 0x08
int 0x021
mov bl, 0x0A
mov si, s_noos_i_info
mov dl, 0x03
int 0x021
mov dl, 0x07
int 0x021
mov dl, 0x08
int 0x021
loopi:
mov ah,00h
int 16h
mov bl,0x08
cmp al,0x31
je do_show_info
cmp al,0x32
je do_calc_test
jmp _continue
do_show_info:
call show_info
jmp _continue
do_calc_test:
call calc_test
jmp _continue
_continue:
call noos_putchar
call noos_inc_row
call noos_inc_line
call noos_reset_line
jmp loopi
;Variablen
;========
s_noos_init0 db "Init 0",13,10,0
s_noos_logo db "[ NoOS ]",0
s_noos_jmp_good db " Jump into kernel successful",0
s_noos_step1 db " Setting up syscalls",0
s_noos_step2 db " Syscalls (INT 0x021) set",0
s_noos_step3 db " Reading from CMOS (Month)",0
s_noos_step4 db " And the month is: ",0
s_noos_keyp db "KEY_PRESSED",0
s_noos_i_info db "Options",13,9,"1.) Show copyright",13,9,"2.) Calc test",0
s_noos_i_autor db "NoOS (c) by Roman Muentener",0
s_noos_i_calc_end db "Calc test done...",0
;Funktionen
;========
calc_test:
mov cx, 0xFFFF
calc_test_loop:
cmp cx,0
je calc_test_end
dec cx
jmp calc_test_loop
calc_test_end:
mov bl,0xA8
mov si,s_noos_i_calc_end
mov dl,0x03
int 0x021
retn
show_info:
mov bl,0x0D
mov si,s_noos_i_autor
mov dl,0x03
int 0x021
retn
keyboard_handler:
mov si,s_noos_keyp
mov bl,0x02
mov dl,0x03
int 0x021
mov al, 0x20
out 0x20, al
iret
noos_reset_line:
call noos_get_cursor_pos
mov dl,0
call noos_set_cursor_pos
retn
;ret: DL = Spalte; ret: DH = Zeile
noos_get_cursor_pos:
mov ah, 0x03
int 0x10
retn
;DL = Spalte; DH = Zeile
noos_set_cursor_pos:
mov ah, 0x02
push bx
xor bh, bh
int 0x10
pop bx
retn
noos_inc_line:
call noos_get_cursor_pos
inc dh
call noos_set_cursor_pos
retn
noos_inc_row:
call noos_get_cursor_pos
inc dl
call noos_set_cursor_pos
retn
;SI = string
noos_printf:
lodsb
or al,al
jz noos_printf_end
call noos_putchar
call noos_inc_row
jmp noos_printf
noos_printf_end:
retn
;AL = char; BL = Farbe
noos_putchar:
push cx
mov cx, 1
mov ah, 0x09
int 0x10
pop cx
retn
;SI = string
noos_putstr:
lodsb
or al, al
jz noos_putstr_end
mov ah, 0x0E
mov bx, 0x07
int 0x10
jmp noos_putstr
noos_putstr_end:
retn
noos_reboot:
jmp 0xffff:0x0000
noos_getkey:
mov ah,00h
int 0x16
retn
;-------
;Syscalls
;-------
_int0x021:
cmp dl, 0x01
je _int0x021_f1
cmp dl, 0x02
je _int0x021_f2
cmp dl, 0x03
je _int0x021_f3
cmp dl, 0x04
je _int0x021_f4
cmp dl, 0x05
je _int0x021_f5
cmp dl, 0x06
je _int0x021_f6
cmp dl, 0x07
je _int0x021_f7
cmp dl, 0x08
je _int0x021_f8
cmp dl, 0x09
je _int0x021_f9
iret
;noos_putstr: SI = string
_int0x021_f1:
push dx
lodsb
or al, al
jmp _int0x021_f1_end
mov ah, 0x0E
mov bx, 0x07
int 0x10
_int0x021_f1_end:
pop dx
retn
;noos_putchar: AL = char, BL = farbe
_int0x021_f2:
push dx
push cx
cmp al, 0xD
je _int0x021_f2_newline
cmp al, 0x09
je _int0x021_f2_tab
mov cx, 1
mov bh, 0x00
mov ah, 0x09
int 0x10
call _int0x021_f4
jmp _int0x021_f2_end
_int0x021_f2_tab:
call _int0x021_f4
call _int0x021_f4
call _int0x021_f4
call _int0x021_f4
jmp _int0x021_f2_end
_int0x021_f2_newline:
call _int0x021_f7
call _int0x021_f8
_int0x021_f2_end:
pop cx
pop dx
retn
;noos_printf: SI = string, BL = farbe
_int0x021_f3:
push dx
lodsb
or al,al
jz _int0x021_f3_end
call _int0x021_f2
pop dx
jmp _int0x021_f3
_int0x021_f3_end:
pop dx
retn
;noos_inc_row
_int0x021_f4:
push dx
call _int0x021_f5
inc al
call _int0x021_f6
pop dx
retn
;noos_get_cursor_pos: ret: AL = Spalte; ret: AH = Zeile
_int0x021_f5:
push dx
mov ah, 0x03
int 0x10
mov al,dl
mov ah,dh
pop dx
retn
;noos_set_cursor_pos: ;AL = Spalte; AH = Zeile
_int0x021_f6:
push dx
mov dl,al
mov dh,ah
mov ah, 0x02
push bx
xor bh, bh
int 0x10
pop bx
pop dx
retn
;noos_inc_line
_int0x021_f7:
push dx
call _int0x021_f5
inc ah
call _int0x021_f6
pop dx
retn
;noos_reset_line
_int0x021_f8:
push dx
call _int0x021_f5
mov al,0
call _int0x021_f6
pop dx
retn
;noos_get_month
_int0x021_f9:
push dx
mov al,0x08
out 0x70,al
in al,0x71
cmp al,0x01
je _int0x021_f9_jan
cmp al,0x02
je _int0x021_f9_feb
cmp al,0x03
je _int0x021_f9_mar
cmp al,0x04
je _int0x021_f9_apr
cmp al,0x05
je _int0x021_f9_may
cmp al,0x06
je _int0x021_f9_jun
cmp al,0x07
je _int0x021_f9_jul
cmp al,0x08
je _int0x021_f9_aug
cmp al,0x09
je _int0x021_f9_sep
cmp al,0x0A
je _int0x021_f9_oct
cmp al,0x0B
je _int0x021_f9_nov
cmp al,0x0C
je _int0x021_f9_dec
je _int0x021_f9_end
_int0x021_f9_jan:
mov si,jan
jmp _int0x021_f9_end
_int0x021_f9_feb:
mov si,feb
jmp _int0x021_f9_end
_int0x021_f9_mar:
mov si,mar
jmp _int0x021_f9_end
_int0x021_f9_apr:
mov si,apr
jmp _int0x021_f9_end
_int0x021_f9_may:
mov si,may
jmp _int0x021_f9_end
_int0x021_f9_jun:
mov si,jun
jmp _int0x021_f9_end
_int0x021_f9_jul:
mov si,jul
jmp _int0x021_f9_end
_int0x021_f9_aug:
mov si,aug
jmp _int0x021_f9_end
_int0x021_f9_sep:
mov si,sep
jmp _int0x021_f9_end
_int0x021_f9_oct:
mov si,oct
jmp _int0x021_f9_end
_int0x021_f9_nov:
mov si,nov
jmp _int0x021_f9_end
_int0x021_f9_dec:
mov si,dec_
jmp _int0x021_f9_end
mov si,unk
_int0x021_f9_end:
pop dx
retn
retn
_int0x021_end:
iret
jan db "January",0
feb db "February",0
mar db "March",0
apr db "April",0
may db "May",0
jun db "June",0
jul db "July",0
aug db "August",0
sep db "September",0
oct db "October",0
nov db "November",0
dec_ db "December",0
unk db "Unknown",0
times 1474048-($-$$) db 0
Etwas viel ich weiss, aber ich hoffe ihr koennt mir weiterhelfen.