Re: LF: Still: fargo programming


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

Re: LF: Still: fargo programming




Your first program looks fine... does it run correctly?

As for the second, the problem is a common mistake.  I'm willing to wager
that the second program does actually print something it crashes the calc.

So what's wrong?  You pushed the address of the message onto the stack,
you called your subroutiene, but you never popped that address off of the
stack...  try add.l #4,a7 or the supposedly faster lea 10(a7),a7 right
after the bsr statement/opcode.

--Shawn Walker (swalker@earthling.net)


On Wed, 18 Jun 1997 Hmlacage@aol.com wrote:

> I don' t understand: i hadn' t been thinking much in my last email: what i
> had done was stupid....
> Howerver: here is what i don' t understand: i want to disp a message on the
> screen: i don' t want to use a macro ( it is some sort of exercise ) . 
> Here is a hello world prog. I would like to write a subroutine which disp a
> message  and wich uses the adress of the param as in param. Thus , i wrote
> the 2nd prog. ( see and of message ) What is wrong with it ? 
> 
>              @Program          prog_code,prog_name
> 
> 
> prog_code:
> 
>     jsr flib[clr_scr]
> 
> 
> main:
>     move.w   #4,-(A7)
>     pea      ess(PC)
>     move.w   #10,-(A7)
>     move.w   #10,-(A7)
>     jsr      romlib[puttext]
>     lea      10(A7),A7
>     jsr      flib[idle_loop]
>     rts
> 
> ess: dc.b "coucou",0
> 
> prog_name:
>   dc.b "essai",0
> 
>          reloc_open
>          add_library romlib
>          add_library flib
>          reloc_close
>          end
> 
> 
> 2nd prog: 
> 
>             @Program          prog_code,prog_name
> 
> 
> prog_code:
> 
>     jsr flib[clr_scr]
> 
> main:
>     pea      ess        ; Loads "ess" adress in the stack
>     bsr      affich
>     rts
>     
> affich:
>     move.l   D7,A1      ; gets back the param in A1
>     lea      4(A7),A7   ; puts the stack back to normal
>     move.w   #4,-(A7)   ;
>     pea      D7(PC)     ;    loading params for puttext  
>     move.w   #10,-(A7)  ;    
>     move.w   #10,-(A7)  ;
>     jsr      romlib[puttext]
>     lea      10(A7),A7
>     rts
> 
> 
> ess: dc.b "coucou",0
> 
> prog_name:
>   dc.b "essai",0
> 
>          reloc_open
>          add_library romlib
>          add_library flib
>          reloc_close
>          end
> 
> 


References: