.section .data .align 4 # The DPMI Register Structure (50 bytes total) # This holds the register states injected into Real Mode. dpmi_regs: .long 0 # edi (offset 0) .long 0 # esi (offset 4) .long 0 # ebp (offset 8) .long 0 # esp / reserved (offset 12) .long 0 # ebx (offset 16) .long 0 # edx (offset 20) .long 0 # ecx (offset 24) dpmi_eax: .long 0 # eax (offset 28) .short 0 # flags(offset 32) .short 0 # es (offset 34) .short 0 # ds (offset 36) .short 0 # fs (offset 38) .short 0 # gs (offset 40) .short 0 # ip (offset 42) .short 0 # cs (offset 44) .short 0 # sp (offset 46) .short 0 # ss (offset 48) .section .text .global _start _start: call plr_display_dos_main # 1. Set up the Real-Mode registers inside the DPMI structure # AH = 4Ch (DOS Exit Function), AL = 00h (Return Code 0) movl $0x00004C00, dpmi_eax # 2. Call DPMI Simulate Real Mode Interrupt movw $0x0300, %ax # DPMI Function: Simulate Real Mode Interrupt movb $0x21, %bl # Interrupt number to trigger (INT 21h) movb $0x00, %bh # Flags (Must be 0) movw $0x0000, %cx # Number of words to copy to RM stack (0) # ES:EDI points to our DPMI register block. # In WDOSX flat model, %es already targets the flat data descriptor. movl $dpmi_regs, %edi int $0x31 # Trigger DPMI host to execute the RM interrupt # --- Execution halts here as DOS terminates the program ---