Re: A82: Definition help


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

Re: A82: Definition help




> > This is a definition from mines82.asm by Wouter Demuynck:
> >  
> >  #define TEXT_ZM(Xloc,Yloc,Addr) .db %00100001 \ .db Xloc,Yloc \ LD
> >  (CURSOR_X),hl \ .db %00100001 \ .dw Addr \ ROM_CALL(D_ZM_STR)
> >  
> >  Evidently this works, since he must have been able to compile a working
> >  game with it.
> >  
> 
> really?!?!?!?!?!  I've been trying to figure out how to get multiple args into
> a definition for a while!  I didn't think you could w/ TASM.  It actually
> looks like the .dbs and .dws would crash the calc.  I'd like Wouter to explain

Well, db %00100001 is the first byte of the opcode for ld hl,XXXX
the .db Xloc,Yloc are the bytes that come after that, so
this is actually the same al ld hl,(Yloc*256)+Xloc
It's The same with .db %00100001 \ .dw Addr

I could have written
  #define TEXT_ZM(Xloc,Yloc,Addr) ld hl,(Yloc*256)+Xloc \ LD  
  (CURSOR_X),hl \ ld hl,Addr \ ROM_CALL(D_ZM_STR)
instead, it's exactly the same.
I can't remember why I actually used the more complicated form

Wouter 


References: