十六进制的数怎么存储格式_添加存储在连续内存或数组中的十六进制数字

十六进制的数怎么存储格式

Problem statement:

问题陈述:

Write an assembly language program to add hexadecimal numbers stored in continuous memory or in an array.

编写汇编语言程序以添加存储在连续存储器或数组中的十六进制数字。

Assumption: Let the size of the array is stored at memory location 2050 and the base address of the array is 2051. The sum will be stored at memory location 3050 and carry will be stored at location 3051.

假设:让数组的大小存储在内存位置2050,数组的基地址为2051。总和将存储在内存位置3050,进位将存储在位置3051。

Algorithm:

算法:

  1. Load the base address of the array in HL register pair.

    在HL寄存器对中加载阵列的基地址。

  2. Size of the array is used as a counter.

    数组的大小用作计数器。

  3. Initialize accumulator to 00.

    将累加器初始化为00。

  4. Add content of accumulator with the content stored at memory location given in HL pair.

    将累加器的内容与存储在HL对中指定存储位置的内容相加。

  5. Decrease counter on each addition.

    减少每次添加的计数器。

Program:

程序:

    2000    LDA 2050
    2003    MOV B,A
    2004    LXI H,2051
    2007    MVI A,00
    2009    MVI C,00
    200B    ADD M
    200C    INR M
    200D    JNC 2011
    2010    INR C
    2011    DCR B
    2012    JNZ 200B
    2015    STA 3050
    2018    MOV A,C
    2019    STA 3051
    201C    HLT

Explanation:

说明:

  • LDA 2050: load accumulator with content of location 2050

    LDA 2050:内容为2050的负载累加器

  • MOV B, A: copy contents of accumulator to register B

    MOV B,A:将累加器的内容复制到寄存器B

  • LXI H, 2051: store 20 to H register and 51 to L register

    LXI H 2051:将20存储到H寄存器并将51存储到L寄存器

  • MVI A, 00: store 00 to accumulator

    MVI A 00:将00存储到累加器

  • MVI C, 00: store 00 to register C

    MVI C,00:将00存储到寄存器C

  • ADD M: add accumulator with the contents of memory location given in HL register pair

    ADD M:将累加器与HL寄存器对中给出的存储器位置的内容相加

  • INR M: increase M by 1

    INR M:将M增加1

  • JNC 2011: if not carry, jump to location 2011 otherwise to the location given in PC

    JNC 2011:如果不携带,则跳至位置2011,否则跳至PC中给定的位置

  • INR C: increase content of register C by 1

    INR C:将寄存器C的内容增加1

  • DCR B: decrease content of register B by 1

    DCR B:将寄存器B的内容减1

  • JNZ 200B: if not zero, jump to location 200B otherwise to the location given in PC

    JNZ 200B:如果不为零,则跳转到位置200B,否则跳转到PC中给定的位置

  • STA 3050: store contents of accumulator to memory location 3050

    STA 3050:将累加器的内容存储到内存位置3050

  • MOV A, C: copy contents of register C to accumulator

    MOV A,C:将寄存器C的内容复制到累加器

  • STA 3051: store contents of accumulator to memory location 3051

    STA 3051:将累加器的内容存储到内存位置3051

  • HLT: terminates the program

    HLT:终止程序

翻译自: https://www.includehelp.com/embedded-system/add-hexadecimal-numbers-stored-in-continuous-memory-or-in-an-array.aspx

十六进制的数怎么存储格式

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值