如何打印寄存器的内容在EMU8086? [英] How to print the contents of a register in emu8086?

查看:788
本文介绍了如何打印寄存器的内容在EMU8086?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 包括emu8086.inc
#make_com#组织100HS1 DW 50,60,70,80,90,100,120,130,140,​​160,170,190,190,220,250,270,300    MOV SI,0
    MOV CX,16S2:
    MOV AX,S1 [SI]S3:
    INC SI
    CMP AX,100
    JBE S4
    JA S5S4:
    PRINTF AX
    JMP S3S5:
    CMP AX,200
    JB S6
    JA S7S6:
    PRINTF AX
    JMP S3S7:
    PRINTF AX
    JMP S3    结束
    ; printf的AX不工作,我想打印AX的内容


解决方案

  

;的printf AX不工作,我想打印AX的内容


您还没有表现出我们是什么的printf 的是应该做的。因此,所有你的的printf AX 宏调用可能会确定。

但你的程序确实有2个错误的prevent它正确地执行。


  1. 一个.COM程序从顶部开始执行,但是这就是你放置你的数据。这不能执行!因此,无论放置在数据低于code或跳过的数据。

  2. 您使用的数据是字大小的,因此你需要添加2到SI注册遍历数据时。

include 'emu8086.inc'
#make_com#

org 100h

s1 dw 50,60,70,80,90,100,120,130,140,160,170,190,190,220,250,270,300

    MOV SI,0
    MOV CX,16

s2:
    MOV AX,s1[SI]

s3:
    INC SI
    CMP AX,100
    JBE s4
    JA s5

s4:
    PRINTf AX
    JMP s3

s5:
    CMP AX,200
    JB s6
    JA s7

s6:
    PRINTf AX
    JMP s3

s7:
    PRINTf AX
    JMP s3

    END
    ;printf AX doesn't work and i want to print the contents of AX

解决方案

;printf AX doesn't work and i want to print the contents of AX

You haven't shown us what PRINTf is supposed to do. So all of your PRINTf AX macro calls could be OK.

But your program does have 2 errors that prevent it from executing correctly.

  1. A .COM program starts executing from the top but that's where you have placed your data. This must not be executed! So either place the data below the code or jump over the data.
  2. The data you use is word sized and thus you need to add 2 to the SI register when iterating over the data.

这篇关于如何打印寄存器的内容在EMU8086?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆