- dbg_head db 'ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»',0\r
- dbg_head2 db 'º BOS 0.05 - ERROR: ',0\r
- dbg_head3 db 'º º',0\r
- dbg_press db 'º Press any key to continue... º',0\r
- dbg_restart db 'º Press a key to restart the PC... º',0\r
- dbg_footer db 'ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ',0\r
- dbg_close_row db ' º',0\r
- dbg_keypress db 1 ; 0 = restart, 1 = wait for key\r
- dbg_error db ' none. ',0 ; error msg to show, max 14 chars\r
+ dbg_head db 'ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»',0\r
+ dbg_head2 db 'º BOS 0.05 - ERROR: ',0\r
+ dbg_head3 db 'º º',0\r
+ dbg_press db 'º Press any key to continue... º',0\r
+ dbg_restart db 'º Press a key to restart the PC... º',0\r
+ dbg_footer db 'ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ',0\r
+ dbg_close_row db ' º',0\r
+ dbg_keypress db 1 ; 0 = restart, 1 = wait for key\r
+ dbg_error db ' none. ',0 ; error msg to show, max 14 chars\r
- ;--------------------------------------;\r
- ; I'll start with the common regs.. ;\r
- ;--------------------------------------;\r
- debug_eax db 'º EAX: 0x', 0\r
- debug_ebx db ' EBX: 0x', 0\r
- debug_ecx db 'º ECX: 0x', 0\r
- debug_edx db ' EDX: 0x', 0\r
- debug_esp db 'º ESP: 0x', 0\r
- debug_ebp db ' EBP: 0x', 0\r
- debug_esi db 'º ESI: 0x', 0\r
- debug_edi db ' EDI: 0x', 0\r
+ ;--------------------------------------;\r
+ ; I'll start with the common regs.. ;\r
+ ;--------------------------------------;\r
+ debug_eax db 'º EAX: 0x', 0\r
+ debug_ebx db ' EBX: 0x', 0\r
+ debug_ecx db 'º ECX: 0x', 0\r
+ debug_edx db ' EDX: 0x', 0\r
+ debug_esp db 'º ESP: 0x', 0\r
+ debug_ebp db ' EBP: 0x', 0\r
+ debug_esi db 'º ESI: 0x', 0\r
+ debug_edi db ' EDI: 0x', 0\r
- ;-----------------------------------;\r
- ; "fake stack" to save regs on.. ;\r
- ;-----------------------------------;\r
- stack_eax dd 0\r
- stack_eax2 dd 0\r
- stack_ebx dd 0\r
- stack_edx dd 0\r
+ ;-----------------------------------;\r
+ ; "fake stack" to save regs on.. ;\r
+ ;-----------------------------------;\r
+ stack_eax dd 0\r
+ stack_eax2 dd 0\r
+ stack_ebx dd 0\r
+ stack_edx dd 0\r
\r
;-------------------------------------------------;\r
; mostly in debug purpose, and in lack of MM.. ;\r
;-------------------------------------------------;\r
\r
;-------------------------------------------------;\r
; mostly in debug purpose, and in lack of MM.. ;\r
;-------------------------------------------------;\r
\r
\r
;--------------------------------------------;\r
; dump regs.. does not use the stack. ;\r
;--------------------------------------------;\r
dump_regs:\r
\r
\r
;--------------------------------------------;\r
; dump regs.. does not use the stack. ;\r
;--------------------------------------------;\r
dump_regs:\r
- mov dx, 0 ; row counter\r
- mov esi, (0xB8000+840)\r
- mov edi, scr_buffer\r
- .big_loop:\r
- mov cx, 0 ; col counter\r
- .small_loop:\r
- movsb ; copy creen content\r
- inc cx ; increase counter\r
- cmp cx, 72 ; have we copied 72 bytes?\r
- je .end_small ; if we have, end small loop\r
- jmp .small_loop ; if not continue with next byte\r
- .end_small:\r
- inc dx ; increase row count\r
- cmp dx, 10 ; check if all ten is copied\r
- je .end_big ; if it is, end.\r
- add esi, 88 ; else continue with next row\r
- jmp .big_loop\r
+ mov dx, 0 ; row counter\r
+ mov esi, (0xB8000+840)\r
+ mov edi, scr_buffer\r
+ .big_loop:\r
+ mov cx, 0 ; col counter\r
+ .small_loop:\r
+ movsb ; copy creen content\r
+ inc cx ; increase counter\r
+ cmp cx, 72 ; have we copied 72 bytes?\r
+ je .end_small ; if we have, end small loop\r
+ jmp .small_loop ; if not continue with next byte\r
+ .end_small:\r
+ inc dx ; increase row count\r
+ cmp dx, 10 ; check if all ten is copied\r
+ je .end_big ; if it is, end.\r
+ add esi, 88 ; else continue with next row\r
+ jmp .big_loop\r
- mov bx, 420 ; row 5 char 20\r
- call .set_cur\r
- mov ebp, dbg_head\r
- call .print\r
- mov bx, 500 ; row 6 char 20\r
- call .set_cur\r
- mov ebp, dbg_head2\r
- call .print\r
- mov ebp, dbg_error\r
- call .print\r
- mov ebp, dbg_close_row\r
- call .print\r
- mov bx, 580 ; row 7 char 20\r
- call .set_cur\r
- mov ebp, dbg_head3\r
- call .print\r
+ mov bx, 420 ; row 5 char 20\r
+ call .set_cur\r
+ mov ebp, dbg_head\r
+ call .print\r
+ mov bx, 500 ; row 6 char 20\r
+ call .set_cur\r
+ mov ebp, dbg_head2\r
+ call .print\r
+ mov ebp, dbg_error\r
+ call .print\r
+ mov ebp, dbg_close_row\r
+ call .print\r
+ mov bx, 580 ; row 7 char 20\r
+ call .set_cur\r
+ mov ebp, dbg_head3\r
+ call .print\r
- mov bx, 660 ; row 8 char 20\r
- call .set_cur\r
- mov ebp, debug_eax\r
- call .print\r
- mov eax, [state_eax] ; eax\r
- call .print_hex32\r
- mov ebp, debug_ebx\r
- call .print\r
- mov eax, [state_ebx] ; ebx\r
- call .print_hex32\r
- mov ebp, dbg_close_row\r
- call .print\r
+ mov bx, 660 ; row 8 char 20\r
+ call .set_cur\r
+ mov ebp, debug_eax\r
+ call .print\r
+ mov eax, [state_eax] ; eax\r
+ call .print_hex32\r
+ mov ebp, debug_ebx\r
+ call .print\r
+ mov eax, [state_ebx] ; ebx\r
+ call .print_hex32\r
+ mov ebp, dbg_close_row\r
+ call .print\r
- mov bx, 740 ; row 9 char 20\r
- call .set_cur\r
- mov ebp, debug_ecx\r
- call .print\r
- mov eax, [state_ecx] ; ecx\r
- call .print_hex32\r
- mov ebp, debug_edx\r
- call .print\r
- mov eax, [state_edx] ; edx\r
- call .print_hex32\r
- mov ebp, dbg_close_row\r
- call .print\r
+ mov bx, 740 ; row 9 char 20\r
+ call .set_cur\r
+ mov ebp, debug_ecx\r
+ call .print\r
+ mov eax, [state_ecx] ; ecx\r
+ call .print_hex32\r
+ mov ebp, debug_edx\r
+ call .print\r
+ mov eax, [state_edx] ; edx\r
+ call .print_hex32\r
+ mov ebp, dbg_close_row\r
+ call .print\r
- mov bx, 820 ; row 10 char 20\r
- call .set_cur\r
- mov ebp, debug_esp\r
- call .print\r
- mov eax, [state_esp] ; esp\r
- call .print_hex32\r
- mov ebp, debug_ebp\r
- call .print\r
- mov eax, [state_ebp] ; ebp\r
- call .print_hex32\r
- mov ebp, dbg_close_row\r
- call .print\r
+ mov bx, 820 ; row 10 char 20\r
+ call .set_cur\r
+ mov ebp, debug_esp\r
+ call .print\r
+ mov eax, [state_esp] ; esp\r
+ call .print_hex32\r
+ mov ebp, debug_ebp\r
+ call .print\r
+ mov eax, [state_ebp] ; ebp\r
+ call .print_hex32\r
+ mov ebp, dbg_close_row\r
+ call .print\r
- mov bx, 900 ; row 11 char 20\r
- call .set_cur\r
- mov ebp, debug_esi\r
- call .print\r
- mov eax, [state_esi] ; esi\r
- call .print_hex32\r
- mov ebp, debug_edi\r
- call .print\r
- mov eax, [state_edi] ; edi\r
- call .print_hex32\r
- mov ebp, dbg_close_row\r
- call .print\r
+ mov bx, 900 ; row 11 char 20\r
+ call .set_cur\r
+ mov ebp, debug_esi\r
+ call .print\r
+ mov eax, [state_esi] ; esi\r
+ call .print_hex32\r
+ mov ebp, debug_edi\r
+ call .print\r
+ mov eax, [state_edi] ; edi\r
+ call .print_hex32\r
+ mov ebp, dbg_close_row\r
+ call .print\r
- mov bx, 980 ; row 12 char 20\r
- call .set_cur\r
- mov ebp, dbg_head3\r
- call .print\r
- mov bx, 1140 ; row 14 char 20\r
- call .set_cur\r
- mov ebp, dbg_footer\r
- call .print\r
- mov bx, 1060 ; row 13 char 20\r
- call .set_cur\r
+ mov bx, 980 ; row 12 char 20\r
+ call .set_cur\r
+ mov ebp, dbg_head3\r
+ call .print\r
+ mov bx, 1140 ; row 14 char 20\r
+ call .set_cur\r
+ mov ebp, dbg_footer\r
+ call .print\r
+ mov bx, 1060 ; row 13 char 20\r
+ call .set_cur\r
- mov esi, kbd_buffer\r
- movzx eax, [kbd_tail]\r
- add esi, eax\r
- mov ah, byte [esi] ; ah = scancode\r
- cmp ah, 0xFA ; check for some stuff..\r
- je .no_new1\r
- cmp ah, 0xE0\r
- je .no_new1\r
- cmp ah, 0xE1\r
- je .no_new1\r
- test ah, 0x80\r
- jnz .no_new1\r
+ mov esi, kbd_buffer\r
+ movzx eax, [kbd_tail]\r
+ add esi, eax\r
+ mov ah, byte [esi] ; ah = scancode\r
+ cmp ah, 0xFA ; check for some stuff..\r
+ je .no_new1\r
+ cmp ah, 0xE0\r
+ je .no_new1\r
+ cmp ah, 0xE1\r
+ je .no_new1\r
+ test ah, 0x80\r
+ jnz .no_new1\r
- mov al, [kbd_head]\r
- mov ah, [kbd_tail]\r
- cmp ah, 63 ; if we are at the buffer end,\r
- jne .check2 ; we must check that head != 0\r
- cmp al, 0\r
- je .no_new2 ; we don't have new keys to read\r
- mov [kbd_tail], 0 ; "increase" to 0 (loop buffer)\r
- jmp .done_check2\r
+ mov al, [kbd_head]\r
+ mov ah, [kbd_tail]\r
+ cmp ah, 63 ; if we are at the buffer end,\r
+ jne .check2 ; we must check that head != 0\r
+ cmp al, 0\r
+ je .no_new2 ; we don't have new keys to read\r
+ mov [kbd_tail], 0 ; "increase" to 0 (loop buffer)\r
+ jmp .done_check2\r
- mov esi, kbd_buffer\r
- movzx eax, [kbd_tail]\r
- add esi, eax\r
- mov ah, byte [esi] ; ah = scancode\r
- cmp ah, 0xFA ; check for some stuff..\r
- je .no_new2\r
- cmp ah, 0xE0\r
- je .no_new2\r
- cmp ah, 0xE1\r
- je .no_new2\r
- test ah, 0x80\r
- jnz .no_new2\r
+ mov esi, kbd_buffer\r
+ movzx eax, [kbd_tail]\r
+ add esi, eax\r
+ mov ah, byte [esi] ; ah = scancode\r
+ cmp ah, 0xFA ; check for some stuff..\r
+ je .no_new2\r
+ cmp ah, 0xE0\r
+ je .no_new2\r
+ cmp ah, 0xE1\r
+ je .no_new2\r
+ test ah, 0x80\r
+ jnz .no_new2\r
- mov dx, 0 ; restore screen as\r
- mov edi, (0xB8000+840) ; it was before.\r
- mov esi, scr_buffer ; same loops as above\r
- .big_loop2: ; but exchanged esi and edi\r
- mov cx, 0\r
+ mov dx, 0 ; restore screen as\r
+ mov edi, (0xB8000+840) ; it was before.\r
+ mov esi, scr_buffer ; same loops as above\r
+ .big_loop2: ; but exchanged esi and edi\r
+ mov cx, 0\r
- mov bx, [state_cursor]\r
- call .set_cur\r
- mov [dbg_keypress], 1\r
- mov [dbg_error], ' ' ; restore variables.\r
- mov [dbg_error+1], 'n' ; ugly..\r
- mov [dbg_error+2], 'o'\r
- mov [dbg_error+3], 'n'\r
- mov [dbg_error+4], 'e'\r
- mov [dbg_error+5], '.'\r
- mov [dbg_error+6], ' '\r
- mov [dbg_error+7], ' '\r
- mov [dbg_error+8], ' '\r
- mov [dbg_error+9], ' '\r
- mov [dbg_error+10], ' '\r
- mov [dbg_error+11], ' '\r
- mov [dbg_error+12], ' '\r
- mov [dbg_error+13], ' '\r
- mov [dbg_error+14], 0\r
- ret\r
+ mov bx, [state_cursor]\r
+ call .set_cur\r
+ mov [dbg_keypress], 1\r
+ mov [dbg_error], ' ' ; restore variables.\r
+ mov [dbg_error+1], 'n' ; ugly..\r
+ mov [dbg_error+2], 'o'\r
+ mov [dbg_error+3], 'n'\r
+ mov [dbg_error+4], 'e'\r
+ mov [dbg_error+5], '.'\r
+ mov [dbg_error+6], ' '\r
+ mov [dbg_error+7], ' '\r
+ mov [dbg_error+8], ' '\r
+ mov [dbg_error+9], ' '\r
+ mov [dbg_error+10], ' '\r
+ mov [dbg_error+11], ' '\r
+ mov [dbg_error+12], ' '\r
+ mov [dbg_error+13], ' '\r
+ mov [dbg_error+14], 0\r
+ ret\r
- mov [stack_eax2], eax\r
- mov [stack_edx], edx ; can it get any uglier?\r
- mov al, 0x0E\r
- mov ah, bh\r
- mov dx, 0x3D4\r
- out dx, ax\r
- inc ax\r
- mov ah, bl\r
- out dx, ax\r
- mov edx, [stack_edx]\r
- mov eax, [stack_eax2]\r
- ret\r
+ mov [stack_eax2], eax\r
+ mov [stack_edx], edx ; can it get any uglier?\r
+ mov al, 0x0E\r
+ mov ah, bh\r
+ mov dx, 0x3D4\r
+ out dx, ax\r
+ inc ax\r
+ mov ah, bl\r
+ out dx, ax\r
+ mov edx, [stack_edx]\r
+ mov eax, [stack_eax2]\r
+ ret\r
- mov [stack_eax2], eax\r
- mov [stack_edx], edx\r
- mov dx, 0x3D4\r
- mov al, 0x0E\r
- out dx, al\r
- inc dx\r
- in al, dx\r
- mov bh, al\r
- mov al, 0x0F\r
- dec dx\r
- out dx, al\r
- inc dx\r
- in al, dx\r
- mov bl, al\r
- mov edx, [stack_edx]\r
- mov eax, [stack_eax2]\r
- ret\r
- ;--------------------------------;\r
- ; subfunction to print a char ;\r
- ; bl = char, bh = attrib ;\r
- ;--------------------------------;\r
- .print_char:\r
- mov [stack_eax], eax\r
- mov [stack_ebx], ebx\r
- call .get_cur\r
- mov eax, ebx\r
- mov ebx, [stack_ebx]\r
- mov [es:(eax*2 + 0xB8000)], bx\r
- mov ebx, eax\r
- inc bx\r
- call .set_cur\r
- mov ebx, [stack_ebx]\r
- mov eax, [stack_eax]\r
- ret\r
+ mov [stack_eax2], eax\r
+ mov [stack_edx], edx\r
+ mov dx, 0x3D4\r
+ mov al, 0x0E\r
+ out dx, al\r
+ inc dx\r
+ in al, dx\r
+ mov bh, al\r
+ mov al, 0x0F\r
+ dec dx\r
+ out dx, al\r
+ inc dx\r
+ in al, dx\r
+ mov bl, al\r
+ mov edx, [stack_edx]\r
+ mov eax, [stack_eax2]\r
+ ret\r
+ ;--------------------------------;\r
+ ; subfunction to print a char ;\r
+ ; bl = char, bh = attrib ;\r
+ ;--------------------------------;\r
+ .print_char:\r
+ mov [stack_eax], eax\r
+ mov [stack_ebx], ebx\r
+ call .get_cur\r
+ mov eax, ebx\r
+ mov ebx, [stack_ebx]\r
+ mov [es:(eax*2 + 0xB8000)], bx\r
+ mov ebx, eax\r
+ inc bx\r
+ call .set_cur\r
+ mov ebx, [stack_ebx]\r
+ mov eax, [stack_eax]\r
+ ret\r
;------------------------------------------;\r
; subfunction to print 32-bit hex value ;\r
; IN: eax = value, bh = color. ;\r
;------------------------------------------;\r
.print_hex32:\r
;------------------------------------------;\r
; subfunction to print 32-bit hex value ;\r
; IN: eax = value, bh = color. ;\r
;------------------------------------------;\r
.print_hex32:\r
- mov bl, dl\r
- call .print_char\r
- loop .print_it\r
- ret\r
- ;-----------------------------------------;\r
- ; subfunction to display asciiz string ;\r
- ; Input: ebp = string ;\r
- ;-----------------------------------------;\r
- .print:\r
- mov al, byte [ebp]\r
- or al, al\r
- jz .done\r
- mov bl, al\r
- mov bh, 0x40 ; standard color for this...\r
- call .print_char\r
- inc ebp\r
- jmp .print\r
- .done:\r
- ret
\ No newline at end of file
+ mov bl, dl\r
+ call .print_char\r
+ loop .print_it\r
+ ret\r
+ ;-----------------------------------------;\r
+ ; subfunction to display asciiz string ;\r
+ ; Input: ebp = string ;\r
+ ;-----------------------------------------;\r
+ .print:\r
+ mov al, byte [ebp]\r
+ or al, al\r
+ jz .done\r
+ mov bl, al\r
+ mov bh, 0x40 ; standard color for this...\r
+ call .print_char\r
+ inc ebp\r
+ jmp .print\r
+ .done:\r
+ ret
\ No newline at end of file