/* Moveto_ix_b: These routines force the scale factor to the value of the B register, 
  and then move the pen to the (y,x) position pointed to by the X-register. 
  The X-register is then incremented by 2. */
#define Moveto_ix_b(c, s)    jsrxb(c, s, 0xF30E)   // 
#define Moveto_ix()          jsr(0xF310)   // 

/* Moveto_d: This routine uses the current scale factor, and moves the pen to the (y,x) 
   position specified in D register. */
#define Moveto_d(x, y)       jsrba(x, y, 0xF312)   // 

#define Reset0Ref_D0()       jsr(0xF34A)   // 
#define Check0Ref()          jsr(0xF34F)   // 
#define Reset0Ref()          jsr(0xF354)   // 
#define Reset_Pen()          jsr(0xF35B)   // 
#define Reset0Int()          jsr(0xF36B)   // 
#define Print_Str_hwyx()     jsr(0xF373)   // 
#define Print_Str_yx()       jsr(0xF378)   // 
#define Print_Str_d(y,x,p)    jsrabu(y,x,p, 0xF37a) 
#define Print_List_hw()      jsr(0xF385)   // 
#define Print_List()         jsr(0xF38A)   // 
#define Print_List_chk()     jsr(0xF38C)   // 
#define Print_Ships_x()      jsr(0xF391)   // 
#define Print_Ships()        jsr(0xF393)   // 
#define Mov_Draw_VLc_a()     jsr(0xF3AD)   // count y x y x ...
#define Mov_Draw_VL_b()      jsr(0xF3B1)   // y x y x ...
#define Mov_Draw_VLcs()      jsr(0xF3B5)   // count scale y x y x ...
#define Mov_Draw_VL_ab()     jsr(0xF3B7)   // y x y x ...
#define Mov_Draw_VL_a()      jsr(0xF3B9)   // y x y x ...
#define Mov_Draw_VL()        jsr(0xF3BC)   // y x y x ...
#define Mov_Draw_VL_d()      jsr(0xF3BE)   // y x y x ...

/* Draw_VLc: This routine draws vectors between the set of (y,x) points 
   pointed to by the X register. The number of vectors to draw is specified 
   as the first byte in the vector list. The current scale factor is used. 
   The vector list has the following format:

     count, rel y, rel x, rel y, rel x, ...
*/
#define Draw_VLc(c)          jsrx(c, 0xF3CE)   // count y x y x ...
#define Draw_VL_b()          jsr(0xF3D2)   // y x y x ...
#define Draw_VLcs()          jsr(0xF3D6)   // count scale y x y x ...
#define Draw_VL_ab()         jsr(0xF3D8)   // y x y x ...
#define Draw_VL_a()          jsr(0xF3DA)   // y x y x ...
#define Draw_VL()            jsr(0xF3DD)   // y x y x ...

/* Draw_Line_d: This routine will draw a line from the current pen position, 
   to the point specified by the (y,x) pair specified in the D register. 
   The current scale factor is used. Before calling this routine, 
   $C823 should be = 0, so that only the one vector will be drawn. */
#define Draw_Line_d(x, y)    jsrba(x, y, 0xf3df) // y x y x ...

#define Draw_VLp_FF()        jsr(0xF404)   // pattern y x pattern y x ... 0x01
#define Draw_VLp_7F(xp)      jsrx(xp, 0xF408)   // pattern y x pattern y x ... 0x01
#define Draw_VLp_scale()     jsr(0xF40C)   // scale pattern y x pattern y x ... 0x01
#define Draw_VLp_b()         jsr(0xF40E)   // pattern y x pattern y x ... 0x01
#define Draw_VLp()           jsr(0xF410)   // pattern y x pattern y x ... 0x01
#define Draw_Pat_VL_a()      jsr(0xF434)   // y x y x ...
#define Draw_Pat_VL()        jsr(0xF437)   // y x y x ...
#define Draw_Pat_VL_d()      jsr(0xF439)   // y x y x ...
#define Draw_VL_mode()       jsr(0xF46E)   // mode y x mode y x ... 0x01
#define Print_Str()          jsr(0xF495)   // 
#define Random_3()           jsr(0xF511)   // 
#define Random()             jsr(0xF517)   // 
#define Init_Music_Buf()     jsr(0xF533)   // 
#define Clear_x_b()          jsr(0xF53F)   // 
#define Clear_C8_RAM()       jsr(0xF542)   // never used by GCE carts?
#define Clear_x_256()        jsr(0xF545)   // 
#define Clear_x_d()          jsr(0xF548)   // 
#define Clear_x_b_80()       jsr(0xF550)   // 
#define Clear_x_b_a()        jsr(0xF552)   // 
#define Dec_3_Counters()     jsr(0xF55A)   // 
#define Dec_6_Counters()     jsr(0xF55E)   // 
#define Dec_Counters()       jsr(0xF563)   // 
#define Delay_3()            jsr(0xF56D)   // 30 cycles
#define Delay_2()            jsr(0xF571)   // 25 cycles
#define Delay_1()            jsr(0xF575)   // 20 cycles
#define Delay_0()            jsr(0xF579)   // 12 cycles
#define Delay_b()            jsr(0xF57A)   // 5*B + 10 cycles
#define Delay_RTS()          jsr(0xF57D)   // 5 cycles
#define Bitmask_a()          jsr(0xF57E)   // 
#define Abs_a_b()            jsr(0xF584)   // 
#define Abs_b()              jsr(0xF58B)   // 
#define Rise_Run_Angle()     jsr(0xF593)   // 
#define Get_Rise_Idx()       jsr(0xF5D9)   // 
#define Get_Run_Idx()        jsr(0xF5DB)   // 
#define Get_Rise_Run()       jsr(0xF5EF)   // 
#define Rise_Run_X()         jsr(0xF5FF)   // 
#define Rise_Run_Y()         jsr(0xF601)   // 
#define Rise_Run_Len()       jsr(0xF603)   // 
#define Rot_VL_ab()          jsr(0xF610)   // 
#define Rot_VL()             jsr(0xF616)   // 
#define Rot_VL_Mode_a()      jsr(0xF61F)   // 
#define Rot_VL_Mode()        jsr(0xF62B)   // 
#define Rot_VL_dft()         jsr(0xF637)   // 
#define Xform_Run_a()        jsr(0xF65B)   // 
#define Xform_Run()          jsr(0xF65D)   // 
#define Xform_Rise_a()       jsr(0xF661)   // 
#define Xform_Rise()         jsr(0xF663)   // 
#define Move_Mem_a_1()       jsr(0xF67F)   // 
#define Move_Mem_a()         jsr(0xF683)   // 

/* Init_Music_chk: These routines are responsible for filling the music work 
   buffer while a sound is being made. It should be called once during each 
   refresh cycle. If you want to start a new sound, then you must set $C856 
   to 0x01, and point the U-register to the sound block. If no sound is in 
   progress ($C856 = 0), then it returns immediately (unless you called 
   Init_Music or Init_Music_dft, which do not make this check). When a sound 
   is in progress, $C856 will be set to 0x80.

   These routines process a single note at a time, and calculate the amplitude 
   and course/fine tuning values for the 3 sound channels. The values 
   calculated are stored in the music work buffer, at $C83F-$C84C.

  Music data format:

  header word -> $C84F 32 nibble ADSR table
  header word -> $C851 8-byte "twang" table
  data bytes

   The ADSR table is simply 32 nibbles (16 bytes) of amplitude values.

   The twang table is 8 signed bytes to modify the base frequency of each note 
   being played. Each channel has a different limit to its twang table index 
   (6-8) to keep them out of phase to each other.

  Music data bytes:

   Bits 0-5 = frequency
   Bit 6 clear = tone
   Bit 6 set = noise
   Bit 7 set = next music data byte is for next channel
   Bit 7 clear, play note with duration in next music data byte:
   bits 0-5 = duration
   bit 6 = unused
   bit 7 set = end of music */
#define Init_Music_chk(m)    jsru(m, 0xF687)   // 
#define Init_Music()         jsr(0xF68D)   // 
#define Init_Music_x()       jsr(0xF692)   // 
#define Select_Game()        jsr(0xF7A9)   // 
#define Clear_Score()        jsr(0xF84F)   // 
#define Add_Score_a()        jsr(0xF85E)   // 
#define Add_Score_d()        jsr(0xF87C)   // 
#define Strip_Zeros()        jsr(0xF8B7)   // 
#define Compare_Score()      jsr(0xF8C7)   // 
#define New_High_Score()     jsr(0xF8D8)   // 
#define Obj_Will_Hit_u()     jsr(0xF8E5)   // 
#define Obj_Will_Hit()       jsr(0xF8F3)   // 
#define Obj_Hit()            jsr(0xF8FF)   // 
#define Explosion_Snd()      jsr(0xF92E)   // 
#define Draw_Grid_VL()       jsr(0xFF9F)   // 
                                ;
#define music1   0xFD0D                 // 
#define music2   0xFD1D                 // 
#define music3   0xFD81                 // 
#define music4   0xFDD3                 // 
#define music5   0xFE38                 // 
#define music6   0xFE76                 // 
#define music7   0xFEC6                 // 
#define music8   0xFEF8                 // 
#define music9   0xFF26                 // 
#define musica   0xFF44                 // 
#define musicb   0xFF62                 // 
#define musicc   0xFF7A                 // 
#define musicd   0xFF8F                 // 

