li222881 2016-03-05 08:15 采纳率: 33.3%
浏览 2334
已采纳

下面一段代码的错误不明白,子程序的保护现场和恢复现场要怎么写?在哪写?

DATAS SEGMENT
letter db 0
digit db 0
other db 0
str db 80,?,80 dup(?)
str2 db 'letter:$'
str3 db 'digit:$'
str4 db 'other:$'
DATAS ENDS

CODES SEGMENT
ASSUME CS:CODES,DS:DATAS,SS:STACKS
START:
MOV AX,DATAS
MOV DS,AX
lea dx,str
mov ah,0ah
int 21h
mov ch,0
mov cl,80
L1:mov ah,1
int 21h
cmp al,0dh
jz over
cmp al,'0'
jb others
cmp al,'9'
ja L2
jmp digits
L2:cmp al,'A'
jb others
cmp al,'Z'
ja L3
jmp letters
L3:cmp al,'a'
jb others
cmp al,'z'
ja others
jmp letters
letters:
inc letter
jmp over1
digits:
inc digit
jmp over1
others:
inc other
jmp over
over1:
loop L1
over:
call endline
lea dx,str2
mov ah,9
int 21h
sub ax,ax
mov al,letter
call display
call endline
lea dx,str3
mov ah,9
int 21h
sub ax,ax
mov al,digit
call display
call endline
lea dx,str4
mov ah,9
int 21h
sub ax,ax
mov al,other
call display
MOV AH,4CH
INT 21H
endline proc near
mov ah,2
mov dl,0ah
int 21h
mov ah,2
mov dl,0dh
int 21h
ret
endline endp
display proc near
mov dl,al
add dl,30h
mov ah,2
int 21h
ret
display endp

CODES ENDS
END START
error A2085:instruction or register not accepted in current CPU mode.
(此代码需要实现的功能是:键入一串字符,输出字符中字母、数字、其他字符的个数。)
这个代码是我各处摘抄的……一定有很多问题。
子程序有保护现场和恢复现场要在哪里写?按照上面写的代码需要保护的寄存器是ax么?

  • 写回答

2条回答

  • threenewbee 2016-03-06 00:07
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记