From b5ae11f850212af32a538451ad5700710335916d Mon Sep 17 00:00:00 2001 From: Elaina Claus Date: Fri, 5 Sep 2025 15:43:22 -0400 Subject: [PATCH] set ds/es to a tiny memory model after entering Unreal mode ss/fs/gs will all be huge/flat model after --- include/cdecl16.inc | 4 ++-- src/stage2/stage2.nasm | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/include/cdecl16.inc b/include/cdecl16.inc index 2ec017d..0157454 100644 --- a/include/cdecl16.inc +++ b/include/cdecl16.inc @@ -69,8 +69,8 @@ %endmacro %endif -%ifnmacro __DEFLAT_DS_ES -%macro __DEFLAT_DS_ES 0 +%ifnmacro __TINY_DS_ES +%macro __TINY_DS_ES 0 mov ax, __STAGE2_SEGMENT mov ds, ax mov es, ax diff --git a/src/stage2/stage2.nasm b/src/stage2/stage2.nasm index 02c0ba7..42974b1 100755 --- a/src/stage2/stage2.nasm +++ b/src/stage2/stage2.nasm @@ -162,6 +162,12 @@ main: ; enter unreal mode (16 bit code, 32 bit flat memory model) call EnterUnrealMode + + ; set ds, es to the STAGE2_SEGMENT, for our model (generally) ds == es == cs + ; fs, gs & ss are all still huge data model, and the macro "__REFLAT_DS_ES" exists + ; to easily access data outside of 64KiB boundries using ds/es addressing + __TINY_DS_ES + print_string UnrealMode_OK_info ; FAT Driver setup