【发布时间】:2021-07-29 15:08:07
【问题描述】:
我对 RTC + CMOS(实时时钟)有一个小问题,更准确地说是摩托罗拉 MC146818A。 程序执行的任务是以等于 1s 的固定时间间隔显示字母“A”。所以我正确设置了寄存器A和寄存器B的位,事实是我截取的子程序只激活了一次,我不明白为什么。代码如下:
这是函数的模块:
_text SEGMENT PARA PUBLIC
farjmp 09C0h, _start
times db 0h
mount_rtc_subroutine PROC NEAR
push ax
push es
xor ax, ax
mov es, ax
;I mask the line of break n0 of the slave PIC
in al, 0A1h
or al, 01h
out 0A1h, al
;memorize in the IVT the SEG: OFF components of the
;first instruction of my service subroutine
mov WORD PTR es:[1C0h], _rtc_subroutine
mov WORD PTR es:[1C2h], 09C0h
mov al, 0Ah
out 70h, al
mov al, 2Fh
out 71h, al
mov al, 0Bh
out 70h, al
mov al, 42h
out 71h, al
;active the break line n0 of the slave PIC
in al, 0A1h
and al, 0FEh
out 0A1h, al
pop es
pop ax
ret
mount_rtc_subroutine ENDP
_rtc_subroutine:
push ax
push bx
mov bx, OFFSET times
cmp BYTE PTR [bx], 0h
jne _write
inc BYTE PTR [bx]
jmp _EOI
_write: mov ax, 0F41h
stosw
mov WORD PTR [bx], 0h
_EOI: mov al, 20h
out 0A0h, al
out 20h, al
pop bx
pop ax
iret
_text ENDS
主模块:
farjmp MACRO segm, off
db 0EAh
dw off
dw segm
ENDM
INCLUDE rtc_sub
_text SEGMENT PARA PUBLIC
_start:
mov ax, 09C0h
mov ds, ax
mov ss, ax
mov sp, 0FFFFh
mov ax, 0B800h
mov es, ax
call mount_rtc_subroutine
jmp $
_text ENDS
END _start
我没有发现任何问题,但确实存在。 你觉得问题出在哪里?
【问题讨论】:
-
This 可能会有所帮助,尤其是关于寄存器 C 的部分。
-
谢谢,现在一切正常,我不知道你必须读取 C 寄存器。