A89: Re: Re: Re: Line 1111 error?
[Prev][Next][Index][Thread]
A89: Re: Re: Re: Line 1111 error?
the return address is on top of the stack and is a long.
try
move.w 4(a7),d1 ; Read Y Value
move.w 6(a7),d0 ; Read X Value
instead.
you say "doesn't _even_ show up"? does it still crash?
If you should save the regs, you should do it before you change them too..
that is, right after the label.
///Olle
----- Original Message -----
From: "Josh 'Gage'" <antgage@apk.net>
To: <assembly-89@lists.ticalc.org>
Sent: Sunday, October 01, 2000 10:32 PM
Subject: A89: Re: Re: Line 1111 error?
>
> ok, so my new piece of code is like so:
>
> LowDrawSprite:
> move.w 2(a7),d1 ; Read Y Value
> move.w 4(a7),d0 ; Read X Value
>
> ; Don't need these?
> ;movem d0-d2/a0-a1,-(a7) ; Save Registers
>
> lea mario_standing_0(pc),a0
>
> jsr graphlib::put_sprite ; Draw Sprite
>
> ;movem (a7)+,d0-d2/a0-a1 ; Restore Registers
>
> rts
>
> now my sprite doesn't even show up on the screen...
>
> thanks for the help guys, I know I'm a newbie at this stuff, im just
> thankful that you guys aren't being asses about it :)
>
> ----- Original Message -----
> From: "Olle Hedman" <oh@hem.passagen.se>
> To: <assembly-89@lists.ticalc.org>
> Sent: Sunday, October 01, 2000 3:04 PM
> Subject: 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: