- 1、本文档共24页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 5、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 6、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 7、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 8、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
汇编语言程序设计例子(Assembly language programming examples)
汇编语言程序设计例子(Assembly language programming examples)
Assembly language programming typical cases
Sequential programming
Example: enter two numbers (0-9) from the keyboard and output them. (X1 validated) P41
CODE SEGMENT
ASSUME CS:CODE
ORG 100H
Main:MOV AH, 1
INT 21H
MOV, BL, AL
MOV AH, 2
MOV, DL, 0DH
INT 21H
MOV, DL, 0AH
INT 21H
MOV AH, 1
INT 21H
SUB, AL, 30H
SUB, BL, 30H
MUL BL
MOV BL, 10
DIV BL
ADD, AX, 3030H
MOV, BX, AX
MOV AH, 2
MOV, DL, 0DH
INT 21H
MOV, DL, 0AH
INT 21H
MOV, DL, BL
MOV AH, 2
INT 21H
MOV AH, 2
MOV, DL, 0DH
INT 21H
MOV, DL, 0AH
INT 21H
MOV, DL, BH
MOV AH, 2
INT 21H
MOV, AH, 4CH
INT 21H
CODE ENDS
END Main
Two branch program
1 simple branches
Example: a 16 bit unsigned number is placed in the AX, and there is a 8 bit unsigned number in BL, 1P50
Write programs that add them together and result in DX.
2 branches
Example: write BX and DX in the larger unsigned number into the AX program. (X2 validated) 1P51
DATA SEGMENT
BUF1 DW?
DATA ENDS
CODE SEGMENT
ASSUME, CS:CODE, DS:DATA
START:MOV, AX, DATA
MOV, DS, AX
LEA, SI, BUF1
MOV, BX, [SI]
INC SI
MOV, DX, [SI]
CMP, BX, DX
JA Lab1
MOV, AX, DX
JMP Lab2
Lab1:MOV, AX, BX
Lab2:MOV, AH, 4CH
INT 21H
CODE ENDS
END START
3 the branch of complex conditions
Example: read two single digits from the keyboard and output the product. P52 (X1 validated)
CODE SEGMENT
ASSUME CS:CODE
ORG 100H
MOV, AH, 1; read the first number from the keyboard
INT 21H
CMP, AL,0
JB Lab1
CMP, AL,9
JA Lab1
MOV, BL, AL
MOV AH, 2
MOV, DL, 13H
INT 21H
MOV, DL, 10H
INT 21H
MOV, AH, 1; read second numbers from keyboard
INT 21H
CMP, AL,0
JB Lab1
CMP, AL,9
JA Lab1
SUB, AL, 30H; restore the ASCALL code of the later read numbers to numbers
SUB, BL, 30H; restore the ASCALL code of the number to be read into numbers
MUL BL; two phase
MOV BL, 10;
DIV BL; ten bits and bits of a spin product
ADD, AX, 3030H; the product is converted to ASCALL code
MOV, BX, AX
MOV AH, 2
MOV, DL, 13H, carriage return
INT 21H
MOV, DL, 10H; line feed
INT 21H
MOV, DL, BL; output show
您可能关注的文档
- 残留溶剂测定法(Residual solvent method).doc
- 武汉理工大学无机材料科学基础名词解释(Wuhan University of Technology, inorganic materials science, basic terms, explanation).doc
- 残疾人李成松奋发图强的事迹(The deeds of Li Chengsong make efforts).doc
- 毁灭之王 符文物品、符石功能、赫拉笛克方块等(The Lord of destruction Rune Rune objects, functions, such as boxes of Hera dick).doc
- 母婴保健技术考核试题(Examination questions of maternal and child health care technology).doc
- 母婴店 童装店 孕婴店 促销必胜208招(Maternal stores children's clothing store Yunying shop promotion win 208 strokes).doc
- 武汉体育学院目标管理 机关单位2012年度目标初案参考模板(Target management unit of Wuhan Sports Institute 2012 annual target initial case reference template).doc
- 母猪产子需要专业产婆(The sow needs professional midwife).doc
- 母猪产后护理要点及注意事项(Key points and points for attention in postpartum nursing of sows).doc
- 母亲的感人事迹(A touching story of mother).doc
- 汇编语言编程键盘输入的小写字母换成大写(Assembly language programming, keyboard input of lowercase letters into uppercase).doc
- 汉之云全支线攻略(Han cloud all branch line strategy).doc
- 汉书.卷十 成帝纪第十(Han Emperor Ji tenth volume ten.).doc
- 汉声中国童话目录(Chinese fairy tale catalogue).doc
- 水路运输常识(Common sense of water transportation).doc
- 汉字拼意文字(Chinese characters spelling).doc
- 汉王科技,休克还是停摆管理(Hanvon technology, shock or lockout management).doc
- 汉英-4-补充材料-请阅读(English Chinese -4- supplementary materials - please read).doc
- 汉语疑难详解-6601(Chinese difficult explanation -6601).doc
- 汉语的美妙(The beauty of Chinese).doc
文档评论(0)