《MS-DOS 文件管理程序 DUMP 的分析与比较》
1. 关键代码解读
首先来看一段关键代码,它用于处理用户响应并根据用户输入设置相应的操作代码:
in t2 4 a : mov
ax.seg prompt
; display prompt for user
mov
d s .a x
; using function 9 (print string
mov
e s .a x
; terminated by $ character)
mov
d x . o f f s e t prompt
mov
a h ,9
1 n t
21 h
mov
a h , 1
; get user's response
i n t
21h
; function 1 - read one character
mov
d i , o f f s e t keys
; look up code for response key
mov
c x ,k e y s _ le n
cl d
repne
scasb
jn z
in t2 4 a
; prompt again if bad response
; set AL - action code for MS-DOS
; according to key that was entered:
; 0 - ignore. 1 - retry. 2 - abort.
; 3 - fail
mov
a l , [d i+ k e y s _ le n - 1 ]
pop
es
; restore registers
pop
ds
pop
bp
pop
di
pop
si
pop
dx
pop
cx