我在这里有一个程序,它应该在调用中断时循环回来,基本上当我们的8086培训板上按下一个键时。当它运行时,按下一个键并且值显示在屏幕上,但它应该仍在运行,就像按下另一个键一样,屏幕将显示该键。我无法弄清楚为什么在调用硬件中断时它不会循环回来。有什么帮助吗?
BITS 16
CPU 8086
cli
section CONSTSEG USE16 ALIGN=16 CLASS=CONST
TABLE: DB "01231xxx45672xxx89AB3xxxCDEF4"
LETTER: DB '0'
fletter:DB 'F'
clear: DB " "
DB " "
DB " "
DB " "
LEN1: equ $ - clear
section PROGRAM USE16 ALIGN=16 CLASS=CODE
..start
MOV AX, 0 ; 0 for writing to entire screen
MOV BX, clear ; pointer to the string in memory
MOV CX, LEN1 ; number of characters
MOV DX, 0
MOV SI, DS
INT 0X10
;; sets up the 8259A
mov DX, 0XFFF4
mov AL, 00010011b ;ICW1
out DX, AL
mov DX, 0XFFF6
mov AL, 00001000b ;ICW2
out DX, AL
mov AL, 00000001b ;ICW4
out DX, AL
mov AL, 11111101b ;OCW1
out DX, AL
;; Setup the keyboard
mov DX, 0XFFF2
mov AL, 00111001b ; 39H clk 100kHz
out DX, AL
mov AL, 00000001b ; mode: Decoded scan mode, n-key rollover, 8 8-bit display left-entry
out DX, AL
mov AL, 11011111b ; clear FIFO and display
out DX, AL
mov AL,01000000B ;initialize 8279 for read FIFO
OUT DX,AL
mov CX, word 0 ; set extra segment to zero
mov ES, CX
mov [ES:36], word key_isr ; store the isr in the vector taBLe
mov [ES:38], CS
STI
jmp $
key_isr:
mov DX, 1111111111110010B ;FFF2 into DX "Command"
IN AL,DX
AND AL,00000111B ;;Ands the register with a mask to see the number of timES a key was prESsed.
MOV AX, 0 ; 0 for writing to entire screen
MOV BX, clear ; pointer to the string in memory
MOV CX, LEN1 ; number of characters
MOV DX, 0
MOV SI, DS
INT 0X10
mov DX, 1111111111110000B ;ADDRESS FOR DATA
IN AL, DX
AND AL, 00111111B ; masks control and shift bits to see what was prESsed
mov BL, AL ;For last row
and BL, 00000100B ;and with 0X0004H
jz overhere
jnz fprint
overhere:
mov DX, 1111111111001100B ;LED AdrESs debugging
out DX, AL
; bits going to led for debugging
MOV BX, TABLE
XLAT ;RETURN THE LETTER FROM THE TABLE rESults in AL
;Print
MOV [LETTER], AL
MOV AX, 0
MOV BX, LETTER
MOV CX, 1 ;length ALways 1
MOV DX, 0 ; offset
MOV SI, DS
INT 0X10
jmp end_stuff
fprint:
mov DX, 1111111111001100B ;0XFFCC
out DX, AL
MOV BX, TABLE
XLAT
mov [LETTER], AL
MOV AX, 1
MOV BX, fletter
MOV CX, 1
MOV DX, 0
MOV SI, DS
INT 0X10
MOV AX, 1
MOV BX, LETTER
MOV CX, 1
MOV DX, 1
MOV SI, DS
INT 10H
end_stuff:
mov DX, 0XFFF4 ; 8259A data
mov AL, 00100000b
out DX, AL
mov DX, 0XFFF6 ;8259A command
mov AL, 11101101b ; unmasked clock interrupt
out DX, AL
iret
; Exit the program