Search code examples
68000easy68k

68k -- Why is this loading FF?


I've been trying to figure out why this program loads FF into D1. Here is the code:

    ORG    $1000

START:
    MOVE.B      pattern,D1
    SIMHALT

pattern     EQU     $AA50

    END    START

My thoughts are that pattern is in hex. It's a word. I'm just moving the least significant byte of pattern into D1. This least significant byte is 50 in hex, which is 01010000 in binary. I would expect D1 to contain $00000050 but instead it contains $000000FF. I'm at a loss. FF would be 11111111 in binary which is (obviously) not 01010000.

Any help would be appreciated. I'm using Easy68k.


Solution

  • Looks like you're loading in FF from the address $0000AA50. That's my guess, but I'll try it out to see if that was the case.

    **-----------------------------------------------------------------------------
    
        ORG    $1000
    
    START:
    
        MOVE.B #pattern,D1  ;Declare pattern as a
                            ;Hexadecimal using #
        SIMHALT
    
    pattern EQU $AA50       ;ERRROR:This will exceed 8 bits
                            ;Else use MOVE.W
    
    *pattern EQU $50        ;This works too using MOVE.B
    
    END    START
    
    **-----------------------------------------------------------------------------