It is currently Tue Jun 02, 2020 5:00 pm

 All times are UTC

 Page 1 of 1 [ 8 posts ]
 Print view Previous topic | Next topic
Author Message
 Posted: Tue Dec 23, 2008 3:47 pm

Joined: Tue Dec 23, 2008 3:28 pm
Posts: 5
Location: Byron, GA
Hi

I'm taking a 68000 programming course that came with ASM68k & EMU68k. I like easy68k much better (I like to be able to see the registers on the fly), but I keep running into a problem. I searched this board any didn't find anything on it.

Several times now when I enter code that works fine in EMU68k, I get the following error in Easy68k:

"Address or Bus error during exception processing. Execution halted."

At first I thought it was due to differences in the TRAPs, but I put a program in this morning where I encountered this error before any TRAPS had been executed (I think - read on...). As an example, here is the code I put in this morning:

====================

START ORG \$8000
X1 DC.W 0
Y1 DC.W 6
X2 DC.W 1
Y2 DC.W 9
X3 DC.W 10
Y3 DC.W 486
X4 DC.W 100
Y4 DC.W 49806
PASS DC.B 'Subroutine passes.',0
FAIL DC.B 'Subroutine fails.',0

ORG \$8100
TEST MOVE.W X1,D0
CMP.W Y1,D1
MOVE.W X2,D0
CMP.W Y2,D1
MOVE.W X3,D0
CMP.W Y3,D1
MOVE.W X4,D0
CMP.W Y4,D1
MOVEA.L #PASS,A3

SEND TRAP #3
TRAP #9

BRA SEND

MULS D0,D1
MULS #5,D1
MULS #2,D0
SUB.W D0,D1
RTS

END START

===================

BTW, this is a routine to figure out the quadratic equation "y=5x^2 - 2x + 6," along with the testing program. For that code to work properly in EMU68k, the last statement needs to say "END TEST." Once that is done, everything works fine in EMU68k. But I don't wanna use EMU68k, I prefer Easy68k.

Anyhow, when I manually trace through that code in Easy68k I can click the "trace" button three times before the program counter jumps to \$FFFFFFFF. Two more clicks and I get the error I described above. The program counter starts at \$8000 (due to the ORG - I've at least learned something so far). One trace click changes it to 8004 (due to size .W), second click changes it to 8008, third click changes it to FFFFFFFF. Since the program counter mysteriously jumped to FFFFFFFF, I can't figure out which line is causing the error. Furthermore, I don't understand why the PC jumped to FFFFFFFF in the first place.

Any ideas?

Thanks,

Tom

Top

 Post subject: Posted: Tue Dec 23, 2008 10:50 pm

Joined: Thu Dec 16, 2004 6:42 pm
Posts: 1122
I see two issues in the program

In EASy68K the label used with the END directive sets the starting address of the program. Use
Code:
END      TEST

TEST is the starting location of your program.

A second issue is the TRAP instruction. In EASy68K all simulator functions are accessed with TRAP #15. Any other trap instructions will cause a 68000 trap exception. To handle the trap exceptions in code you need to turn on exception processing in the simulator by checking "Enable Exceptions" in the simulator Options. I'm not familiar with EMU68K traps.

_________________
Prof. Kelly

Top

 Post subject: Posted: Wed Dec 24, 2008 12:27 pm

Joined: Tue Dec 23, 2008 3:28 pm
Posts: 5
Location: Byron, GA
Okay, now I understand about the label with the "END" directive setting the program's starting address (thanks).

With the code I'm trying to put in, if I change the END label to TEST, then the sim skips the first 11 lines of my code (which makes sense - I'm now telling it to start at "TEST," which is after line 11). When I do that, the program actually progresses line-by-line in the simulator as I would expect it to - problem is, I have no X or Y values, because those were skipped.

So now I need to somehow include the X and Y values. I've tried moving them into the "TEST" routine, but then I run into my original problem with the "Address or Bus error...". Any ideas?

Thanks for the help,

Tom

Top

 Post subject: Posted: Wed Dec 24, 2008 2:15 pm

Joined: Tue Dec 23, 2008 3:28 pm
Posts: 5
Location: Byron, GA
I've done some fiddling around, and my problem has to do with the DC directive. These two very simple programs will not work:

===prog 1===
START ORG \$1000

DC.B 15
MOVE (\$1000),D0

TRAP #15 ;Halt Simulator

END START
==========
===prog 2===
START ORG \$1000

TEST DC.B 15
MOVE TEST,D0

TRAP #15 ;Halt Simulator

END START
==========

Any suggestions on where I'm going wrong with DC?

Tom

Top

 Post subject: Posted: Wed Dec 24, 2008 5:01 pm

Joined: Thu Dec 16, 2004 6:42 pm
Posts: 1122
To do text input/output in EASy68K put the task number in register D0 then do TRAP #15. Look at the programs in the EASy68K examples folder for more examples. I've changed your program to display the two messages. Just put the numbers you want for X1,Y1 etc in the code. I have not verified the correctness of this program, I'll leave that up to you.

Code:
*-----------------------------------------------------------
* Program    :
* Written by :
* Date       :
* Description:
*-----------------------------------------------------------
START ORG \$8000

MOVE.W X1,D0
CMP.W Y1,D1
MOVE.W X2,D0
CMP.W Y2,D1
MOVE.W X3,D0
CMP.W Y3,D1
MOVE.W X4,D0
CMP.W Y4,D1
MOVEA.L #PASS,A1

SEND MOVE #13,D0   task #13 = display null terminated string pointed to by A1

MOVE.B   #9,D0
TRAP   #15      Halt Simulator

BRA SEND

MULS D0,D1
MULS #5,D1
MULS #2,D0
SUB.W D0,D1
RTS

X1  DC.W 0
Y1  DC.W 6
X2  DC.W 1
Y2  DC.W 9
X3  DC.W 10
Y3  DC.W 486
X4  DC.W 100
Y4  DC.W 49806
PASS DC.B 'Subroutine passes.',0
FAIL DC.B 'Subroutine fails.',0

END START

_________________
Prof. Kelly

Top

 Post subject: Posted: Wed Dec 24, 2008 7:09 pm

Joined: Tue Dec 23, 2008 3:28 pm
Posts: 5
Location: Byron, GA
Professor Kelly,

That code works. Seems that my main problem was putting the DCs before the rest of the code. I can even ORG the DCs in a lower memory address than the rest of the code, but in easy68k the DCs can not (at least in this example) be placed before the code that uses the constants. Is that a general rule?

I haven't tested the code to be sure it works, but I will. It should work, unless I made a typo, since the code came straight from the textbook. I'm not actually trying to write code at this point, I just want to understand how to get easy68k to work properly with the examples from my book so I can use it instead of emu68k (there are differences).

Thanks again,

Tom

Top

 Post subject: Posted: Wed Dec 24, 2008 7:35 pm

Joined: Tue Dec 23, 2008 3:28 pm
Posts: 5
Location: Byron, GA
That's not quite right. The DCs can be placed before the code that uses the constants, but ithe memory addresses those lines are assigned to must be higher than the addresses of the code that uses the constants.

I have to do some more tinkering, but I got my original question answered. Thanks for the help.

Tom

Top

 Post subject: Posted: Wed Dec 24, 2008 10:22 pm

Joined: Thu Dec 16, 2004 6:42 pm
Posts: 1122
The DC directives may be placed anywhere in the code. The important point is to make sure the label used with the END directive points to the start of the program code and not to the DC directives.

_________________
Prof. Kelly

Top

 Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending
 Page 1 of 1 [ 8 posts ]

 All times are UTC

#### Who is online

Users browsing this forum: MicroCoreLabs and 5 guests

 You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum

Search for:
 Jump to:  Select a forum ------------------ EASy68K Forum    FAQ    Latest Features    EASy68K Questions    68000 Programming Questions    Wish List    Wishes Granted    Undocumented Features    Documented Features    General Discussion    EASy68K Projects