;This handles the protected mode jump for Isnt. ;(C) 1995 American Eagle Publications, Inc. All rights reserved. ;Definitions for use in this program IOMAP_SIZE EQU 801H VIDEO_SEG EQU 0B800H ;segment for video ram STACK_SIZE EQU 500H ;size of stacks used in this pgm NEW_INT_LOC EQU 20H ;new location for base of hardware ints INCLUDE PM_DEFS.ASM ;include protected mode definitions ;Definition for jump into protected mode HI_MEMORY DD OFFSET V86_LOADER DW CODE_1_SEL OLDSTK DD ? ;old stack pointer from slips ;This routine actually performs the protected mode jump. It initializes tables, ;moves the code to high memory, and then jumps to the V86_LOADER in the TASK1 ;segment. Control returns in V86 mode to the routine VIRTUAL below. GO_PROTECTED: mov ax,cs ;initialize variables for pgm mov ds,ax mov WORD PTR [OLDSTK],sp ;save the stack mov WORD PTR [OLDSTK+2],ss call SETUP_IDT ;initialize IDT call SETUP_TASK2 ;initialize Task State Seg 2 call MOVE_CODE ;move code to 110000H cli call CHANGE_INTS ;Move 8259 controller bases call GATE_A20 ;Turn A20 line on mov ah,1 ;this flushes something on int 16H ;some 386SXs or they crash xor eax,eax push eax popfd ;clear flags lgdt FWORD PTR GDT_PTR ;set up GDT register lidt FWORD PTR IDT_PTR ;set up IDT register mov eax,cr0 or eax,1 mov cr0,eax ;set protected mode bit jmp FWORD PTR cs:[HI_MEMORY];go to high memory ;This routine returns with Z set if the processor is in real mode, and NZ if ;it is in V86 mode. IS_V86: PUSHF ;first check for V86 mode POP AX OR AX,3000H mov bx,ax PUSH AX POPF ;Pop flags off Stack PUSHF ;Push flags on Stack POP AX cmp ax,bx jnz VMODE AND AX,0CFFFH mov bx,ax PUSH AX POPF ;Pop flags off Stack PUSHF ;Push flags on Stack POP AX cmp ax,bx VMODE: ret INCLUDE SETUPROT.ASM ;protected mode setup routines called above ;End of code to get to protected mode ;******************************************************************************* ;****************************************************************************** ;The following code is executed in V86 mode after control is passed here from ;the protected mode task switch. It just turns interrupts back on and returns ;control to the calling program. ;****************************************************************************** VIRTUAL: cli mov al,0 ;unmask hardware interrupts out 21H,al mov ax,cs ;set up segments mov ds,ax mov es,ax lss sp,[OLDSTK] ;and the stack sti ;enable interrupts ret ;return to caller in Isnt ;End of V86 mode code ;*******************************************************************************