📄 dbg.inc
字号:
%*DEFINE(SetRegByte (reg,val))(
mov dl, LOW %reg
mov dh, HIGH %reg
mov al,%val
out dx,al
)
%*DEFINE(SetRegByteP (reg,val))(
mov dl, LOW %reg
mov dh, HIGH %reg
mov al,%val
out dx,al
)
; COM1 ADDERSSES
DDLL0 EQU 03F8H
DIER0 EQU 03F9H
DDLH0 EQU 03F9H
DTBR0 EQU 03F8H
DLSR0 EQU 03FDH
DIIR0 EQU 03FAH
DLCR0 EQU 03FBH
; COM2 ADDRESSES
DDLL1 EQU 02F8H
DIER1 EQU 02F9H
DDLH1 EQU 02F9H
DLSR1 EQU 02FDH
DTBR1 EQU 02F8H
DIIR1 EQU 02FAH
DLCR1 EQU 02FBH
;;**********************DEBUGGING CODE**************************************
;; Use external clocking (COMCLK) @1.8432MHz, 9600 Baud (divisor = 0c)
%*define (INIT_SER_COM1) (
%SetRegByte (DLCR0, 080H) ;Access divisor latch.
%SetRegByte (DDLH0,00H) ;Set the divisor for the baud rate generator.
%SetRegByte (DDLL0,0CH)
%SetRegByte (DLCR0,03H ) ;Set parity, stop bits, and word size.
%SetRegByte (DIER0,00H ) ;Enable selected interrupts.
%SetRegByte (DIIR0,00H ) ;Clear all interrupts at start.
)
%*define (INIT_SER_COM2) (
%SetRegByte (DLCR1, 080H) ;Access divisor latch.
%SetRegByte (DDLH1,00H) ;Set the divisor for the baud rate generator.
%SetRegByte (DDLL1,0CH)
%SetRegByte (DLCR1,03H ) ;Set parity, stop bits, and word size.
%SetRegByte (DIER1,00H ) ;Enable selected interrupts.
%SetRegByte (DIIR1,00H ) ;Clear all interrupts at start.
)
%*define (OUT_CHAR_COM1 (CHAR)) (
mov edx, DLSR0
in al, dx
bt eax, 5
jnc $ - 11
%SetRegByte (DTBR0,%CHAR)
)
%*define (OUT_CHARP_COM1 (CHAR)) (
mov dl, LOW DLSR0
mov dh, HIGH DLSR0
in al, dx
bt eax, 5
jnc $ - 9
%SetRegByteP (DTBR0,%CHAR)
)
%*define (OUT_CHAR_COM2 (CHAR)) (
mov dl, LOW DLSR1
mov dh, HIGH DLSR1
in al, dx
bt eax, 5
jnc $ - 9
%SetRegByte (DTBR1,%CHAR)
)
%*define (OUT_CHARP_COM2 (CHAR)) (
mov edx, DLSR1
in al, dx
bt eax, 5
jnc $ - 11
%SetRegByteP (DTBR1,%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 + -