use bochs magic breakpoints in the error printer

makes it easier to get a good state to do some investigating before reseting.
This commit is contained in:
2024-10-13 20:53:13 -04:00
parent f32745a7e3
commit ad2d37c63b
3 changed files with 30 additions and 20 deletions

View File

@@ -20,7 +20,8 @@
%ifndef __INC_BOCHS_DEBUG_MAGIC
;
; for things like the error printer, opperate differently when we are targeting a dev (bochs) build
%define __STEVIA_DEV_DEBUG
; port_e9_hack: enabled=1 needs to be set in bochsrc.txt/bxrc
;
%ifnmacro __BOCHS_PRINTC

View File

@@ -22,7 +22,12 @@
%macro ERROR 1
mov al, %1 ; al = 1 byte error code mapped to ascii values
%ifdef __STEVIA_DEV_DEBUG
__BOCHS_MAGIC_DEBUG
%endif
jmp error
%endmacro
; pass error as ascii character in al, errors a-zA-Z or 0-9

View File

@@ -86,11 +86,13 @@ init:
mov ss, ax ; Set Stack Segment to data segment
mov sp, stack_top ; Set Stack Pointer
mov ax, init
push ax ; simulate a return value to the begining of the stage2 loader
push bp
mov bp, sp
sub sp, 0x20 ; 32 bytes for local varibles
sti
jmp word __STAGE2_SEGMENT:main
; ###############
@@ -106,11 +108,6 @@ init:
; FAT32 Driver
; ###############
boot_drive_ptr:
dw 0x0000
partition_offset_ptr:
dw 0x0000
%include 'fat32/FAT32_SYS.inc'
; ###############
@@ -191,7 +188,6 @@ main:
call InitFATDriver
print_string InitFATSYS_OK_cstr
ERROR STEVIA_DEBUG_HALT
;
; Find first cluster of bootable file
;
@@ -201,11 +197,9 @@ main:
push dword eax
call PrintDWORD ; void PrintDWORD(uint32_t dword)
add sp, 0x4
print_string NewLine_cstr
print_string NewLine_cstr
hcf:
hlt
jmp short (hcf - $$)
ERROR STEVIA_DEBUG_OK
; ##############################
;
@@ -505,6 +499,10 @@ stack_top:
stage2_main_redzone:
resb 32
;
; structures
;
align 16, resb 1
partition_table resb PartTable_t_size
@@ -518,19 +516,25 @@ fat32_nc_data resb 16
align 16, resb 1
lba_packet resb LBAPkt_t_size
align 16, resb 1
SteviaInfo:
resd 4
align 16, resb 1
fat32_state:
resb FAT32_State_t_size
align 16, resb 1
mbr_sector_data:
resb 512
vbr_sector_data:
resb 512
SteviaInfo:
resd 4
;
; locals
;
boot_drive_ptr:
resw 1
partition_offset_ptr:
resw 1
;
; large continuous allocations
;
align 16, resb 1
disk_buffer:
resb 512