汇编语言,两个数字的想加_8085微处理器中的汇编语言程序将两个16位数字相乘...

汇编语言,两个数字的想加

Problem statement:

问题陈述:

Write an assembly language program in 8085 microprocessor to multiply two 16 bit numbers.

在8085微处理器中编写汇编语言程序,以将两个16位数字相乘。

Assumption:

假设:

  1. Starting address of program: 2000

    程序的起始地址:2000

  2. Input memory location: 2050, 2051, 2052, 2053

    输入存储器位置:2050、2051、2052、2053

  3. Output memory location: 2054, 2055, 2056, 2057

    输出存储器位置:2054、2055、2056、2057

Algorithm:

算法:

  1. Load the first data in HL pair.

    加载HL对中的第一个数据。

  2. Move content of HL pair to stack pointer.

    将HL对的内容移到堆栈指针。

  3. Load the second data in HL pair and move it to DE.

    将第二对数据装入HL对并将其移至DE。

  4. Make H register as 00H and L register as 00H.

    将H寄存器设为00H,将L寄存器设为00H。

  5. ADD HL pair and stack pointer.

    添加HL对和堆栈指针。

  6. Check for carry if carry increment it by 1 else move to next step.

    检查进位是否将进位加1,否则进入下一步。

  7. Then move E to A and perform OR operation with accumulator and register D.

    然后将E移至A,并对累加器和寄存器D执行“或”运算。

  8. The value of operation is zero, then store the value else goto step 3.

    运算的值为零

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
古老的8085汇编器 看看先贤们在古老的年代(作于1988年)所写的古老的8085汇编器(BTW:8085是intel的8微处理器,比8086/8088还要古老),明显的2遍扫描的处理方式,将汇编语言转换为机器语言,输出文件为.lst和.hex文件。 代码结构简洁,有效文件仅有6个,容易研读和分析,研读时候需要找到8085的datasheet,以便分析每条指令的意义和程序汇编过程。 asm80 |-- [Apr 21 1988] Makefile |-- [Apr 21 1988] README |-- [Apr 21 1988] as81.c |-- [Apr 21 1988] as82.c |-- [Apr 21 1988] as83.c |-- [Apr 21 1988] as85.c |-- [Apr 21 1988] asm.c |-- [Apr 21 1988] asm.h |-- [Apr 21 1988] asm80.1 `-- [Apr 21 1988] asm80.doc 0 directories, 10 files 代码包含有3个压缩文件 -rw-r--r-- 1 root root 25362 Dec 4 2001 asm80.tar.Z -rw-r--r-- 1 root root 16795 Oct 7 23:57 asm80.tar.gz -rw-r--r-- 1 root root 21523 Oct 18 12:56 asm80-121018.tar.gz 其的asm80.tar.Z是原封不动的原始的代码用Linux环境下的编译器稍微做改动放可编译通过 解压方式: tar zxvf asm80.tar.Z 其的asm80.tar.gz是稍微做改动可在Linux环境下的编译器编译通过的代码包,改动点只有一处, 于asm.h文件的15行,改动如下(原有的代码注释保留,改动后的放在其下面。): //#define putback(c) ((c) != '\0' && --sptr < sbuf && abort()) #define putback(c) ((c) != '\0' && --sptr < sbuf && ({abort();0;})) //snallie@tom.com, Sun Oct 7 22:38:47 CST 2012 编译过程如下 [root@localhost dd]# tar zxf asm80.tar.gz [root@localhost dd]# cd asm80 [root@localhost asm80]# make cc -O -c -o asm.o asm.c cc -O -c -o as81.o as81.c cc -O -c -o as82.o as82.c cc -O -c -o as83.o as83.c cc -O -c -o as85.o as85.c cc -O asm.o as81.o as82.o as83.o as85.o -o asm80 使用asm80 汇编a.asm,生成a.lst以及a.hex [root@localhost asm80]# ./asm80 -l a.asm Total bytes assembled = A20D [root@localhost asm80]# more a.lst a.asm KSE cross assembler for the 8080 page 1 1 ; 2 ; a.asm , a 8080 asm source file 3 ; snallie@tom.com 4 ; Sun Oct 7 22:38:47 CST 2012 5 ; 0100 6 org 100H 0100 7 start: 0100 160A 8 mvi d, 0AH 0102 0E0B 9 mvi c, 0bH 0104 3E00 10 mvi a, 0 0106 CD00A2 11 call subRoutine 0109 00 12 nop 010A C30E01 13 jmp exit 010D 00 14 nop 010E 15 exit: 010E 76 16 hlt 17 A200 18 org 0a200H A200 19 subRoutine: A200 80 20 add b A201 81 21 add c A202 00 22 nop A203 C9 23 Ret 24 A204 25 bufByte: A204 01 26 db 1 A205 27 bufWord: A205 01000200 28 dw 1,2,3,4 A209 03000400 A20D 29 End start ^L a.asm Symbol table dump Page 1 bufbyte = A204 bufword = A205 start = 0100 exit = 010E subroutine = A200 ^L [root@localhost asm80]# more a.hex :0F010000160A0E0B3E00CD00A200C30E010076C2 :0DA20000808100C90101000200030004007C :00000000 [root@localhost asm80]# 其的asm80-121018.tar.gz对代码做了加大改动,并加入的测试的用例及研读的注释,增加的若干的伪指令。 这个编译器的指令表为对指令名按字典序排序的,需要增加新的伪指令是要注意,加入新指令后仍然要保持按字典序排序。 === 古老的经典代码,让你温故而知新。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值