简体   繁体   English

Mortorola 68k:如何将字符串ASCII存储在地址寄存器a0中

[英]Mortorola 68k : How String ASCII is stored in address register a0

I am very new to Assembly programming in 68k. 我对68k的汇编编程非常陌生。 I am using Easy68k. 我正在使用Easy68k。

I have a program: 我有一个程序:

    ORG    $1000
START:                

* Put program code here

    lea MSG,a1      ; loads MSG into address register a1
    move.b #14,d0   ; 14 gets coverted to hex E
    trap #15

    move.b #9,d1    ; 9 decimal gets converted t hex 9
    SIMHALT             ; halt simulator

* Put variables and constants here

MSG dc.b    'It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout',0 

    END    START        ; last line of source

As far is I know, the address register a1 can store long-word length items. 据我所知,地址寄存器a1可以存储长字长度的项目。 But you see the string 但是你看到的字符串

"It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout" “一个公认的事实是,当阅读者阅读页面的布局时,他们会被页面的可读内容分散注意力”

convert it to its ASCII format, you will see how the hex for each word would exceed the long-word length. 将其转换为ASCII格式,您将看到每个单词的十六进制将如何超过长单词的长度。

So How is this string stored? 那么,该字符串如何存储? I want to understand how assembly is storing and displaying the string to the screen. 我想了解汇编是如何存储字符串并将其显示在屏幕上的。

Can someone please explain? 有人可以解释一下吗?

The comment "loads MSG into address register a1" is somewhat misleading. 注释“将MSG加载到地址寄存器a1中”有点误导。 What you're loading into a1 is not the contents at MSG ; 您要加载到a1中的内容不是MSG的内容; you're loading the address of MSG . 您正在加载MSG的地址。 A label (eg MSG ) is just a name for some location in your program that makes it convenient to refer to that location. 标签(例如MSG )只是程序中某个位置的名称,可以方便地引用该位置。

The address has a fixed size which fits into the register and is independent of the data stored at that address. 该地址的大小固定在寄存器中,并且独立于该地址存储的数据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM