先占个位置,傍晚有空再帮你弄,希望在我帮你弄之前有人已经帮你弄出来
傍晚调试十有些与理想结果有点差距,结果回来加了一句add ax,3030h后调试完美通过,尽量应用封装技术(子程序)使得程序四路清晰易读,同时也尽量使得子程序名做到“顾名思义”,如果你看起来不吃了,那我还算是welldone的了,有好些“入出栈对”不是必须的,本来也没有,是在排错中习惯添加的,自己可以根据需要删减。本程序按下ESC推出
;---------------------------------------------------------------------------------------------------
data segment
; add your data here!
ends
stack segment
dw 128 dup(0)
ends
code segment
;----------------------------
start:
; set segment registers:
mov ax, data
mov ds, ax
mov es, ax
; add your code here
again:
call readchar
cmp al,1bh
jz exit
cmp al,41h ;z
cmp al,5ah
jle oindex ;a
ostar:
call newline_begin
call out_star
jmp again
oindex:
call newline_begin:
call out_index
jmp again
exit:
mov ah,4ch
int 21h
;---------------------------------
;call readchar
readchar proc near
mov ah,01h
int 21h
ret
readchar endp
;---------------------------------
;call out_star
out_star proc near
push ax
mov dl,2ah
mov ah,02h
int 21h
pop ax
call newline_begin
ret
out_star endp
;---------------------------------
;call newline_begin
newline_begin proc near
push ax
mov ah,02h
mov dl,0ah
int 21h
mov dl,0dh
int 21h
pop ax
ret
newline_begin endp
;---------------------------------
;call out_index
out_index proc near
push ax
cmp al,5ah ;zimutest1.exe
a
01
b
02
c
03
d
04
e
05
f
06
A
01
B
02
C
03
D
04
E
05
F
06
0
*
1
*
2
*
3
*
4
*
5
*
←
C:CODEST~1