EASy68K
http://easy68k.com/EASy68Kforum/

Adress error
http://easy68k.com/EASy68Kforum/viewtopic.php?f=6&t=1611
Page 1 of 1

Author:  cross [ Tue Feb 13, 2018 12:18 pm ]
Post subject:  Adress error

Hello!

Iam currently beginning a project to learn 68k asm and general understanding the 68k cpu.
Ive bought the book "The 68000 processor" by James L. Antonakos. And just to check that i had the toolchain working i typed in the example program in side 39:

Code:
        ORG     $8000
SUM     DC.W    0
DATA    DS.B    16
       
        ORG $8100       
TOTAL   CLR.W   D0
        MOVE.B  #16,D1
        MOVEA.L #DATA,A0
LOOP    ADD.B   (A0)+,D0
        SUBI.B  #1,D1
        BNE     LOOP
        MOVEA.L #SUM,A1
        MOVE.W  D0,(A1)
        RTS

        END TOTAL


It assembles the code without any error or warnings, however in the simulator i get:
Code:
Address Error: Instruction at ffffffff accessing address ffffffff


I just wanted to know what is causing this. Is the book not compatible with the easy68k or is there something else wrong?

Thank you.

Author:  profkelly [ Tue Feb 13, 2018 1:21 pm ]
Post subject:  Re: Adress error

The RTS instruction pulls a return address from the stack and goes to that address, however since TOTAL was not called as a subroutine there is not a valid return address. Replace the RTS instruction with SIMHALT and it will work.

cross wrote:
Code:
        ORG     $8000
SUM     DC.W    0
DATA    DS.B    16
       
        ORG $8100       
TOTAL   CLR.W   D0
        MOVE.B  #16,D1
        MOVEA.L #DATA,A0
LOOP    ADD.B   (A0)+,D0
        SUBI.B  #1,D1
        BNE     LOOP
        MOVEA.L #SUM,A1
        MOVE.W  D0,(A1)
        SIMHALT

        END TOTAL


Author:  cross [ Tue Feb 13, 2018 3:58 pm ]
Post subject:  Re: Adress error

Thank you very much for that info.

Is this due to a error in the book, or is it something that is for the simulator only?
I guess that the "SIMHALT" is only for the simulator?

Author:  profkelly [ Tue Feb 13, 2018 7:58 pm ]
Post subject:  Re: Adress error

Correct, SIMHALT is unique to EASy68K.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/