📄 386_dbg.inc
字号:
CODEMACRO opprefx ; macro to change default operand size
db 66H ; when operating in real mode
ENDM
%*define (OPEN_IO) (
MOV EAX, 08000H ;Enable expanded I/O space
OUT REMAPCFGH, AL ; and unlock the re-map bits
XCHG AL, AH
OUT REMAPCFGL, AL
OUT REMAPCFG, EAX
)
;;**********************DEBUGGING CODE**************************************
;; Use external clocking (COMCLK) @1.8432MHz, 9600 Baud (divisor = 0c)
%*define (INIT_SER_COM1) (
%SetEXRegByte (LCR0, 080H) ;Access divisor latch.
%SetEXRegByte (DLH0,00H) ;Set the divisor for the baud rate generator.
%SetEXRegByte (DLL0,0CH)
%SetEXRegByte (LCR0,03H ) ;Set parity, stop bits, and word size.
%SetEXRegByte (IER0,00H ) ;Enable selected interrupts.
%SetEXRegByte (IIR0,00H ) ;Clear all interrupts at start.
)
%*define (INIT_SER_COM2) (
%SetEXRegByte (LCR1, 080H) ;Access divisor latch.
%SetEXRegByte (DLH1,00H) ;Set the divisor for the baud rate generator.
%SetEXRegByte (DLL1,0CH)
%SetEXRegByte (LCR1,03H ) ;Set parity, stop bits, and word size.
%SetEXRegByte (IER1,00H ) ;Enable selected interrupts.
%SetEXRegByte (IIR1,00H ) ;Clear all interrupts at start.
)
%*define (OUT_CHAR_COM1 (CHAR)) (
mov edx, LSR0
in al, dx
bt eax, 5
jnc $ - 11
%SetEXRegByte (TBR0,%CHAR)
)
%*define (OUT_CHARP_COM1 (CHAR)) (
mov dl, LOW LSR0
mov dh, HIGH LSR0
in al, dx
bt eax, 5
jnc $ - 9
%SetEXRegByteP (TBR0,%CHAR)
)
%*define (OUT_CHAR_COM2 (CHAR)) (
mov dl, LOW LSR1
mov dh, HIGH LSR1
in al, dx
bt eax, 5
jnc $ - 9
%SetEXRegByte (TBR1,%CHAR)
)
%*define (OUT_CHARP_COM2 (CHAR)) (
mov edx, LSR1
in al, dx
bt eax, 5
jnc $ - 11
%SetEXRegByteP (TBR1,%CHAR)
)
%*define (INIT_SER) (
%IF (%DEBUG_COM EQ 1) THEN (
%INIT_SER_COM1
) ELSE(
%IF (%DEBUG_COM EQ 2) THEN (
%INIT_SER_COM2
)FI
)FI
)
%*define (OUT_CHAR (CHAR)) (
%IF (%DEBUG_COM EQ 1) THEN (
%OUT_CHAR_COM1 (%CHAR)
) ELSE(
%IF (%DEBUG_COM EQ 2) THEN (
%OUT_CHAR_COM2 (%CHAR)
)FI
)FI
)
%*define (OUT_CHARP (CHAR)) (
%IF (%DEBUG_COM EQ 1) THEN (
%OUT_CHARP_COM1 (%CHAR)
) ELSE(
%IF (%DEBUG_COM EQ 2) THEN (
%OUT_CHARP_COM2 (%CHAR)
)FI
)FI
)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -