A89: Re: Help


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

A89: Re: Help




I'll try to give a better answer now...

In your text subroutine, you call a sub. called compare. Here the PC is
pushed on to the stack and it is supposed to be popped by the rts op., but
it never gets that far because of your "bhi text" op. This will probably
fill up the stack with the wrong data, and the program will not execute
correctly. Try making the compare sub. a part of the text sub. or pop the
right number of bytes from the stack before you jump to text.

hope this was a better answer.

Anders

----------
> From: Paco <pacster@usa.net>
> To: assembly-89@lists.ticalc.org
> Subject: A89: Help
> Date: 22. oktober 1998 00:44
> 
> 
> why is this program giving me an illegal op? i am just beginning to
program
> assembly, any help is deeply appreciated.
> 
>     include "tios.h"
>     include "util.h"
>                      
>     xdef _main
>     xdef _comment
>     xdef _ti89   
> 
> _main:
>     move.w   #9,d1
>     move.w   #1,d0
>     jsr      util::idle_loop
>     bsr      text
>     rts
> 
> text:
>     jsr      util::clr_scr          
>     move.w   #4,-(a7)               
>     lea      string(pc),a0          
>     move.l   a0,-(a7)
>     move.w   #50,-(a7)              
>     move.w   #25,-(a7)              
>     jsr      tios::DrawStrXY        
>     add.l    #10,(a7)                 
>     jsr      util::idle_loop
>     sub.w    d0,d1
>     move.w   d0,d2
>     clr.w    d0
>     clr.w    d1
>     move.w   #1,d0
>     move.w   d2,d1
>     jsr      util::idle_loop        
>     jsr      util::clr_scr
>     jsr      util::idle_loop
>     bsr      compare
>     rts
> 
> compare:
>     cmp      d0,d1
>     bhi      text
>     rts
>  
> string:
>     dc.b "Die by my hand!",0
> _comment:
>     dc.b "Tim's Program",0
> 
>     end