...just were browsing AThelp and I found a snippet of code, that used Windows 2.0 to 3.1 in 16-bit protected mode when returning to DOS:
Code: Select all
Mov ax,[CodeBase]
Push offset def0400 - offset defgdt
Pop ds
assume ds:nothing;
Mov word ptr ds:[067h],offset real
Mov word ptr ds:[069h],ax
; in the shutdown address of BIOS - address of our program
; after the RESET it should begin there
Mov al,0fh
Out 70h,al
jmp delay2
delay2: Mov al,0ah
Out 71h,al ; write SHUTDOWN byte in CMOS
Mov al,0fch ; RESET the processor
Out 64h,al
halt: hlt ; RESET does take a while, we will halt the CPU
jmp halt ; what if NMI ?
nop
Real: Mov ax,seg stak
Mov ss,ax ; set the stack
Mov sp,[Storesp]
Push seg data
Pop ds
assume ds:data; ; Data segment
Mov al,0ffh ; enable keyboard
Out 64h,al
Sti ; and interrupts