2001-02-25 21:48:09 +01:00
|
|
|
.model tiny
|
|
|
|
.486
|
|
|
|
smart
|
|
|
|
.code
|
2001-04-27 22:48:09 +02:00
|
|
|
|
2001-02-25 21:48:09 +01:00
|
|
|
org 0100h
|
|
|
|
|
|
|
|
start:
|
|
|
|
|
2001-04-27 22:48:09 +02:00
|
|
|
jmp tsr
|
|
|
|
offsets dd 0
|
|
|
|
db 'KEYBOARD'
|
|
|
|
tsr:
|
|
|
|
pushf
|
|
|
|
db 2eh,0ffh,1eh
|
|
|
|
dw offsets
|
|
|
|
cli
|
2001-05-09 22:48:10 +02:00
|
|
|
mov cs:feax,eax
|
2001-04-27 22:48:09 +02:00
|
|
|
in al,60h
|
|
|
|
cmp cs:isstate,1
|
|
|
|
jne nostate
|
|
|
|
cmp al,57
|
2001-05-09 22:48:10 +02:00
|
|
|
jne endof
|
2001-04-27 22:48:09 +02:00
|
|
|
mov cs:isstate,0
|
2001-05-09 22:48:10 +02:00
|
|
|
jmp endof
|
2001-04-27 22:48:09 +02:00
|
|
|
nostate:
|
|
|
|
cmp al,87
|
2001-05-09 22:48:10 +02:00
|
|
|
je F11
|
2001-04-27 22:48:09 +02:00
|
|
|
cmp al,88
|
2001-05-09 22:48:10 +02:00
|
|
|
je F12
|
|
|
|
endof:
|
|
|
|
mov eax,cs:feax
|
2001-04-27 22:48:09 +02:00
|
|
|
sti
|
|
|
|
iret
|
|
|
|
isstate db 0
|
|
|
|
infos db 10 dup (0)
|
2001-02-25 21:48:09 +01:00
|
|
|
|
2001-05-09 22:48:10 +02:00
|
|
|
F11:
|
|
|
|
push ax di es
|
|
|
|
push cs
|
|
|
|
pop es
|
|
|
|
mov di,offset infos
|
|
|
|
mov ah,34
|
|
|
|
int 47h
|
|
|
|
mov al,cs:infos+7
|
|
|
|
inc al
|
|
|
|
and ax,111b
|
|
|
|
int 47h
|
|
|
|
pop es di ax
|
|
|
|
jmp endof
|
|
|
|
|
|
|
|
|
|
|
|
f12:
|
|
|
|
mov cs:isstate,1
|
|
|
|
pop word ptr cs:fip
|
|
|
|
pop word ptr cs:fcs
|
|
|
|
pop dword ptr cs:ffl
|
|
|
|
mov cs:fesp,esp
|
|
|
|
push ds es
|
|
|
|
pusha
|
|
|
|
push word ptr cs:fip
|
2001-04-27 22:48:09 +02:00
|
|
|
push gs
|
|
|
|
push fs
|
2001-05-09 22:48:10 +02:00
|
|
|
push ss
|
2001-04-27 22:48:09 +02:00
|
|
|
push es
|
|
|
|
push ds
|
2001-05-09 22:48:10 +02:00
|
|
|
push word ptr cs:fcs
|
|
|
|
push dword ptr cs:fesp
|
|
|
|
push ebp
|
|
|
|
push edi
|
|
|
|
push esi
|
|
|
|
push edx
|
|
|
|
push ecx
|
|
|
|
push ebx
|
|
|
|
push eax
|
|
|
|
push dword ptr cs:ffl
|
2001-04-27 22:48:09 +02:00
|
|
|
push cs
|
|
|
|
push cs
|
|
|
|
pop es
|
|
|
|
pop ds
|
2001-05-09 22:48:10 +02:00
|
|
|
mov ah,26
|
|
|
|
int 47h
|
2001-04-27 22:48:09 +02:00
|
|
|
mov ah,2
|
|
|
|
int 47h
|
|
|
|
mov ah,21
|
|
|
|
mov cl,4
|
|
|
|
int 47h
|
|
|
|
mov ah,13
|
|
|
|
mov si,offset reg
|
|
|
|
int 47h
|
|
|
|
mov ah,6
|
|
|
|
int 47h
|
|
|
|
mov ah,21
|
|
|
|
mov cl,7
|
|
|
|
int 47h
|
|
|
|
mov ah,13
|
|
|
|
mov si,offset fla
|
|
|
|
int 47h
|
|
|
|
pop edx
|
|
|
|
mov cx,32
|
|
|
|
mov ah,11
|
|
|
|
int 47h
|
|
|
|
mov ah,5
|
|
|
|
int 47h
|
|
|
|
mov ah,10
|
|
|
|
int 47h
|
|
|
|
mov si,offset regs
|
2001-05-09 22:48:10 +02:00
|
|
|
mov bx,8+7
|
2001-04-27 22:48:09 +02:00
|
|
|
mov ah,21
|
|
|
|
mov cl,6
|
|
|
|
int 47h
|
|
|
|
showallREG:
|
|
|
|
mov ah,6
|
|
|
|
int 47h
|
2001-05-09 22:48:10 +02:00
|
|
|
cmp bx,8
|
2001-04-27 22:48:09 +02:00
|
|
|
jb nodr
|
|
|
|
pop edx
|
2001-05-09 22:48:10 +02:00
|
|
|
mov cx,32
|
2001-04-27 22:48:09 +02:00
|
|
|
jmp popo
|
|
|
|
nodr:
|
|
|
|
mov ah,21
|
|
|
|
mov cl,1
|
|
|
|
int 47h
|
|
|
|
xor edx,edx
|
|
|
|
pop dx
|
2001-05-09 22:48:10 +02:00
|
|
|
mov cx,16
|
2001-04-27 22:48:09 +02:00
|
|
|
popo:
|
|
|
|
mov ah,13
|
|
|
|
int 47h
|
|
|
|
mov ah,10
|
|
|
|
int 47h
|
|
|
|
mov ah,5
|
|
|
|
int 47h
|
|
|
|
push si
|
|
|
|
mov si,offset gr
|
|
|
|
mov ah,13
|
|
|
|
int 47h
|
|
|
|
mov ah,8
|
|
|
|
int 47h
|
|
|
|
mov si,offset dr
|
|
|
|
mov ah,13
|
|
|
|
int 47h
|
|
|
|
pop si
|
|
|
|
add si,5
|
|
|
|
dec bx
|
|
|
|
jnz showallreg
|
|
|
|
mov ah,34
|
|
|
|
mov di,offset infos
|
|
|
|
int 47h
|
|
|
|
mov ah,25
|
|
|
|
mov bl,cs:infos
|
|
|
|
xor bh,bh
|
|
|
|
dec bl
|
|
|
|
int 47h
|
|
|
|
mov si,offset app
|
|
|
|
mov ah,13
|
|
|
|
int 47h
|
|
|
|
mov ah,32
|
|
|
|
mov bl,cs:infos
|
|
|
|
xor bh,bh
|
|
|
|
mov di,ax
|
|
|
|
dec di
|
|
|
|
mov cl,116
|
|
|
|
int 47h
|
2001-05-09 22:48:10 +02:00
|
|
|
pop es ds
|
|
|
|
sti
|
|
|
|
waitt:
|
|
|
|
cmp cs:isstate,0
|
|
|
|
jne waitt
|
|
|
|
mov ah,27
|
|
|
|
int 47h
|
|
|
|
popa
|
2001-04-27 22:48:09 +02:00
|
|
|
pop es ds
|
2001-05-09 22:48:10 +02:00
|
|
|
push dword ptr cs:ffl
|
|
|
|
push word ptr cs:fcs
|
|
|
|
push word ptr cs:fip
|
|
|
|
jmp endof
|
2001-02-25 21:48:09 +01:00
|
|
|
|
2001-05-09 22:48:10 +02:00
|
|
|
reg db ' State of registers',0
|
|
|
|
fla db 'Eflags:',0
|
|
|
|
regs db 'EAX:',0
|
|
|
|
db 'EBX:',0
|
|
|
|
db 'ECX:',0
|
|
|
|
db 'EDX:',0
|
2001-04-27 22:48:09 +02:00
|
|
|
db 'ESI:',0
|
2001-05-09 22:48:10 +02:00
|
|
|
db 'EDI:',0
|
2001-04-27 22:48:09 +02:00
|
|
|
db 'EBP:',0
|
|
|
|
db 'ESP:',0
|
|
|
|
db ' CS:',0
|
|
|
|
db ' DS:',0
|
|
|
|
db ' ES:',0
|
|
|
|
db ' FS:',0
|
|
|
|
db ' GS:',0
|
|
|
|
db ' SS:',0
|
2001-05-09 22:48:10 +02:00
|
|
|
db ' IP:',0
|
2001-04-27 22:48:09 +02:00
|
|
|
gr db '(',0
|
|
|
|
dr db ')',0
|
|
|
|
app db 'Press space to quit...',0
|
2001-05-09 22:48:10 +02:00
|
|
|
ffl dd 0
|
|
|
|
fcs dw 0
|
|
|
|
fip dw 0
|
|
|
|
fesp dd 0
|
|
|
|
feax dd 0
|
2001-02-25 21:48:09 +01:00
|
|
|
end start
|