📄 npost.asm
字号:
page ,132
title POST HOOKS (NO PORTING NEEDED IN GENERAL)
;---------------------------------------------------------------;
; NOTE: Do not destroy EBP,SS,DS,ES,FS,GS unless otherwise specified.
;---------------------------------------------------------------;
;*****************************************************************;
;*****************************************************************;
;** **;
;** (C)Copyright 1985-1996, American Megatrends Inc. **;
;** **;
;** All Rights Reserved. **;
;** **;
;** 6145-F, Northbelt Parkway, Norcross, **;
;** **;
;** Georgia - 30071, USA. Phone-(770)-246-8600. **;
;** **;
;*****************************************************************;
;*****************************************************************;
;*****************************************************************;
;---------------------------------------;
include mbiosmac.mac
include mbiosequ.equ
include cf.equ
include biosdata.dat
include makeflag.equ
include setupequ.ext
include silent.equ
include makeflag.equ
;---------------------------------------;
extrn frequency_high:near
extrn frequency_low:near
extrn check_cmos_data:near
extrn get_cmos_reg_mask_x:near
extrn reset_e05b:near
extrn proc_shutdown:near
extrn check_cmos_8e:near
extrn ide_prim_base_addr:word
extrn ide_sec_base_addr:word
extrn ide_prim_irq:byte
extrn ide_sec_irq:byte
extrn bios_scratch:byte
;---------------------------------------;
cgroup group _text
_text segment word public 'CODE'
assume cs:cgroup
.486p
;---------------------------------------;
public _NPOST_STARTS
_NPOST_STARTS label byte ; marks start of module
;-----------------------------------------------------------------------;
; INIT_BEFORE_KB_BAT ;
;-----------------------------------------------------------------------;
; check_point : 0B ;
; This routine can be used if any special work involved before 8042 ;
; keyboard controller initialization after power-on/soft reset. ;
; input: ;
; DS 0000H ;
; ES 0000H ;
; stack available ;
; register usage : can destroy any register except EBP,DS,ES,FS,GS ;
;-----------------------------------------------------------------------;
extrn cmos_data_in_x:near
extrn cmos_data_out_x:near
extrn open_extend_cmos:near
extrn close_extend_cmos:near
public init_before_kb_bat
init_before_kb_bat:
test bp,cmos_bat_err_bit+cmos_csum_err_bit
jz check_data_code
mov ax,0ffc0h
clear_stand_cmos:
call cmos_data_out_x ; Write 0ffh
inc al
cmp al,0feh
jnz clear_stand_cmos
pushf
call open_extend_cmos
mov ax,0080h
clear_extend_cmos:
call cmos_data_out_x ; Write 000h
inc al
jnz clear_extend_cmos
call close_extend_cmos
popf
check_data_code:
mov eax, cs:[0f47bh]
mov dx,ax
bswap eax
mul ah
mul dx
add ah,al
mov al,ah
and al,0fh
shr ah,4
add ah,al
mov al,0b3h
call cmos_data_in_x
mov dl,al
and al,01111100b
shr al,2
cmp al,ah
jz bios_version_ok
shl ah,2
and dl,10000011b
or ah,dl
mov al,0b3h
call cmos_data_out_x
or bp,cmos_csum_err_bit ; set soft error
mov ax,5c8eh
call cmos_data_out_x
bios_version_ok:
ret
;-----------------------------------------------------------------------;
; INIT_AFTER_KB_BAT ; Moved to OEMPOST.ASM
;-----------------------------------------------------------------------;
; BEFORE_VECTOR ; Moved to OEMPOST.ASM
;-----------------------------------------------------------------------;
; SET_MEMORY ;
;-----------------------------------------------------------------------;
; check_point : 27 ;
; This routine is called for any init before memory test. ;
; input : ;
; SS 0030H ;
; DS 0040H ;
; ES 0000H ;
; stack available ;
; register usage : can destroy any register except EBP,DS,ES,FS,GS ;
;-----------------------------------------------------------------------;
extrn irq_map:byte
extrn pci_irq_avail_table:byte
public set_memory
set_memory:
mov ax,0b102h
mov cx,0350h
mov dx,109eh
sub si,si
int 1ah
push ds
push cs
pop ds
jnc irq_route_table_done
extrn ms_irq_route_table_sign:byte
mov si,offset cgroup:ms_irq_route_table_sign
push si
mov cx, [si+6]
xor ax,ax
@@:
lodsb
add ah,al
loop @b
neg ah
pop si
mov [si+31],ah
irq_route_table_done:
mov di,offset cgroup:irq_map
add di,7
mov cx,4
mov si,offset cgroup:pci_irq_avail_table
check_peri_irq:
lodsb
inc si
call get_cmos_item
dec al
jnz @f
dec si
lodsb
mov [di],al
inc di
@@:
loop check_peri_irq
pop ds
ret
;-----------------------------------------------------------------------;
; C000_CONTROL_BEFORE ; Moved to OEMPOST.ASM
;-----------------------------------------------------------------------;
; C000_CONTROL_AFTER ; Moved to OEMPOST.ASM
;-----------------------------------------------------------------------;
; DISPLAY_CPU_NAME_PRATING_CLOCK ;
;-----------------------------------------------------------------------;
; check_point : 37 ;
; This routine is called from SN.ASM at the end of sign-on message ;
; display but before calling the hook after_sign_on_msg. this routine ;
; displays the CPU name, PRating, clock, etc. ;
; input : ;
; SS 0030H ;
; DS 0040H ;
; ES 0000H ;
; Cursor is located at column 0 of a particular row ;
; stack available ;
; output: ;
; Cursor is expected to be at column 0 of a particular row which ;
; will not be same as the input row if this routine displays ;
; anything. ;
; register usage : do not destroy any register ;
;-----------------------------------------------------------------------;
extrn write_tty:near
extrn display_cpu_name_prating:near
extrn check_display_cpu_clock:near
extrn display_cpu_clock:near
extrn display_0d0a:near
public display_cpu_name_prating_clock
display_cpu_name_prating_clock:
push ax
call display_cpu_name_prating; display CPU name, PRating
call check_display_cpu_clock
jc short dcnpc_00 ; do not display CPU clock
mov al,' '
call write_tty
mov al,'-'
call write_tty
mov al,' '
call write_tty
call display_cpu_clock
dcnpc_00:
call display_0d0a ; take cursor to col 0 of next row
pop ax
ret
;-----------------------------------------------------------------------;
; AFTER_SIGN_ON_MSG ;
;-----------------------------------------------------------------------;
; check_point : 37 ;
; This routine is called after normal sign-on message display. ;
; input : ;
; SS 0030H ;
; DS 0040H ;
; ES 0000H ;
; stack available ;
; register usage : can destroy any register except EBP,DS,ES,FS,GS ;
; Note: ;
; 1. At input, cursor is set to column 0 of new row. ;
; 2. Implement any new stuff to be displayed here. ;
; 3. After displaying the new stuff, set cursor to column 0 of next row.;
;-----------------------------------------------------------------------;
public after_sign_on_msg
after_sign_on_msg:
ret
;-----------------------------------------------------------------------;
; DISPLAY_BEFORE_MEM_COUNTING ;
;-----------------------------------------------------------------------;
; check_point : 39 ;
; This routine can be used to display any shared memory information. ;
; input : ;
; SS 0030H ;
; DS 0040H ;
; ES 0000H ;
; stack available ;
; register usage : can destroy any register except EBP,DS,ES,FS,GS ;
; Note : ;
; 1. Cursor position is at same posn where memory counting will be;
; displayed. ;
; 2. This routine can be used to display the Shared memory size. ;
;-----------------------------------------------------------------------;
extrn read_cursor_posn:near
extrn set_cursor_posn:near
public display_before_mem_counting
display_before_mem_counting:
; call read_cursor_posn ; read current cursor posn
; push dx
; add code here to display any shared memory size, etc.
; pop dx
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -