remove define_info macro, improved cstr macro and renamed all the OK/Msg debug strings

This commit is contained in:
2025-09-13 13:45:37 -04:00
parent 721ff2e62d
commit 526c3e7ea5

View File

@@ -39,7 +39,7 @@ begin_text:
ALIGN 16, db 0x90 ALIGN 16, db 0x90
init: init:
cli ; We do not want to be interrupted cli ; We do not want to be interrupted
mov [boot_drive], dl ; copy boot_drive to globals mov [u8BootDrive], dl ; copy boot_drive to globals
mov ax, __STAGE2_SEGMENT ; set all our segments to the configured segment, except es mov ax, __STAGE2_SEGMENT ; set all our segments to the configured segment, except es
mov ds, ax ; * mov ds, ax ; *
@@ -128,7 +128,7 @@ main:
__CDECL16_CALL_ARGS early_heap_state __CDECL16_CALL_ARGS early_heap_state
__CDECL16_CALL arena_init, 1 __CDECL16_CALL arena_init, 1
__CDECL16_CALL_ARGS HelloPrompt_info __CDECL16_CALL_ARGS pszHelloPrompt
__CDECL16_CALL PrintString, 1 __CDECL16_CALL PrintString, 1
; setup and store our vbr/mbr (e)bpb ; setup and store our vbr/mbr (e)bpb
@@ -137,7 +137,7 @@ main:
mov word [mbr_ptr], ax mov word [mbr_ptr], ax
push ax ; dst push ax ; dst
movzx ax, byte [boot_drive] movzx ax, byte [u8BootDrive]
push ax ; boot_drive push ax ; boot_drive
__CDECL16_CALL read_mbr, 2 ; fill mbr buffer __CDECL16_CALL read_mbr, 2 ; fill mbr buffer
@@ -146,18 +146,18 @@ main:
mov word [vbr_ptr], ax mov word [vbr_ptr], ax
push ax ; dst push ax ; dst
movzx ax, byte [boot_drive] movzx ax, byte [u8BootDrive]
push ax ; boot_drive push ax ; boot_drive
__CDECL16_CALL read_vbr, 2 ; fill vbr buffer __CDECL16_CALL read_vbr, 2 ; fill vbr buffer
; enable A20 gate ; enable A20 gate
call EnableA20 call EnableA20
__CDECL16_CALL_ARGS A20_Enabled_OK_info __CDECL16_CALL_ARGS pszA20EnabledOk
__CDECL16_CALL PrintString, 1 __CDECL16_CALL PrintString, 1
; get system memory map ; get system memory map
call GetMemoryMap call GetMemoryMap
__CDECL16_CALL_ARGS MemoryMap_OK_info __CDECL16_CALL_ARGS pszMemoryMapOk
__CDECL16_CALL PrintString, 1 __CDECL16_CALL PrintString, 1
; enter unreal mode (enter PM w/ 16 bit code, 32 bit flat memory model & return to real) ; enter unreal mode (enter PM w/ 16 bit code, 32 bit flat memory model & return to real)
@@ -165,12 +165,12 @@ main:
; use __REFLAT macros to re-flat ds/es for easy transfers to >1MiB ; use __REFLAT macros to re-flat ds/es for easy transfers to >1MiB
; NOTE: if you modify a segment register you will need to re-unreal it ; NOTE: if you modify a segment register you will need to re-unreal it
call EnterUnrealMode call EnterUnrealMode
__CDECL16_CALL_ARGS UnrealMode_OK_info __CDECL16_CALL_ARGS pszUnrealModeOk
__CDECL16_CALL PrintString, 1 __CDECL16_CALL PrintString, 1
; FAT Driver setup ; FAT Driver setup
;call InitFATDriver ;call InitFATDriver
;__CDECL16_CALL_ARGS InitFATSYS_OK_info ;__CDECL16_CALL_ARGS pszInitFAT32Ok
;__CDECL16_CALL PrintString, 1 ;__CDECL16_CALL PrintString, 1
; ;
@@ -178,7 +178,7 @@ main:
;call SearchFATDIR ;call SearchFATDIR
;push dword eax ; save first cluster of bootable file ;push dword eax ; save first cluster of bootable file
;__CDECL16_CALL_ARGS FileFound_OK_info ;__CDECL16_CALL_ARGS pszFileFoundMsg
;__CDECL16_CALL PrintString, 1 ;__CDECL16_CALL PrintString, 1
;pop dword eax ;pop dword eax
@@ -385,41 +385,36 @@ begin_data:
; ############# ; #############
%define CRLF 0Dh, 0Ah %define CRLF 0Dh, 0Ah
%macro define_cstr 2 %macro define_cstr 2-*
%if %0 > 2
align 16 align 16
%1_cstr: %1:
db %{2:-1}, 00h
%else
align 16
%1:
db %2, 00h db %2, 00h
%endif
%endmacro %endmacro
%macro define_info 2 define_cstr pszHelloPrompt, "Hello from Stevia Stage2!", CRLF
align 16 define_cstr pszA20EnabledOk, "A20 Enabled OK", CRLF
%1_info: define_cstr pszMemoryMapOk, "Memory map OK", CRLF
db %2, CRLF, 00h define_cstr pszUnrealModeOk, "Unreal mode OK", CRLF
%endmacro define_cstr pszInitFAT32Ok, "FAT32 Driver Init OK", CRLF
define_info HelloPrompt, "Hello from Stevia Stage2!" define_cstr pszFileFoundMsg, "Found SFN entry for bootable binary, first cluster -> ", CRLF
define_info A20_Enabled_OK, "A20 Enabled OK" define_cstr pszSearchFAT32DirMsg, "Searching FAT fs for bootable file...", CRLF
define_info MemoryMap_OK, "Memory map OK" define_cstr pszReadFAT32ClusterMsg, "Attempting to load next FAT", CRLF
define_info UnrealMode_OK, "Unreal mode OK" define_cstr pszMaybeFoundBootMsg, "Maybe found a file...checking...", CRLF
define_info FileFound_OK, "Found SFN entry for bootable binary, first cluster -> "
define_info InitFATSYS_OK, "FAT32 Driver Init..."
define_info SearchFATDIR, "Searching FAT DIR for bootable file..."
define_info NextFATCluster, "Attempting to find next FAT cluster..."
define_info ReadFATCluster, "Attempting to load next FAT"
define_info MaybeFound_Boot, "Maybe found a file...checking..."
define_cstr BootTarget, "BOOT BIN" define_cstr BootTarget, "BOOT BIN"
; set to boot_drive passed from BIOS almost first thing in init ; set to boot_drive passed from BIOS almost first thing in init
align 4, db 0 align 4, db 0
boot_drive: u8BootDrive:
db 0x00 db 0x00
align 16, db 0
BootTarget:
db 'BOOT BIN'
align 16, db 0 align 16, db 0
IntToHex_table: IntToHex_table:
db '0123456789ABCDEF' db '0123456789ABCDEF'