求答案,在线等

adan3678 2011-08-18 11:47:50
下面的程序从键盘输入一字符,若为数字则显示“It is a numeral.”,否则显示“Mistake,it is not a numeral.”然后返回操作系统。
DAT SEGMENT
ISNUM DB “It is a numeral.$”
NONUM DB “Mistake,it is not a numeral.$”
DAT ENDS
MYCD SEGMENT
ASSUME CS:MYCD,DS:DAT
FFD PROC FAR
START:MOV AX,DAT
MOV DS,AX
MOV AH,1
INT 21H
CMP AL,‘0’

____________
CMP AL,‘9’

_____________

_____________
MOV AH,9
INT 21H
DONE: MOV AH,4CH
INT 21H

GO: _______________
MOV AH,9
INT 21H
JMP DONE
FFD ENDP
MYCD ENDS
END START
...全文
312 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
aiyaya730 2011-08-18
  • 打赏
  • 举报
回复
记得结贴,谢谢!



DATA SEGMENT
ISNUM DB “It is a numeral.$”
NONUM DB “Mistake,it is not a numeral.$”
DAT ENDS
MYCD SEGMENT
ASSUME CS:MYCD,DS:DAT
FFD PROC FAR
START:MOV AX,DAT
MOV DS,AX
MOV AH,1
INT 21H
CMP AL,‘0’

____________ jb GO
CMP AL,‘9’

_____________ ja GO

_____________ mov dx,offset ISNUM
MOV AH,9
INT 21H
DONE: MOV AH,4CH
INT 21H

GO: _______________ mov dx,offset NONUM
MOV AH,9
INT 21H
JMP DONE
FFD ENDP
MYCD ENDS
END START

adan3678 2011-08-18
  • 打赏
  • 举报
回复
作业呀,帮忙
gsy999 2011-08-18
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 adan3678 的回复:]
作业呀,帮忙
[/Quote]

;判断从键盘输入的是什么字符
;KEYBOARD INPUT WITH ECHO (01H)
;keycode.asm
;ml /c keycode.asm
;link16 /TINY keycode;

code segment public
assume cs:code,ds:code
org 100h
start: jmp begin
msg1 db ' Press any key to test,Ctrl-Z to end.',0dh,0ah,'$'
msg2 db ' Letter ',0dh,0ah,'$'
msg3 db ' Extended Ascii Character ',0dh,0ah,'$'
msg4 db ' Digital ',13,10,'$'

begin: mov ax,cs
mov ds,ax
mov dx,offset msg1 ;set up to display message
mov ah,09h ;display string function request
int 21h ;call DOS
next:
mov ah,01h ;read keyboard and echo function request
int 21h ;call DOS
mov cx,offset msg2 ;set up to display message
cmp al,0 ;check if extended ascii char
jne disp ;no, tack jump
mov ah,01h ;read keyboard and echo function request
int 21h ;call DOS
mov cx,offset msg3
disp:
cmp al,1ah ;check for control-z
je done ;quit if control-z

cmp al,'0'
jl noNumber;
cmp al,'9'
jg noNumber;

;显示输入的字符:
mov dl,al ;return char in dl for next function
mov ah,02h ;display character funct request
int 21h ;call DOS

mov dx,offset msg4 ;get proper message
mov ah,09h ;display string function request
int 21h ;call DOS
jmp next

noNumber:
;显示输入的字符:
mov dl,al ;return char in dl for next function
mov ah,02h ;display character funct request
int 21h ;call DOS

mov dx,cx ;get proper message
mov ah,09h ;display string function request
int 21h ;call DOS

jmp next ;get next character
done:
mov ah,00h ;terminate progream funct request
int 21h ;call DOS
code ends ;end of code segment
end start ;start is the entry point

别忘了结贴!

21,459

社区成员

发帖
与我相关
我的任务
社区描述
汇编语言(Assembly Language)是任何一种用于电子计算机、微处理器、微控制器或其他可编程器件的低级语言,亦称为符号语言。
社区管理员
  • 汇编语言
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧