- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
带符号数输入排序(Signed input sorting)
带符号数输入排序(Signed input sorting)
数据段
note0 DB”注:分隔的整数都可以除十位ASCII字符(任何可见,27h、0,27h、 - ,27h、9,27h、),0Dh,0ah,$
注1分贝0Dh,0ah,“================================================================== ,0Dh,0ah
DB的请输入20(或更少)的十进制整数(32768 + 32767):,0Dh,0ah,$
注2分贝0Dh,0ah,“================================================================== ,0Dh,0ah
DB 0Dh,0ah,“输入的整数:, $
注3分贝0Dh,0ah,“================================================================== ,0Dh,0ah
DB 0Dh,0ah,多少十进制整数?$
Note4 DB 0Dh,0ah,“排序结果:,0Dh,0ah,$
err_str DB 0Dh,0ah,“****************************************************************** ,0Dh,0ah
dB的输入错误!”,0Dh,0ah
con_str DB 0Dh,0ah,“****************************************************************** ,0Dh,0ah
DB 0Dh,0ah,continue?是或否?”,$
dec_str用来存放输入的原始数据200 dB;
DB?
DB 150 DUP(“$”)
总DB 3 DUP($);用来记录输入的数字个数
dec_num DW 30 DUP(?);用来存放将输入的ASCII码转换成2进制数以便比较的结果
out_str DB 150 DUP($);存放待输出的字符组信息
数据结束
设置堆栈段
STT DB 100 DUP(?);堆栈
堆栈结束
代码段
主远过程
精简代码,DS:数据、SS:栈
开始:MOV AX,栈
MOV SS、斧
MOV AX,数据
MOV DS,斧
----------------------------------输出提示信息;
LEA DX,note0
MOV AH,09h
int 21h
disp0: lea dx, note1
mov ah, 09h
int 21h
lea dx, dec _ str; 将原始数据存入该空间
mov ah, 0ah
int 21h
mov al, byte ptr [dec _ str + 2]; 输入合法性的标志: 开头是数字或者符号
cmp al, 0
jae cmp1
cmp al, +
je disp2
cmp al, -
je disp2
jmp disp1
cmp1: cmp al, 9
jbe disp2
disp1: lea dx, err _ str
mov ah, 09h
int 21h
con _ yn: mov ah, 01h; 程序结束处询问是否需要继续
int 21h
cmp al, y
je disp0
cmp al, y
je disp0
cmp al, n
je over0
cmp al, n
je over0
over0: jmp; 用以结束程序
disp2: lea dx, note 2; 将输入的数据输出以便用户对照其正确性
mov ah, 09h
int 21h
lea dx, [dec _ str + 2]
mov ah, 09h
int 21h
; = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = count how many decimal integers
lea si, dec _ str
mov cl, byte ptr [si + 1]; cl中存放输入的总字符数
mov ch, 0
push cx
mov al, 0; al用来计数数字个数
lp1: mov dl, byte ptr [si + 2]; 如果输入数字, 符号则继续读下一位, 如果输入其他字符则al加一, 这也是开头第一个字母不能为其他字符的原因
cmp dl, +
je mov _ ptr
cmp dl, -
je mov _ ptr
cmp dl, 0
jl mov _ inc.
cmp dl, 9
jle mov _ ptr
mov _ inc.: inc. all
mov_
您可能关注的文档
- 大学生第一份工作的10个标准(10 standards for college students' first job).doc
- 大学生素质培养(Quality training of College Students).doc
- 大学生综合素质测量及评价(Measurement and evaluation of College Students' comprehensive quality).doc
- 大学生综合素质论文(College students comprehensive quality).doc
- 大学生实习周记范文(Student internship week).doc
- 大学生礼仪(etiquette of university students).doc
- 大学生心理问题解答汇集(Solutions to college students' psychological problems).doc
- 大学生劳动心得11(College students work experience 11).doc
- 大学生情侣休闲吧宣传企划案(College Students' leisure bar propaganda project).doc
- 大学生职业规划素材(Career planning materials for College Students).doc
- 帮派任务答案(Gang mission answer).doc
- 常林和柳工的区别(The difference between Chang Linzhu and Liugong).doc
- 常用ic技术参数(Commonly used IC technical parameters).doc
- 常用佳能镜头介绍(Commonly used Canon lens introduction).doc
- 常用农药商品名对照(Comparison of commonly used pesticides).doc
- 常用农药配制(Preparation of commonly used pesticides).doc
- 常用化工介质的名称缩写对照(Commonly used chemical medium name abbreviation control).doc
- 常用化工品英文缩写与中文名称对照(Commonly used chemicals in English abbreviations and Chinese name control).doc
- 常用各种混凝土配合比(Commonly used concrete mixture ratio).doc
- 常用商务日语会话(Frequently used business Japanese Conversation).doc
文档评论(0)