Re: A89: error


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

Re: A89: error




Its easier to debug if you tell a brief description ofwhat the prog is supposed
to do, and exactly what happens when you try to run it.. I saw some strange
thing as I looked through it.. marked inside:

Joe Koston wrote:
> 
> Well first thing is im sorry about my attitude the other day...bad day..no
> excuse but im sorry
> 
> and another thing...please bear with me its my first program ever so i know
> its not very good but would you guys please help me with it.  It keeps
> giving me an addres error. thanks for any help...remember im a real newbie
> 
>         include "tios.h"
>         include "util.h"
> 
>         xdef _main
>         xdef _ti89
> 
> _main
>         move.w #15,y_coord
>         move.w #15,x_coord
> 
> test:
>         jsr util::clr_scr
>         move.w #2,-(a7)
>         jsr tios::FontSetSys
>         add.l #4,a7		;<- here you have messed up the stack it
>         move.w #4,-(a7)		should be add.l #2,a7 to restore it
>         pea bates(pc)			try change that..
>         move.w y_coord,-(a7)
>         move.w x_coord,-(a7)
>         jsr tios::DrawStrXY
>         add.l #10,a7
>         jsr util::idle_loop
>         jsr util::clr_scr
>         bsr move		;<- this is strange..  why bsr? why any jump?
				    the label move is just beneth..
> 
> move:
>         cmp #52,d0
>         beq left
>         cmp #54,d0
>         beq right
>         cmp #264,d0
>         beq exit
>         bsr test		;<- no good with bsr here either..  my guess
					is that you are filling upp the stack with junk..

bsr is jump to subroutine, it will jump to label and then return to this point
at the next rts..
the only rts in this program is the one at the end..  every time you bsr, the
return address is pushed on the stack.. 

> 	
> left:
>         bsr test
> 
> right:
>         move.w x_coord,d0
>         add.w #1,d0
>         move.w d0,x_coord
>         bsr test
> 
> exit:
>         jsr util::clr_scr ; i think its around here
>         rts	 <- I think it is here...  poor rts tries to find a return address on the stack and find only a lot of junk, and jumps out in cyberspace...


> 
> bates: dc.b "Hey Matt",0
> y_coord: dc.w 15
> x_coord: dc.w 15
>  end
> 
> joE
> 
> ICQ: 12676345  AIM: Olp1726
> http://members.xoom.com/olp1726/
> 
> --------------Quotes---------------
> -"Love your enemies just in case your friends turn out to be a buunch of
> bastards."
> 
> -"You can go a long way with a smile. You can go a lot farther with a smile
> and a gun."
> -Al Capone
> 
> -"I believe in computer dating, but only if the computers are truly in
> love. " Groucho Marx

Isnt it enough with one quote? :) (if any)

//Olle


Follow-Ups: References: