IBM 5170 手册中 5-34页:
IBM PC XT (286 BIOS)片段
;-------------------------------------------------------------------------------
; SHUTDOWN - RESTART :
; RETURN CONTROL AFTER A SHUTDOWN COMMAND IS ISSUED :
; DESCRIPTION :
; A TEST IS MADE FOR THE SYSTEM FLAG BEING SET. IF THE SYSTEM FLAG IS :
; SET, THE SHUTDOWN BYTE IN CMOS IS USED TO DETERMINE WHERE CONTROL IS :
; RETURNED. :
; :
; CMOS = 0 SOFT RESET OR UNEXPECTED SHUTDOWN :
; CMOS = 1 SHUT DOWN AFTER MEMORY SIZE :
; CMOS = 2 SHUT DOWN AFTER MEMORY TEST :
; CMOS = 3 SHUT DOWN WITH MEMORY ERROR :
; CMOS = 4 SHUT DOWN WITH BOOT LOADER REQUEST :
; CMOS = 5 JMP DWORD REQUEST - (INTERRUPT CHIPS & 287 ARE INITIALIZED) :
; CMOS = 6 PROTECTED MODE TEST3 PASSED :
; CMOS = 7 PROTECTED MODE TEST3 FAILED :
; CMOS = 8 PROTECTED MODE TEST1 FAILED :
; CMOS = 9 BLOCK MOVE SHUTDOWN REQUEST :
; CMOS = A JMP DWORD REQUEST - (W/O INTERRUPT CHIPS INITIALIZED) :
; :
; NOTES: RETURNS ARE MADE WITH INTERRUPTS AND NMI DISABLED. :
; USER MUST RESTORE SS:SP (POST DEFAULT SET = 0000:0400), :
; ENABLE NON-MASKABLE INTERRUPTS (NMI) WITH AN OUT TO :
; PORT 70H WITH HIGH ORDER BIT OFF, AND THEN ISSUE A :
; STI TO ENABLE INTERRUPTS. FOR SHUTDOWN (5) THE USER :
; MUST ALSO RESTORE THE INTERRUPT MASK REGISTERS. :
;-------------------------------------------------------------------------------
;----- CHECK FROM WHERE
C7C:
MOV AL,CMOS_SHUT_DOWN+NMI ; CLEAR CMOS BYTE
OUT CMOS_PORT,AL
NOP ; I/O DELAY
SUB AL,AL ; SET BYTE TO 0
OUT CMOS_DATA,AL
XCHG AH,AL
CMP AL,0AH ; COMPARE WITH MAXIMUM TABLE ENTRIES
JA SHUT0 ; SKIP TO POST IF GREATER THAN MAXIMUM
MOV SI,OFFSET BRANCH ; POINT TO THE START OF THE BRANCH TABLE
ADD SI,AX
ADD SI,AX ; POINT TO BRANCH ADDRESS
MOV BX,CS:[SI] ; MOVE BRANCH TO ADDRESS TO BX REGISTER
;----- SET TEMPORARY STACK FOR POST
MOV AX,ABS0 ; SET STACK SEGMENT TO ABS0 SEGMENT
MOV SS,AX
MOV SP,OFFSET @TOS ; SET STACK POINTER TO END OF VECTORS
JMP BX ; JUMP BACK TO RETURN ROUTINE
BRANCH: DW SHUT0 ; NORMAL POWER UP/UNEXPECTED SHUTDOWN
DW SHUT1 ; SHUT DOWN AFTER MEMORY SIZE
DW SHUT2 ; SHUT DOWN AFTER MEMORY TEST
DW SHUT3 ; SHUT DOWN WITH MEMORY ERROR
DW SHUT4 ; SHUT DOWN WITH BOOT LOADER REQUEST
DW SHUT5 ; JMP DWORD REQUEST WITH INTERRUPT INIT
DW SHUT6 ; PROTECTED MODE TEST7 PASSED
DW SHUT7 ; PROTECTED MODE TEST7 FAILED
DW SHUT8 ; PROTECTED MODE TEST1 FAILED
DW SHUT9 ; BLOCK MOVE SHUTDOWN REQUEST
DW SHUTA ; JMP DWORD REQUEST (W/O INTERRUPT INIT)
PAGE
;----- @IO_ROM_INIT MUST BE INITIALIZED BY THE USER FOR VECTORED REQUESTS
SHUT5:
IN AL,PORT_A ; FLUSH THE KEYBOARD BUFFER
MOV AL,EOI ; FLUSH LAST TIMER REQUEST IF PENDING
OUT INTA00,AL ; - TO ALLOW TIMER INTERRUPTS
SHUTA:
JMP DWORD PTR @IO_ROM_INIT ; FAR JUMP TO USER DEFINED LOCATION
用05和0ah返回实模式在PCEM中可以,用05返回需要恢复8259 的IMR,否则DOS不响应硬件中断。0xa是INTEL推荐的方法,在MP手册中推荐用于启动和停止AP CPU(只限于使用82489DX的系统),这个技术已经被废除了现代PC的BIOS基本上没这个了。