简体   繁体   中英

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

I am very new to Assembly programming in 68k. I am using 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. 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.

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. What you're loading into a1 is not the contents at MSG ; you're loading the address of MSG . A label (eg MSG ) is just a name for some location in your program that makes it convenient to refer to that location.

The address has a fixed size which fits into the register and is independent of the data stored at that address.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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