三位bcd加法计数器_查找两个8位BCD编号的加法| 8086微处理器

三位bcd加法计数器

Problem statement:

问题陈述:

Write a program in 8086 microprocessor to find out the addition of two 8-bit BCD numbers, where numbers are stored from starting memory address 2000 : 500 and store the result into memory address 2000 : 600 and carry at 2000 : 601.

在8086微处理器中编写一个程序,找出两个8位BCD数字的加法运算,其中数字从起始存储地址2000:500存储,并将结果存储到存储地址2000:600,并在2000:601进位。

Algorithm:

算法:

  1. Load data from offset 500 to register AL (first number)

    将数据从偏移500加载到寄存器AL(第一个数字)

  2. Load data from offset 501 to register BL (second number)

    将数据从偏移量501加载到寄存器BL(第二个数字)

  3. Add these two numbers (contents of register AL and register BL)

    将这两个数字相加(寄存器AL和寄存器BL的内容)

  4. Apply DAA instruction (decimal adjust)

    应用DAA指令(十进制调整)

  5. Store the result (content of register AL) to offset 600

    将结果(寄存器AL的内容)存储到偏移600

  6. Set register AL to 00

    将寄存器AL设置为00

  7. Add contents of register AL to itself with carry

    用进位将寄存器AL的内容添加到自身

  8. Store the result (content of register AL) to offset 601

    将结果(寄存器AL的内容)存储到偏移量601

  9. Stop

    停止

Program:

程序:

ADDRESSMNEMONICSCOMMENTS
400MOV AL, [500]AL ← [500]
404MOV BL, [501]BL ← [501]
408ADD AL, BLAL ← AL+BL
40ADAADECIMAL ADJUST AL
40BMOV [600], ALAL → [600]
40FMOV AL, 00AL ← 00
411ADC AL, ALAL ← AL+AL+cy(prev)
413MOV [601], ALAL → [601]
417HLTEND
地址 记忆 注释
400 MOV AL,[500] AL←[500]
404 MOV BL,[501] BL←[501]
408 新增AL,BL AL←AL + BL
40A DAA 法定调整
40B MOV [600],AL AL→[600]
40楼 MOV AL,00 AL←00
411 ADC AL,AL AL←AL + AL + cy(上一个)
413 MOV [601],AL AL→[601]
417 HLT 结束

Explanation:

说明:

  1. MOV AL, [500]: load data from offset 500 to register AL

    MOV AL,[500]:将数据从偏移500加载到寄存器AL

  2. MOV BL, [501]: load data from offset 501 to register BL

    MOV BL,[501]:将数据从偏移量501加载到寄存器BL

  3. ADD AL, BL: ADD contents of registers AL AND BL

    ADD AL,BL:添加寄存器AL和BL的内容

  4. DAA: decimal adjust AL

    DAA:十进制调整AL

  5. MOV [600], AL: store data from register AL to offset 600

    MOV [600],AL:将数据从寄存器AL存储到偏移量600

  6. MOV AL, 00: set value of register AL to 00

    MOV AL,00:将寄存器AL的值设置为00

  7. ADC AL, AL: add contents of register AL to AL with carry

    ADC AL,AL:带进位将寄存器AL的内容添加到AL

  8. MOV [601], AL: store data from register AL to offset 601

    MOV [601],AL:将数据从寄存器AL存储到偏移量601

  9. HLT: stop

    HLT:停止

翻译自: https://www.includehelp.com/embedded-system/find-addition-of-two-8-bit-bcd-numbers-using-8086-microprocessor.aspx

三位bcd加法计数器

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值