]>
wirehaze git hosting - BOS.git/blob - kernel/int/debug.asm
4c1fe1939ca76f2bc0f6f5254dcf26d96f79ce90
1 ;----------------------------------------------------------;
2 ; BOS kernel Christoffer Bubach, 2004-2005. ;
3 ;----------------------------------------------------------;
5 ; BOS mighty debugging service, dump some regs.. ;
7 ;----------------------------------------------------------;
12 dbg_head db 'ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»',0
13 dbg_head2 db 'º BOS 0.04 - ERROR: ',0
15 dbg_press db 'º Press any key to continue... º',0
16 dbg_restart db 'º Press a key to restart the PC... º',0
17 dbg_footer db 'ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ',0
18 dbg_close_row db ' º',0
19 dbg_keypress db 1 ; 0 = restart, 1 = wait for key
20 dbg_error db ' none. ',0 ; error msg to show, max 14 chars
22 ;--------------------------------------;
23 ; I'll start with the common regs.. ;
24 ;--------------------------------------;
25 debug_eax db 'º EAX: 0x', 0
26 debug_ebx db ' EBX: 0x', 0
27 debug_ecx db 'º ECX: 0x', 0
28 debug_edx db ' EDX: 0x', 0
29 debug_esp db 'º ESP: 0x', 0
30 debug_ebp db ' EBP: 0x', 0
31 debug_esi db 'º ESI: 0x', 0
32 debug_edi db ' EDI: 0x', 0
46 ;-----------------------------------;
47 ; "fake stack" to save regs on.. ;
48 ;-----------------------------------;
54 ;-------------------------------;
55 ; original cursor placment.. ;
56 ;-------------------------------;
59 ;-------------------------------------------------;
60 ; mostly in debug purpose, and in lack of MM.. ;
61 ;-------------------------------------------------;
62 scr_buffer: times 180 dd 0 ; 720 = box buffer size (char+attrib)
65 ;--------------------------------------------;
66 ; dump regs.. does not use the stack. ;
67 ;--------------------------------------------;
79 mov [state_cursor
], bx
81 mov dx, 0 ; row counter
82 mov esi, (0xB8000+840)
85 mov cx, 0 ; col counter
87 movsb ; copy creen content
88 inc cx ; increase counter
89 cmp cx, 72 ; have we copied 72 bytes?
90 je .end_small
; if we have, end small loop
91 jmp .small_loop
; if not continue with next byte
93 inc dx ; increase row count
94 cmp dx, 10 ; check if all ten is copied
95 je .end_big
; if it is, end.
96 add esi, 88 ; else continue with next row
100 mov bx, 420 ; row 5 char 20
104 mov bx, 500 ; row 6 char 20
110 mov ebp, dbg_close_row
112 mov bx, 580 ; row 7 char 20
118 mov bx, 660 ; row 8 char 20
122 mov eax, [state_eax
] ; eax
126 mov eax, [state_ebx
] ; ebx
128 mov ebp, dbg_close_row
131 mov bx, 740 ; row 9 char 20
135 mov eax, [state_ecx
] ; ecx
139 mov eax, [state_edx
] ; edx
141 mov ebp, dbg_close_row
144 mov bx, 820 ; row 10 char 20
148 mov eax, [state_esp
] ; esp
152 mov eax, [state_ebp
] ; ebp
154 mov ebp, dbg_close_row
157 mov bx, 900 ; row 11 char 20
161 mov eax, [state_esi
] ; esi
165 mov eax, [state_edi
] ; edi
167 mov ebp, dbg_close_row
170 mov bx, 980 ; row 12 char 20
174 mov bx, 1140 ; row 14 char 20
178 mov bx, 1060 ; row 13 char 20
181 cmp [dbg_keypress
], 1
184 ;----------------------------------;
185 ; wait for scancode and restart ;
186 ;----------------------------------;
189 mov bx, 1093 ; row 13 char 46
210 movzx eax, [kbd_tail
]
212 mov ah, byte [esi] ; ah = scancode
213 cmp ah, 0xFA ; check for some stuff..
222 call reboot
; in commands.inc
224 ;--------------------------;
225 ; wait for key and quit ;
226 ;--------------------------;
230 mov bx, 1091 ; row 13 char 51
236 cmp ah, 63 ; if we are at the buffer end,
237 jne .check2
; we must check that head != 0
239 je .no_new2
; we don't have new keys to read
240 mov [kbd_tail
], 0 ; "increase" to 0 (loop buffer)
244 inc bl ; head should be +1 compared to tail
247 inc [kbd_tail
] ; increase
250 movzx eax, [kbd_tail
]
252 mov ah, byte [esi] ; ah = scancode
253 cmp ah, 0xFA ; check for some stuff..
262 mov dx, 0 ; restore screen as
263 mov edi, (0xB8000+840) ; it was before.
264 mov esi, scr_buffer
; same loops as above
265 .big_loop2: ; but exchanged esi and edi
281 mov bx, [state_cursor
]
283 mov [dbg_keypress
], 1
284 mov [dbg_error
], ' ' ; restore variables.
285 mov [dbg_error
+1], 'n' ; ugly..
286 mov [dbg_error
+2], 'o'
287 mov [dbg_error
+3], 'n'
288 mov [dbg_error
+4], 'e'
289 mov [dbg_error
+5], '.'
290 mov [dbg_error
+6], ' '
291 mov [dbg_error
+7], ' '
292 mov [dbg_error
+8], ' '
293 mov [dbg_error
+9], ' '
294 mov [dbg_error
+10], ' '
295 mov [dbg_error
+11], ' '
296 mov [dbg_error
+12], ' '
297 mov [dbg_error
+13], ' '
298 mov [dbg_error
+14], 0
301 ;-------------------------------;
302 ; subfunctions to inc cursor ;
303 ;-------------------------------;
305 mov [stack_eax2
], eax
306 mov [stack_edx
], edx ; can it get any uglier?
315 mov eax, [stack_eax2
]
318 mov [stack_eax2
], eax
333 mov eax, [stack_eax2
]
335 ;--------------------------------;
336 ; subfunction to print a char ;
337 ; bl = char, bh = attrib ;
338 ;--------------------------------;
345 mov [es:(eax*2 + 0xB8000)], bx
352 ;------------------------------------------;
353 ; subfunction to print 32-bit hex value ;
354 ; IN: eax = value, bh = color. ;
355 ;------------------------------------------;
371 ;-----------------------------------------;
372 ; subfunction to display asciiz string ;
373 ; Input: ebp = string ;
374 ;-----------------------------------------;
380 mov bh, 0x40 ; standard color for this...