Home > other >  Assembly language quirks class set the problems solved, but don't know why, very meng, solving
Assembly language quirks class set the problems solved, but don't know why, very meng, solving

Time:09-16

Electronic time clock display system, and use the way of rewriting int 9 interrupt "during the time display can enter any characters, display on the screen", rewrite the int 9 interrupt code is as follows:
Int9:
Push ax
Push bx
Push dx
In al, 60 h
Pushf
Pushf
Pop bx
And bh, 11111100 b
Push bx
Popf
Call dword PTR ds: [0]

CMP al, 01 h; The esc key scan code
Developed int9ret

; Restore the interrupt vector
Mov ax, 0
Mov es, ax

Push ds: [0]
Pop es: [9 * 4)
Push ds: [2]
Pop es: [9 * 4 + 2]

Mov ax, 4 c00h
Int 21 h

Int9ret:
mov ah, 01 h
Int 16 h
Pushf; Detect the presence of keyboard input
Pop bx
And bl, 01000000 b
CMP bl, 01000000 b
Je over; No keyboard input

Mov ah, 00 h; Have a keyboard input is read ASCII
Int 16 h
Mov dl, al; Displayed on the screen
Mov ah, 02 h
Int 21 h

Over: pop dx
Pop bx
Pop ax
Iret
Why do you want to add the red font part, not trigger int 9 interrupt means has a keyboard input??