A89: Re: Line 1111 error?


[Prev][Next][Index][Thread]

A89: Re: Line 1111 error?




You screwed up your stack. On the top of the stack there is the return
address for the rts.
And when you read the values off the stack for a subroutine like this, you
should _not_ use (a7)+, that changes the stack pointer value.
You should read them like 4(a7) and 6(a7) or something like that instead.
(I guess there is where your x and y is located.)
And why trash d6 and d7 and save d0 and d1? isn't it better the other way
around?
I think the calling convention assumes d0, d1 and a0 destroyed, so you
shouldn't have to save thoose.
(if useing it in C)

///Olle

----- Original Message -----
From: "Josh 'Gage'" <antgage@apk.net>
To: "Assembly 89 LIST" <assembly-89@lists.ticalc.org>
Sent: Sunday, October 01, 2000 8:22 PM
Subject: A89: Line 1111 error?


>
> I've been banging my head against the wall trying this piece of code:
>
> ; LowDrawSprite( x, y, sprite )
> ; Draws Sprite at (x,y)
> LowDrawSprite:
>  ;;;;;
>  ; Temp Move x,y to d6,d7
>  ;move.w (a7)+,d7
>  ;move.w (a7)+,d6
>
>  move.w #10,d7
>  move.w #15,d6
>
>  movem d0-d2/a0-a1,-(a7) ; Save Registers
>
>  move.w d7,d1
>  move.w d6,d0
>  lea mario_standing_0(pc),a0
>
>
>  jsr graphlib::put_sprite ; Draw Sprite
>
>  movem (a7)+,d0-d2/a0-a1 ; Restore Registers
>
>  rts
>
> now if you compile like that, it's fine. However since this is a TIGCC Low
> Level Command(for C), I want to read the x,y values from the stack. I
tried
> the first two commands(uncomment the first pair of commands and comment
the
> second pair), and I get an error 1111 thing. What's the deal?
>
> I'm still learning assembly so don't bitch at me too much :)
>
>
>




Follow-Ups: References: