【问题标题】:Why does this 8 appear in my assembler code?为什么这个 8 出现在我的汇编代码中?
【发布时间】:2016-01-28 06:35:14
【问题描述】:

这是我的汇编代码,当我运行它时出现随机 8,我不知道如何摆脱它。

    B main

number  DEFW    4
verse   DEFB    " men went to mow\nWent to mow a meadow\n",0
verse2  DEFB    " men," 



    ALIGN


main    ADR R0,number   ;puts address of number into R0
        SWI 4           ;prints value in number

        ADR R0,verse    
        SWI 3           ;prints verse

        ADR R0,number
        SWI 4           ;prints value number

        ADR R0,verse2   ;places the address of verse to R0
        SWI 3           ;prints verse2

        SWI 2

【问题讨论】:

    标签: assembly


    【解决方案1】:

    您没有像 verse 那样终止您的 verse2,因此它将继续打印文本,直到找到 0 字节。

    8 可能是第一条指令的一部分,它可能以0x38 0x00 ... 开头,0x38 是 '8' 的 ASCII 码。

    不确定SWI 3 在不可打印的情况下会做什么,但可能在 1-31 范围内的值之间存在内存,并且正在被忽略。

    【讨论】:

      猜你喜欢
      • 2012-06-29
      • 2020-06-15
      • 1970-01-01
      • 1970-01-01
      • 2014-03-24
      • 1970-01-01
      • 2015-06-22
      • 1970-01-01
      相关资源
      最近更新 更多