📄 board_at.s
字号:
;-============================================================
; @(#)board_at.mac 1.4 11/18/93
;
; File: BOARD_at.MAC - derived from the
; generic board file for xdm86 monitor
; Created: Nov 1, 1990
;
; Rev 1.4 J. Jefferies, MRI, Nov 1994
; ported to 386EX evaluation board
; Rev 1.3 J. Jefferies, MRI , May 1993
; modifications to run on 386/486 PC
;
; Rev 1.2 J. Fuchigami, MRI, March 20, 1991
; removed leading underscore from mo_start
;
; New rev #1.1 J. Fuchigami, MRI, March 20, 1991
; Put under SCCS
;
;-============================================================
;
; XRAYMON Board Support
; for
; Boards
;
; Various I/O techniques
;
; This file contains generic console input and output
; routines which can be used by changing some of the
; I/O UART receive and transmit flags to match your UART.
;
; The UART addresses are obtained from the menu program.
;
; The equates in boardset.inc define how the monitor will
; operate.
;-============================================================
;
; Segments used
;
; CODE Code
; ROM ROMable data
; RAM Workspace and Initial Stack
;
;-============================================================
; System defines
;-============================================================
;-============================================================
; include files
;-============================================================
$include (monvisi.inc) ;XRAYMON definitions
$include (boardset.inc) ; equates for UART address, etc
;-============================================================
; Externals
;-============================================================
extrn mo_start:near ;XRAYMON start address
extrn set_ivt_offs:near ;a xmasprt routine to set interrupts
extrn RET_BOARD_START:near ;a label to jmp to
;-============================================================
; Publics
;-============================================================
public BOARD_START ;Board startup code
public CON_INIT ;init for console code (hook for init)
public CON_TERM ;terminate I/O connect or reconn.
; check if using polled input
public CON_IN ;read input
public CON_OUT ;write output
;-============================================================
; Section: Code
;-============================================================
CODE32 SEGMENT ER USE32 PUBLIC
assume ds:_DATA, es:_DATA
name board
;-============================================================
;
; Entry points
;
;-============================================================
; This routine is called before the monitor initialization
; routine is called and may be used to perform board init code.
; A delicate point, if this is a pc-at then we are in 1st meg
; and can use the stack. If not then everything must be inline
; until we set csu and A20
BOARD_START proc near
; clear out the debugging registers
xor eax,eax
mov dr0,eax
mov dr1,eax
mov dr2,eax
mov dr3,eax
mov dr6,eax
mov dr7,eax
%IF(%TARGET EQ %CPUI386EX) THEN (
;initialize the 386EX chip select and interrupt control units
$include (i386ex.inc) ;80386ex register definitions & register get/set macros
;=====================================================================
; CHIP SELECT INITIALIZATION ROUTINE.
;=====================================================================
;;*** CAUTION ****
;; Care must be taken in changing the chip-selects. The chip-selects
;; determine what the memory map looks like. Change chip-selects from
;; within the XRAY debugger could cause the debugger to no longer work.
; Initialize the Chip-select Unit
; Intialize for Protected Mode operation
; Disable SMM operation
; 512KB of flash & 1MB of RAM
; Only UCS and CS4 are used.
%SetChipSelects (0, 0, 512, 1024)
;=====================================================================
; ICU INITIALIZATION ROUTINE.
;=====================================================================
;Program Slave ICU
%SetEXRegByte(ICW1S, 011H) ;Set slave triggering
%SetEXRegByte(ICW2S, 0A0H) ;Set slave base interrupt type, least 3-bit must be 0
%SetEXRegByte(ICW3S, 2) ;Set slave ID
%SetEXRegByte(ICW4S, 1) ;Set bit 0 to guarantee operation
;Program Master ICU
%SetEXRegByte(ICW1M, 11H); ;Set master triggering
%SetEXRegByte(ICW2M, 30H); ;Set master base interrupt type, least 3-bit must be 0
%SetEXRegByte(ICW3M, 04H) ;Set IR2 set for Cascade
%SetEXRegByte(ICW4M, 01H) ;Set bit 0 and remove Trigger_level bit (part of ICW1)
;Program chip configuration register -- no external pin connections
%SetEXRegByte(INTCFG, 0) ;ClearSlave external interrupt pins */
jmp RET_BOARD_START
)
ELSE
(
%IF (%TARGET EQ %CPUNS486) THEN
(
$include (ns486reg.inc) ;NS486SXF registers
$include (ns486mri.inc) ;NS486SXF MRI init code
jmp RET_BOARD_START
)
ELSE
(
$include (8042eq.inc) ; equates for A20 enabling
; For the standard 386 chip and PC-AT Board
;_______________________________________________________________________
;GATE_A20 for PC-AT
; This routine controls a signal which gates address bit 20
;
;INPUT
; (AH)=DDH Address Bit 20 GATE OFF (A20 always zero)
; (AH)=DFH Address bit 20 gate on. (A20 controlled by processor)
;_______________________________________________________________________
mov ah, ENABLE_BIT20
pushf
cli
call empty_8042 ;insure 8042 input buffer empty
jnz GATE_A20_RETURN ;return if 8042 unable to accept command
mov al,0d1h ;8042 command to write ouput port
out STATUS_PORT,al ;output command to 8042
call empty_8042 ;wait for 8042 to accept command
jnz GATE_A20_RETURN ;return if 8042 unable to accept command
mov al,ah ;8042 port data
out PORT_A,al ;output port data to 8042
call empty_8042 ;wait for 8042 to accept command
;8042 will switch within 20 usec of acceptance
GATE_A20_RETURN:
popf
jmp RET_BOARD_START
;EMPTY_8042
; This routine waits for the 8042 input buffer to empty.
;INPUT
; none
;OUTPUT
; (al)=0 8042 input buffer empty (zero flag set)
; (al)=2 timeout, 8042 input buffer full (non-zero flag set).
;_______________________________________________________________________
empty_8042:
push cx ;save cx
sub cx,cx ;cs=0, wil be used as time out value
EMPTY_LOOP:
in al,STATUS_PORT ;read 8042 status port
and al, 02h ;test until input buffer full flag empty
loopnz EMPTY_LOOP ;loop until input buffer empty or timeout
pop cx ;restore cx
ret
)FI
)FI
BOARD_START endp
;-============================================================
;
; INT_INIT and INT_CLR routines used by some hardware device
; drivers to supplement the normal init and reset
; Note: you may need to add code if special PICs need to be
; setup/cleared during init and after an int fires.
; The common case is clearing the ISR and initializing
; the enable masks.
;
;-============================================================
INT_INIT proc near
ret ; normal init ok
INT_INIT endp
INT_CLR proc near
ret ; normal interrupt handling ok
INT_CLR endp
;-============================================================
;
; XRAYMON init hook
;
;-============================================================
;
;** If INIT enabled, call the INIT routine
CON_INIT proc near
%IF ((%CONIO AND %INITIO) ne 0) THEN (
sub eax,eax ;0 means first init.
call near ptr IO_INIT ;init I/O hardware including interrupts
) FI
mov ax,RET_OK
ret
CON_INIT endp
;-============================================================
;
; XRAYMON aux-mon hook - called before enter/exit of aux-mon
;
;-============================================================
CON_TERM proc near
%IF ((%CONIO AND %INITIO) ne 0) THEN (
cmp ax,AUX_ENTER
jz term_io ;entering aux-mon, disable ints or restore
;baud rate, etc.
mov eax,1 ;indicate reinit, not first init
call near ptr IO_INIT ;reinit
jmp term_done
;;
term_io:
call near ptr IO_TERM ;terminate I/O stuff or reset back.
) FI
term_done:
mov eax,RET_OK ;indicate ok
ret
CON_TERM endp
;-============================================================
;
; Abort handler - services ABORT button on boards
;
;-============================================================
;
;** Insert any code required for clearing ABORT (for debounce, etc)
;
ABORT proc near
jmp mo_start+MOHALT ; jump to XRAYMON halt, stop execution
ABORT endp
$include (hwequ.inc) ;com_in, com_out, rx_int routines
$include (hwdrv.inc) ;com_in, com_out, rx_int routines
;=======================================================================
PUBLIC setPageTable
setPageTable proc near
ret ;if 386EX is defined no virtual memory
setPageTable endp
;========================================================================
CODE32 ends
_DATA SEGMENT RW USE32 PUBLIC
ether_int_active dd ?
ether_int_number dd ?
_DATA ENDS
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -