EASy68K  
It is currently Fri May 29, 2020 10:18 am

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Sat Nov 30, 2013 3:31 pm 
Offline

Joined: Wed Nov 27, 2013 12:06 am
Posts: 3
I'm starting with assembly 68k and Easy68k and I have a problem now.
What does means the error 'during Exception Handler: SSP odd or outside memory space'? It happen with the below code. Also, I was trying to translate some intel's assembly 8086 to Motorola 68k. The push/pop I did with usual moves but the sub to allocate space to local variables I did with SP itself once there's no bp Is this right?

Code:
START ORG $1000

   BSR DOMAIN
   MOVE #9,D0       
        TRAP #15 
DOMAIN:
   BSR DOFOO
   MOVE D0,-(SP)
   BSR PRINTN
   ADDQ.L #4,SP
   RTS
DOFOO:
        SUB #8,SP
   MOVE #10,D0
   MOVE D0,-4(SP)
   MOVE -4(SP),D0
   MOVE D0,-8(SP)
   MOVE #3,D0
   ADD -8(SP),D0
   MOVE D0,-8(SP)
   MOVE -8(SP),D0
        ADD #8,SP
   RTS
PRINTN:
        MOVE 4(SP),D1
        MOVE #3,D0
        TRAP #15
        RTS

   END START


Top
 Profile  
 
PostPosted: Sat Nov 30, 2013 7:13 pm 
Offline
User avatar

Joined: Thu Dec 16, 2004 6:42 pm
Posts: 1122
The error message is telling you that an exception occurred and that during the processing of the exception the stack pointer was at an odd address or was outside the memory space.

In your example the instruction MOVE D0,(-SP), in the DOMAIN: subroutine, is pushing 2 bytes of D0 onto the stack. The following ADDQ.L #4,SP should be ADDQ.L #2,SP.

_________________
Prof. Kelly


Top
 Profile  
 
PostPosted: Sat Nov 30, 2013 8:24 pm 
Offline

Joined: Wed Nov 27, 2013 12:06 am
Posts: 3
profkelly wrote:
The error message is telling you that an exception occurred and that during the processing of the exception the stack pointer was at an odd address or was outside the memory space.

In your example the instruction MOVE D0,(-SP), in the DOMAIN: subroutine, is pushing 2 bytes of D0 onto the stack. The following ADDQ.L #4,SP should be ADDQ.L #2,SP.


Thanks very much. Also, is my offsets to access local variables right?


Top
 Profile  
 
PostPosted: Sat Nov 30, 2013 11:37 pm 
Offline
User avatar

Joined: Thu Dec 16, 2004 6:42 pm
Posts: 1122
AsmMan wrote:
is my offsets to access local variables right?

I'll leave that for you to decide. Use the simulator to trace through the code (F7). The stack memory may be viewed by selecting "View/Stack" from the simulator menu.

_________________
Prof. Kelly


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: Bing [Bot] and 9 guests


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

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group