早教吧 育儿知识 作业答案 考试题库 百科 知识分享

求汇编的答案~~~~1.键入一个字符(1号功能)2.判断是否为大小写英文字符(CMP)3.是英文字母,计算它的顺序号,并进行显示,否则,显示‘*’。(要显示序号时,需将顺序号的十位

题目详情
求汇编的答案~~~~
1. 键入一个字符(1号功能)
2. 判断是否为大小写英文字符(CMP)
3. 是英文字母,计算它的顺序号,并进行显示,否则,显示‘*’。(要显示序号时,需将顺序号的十位数和个位数分别转换成ASCII码,并一一进行,2号功能)
▼优质解答
答案和解析
先占个位置,傍晚有空再帮你弄,希望在我帮你弄之前有人已经帮你弄出来
傍晚调试十有些与理想结果有点差距,结果回来加了一句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 ; jl ostar
cmp al,7ah
jg ostar ;>z
cmp al,5ah
jle oindex ; cmp al,61h
jge 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 ; jg lowletter
sub al,40h ;upletter_index
call outal_Denum
jmp last
lowletter:
sub al,60h ;lowletter_index
call outal_Denum
last:
pop ax
ret
out_index endp
;---------------------------------
;call outal_Denum
outal_Denum proc near
push ax
mov ah,00h;xor ah,ah
;cbw
mov cl,0ah
div cl
add ax,3030h;
mov dl,al
call outdl
mov dl,ah
call outdl
call newline_begin
pop ax
ret
outal_Denum endp
;---------------------------------
;call outdl
outdl proc near
push ax
mov ah,02h
int 21h
pop ax
ret
outdl endp
;---------------------------------
ends
end start ; set entry point and stop the assembler.
;-------------------------------------------------------------------------------------------------
附加cmd模式下部分调试结果:
C:\codestest>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>
看了求汇编的答案~~~~1.键入一...的网友还看了以下: