summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--RDATA.S82419
-rw-r--r--RDIRS.S82546
-rw-r--r--RDISP.S82210
-rw-r--r--RKL.S821449
-rw-r--r--RMAIN.S821361
-rw-r--r--RSNDS.S82473
-rw-r--r--RSTMP.S821930
-rw-r--r--RSUBR.S821328
-rw-r--r--RWAVE.S82953
9 files changed, 8669 insertions, 0 deletions
diff --git a/RDATA.S82 b/RDATA.S82
new file mode 100644
index 0000000..384d3ab
--- /dev/null
+++ b/RDATA.S82
@@ -0,0 +1,419 @@
+******************************************************
+******************************************************
+*
+*
+* ROBOTRON 6-JULY-83
+* 18-JULY-83 3:30
+* 23-AUGUST-83 12:30
+*
+*
+* RDATA.S
+*
+******************************************************
+*
+* ROBOTRON DATA
+*
+*******************
+
+*
+* THIS FOLLOWS RSOUNDS.S IN MEMORY... NO ORG NEEDED
+*
+
+******************************************
+******************************************
+*
+* MISCELLANEOUS TABLES
+*
+
+
+******************************************
+*
+* MOVTBL -- POINTS TO VARIOUS ROUTINES TO HANDLE
+* MOVING EACH DIFFERENT TYPE OF OBJECT
+* POINTERS ARE ADDRESSES IN LOW,HIGH FORMAT
+* THE 14 OBJECT TYPES:
+MOVTBL DW GMOV ;GRUNTS
+ DW FMOV ;MOMMIES
+ DW FMOV ;DADDIES
+ DW FMOV ;MIKEYS
+ DW HMOV ;HULKS
+ DW SQMOV ;SPHEROIDS
+ DW SQMOV ;QUARKS
+ DW ETMOV ;ENFORCERS
+ DW ETMOV ;TANKS
+ DW BMOV ;BRAINS
+ DW PMOV ;PROGS
+ DW MMOV ;ENFORCER MISSILES
+ DW MMOV ;CRUISE MISSILES
+ DW MMOV ;TANK MISSILES
+*
+******************************************
+*
+* STICKTBL -- FOR ANY OF THE 4-BIT DIR CODES, RETURN A 0-7 DIRECTION
+*
+STICKTBL DB $00 ;0 INVALID
+ DB $00 ;1 INVALID
+ DB $00 ;2 INVALID
+ DB $00 ;3 INVALID
+ DB $00 ;4 INVALID
+ DB $05 ;5 SE
+ DB $04 ;6 NE
+ DB $02 ;7 E
+ DB $00 ;8 INVALID
+ DB $06 ;9 SW
+ DB $07 ;A NW
+ DB $03 ;B W
+ DB $00 ;C INVALID
+ DB $01 ;D S
+ DB $00 ;E N
+ DB $00 ;F NONE
+
+******************************************
+*
+* X,YDIRTBL - RETURN X AND Y INCREMENTS GIVEN A DIRECTION ( 0 - 7 )
+*
+XDIRTBL DB $00 ;N
+ DB $00 ;S
+ DB $01 ;E
+ DB $FF ;W
+ DB $01 ;NE
+ DB $01 ;SE
+ DB $FF ;SW
+ DB $FF ;NW
+
+YDIRTBL DB $FE ;N
+ DB $02 ;S
+ DB $00 ;E
+ DB $00 ;W
+ DB $FE ;NE
+ DB $02 ;SE
+ DB $02 ;SW
+ DB $FE ;NW
+
+******************************************
+*
+* X,YDIRTBL4 -- FOR ANY OF THE 4-BIT DIR CODES, RETURN X OR Y INCREMENT
+*
+XDIRTBL4 DB $00 ;0 INVALID
+ DB $00 ;1 INVALID
+ DB $00 ;2 INVALID
+ DB $00 ;3 INVALID
+ DB $00 ;4 INVALID
+ DB $01 ;5 SE
+ DB $01 ;6 NE
+ DB $01 ;7 E
+ DB $00 ;8 INVALID
+ DB $FF ;9 SW
+ DB $FF ;A NW
+ DB $FF ;B W
+ DB $00 ;C INVALID
+ DB $00 ;D S
+ DB $00 ;E N
+ DB $00 ;F INVALID
+*
+YDIRTBL4 DB $00 ;0 INVALID
+ DB $00 ;1 INVALID
+ DB $00 ;2 INVALID
+ DB $00 ;3 INVALID
+ DB $00 ;4 INVALID
+ DB $02 ;5 SE
+ DB $FE ;6 NE
+ DB $00 ;7 E
+ DB $00 ;8 INVALID
+ DB $02 ;9 SW
+ DB $FE ;A NW
+ DB $00 ;B W
+ DB $00 ;C INVALID
+ DB $02 ;D S
+ DB $FE ;E N
+ DB $00 ;F INVALID
+*
+
+******************************************
+*
+* GSPTBL -- STARTING GRUNT SPEEDS FOR VARIOUS WAVES
+* DATA HERE IS FOR WAVES 1 TO 7, HIGHER WAVES USE #GSPMAX
+*
+;SHOULD BE GSPTBL DB $A,$9,$8,$7,$6,$5,$4
+GSPTBL DB $7F,$9,$8,$7,$6,$5,$4
+GSPMAX EQU $4 ;MAXIMUM START-OF-RACK SPEED
+
+******************************************
+*
+* HSPTBL -- STARTING HULK SPEEDS FOR VARIOUS WAVES
+* DATA HERE IS FOR WAVES 1 TO 13, HIGHER WAVES USE #HSPMAX
+*
+HSPTBL DB $7,$F,$E,$D,$0,$C,$B,$A,$9,$0,$8,$7,$6 ;ZEROES := NO HULKS
+HSPMAX EQU $6 ;MAXIMUM START-OF-RACK SPEED
+
+******************************************
+*
+* SQBTTBL -- BASE TIMES UNTIL FIRST BIRTH FOR VARIOUS WAVES
+* DATA HERE IS FOR WAVES 1 TO 17, HIGHER WAVES USE #SQBTMAX
+*
+SQBTTBL DB 0,70,60,50,0,45,60,40,35,35
+ DB 35,50,32,32,32,32,39
+SQBTMAX EQU 30
+
+******************************************
+*
+* QSPTBL -- STARTING QUARK SPEEDS FOR VARIOUS WAVES
+* DATA HERE IS FOR WAVES 1 TO 13, HIGHER WAVES USE #QSPMAX
+*
+QSPTBL DB 0,0,0,0,0,0,6,0,0,0,0,5,0,0,0,0,4
+QSPMAX EQU 3 ;MAXIMUM START-OF-RACK SPEED
+
+******************************************
+*
+* TSPTBL -- STARTING TANK SPEEDS FOR VARIOUS WAVES
+* DATA HERE IS FOR WAVES 1 TO 17, HIGHER WAVES USE #TSPMAX
+*
+TSPTBL DB $0,$0,$0,$0,$0,$0,$A,$0,$0,$0,$0,$9,$0,$0,$0,$0,$7
+TSPMAX EQU $5 ;MAXIMUM START-OF-RACK SPEED
+
+******************************************
+*
+* BSTPBL -- STARTING BRAIN SPEEDS FOR VARIOUS WAVES
+* DATA HERE IS FOR WAVES 1 TO 15, HIGHER WAVES USE #BSPMAX
+*
+BSPTBL DB $C,$0,$0,$0,$A,$0,$0,$0,$0,$9,$0,$0,$0,$0,$7
+BSPMAX EQU $6 ;MAXIMUM START-OF-RACK SPEED
+
+******************************************
+*
+* BSTTBL -- BASE BRAIN SHOT TIMER VALUES FOR VARIOUS WAVES
+* DATA HERE IS FOR WAVES 1 TO 15, HIGHER WAVES USE #BSTMAX
+*
+BSTTBL DB $0,$0,$0,$0,$C,$0,$0,$0,$0,$A,$0,$0,$0,$0,$8
+BSTMAX EQU $7 ;MAXIMUM START-OF-RACK VALUE
+
+
+
+******************************************
+*
+* WAVETBL -- NUMBERS OF EACH OBJECT TO ALLOCATE FOR EACH WAVE
+*
+* THERE IS A BLOCK OF SIXTEEN BYTES FOR EACH WAVE, AS FOLLOWS:
+*
+* G, Mo, D, Mi, H, S, Q, E, T, B, P, Enf.M, Cr.M, TankM, ELECTRODES, UNUSED
+*
+*
+WAVETBL
+AA ;THIS IS JUST ANOTHER SYMBOL FOR WAVETBL - FOR EASY TYPING
+ PRINT OFF
+
+* G Mo D Mi H S Q E T B P EM CM TM EL ??
+*SHOULD BEDB 15,01,01,00,00,00,00,00,00,00,00,00,00,00,05,00 ;WAVE 01
+ DB 02,02,02,02,02,00,00,00,00,00,00,00,00,00,05,00 ;@@@ ;WAVE 01
+ DB 17,01,01,01,05,01,00,00,00,00,00,00,00,00,00,00 ;WAVE 02
+ DB 22,02,02,02,06,03,00,00,00,00,00,00,00,00,00,00 ;WAVE 03
+ DB 42,02,02,03,06,04,00,00,00,00,00,00,00,00,00,00 ;WAVE 04
+ DB 20,14,00,01,00,01,00,00,00,15,00,00,00,00,00,00 ;WAVE 05
+ DB 30,03,03,03,07,04,00,00,00,00,00,00,00,00,00,00 ;WAVE 06
+ DB 00,04,04,04,12,00,10,00,00,00,00,00,00,00,00,00 ;WAVE 07
+ DB 35,03,02,03,08,05,00,00,00,00,00,00,00,00,00,00 ;WAVE 08
+ DB 65,03,03,03,04,05,00,00,00,00,00,00,00,00,00,00 ;WAVE 09
+ DB 24,00,20,00,00,01,00,00,00,16,00,00,00,00,00,00 ;WAVE 10
+ DB 35,03,03,03,08,05,00,00,00,00,00,00,00,00,00,00 ;WAVE 11
+ DB 00,03,03,03,13,00,13,00,00,00,00,00,00,00,00,00 ;WAVE 12
+ DB 35,03,03,03,08,05,00,00,00,00,00,00,00,00,00,00 ;WAVE 13
+ DB 26,05,05,05,18,02,00,00,00,00,00,00,00,00,00,00 ;WAVE 14
+ DB 27,00,00,22,00,01,00,00,00,21,00,00,00,00,00,00 ;WAVE 15
+ DB 34,03,03,03,04,05,00,00,00,00,00,00,00,00,00,00 ;WAVE 16
+ DB 00,03,03,03,11,00,17,00,00,00,00,00,00,00,00,00 ;WAVE 17
+ DB 33,03,03,03,08,05,00,00,00,00,00,00,00,00,00,00 ;WAVE 18
+ DB 66,03,03,03,03,04,00,00,00,00,00,00,00,00,00,00 ;WAVE 19
+ DB 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 ;WAVE 20
+ DB 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 ;WAVE 21
+ DB 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 ;WAVE 22
+ DB 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 ;WAVE 23
+ DB 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 ;WAVE 24
+ DB 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 ;WAVE 25
+ DB 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 ;WAVE 26
+ DB 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 ;WAVE 27
+ DB 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 ;WAVE 28
+ DB 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 ;WAVE 29
+ DB 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 ;WAVE 30
+ DB 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 ;WAVE 31
+ DB 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 ;WAVE 32
+ DB 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 ;WAVE 33
+ DB 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 ;WAVE 34
+ DB 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 ;WAVE 35
+ DB 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 ;WAVE 36
+ DB 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 ;WAVE 37
+ DB 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 ;WAVE 38
+ DB 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 ;WAVE 39
+ DB 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 ;WAVE 40
+
+
+ PRINT ON
+
+
+******************************************
+*
+* SCORETBL -- SCORE FOR EACH OBJECT WHEN SHOT
+*
+*
+SCORETBL DB $00,$00 ;OBJECT ZERO IS NULL
+ DB $01,$00 ;1 GRUNT - 100
+ DB $00,$00 ;2 MOMMY - NOT APPLICABLE HERE
+ DB $00,$00 ;3 DADDY - NOT APPLICABLE HERE
+ DB $00,$00 ;4 MIKEY - NOT APPLICABLE HERE
+ DB $00,$00 ;5 HULK - CAN'T BE DESTROYED
+ DB $10,$00 ;6 SPHEROID - 1000
+ DB $10,$00 ;7 QUARK - 1000
+ DB $01,$50 ;8 ENFORCER - 150
+ DB $02,$00 ;9 TANK - 200
+ DB $05,$00 ;A BRAIN - 500
+ DB $01,$00 ;B PROG - 100
+ DB $00,$25 ;C ENFORCER MISSILE - 25
+ DB $00,$25 ;D CRUISE MISSILE - 25
+ DB $00,$25 ;E TANK MISSILE - 25
+
+*
+*
+******************************************
+*
+* ZONE DATA TABLES
+*
+******************************************
+*
+ZONDLAL DB $00 ;ZONE DISPLAY LIST LOW ADDRESSES
+ DB $80
+ DB $00
+ DB $80
+ DB $00
+ DB $80 ;6
+ DB $00
+ DB $80
+ DB $00
+ DB $80
+ DB $00
+ DB $80 ;12
+*
+*
+ZONDLAH DB $1A ;ZONE DISPLAY LIST ADDRESSES HIGH
+ DB $1A
+ DB $1B
+ DB $1B
+ DB $1C
+ DB $1C ;6
+ DB $1D
+ DB $1D
+ DB $1E
+ DB $1E
+ DB $1F
+ DB $1F ;12
+*
+*
+ZONLINE DB 00 ;ZONE START LINE NUMBER (YPOS)
+ DB 16
+ DB 32
+ DB 48
+ DB 64
+ DB 80 ;6
+ DB 96
+ DB 112
+ DB 128
+ DB 144
+ DB 160
+ DB 176 ;12 (TO 192)
+*
+*
+*
+ZONOBJLL DB $B0 ;ZONE OBJECT LIST ADDRESSES (LOW)
+ DB $CC
+ DB $E8
+ DB $04
+ DB $20
+ DB $3C ;6
+ DB $58
+ DB $74
+ DB $90
+ DB $AC
+ DB $C8
+ DB $E4 ;12
+*
+*
+ZONOBJLH DB $18 ;ZONE OBJECT LIST ADDRESSES (HIGH)
+ DB $18
+ DB $18
+ DB $19
+ DB $19
+ DB $19 ;6
+ DB $19
+ DB $19
+ DB $19
+ DB $19
+ DB $19
+ DB $19 ;12
+*
+*
+* FREEMSK -- MASKS FOR SETTING/UNSETTING DLIST FREE LIST ENTRIES
+*
+*
+FREEMSK DB $80
+ DB $40
+ DB $20
+ DB $10
+ DB $08
+ DB $04
+ DB $02
+ DB $01
+
+
+******************************
+* *
+* SOUND DATA *
+* *
+******************************
+*
+
+* NUMBERS (PRIORITY OF EACH SOUND)
+NOTSOUND EQU 0
+GULPSND EQU 1
+MCDIESND EQU 2
+
+*
+* TABLES POINTING TO DATA:
+* ( START WITH SOUND # 1 )
+
+DUR ;# OF FRAMES BETWEEN SOUND REGISTER CHANGES FOR EACH SOUND
+ DB 1,1
+
+SCNTRLS ;AUDC0/1 TO USE FOR EACH SOUND
+ DB $44,$44
+
+LENGTH ;LENGTH OF SOUND TABLES - # BYTES OF V'S OR F'S FOR EACH SOUND
+ DB 6,6
+
+LVTABL ;LOW BYTES OF VOLUMES FOR EACH SOUND
+ DB L(GULPVOL),L(MCDIEVOL)
+
+LFTABL ;LOW BYTES OF FREQUENCIES FOR EACH SOUND
+ DB L(GULPFRQ),L(MCDIEFRQ)
+
+*
+* ACTUAL SOUND DATA TABLES: THIS SHOULD NOT CROSS A PAGE BOUNDARY
+*
+SOUNDS:
+GULPFRQ DB 1,2,3,4,5,6
+GULPVOL DB 9,8,7,6,5,4
+MCDIEFRQ DB 5,5,5,5,5,5
+MCDIEVOL DB 4,4,4,4,4,4
+
+
+
+********************************************************************************
+********************************************************************************
+********************************************************************************
+
+* END OF RDATA.S
+
+*
+* THIS ALSO THE END OF CONGLOMERATE FILE ROB.S
+* RSTAMPS.S MUST BE ASSEMBLED SEPERATELY AND LINKED
+*
+
+* THE
+ END
diff --git a/RDIRS.S82 b/RDIRS.S82
new file mode 100644
index 0000000..e282357
--- /dev/null
+++ b/RDIRS.S82
@@ -0,0 +1,546 @@
+******************
+*
+*
+* ROBOTRON 20-JULY-83
+* 12-AUGUST-83 C:00
+* 24-AUGUST-83 10:10
+*
+* RDIRS.S DIRECTION DATA
+*
+* FOLLOWED BY RSTAMPS.S
+******************
+
+***
+*
+* INFORMATION FOR LINKER
+*
+ PUBLIC CRETODST,DIRTOSTE,STAMPHGH
+ PUBLIC STAMPL,STAMPS,PALNWID,STAMPPWD
+*
+
+************
+*
+* TABLES FOR ANIMATION
+*
+************
+
+
+ ORG $4000
+
+*******
+* CRETODST STANDS FOR CREATURE TO DIRECTION START
+* IT TELLS WHICH ENTRY IN THE DIRECTION TABLE IS THE
+* FIRST POINTER TO THE STEPS
+
+CRETODST DB 0 ;MC
+ DB (GD-DIRTOSTE) ;GD
+ DB (MOD-DIRTOSTE) ;MOD
+ DB (DD-DIRTOSTE) ;DD
+ DB (MID-DIRTOSTE) ;MI
+ DB (HD-DIRTOSTE) ;H
+ DB (SD-DIRTOSTE) ;S
+ DB (QD-DIRTOSTE) ;Q
+ DB (ED-DIRTOSTE) ;E
+ DB (TD-DIRTOSTE) ;T
+ DB (BD-DIRTOSTE) ;B
+ DB 0
+ DB 0
+ DB 0
+ DB 0
+ DB (MCSD-DIRTOSTE) ;MCS
+
+*******
+* DIRTOSTE STANDS FOR DIRECTION TO STEP
+* IT IS ACCESSED BY ADDING THE CONTENTS OF CRETODST
+* TO THE DIRECTION AND USING THAT TO INDEX IN.
+* TAKING ITS CONTENTS AND ADDING THE STEP GIVES A POINTER
+* INTO ALL THE STAMP TABLES
+
+DIRTOSTE DB 0 ;MC DIRECTIONS
+ DB 0 ;1
+ DB 0 ;2
+ DB 0 ;3
+ DB 0 ;4
+ DB (MCD2-STAMPL) ;5
+ DB (MCD2-STAMPL) ;6
+ DB (MCD2-STAMPL) ;7
+ DB 0 ;8
+ DB (MCD3-STAMPL) ;9
+ DB (MCD3-STAMPL) ;A
+ DB (MCD3-STAMPL) ;B
+ DB 0 ;C
+ DB (MCD1-STAMPL) ;D
+ DB 0 ;E
+ DB 0 ;F
+GD DB (GD0-STAMPL) ;G
+MOD DB (MOD0-STAMPL) ;MOMMY DIRECTIONS
+ DB (MOD1-STAMPL)
+ DB (MOD2-STAMPL)
+ DB (MOD3-STAMPL)
+ DB (MOD2-STAMPL) ;D4
+ DB (MOD2-STAMPL) ;D5
+ DB (MOD3-STAMPL) ;D6
+ DB (MOD3-STAMPL) ;D7
+ DB (FDIE-STAMPL)
+DD DB (DD0-STAMPL) ;DADDY DIRS
+ DB (DD1-STAMPL)
+ DB (DD2-STAMPL)
+ DB (DD3-STAMPL)
+ DB (DD2-STAMPL) ;D4
+ DB (DD2-STAMPL) ;D5
+ DB (DD3-STAMPL) ;D6
+ DB (DD3-STAMPL) ;D7
+MID DB (MID0-STAMPL) ;MIKEY DIRS
+ DB (MID1-STAMPL)
+ DB (MID2-STAMPL)
+ DB (MID3-STAMPL)
+ DB (MID2-STAMPL) ;D4
+ DB (MID2-STAMPL) ;D5
+ DB (MID3-STAMPL) ;D6
+ DB (MID3-STAMPL) ;D7
+HD DB (HD0-STAMPL) ;HULK DIRS
+ DB (HD1-STAMPL)
+ DB (HD2-STAMPL)
+ DB (HD3-STAMPL)
+SD DB (SD0-STAMPL) ;S
+QD DB (QD0-STAMPL) ;Q
+ED DB (ED0-STAMPL) ;E
+TD DB (TD0-STAMPL) ;T
+BD DB (BD0-STAMPL) ;B
+ DB (BD1-STAMPL)
+ DB (BD2-STAMPL)
+ DB (BD3-STAMPL)
+ DB (BD2-STAMPL) ;D4
+ DB (BD2-STAMPL) ;D5
+ DB (BD3-STAMPL) ;D6
+ DB (BD3-STAMPL) ;D7
+MCSD DB (MCSD0-STAMPL) ;MCS
+ DB (MCSD0-STAMPL) ;1
+ DB (MCSD0-STAMPL) ;2
+ DB (MCSD0-STAMPL) ;3
+ DB (MCSD0-STAMPL) ;4
+ DB (MCSD5-STAMPL) ;5
+ DB (MCSD6-STAMPL) ;6
+ DB (MCSD7-STAMPL) ;7
+ DB (MCSD0-STAMPL) ;8
+ DB (MCSD6-STAMPL) ;9
+ DB (MCSD5-STAMPL) ;A
+ DB (MCSD7-STAMPL) ;B
+ DB (MCSD0-STAMPL) ;C
+ DB (MCSDD-STAMPL) ;D
+ DB (MCSDD-STAMPL) ;E
+ DB (MCSD0-STAMPL) ;F
+
+***********
+* DATA DESCRIBING THE STAMPS
+*
+
+STAMPL DB L(MCD0S0)
+ DB L(MCD0S1)
+ DB L(MCD0S0)
+ DB L(MCD0S2)
+MCD1 DB L(MCD1S0)
+ DB L(MCD1S1)
+ DB L(MCD1S0)
+ DB L(MCD1S2)
+MCD2 DB L(MCD2S0)
+ DB L(MCD2S1)
+ DB L(MCD2S0)
+ DB L(MCD2S2)
+MCD3 DB L(MCD3S0)
+ DB L(MCD3S1)
+ DB L(MCD3S0)
+ DB L(MCD3S2)
+GD0 DB L(GD0S0)
+ DB L(GD0S1)
+ DB L(GD0S0)
+ DB L(GD0S2)
+ DB L(GD0S3) ;THESE ARE EXPLOSIONS
+ DB L(GD0S4)
+ DB L(GD0S5)
+ DB L(GD0S6)
+ DB L(GD0S7)
+ DB L(GD0S8)
+MOD0 DB L(MOD0S0)
+ DB L(MOD0S1)
+ DB L(MOD0S0)
+ DB L(MOD0S2)
+MOD1 DB L(MOD1S0)
+ DB L(MOD1S1)
+ DB L(MOD1S0)
+ DB L(MOD1S2)
+FDIE DB L(SKULL)
+ DB L(SCORE1K)
+ DB L(SCORE2K)
+ DB L(SCORE3K)
+ DB L(SCORE4K)
+ DB L(SCORE5K)
+MOD2 DB L(MOD2S0)
+ DB L(MOD2S1)
+ DB L(MOD2S0)
+ DB L(MOD2S2)
+MOD3 DB L(MOD3S0)
+ DB L(MOD3S1)
+ DB L(MOD3S0)
+ DB L(MOD3S2)
+DD0 DB L(DD0S0)
+ DB L(DD0S1)
+ DB L(DD0S0)
+ DB L(DD0S2)
+DD1 DB L(DD1S0)
+ DB L(DD1S1)
+ DB L(DD1S0)
+ DB L(DD1S2)
+DD2 DB L(DD2S0)
+ DB L(DD2S1)
+ DB L(DD2S0)
+ DB L(DD2S2)
+DD3 DB L(DD3S0)
+ DB L(DD3S1)
+ DB L(DD3S0)
+ DB L(DD3S2)
+MID0 DB L(MID0S0)
+ DB L(MID0S1)
+ DB L(MID0S0)
+ DB L(MID0S2)
+MID1 DB L(MID1S0)
+ DB L(MID1S1)
+ DB L(MID1S0)
+ DB L(MID1S2)
+MID2 DB L(MID2S0)
+ DB L(MID2S1)
+ DB L(MID2S0)
+ DB L(MID2S2)
+MID3 DB L(MID3S0)
+ DB L(MID3S1)
+ DB L(MID3S0)
+ DB L(MID3S2)
+HD0 DB L(HD0S0)
+ DB L(HD0S1)
+ DB L(HD0S0)
+ DB L(HD0S2)
+HD1 DB L(HD1S0)
+ DB L(HD1S1)
+ DB L(HD1S0)
+ DB L(HD1S2)
+HD2 DB L(HD2S0)
+ DB L(HD2S1)
+ DB L(HD2S0)
+ DB L(HD2S2)
+HD3 DB L(HD3S0)
+ DB L(HD3S1)
+ DB L(HD3S0)
+ DB L(HD3S2)
+SD0 DB L(SD0S0)
+ DB L(SD0S1)
+ DB L(SD0S2)
+ DB L(SD0S3)
+ DB L(SD0S4)
+ DB L(SD0S5)
+ DB L(SD0S6)
+ DB L(SD0S7)
+ DB L(QD0S0)
+QD0 DB L(QD0S1)
+ DB L(QD0S2)
+ DB L(QD0S3)
+ DB L(QD0S4)
+ DB L(QD0S5)
+ DB L(QD0S6)
+ DB L(QD0S7)
+ED0 DB L(ED0S0)
+ DB L(ED0S1)
+TD0 DB L(TD0S0)
+ DB L(TD0S1)
+ DB L(TD0S2)
+ DB L(TD0S3)
+BD0 DB L(BD0S0)
+ DB L(BD0S1)
+ DB L(BD0S0)
+ DB L(BD0S2)
+BD1 DB L(BD1S0)
+ DB L(BD1S1)
+ DB L(BD1S0)
+ DB L(BD1S2)
+BD2 DB L(BD2S0)
+ DB L(BD2S1)
+ DB L(BD2S0)
+ DB L(BD2S2)
+BD3 DB L(BD3S0)
+ DB L(BD3S1)
+ DB L(BD3S0)
+ DB L(BD3S2)
+MCSD0 DB L(MCSD0S0)
+MCSD5 DB L(MCSD5S0)
+MCSD6 DB L(MCSD6S0)
+MCSD7 DB L(MCSD7S0)
+MCSDD DB L(MCSDDS0)
+
+
+STAMPHGH DB $B ;MC D0 S0
+ DB $B ;MC D1
+ DB $B ;MC D2
+ DB $B ;MC D3
+ DB $B ;MC D4
+ DB $B ;MC D5
+ DB $B ;MC D6
+ DB $B ;MC D7
+ DB $B ;MC D8
+ DB $B ;MC D9
+ DB $B ;MC DA
+ DB $B ;MC DB
+ DB $B ;MC DC
+ DB $B ;MC DD
+ DB $B ;MC DE
+ DB $B ;MC DF
+ DB $B ;G D0
+ DB $B ;MO D0
+ DB $B ;MO D1
+ DB $B ;MO D2
+ DB $B ;MO D3
+ DB $B ;MO D2
+ DB $B ;MO D2
+ DB $B ;MO D3
+ DB $B ;MO D3
+ DB $B ;FDIE (A DYING FAMILY MEMBER EITHER POINTS OR SKULL)
+ DB $B ;D D0
+ DB $B ;D D1
+ DB $B ;D D2
+ DB $B ;D D3
+ DB $B ;D D2
+ DB $B ;D D2
+ DB $B ;D D3
+ DB $B ;D D3
+ DB $A ;MI D0
+ DB $A ;MI D1
+ DB $A ;MI D2
+ DB $A ;MI D3
+ DB $A ;MI D2
+ DB $A ;MI D2
+ DB $A ;MI D3
+ DB $A ;MI D3
+ DB $D ;H D0
+ DB $D ;H D1
+ DB $D ;H D2
+ DB $D ;H D3
+ DB 0 ;S D0 S0
+ DB 0 ;Q D0 S0
+ DB 0 ;E D0 S0
+ DB 0 ;T D0 S0
+ DB $D ;B D0
+ DB $D ;B D1
+ DB $D ;B D2
+ DB $D ;B D3
+ DB $D ;B D2
+ DB $D ;B D2
+ DB $D ;B D3
+ DB $D ;B D3
+ DB 0 ;MCSD0
+ DB 0 ;MCSD1
+ DB 0 ;MCSD2
+ DB 0 ;MCSD3
+ DB 0 ;MCSD4
+ DB $07 ;MCSD5
+ DB $07 ;MCSD6
+ DB $01 ;MCSD7
+ DB 0 ;MCSD8
+ DB $07 ;MCSD6
+ DB $07 ;MCSD5
+ DB $01 ;MCSD7
+ DB 0 ;MCSDC
+ DB $07 ;MCSDD
+ DB $07 ;MCSDD
+ DB 0 ;MCSDF
+
+
+PALNWID DB $1E ;MC D0 S0
+ DB $1E ;MC D1
+ DB $1E ;MC D2
+ DB $1E ;MC D3
+ DB $1E ;MC D4
+ DB $1E ;MC D5
+ DB $1E ;MC D6
+ DB $1E ;MC D7
+ DB $1E ;MC D8
+ DB $1E ;MC D9
+ DB $1E ;MC DA
+ DB $1E ;MC DB
+ DB $1E ;MC DC
+ DB $1E ;MC DD
+ DB $1E ;MC DE
+ DB $1E ;MC DF
+ DB $3E ;G D0
+ DB $5E ;MO D0
+ DB $5E ;MO D1
+ DB $5F ;MO D2
+ DB $5F ;MO D3
+ DB $5E ;MO D2
+ DB $5E ;MO D2
+ DB $5F ;MO D3
+ DB $5F ;MO D3
+ DB $BD ;FDIE
+ DB $7E ;D D0
+ DB $7E ;D D1
+ DB $7F ;D D2
+ DB $7F ;D D3
+ DB $7E ;D D2
+ DB $7E ;D D2
+ DB $7F ;D D3
+ DB $7F ;D D3
+ DB $3E ;MI D0
+ DB $3E ;MI D1
+ DB $3F ;MI D2
+ DB $3F ;MI D3
+ DB $3E ;MI D2
+ DB $3E ;MI D2
+ DB $3F ;MI D3
+ DB $3F ;MI D3
+ DB $9E ;H D0
+ DB $9E ;H D1
+ DB $9E ;H D2
+ DB $9E ;H D3
+ DB $FF ;S D0 S0
+ DB $FF ;Q D0 S0
+ DB $FF ;E D0 S0
+ DB $FF ;T D0 S0
+ DB $DE ;B D0
+ DB $DE ;B D1
+ DB $DE ;B D2
+ DB $DE ;B D3
+ DB $DE ;B D2
+ DB $DE ;B D2
+ DB $DE ;B D3
+ DB $DE ;B D3
+ DB $1F ;MCSD0
+ DB $1F ;MCSD1
+ DB $1F ;MCSD2
+ DB $1F ;MCSD3
+ DB $1F ;MCSD4
+ DB $1F ;MCSD5
+ DB $1F ;MCSD6
+ DB $1F ;MCSD7
+ DB $1F ;MCSD8
+ DB $1F ;MCSD6
+ DB $1F ;MCSD5
+ DB $1F ;MCSD7
+ DB $1F ;MCSDC
+ DB $1F ;MCSDD
+ DB $1F ;MCSDD
+ DB $1F ;MCSDF
+
+STAMPPWD DB 4 ;MC D0 S0
+ DB 4 ;MC D1
+ DB 4 ;MC D2
+ DB 4 ;MC D3
+ DB 4 ;MC D4
+ DB 4 ;MC D5
+ DB 4 ;MC D6
+ DB 4 ;MC D7
+ DB 4 ;MC D8
+ DB 4 ;MC D9
+ DB 4 ;MC DA
+ DB 4 ;MC DB
+ DB 4 ;MC DC
+ DB 4 ;MC DD
+ DB 4 ;MC DE
+ DB 4 ;MC DF
+ DB $06 ;G D0
+ DB 4 ;MO D0
+ DB 4 ;MO D1
+ DB 4 ;MO D2
+ DB 4 ;MO D3
+ DB 4 ;MO D2
+ DB 4 ;MO D2
+ DB 4 ;MO D3
+ DB 4 ;MO D3
+ DB $01 ;FDIE
+ DB 4 ;D D0
+ DB 4 ;D D1
+ DB 4 ;D D2
+ DB 4 ;D D3
+ DB 4 ;D D2
+ DB 4 ;D D2
+ DB 4 ;D D3
+ DB 4 ;D D3
+ DB 4 ;MI D0
+ DB 4 ;MI D1
+ DB 4 ;MI D2
+ DB 4 ;MI D3
+ DB 4 ;MI D2
+ DB 4 ;MI D2
+ DB 4 ;MI D3
+ DB 4 ;MI D3
+ DB $06 ;H D0
+ DB $06 ;H D1
+ DB $06 ;H D2
+ DB $06 ;H D3
+ DB 0 ;S D0 S0
+ DB 0 ;Q D0 S0
+ DB 0 ;E D0 S0
+ DB 0 ;T D0 S0
+ DB 6 ;B D0
+ DB 6 ;B D1
+ DB 6 ;B D2
+ DB 6 ;B D3
+ DB 6 ;B D2
+ DB 6 ;B D2
+ DB 6 ;B D3
+ DB 6 ;B D3
+ DB $0 ;MCSD0
+ DB $0 ;MCSD0
+ DB $0 ;MCSD0
+ DB $0 ;MCSD0
+ DB $0 ;MCSD0
+ DB $03 ;MCSD5
+ DB $03 ;MCSD6
+ DB $03 ;MCSD7
+ DB $0 ;MCSD0
+ DB $03 ;MCSD6
+ DB $03 ;MCSD5
+ DB $03 ;MCSD7
+ DB $0 ;MCSD0
+ DB $01 ;MCSDD
+ DB $01 ;MCSDD
+ DB $0 ;MCSD0
+
+***********
+*
+* STAMP DATA
+*
+************
+*
+
+* THE STAMPS START AT STAMPBAS BUT ARE FILLED WITH ZEROES UP TO STAMPBAS+$F00
+* THE DIFERENT LINES OF EACH STAMP ARE 100H APART
+
+STAMPBAS EQU $4300 ;BASE ADDRESS OF STAMPS
+*** WE MUST MAKE SURE THIS IS NOT OVERWRITTEN BY THE END OF
+********* THE PRECEDING TABLES. IF SO, INCREASE STAMPBAS
+
+ ORG STAMPBAS
+
+* WE NEED 15 PAGES OF ZEROES HERE, AND 15 AFTER THE END OF
+* EACH STAMP. TO DO THIS, FIRST USE A DO LOOP
+* TO FILL MEMORY FROM STAMPBAS FOR 46 PAGES
+* 46 = 15 (ZEROES) + 16 (MAX STAMP) + 15 (ZEROES)
+* AFTER WE CREATE ALL THOSE ZEROES, DEFINE STAMPS ON TOP
+* AS NEEDED
+
+ PRINT OFF
+
+ DO 16 ;16 PAGES
+ DO $10 ;ALLOCATE 256 BYTES PER PAGE
+ DB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+ ENDDO
+ ENDDO
+
+ ORG STAMPBAS+$1E00
+ DO 16 ;16 PAGES
+ DO $10 ;ALLOCATE 256 BYTES PER PAGE
+ DB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+ ENDDO
+ ENDDO
+
+ PRINT ON
+
+
+********** END OF RDIRS.S *****************************
diff --git a/RDISP.S82 b/RDISP.S82
new file mode 100644
index 0000000..5cb0212
--- /dev/null
+++ b/RDISP.S82
@@ -0,0 +1,210 @@
+******************************************
+*
+* RDISP.S
+*
+******************************************
+*
+* ROBOTRON DISPLAY DRIVERS 18-JUL-83 CARLOS
+* 20-JUL-83
+* 17-AUGUST-83 9:00
+*
+******************************************
+
+
+
+
+******************************************
+*
+* DISPINIT -- INITIALIZE DISPLAY LIST AND ZONE OBJECT TABLES
+*
+******************************************
+*
+DISPINIT
+ LDA #H(DL) ;SET DLIST ADDRESS
+ STA TADDRH
+ LDA #L(DL)
+ STA TADDRL
+DISPINT0 LDA #$00
+ TAY
+DISPINT1 STA (TADDRL),Y
+ INY
+ CPY #$7F ;TEST FOR END OF A ZONE LIST
+ BCC DISPINT1
+ LDA #$1F
+ STA (TADDRL),Y ;SET LAST BYTE OF FREE LIST
+ LDA TADDRL
+ CLC
+ ADC #$80 ;ADVANCE
+ STA TADDRL
+ LDA TADDRH
+ ADC #$00
+ STA TADDRH
+ CMP #$20 ;TEST IF END OF DISPLAY LISTS
+ BCC DISPINT0 ;NOT DONE
+*
+ LDA #H(ZONOBJL) ;SET ADDRESS OF ZONE OBJECT LISTS
+ STA TADDRH
+ LDA #L(ZONOBJL)
+ STA TADDRL
+DISPINT2 LDA #$00
+ TAY
+DISPINT3 STA (TADDRL),Y
+ INY
+ CPY #$A8 ;TEST TO ADVANCE BASE ADDRESS
+ BCC DISPINT3
+ LDA TADDRL
+ CLC
+ ADC #$A8 ;ADVANCE BASE ADDRESS
+ STA TADDRL
+ LDA TADDRH
+ ADC #$00
+ STA TADDRH
+ CMP #H(DL) ;TEST IF DONE
+ BNE DISPINT2
+*
+ LDX #$0B ;INIT OBJECT COUNT TABLES
+ LDA #$00
+DISPIN4 STA ZONOBJC,X
+ DEX
+ BPL DISPIN4
+
+ RTS
+*
+******************************************
+*
+* DISPLOAD -- LOAD DISPLAY LIST WITH INITIAL OBJECT DATA
+*
+******************************************
+*
+DISPLOAD
+
+ LDX #$4F
+DISPL1 LDA STTBL,X ;SKIP OBJECTS WITH ZERO STATUS
+ BEQ DISPL20
+ LDA YTBL,X ;GET ZONE FROM Y POSITION
+ STA TEMP18
+ LSR A
+ LSR A
+ LSR A
+ LSR A
+ STA TEMP14 ;ZONE
+ LDA XTBL,X
+ STA TEMP17 ;HPOS
+
+ JSR GETSTAMP ;GET STAMP ADDRESS
+ JSR ZONELOAD ;LOAD ZONE DISPLAY ENTRY
+
+ LDA TADDRL ;SAVE OBJECTS DISPLAY LIST ADDR
+ STA DLPLTBL,X
+ LDA TADDRH
+ STA DLPHTBL,X
+ LDA YEXTBL,X ;GET LOWER ZONE
+ LSR A
+ LSR A
+ LSR A
+ LSR A
+ CMP TEMP14 ;COMPARE WITH TOP ZONE
+ BEQ DISPL20 ;SAME, GET NEXT OBJECT
+ STA TEMP14 ;SECOND ZONE
+ LDA #$00
+ JSR GETSTAMP
+ JSR ZONELOAD
+ SEC ;COMPUTE OFFSET TO SECOND ENTRY
+ LDA TADDRL
+ SBC DLPLTBL,X
+ STA DL2PTBL,X
+*
+DISPL20 DEX
+ BPL DISPL1 ;DONE?
+ RTS
+*
+******************************************
+*
+* ZONELOAD -- LOAD A ZONE DISPLAY LIST ENTRY WITH OBJECT DATA
+*
+******************************************
+*
+ZONELOAD STX TEMP13 ;SAVE X
+ LDX TEMP14 ;GET ZONE
+ INC ZONOBJC,X ;INC ZONE OBJECT COUNT
+ LDA ZONDLAL,X ;ZONE DISPLAY LIST ADDRESS
+ STA TADDRL
+ LDA ZONDLAH,X
+ STA TADDRH
+ LDA ZONLINE,X ;ZONE START LINE NUMBER
+ STA TEMP12
+ LDA ZONOBJLL,X ;ZONE OBJECT LIST ADDRESS
+ STA TADDR1L
+ LDA ZONOBJLH,X
+ STA TADDR1H
+*
+ LDY #$7C ;FIND A FREE ENTRY
+ZONLD0 LDX #$00
+ LDA (TADDRL),Y
+ CMP #$FF ;TEST IF SECTION FULL
+ BNE ZONLD1 ;HAS ROOM
+ INY
+ CPY #$80 ;TEST IF AT END
+ BCC ZONLD0
+ JMP ZONLD90 ;NO ROOM IN ZONE
+*
+ZONLD1 ASL A ;SHIFT UNTIL EMPTY SPOT FOUND
+ BCC ZONLD2
+ INX ;COUNT BITS
+ BNE ZONLD1
+*
+ZONLD2 LDA FREEMSK,X ;UNFREE ENTRY
+ ORA (TADDRL),Y
+ STA (TADDRL),Y
+ TYA ;COMPUTE OFFSET OF FREE ENTRY
+ SEC
+ SBC #$7C
+ ASL A
+ ASL A
+ ASL A ;8 X FREE LIST WORD NO.
+ STA TEMP11
+ TXA
+ CLC
+ ADC TEMP11
+ STA TEMP10 ;FREE ENTRY NUMBER
+ ASL A
+ ASL A ;X4 BYTES PER ENTRY
+ ADC TADDRL ;ADDRESS OF FREE ENTRY
+ STA TADDRL
+*
+ LDY #$00
+ LDA TEMP19 ;STAMP LOW ADDRESS
+ STA (TADDRL),Y
+ LDA TEMP15 ;WIDTH AND PALETTE
+ INY
+ STA (TADDRL),Y
+ INY
+ LDA TEMP12 ;COMPUTE OFFSET OF HIGH STAMP ADDR
+ SEC
+ SBC TEMP18 ;YPOS
+ CLC
+ ADC TEMP20 ;STAMP HIGH
+ STA (TADDRL),Y ;STAMP HIGH
+ INY
+ LDA TEMP17 ;HPOS
+ STA (TADDRL),Y
+*
+ LDY TEMP10
+ LDA TEMP13 ;OBJECT NUMBER
+ STA (TADDR1L),Y ;INTO ZONE OBJECT LIST
+ JMP ZONLDX ;DONE
+*
+ZONLD90 LDA #$00 ;NO ROOM IN ZONE
+ STA TADDRL
+ STA TADDRH
+*
+ZONLDX LDX TEMP13
+ RTS
+*
+*
+******************************************
+*
+* END OF RDISP.S
+*
+*
+ EJE
diff --git a/RKL.S82 b/RKL.S82
new file mode 100644
index 0000000..51c1f50
--- /dev/null
+++ b/RKL.S82
@@ -0,0 +1,1449 @@
+******************************************************
+******************************************************
+*
+*
+* ROBOTRON 6-JULY-83 3:00
+* 21-JULY-83 8:00
+* 29-JULY-83 1:30
+* 22-AUGUST-83 5:00
+*
+* RKERNEL.S
+*
+******************************************************
+
+
+*******************
+*
+* ROBOTRON KERNEL GOES HERE
+*
+*******************
+* HERE STORE THE STATUS OF EVERYTHING BECAUSE WE ARRIVED BY INTERUPT
+
+KERNEL
+ PHA ;SAVE REGISTERS
+ TXA
+ PHA
+ TYA
+ PHA
+
+TOPWAIT STA WSYNC ;ONLY CHECK FOR TOP WHEN OFF EDGE
+ BIT MSTAT ;WAIT FOR EXACT BOTTOM OF SCREEN
+M2 BPL TOPWAIT
+
+TOPWAIT1 BIT MSTAT
+ BMI TOPWAIT1 ;CHANGE TO BMI FOR SI MARIA
+
+
+* STORING TO DPL CAUSES DMA TO START
+* Y IS ALWAYS THE OFFSET
+* X IS ALWAYS THE LOW DL POINTER
+;ZONE 0
+;LINE 0
+ LDY #0
+ LDA #H(DLZONE0)
+ STA DPH
+ LDX #L(DLZONE0)
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+* WE'VE SEEN ENOUGH OF THIS
+ PRINT OFF
+
+;LINE 1
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 2
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 3
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 4
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 5
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 6
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 7
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 8
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 9
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 10
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 11
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 12
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 13
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 14
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+ LDA #H(DLZONE1) ;START TO SET UP FOR THE NEXT ZONE
+;LINE 15
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ LDY #0 ;SET THE OFFSET TO ZERO FOR NEW ZONE
+ STA DPH ;SET UP THE DISPLAY HIGH POINTER
+;ZONE 1
+;LINE 0
+ LDX #L(DLZONE1)
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 1
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 2
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 3
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 4
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 5
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 6
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 7
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 8
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 9
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 10
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 11
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 12
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 13
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 14
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+ LDA #H(DLZONE2) ;START TO SET UP FOR THE NEXT ZONE
+;LINE 15
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ LDY #0 ;SET THE OFFSET TO ZERO FOR NEW ZONE
+ STA DPH ;SET UP THE DISPLAY HIGH POINTER
+;ZONE 2
+;LINE 0
+ LDX #L(DLZONE2)
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 1
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 2
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 3
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 4
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 5
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 6
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 7
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 8
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 9
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 10
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 11
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 12
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 13
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 14
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+ LDA #H(DLZONE3) ;START TO SET UP FOR THE NEXT ZONE
+;LINE 15
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ LDY #0 ;SET THE OFFSET TO ZERO FOR NEW ZONE
+ STA DPH ;SET UP THE DISPLAY HIGH POINTER
+;ZONE3
+;LINE 0
+ LDX #L(DLZONE3)
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 1
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 2
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 3
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 4
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 5
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 6
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 7
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 8
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 9
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 10
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 11
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 12
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 13
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 14
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+ LDA #H(DLZONE4) ;START TO SET UP FOR THE NEXT ZONE
+;LINE 15
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ LDY #0 ;SET THE OFFSET TO ZERO FOR NEW ZONE
+ STA DPH ;SET UP THE DISPLAY HIGH POINTER
+;ZONE 4
+;LINE 0
+ LDX #L(DLZONE4)
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 1
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 2
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 3
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 4
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 5
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 6
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 7
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 8
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 9
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 10
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 11
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 12
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 13
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 14
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+ LDA #H(DLZONE5) ;START TO SET UP FOR THE NEXT ZONE
+;LINE 15
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ LDY #0 ;SET THE OFFSET TO ZERO FOR NEW ZONE
+ STA DPH ;SET UP THE DISPLAY HIGH POINTER
+;ZONE 5
+;LINE 0
+ LDX #L(DLZONE5)
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 1
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 2
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 3
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 4
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 5
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 6
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 7
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 8
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 9
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 10
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 11
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 12
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 13
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 14
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+ LDA #H(DLZONE6) ;START TO SET UP FOR THE NEXT ZONE
+;LINE 15
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ LDY #0 ;SET THE OFFSET TO ZERO FOR NEW ZONE
+ STA DPH ;SET UP THE DISPLAY HIGH POINTER
+;ZONE 6
+;LINE 0
+ LDX #L(DLZONE6)
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 1
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 2
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 3
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 4
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 5
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 6
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 7
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 8
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 9
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 10
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 11
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 12
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 13
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 14
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+ LDA #H(DLZONE7) ;START TO SET UP FOR THE NEXT ZONE
+;LINE 15
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ LDY #0 ;SET THE OFFSET TO ZERO FOR NEW ZONE
+ STA DPH ;SET UP THE DISPLAY HIGH POINTER
+;ZONE 7
+;LINE 0
+ LDX #L(DLZONE7)
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 1
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 2
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 3
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 4
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 5
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 6
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 7
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 8
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 9
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 10
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 11
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 12
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 13
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 14
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+ LDA #H(DLZONE8) ;START TO SET UP FOR THE NEXT ZONE
+;LINE 15
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ LDY #0 ;SET THE OFFSET TO ZERO FOR NEW ZONE
+ STA DPH ;SET UP THE DISPLAY HIGH POINTER
+;ZONE 8
+;LINE 0
+ LDX #L(DLZONE8)
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 1
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 2
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 3
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 4
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 5
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 6
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 7
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 8
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 9
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 10
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 11
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 12
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 13
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 14
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+ LDA #H(DLZONE9) ;START TO SET UP FOR THE NEXT ZONE
+;LINE 15
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ LDY #0 ;SET THE OFFSET TO ZERO FOR NEW ZONE
+ STA DPH ;SET UP THE DISPLAY HIGH POINTER
+;ZONE 9
+;LINE 0
+ LDX #L(DLZONE9)
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 1
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 2
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 3
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 4
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 5
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 6
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 7
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 8
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 9
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 10
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 11
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 12
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 13
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 14
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+ LDA #H(DLZONE10) ;START TO SET UP FOR THE NEXT ZONE
+;LINE 15
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ LDY #0 ;SET THE OFFSET TO ZERO FOR NEW ZONE
+ STA DPH ;SET UP THE DISPLAY HIGH POINTER
+;ZONE 10
+;LINE 0
+ LDX #L(DLZONE10)
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 1
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 2
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 3
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 4
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 5
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 6
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 7
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 8
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 9
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 10
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 11
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 12
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 13
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 14
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+ LDA #H(DLZONE11) ;START TO SET UP FOR THE NEXT ZONE
+;LINE 15
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ LDY #0 ;SET THE OFFSET TO ZERO FOR NEW ZONE
+ STA DPH ;SET UP THE DISPLAY HIGH POINTER
+;ZONE 11
+;LINE 0
+ LDX #L(DLZONE11)
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 1
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 2
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 3
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 4
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 5
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 6
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 7
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 8
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 9
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 10
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 11
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 12
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 13
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+;LINE 14
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+ INY
+
+* OK, TURN ON LISTING AGAIN
+ PRINT ON
+
+;LINE 15
+ STA WSYNC ;WAIT FOR START OF SCAN LINE
+ DB $84,$38,$EA,$EA
+ STX DPL
+;DMA TIME
+
+
+* INCREMENT FRAME COUNT
+ INC FRMCNT
+
+* THEN SET UP THE TIMER FOR THE NEXT FRAME
+ LDA #$7C ;THIS SHOULD GIVE THE CORRECT WAIT
+ STA TIM64TI ;BEFORE THE NEXT INTERUPT
+*
+
+*******************
+*
+* CALL THE SOUND DRIVER ROUTINE
+*
+ JSR TUNER ;ROUTINE IN RSOUNDS.S
+*
+
+
+*
+* END OF KERNEL
+*
+
+* RESTORE THE REGISTERS THAT WERE SAVED AT THE BEGINING
+* AND DO AN RTI
+ PLA
+ TAY
+ PLA
+ TAX
+ PLA
+ RTI
+
+******************************************
+
+* END OF RKERNEL.S
+ EJE
diff --git a/RMAIN.S82 b/RMAIN.S82
new file mode 100644
index 0000000..2207270
--- /dev/null
+++ b/RMAIN.S82
@@ -0,0 +1,1361 @@
+******************************************************
+******************************************************
+*
+*
+* ROBOTRON 8-JUNE-83
+* 16-JUNE-83
+* 18-JULY-83
+* 24-AUGUST-83 3:30
+*
+*
+* RMAIN.S
+*
+******************************************************
+
+
+**********
+*
+* STUFF FROM LINKER
+*
+ EXTRN STAMPHGH,CRETODST,DIRTOSTE
+ EXTRN STAMPL,STAMPS,PALNWID,STAMPPWD
+*
+
+******************************************
+******************************************
+* *
+* ROBOTRON RAM AND MAIN ROUTINES *
+* *
+******************************************
+
+
+******************************************
+*
+* ZERO PAGE LOCATIONS
+*
+******************************************
+*
+
+TEMP0 EQU $A0 ;TEMPS
+TEMP1 EQU $A1
+TEMP2 EQU $A2
+TEMP3 EQU $A3
+TEMP4 EQU $A4
+TEMP5 EQU $A5
+TEMP6 EQU $A6
+TEMP7 EQU $A7
+TEMP8 EQU $A8
+TEMP9 EQU $A9
+TEMP10 EQU $AA
+TEMP11 EQU $AB
+TEMP12 EQU $AC
+TEMP13 EQU $AD
+TEMP14 EQU $AE
+TEMP15 EQU $AF
+*
+*
+*
+TEMP16 EQU $B0
+TEMP17 EQU $B1
+TEMP18 EQU $B2
+TEMP19 EQU $B3
+TEMP20 EQU $B4
+TEMP21 EQU $B5
+TEMP22 EQU $B6
+
+
+FRMCNT EQU $B7 ;FRAME COUNT
+
+TEMPX EQU $B8 ;MISCELLANEOUS TEMPS
+TEMPY EQU $B9
+
+TADDRL EQU $BA ;TEMPS USED TO INDEX THRU TABLES
+TADDRH EQU $BB
+TADDR1L EQU $BC
+TADDR1H EQU $BD
+
+XORIG EQU $BE ;ORIGINAL XPOS OF AN OBJECT (BEFORE A MOVE)
+YORIG EQU $BF
+XINTEND EQU $C0 ;INTENDED XPOS OF AN OBJECT (WHERE IT WANTS TO MOVE)
+YINTEND EQU $C1
+XXINTEND EQU $BE
+YXINTEND EQU $BF
+*
+*
+TEMPZON EQU $C2 ;TEMP VARIABLE USED TO HOLD A ZONE #
+
+RANDOMX EQU $C3 ;RANDOM VALID X AND Y POSITIONS
+RANDOMY EQU $C4 ;GENERATED BY RANDXY AND RANDXYBX
+
+RNDM EQU $C5 ;FOR RANDOM NUMBER GENERATOR
+* ALSO NEEDS $C6
+
+
+* OTHER MISCELLANEOUS VARIABLES
+TEMPCOL EQU $C7 ;TEMP VARIABLE FOR COLOR CYCLING
+MCCTMR EQU $C8 ;TIMER FOR MC COLLISIONS
+
+CRELEFT EQU $C9 ;COUNT OF CREATURES LEFT ALIVE
+ ; INC WHEN ONE BORN, DEC WHEN ONE DIES
+*
+* VARIABLES FOR SOUND GENERATION
+SOUNDZP EQU $CA ;2 BYTES - ZERO PAGE FOR SOUND
+ ;ALSO USES $CB
+
+* OBJECT SPEED, STEP AND OTHER LOCATIONS
+* SPEEDS, STEPS, ETC. WHICH CHANGE OVER TIME OR FROM
+* RACK TO RACK ARE HERE AS RAM LOCATIONS
+* CONSTANTS ARE IN ASSEMBLY CONSTANTS SECTION
+*
+GSPEED EQU $CC ;# OF FRAMES BETWEEN GRUNT MOVES
+FSPEED EQU $CD ;# FRAMES BETWEEN FAMILY MOVES
+HSPEED EQU $CE ;# OF FRAMES BETWEEN HULK MOVES
+SQBTIME EQU $CF ;BASE TIME UNTIL FIRST BIRTH IN A WAVE
+QSPEED EQU $D0 ;# OF FRAMES BETWEEN QUARK MOVES
+TSPEED EQU $D1 ;# OF FRAMES BETWEEN TANK MOVES
+BSPEED EQU $D2 ;# OF FRAMES BETWEEN BRAIN MOVES
+BSTIME EQU $D3 ;BASE # OF FRAMES BETWEEN BRAIN SHOTS
+
+* OTHER GLOBAL VARIABLES:
+FAMLEVEL EQU $D4 ;SCORE LEVEL FOR FAMILY PICKING UP
+PLAYER EQU $D5 ;0 OR 1 FOR PLAYER 1 OR 2
+WAVENUM EQU $D6 ;THE NUMBER WAVE WE ARE CURRENTLY ON
+
+* THESE VARIABLES MUST BE SEQUENTIAL IN RAM
+* THERE ARE STARTNUM OF THESE LOCATIONS - PRESERVE CURRENT STATUS
+* USED AT WAVE START AND BETWEEN TURNS
+* THESE MAY BE WIPED OUT BY WAVE START ROUTINES - DO NOT USE DURING WAVE
+* THESE SHOULD BE RE-COMPUTED FROM THE OBJECT DATA TABLES AT THE END
+* OF A TURN OR WAVE
+* THE 14 OBJECT TYPES:
+GNUM EQU $D7 ;# GRUNTS
+MONUM EQU $D8 ;# MOMMIES
+DNUM EQU $D9 ;# DADDIES
+MINUM EQU $DA ;# MIKEYS
+HNUM EQU $DB ;# HULKS
+SNUM EQU $DC ;# SPHEROIDS
+QNUM EQU $DD ;# QUARKS
+ENUM EQU $DE ;# ENFORCERS (NULL, AT WAVE START)
+TNUM EQU $DF ;# TANKS
+BNUM EQU $E0 ;# BRAINS
+PNUM EQU $E1 ;# PROGS (NULL, AT WAVE START)
+EMNUM EQU $E2 ;# ENFORCER MISSILES (NULL, AT WAVEST)
+CMNUM EQU $E3 ;# CRUISE MISSILES (NULL, AT WAVE ST)
+TMNUM EQU $E4 ;# TANK MISSILES (NULL, AT WAVE START)
+* OTHER WAVE-DEPENDANT NUMBERS:
+ELECNUM EQU $E5 ;# ELECTRODES
+
+
+* POINTERS TO SEGMENTS WITHIN OBJECT DATA TABLES
+* THESE CONTAIN INDICES TO THE STARTS OF VARIOUS SECTIONS
+ ;GRUNTS START AT FIRST BYTE, INDEX=1 (NOTE: NOT 0)
+FPTR EQU $E6 ;START OF FAMILY (NO SEPERATE MO,D,MI)
+HPTR EQU $E7 ; HULKS
+SPTR EQU $E8 ; SPHEROIDS
+QPTR EQU $E9 ; QUARKS
+EPTR EQU $EA ; ENFORCERS
+TPTR EQU $EB ; TANKS
+BPTR EQU $EC ; BRAINS
+PPTR EQU $ED ; PROGS
+MPTR EQU $EE ; MISSILES (NO SEPERATE E,C,T)
+
+
+
+
+******************************************
+*
+* OTHER LOCATIONS
+*
+******************************************
+*
+
+* NOT-ZERO-PAGE RAM LOCATIONS
+
+*
+* SCORE VARIABLES IN BCD FORMAT
+* USE START OF FREE RAM NOT SHADOWED ANYWHERE
+SCORE1L EQU $1000 ;PLAYER 1 LOWER 2 DIGITS
+SCORE1M EQU $1001 ; MIDDLE 2 DIGITS
+SCORE1H EQU $1002 ; HIGH 2 DIGITS
+SCORE1V EQU $1003 ; VERY HIGH 2 DIGITS
+
+SCORE2L EQU $1004 ;PLAYER 2 LOWER 2 DIGITS
+SCORE2M EQU $1005 ; MIDDLE 2 DIGITS
+SCORE2H EQU $1006 ; HIGH 2 DIGITS
+SCORE2V EQU $1007 ; VERY HIGH 2 DIGITS
+
+*
+
+* SOUND ROUTINE VARIABLES
+TUNON EQU $1300 ;2 BYTES - WHETHER TUNE IS ACTIVE
+TUNINDEX EQU $1302 ;2 BYTES - WHAT TUNE IS PLAYING
+TUNPRIOR EQU $1304 ;2 BYTES - WHAT THE PRIORITY OF TUNE IS
+TUNBASE EQU $1306 ;2 BYTES - BASE ADDRESS OF TUNE DATA
+TUNBASE1 EQU $1308 ;2 BYTES - HI BYTE OF BASE ADDRESS
+FREQOFF EQU $130A ;2 BYTES - OFFSET INTO DATA FOR FREQ'S
+CTLOFF EQU $130C ;2 BYTES - OFFSET INTO DATA FOR CTL'S
+VOLOFF EQU $130E ;2 BYTES - OFFSET INTO DATA FOR VOL'S
+FREQTIME EQU $1310 ;2 BYTES - NUMBER FRAMES TILL NEXT FREQ
+CTLTIME EQU $1312 ;2 BYTES - NUMBER FRAMES TILL NEXT CTL
+VOLTIME EQU $1314 ;2 BYTES - NUMBER FRAMES TILL NEXT VOL
+TUNNUM EQU $1316 ;WHAT TUNE YOU WANT - PARAMETER
+TUNTEMP0 EQU $1317 ;TEMP VALUE FOR TUNE DRIVER
+TUNTEMP1 EQU $1318 ;TEMP VALUE FOR TUNE DRIVER
+
+********
+
+* OBJECT DATA TABLES
+* THESE ARE PARALLEL TABLES WHICH HAVE VARIOUS STATE VARIABLES
+* FOR EACH OBJECT. ONE INDEX (OBJECT INDEX) IS USED TO INDEX INTO
+* ANY ONE OF THESE TABLES TO FIND INFO FOR A SPECIFIC OBJECT.
+* THE OBJECT INDEX IS A ONE-BYTE QUANTITY FROM 1 TO MAXOBJS-1
+* OBJECT 0 IS THE MUTANT CLONE,
+* OBJECTS MAXOBJS-4 THROUGH MAXOBJS-1 ARE THE 4 MC SHOTS.
+
+MAXOBJS EQU 80
+NUMTBLS EQU 16 ;NUMBER OF OBJECT DATA TABLES
+
+ ORG $1319
+XTBL DS MAXOBJS ;X POSITION
+YTBL DS MAXOBJS ;Y POSITION
+MTTBL DS MAXOBJS ;MOVE TIMER - # FRAMES TIL NEXT MOVE
+DXTBL DS MAXOBJS ;X-COMP OF CURRENT DIR, SPEED MOVING
+DYTBL DS MAXOBJS ;Y-COMP OF CURRENT DIR, SPEED MOVING
+DTTBL DS MAXOBJS ;DIR TIMER - # MOVES TIL DIR CHANGE
+SATBL DS MAXOBJS ;STEP IN ANIMATION + TYPE DATA
+MISCTBL DS MAXOBJS ;MISCELLANEOUS USE
+DLPHTBL DS MAXOBJS ;HIGH BYTE OF ABSOLUTE ADDR OF DL ENTRY
+DLPLTBL DS MAXOBJS ;LOW BYTE OF ABSOLUTE ADDR OF DL ENTRY
+DL2PTBL DS MAXOBJS ;DIFFERENCE BETWEEN 2 DL ENTRIES
+CRTBL DS MAXOBJS ;CREATURE TYPE
+XEXTBL DS MAXOBJS ;X-POSITION OF HORIZONTAL EXTENT
+YEXTBL DS MAXOBJS ;Y-POSITION OF VERTICAL EXTENT
+STTBL DS MAXOBJS ;STATUS TABLE
+ZONTBL DS MAXOBJS ;ZONE - USED BY THE UNLOADER
+
+* MUTANT CLONE STATISTICS: ZEROTH ENTRIES IN OBJECT DATA TABLES
+MCXPOS EQU XTBL ;X POSITION
+MCYPOS EQU YTBL ;Y POSITION
+MCXEX EQU XEXTBL ;X EXTENT (ABSOLUTE POSITION)
+MCYEX EQU YEXTBL ;Y EXTENT (ABSOLUTE POSITION)
+MCMTMR EQU MTTBL ;MC MOVE TIMER - # FRAMES TIL MOVE
+MCSTMR EQU MISCTBL ;MC SHOT TIMER-MC CAN FIRE IF NEGATIVE
+MCDIR EQU DXTBL ;CURRENT DIRECTION OF MC
+MCSA EQU SATBL ;CURRENT MC STEP IN ANIMATION
+
+* TABLE OF THE 4 MC SHOTS: **** SHOT TABLES ****
+* THESE ARE PARALLEL DATA TABLES, INDEX INTO THEM WITH THE
+* SHOT NUMBER, 0 TO 3.
+* THESE TABLES USE THE LAST 4 ENTRIES IN THE OBJECT DATA TABLES
+SDIRTBL EQU DXTBL+MAXOBJS-4 ;SHOT DIR (4-BIT), 0 = NULL
+SXTBL EQU XTBL+MAXOBJS-4 ;X POS
+SYTBL EQU YTBL+MAXOBJS-4 ;Y POS
+SXEXTBL EQU XEXTBL+MAXOBJS-4 ;X EXTENT
+SYEXTBL EQU YEXTBL+MAXOBJS-4 ;Y EXTENT
+SSATBL EQU SATBL+MAXOBJS-4 ;ANIMATION STEP - ALWAYS 0
+SSTTBL EQU STTBL+MAXOBJS-4 ;STATUS
+SCRTBL EQU CRTBL+MAXOBJS-4 ;CREATURE TYPE - ALWAYS #MCSCODE
+
+* OBJECT DATA TABLES EXTEND UP TO $1319+NUMTBLS*MAXOBJS
+
+
+
+*
+*
+ZONOBJC EQU $18A4 ;ZONE OBJECT COUNTS
+*
+*
+ZONOBJL EQU $18B0 ;ZONE OBJECT COUNT (TO 1A00)
+*
+*
+*
+* DISPLAY LIST
+*
+*
+*
+DL EQU $1A00 ;MARIA DISPLAY LIST
+
+*
+*THE DEFINITIONS OF DLZONE0 ETC. ARE FOR THE MARIA 1 KERNEL'S CONVENIENCE
+*
+
+DLZONE0 EQU DL+$80*0
+DLZONE1 EQU DL+$80*1
+DLZONE2 EQU DL+$80*2
+DLZONE3 EQU DL+$80*3
+DLZONE4 EQU DL+$80*4
+DLZONE5 EQU DL+$80*5
+DLZONE6 EQU DL+$80*6
+DLZONE7 EQU DL+$80*7
+DLZONE8 EQU DL+$80*8
+DLZONE9 EQU DL+$80*9
+DLZONE10 EQU DL+$80*10
+DLZONE11 EQU DL+$80*11
+DLZONE12 EQU DL+$80*12
+
+
+
+******************************************
+*
+* ASSEMBLY CONSTANTS
+*
+******************************************
+*
+
+* CONSTANTS DEALING WITH SCREEN BOUNDARIES
+MINX EQU 02 ;MINIMUM X VALUE TO APPEAR ON SCREEN
+MAXX EQU 159-3 ;MAX X ON SCREEN - FOR UPPER LEFT OF STAMP
+MINY EQU 18 ;MIN Y ON SCREEN
+MAXY EQU 191-3 ;MAX Y ON SCREEN FOR UPPER LEFT OF STAMP
+SCENTERX EQU 80 ;X SCREEN CENTER
+SCENTERY EQU 96 ;Y SCREEN CENTER
+SBOXMAXX EQU 80+30
+SBOXMINX EQU 80-30 ;EDGES OF BOX IN CENTER OF SCREEN
+SBOXMAXY EQU 96+25 ;INSIDE WHICH OBJECTS CAN'T APPEAR
+SBOXMINY EQU 96-25
+
+MCWID EQU $05 ;MC WIDTH
+MCHEIGHT EQU $0B ;MC HEIGHT
+
+MCXINIT EQU SCENTERX-MCWID/2 ;STARTING MC X POSITION
+MCYINIT EQU SCENTERY-MCHEIGHT/2 ;STARTING MC Y POSITION
+
+MASKL EQU 00001111B ;SAVE LOWER HALF-BYTE
+MASKH EQU 11110000B ;SAVE UPPER HALF-BYTE
+MASK1 EQU 00000001B ;SAVE LOWEST BIT
+MASK2 EQU 00000011B ;SAVE LOWER 2 BITS
+MASK3 EQU 00000111B ;SAVE LOWER 3 BITS
+MASK5 EQU 00011111B ;SAVE LOWER 5 BITS
+
+
+MCSDELAY EQU $04 ;# FRAMES BETWEEN MC SHOTS
+SHOTSTX EQU $07 ;MC SHOT STEP IN X DIRECTION
+SHOTSTY EQU $0E ;MC SHOT STEP IN Y DIRECTION
+SHOTWID EQU $04 ;MC SHOT WIDTH (EXCEPT VERTICAL SHOTS)
+SHOTHT EQU $08 ;MC SHOT HEIGHT (EXCEPT HORIZONTAL)
+
+MAXINZON EQU 20 ;MAXIMUM NUMBER OF OBJECTS IN A ZONE
+
+
+* OBJECT CODES: FOUND IN CRTBL
+NULLCODE EQU $0
+GCODE EQU $1
+MOCODE EQU $2
+DCODE EQU $3
+MICODE EQU $4
+HCODE EQU $5
+SCODE EQU $6
+QCODE EQU $7
+ECODE EQU $8
+TCODE EQU $9
+BCODE EQU $A
+PCODE EQU $B
+EMCODE EQU $C
+CMCODE EQU $D
+TMCODE EQU $E
+MCSCODE EQU $F
+* NOTE THAT THERE ARE SPECIAL CODES WHICH WAY BE FOUND IN CRTBL:
+* $00: NULL OBJECT
+* $FF: END OF OBJECT DATA TABLES
+
+
+* NOMINAL OBJECT DIMENSIONS - USE TO COMPUTE EXTENTS WHEN SETTING UP
+GWID EQU 7
+GHEIGHT EQU 12
+FWID EQU 4
+FHEIGHT EQU 11
+HWID EQU 7
+HHEIGHT EQU 15
+SQWID EQU 9
+SQHEIGHT EQU 9
+EWID EQU 8
+EHEIGHT EQU 8
+TWID EQU 10
+THEIGHT EQU 10
+BWID EQU 9
+BHEIGHT EQU 9
+
+*
+* OBJECT SPEED, STEP AND OTHER CONSTANTS
+* SPEEDS, STEPS, ETC. WHICH DO NOT CHANGE OVER TIME OR FROM
+* RACK TO RACK ARE HERE AS ASSEMBLY CONSTANTS
+* RAM VARIABLES ARE IN THE ZERO PAGE SECTION
+*
+GSTEPX EQU $2 ;# OF PIXELS IN A HORIZONTAL GRUNT STEP
+GSTEPY EQU $4 ;# OF PIXELS IN A VERTICAL GRUNT STEP
+SQSTEP1 EQU 1 ;STARTING ANIMATION STEP FOR S + Q
+SQBIRTHS EQU 4 ;STARTING NUMBER OF BIRTHS LEFT
+MAXSSPD EQU $7 ;MAX SPH SPEED AT WAVE START - USED AS PARM TO RANDPM
+TSTIME EQU 8 ;BASE # OF FRAMES BETWEEN TANK SHOTS
+
+
+FDIEWAIT EQU 60 ;# FRAMES TO KEEP UP A SKULL OR FAMILY SCORE
+
+STARTNUM EQU 15 ;NUMBER OF BYTES TO GET FROM WAVETBL
+ ; WHEN SETTING UP FOR A NEW WAVE
+
+WSWAIT EQU $13 ;# OF FRAMES AT WAVE START BEFORE ACTION STARTS
+
+STACK EQU $FF ;INITIAL VALUE FOR STACK POINTER
+
+
+
+******************************************
+******************************************
+* *
+* ROBOTRON CODE: *
+* *
+* MAIN ROUTINES *
+* *
+******************************************
+
+
+******************************************
+*
+* VECTORS
+*
+ ORG $FFFC
+ DB L(INIT),H(INIT)
+ DB L(KERNEL),H(KERNEL)
+*
+ ORG $C000 ;START OF PROGRAM ROM
+
+******************************************
+*
+* INIT -- FIRST ROUTINE IN CARTRIDGE - SETS UP SYSTEM
+*
+******************************************
+*
+INIT SEI
+ CLD
+ LDX #STACK
+ TXS ;SET UP STACK POINTER
+* OTHER INITIALIZATIONS MIGHT GO HERE *********
+
+
+* DO TITLE PAGE, OPTION SELECT, ETC. *********
+
+ JSR MARINIT ;SETUP SOME MARIA STUFF @@@@@@@@@@@@@@@
+ JSR CONV ;CONV STAMPS FOR SI MARIA@@@@@@@@@@@@@@
+
+ JMP GAMESTRT
+*
+
+******************************************
+*
+* GAMESTRT -- VERY FIRST ROUTINE IN A GAME, INITIALIZES VARIOUS THING
+*
+******************************************
+*
+GAMESTRT
+ JSR CLEARTUN ;TURN OFF SOUNDS
+
+ LDA #$00
+ STA WAVENUM
+
+ JSR RESETSC ;RESET SCORES
+
+* INITIALIZE RANDOM NUMBER GENERATOR - THIS SHOULD BE DONE EVERY SO OFTEN
+ LDA FRMCNT ;PSEUDO-RANDOM AT THIS POINT
+ EOR RNDM+1 ;RANDOM NUMBER REGISTERS
+ STA RNDM
+
+ JSR WAVESTRT ;SET UP FOR START OF PLAY
+ JSR DISPINIT
+ JSR DISPLOAD
+
+MAIN2 BIT MSTAT ;INIT KERNEL
+ BVS MAIN2
+ BRK ;ENTER KERNEL
+ NOP
+ CLI ;TURN ON INTERRUPTS
+
+* MAKE CREATURES APPEAR, MAYBE MOVE, BUT DON'T START NORMAL ACTION
+ SEI ;NO INTERRUPTS
+ LDX #WSWAIT ;LOOP FOR WSWAIT FRAMES
+WSWLOOP STX TEMP16 ;SAVE X
+* NOW DO SOME COLOR CYCLING OF VARIOUS PALETTES
+ JSR CHKOBJ
+
+ LDX TEMP16 ;IT WAS SAVED HERE
+ CPX #$10
+ BPL WSWLOOP1
+* WE ARE LESS THAN $10 FRAMES TILL ACTION
+ JSR WAVESTMC
+ TXA ;A HAS A NUMBER F TO 0
+ SBC #$10
+ EOR #$FF
+ CLC
+ ADC #$01
+ STA P0C1
+ STA P0C2
+ STA P0C3
+
+WSWLOOP1 JSR DISPINIT
+ JSR DISPLOAD
+ BRK
+ NOP
+
+ LDX TEMP16 ;RESTORE X
+ DEX
+ BPL WSWLOOP
+
+* NOW START ACTION
+ JSR WAVESTMC ;SET UP MC
+ JSR MARINIT ;RESET PALETTES
+
+ JMP MAIN ;GO!
+*
+
+******************************************
+*
+* MAIN -- MASTER LOOP - LOOPS ONCE EACH FRAME DURING PLAY
+*
+******************************************
+*
+MAIN
+ SEI ;DISABLE INTERRUPTS
+* MAYBE CHANGE PALETTE HERE FOR SOME COLOR CYCLING *********
+ JSR PALINIT ;REFRESH PALETTES
+
+ LDA TEMPCOL ;USE TO HOLD MC COLOR 3
+ CLC ; SINCE PALETTES ARE UNREADABLE
+ ADC #$01
+ STA TEMPCOL
+ STA P0C3
+
+ LDA TEMPCOL
+ ASL A
+ AND #MASKL
+ ORA #$30 ;MAKE THIS INTO A RED
+ STA P5C3 ;ELECTRODES/SKULL EYES/SCORE NUMBERS
+ STA P6C1 ;BRAIN EYES AND PART OF HEAD
+
+ LDA TEMPCOL
+ ASL A
+ EOR #$FF
+ AND #MASKL
+ ORA #$90 ;MAKE INTO A BLUE
+ STA P5C2 ;PALETTE 5 COLOR CYCLING
+
+ LDA TEMPCOL
+ ASL A
+ AND #MASKL
+ STA P4C3 ;CYCLE HULK ARMS
+
+
+ JSR MCSHOOT ;MOVE MC SHOTS, CHECK FOR HITS
+ JSR MCMOV ;MOVE MAN, CHECK FOR COLLISIONS
+ JSR CHKOBJ ;CHECK EACH OBJECT, POSSIBLY ACT
+
+* CHECK FOR WAVE END
+ LDA CRELEFT
+ BNE KEEPGOIN
+* WAVE IS OVER
+ JSR WAVEEND ;DO SOMETHING FANCY
+
+ JMP INIT ;FOR NOW, RESTART@@@@@@@@@@@@@
+
+*
+
+KEEPGOIN ;WAVE CONTINUES INTO NEXT FRAME
+* UPDATE GLOBAL VARIABLES IF NECESSARY
+
+
+
+* FOR NOW:@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
+ JSR DISPINIT ;RELOAD
+ JSR DISPLOAD
+ CLI ;INTERRUPTS OK
+
+ BRK ;GO TO KERNEL
+ NOP
+
+ JMP MAIN
+*
+
+
+******************************************
+*
+* MCSHOOT -- MOVE MC SHOTS, CHECK FOR ANY COLLISIONS
+* ALSO ADD A NEW SHOT IN DIRECTION OF FIRE CONTROL
+* IF LESS THAN 4 ARE OUT AND PLAYER IS FIRING
+* NOTE THAT SHOTS USE 4-BIT DIR CODE, WITH 0 IN SDIRTBL = NULL
+*
+******************************************
+*
+MCSHOOT LDX #$00 ;INITIALIZE X TO START AT FIRST SHOT
+ ; X POINTS TO SHOTS 0 THRU 3 IN THIS LOOP
+
+ DEC MCSTMR ;DECREMENT MC SHOT TIMER
+ BPL MCSLOOP ;IF IT DOESN'T GO TO ZERO START LOOPING
+ STX MCSTMR ;IF HE IS READY TO SHOOT, KEEP
+ ; MCSTMR AT ZERO
+
+MCSLOOP TXA
+ CMP #$04 ;DONE MOVING SHOTS?
+ BMI MCSL1
+ JMP MCSEND ;YES, IF Y IS PAST 4TH SHOT
+
+MCSL1 LDA SDIRTBL,X ;LOAD DIRECTION OF THIS SHOT
+ BNE MCSGO ;IF DIR NOT 00, DON'T ADD ANOTHER SHOT
+
+* NOW THERE IS A NULL SHOT IN THE TABLE. ADD ANOTHER IF MCSTMR IS ZERO
+ LDA MCSTMR
+ BEQ MCSL2
+ JMP MCSCONT ;IF NOT ZERO, CAN'T ADD A SHOT
+
+MCSL2 LDA #MCSDELAY ;ADDING A NEW SHOT SO RESET TIMER
+ STA MCSTMR
+
+ JSR CRESHOT ;THIS SETS UP SHOT DATA IN TABLES IF NECESSARY
+* NOW GO ON AND MOVE THIS SHOT
+ JMP MCS1
+
+* NOW CHECK FOR COLLISIONS WITH CURRENT SHOT
+MCSGO JSR CHKSHOT ;ROUTINE USES X AND SHOT TABLES;;;;;;;
+
+* MUST MOVE THIS SHOT
+MCS1 JSR MOVESHOT ;MOVE SHOT POS'S AND EXTENTS, REMOVE IF OFFSCREEN
+
+
+* NOW JSR TO A ROUTINE WHICH UPDATES THE SHOT IN DL AND ZONOBJC ********
+* X POINTS TO SHOT IN SHOT TABLES ********
+* NEW SHOT POSITIONS AND EXTENTS IN SHOT DATA TABLES *********
+* IF SDIRTBL,X IF ZERO, AND SHOT HAS NO DL ENTRY, LEAVE IT ALONE.*******
+* IF SDIRTBL,X IS ZERO, AND SHOT HAS SPACE IN DL, REMOVE IT. ***********
+*
+* SHOT DATA SHOULD BE UNCHANGED IN SHOT DATA TABLES
+
+* NOW ADVANCE POINTER INTO SHOT TABLES
+MCSCONT INX ;POINT TO NEXT SHOT
+ JMP MCSLOOP ;ON TO NEXT SHOT
+
+* DONE WITH LOOPING THROUGH SHOTS 0 - 3
+MCSEND
+* LOAD SHOTS INTO END OF OBJECT DATA TABLES @@@@@@@@@@@@@@@@@@@@@@@
+ LDX #$03
+MCSTEMP1
+ LDA #$01
+ STA SSTTBL,X
+ LDA SDIRTBL,X
+ BNE MCSTEMP2 ;BRANCH IF SHOT EXISTS
+ STA SSTTBL,X ;STORE ZERO IN STTBL ENTRY
+MCSTEMP2
+ DEX
+ BPL MCSTEMP1
+
+ RTS ;BACK TO MAIN LOOP
+*
+******************************************
+*
+* SUBROUTINES USED BY MCSHOOT:
+*
+******************************************
+
+*******************
+*
+* CRESHOT -- ROUTINE TO CREATE (POSSIBLY) A NEW SHOT
+*
+* GIVEN SHOT NUMBER IN X, PRESERVES X
+* SDIRTBL,X SHOULD BE 0 FOR THIS TO BE CALLED - A NULL SHOT DOES EXIST
+* IF A NEW SHOT IS CALLED FOR, SETS EACH SHOT TABLE,X
+* ENDS WITH RTS, AFTER SETTING UP SHOT TABLES FOR SHOT NUMBER X
+*
+CRESHOT
+ LDA SWCHA ;LOOK AT JOYSTICK TO FIND DIRECTION
+ AND #MASKL
+ CMP #$0F ;WILL BE 0F IF NOT FIRING
+ BNE CRESHOT1
+ RTS ;LEAVE THIS SHOT NULL, CONTINUE
+ ; SHOT MOVE ROUTINE WILL NOT MOVE THIS SINCE IT IS NULL
+
+CRESHOT1 STA SDIRTBL,X
+ LDA CRETODST+$0F ;BYPASS GETSTAMPS FOR SPEED. F IS THE TYPE
+ CLC ;THAT LOAD JUST GOT THE TYPE POINTER
+ ADC SDIRTBL,X ;ADD IN THE DIRECTION FOR POINTERS TO EXTENTS
+ TAY
+ LDA MCXPOS
+ CLC
+ ADC #MCWID/2 ;COMPUTE CENTER OF MC'S BODY
+ STA SXTBL,X ;STORE SHOT XPOS = CENTER OF MC
+ CLC
+ ADC STAMPPWD,Y ;COMPUTE EXTENT BY GOING STAIGHT TO THE
+ STA SXEXTBL,X ;ANIMATION TABLES
+
+ LDA MCYPOS
+ CLC
+ ADC #MCHEIGHT/2 ;COMPUTE CENTER OF MC'S BODY
+ STA SYTBL,X ;STORE SHOT YPOS = CENTER OF MC
+ CLC
+ ADC STAMPHGH,Y ;COMPUTE EXTENT - SHOULD BE IMPROVED***
+ STA SYEXTBL,X
+
+ ; NOW SHOT EXISTS, AND HAS THE DIRECTION OF THE MC'S FIRING CONTROL
+* START MC SHOOTING SOUND
+ LDA #SMCS
+ JSR DOTUNE
+ ; NOW RETURN, AND THIS SHOT SHOULD THEN BE MOVED
+ RTS
+
+*******************
+*
+* CHKSHOT -- CHECK FOR COLLISIONS VERSUS ONE SHOT
+* SHOT NUMBER GIVEN IN X, USE SHOT DATA TABLES
+* END WITH AN RTS, PRESERVE X
+* IF NO COLLISION, DON'T CHANGE ANYTHING
+* IF A COLLISION, REMOVE SHOT BY NULLING OUT SDIRTBL,X
+* AND MODIFY OBJECT DATA TABLES TO SHOW CREATURE
+* WHICH WAS HIT AS DYING
+*
+CHKSHOT
+* GET SHOT POSITION AND EXTENTS
+ LDA SXTBL,X ;GET SHOT XPOS
+ STA TEMPX
+ LDA SXEXTBL,X ;GET SHOT X EXTENT
+ STA TEMP4
+
+ LDA SYTBL,X ;GET SHOT YPOS
+ STA TEMPY
+ LDA SYEXTBL,X ;GET SHOT Y EXTENT
+ STA TEMP5
+
+
+* LOOP THROUGH OBJECTS TO CHECK FOR COLLISIONS WITH A SHOT
+* SEARCH THROUGH OBJECTS IN THE SHOT'S ZONE
+* SET UP TEMP0 AND TEMP1 TO BE THE ADDRESS OF THE SHOT'S ZONE'S ENTRY IN ZONOBJC
+* (THE FIRST IF SHOT IS IN 2 ZONES). THEN SET Y TO 27 (OR 55 IF SHOT
+* IS IN 2 ZONES) AND LOOP THRU ZONOBJC, DECREMENTING Y UNTIL IT GOES TO 0.
+
+ LDY #27 ;SET UP Y FOR 1-ZONE CASE
+* COMPUTE SHOT'S FIRST ZONE, CHECK IF 1 OR 2 ZONES, SET UP Y
+
+ LDA SYTBL,X ;LOAD SHOT Y POSITION
+ LSR A
+ LSR A
+ LSR A
+ LSR A ;GET ZONE # FROM Y POSITION
+ STA TEMPZON
+* CHECK IF IN 2 ZONES
+ LDA SYEXTBL,X ;Y POSITION OF SHOT LOWER EDGE
+ LSR A
+ LSR A
+ LSR A
+ LSR A ;GET ZONE # OF SHOT'S LOWER EDGE
+ CMP TEMPZON ;IS IT SAME AS SHOT TOP ZONE?
+ BEQ MCSC1 ;SHOT IN ONLY 1 ZONE, LEAVE Y AS 31
+ LDY #55 ;LOAD Y WITH 63 - WE WILL INDEX THRU 2 ZONES
+MCSC1 ;NOW Y IS SET UP
+* GET ABSOLUTE ADDRESS OF START OF SHOT'S ZONE IN ZONOBJC
+* ZONE NUMBER IS IN TEMPZON
+ STY TEMP2 ;PUT Y AWAY FOR NOW
+ LDY TEMPZON
+ LDA ZONOBJLH,Y ;GET HIGH BYTE
+ STA TEMP1
+ LDA ZONOBJLL,Y ;GET LOW BYTE OF ABS ADDRESS
+ STA TEMP0
+ LDY TEMP2 ;RECOVER Y - IT IS INDEX THRU ZONOBJC
+
+* NOW WE HAVE THE ABSOLUTE ADDRESS OF THE ZONOBJC LISTING
+* FOR THE SHOT'S (FIRST) ZONE IN TEMP0 AND TEMP1
+
+* SAVE X - IT CURRENTLY POINTS TO CURRENT SHOT IN SHOT TABLES
+ STX TEMP8
+
+MCSCLOOP LDA (TEMP0),Y ;GET OBJECT NUMBER FROM ZONOBJC
+ BEQ MCSCNEXT ;IF 0, A NULL ENTRY
+ TAX ;PUT OBJECT NUMBER IN X
+ LDA CRTBL,X ;GET CREATURE CODE
+ BEQ MCSCNEXT ;IF THIS IS 0, ALSO A NULL OBJECT
+ CMP #MCSCODE ;IS IT AN MC SHOT?
+ BEQ MCSCNEXT ;SHOT CAN'T COLLIDE WITH A SHOT
+ LDA STTBL,X
+ AND #MASKL
+ BEQ MCSCNEXT ;DON'T COLLIDE WITH A DEAD OBJECT
+ CMP #$03 ;CODE IN STTBL FOR 'DYING' OBJECT
+ BEQ MCSCNEXT ;DON'T COLLIDE WITH DYING OBJECT
+
+
+* HERE CHECK FOR A COLLISION WITH OBJECT NUMBER X
+* MC SHOT X,Y ARE IN TEMPX AND TEMPY
+* MC SHOT X,Y EXTENTS ARE IN TEMP4 AND TEMP5
+* OBJECT X,Y ARE IN XTBL,X AND YTBL,X
+* OBJECT EXTENTS ARE IN XEXTBL,X AND YEXTBL,X
+* IF A HIT, FALL THRU TO THE JSR MCSHIT,
+* OTHERWISE BRANCH TO MCSCNEXT
+* Y IS AN INDEX THRU ZONOBJC - PRESERVE IT
+
+MCSCL1 LDA TEMP4
+ CMP XTBL,X
+ BCC MCSCNEXT ;BRANCH IF LESS THAN
+ LDA TEMPX
+ CMP XEXTBL,X
+ BCS MCSCNEXT ;BRANCH IF > OR =
+
+ LDA TEMP5
+ CMP YTBL,X
+ BCC MCSCNEXT ;BRANCH IF LESS THAN
+ LDA TEMPY
+ CMP YEXTBL,X
+ BCS MCSCNEXT ;BRANCH IF > OR =
+
+
+* ****************** HIT! ******************
+ JSR MCSHIT ;AN OBJECT WAS HIT - POSSIBLY REMOVE
+ ; IT AND/OR SHOT
+ ;SHOT # IN TEMP8, OBJECT INDEX IN X
+
+* BACK FROM MC SHOT HIT ROUTINE
+ LDX TEMP8 ;X WAS SAVED HERE - CURRENT SHOT #
+ LDA SDIRTBL,X ;GET DIR OF CURRENT SHOT
+ BEQ CHKSEND ;DON'T BOTHER WITH THIS SHOT ANYMORE - IT IS GONE
+
+
+* WE ARE HERE IF THERE WAS NOT A DESTRUCTIVE SHOT COLLISION
+MCSCNEXT
+ LDX TEMP8 ;RESTORE X - IT IS SHOT NUMBER
+ DEY ; ON TO NEXT ENTRY IN ZONOBJC
+ BPL MCSCLOOP ;IF Y NON-NEGATIVE, KEEP GOING
+
+CHKSEND RTS ;BACK TO MASTER MCSHOOT ROUTINE
+*
+
+*******************
+*
+* MCSHIT - MC SHOT HIT SOMETHING
+* A COLLISION! REPLACE OBJECT WITH NULL OBJECT
+* AND SHOT WITH A NULL SHOT IF A LEGITIMATE COLLISION.
+* THE SHOT CAN BE FOUND FROM TEMP8. THE OBJECT THAT WAS HIT IS
+* INDEXED BY X. DO AN STZ CRTBL,X TO ZERO THE OBJECT CODE.
+*
+*******************
+*
+MCSHIT
+ LDA CRTBL,X ;GET OBJECT CODE THAT SHOT HIT
+* CHECK IF COLLISION WITH FAMILY. IF SO, PRETEND AS IF NO COLLISION
+ CMP #MOCODE ;IS IT MOMMY?
+ BEQ MCSHITNO ;SHOT GOES THROUGH HER
+ CMP #DCODE ;IS IT DADDY?
+ BEQ MCSHITNO ;SHOT GOES THROUGH HIM
+ CMP #MICODE ;IS IT MIKEY?
+ BEQ MCSHITNO ;SHOT GOES THROUGH THE LITTLE TWERP
+
+* SOMETHING WAS REALLY SHOT...
+* FIRST REMOVE MC SHOT WHICH CAUSED THIS
+ STY TEMP9 ;TEMP9 NOW HOLDS INDEX INTO ZONOBJC
+ LDY TEMP8 ;SHOT NUMBER WAS SAVED HERE
+ LDA SDIRTBL,Y
+ STA TEMP0 ;PUT DIR AWAY IN CASE A HULK IS HIT
+ LDA #$00
+ STA SDIRTBL,Y ;ZERO THIS SHOT'S DIRECTION
+ ;A NEW SHOT WILL SOON BE ADDED
+
+* UPDATE SCORE AND REMOVE OBJECT IF OBJECT IS DESTRUCTABLE
+ LDA CRTBL,X ;GET CREATURE OBJECT CODE
+ CMP #HCODE ;IS IT A HULK?
+ BNE KILLOBJ ;IF NOT, GET RID OF THE OBJECT
+
+* ITS A HULK ;HULK WAS SHOT
+ LDA TEMP0 ;LOAD ORIGINAL DIR OF CURRENT SHOT
+ STA MISCTBL,X ;SET HULK'S DIR-TO-JUMP TO SHOT DIR
+ LDA #$00
+ STA MTTBL,X ;FORCE HULK TO MOVE NEXT FRAME
+ JMP MCSHIT1 ;ON TO NEXT SHOT
+
+* NOW DEFINITELY UPDATE SCORE AND ELIMINATE OBJECT
+KILLOBJ ;OBJECT CODE IS IN A
+ TAY ;Y NOW HAS OBJECT CODE
+ CLC
+ SED
+ LDA SCORETBL+1,Y ;GET LOW 2 DIGITS OF OBJECT'S VALUE
+ ADC SCORE1L
+ STA SCORE1L
+ LDA SCORETBL,Y ;HIGH 2 DIGITS OF OBJECT'S VALUE
+ ADC SCORE1M
+ STA SCORE1M
+******************
+* THIS ROUTINE SHOULD BE IMPROVED TO COMPLETELY UPDATE ALL SCORE DIGITS*********
+* AND TO ADD TO THE SCORE OF THE PLAYER (1 OR 2) WHO IS PLAYING *********
+******************
+ CLD
+
+*
+
+* NOW REMOVE OBJECT, OBJECT INDEX TO REMOVE IS IN X
+* SET BIT 1 OF STTBL,X, WHICH MEANS OBJECT IS DYING
+ LDA #$02 ;BIT 1 IS ON
+ ORA STTBL,X
+ STA STTBL,X ;SAVE NEW STATUS
+* SET OBJECT TO MOVE NEXT FRAME SO IT CAN START DYING
+ LDA #$00
+ STA MTTBL,X ;ZERO # OF FRAMES UNTIL NEXT MOVE
+
+* HIT ROUTINE IS FINISHED. WE MAY HAVE ZEROED THE CURRENT SHOT DIR
+
+MCSHIT1 LDY TEMP9 ;RESTORE ZONOBJC TO Y
+ ; CODE AFTER THE JSR TO MCSHIT WILL RESTORE X AS SHOT INDEX
+
+MCSHITNO RTS
+*
+
+*******************
+*
+* MOVESHOT - MOVE AN MC SHOT
+* GIVEN SHOT NUMBER IN X
+* THIS CHANGES THE SHOT DATA IN THE SHOT TABLES
+* STORE NEW X,Y POSITIONS, THEN COMPUTE AND STORE EXTENTS
+* WILL NULL OUT DIR CODE IF A BOUNDARY IS ENCOUNTERED
+*
+*******************
+*
+MOVESHOT
+ LDY SDIRTBL,X ;X HAS DIRECTION CODE
+ BNE MOVES0 ;MOVE THIS SHOT; IT IS ALIVE
+ RTS ;DON'T MOVE THIS SHOT; IT IS NULL
+MOVES0 LDA XDIRTBL4,Y ;A HAS 1, 0, OR FF FOR X CHANGE
+ BEQ MCSY ;DON'T CHANGE X POSITION
+ BMI MCSXMI ;BRANCH ON NEGATIVE DELTA X
+ LDA SXTBL,X ;LOAD SHOT X POSITION
+ CLC
+ ADC #SHOTSTX ;INCREMENT X POS BY X SHOTSTEP
+ STA SXTBL,X
+ CMP #MAXX-SHOTWID
+ BCS SHOTEND ;IF SHOT IS OUT OF BOUNDS DESTROY IT
+ LDA SXEXTBL,X ;GET THE EXTENT
+ ADC #SHOTSTX ;MOVE THE OTHER EDGE
+ STA SXEXTBL,X
+ JMP MCSY
+MCSXMI LDA SXTBL,X ;LOAD SHOT X POSITION
+ SEC
+ SBC #SHOTSTX ;DECREMENT X POS BY X SHOTSTEP
+ STA SXTBL,X ;STORE NEW POS IN TABLES
+ CLC
+ ADC #$10 ;ADD FOR BORDER CHECKING
+ CMP #MINX+$10
+ BCC SHOTEND ;IF SHOT IS OUT OF BOUNDS DESTROY IT
+ LDA SXEXTBL,X ;GET THE EXTENT
+ SBC #SHOTSTX ;MOVE THE OTHER EDGE
+ STA SXEXTBL,X
+
+* NOW HANDLE Y CHANGE
+MCSY LDA YDIRTBL4,Y ;GET 0, POSITIVE OR NEG # FOR DELTA Y
+ BEQ MOVESD ;NO Y CHANGE, GO ON AND DO EXTENTS
+ BMI MCSYMI ;BRANCH IF NEGATIVE DELTA Y
+ LDA SYTBL,X ;GET SHOT Y POSITION
+ CLC
+ ADC #SHOTSTY ;INCREMENT Y POS BY Y SHOTSTEP
+ STA SYTBL,X
+ CMP #MAXY-SHOTHT
+ BCS SHOTEND ;IF SHOT IS OUT OF BOUNDS DESTROY IT
+ LDA SYEXTBL,X ;GET THE EXTENT
+ ADC #SHOTSTY ;MOVE THE OTHER EDGE
+ STA SYEXTBL,X
+ JMP MOVESD
+MCSYMI LDA SYTBL,X ;LOAD SHOT Y POSITION
+ SEC
+ SBC #SHOTSTY ;DECREMENT Y POS BY Y SHOTSTEP
+ STA SYTBL,X ;SAVE NEW POS IN TABLES
+ CLC
+ ADC #$10 ;ADD FOR BORDER CHECKING
+ CMP #MINY+$10
+ BCC SHOTEND
+ LDA SYEXTBL,X ;GET THE EXTENT
+ SBC #SHOTSTY ;MOVE THE OTHER EDGE
+ STA SYEXTBL,X
+ JMP MOVESD ;DONE WITH MOVING SHOT
+
+* NOTE: IN THE BORDER CHECKING ABOVE IT IS OK TO USE SHOTWID AND SHOTHT
+* INSTEAD OF ACTUAL EXTENTS - SHOTS ARE NEVER PARALLEL TO BORDERS THEY HIT
+
+* A SHOT HIT A WALL -- REMOVE IT
+SHOTEND LDA #$00
+ STA SDIRTBL,X ;ZERO ITS DIRECTION
+* NOW GO ON, AND THE SHOT LOADING ROUTINE MUST REMOVE THIS SINCE
+* ITS DIRECTION IS 0.
+
+* CONTINUE AFTER MOVING SHOT...
+MOVESD RTS
+*
+
+
+
+
+******************************************
+*
+* MCMOV -- MOVE MUTANT CLONE ACCORDING TO MOVEMENT JOYSTICK
+* ALSO CHECK FOR COLLISIONS
+*
+******************************************
+*
+MCMOV DEC MCMTMR ;CHECK IF TIME TO MOVE
+ BPL MCMOV1 ;SKIP PAST IF TOO EARLY
+ INC MCMTMR ;RESET MCMTMR
+; INC MCMTMR ;NOW, HAVE MC MOVE EVERY FRAME @@@@@@
+ CLC
+ LDA SWCHA ;GET MOVE CONTROL
+ AND #MASKH ;GET CORRECT BITS
+ LSR A
+ LSR A
+ LSR A
+ LSR A ;GET IT INTO BOTTOM BITS
+ CMP #$0F ;WILL BE $F IF MC ISN'T MOVING
+ BEQ MCMOV1 ;SKIP MOVING MC
+
+* MC IS MOVING THIS FRAME
+ STA MCDIR ;PUT AWAY MOVEMENT DIR FROM JOYSTICK
+* CHANGE ANIMATION STEP
+ DEC MCSA ;DECREMENT STEP
+ BPL MCMOV2 ;BRANCH IF STILL A VALID STEP
+ LDA #$03 ;RESET ANIMATION - LOAD HIGHEST ANIMATION STEP
+ STA MCSA
+
+MCMOV2 LDA MCDIR ;RESTORE MOVEMENT DIRECTION
+* COMPUTE CHANGES IN MC'S POSITION
+ TAX ;PUT IT IN X TO INDEX
+ LDA XDIRTBL4,X ;RETURNS 0, +STEP OR -STEP FROM 4-BITS
+ ADC MCXPOS ;MOVE 1 STEP
+ STA MCXPOS ;STORE NEW POSITION
+ CLC
+ ADC #MCWID
+ STA MCXEX ;STORE NEW X EXTENT
+
+ LDA YDIRTBL4,X ;RETURN CHANGE IN Y POSITION
+ CLC
+ ADC MCYPOS ;MOVE 1 STEP IN Y DIRECTION
+ STA MCYPOS ; STORE NEW Y POSITION
+ CLC
+ ADC #MCHEIGHT
+ STA MCYEX ;STORE NEW Y EXTENT
+
+ LDX #$00 ;LOOK AT MC ENTRIES IN OBJECT TABLES
+ JSR CHKOBJBD ;CHECK IF OFF SCREEN
+
+MCMOV1 ;LOOK FOR MC COLLIDING WITH AN OBJECT
+ DEC MCCTMR ;DECREMENT COLLISION TIMER
+ BMI MCMOV11 ;MUST CHECK COLLISIONS NOW
+ JMP MCOK ;SKIP COLLISIONS THIS FRAME
+MCMOV11 LDA #$02
+ STA MCCTMR ;RESET COLLISION TIMER
+
+* CHECK FOR COLLISIONS
+
+***********HERE NEED TO CHECK THROUGH ELECTRODES FOR COLLISIONS *********
+
+* SEARCH THROUGH OBJECTS IN MC'S ZONE
+* SET UP TEMP0 AND TEMP1 TO BE THE ADDRESS OF THE MC'S ZONE'S ENTRY IN ZONOBJC
+* (THE FIRST IF MC IS IN 2 ZONES). THEN SET Y TO 27 (OR 55 IF MC
+* IS IN 2 ZONES) AND LOOP THRU ZONOBJC, DECREMENTING Y UNTIL IT GOES TO 0.
+
+ LDY #27 ;SET UP Y FOR 1-ZONE CASE
+* COMPUTE MC'S FIRST ZONE, CHECK IF IN 1 OR 2 ZONES, SET UP Y
+
+ LDA MCYPOS ;LOAD MC Y POSITION
+ LSR A
+ LSR A
+ LSR A
+ LSR A ;GET ZONE # FROM Y POSITION
+ STA TEMPZON
+* CHECK IF IN 2 ZONES
+ LDA MCYEX ;Y POSITION OF MC LOWER EDGE
+ LSR A
+ LSR A
+ LSR A
+ LSR A ;GET ZONE # OF MC'S LOWER EDGE
+ CMP TEMPZON ;IS IT SAME AS MC TOP ZONE?
+ BEQ MCC1 ;MC IN ONLY 1 ZONE, LEAVE Y AS 31
+ LDY #55 ;LOAD Y WITH 55 - WE WILL INDEX THRU 2 ZONES
+MCC1 ;NOW Y IS SET UP
+* GET ABSOLUTE ADDRESS OF START OF MC'S ZONE IN ZONOBJC
+* ZONE NUMBER IS IN TEMPZON
+ STY TEMP2 ;PUT Y AWAY FOR NOW
+ LDY TEMPZON ;ZONE NUMBER WILL BE USED TO INDEX
+ LDA ZONOBJLH,Y ;GET HIGH BYTE OF ABS ADDRESS
+ STA TEMP1
+ LDA ZONOBJLL,Y ;GET LOW BYTE OF ABS ADDRESS
+ STA TEMP0
+ LDY TEMP2 ;RECOVER Y - IT WILL INDEX THRU ZONOBJC
+
+* NOW WE HAVE THE ABSOLUTE ADDRESS OF THE ZONOBJC LISTING
+* FOR THE MC'S (FIRST) ZONE IN TEMP0 AND TEMP1
+
+MCCLOOP LDA (TEMP0),Y ;GET OBJECT # FROM CORRECT PART OF ZONOBJC
+ BEQ MCCNEXT ;IF 0, A NULL ENTRY
+ TAX ;PUT OBJECT INDEX IN X
+ LDA CRTBL,X ;LOAD CREATURE TYPE
+ BEQ MCCNEXT ;IF THIS IS 0, ALSO A NULL OBJECT
+ CMP #MCSCODE ;CHECK IF AN MC SHOT
+ BEQ MCCNEXT ;MC CAN'T HIT HIS OWN SHOT
+ LDA STTBL,X
+ BEQ MCCNEXT ;CAN'T HIT DEAD OBJECT
+ AND #MASKL
+ CMP #$03
+ BEQ MCCNEXT ;CAN'T HIT DYING OBJECT
+
+* CHECK FOR A COLLISION WITH THE OBJECT POINTED TO BY X.
+* IF A FAMILY, HANDLE IT AND THEN CONTINUE
+* IF A COLLISION, THE MC BITES IT
+*
+* MC X,Y ARE IN MCXPOS AND MCYPOS
+* MC X,Y EXTENTS ARE IN MCXEX AND MCYEX
+* OBJECT X,Y ARE IN XTBL,X AND YTBL,X
+* OBJECT EXTENTS ARE IN XEXTBL,X AND YEXTBL,X
+* IF A MISS, BRANCH TO MCCNEXT. IF A HIT, FALL THROUGH
+ CLC
+ LDA MCXEX
+ CMP XTBL,X
+ BCC MCCNEXT ;BRANCH IF LESS THAN
+ LDA MCXPOS
+ CMP XEXTBL,X
+ BCS MCCNEXT ;BRANCH IF > OR =
+
+ LDA MCYEX
+ CMP YTBL,X
+ BCC MCCNEXT ;BRANCH ON LESS THAN
+ LDA MCYPOS
+ CMP YEXTBL,X
+ BCS MCCNEXT ;BRANCH ON GREATER THAN
+
+* HIT! CHECK IF WITH FAMILY
+
+ LDA CRTBL,X ;GET CREATURE TYPE
+ CMP #MOCODE
+ BEQ MCCF
+ CMP #DCODE
+ BEQ MCCF
+ CMP #MICODE
+ BNE MCC2
+MCCF ;MC COLLIDED WITH A FAMILY MEMBER
+* NOW: ENTER PICKUP SOUND INTO QUEUE. UPDATE SCORE AND SET FAMILY
+* ANIMATION TO THE CORRECT NUMBER (1,2,3,4 OR 5) WITH THE HIGH BIT SET
+* SET THE OBJECT CODE TO #MOCODE. SET THE DYING BIT IN STTBL.
+* SET THE OBJECT DIRECTION CODE TO 8. FINALLY, RESET MTTBL.
+
+* HERE ENTER PICKUP SOUND INTO SOUND QUEUE ********
+* HERE CALL THE ROUTINE TO UPDATE SCORE - IT SHOULD RETURN WITH
+* THE CORRECT NUMBER ANIMATION IN A (1 - 5 FOR 1000 - 5000 )
+ JSR FSCORE ;THIS RETURNS WITH 1 - 5 IN A
+ ORA #$80 ;SET HIGH BIT
+ STA SATBL,X ;STORE NEW ANIMATION STEP
+ LDA #MOCODE
+ STA CRTBL,X ;STORE NEW CREATURE TYPE
+ LDA #$02 ;BIT 1 IS ON
+ ORA STTBL,X
+ STA STTBL,X ;SET BIT 1 IN STATUS ENTRY
+ LDA #$08
+ STA DXTBL,X ;SET DIR CODE
+ LDA #$00
+ STA MTTBL,X ;RESET MOVEMENT TIMER
+
+ JMP MCCNEXT ;CONTINUE COLLISION CHECKING
+
+MCC2 ;MC DIDN'T HIT A FAMILY, SO HE HIT SOMETHING HE DIDN'T WANT TO
+ JMP MCDEATH ;MC DEATH ROUTINE
+
+* CONTINUE HERE IF NO COLLISION WITH CURRENT OBJECT
+MCCNEXT DEY ;ON TO NEXT ENTRY IN ZONE LIST
+ BPL MCCLOOP ;IF Y NON-NEGATIVE, KEEP GOING
+
+* WE HAVE CHECKED EVERYTHING IN THE MC'S ZONE(S)
+MCOK ;NO COLLISION WITH MC THIS TIME
+ RTS ;MC MAKES IT THROUGH YET ANOTHER FRAME
+
+*
+
+******************************************
+*
+* CHKOBJ -- CHECK OBJECTS LOOP
+* LOOK AT EACH OBJECT, AND IF NECESSARY, MOVE IT
+*
+******************************************
+*
+CHKOBJ LDX #$01 ;OBJECT INDEX FOR FIRST OBJECT (GRUNT)
+
+* X IS THE OBJECT INDEX: A COUNTER INTO THE OBJECT DATA TABLES
+*
+LOOP LDA CRTBL,X ;GET CREATURE CODE
+ BEQ OBJCONT ;NULL OBJECT IF 0
+ CMP #$FF
+ BEQ DONE ;END OF TABLE IF $FF
+*
+ DEC MTTBL,X ;DEC MOVEMENT TIMER
+ BMI MOVE ;TIME HAS COME TO MOVE
+
+* MOVE RETURNS TO HERE:
+OBJCONT INX ;INCREMENT OBJECT INDEX: NEXT OBJECT
+ JMP LOOP ;CHECK THE NEXT OBJECT
+
+*
+DONE RTS
+*
+
+******************************************
+*
+* MOVE -- CALLED BY CHKOBJ
+*
+******************************************
+*
+MOVE ;X IS OBJECT INDEX
+ LDA CRTBL,X ;GET OBJECT TYPE
+* WE NOW HAVE A NUMBER FROM 1 TO $E DENOTING OBJECT TYPE
+
+ SEC
+ SBC #$01 ;GET A NUMBER FROM 0 TO $D
+ ASL A ;MULTIPLY BY 2, HAVE 0 TO $1A
+ TAY
+ LDA MOVTBL,Y ;LOAD TEMP0 AND TEMP1
+ STA TEMP0 ; WITH ADDRESS OF OBJECT HANDLING
+ LDA MOVTBL+1,Y ; ROUTINE LOOKED UP IN MOVTBL
+ STA TEMP1 ;JUMP TO CORRECT ROUTINE TO HANDLE
+ JMP (TEMP0) ; EACH TYPE OF OBJECT
+*
+**********************************************************************
+
+******************
+* THROWAWAY GARBAGE:
+*
+* MARINIT - INIT MARIA STUFF
+MARINIT LDA #$FF ;SET UP GRAPHICS MODE
+ STA CTRL
+M1 EQU MARINIT ;CODE WHICH MAY HAVE TO BE CHANGED
+ ;IN THE EMULATOR DUE TO MARIA DIFFERENCES
+
+ LDA #$00
+ STA CTLSWA ;INIT JOYSTICK PORT
+
+ LDA #$00 ;BACKGROUND COLOR
+ STA BACKGRND
+
+ JSR PALINIT ;SET UP PALETTES
+
+ RTS
+*
+
+*******************
+*
+* PALINIT - INIT PALETTES
+*
+*******************
+*
+
+PALINIT
+* PALETTE 0 - MUTANT CLONE
+ LDA #$0F ;WHITE
+ STA P0C1 ;BODY AND FEET
+ LDA #$69 ;PURPLE
+ STA P0C2 ;ARMS AND HEAD (BEANIE)
+* LEAVE COLOR 3 ALONE - IT CYCLES
+
+* PALETTE 1 - GRUNT AND MIKEY
+ LDA #$0F ;WHITE
+ STA P1C1 ;NECK STRIPE
+ LDA #$36 ;RED
+ STA P1C2 ;BODY
+ LDA #$1F ;YELLOW
+ STA P1C3 ;HEAD AND FEET
+
+* PALETTE 2 - MOMMY
+ LDA #$FF ;BLONDE
+ STA P2C1 ;HAIR AND LEGS
+ LDA #$4F ;HOT PINK
+ STA P2C2 ;DRESS
+ LDA #$DF ;POCKETBOOK GREEN
+ STA P2C3 ;POCKETBOOK
+
+* PALETTE 3 - DADDY
+ LDA #$99 ;BLUE
+ STA P3C1 ;SUIT
+ LDA #$1A ;DIRTY BLONDE
+ STA P3C2 ;HAIR
+ LDA #$14 ;BROWNISH
+ STA P3C3 ;FACE AND ATTACHE CASE
+
+* PALETTE 4 - HULKS
+ LDA #$35 ;RED
+ STA P4C1 ;HEAD AND LEGS
+ LDA #$ED ;LIGHT GREEN
+ STA P4C2 ;BODY
+ LDA #$00 ;UNIMPORTANT
+ STA P4C3 ;ARMS - COLOR CYCLE
+
+* PALETTE 5 - SKULL AND CROSSBONES, SCORE NUMBERS, ELECTRODES
+ LDA #$0F ;WHITE
+ STA P5C1 ;SKULL
+ LDA #$00 ;UNIMPORTANT
+ STA P5C2 ;THIS COLOR CYCLES
+ LDA #$00 ;UNIMPORTANT
+ STA P5C3 ;THIS COLOR CYCLES
+
+* PALETTE 6 - BRAINS
+ LDA #$00 ;UNIMPORTANT
+ STA P6C1 ;EYES AND SOME OF BRAIN - COLOR CYCLES
+ LDA #$97 ;BLUE
+ STA P6C2 ;BRAIN
+ LDA #$EB ;GREEN
+ STA P6C3 ;BRAINS' FEET
+
+ RTS
+*
+
+*****************************************
+*
+* CONV- CONVERT DATA INTO Si MARIA FORM (MUNG-O-RAMA) ********
+*
+*****************************************
+
+; CONVERTS GRAPHICS DATA FROM $4000 TO $5FFF
+; FROM THE FORMAT 76 54 32 10 TO 10 32 54 76
+
+GRAPH EQU $4300
+END EQU $6200 ;SHOULD BE ENLARGED LATER
+
+CONV NOP ;FOR SI MARIA, SHOULD BE A NOP
+ LDA #$60
+ STA CONV ;RTS OUT THIS SUBROUTINE,
+ ; IT HAS BEEN USED ONCE
+ LDX #0
+ LDA #H(GRAPH)
+ STA LOAD+2
+ STA SAVE+2
+LOAD LDA GRAPH,X
+ STA CONVTEMP
+ AND #$C0
+ CLC
+ ROL A
+ ROL A
+ ROL A ;BITS 7,6 IN PLACE
+ ASL CONVTEMP
+ ASL CONVTEMP
+SK2 ASL CONVTEMP
+ BCC SK3
+ ORA #$8 ;ADD BIT 5
+SK3 ASL CONVTEMP
+ BCC SK4
+ ORA #$4 ;ADD BIT 4
+SK4 ASL CONVTEMP
+ BCC SK5
+ ORA #$20 ;ADD BIT 3
+SK5 ASL CONVTEMP
+ BCC SK6
+ ORA #$10 ;ADD BIT 2
+SK6 ORA CONVTEMP ;OR IN BITS 1 AND 0
+SAVE STA GRAPH,X
+ INX
+ BNE LOAD
+ INC LOAD+2
+ INC SAVE+2
+ LDA LOAD+2
+ CMP #H(END)
+ BNE LOAD
+ RTS
+CONVTEMP DB 0 ;TEMP, THROWAWAY VARIABLE
+
+
+
+
+***********************************************
+***********************************************
+***********************************************
+
+
+* END OF RMAIN.S
+ EJE
diff --git a/RSNDS.S82 b/RSNDS.S82
new file mode 100644
index 0000000..e053959
--- /dev/null
+++ b/RSNDS.S82
@@ -0,0 +1,473 @@
+******************
+*
+*
+* ROBOTRON 22-AUGUST-83
+* 24-AUGUST-83 4:00
+*
+* RSOUNDS.S SOUND ROUTINES AND DATA
+*
+******************
+
+* ORIGINALLY: ALIEN;TUNES.S - SOUND DRIVER
+
+* THERE ARE 3 EXTERNAL ROUTINES IN THIS PACKAGE:
+* DOTUNE STARTS A TUNE, THE NUMBER OF THE TUNE IS IN THE ACCUMULATOR
+* KILLTUNE KILLS A TUNE, THE NUMBER OF THE TUNE IS IN THE ACCUMULATOR
+* CLEARTUN CLEARS OUT ALL TUNES, INCLUDING BACKED UP TUNES
+* NOTE THAT THESE ALL PRESERVE X AND Y REGISTERS.
+* IN ADDITION, THERE IS A ROUTINE CALLED 'TUNER' WHICH SHOULD BE CALLED ONCE
+* PER FRAME (PREFERABLY AT ABOUT THE SAME TIME EACH FRAME). NOTE THAT IT
+* CAN BE CALLED LESS FREQUENTLY (SAY ONCE PER TWO FRAMES) IF THE DURATION
+* DATA IS HALVED AND YOU ARE WILLING TO LIVE WITH THE DECREASED DURATION
+* RESOLUTION.
+
+* A BRIEF DESCRIPTION OF THE DRIVER. THIS IS A PRIORITY BASED TUNE DRIVER
+* WITH TWO BACK-UP CHANNELS. WHENEVER A DOTUNE IS EXECUTED, A CLEAR CHANNEL
+* IS LOOKED FOR. IF IT IS NOT AVAILABLE, PRIORITIES ARE CHECKED TO SEE IF
+* THE NEW TUNE SHOULD PREEMPT A LOWER PRIORITY TUNE. WHICHEVER TUNE LOSES
+* IS STORED IN ONE OF THE BACK-UP CHANNELS AND RESTARTED WHENEVER A CHANNEL
+* FREES ITSELF. IF MORE THAN ONE IS BACKED UP, THE HIGHER PRIORITY ONE IS
+* RESTARTED. CONCEPTUALLY THERE ARE 4 SOUND CHANNELS, OF WHICH CHANNELS 0
+* AND 1 ARE ACTIVE AND CHANNELS 2 AND 3 ARE INACTIVE. THERE ARE PROVISIONS
+* FOR INFINITE TUNES AND TUNES WHICH INVOKE OTHER TUNES WHEN THEY ARE FINISHED.
+
+* LET'S START WITH THE DATA. NOTE THAT I HAVE LEFT A SELECTION OF TUNES
+* AND SOUND EFFECTS FROM MS PAC-MAN IN HERE TO SHOW HOW THE DATA IS ORGANIZED.
+* THERE ARE 5 TABLES WHICH CONTROL THE TUNES. THESE ARE INDEXED BY THE TUNE
+* TUMBER. THESE ARE:
+* TBASE LOW BYTE OF BASE ADDRESS OF TUNE DATA
+* TBASE1 HI BYTE
+* TCTLOFF OFFSET INTO TUNE DATA WHERE CTL DATA STARTS
+* TVOLOFF OFFSET INTO TUNE DATA WHERE VOLUME DATA STARTS
+* TPRIOR PRIORITY OF THIS TUNE (FROM 0 TO $7F, 0 IS LOWEST)
+* THESE TABLES TELL WHERE TO FIND AND HOW TO INTERPRET THE 'TUNE DATA' FOR
+* EACH TUNE. THE TUNE DATA IS ORGANIZED AS FOLLOWS:
+* FREQUENCY INFORMATION: THIS IS A SET OF PAIRS 'FREQ,DUR' WHERE
+* FREQ IS THE VALUE TO STUFF INTO AUDF0 AND DUR IS THE NUMBER
+* OF FRAMES TO LEAVE IT THERE. THE TUNE IS TERMINATED WHEN
+* A NEGATIVE FREQ IS ENCOUNTERED (THERE ARE ONLY 5 SIGNIFICANT
+* BITS OF FREQ, SO THIS DOES NOT LIMIT THE TUNES). THERE ARE
+* THE FOLLOWING WAYS TO TERMINATE A TUNE:
+* $FF - THE TUNE IS OVER
+* $FE - REPEAT THE TUNE (MAKES THE TUNE INFINITE)
+* $FD,TUNENUM - IMMEDIATELY START TUNENUM
+* CONTROL INFORMATION: THIS IS A SET OF PAIRS 'CTL,DUR' WHERE CTL IS
+* THE VALUE TO STUFF INTO AUDC0 AND DUR IS THE NUMBER OF FRAMES
+* TO LEAVE IT THERE. A DUR OF '$00' WILL MAKE THE CTL LAST THE
+* ENTIRE TUNE.
+* VOLUME INFORMATION: THIS IS A SET OF PAIRS 'VOL,DUR' WHERE VOL IS
+* THE VALUE TO STUFF INTO AUDV0 AND DUR IS THE NUMBER OF FRAMES
+* TO LEAVE IT THERE. AGAIN, A DUR OF '$00' WILL KEEP THE VOL
+* FOR THE ENTIRE TUNE.
+* NOTE THAT THE TUNE DATA FOR A SINGLE TUNE CANNOT BE LARGER THAN A PAGE.
+* BREAK THE TUNE INTO TWO PARTS WITH ONE STARTING THE OTHER IF YOU NEED A
+* LARGER TUNE. TAKE A LOOK AT THE EXAMPLES AT THE END OF THIS FILE IF THIS
+* DESCRIPTION DOESN'T MAKE SENSE, THERE ARE EXAMPLES OF INFINITE TUNES AND
+* TUNES CALLING EACH OTHER. NOTE THAT AN INFINITE TUNE CAN BE STOPPED BY
+* A KILLTUN OR A CLEARTUN.
+
+* AND NOW TO THE VARIABLES NEEDED. COPY OUT THESE VARIABLES (CHANGING THE
+* LOCATIONS AS NEEDED):
+
+*
+* ALL VARIABLES USED ARE IN RMAIN.S
+*
+* NOTE THAT SOUNDZP CAN PROBABLY BE PUT THE SAME PLACE AS YOUR LOADER TEMP
+* VARIABLES.
+* THE ONLY VARIABLES HERE THAT YOU MIGHT WISH TO LOOK AT FROM 'OUTSIDE' ARE
+* TUNON AND TUNINDEX. TUNON IS 1 IF A CHANNEL IS USED, 0 IF IT IS FREE.
+* TUNINDEX IS THE TUNE NUMBER OF A USED CHANNEL, 0 IF THE CHANNEL IS FREE.
+* NOTE THAT IF TUNON IS 0, A ZERO VOLUME IS FORCED INTO THE APPROPRIATE VOLUME
+* REGISTER, SO SIMPLY ZEROING THE TUNE DATA WILL SHUT THE TIA UP (OF COURSE,
+* CLEARTUN ALSO DOES THIS).
+
+* THE SIZE OF THIS CODE IS ABOUT $200 BYTES. NOTE THAT THE TUNE DATA WILL
+* PROBABLY RUN MUCH LARGER.
+
+
+* THIS ROUTINE ENTERS A TUNE INTO ONE OF THE SOUND CHANNELS IF IT CAN
+* INPUT: TUNE NUMBER IN A
+* X AND Y ARE PRESERVED
+DOTUNE STA TUNNUM ;SAVE IT
+ TXA ;STACK REGISTERS
+ PHA
+ TYA
+ PHA
+
+ LDX TUNNUM ;FIND PRIORITY OF NEW TUNE
+ LDA TPRIOR,X
+ STA TUNTEMP0
+ JSR GETCHANL ;GET A CHANNEL
+ CPX #$00 ;SEE IF WE GOT ONE
+ BMI DTOUT
+ LDA TUNNUM
+ JSR BEGINTUN ;START THE TUNE
+
+DTOUT PLA ;UNSTACK REGISTERS
+ TAY
+ PLA
+ TAX
+ RTS
+
+
+* THIS ROUTINE TRIES TO GET A CHANNEL TO PUT A TUNE INTO. THIS IS DONE BY
+* GIVING AN OPEN CHANNEL IF AVAILABLE OR BUMPING SOMEONE IF NONE ARE OPEN.
+* IF THE PRIORITY IS TO LOW TO GET ANYTHING, FF IS RETURNED.
+* INPUT: PRIORITY OF REQUESTOR IN TUNTEMP0
+* OUTPUT:CHANNEL IN X, $FF IF NO CHANNEL AVAILABLE
+* USES: X, Y
+GETCHANL LDX #$01 ;FIRST - SEE IF OPEN ACTIVE CHANNEL
+GCLOOP0 LDA TUNON,X ;SEE IF CHANNEL OPEN
+ BNE GCNEXT0
+ RTS ;GOT IT - EASY
+GCNEXT0 DEX
+ BPL GCLOOP0
+
+ LDX #$00 ;NOW, TRY TO BUMP ACTIVE CHANNEL
+ LDA TUNPRIOR ;GET INDEX OF LOWER PRIORITY ACTIVE CNL
+ CMP TUNPRIOR+1
+ BMI GCJMP0
+ INX
+GCJMP0 LDA TUNPRIOR,X ;SEE IF OUR PRIORITY HIGHER
+ CMP TUNTEMP0
+ BPL GCNONE ;NO CHANNELS AVAILABLE
+
+ JMP ENDTUNE
+
+ ;HERE I DELETED STUFF TO HANDLE BACKUP CHANNELS
+
+GCNONE LDX #$FF ;NO CHANNELS AVAILABLE
+ RTS
+
+
+* ROUTINE TO KILL A PARTICULAR TUNE - IF IT IS RUNNING
+* INPUT: TUNE NUMBER IN A
+* X AND Y ARE PRESERVED
+KILLTUNE STA TUNNUM ;SAVE IT
+ TXA ;STACK REGISTERS
+ PHA
+ TYA
+ PHA
+ LDX #$01 ;CHECK ALL CHANNELS
+KTLOOP LDA TUNON,X ;SEE IF CHANNEL ON
+ BEQ KTNEXT
+ LDA TUNINDEX,X ;SEE IF HAS TUNE TO BE KILLED
+ CMP TUNNUM
+ BNE KTNEXT
+ JSR ENDTUNE ;ERASE IT
+KTNEXT DEX
+ BPL KTLOOP
+ PLA ;UNSTACK REGISTERS
+ TAY
+ PLA
+ TAX
+ RTS
+
+
+* THIS ROUTINE ERASES ALL TUNES
+* X AND Y ARE PRESERVED
+CLEARTUN TXA ;STACK REGISTERS
+ PHA
+ TYA
+ PHA
+ LDX #$01
+CTLOOP JSR ENDTUNE ;ERASE CURRENT TUNE
+ DEX
+ BPL CTLOOP
+ PLA ;UNSTACK REGISTERS
+ TAY
+ PLA
+ TAX
+ RTS
+
+
+* THIS ROUTINE IS CALLED EVERY VBLANK TO TAKE CARE OF TUNES
+* REGISTERS ARE NOT SAVED
+TUNER LDX #$01 ;TWO TUNES CHANNELS, START WITH SECOND
+TUNLOOP LDA TUNON,X
+ BNE TUNBODY
+ STA AUDV0,X ;CHANNEL OFF - MAKE SURE VOLUME OFF
+ JMP TUNNEXT
+
+TUNBODY LDA TUNBASE,X ;GET ADDRESS OF TUNE
+ STA SOUNDZP
+ LDA TUNBASE1,X
+ STA SOUNDZP+1
+
+ DEC FREQTIME,X ;DO FREQUENCY
+ BNE TUNCTL
+ JSR TNXTFREQ ;TIME FOR NEXT FREQUENCY
+TUNCTL LDA CTLTIME,X ;DO CONTROL
+ BEQ TUNVOL ;IS CTL CONSTANT? (STARTS AT 0)
+ DEC CTLTIME,X
+ BNE TUNVOL
+ JSR TNXTCTL ;TIME FOR NEXT CTL
+TUNVOL LDA VOLTIME,X ;DO VOLUME
+ BEQ TUNNEXT ;IS VOLUME CONSTANT? (STARTS AT 0)
+ DEC VOLTIME,X
+ BNE TUNNEXT
+ JSR TNXTVOL ;TIME FOR NEXT VOLUME
+
+TUNNEXT DEX ;DONE WITH THAT TUNE, IS THERE ANOTHER?
+ BPL TUNLOOP
+ RTS ;ALL DONE
+
+* ROUTINES TO GET NEXT FREQUENCY, CTL, OR VOLUME
+
+* THIS ROUTINE GETS NEXT FREQUENCY
+TNXTFREQ LDY FREQOFF,X ;GET INDEX INTO TABLE
+ LDA (SOUNDZP),Y ;GET FREQUENCY
+ BMI TNFENDT ;IS THIS THE END OF THE TUNE?
+ STA AUDF0,X
+ INY
+ LDA (SOUNDZP),Y ;GET DURATION
+ STA FREQTIME,X
+ INY
+ TYA
+ STA FREQOFF,X
+ RTS
+TNFENDT CMP #$FF ;SEE IF TUNE OVER
+ BEQ TNFEOVER
+ CMP #$FE ;SEE IF TUNE REPEATS
+ BEQ TNFEREPT
+ INY ;ANOTHER TUNE COMING
+ LDA (SOUNDZP),Y ;FIND OUT WHICH TUNE
+ JSR BEGINTUN ;START TUNE
+ JMP TNFEOUT
+
+TNFEREPT LDA TUNINDEX,X ;TUNE REPEATS - RESTART IT
+ JSR BEGINTUN ;START TUNE
+ JMP TNFEOUT
+
+TNFEOVER JSR ENDTUNE ;TUNE FINISHED
+TNFEOUT PLA ;END OF TUNE
+ PLA ;GET RID OF WHERE WE ARE RTS'ING TO
+ JMP TUNLOOP ;UPDATE THIS CHANNEL
+
+
+* THIS ROUTINE GETS NEXT CONTROL BYTE
+TNXTCTL LDY CTLOFF,X ;GET INDEX INTO TABLE
+ LDA (SOUNDZP),Y ;GET FREQUENCY
+ STA AUDC0,X
+ INY
+ LDA (SOUNDZP),Y ;GET DURATION
+ STA CTLTIME,X
+ INY
+ TYA
+ STA CTLOFF,X
+ RTS
+
+
+* THIS ROUTINE GETS NEXT VOLUME BYTE
+TNXTVOL LDY VOLOFF,X ;GET INDEX INTO TABLE
+ LDA (SOUNDZP),Y ;GET FREQUENCY
+ STA AUDV0,X
+ INY
+ LDA (SOUNDZP),Y ;GET DURATION
+ STA VOLTIME,X
+ INY
+ TYA
+ STA VOLOFF,X
+ RTS
+
+
+* THIS ROUTINE CLEARS OUT A TUNE CHANNEL
+* INPUT: X IS CHANNEL
+ENDTUNE LDA #$00
+ STA TUNON,X ;INDICATE CHANNEL CLEAR
+ STA TUNINDEX,X ;CLEAR TUNE INDEX
+ ;HERE WAS BACKUP CHANNEL STUFF
+ETOUT RTS
+
+
+* THIS ROUTINE STARTS A TUNE IN A CHANNEL
+* INPUT: X IS CHANNEL, A IS TUNE
+* USES: Y
+BEGINTUN TAY ;PUT TUNE IN Y
+ STA TUNINDEX,X ;SET THE TUNE INDEX
+ LDA TBASE,Y ;SET THE BASE ADDRESS FOR TUNE
+ STA TUNBASE,X
+ LDA TBASE1,Y
+ STA TUNBASE1,X
+ LDA #$00 ;FREQUENCY IS AT START OF TUNE
+ STA FREQOFF,X
+ LDA TCTLOFF,Y ;SET CONTROL OFFSET
+ STA CTLOFF,X
+ LDA TVOLOFF,Y ;SET VOLUME OFFSET
+ STA VOLOFF,X
+ LDA TPRIOR,Y ;SET PRIORITY
+ STA TUNPRIOR,X
+ LDA #$01 ;SET FREQ, CTL, AND VOL TO BE SET
+ STA FREQTIME,X ; NEXT VBLANK (TICK DOWN TO 0 EACH)
+ STA CTLTIME,X
+ STA VOLTIME,X
+ STA TUNON,X ;AND TURN THE TUNE ON!
+ RTS
+
+
+* THIS ROUTINE MOVES A TUNE FROM ONE CHANNEL TO ANOTHER
+* INPUT: Y IS FROM CHANNEL, X IS TO CHANNEL
+ ; THIS ROUTINE IS NO LONGER NECESSARY
+
+* DATA FOR TUNES
+
+* TUNE TABLES, BASE ADDRESSES FOR TUNES AND THE OFFSETS WITHIN THE TUNES WHERE
+* THE CTL AND VOL INFORMATION START
+TBASE DB L(TMCS),L(TFPICK),L(TCREDIE),L(TSKULL0),L(TSKULL1),L(TEXTRA)
+ DB L(TRACKA),L(TRACKB),L(TMCDIE)
+
+TBASE1 DB H(TMCS),H(TFPICK),H(TCREDIE),H(TSKULL0),H(TSKULL1),H(TEXTRA)
+ DB H(TRACKA),H(TRACKB),H(TMCDIE)
+
+TCTLOFF DB 021,023,015,017,017,009,078,111,009
+
+TVOLOFF DB 023,039,019,019,019,011,206,159,011
+
+TPRIOR DB 005,020,006,015,015,025,018,018,022
+
+* TUNE 0 - MUTANT CLONE SHOOTING
+SMCS EQU 0 ;TUNE 0
+TMCS DB $02,$01,$03,$01,$04,$01,$05,$01,$06,$01 ;FREQ
+ DB $07,$01,$08,$01,$09,$01,$0A,$01,$0B,$01,$FF
+
+ DB $06,$00 ;CTL
+
+ DB $09,$00 ;VOL
+
+* TUNE 1 - FAMILY PICKUP SOUND
+SFPICK EQU 1
+TFPICK DB $15,$09,$0D,$03,$15,$03,$14,$03,$0C,$03
+ DB $15,$03,$13,$03,$0B,$03,$15,$03,$12,$03
+ DB $0A,$03,$FF
+
+ DB $06,$06,$0D,$06,$06,$03,$0D,$06,$06,$03
+ DB $0D,$06,$06,$03,$0D,$06
+
+ DB $09,$00
+
+* TUNE 2 - GENERIC EXPLOSION
+SCREDIE EQU 2
+TCREDIE DB $02,$03,$03,$03,$04,$03,$05,$03,$06,$03
+ DB $15,$03,$19,$03,$FF
+
+ DB $08,$0F,$02,$06
+
+ DB $09,$03,$07,$03,$06,$03,$05,$03,$04,$03
+ DB $06,$03,$03,$03
+
+
+* TUNE 3 - SKULL AND CROSSBONES SCREAM CHANNEL 0
+SSKULL0 EQU 3
+TSKULL0 DB $0C,$04,$0D,$04,$0E,$04,$0F,$04,$10,$04
+ DB $11,$04,$12,$04,$13,$04,$FF
+
+ DB $04,$00
+
+ DB $09,$00
+
+* TUNE 4 - SKULL AND CROSSBONES SCREAM CHANNEL 1
+SSKULL1 EQU 4
+TSKULL1 DB $1F,$04,$1E,$04,$1D,$04,$1C,$04,$1B,$04
+ DB $1A,$04,$19,$04,$18,$04,$FF
+
+ DB $04,$00
+
+ DB $02,$04,$03,$04,$04,$04,$05,$04,$06,$04
+ DB $05,$04,$04,$04,$03,$04,$FF
+
+
+* TUNE 5 - EXTRA MAN
+SEXTRA EQU 5
+TEXTRA DB $03,$02,$04,$02,$05,$02,$06,$02,$FF
+
+ DB $0F,$00
+
+ DB $09,$00
+
+* TUNE 6 - BETWEEN RACK SOUND PART A
+SRACKA EQU 6
+TRACKA DB $1F,$04,$1D,$04,$1B,$04,$1A,$04,$18,$04 ;FREQ
+ DB $17,$04,$16,$04,$14,$04,$13,$04,$12,$04
+ DB $11,$04,$10,$04,$0F,$04,$0E,$04,$0D,$04
+ DB $0C,$04,$0B,$04,$0A,$04,$09,$02,$1F,$02
+ DB $08,$02,$1D,$02,$07,$02,$1B,$02,$06,$02
+ DB $1A,$02,$05,$02,$18,$02,$04,$02,$17,$02
+ DB $15,$04,$14,$04,$13,$04,$12,$04,$11,$04
+ DB $10,$04,$0F,$04,$0E,$04,$FD,$07
+
+
+ DB $06,$02,$0D,$02,$06,$02,$0D,$02 ;CTL
+ DB $06,$02,$0D,$02,$06,$02,$0D,$02
+ DB $06,$02,$0D,$02,$06,$02,$0D,$02
+ DB $06,$02,$0D,$02,$06,$02,$0D,$02
+ DB $06,$02,$0D,$02,$06,$02,$0D,$02
+ DB $06,$02,$0D,$02,$06,$02,$0D,$02
+ DB $06,$02,$0D,$02,$06,$02,$0D,$02
+ DB $06,$02,$0D,$02,$06,$02,$0D,$02
+ DB $06,$02,$0D,$02,$06,$02,$0D,$02
+ DB $06,$02,$04,$02,$06,$02,$04,$02
+ DB $06,$02,$04,$02,$06,$02,$04,$02
+ DB $06,$02,$04,$02,$06,$02,$04,$02
+ DB $0D,$02,$04,$02,$0D,$02,$04,$02
+ DB $0D,$02,$04,$02,$0D,$02,$04,$02
+ DB $0D,$02,$04,$02,$0D,$02,$04,$02
+ DB $0D,$02,$04,$02,$0D,$02,$04,$02
+
+ DB $09,$00 ;VOL
+
+* TUNE 7 - BETWEEN RACK SOUND PART B
+SRACKB EQU 7
+TRACKB DB $0D,$04,$09,$02 ;FREQ
+ DB $13,$02,$18,$02,$1D,$02,$0B,$02,$0F,$02
+ DB $10,$02,$16,$02,$0A,$02,$12,$02,$15,$02
+ DB $1D,$02,$0D,$02,$0E,$02,$09,$02,$13,$02
+ DB $18,$02,$1D,$02,$0B,$02,$0F,$02,$10,$02
+ DB $16,$02,$0A,$02,$12,$02,$15,$02,$1D,$02
+ DB $0D,$02,$0E,$02,$09,$02,$13,$02,$18,$02
+ DB $1D,$02,$0B,$02,$0F,$02,$10,$02,$16,$02
+ DB $0A,$02,$12,$02,$15,$02,$1D,$02,$0D,$02
+ DB $0E,$02,$09,$02,$13,$02,$18,$02,$1D,$02
+ DB $0B,$02,$0F,$02,$10,$02,$16,$02,$0A,$02
+ DB $12,$02,$15,$02,$1D,$02,$FF
+
+ DB $0D,$02,$04,$04,$0D,$06,$06,$04 ;CTL
+ DB $04,$06,$0D,$06,$06,$04,$04,$02
+ DB $0D,$06,$06,$04,$04,$06,$0D,$06
+ DB $06,$04,$04,$02,$0D,$06,$06,$04
+ DB $04,$06,$0D,$06,$06,$04,$04,$02
+ DB $0D,$06,$06,$04,$04,$06,$0D,$06
+
+ DB $09,$00 ;VOL
+
+* TUNE 8 - MC DEATH SOUND
+SMCDIE EQU 8
+TMCDIE DB $0A,$04,$0C,$04,$0F,$04,$1F,$80,$FF
+
+ DB $08,$00
+
+ DB $09,$0C,$0F,$10,$0A,$10,$09,$10,$07,$10
+ DB $05,$10,$04,$10,$03,$0C,$02,$0C,$01,$0C
+
+
+
+
+***********
+* TEMPORARY EQUIVALENCES FOR ROBOTRON
+***********
+
+*SSKULL EQU SPACDTH
+*SFPICK EQU SANIM10
+*SMCS EQU SMUNCH
+*SCREDIE EQU SFRTBNC
+*SMCDIE EQU SENERGA
+
+
+* TUNE # -
+;S EQU #
+;T DB $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
+; DB $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
+; DB $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
+
+*********** END OF RSOUNDS.S *************
+
+ EJE
diff --git a/RSTMP.S82 b/RSTMP.S82
new file mode 100644
index 0000000..a0d78b4
--- /dev/null
+++ b/RSTMP.S82
@@ -0,0 +1,1930 @@
+******************
+*
+*
+* ROBOTRON 20-JULY-83
+* 12-AUGUST-83 C:00
+* 19-AUGUST-83 5:30
+*
+* RSTAMPS.S STAMP DATA
+*
+******************
+
+
+STAMPS EQU STAMPBAS+$F00
+
+
+**** LINE 0
+ ORG STAMPS
+
+MCD0S0 DB $FB,$C0 ;MC D0 S0
+MCD0S1 DB $FB,$C0
+MCD0S2 DB $FB,$C0
+MCD1S0 DB $2A,0 ;MC D1
+MCD1S1 DB $2A,0
+MCD1S2 DB $2A,0
+MCD2S0 DB $2A,$C0 ;MC D2
+MCD2S1 DB $A,$B0
+MCD2S2 DB $2A,$C0
+MCD3S0 DB $EA,0 ;MC D3
+MCD3S1 DB $3A,$80
+MCD3S2 DB $EA,0
+GD0S0 DB $A,$80 ;G D0
+GD0S1 DB $A,$80
+GD0S2 DB $A,$80
+MOD0S0 DB $14,0 ;MO D0
+MOD0S1 DB $14,0
+MOD0S2 DB $14,0
+MOD1S0 DB 5,0 ;MO D1
+MOD1S1 DB 5,0
+MOD1S2 DB 5,0
+MOD2S0 DB $14,0 ;MO D2
+MOD2S1 DB $14,0
+MOD2S2 DB $14,0
+MOD3S0 DB $14,0 ;MO D3
+MOD3S1 DB $14,0
+MOD3S2 DB $14,0
+DD0S0 DB $A,$80 ;D D0
+DD0S1 DB $A,$80
+DD0S2 DB $A,$80
+DD1S0 DB $2A,0 ;D D1
+DD1S1 DB $2A,0
+DD1S2 DB $2A,0
+DD2S0 DB $A8,0 ;D D2
+DD2S1 DB $2A,0
+DD2S2 DB $2A,0
+DD3S0 DB $2A,0 ;D D3
+DD3S1 DB $A,$80
+DD3S2 DB $A,$80
+MID0S0 DB $2A,0 ;MI D0
+MID0S1 DB $2A,0
+MID0S2 DB $2A,0
+MID1S0 DB $2A,0 ;MID1
+MID1S1 DB $2A,0
+MID1S2 DB $2A,0
+MID2S0 DB $A8,0 ;MID2
+MID2S1 DB $2A,0
+MID2S2 DB $2A,0
+MID3S0 DB $A8,0 ;MID3
+MID3S1 DB $2A,0
+MID3S2 DB $2A,0
+SKULL DB 1,$50,0
+SCORE1K DB $F2,$AA,$A0
+SCORE2K DB $FE,$AA,$A0
+SCORE3K DB $FE,$AA,$A0
+SCORE4K DB $C2,$AA,$A0
+SCORE5K DB $FE,$AA,$A0
+HD0S0 DB 5,$40 ;H D0
+HD0S1 DB 5,$40
+HD0S2 DB 5,$40
+HD1S0 DB 5,$40 ;H D1
+HD1S1 DB 5,$40
+HD1S2 DB 5,$40
+HD2S0 DB $15,0 ;H D2
+HD2S1 DB $15,0
+HD2S2 DB $15,0
+HD3S0 DB 1,$50 ;H D3
+HD3S1 DB 1,$50
+HD3S2 DB 1,$50
+SD0S0 DB $00,$00 ;S D0 S0
+SD0S1 DB $00,$00
+SD0S2 DB $00,$00
+SD0S3 DB $00,$00
+SD0S4 DB $00,$00
+SD0S5 DB $00,$00
+SD0S6 DB $00,$00
+SD0S7 DB $00,$00
+QD0S0 DB $00,$00 ;Q D0 S0
+QD0S1 DB $00,$00
+QD0S2 DB $00,$00
+QD0S3 DB $00,$00
+QD0S4 DB $00,$00
+QD0S5 DB $00,$00
+QD0S6 DB $00,$00
+QD0S7 DB $00,$00
+ED0S0 DB $00,$00 ;E D0 S0
+ED0S1 DB $00,$00
+TD0S0 DB $00,$00 ;T D0 S0
+TD0S1 DB $00,$00
+TD0S2 DB $00,$00
+TD0S3 DB $00,$00
+BD0S0 DB $26,$50 ;B D0
+BD0S1 DB $26,$50
+BD0S2 DB $26,$50
+BD1S0 DB $16,$60 ;B D1
+BD1S1 DB $16,$60
+BD1S2 DB $16,$60
+BD2S0 DB $19,$40 ;B D2
+BD2S1 DB $19,$40
+BD2S2 DB $19,$40
+BD3S0 DB $05,$90 ;B D3
+BD3S1 DB $05,$90
+BD3S2 DB $05,$90
+MCSD0S0 DB 0 ;MCSD0
+MCSD5S0 DB $40 ;D5
+MCSD6S0 DB 1 ;D6
+MCSD7S0 DB $55 ;D7
+MCSDDS0 DB $40 ;DD
+ DB $C,$C0 ;G,BEX0
+GD0S3 DB $A,$80 ;G,BEX1
+GD0S4 DB $A,$80 ;G,BEX2
+GD0S5 DB $2,$80 ;G,BEX3
+GD0S6 DB $0,$00 ;G,BEX4
+GD0S7 DB $0,$00 ;G,BEX5
+GD0S8 DB $0,$0 ;G,BEX6
+
+
+**** LINE 1
+ ORG STAMPS+$100
+
+ DB $EA,$C0 ;MC D0 S0
+ DB $EA,$C0
+ DB $EA,$C0
+ DB $FF,$C0 ;MC D1
+ DB $FF,$C0
+ DB $FF,$C0
+ DB $AA,$C0 ;MC D2
+ DB $2A,$B0
+ DB $AA,$C0
+ DB $EA,$80 ;MC D3
+ DB $3A,$A0
+ DB $EA,$80
+ DB $3F,$F0 ;G D0
+ DB $3F,$F0
+ DB $3F,$F0
+ DB $14,$00 ;MO D0
+ DB $14,$00
+ DB $14,$00
+ DB $1A,$40 ;MO D1
+ DB $1A,$40
+ DB $1A,$40
+ DB $18,0 ;MO D2
+ DB $18,0
+ DB $18,0
+ DB $24,0 ;MO D3
+ DB $24,0
+ DB $24,0
+ DB $0A,$80 ;D D0
+ DB $0A,$80
+ DB $0A,$80
+ DB $0C,0 ;D D1
+ DB $0C,0
+ DB $0C,0
+ DB $B0,0 ;D D2
+ DB $2C,0
+ DB $2C,0
+ DB $E,0 ;D D3
+ DB $03,$80
+ DB $03,$80
+ DB $2A,0 ;MID0
+ DB $2A,0
+ DB $2A,0
+ DB $2A,0 ;MID1
+ DB $2A,0
+ DB $2A,0
+ DB $A8,0 ;MID2
+ DB $2A,0
+ DB $2A,0
+ DB $A8,0 ;MID3
+ DB $2A,0
+ DB $2A,0
+ DB 5,$54,0 ;SK
+ DB $32,$22,$20 ;1K
+ DB $E,$22,$20
+ DB $E,$22,$20
+ DB $CE,$22,$20
+ DB $C2,$22,$20 ;5K
+ DB 1,0 ;H D0
+ DB 1,0
+ DB 1,0
+ DB 1,0 ;H D1
+ DB 1,0
+ DB 1,0
+ DB 4,0 ;H D2
+ DB 4,0
+ DB 4,0
+ DB 0,$40 ;H D3
+ DB 0,$40
+ DB 0,$40
+ DB $00,$00 ;S D0 S0
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00 ;Q D0 S0
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00 ;E D0 S0
+ DB $00,$00
+ DB $00,$00 ;T D0 S0
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $66,$68 ;B D0
+ DB $66,$68
+ DB $66,$68
+ DB $A6,$64 ;B D1
+ DB $A6,$64
+ DB $A6,$64
+ DB $A9,$A0 ;B D2
+ DB $A9,$A0
+ DB $A9,$A0
+ DB $29,$A8 ;B D3
+ DB $29,$A8
+ DB $29,$A8
+ DB $00 ;MCSD0
+ DB $40 ;D5
+ DB $01 ;D6
+ DB $00 ;D7
+ DB $40 ;DD
+ DB $F3,$F0 ;G,BEX0
+ DB $3F,$F0 ;G,BEX1
+ DB $3C,$F0 ;G,BEX2
+ DB $20,$30 ;G,BEX3
+ DB $20,$20 ;G,BEX4
+ DB $00,$80 ;G,BEX5
+ DB $00,$00 ;G,BEX6
+
+
+**** LINE 2
+ ORG STAMPS+$200
+
+ DB $EA,$C0 ;MC D0 S0
+ DB $EA,$C0
+ DB $EA,$C0
+ DB $CC,$C0 ;MC D1
+ DB $CC,$C0
+ DB $CC,$C0
+ DB $FF,$C0 ;MC D2
+ DB $3F,$F0
+ DB $FF,$C0
+ DB $FF,$C0 ;MC D3
+ DB $3F,$F0
+ DB $FF,$C0
+ DB $3F,$F0 ;G D0
+ DB $3F,$F0
+ DB $3F,$F0
+ DB $55,$00 ;MO D0
+ DB $55,$00
+ DB $55,$00
+ DB $19,$40 ;MO D1
+ DB $19,$40
+ DB $19,$40
+ DB $54,0 ;MO D2
+ DB $54,0
+ DB $54,0
+ DB $15,0 ;MO D3
+ DB $15,0
+ DB $15,0
+ DB $0A,$80 ;D D0
+ DB $0A,$80
+ DB $0A,$80
+ DB $3F,0 ;D D1
+ DB $3F,0
+ DB $3F,0
+ DB $BC,0 ;D D2
+ DB $2F,0
+ DB $2F,0
+ DB $3E,0 ;D D3
+ DB $F,$80
+ DB $F,$80
+ DB $2A,0 ;MID0
+ DB $2A,0
+ DB $2A,0
+ DB $19,0 ;MID1
+ DB $19,0
+ DB $19,0
+ DB $A4,0 ;MID2
+ DB $29,0
+ DB $29,0
+ DB $68,0 ;MID3
+ DB $1A,0
+ DB $1A,0
+ DB 5,$54,0 ;SK
+ DB $32,$22,$20 ;1K
+ DB $FE,$22,$20
+ DB $3E,$22,$20
+ DB $FE,$22,$20
+ DB $FE,$22,$20 ;5K
+ DB $EA,$AC ;H D0
+ DB $EA,$AC
+ DB $EA,$AC
+ DB $EA,$AC ;H D1
+ DB $EA,$AC
+ DB $EA,$AC
+ DB $AA,$80 ;H D2
+ DB $AA,$80
+ DB $AA,$80
+ DB $A,$A8 ;H D3
+ DB $A,$A8
+ DB $A,$A8
+ DB $00,$00 ;S D0 S0
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00 ;Q D0 S0
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00 ;E D0 S0
+ DB $00,$00
+ DB $00,$00 ;T D0 S0
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $95,$94 ;B D0
+ DB $95,$94
+ DB $95,$94
+ DB $59,$58 ;B D1
+ DB $59,$58
+ DB $59,$58
+ DB $65,$64 ;B D2
+ DB $65,$64
+ DB $65,$64
+ DB $65,$64 ;B D3
+ DB $65,$64
+ DB $65,$64
+ DB $00 ;MCSD0
+ DB $10 ;D5
+ DB $04 ;D6
+ DB $00 ;D7
+ DB $40 ;DD
+ DB $15,$34 ;G,BEX0
+ DB $3C,$F0 ;G,BEX1
+ DB $30,$30 ;G,BEX2
+ DB $30,$00 ;G,BEX3
+ DB $00,$00 ;G,BEX4
+ DB $20,$00 ;G,BEX5
+ DB $02,$00 ;G,BEX6
+
+
+**** LINE 3
+ ORG STAMPS+$300
+
+ DB $2A,$00 ;MC D0 S0
+ DB $2A,$00
+ DB $2A,$00
+ DB $3F,$00 ;MC D1
+ DB $3F,$00
+ DB $3F,$00
+ DB $EA,$C0 ;MC D2
+ DB $3A,$B0
+ DB $EA,$C0
+ DB $EA,$C0 ;MC D3
+ DB $3A,$B0
+ DB $EA,$C0
+ DB $00,$00 ;G D0
+ DB $00,$00
+ DB $00,$00
+ DB $55,$00 ;MO D0
+ DB $55,$00
+ DB $55,$00
+ DB $15,$40 ;MO D1
+ DB $15,$40
+ DB $15,$40
+ DB $60,0 ;MO D2
+ DB $60,0
+ DB $60,0
+ DB $09,0 ;MO D3
+ DB $09,0
+ DB $09,0
+ DB $0F,$C0 ;D D0
+ DB $0F,$C0
+ DB $0F,$C0
+ DB $3F,0 ;D D1
+ DB $3F,0
+ DB $3F,0
+ DB $FC,0 ;D D2
+ DB $3F,0
+ DB $3F,0
+ DB $3F,0 ;D D3
+ DB $F,$C0
+ DB $F,$C0
+ DB $2A,0 ;MID0
+ DB $2A,0
+ DB $2A,0
+ DB $2A,0 ;MID1
+ DB $2A,0
+ DB $2A,0
+ DB $A4,0 ;MID2
+ DB $29,0
+ DB $29,0
+ DB $68,0 ;MID3
+ DB $1A,0
+ DB $1A,0
+ DB 5,$54,0 ;SK
+ DB $32,$22,$20 ;1K
+ DB $C2,$22,$20
+ DB $E,$22,$20
+ DB $E,$22,$20
+ DB $E,$22,$20 ;5K
+ DB $EA,$AC ;H D0
+ DB $EA,$AC
+ DB $EA,$AC
+ DB $EA,$AC ;H D1
+ DB $EA,$AC
+ DB $EA,$AC
+ DB $AE,$80 ;H D2
+ DB $AE,$80
+ DB $AE,$80
+ DB $A,$E8 ;H D3
+ DB $A,$E8
+ DB $A,$E8
+ DB $00,$00 ;S D0 S0
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00 ;Q D0 S0
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00 ;E D0 S0
+ DB $00,$00
+ DB $00,$00 ;T D0 S0
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $5A,$64 ;B D0
+ DB $5A,$64
+ DB $5A,$64
+ DB $66,$94 ;B D1
+ DB $66,$94
+ DB $66,$94
+ DB $96,$58 ;B D2
+ DB $96,$58
+ DB $96,$58
+ DB $96,$58 ;B D3
+ DB $96,$58
+ DB $96,$58
+ DB $00 ;MCSD0
+ DB $10 ;D5
+ DB $04 ;D6
+ DB $00 ;D7
+ DB $40 ;DD
+ DB $C9,$9C ;G,BEX0
+ DB $00,$00 ;G,BEX1
+ DB $00,$00 ;G,BEX2
+ DB $00,$00 ;G,BEX3
+ DB $00,$00 ;G,BEX4
+ DB $00,$00 ;G,BEX5
+ DB $00,$00 ;G,BEX6
+
+
+**** LINE 4
+ ORG STAMPS+$400
+
+ DB $15,$00 ;MC D0 S0
+ DB $15,$00
+ DB $15,$00
+ DB $15,$00 ;MC D1
+ DB $15,$00
+ DB $15,$00
+ DB $2A,$00 ;MC D2
+ DB $0A,$80
+ DB $2A,$00
+ DB $2A,$00 ;MC D3
+ DB $0A,$80
+ DB $2A,$00
+ DB $DA,$9C ;G D0
+ DB $DA,$9C
+ DB $DA,$9C
+ DB $AA,$00 ;MO D0
+ DB $A9,$00
+ DB $6A,$00
+ DB $2A,$80 ;MO D1
+ DB $2A,$80
+ DB $2A,$80
+ DB $28,0 ;MO D2
+ DB $28,0
+ DB $28,0
+ DB $28,0 ;MO D3
+ DB $28,0
+ DB $28,0
+ DB $15,$50 ;D D0
+ DB $15,$50
+ DB $15,$50
+ DB $5D,$40 ;D D1
+ DB $5D,$40
+ DB $5D,$40
+ DB $64,0 ;D D2
+ DB $25,0
+ DB $1,0
+ DB $19,0 ;D D3
+ DB $5,$80
+ DB $5,$40
+ DB $6A,$40 ;MID0
+ DB $2A,$40
+ DB $6A,0
+ DB $6A,$40 ;MID1
+ DB $6A,0
+ DB $2A,$40
+ DB $20,0 ;MID2
+ DB $5A,0
+ DB $6A,0
+ DB $20,0 ;MID3
+ DB $29,$40
+ DB $2A,$40
+ DB $F,$7C,0 ;SK
+ DB $FE,$AA,$A0 ;1K
+ DB $FE,$AA,$A0
+ DB $FE,$AA,$A0
+ DB $E,$AA,$A0
+ DB $FE,$AA,$A0 ;5K
+ DB $EA,$AC ;H D0
+ DB $EA,$AC
+ DB $EA,$AC
+ DB $EA,$AC ;H D1
+ DB $EA,$AC
+ DB $EA,$AC
+ DB $AE,$80 ;H D2
+ DB $AB,$B0
+ DB $BA,$B0
+ DB $A,$E8 ;H D3
+ DB $3A,$B8
+ DB $3B,$A8
+ DB $00,$00 ;S D0 S0
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00 ;Q D0 S0
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00 ;E D0 S0
+ DB $00,$00
+ DB $00,$00 ;T D0 S0
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $9A,$68 ;B D0
+ DB $9A,$68
+ DB $9A,$68
+ DB $AA,$A8 ;B D1
+ DB $AA,$A8
+ DB $AA,$A8
+ DB $66,$A8 ;B D2
+ DB $66,$A8
+ DB $66,$A8
+ DB $AA,$64 ;B D3
+ DB $AA,$64
+ DB $AA,$64
+ DB $00 ;MCSD0
+ DB $04 ;D5
+ DB $10 ;D6
+ DB $00 ;D7
+ DB $40 ;DD
+ DB $D6,$10 ;G,BEX0
+ DB $DA,$9C ;G,BEX1
+ DB $D2,$18 ;G,BEX2
+ DB $C2,$18 ;G,BEX3
+ DB $08,$08 ;G,BEX4
+ DB $02,$00 ;G,BEX5
+ DB $00,$00 ;G,BEX6
+
+
+**** LINE 5
+ ORG STAMPS+$500
+
+ DB $95,$80 ;MC D0 S0
+ DB $95,$80
+ DB $95,$80
+ DB $99,$80 ;MC D1
+ DB $99,$80
+ DB $99,$80
+ DB $19,$00 ;MC D2
+ DB $15,$00
+ DB $64,$00
+ DB $19,$00 ;MC D3
+ DB $01,$90
+ DB $05,$40
+ DB $D6,$5C ;G D0
+ DB $D6,$5C
+ DB $D6,$5C
+ DB $69,$00 ;MO D0
+ DB $69,$C0
+ DB $69,$00
+ DB $1A,$40 ;MO D1
+ DB $DA,$40
+ DB $1A,$40
+ DB $2A,0 ;MO D2
+ DB $2A,0
+ DB $2A,0
+ DB $A8,0 ;MO D3
+ DB $A8,0
+ DB $A8,0
+ DB $15,$50 ;D D0
+ DB $15,$50
+ DB $15,$50
+ DB $5D,$40 ;D D1
+ DB $5D,$40
+ DB $5D,$40
+ DB $64,0 ;D D2
+ DB $95,0
+ DB $16,0
+ DB $19,0 ;D D3
+ DB $5,$60
+ DB $9,$40
+ DB $6A,$40 ;MID0
+ DB $6A,$40
+ DB $6A,$40
+ DB $6A,$40 ;MID1
+ DB $6A,$40
+ DB $6A,$40
+ DB $98,0 ;MID2
+ DB $5A,0
+ DB $69,0
+ DB $98,0 ;MID3
+ DB $29,$40
+ DB $1A,$40
+ DB $11,$11,0 ;SK
+ DB 0,0,0 ;1K
+ DB 0,0,0
+ DB 0,0,0
+ DB 0,0,0
+ DB 0,0,0 ;5K
+ DB $EA,$AC ;H D0
+ DB $EA,$AC
+ DB $EA,$AC
+ DB $EA,$AC ;H D1
+ DB $EA,$AC
+ DB $EA,$AC
+ DB $AE,$80 ;H D2
+ DB $AA,$C0
+ DB $EA,$80
+ DB $A,$E8 ;H D3
+ DB $A,$AC
+ DB $E,$A8
+ DB $00,$00 ;S D0 S0
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00 ;Q D0 S0
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00 ;E D0 S0
+ DB $00,$00
+ DB $00,$00 ;T D0 S0
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $A6,$98 ;B D0
+ DB $A6,$98
+ DB $A6,$98
+ DB $96,$58 ;B D1
+ DB $96,$58
+ DB $96,$58
+ DB $9A,$58 ;B D2
+ DB $9A,$58
+ DB $9A,$58
+ DB $16,$98 ;B D3
+ DB $16,$98
+ DB $16,$98
+ DB $00 ;MCSD0
+ DB $04 ;D5
+ DB $10 ;D6
+ DB $00 ;D7
+ DB $40 ;DD
+ DB $25,$CC ;G,BEX0
+ DB $D4,$1C ;G,BEX1
+ DB $D0,$0C ;G,BEX2
+ DB $E0,$0C ;G,BEX3
+ DB $00,$00 ;G,BEX4
+ DB $00,$00 ;G,BEX5
+ DB $00,$00 ;G,BEX6
+
+
+**** LINE 6
+ ORG STAMPS+$600
+
+ DB $95,$80 ;MC D0 S0
+ DB $95,$80
+ DB $95,$80
+ DB $99,$80 ;MC D1
+ DB $99,$80
+ DB $99,$80
+ DB $19,$00 ;MC D2
+ DB $A5,$00
+ DB $6A,$00
+ DB $19,$00 ;MC D3
+ DB $0A,$90
+ DB $05,$A0
+ DB $F5,$7C ;G D0
+ DB $F5,$7C
+ DB $F5,$7C
+ DB $69,$C0 ;MO D0
+ DB $6B,$C0
+ DB $29,$00
+ DB $DA,$40 ;MO D1
+ DB $FA,$40
+ DB $1A,0
+ DB $2A,0 ;MO D2
+ DB $2A,0
+ DB $2A,0
+ DB $A8,0 ;MO D3
+ DB $A8,0
+ DB $A8,0
+ DB $15,$50 ;D D0
+ DB $15,$50
+ DB $15,$70
+ DB $5D,$40 ;D D1
+ DB $9D,$40
+ DB $5D,$40
+ DB $64,0 ;D D2
+ DB $95,$80
+ DB $16,$80
+ DB $19,0 ;D D3
+ DB $25,$60
+ DB $29,$40
+ DB $6A,$40 ;MID0
+ DB $6A,$40
+ DB $6A,$40
+ DB $6A,$40 ;MID1
+ DB $6A,$40
+ DB $6A,$40
+ DB $98,0 ;MID2
+ DB $6A,$40
+ DB $69,$40
+ DB $98,0 ;MID3
+ DB $6A,$40
+ DB $5A,$40
+ DB $51,$51,$40 ;SK
+ DB 0,0,0 ;1K
+ DB 0,0,0
+ DB 0,0,0
+ DB 0,0,0
+ DB 0,0,0 ;5K
+ DB $EA,$AC ;H D0
+ DB $EA,$AC
+ DB $EA,$AC
+ DB $EA,$AC ;H D1
+ DB $EA,$AC
+ DB $EA,$AC
+ DB $AE,$80 ;H D2
+ DB $AA,$80
+ DB $BA,$80
+ DB $A,$E8 ;H D3
+ DB $A,$B8
+ DB $A,$A8
+ DB $00,$00 ;S D0 S0
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00 ;Q D0 S0
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00 ;E D0 S0
+ DB $00,$00
+ DB $00,$00 ;T D0 S0
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $2A,$A0 ;B D0
+ DB $2A,$A0
+ DB $2A,$A0
+ DB $2A,$A0 ;B D1
+ DB $2A,$A0
+ DB $2A,$A0
+ DB $1A,$A0 ;B D2
+ DB $1A,$A0
+ DB $1A,$A0
+ DB $2A,$90 ;B D3
+ DB $2A,$90
+ DB $2A,$90
+ DB $00 ;MCSD0
+ DB $01 ;D5
+ DB $40 ;D6
+ DB $00 ;D7
+ DB $40 ;DD
+ DB $02,$8C ;G,BEX0
+ DB $E4,$6C ;G,BEX1
+ DB $E0,$2C ;G,BEX2
+ DB $C0,$2C ;G,BEX3
+ DB $80,$20 ;G,BEX4
+ DB $03,$08 ;G,BEX5
+ DB $00,$00 ;G,BEX6
+
+
+**** LINE 7
+ ORG STAMPS+$700
+
+ DB $95,$80 ;MC D0 S0
+ DB $15,$80
+ DB $95,$00
+ DB $99,$80 ;MC D1
+ DB $99,$80
+ DB $99,$80
+ DB $19,$00 ;MC D2
+ DB $95,$00
+ DB $54,$00
+ DB $19,$00 ;MC D3
+ DB $01,$50
+ DB $06,$60
+ DB $E9,$AC ;G D0
+ DB $C9,$AC
+ DB $E9,$8C
+ DB $AB,$C0 ;MO D0
+ DB $AA,$00
+ DB $AA,$C0
+ DB $FA,$80 ;MO D1
+ DB $2A,$40
+ DB $DA,$80
+ DB $38,0 ;MO D2
+ DB $2F,0
+ DB $F8,0
+ DB $2C,0 ;MO D3
+ DB $2F,0
+ DB $F8,0
+ DB $15,$70 ;D D0
+ DB $D5,$70
+ DB $15,$40
+ DB $9D,$40 ;D D1
+ DB $1D,$40
+ DB $9F,$40
+ DB $67,0 ;D D2
+ DB $15,$F0
+ DB $D5,0
+ DB $D9,0 ;D D3
+ DB $F5,$40
+ DB $5,$70
+ DB $2A,0 ;MID0
+ DB $AA,0
+ DB $2A,$80
+ DB $2A,0 ;MID1
+ DB $2A,$80
+ DB $AA,0
+ DB $98,0 ;MID2
+ DB $2A,$40
+ DB $69,$40
+ DB $98,0 ;MID3
+ DB $6A,0
+ DB $5A,$40
+ DB 4,$44,$00 ;SK
+ DB 0,0,0 ;1K
+ DB 0,0,0
+ DB 0,0,0
+ DB 0,0,0
+ DB 0,0,0 ;5K
+ DB $EA,$AC ;H D0
+ DB $EA,$AC
+ DB $EA,$AC
+ DB $EA,$AC ;H D1
+ DB $EA,$AC
+ DB $EA,$AC
+ DB $AF,$80 ;H D2
+ DB $AA,$80
+ DB $AA,$80
+ DB $B,$E8 ;H D3
+ DB $A,$A8
+ DB $A,$A8
+ DB $00,$00 ;S D0 S0
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00 ;Q D0 S0
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00 ;E D0 S0
+ DB $00,$00
+ DB $00,$00 ;T D0 S0
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $0A,$80 ;B D0
+ DB $0A,$80
+ DB $0A,$80
+ DB $0A,$80 ;B D1
+ DB $0A,$80
+ DB $0A,$80
+ DB $0A,$A0 ;B D2
+ DB $0A,$A0
+ DB $0A,$A0
+ DB $2A,$80 ;B D3
+ DB $2A,$80
+ DB $2A,$80
+ DB $00 ;MCSD0
+ DB $01 ;D5
+ DB $40 ;D6
+ DB $00 ;D7
+ DB $40 ;DD
+ DB $C8,$80 ;G,BEX0
+ DB $C0,$8C ;G,BEX1
+ DB $C8,$8C ;G,BEX2
+ DB $C8,$8C ;G,BEX3
+ DB $00,$00 ;G,BEX4
+ DB $00,$00 ;G,BEX5
+ DB $00,$08 ;G,BEX6
+
+
+**** LINE 8
+ ORG STAMPS+$800
+
+ DB $95,$80 ;MC D0 S0
+ DB $15,$80
+ DB $95,$C0
+ DB $95,$80 ;MC D1
+ DB $15,$80
+ DB $95,$00
+ DB $15,$00 ;MC D2
+ DB $15,$80
+ DB $56,$00
+ DB $15,$00 ;MC D3
+ DB $09,$50
+ DB $25,$40
+ DB $CA,$8C ;G D0
+ DB $0A,$8C
+ DB $CA,$80
+ DB $AA,$0 ;MO D0
+ DB $AA,$0
+ DB $AA,$C0
+ DB $2A,$80 ;MO D1
+ DB $2A,$80
+ DB $FA,$80
+ DB $38,0 ;MO D2
+ DB $2F,0
+ DB $F8,0
+ DB $2C,0 ;MO D3
+ DB $2F,0
+ DB $F8,0
+ DB $C5,$40 ;D D0
+ DB $F5,$40
+ DB $CD,$40
+ DB $17,$30 ;D D1
+ DB $17,$30
+ DB $17,$70
+ DB $DF,0 ;D D2
+ DB $15,$70
+ DB $D5,$40
+ DB $F7,0 ;D D3
+ DB $D5,$40
+ DB $15,$70
+ DB $22,0 ;MID0
+ DB $52,0
+ DB $21,$40
+ DB $22,0 ;MID1
+ DB $21,$40
+ DB $52,0
+ DB $20,0 ;MID2
+ DB $22,0
+ DB $22,0
+ DB $20,0 ;MID3
+ DB $22,0
+ DB $22,0
+ DB 1,$10,0 ;SK
+ DB 0,0,0 ;1K
+ DB 0,0,0
+ DB 0,0,0
+ DB 0,0,0
+ DB 0,0,0 ;5K
+ DB $EA,$AC ;H D0
+ DB $EA,$AC
+ DB $EA,$AC
+ DB $FA,$BC ;H D1
+ DB $FA,$BC
+ DB $FA,$BC
+ DB $AA,$80 ;H D2
+ DB $AA,$80
+ DB $AA,$80
+ DB $A,$A8 ;H D3
+ DB $A,$A8
+ DB $A,$A8
+ DB $00,$00 ;S D0 S0
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00 ;Q D0 S0
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00 ;E D0 S0
+ DB $00,$00
+ DB $00,$00 ;T D0 S0
+ DB $00,0
+ DB $00,$00
+ DB $00,$00
+ DB $0F,$C0 ;B D0
+ DB $0F,$C0
+ DB $0F,$C0
+ DB $0F,$C0 ;B D1
+ DB $0F,$C0
+ DB $0F,$C0
+ DB $03,$00 ;B D2
+ DB $03,$00
+ DB $03,$00
+ DB $03,$00 ;B D3
+ DB $03,$00
+ DB $03,$00
+ DB $00 ;MCSD0
+ DB $00 ;D5
+ DB $00 ;D6
+ DB $00 ;D7
+ DB $00 ;DD
+ DB $08,$00 ;G,BEX0
+ DB $CA,$8C ;G,BEX1
+ DB $C8,$0C ;G,BEX2
+ DB $C8,$08 ;G,BEX3
+ DB $00,$00 ;G,BEX4
+ DB $00,$00 ;G,BEX5
+ DB $00,$00 ;G,BEX6
+
+
+**** LINE 9
+ ORG STAMPS+$900
+
+ DB $11,$00 ;MC D0 S0
+ DB $11,$00
+ DB $11,$00
+ DB $11,$00 ;MC D1
+ DB $11,$00
+ DB $11,$00
+ DB $28,$00 ;MC D2
+ DB $28,$80
+ DB $A2,$00
+ DB $0A,$00 ;MC D3
+ DB $08,$A0
+ DB $22,$80
+ DB $0A,$80 ;G D0
+ DB $0A,$80
+ DB $0A,$80
+ DB $14,$00 ;MO D0
+ DB $14,0
+ DB $14,$00
+ DB 5,0 ;MO D1
+ DB 5,0
+ DB 5,0
+ DB $28,0 ;MO D2
+ DB $2A,0
+ DB $2A,0
+ DB $28,0 ;MO D3
+ DB $A8,0
+ DB $A8,0
+ DB $F4,$40 ;D D0
+ DB $F4,$40
+ DB $FC,$40
+ DB $13,$F0 ;D D1
+ DB $13,$F0
+ DB $13,$F0
+ DB $DF,0 ;D D2
+ DB $1F,$70
+ DB $DF,$40
+ DB $F7,0 ;D D3
+ DB $DF,$40
+ DB $1F,$70
+ DB $51,$40 ;MID0
+ DB $51,$40
+ DB $51,$40
+ DB $51,$40 ;MID1
+ DB $51,$40
+ DB $51,$40
+ DB $14,0 ;MID2
+ DB $10,$40
+ DB $11,$40
+ DB $50,0 ;MID3
+ DB $41,0
+ DB $51,0
+ DB 5,$14,0 ;SK
+ DB 0,0,0 ;1K
+ DB 0,0,0
+ DB 0,0,0
+ DB 0,0,0
+ DB 0,0,0 ;5K
+ DB $C4,$4C ;H D0
+ DB $C4,$4C
+ DB $C4,$4C
+ DB $C4,$4C ;H D1
+ DB $C4,$4C
+ DB $C4,$4C
+ DB 4,0 ;H D2
+ DB $15,0
+ DB 5,0
+ DB 0,$40 ;H D3
+ DB 1,$40
+ DB 1,$50
+ DB $00,$00 ;S D0 S0
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00 ;Q D0 S0
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00 ;E D0 S0
+ DB $00,$00
+ DB $00,$00 ;T D0 S0
+ DB $00,$00
+ DB $00,$00
+ DB $00,$00
+ DB $33,$30 ;B D0
+ DB $33,$30
+ DB $33,$30
+ DB $33,$30 ;B D1
+ DB $33,$30
+ DB $33,$30
+ DB $03,$F0 ;B D2
+ DB $03,$F0
+ DB $03,$F0
+ DB $3F,$00 ;B D3
+ DB $3F,$00
+ DB $3F,$00
+ DB $00 ;MCSD0
+ DB $00 ;D5
+ DB $00 ;D6
+ DB $00 ;D7
+ DB $00 ;DD
+ DB $08,$80 ;G,BEX0
+ DB $08,$80 ;G,BEX1
+ DB $08,$80 ;G,BEX2
+ DB $00,$80 ;G,BEX3
+ DB $00,$80 ;G,BEX4
+ DB $20,$00 ;G,BEX5
+ DB $80,$00 ;G,BEX6
+
+
+**** LINE A
+ ORG STAMPS+$A00
+
+ DB $11,$0 ;MC D0 S0
+ DB $11,$40
+ DB $51,$0
+ DB $11,$0 ;MC D1
+ DB $11,$40
+ DB $51,$0
+ DB $15,$0 ;MC D2
+ DB $14,$50
+ DB $51,$50
+ DB $15,$0 ;MC D3
+ DB $14,$50 ;TEMP TRY
+ DB $51,$40
+ DB $08,$80 ;G D0
+ DB $08,$F0
+ DB $3C,$80
+ DB $14,$0 ;MO D0
+ DB $54,0
+ DB $15,00
+ DB 5,0 ;MO D1
+ DB 5,$40
+ DB $15,0
+ DB $04,0 ;MO D2
+ DB $11,0
+ DB $11,0
+ DB $10,0 ;MO D3
+ DB $44,0
+ DB $44,0
+ DB $F4,$40 ;D D0
+ DB $04,$50
+ DB $FC,$40
+ DB $13,$F0 ;D D1
+ DB $13,$F0
+ DB $51,0
+ DB $DF,0 ;D D2
+ DB $1F,$70
+ DB $DF,$40
+ DB $F7,0 ;D D3
+ DB $DF,$40
+ DB $1F,$70
+ DB $51,$40 ;MID0
+ DB 1,$40
+ DB $50,0
+ DB $51,$40 ;MID1
+ DB $50,0
+ DB 1,$40
+ DB $14,0 ;MID2
+ DB $10,$40
+ DB $11,$40
+ DB $50,0 ;MID3
+ DB $41,0
+ DB $51,0
+ DB 0,0,0 ;SK
+ DB 0,0,0 ;1K
+ DB 0,0,0
+ DB 0,0,0
+ DB 0,0,0
+ DB 0,0,0 ;5K
+ DB 4,$40 ;H D0
+ DB $14,$40
+ DB 4,$50
+ DB 4,$40 ;H D1
+ DB $14,$40
+ DB 4,$50
+ DB 4,0 ;H D2
+ DB $11,0
+ DB $11,0
+ DB 0,$40 ;H D3
+ DB 1,$10
+ DB 1,$10
+ DB $00,$0 ;S D0 S0
+ DB $00,$0
+ DB $00,$0
+ DB $00,$0
+ DB $00,$0
+ DB $00,$0
+ DB $00,$0
+ DB $00,$0
+ DB $00,$0 ;Q D0 S0
+ DB $00,$0
+ DB $00,$0
+ DB $00,$0
+ DB $00,$0
+ DB $00,$0
+ DB $00,$0
+ DB $00,$0
+ DB $00,$0 ;E D0 S0
+ DB $00,$0
+ DB $00,$0 ;T D0 S0
+ DB $00,$0
+ DB $00,$0
+ DB $00,$0
+ DB $03,$0 ;B D0
+ DB $03,$C0
+ DB $0F,$0
+ DB $03,$0 ;B D1
+ DB $03,$C0
+ DB $0F,$0
+ DB $03,$0 ;B D2
+ DB $0B,$0
+ DB $0F,$0
+ DB $03,$0 ;B D3
+ DB $03,$C0
+ DB $03,$80
+ DB $00 ;MCSD0
+ DB $00 ;D5
+ DB $00 ;D6
+ DB $00 ;D7
+ DB $00 ;DD
+ DB $3C,$F0 ;G,BEX0
+ DB $08,$80 ;G,BEX1
+ DB $08,$80 ;G,BEX2
+ DB $08,$00 ;G,BEX3
+ DB $00,$00 ;G,BEX4
+ DB $00,$80 ;G,BEX5
+ DB $00,$00 ;G,BEX6
+
+
+**** LINE B
+ ORG STAMPS+$B00
+
+ DB $51,$40 ;MC D0 S0
+ DB $10,$0
+ DB $01,$0
+ DB $51,$40 ;MC D1
+ DB $10,$0
+ DB $01,$0
+ DB $15,$40 ;MC D2
+ DB $14,$50
+ DB $51,$50
+ DB $15,$0 ;MC D3
+ DB $14,$50 ;TEMP TRY
+ DB $51,$40
+ DB $3C,$F0 ;G D0
+ DB $3C,$0
+ DB $00,$80
+ DB $55,$00 ;MO D0
+ DB 4,0
+ DB $10,0
+ DB $15,$40 ;MO D1
+ DB 4,0
+ DB 1,0
+ DB $04,0 ;MO D2
+ DB $11,0
+ DB $11,0
+ DB $10,0 ;MO D3
+ DB $44,0
+ DB $44,0
+ DB $14,$50 ;D D0
+ DB $04,0
+ DB $00,$40
+ DB $51,$40 ;D D1
+ DB $10,0
+ DB $01,0
+ DB $28,0 ;D D2
+ DB $28,$A0
+ DB $28,$A0
+ DB $28,0 ;D D3
+ DB $A2,$80
+ DB $A2,$80
+ DB 0,0 ;MID0
+ DB 0,0
+ DB 0,0
+ DB 0,0 ;MID1
+ DB 0,0
+ DB 0,0
+ DB 0,0 ;MID2
+ DB 0,0
+ DB 0,0
+ DB 0,0 ;MID3
+ DB $0,0
+ DB $0,0
+ DB 0,0,0 ;SK
+ DB 0,0,0 ;1K
+ DB 0,0,0
+ DB 0,0,0
+ DB 0,0,0
+ DB 0,0,0 ;5K
+ DB $04,$40 ;H D0
+ DB $14,$40
+ DB 4,$50
+ DB 4,$40 ;H D1
+ DB $14,$40
+ DB 4,$50
+ DB 4,0 ;H D2
+ DB $40,$44
+ DB $40,$44
+ DB 0,$40 ;H D3
+ DB $44,4
+ DB $44,4
+ DB $00,$0 ;S D0 S0
+ DB $00,$0
+ DB $00,$0
+ DB $00,$0
+ DB $00,$0
+ DB $00,$0
+ DB $00,$0
+ DB $00,$0
+ DB $00,$0 ;Q D0 S0
+ DB $00,$0
+ DB $00,$0
+ DB $00,$0
+ DB $00,$0
+ DB $00,$0
+ DB $00,$0
+ DB $00,$0
+ DB $00,$0 ;E D0 S0
+ DB $00,$0
+ DB $00,$0 ;T D0 S0
+ DB $00,$0
+ DB $00,$0
+ DB $00,$0
+ DB $0C,$0 ;B D0
+ DB $0C,$0
+ DB $00,$C0
+ DB $0C,$0 ;B D1
+ DB $0C,$0
+ DB $00,$C0
+ DB $03,$C0 ;B D2
+ DB $08,$F0
+ DB $0C,$E0
+ DB $0F,$0 ;B D3
+ DB $2C,$C0
+ DB $3C,$80
+ DB $00 ;MCSD0
+ DB $00 ;D5
+ DB $00 ;D6
+ DB $00 ;D7
+ DB $00 ;DD
+ DB $00,$00 ;G,BEX0
+ DB $3C,$F0 ;G,BEX1
+ DB $2C,$E0 ;G,BEX2
+ DB $20,$20 ;G,BEX3
+ DB $20,$20 ;G,BEX4
+ DB $00,$00 ;G,BEX5
+ DB $00,$00 ;G,BEX6
+
+
+**** LINE C
+ ORG STAMPS+$C00
+
+ DB $00,$0 ;MC D0 S0
+ DB $50,$0
+ DB $01,$40
+ DB $00,$0 ;MC D1
+ DB $50,$0
+ DB $01,$40
+ DB $00,$0 ;MC D2
+ DB $00,$0
+ DB $00,$0
+ DB $00,$0 ;MC D3
+ DB $00,$0
+ DB $00,$0
+ DB $00,$0 ;G D0
+ DB $00,$0
+ DB $00,$F0
+ DB $0,0 ;MO D0
+ DB 4,$0
+ DB $10,$0
+ DB 0,0 ;MO D1
+ DB 4,0
+ DB 1,0
+ DB 0,0 ;MO D2
+ DB 0,0
+ DB 0,0
+ DB 0,0 ;MO D3
+ DB 0,0
+ DB 0,0
+ DB $00,$00 ;D D0
+ DB $14,$0
+ DB $0,$C0
+ DB $00,$00 ;D D1
+ DB $10,$0
+ DB $01,$0
+ DB 0,0 ;D D2
+ DB $0,0
+ DB $0,0
+ DB 0,0 ;D D3
+ DB $0,0
+ DB $0,0
+ DB $0,0 ;MID0
+ DB $0,0
+ DB $0,0
+ DB $0,0 ;MID1
+ DB $0,0
+ DB $0,0
+ DB 0,0 ;MID2
+ DB $0,0
+ DB $0,0
+ DB 0,0 ;MID3
+ DB $0,0
+ DB $0,0
+ DB 0,0,0 ;SK
+ DB 0,0,0 ;1K
+ DB 0,0,0
+ DB 0,0,0
+ DB 0,0,0
+ DB 0,0,0 ;5K
+ DB $14,$50 ;H D0
+ DB 0,$40
+ DB 4,0
+ DB $14,$50 ;H D1
+ DB 0,$40
+ DB 4,0
+ DB 5,0 ;H D2
+ DB $40,$50
+ DB $40,$50
+ DB 1,$40 ;H D3
+ DB $14,4
+ DB $14,4
+ DB $00,$0 ;S D0 S0
+ DB $00,$0
+ DB $00,$0
+ DB $00,$0
+ DB $00,$0
+ DB $00,$0
+ DB $00,$0
+ DB $00,$0
+ DB $00,$0 ;Q D0 S0
+ DB $00,$0
+ DB $00,$0
+ DB $00,$0
+ DB $00,$0
+ DB $00,$0
+ DB $00,$0
+ DB $00,$0
+ DB $00,$0 ;E D0 S0
+ DB $00,$0
+ DB $00,$0 ;T D0 S0
+ DB $00,$0
+ DB $00,$0
+ DB $00,$0
+ DB $00,$0 ;B D0
+ DB $0C,$0
+ DB $00,$C0
+ DB $00,$0 ;B D1
+ DB $0C,$0
+ DB $00,$C0
+ DB $00,$0 ;B D2
+ DB $00,$0
+ DB $00,$0
+ DB $00,$0 ;B D3
+ DB $00,$0
+ DB $00,$0
+ DB $00 ;MCSD0
+ DB $00 ;D5
+ DB $00 ;D6
+ DB $00 ;D7
+ DB $00 ;DD
+ DB $00,$00 ;G,BEX0
+ DB $00,$00 ;G,BEX1
+ DB $00,$00 ;G,BEX2
+ DB $00,$00 ;G,BEX3
+ DB $00,$00 ;G,BEX4
+ DB $00,$00 ;G,BEX5
+ DB $00,$00 ;G,BEX6
+
+
+**** LINE D
+ ORG STAMPS+$D00
+
+ DB 0,0 ;MC D0 S0
+ DB 0,0
+ DB 0,0
+ DB 0,0 ;MC D1
+ DB 0,0
+ DB 0,0
+ DB 0,0 ;MC D2
+ DB 0,0
+ DB 0,0
+ DB 0,0 ;MC D3
+ DB 0,0
+ DB 0,0
+ DB 0,0 ;G D0
+ DB 0,0
+ DB 0,0
+ DB 0,0 ;MO D0
+ DB 0,0
+ DB 0,0
+ DB 0,0 ;MO D1
+ DB 0,0
+ DB 0,0
+ DB 0,0 ;MO D2
+ DB 0,0
+ DB 0,0
+ DB 0,0 ;MO D3
+ DB 0,0
+ DB 0,0
+ DB 0,0 ;D D0
+ DB 0,0
+ DB 0,0
+ DB 0,0 ;D D1
+ DB 0,0
+ DB 0,0
+ DB 0,0 ;D D2
+ DB $0,0
+ DB $0,0
+ DB 0,0 ;D D3
+ DB $0,0
+ DB $0,0
+ DB $0,0 ;MID0
+ DB $0,0
+ DB $0,0
+ DB $0,0 ;MID1
+ DB $0,0
+ DB $0,0
+ DB 0,0 ;MID2
+ DB $0,0
+ DB $0,0
+ DB 0,0 ;MID3
+ DB 0,0
+ DB $0,0
+ DB 0,0,0 ;SK
+ DB 0,0,0 ;1K
+ DB 0,0,0
+ DB 0,0,0
+ DB 0,0,0
+ DB 0,0,0 ;5K
+ DB $14,$50 ;H D0
+ DB 0,$50
+ DB $14,0
+ DB $14,$50 ;H D1
+ DB 0,$50
+ DB $14,0
+ DB 5,0 ;H D2
+ DB $50,0
+ DB $50,0
+ DB 1,$40 ;H D3
+ DB 0,$14
+ DB 0,$14
+ DB 0,0 ;S D0 S0
+ DB 0,0
+ DB 0,0
+ DB 0,0
+ DB 0,0
+ DB 0,0
+ DB 0,0
+ DB 0,0
+ DB 0,0 ;Q D0 S0
+ DB 0,0
+ DB 0,0
+ DB 0,0
+ DB 0,0
+ DB 0,0
+ DB 0,0
+ DB 0,0
+ DB 0,0 ;E D0 S0
+ DB 0,0
+ DB 0,0 ;T D0 S0
+ DB 0,0
+ DB 0,0
+ DB 0,0
+ DB 0,0 ;B D0
+ DB 0,0
+ DB 0,0
+ DB 0,0 ;B D1
+ DB 0,0
+ DB 0,0
+ DB 0,0 ;B D2
+ DB 0,0
+ DB 0,0
+ DB 0,0 ;B D3
+ DB 0,0
+ DB 0,0
+ DB $00 ;MCSD0
+ DB $00 ;D5
+ DB $00 ;D6
+ DB $00 ;D7
+ DB $00 ;DD
+ DB $00,$00 ;G,BEX0
+ DB $00,$00 ;G,BEX1
+ DB $00,$00 ;G,BEX2
+ DB $00,$00 ;G,BEX3
+ DB $00,$00 ;G,BEX4
+ DB $00,$00 ;G,BEX5
+ DB $00,$00 ;G,BEX6
+
+
+**** LINE E
+ ORG STAMPS+$E00
+
+ DB 0,0 ;MC D0 S0
+ DB 0,0
+ DB 0,0
+ DB 0,0 ;MC D1
+ DB 0,0
+ DB 0,0
+ DB 0,0 ;MC D2
+ DB 0,0
+ DB 0,0
+ DB 0,0 ;MC D3
+ DB 0,0
+ DB 0,0
+ DB 0,0 ;G D0
+ DB 0,0
+ DB 0,0
+ DB 0,0 ;MO D0
+ DB 0,0
+ DB 0,0
+ DB 0,0 ;MO D1
+ DB 0,0
+ DB 0,0
+ DB 0,0 ;MO D2
+ DB 0,0
+ DB 0,0
+ DB 0,0 ;MO D3
+ DB 0,0
+ DB 0,0
+ DB 0,0 ;D D0
+ DB 0,0
+ DB 0,0
+ DB 0,0 ;D D1
+ DB 0,0
+ DB 0,0
+ DB 0,0 ;D D2
+ DB $0,0
+ DB $0,0
+ DB 0,0 ;D D3
+ DB $0,0
+ DB $0,0
+ DB $0,0 ;MID0
+ DB $0,0
+ DB $0,0
+ DB $0,0 ;MID1
+ DB $0,0
+ DB $0,0
+ DB 0,0 ;MID2
+ DB $0,0
+ DB $0,0
+ DB 0,0 ;MID3
+ DB $0,0
+ DB $0,0
+ DB 0,0,0 ;SK
+ DB 0,0,0 ;1K
+ DB 0,0,0
+ DB 0,0,0
+ DB 0,0,0
+ DB 0,0,0 ;5K
+ DB 0,0 ;H D0
+ DB 0,$50
+ DB $14,0
+ DB 0,0 ;H D1
+ DB 0,$50
+ DB $14,0
+ DB 0,0 ;H D2
+ DB 0,0
+ DB 0,0
+ DB 0,0 ;H D3
+ DB 0,0
+ DB 0,0
+ DB 0,0 ;S D0 S0
+ DB 0,0
+ DB 0,0
+ DB 0,0
+ DB 0,0
+ DB 0,0
+ DB 0,0
+ DB 0,0
+ DB 0,0 ;Q D0 S0
+ DB 0,0
+ DB 0,0
+ DB 0,0
+ DB 0,0
+ DB 0,0
+ DB 0,0
+ DB 0,0
+ DB 0,0 ;E D0 S0
+ DB 0,0
+ DB 0,0 ;T D0 S0
+ DB 0,0
+ DB 0,0
+ DB 0,0
+ DB 0,0 ;B D0
+ DB 0,0
+ DB 0,0
+ DB 0,0 ;B D1
+ DB 0,0
+ DB 0,0
+ DB 0,0 ;B D2
+ DB 0,0
+ DB 0,0
+ DB 0,0 ;B D3
+ DB 0,0
+ DB 0,0
+ DB $00 ;MCSD0
+ DB $00 ;D5
+ DB $00 ;D6
+ DB $00 ;D7
+ DB $00 ;DD
+ DB $00,$00 ;G,BEX0
+ DB $00,$00 ;G,BEX1
+ DB $00,$00 ;G,BEX2
+ DB $00,$00 ;G,BEX3
+ DB $00,$00 ;G,BEX4
+ DB $00,$00 ;G,BEX5
+ DB $00,$00 ;G,BEX6
+
+
+**** LINE F
+ ORG STAMPS+$F00
+
+ DB 0,0 ;MC D0 S0
+ DB 0,0
+ DB 0,0
+ DB 0,0 ;MC D1
+ DB 0,0
+ DB 0,0
+ DB 0,0 ;MC D2
+ DB 0,0
+ DB 0,0
+ DB 0,0 ;MC D3
+ DB 0,0
+ DB 0,0
+ DB 0,0 ;G D0
+ DB 0,0
+ DB 0,0
+ DB 0,0 ;MO D0
+ DB 0,0
+ DB 0,0
+ DB 0,0 ;MO D1
+ DB 0,0
+ DB 0,0
+ DB 0,0 ;MO D2
+ DB 0,0
+ DB 0,0
+ DB 0,0 ;MO D3
+ DB 0,0
+ DB 0,0
+ DB 0,0 ;D D0
+ DB 0,0
+ DB 0,0
+ DB 0,0 ;D D1
+ DB 0,0
+ DB 0,0
+ DB 0,0 ;D D2
+ DB $0,0
+ DB $0,0
+ DB 0,0 ;D D3
+ DB $0,0
+ DB $0,0
+ DB $0,0 ;MID0
+ DB $0,0
+ DB $0,0
+ DB $0,0 ;MID1
+ DB $0,0
+ DB $0,0
+ DB 0,0 ;MID2
+ DB $0,0
+ DB $0,0
+ DB 0,0 ;MID3
+ DB $0,0
+ DB $0,0
+ DB 0,0,0 ;SK
+ DB 0,0,0 ;1K
+ DB 0,0,0
+ DB 0,0,0
+ DB 0,0,0
+ DB 0,0,0 ;5K
+ DB 0,0 ;H D0
+ DB 0,0
+ DB 0,0
+ DB 0,0 ;H D1
+ DB 0,0
+ DB 0,0
+ DB 0,0 ;H D2
+ DB 0,0
+ DB 0,0
+ DB 0,0 ;H D3
+ DB 0,0
+ DB 0,0
+ DB 0,0 ;S D0 S0
+ DB 0,0
+ DB 0,0
+ DB 0,0
+ DB 0,0
+ DB 0,0
+ DB 0,0
+ DB 0,0
+ DB 0,0 ;Q D0 S0
+ DB 0,0
+ DB 0,0
+ DB 0,0
+ DB 0,0
+ DB 0,0
+ DB 0,0
+ DB 0,0
+ DB 0,0 ;E D0 S0
+ DB 0,0
+ DB 0,0 ;T D0 S0
+ DB 0,0
+ DB 0,0
+ DB 0,0
+ DB 0,0 ;B D0
+ DB 0,0
+ DB 0,0
+ DB 0,0 ;B D1
+ DB 0,0
+ DB 0,0
+ DB 0,0 ;B D2
+ DB 0,0
+ DB 0,0
+ DB 0,0 ;B D3
+ DB 0,0
+ DB 0,0
+ DB $00 ;MCSD0
+ DB $00 ;D5
+ DB $00 ;D6
+ DB $00 ;D7
+ DB $00 ;DD
+
+****** END OF STAMP DATA ********
+ ;THE
+ END
diff --git a/RSUBR.S82 b/RSUBR.S82
new file mode 100644
index 0000000..a9563fe
--- /dev/null
+++ b/RSUBR.S82
@@ -0,0 +1,1328 @@
+******************************************************
+******************************************************
+*
+*
+* ROBOTRON 6-JULY-83
+* 5-AUGUST-83 2:40
+* 24-AUGUST-83 9:15
+*
+*
+* RSUBR.S - ROBOTRON SUBROUTINES
+*
+******************************************************
+
+
+
+******************************************
+******************************************
+* *
+* SPECIFIC OBJECT MOVE ROUTINES *
+* *
+* *
+* ALL MUST END WITH A JMP OBJCONT *
+* *
+******************************************
+
+*******************
+*
+* USAGE OF OBJECT DATA TABLES
+* - STANDARD ENTRIES FOR ALL OBJECTS
+* ( FOR THE OTHER ENTRIES, SEE INDIVIDUAL MOVE ROUTINES )
+*
+* XTBL - X POSITION
+* YTBL - Y POSITION
+* XEXTBL - X EXTENT (ABSOLUTE)
+* YEXTBL - Y EXTENT (ABSOLUTE)
+* MTTBL - NUMBER OF FRAMES UNTIL NEXT MOVE
+* DLPHTBL - DISPLAY LIST HIGH BYTE POINTER
+* DLPLTBL - DISPLAY LIST LOW BYTE POINTER
+* DL2PTBL - OFFSET BETWEEN 2 DISPLAY LIST ENTRIES, 0 IF IN 1 ZONE
+* STTBL - USED BY UNLOADER, LOWER 2 BITS ARE COMMAND TO UNLOADER:
+* LOWER 2 BITS OF STTBL MEANING
+* 00 - CREATURE IS DEAD AND GONE - UNLOAD IT PERMANENTLY
+* ( CREATURE CURRENTLY IS IN DL - REMOVE IT FOREVER )
+* 01 - CREATURE IS ALIVE AND MOVING - DO NORMAL LOAD/UNLOAD
+* WITH COMPLETE ZONE-CROSSING CHECKING
+* 10 - CREATURE IS NEW - IT DOES NOT EXIST IN DL AND
+* MUST BE ADDED (IN 1 OR 2 ZONES)
+* 11 - CREATURE IS IN THE PROCESS OF DYING - IT DOES NOT MOVE
+* SO IT IS SAFE TO ASSUME THAT IT DOES NOT CROSS ZONES.
+* THIS COMMAND MEANS TO LOOK UP NEW STAMP, PALETTE AND
+* WIDTH DATA, BUT NOT TO CHECK FOR ZONE CROSSINGS.
+* THE INTEND VARIABLES ARE NOT SET, SO TAKE ALL DATA
+* NECESSARY FROM THE OBJECT DATA TABLES. THIS WILL
+* PROBABLY BE A SIMPLE CALL TO GETSTAMP...
+*
+*******************
+
+******************************************
+*
+* GMOV -- MOVE GRUNTS
+*
+******************************************
+*
+* USE OF OBJECT DATA TABLE ENTRIES:
+*
+* DXTBL - 0
+* DYTBL - UNUSED
+* DTTBL - UNUSED
+* SATBL - STEP - 0,1,2,3 OR 4 - 9 FOR DYING
+* MISCTBL - UNUSED
+* CRTBL - 1
+*
+***********
+*
+GMOV
+ LDA STTBL,X ;LOAD THIS GRUNT'S CURRENT STATUS
+ AND #$03
+ BNE GMOV01 ;WILL BE 0 IF GRUNT IS DEAD AND GONE
+ LDA #NULLCODE ;STTBL IS 0, SO NULL OUT CRTBL
+ STA CRTBL,X
+ JMP OBJCONT ;NEVER WORRY ABOUT THIS GRUNT ANYMORE
+
+GMOV01 AND #00000010B ;GET ONLY BIT 1 - 'DYING' FLAG
+ BNE GDYING ;GRUNT IS DYING - DON'T MOVE
+* GRUNT IS ALIVE AND WELL
+ LDA XTBL,X ;LOAD GRUNT X POSITION
+ CMP MCXPOS
+ BCS GMOV1 ;BRANCH IF GREATER THAN
+ ADC #GSTEPX ;MOVE GRUNT RIGHT
+ STA XINTEND ;THIS IS WHERE THE GRUNT WANTS TO BE
+ LDA XEXTBL,X ;GET X EXTENT
+ CLC
+ ADC #GSTEPX ;MOVE THE OTHER EDGE OF IT
+ STA XXINTEND ;STORE FOR LOADER
+ JMP GMOV2
+GMOV1 SBC #GSTEPX ;MOVE GRUNT LEFT (CARRY SET FROM BCS)
+ STA XINTEND ;WHERE THE GRUNT WANTS TO BE
+ LDA XEXTBL,X ;GET X EXTENT
+ SEC ;JUST IN CASE
+ SBC #GSTEPX ;MOVE THE OTHER EDGE OF IT
+ STA XXINTEND ;STORE FOR LOADER
+GMOV2 LDA YTBL,X ;LOAD GRUNT Y POSITION
+ CMP MCYPOS
+ BCS GMOV3 ;BRANCH ON GREATER THAN
+ ADC #GSTEPY ;MOVE GRUNT DOWN
+ STA YINTEND ;THIS IS WHERE THE GRUNT WANTS TO BE
+ LDA YEXTBL,X ;GET Y EXTENT
+ CLC
+ ADC #GSTEPY ;MOVE THE OTHER EDGE OF IT
+ STA YXINTEND ;STORE FOR LOADER
+ JMP GMOV4
+GMOV3 SBC #GSTEPY ;MOVE GRUNT UP
+ STA YINTEND ;WHERE THE GRUNT WANTS TO BE
+ LDA YEXTBL,X ;GET Y EXTENT
+ SEC ;JUST IN CASE
+ SBC #GSTEPY ;MOVE THE OTHER EDGE OF IT
+ STA YXINTEND
+GMOV4 JSR CHKINTBD ;CHECK IF OFFSCREEN
+ LDA GSPEED
+ STA MTTBL,X ;RESET # OF FRAMES UNTIL NEXT MOVE
+
+* MAYBE CHECK TABLE OF ELECTRODES FOR COLLISION *********
+
+* CHANGE ANIMATION STEP
+ DEC SATBL,X ;GET CURRENT STEP IN ANIMATION
+ BPL GMOV5 ;OK IF NONEGATIVE
+ LDA #$03 ;HIGHEST GRUNT ANIMATION STEP
+ STA SATBL,X ;NEW ANIMATION STEP
+ JMP GMOV5 ;OK, NOW TRY TO LOAD THIS GRUNT
+
+GDYING ;GRUNT IS DYING - DON'T MOVE IT, USE DIFFERENT ANIMATION
+ LDA SATBL,X ;GET CURRENT ANIM STEP
+ CMP #$04 ;WILL BE >=4 IF GRUNT HAS BEEN DYING
+ BPL GDYING1
+* THIS GRUNT JUST DIED SINCE ITS LAST MOVE
+* START GRUNT DEATH SOUND
+ LDA #SCREDIE
+ JSR DOTUNE
+
+ LDA #$00
+ STA DXTBL,X ;DYING DIR MUST BE 0
+ LDA #$03 ;ONE BEFORE LOWEST DEATH ANIMATION
+ STA SATBL,X
+ JMP GDYING2 ;CONTINUE: ADVANCE STEP AND LOAD
+
+GDYING1 ;THIS GRUNT DIED AT LEAST A FRAME AGO
+ CMP #$09 ;HIGHEST DEATH ANIMATION
+ BEQ GDIE ;REALLY KILL THIS GRUNT
+
+GDYING2 INC SATBL,X ;ADVANCE DEATH ANIMATION
+ LDA #$01 ;GSPEED FOR A DYING GRUNT
+ STA MTTBL,X
+ JMP GMOVD0 ;CONTINUE: TRY TO LOAD THIS GRUNT
+
+GDIE ;REMOVE GRUNT PERMANENTLY
+ LDA #$00
+ STA STTBL,X ;COMMAND TO UNLOADER TO REMOVE OBJECT
+ DEC CRELEFT ;MC HAS 1 LESS CREATURE TO KICK AROUND
+ ;NOW GO AHEAD AND LOAD
+GMOVD0 ;GRUNT DATA HAS BEEN CHANGED BUT GRUNT IS DYING
+* DO A SPECIAL LOAD HERE WHICH DOES NOT NEED THE INTEND
+* VARIABLES TO BE SET... CORRECT DATA IS IN TABLES
+* ON TO NEXT OBJECT
+ JMP OBJCONT
+
+GMOV5
+* NOW JSR TO A ROUTINE WHICH MOVES THE GRUNT IN THE DL AND ZONOBJC. ***
+* INTENDED POSITION IS IN X,YINTEND. *********
+* INTENDED EXTENTS ARE IN X,YXINTEND *********
+* THIS OBJECT'S INDEX IS IN X. *********
+* THE ROUTINE SHOULD RETURN WITH THE ACTUAL NEW X AND Y POSITIONS*******
+* IN X,YINTEND *********
+*
+* NOW UPDATE THIS OBJECT'S X AND Y POSITIONS IN THE OBJECT DATA TABLES
+; JSR GETEXTEN ;THIS WILL SET TEMP11 AND TEMP12
+;IT ISN'T CLEAR THAT THE DRIVER WILL PRESERVE THE EXTENTS. PERHAPS IT WILL BE
+;NECESSARY TO VERIFY WITH THE ANIMATOR OCCAISIONALLY ********
+
+ LDA XINTEND
+ STA XTBL,X
+ LDA XXINTEND
+ STA XEXTBL,X
+
+ LDA YINTEND
+ STA YTBL,X
+ LDA YXINTEND
+ STA YEXTBL,X
+
+ JMP OBJCONT ;GO ON TO NEXT OBJECT
+*
+
+******************************************
+*
+* FMOV -- MOVE FAMILY
+*
+******************************************
+*
+* USE OF OBJECT DATA TABLE ENTRIES:
+*
+* DXTBL - DIRECTION OF MOTION (0-7) OR 8 IF SKULL OR POINTS
+* DYTBL - NOT USED
+* DTTBL - #FRAMES FOR DIRECTION CHANGE
+* SATBL - ANIMATION (0-4) OR (0-5) FOR SKULL AND POINTS
+* MISCTBL - UNUSED
+* CRTBL - 2,3 0R 4 FRO MOMMY DADDY AND MIKEY
+*
+***********
+*
+
+FMOV
+ LDA STTBL,X ;LOAD CURRENT STATUS
+ AND #00000010B ;GET ONLY BIT 1 - 'DYING' FLAG
+ BEQ FOK ;THIS FAMILY MEMBER IS NOT DYING
+ JMP FDYING ;HUMAN IS DYING - DON'T MOVE
+* FAMILY IS ALIVE AND WELL SO MAKE THEM MOVE
+
+FOK DEC DTTBL,X ;COUNT FOR DIRECTION CHANGE
+ BPL FMOV1 ;JUMP PAST IF GO STRAIGHT
+ JSR RANDOM ;IF TIME TO TURN: GET A #
+ AND #MASK5
+ ADC #10 ;MINIMUM FAMILY DIR TIMER
+ STA DTTBL,X ;USE IT AS THE NEW TIMER FOR DIRECTION
+ JSR RANDOM ;PICK A NUMBER FOR DIRECTION
+ AND #$07 ;CHANGE IT INTO A NUMBER 0 TO 7
+ STA DXTBL,X ;SAVE THE NEW DIRECTION
+FMOV1 LDA XTBL,X ;LOAD HUMAN POSITION
+ LDY DXTBL,X ;GET THE DIRECTION
+ CLC
+ ADC XDIRTBL,Y ;ADD X STEP FOR THE DIRECTION
+ STA XINTEND ;STORE NEW POSITION
+ LDA XEXTBL,X
+ CLC
+ ADC XDIRTBL,Y ;ADD X STEP FOR THE DIRECTION
+ STA XXINTEND ;STORE NEW EXTENT
+ LDA YTBL,X
+ CLC
+ ADC YDIRTBL,Y ;ADD Y STEP. X REG WAS THE SAME
+ STA YINTEND ;STORE NEW Y POS
+ LDA YEXTBL,X
+ CLC
+ ADC YDIRTBL,Y ;ADD Y STEP. X REG WAS THE SAME
+ STA YXINTEND ;STORE NEW Y EXTENT
+
+* CHECK FOR HULK AND ELECTRODE COLLISIONS *********
+
+
+* FAMILY-HULK COLLISIONS
+ LDA HPTR ;GET THE POINTER TO THE BEGINING HULK
+ TAY ;MAKE Y THE POINTER
+FHCL LDA YTBL,X ;GET FAMILY Y
+ CMP YEXTBL,Y ;COMPARE IT WITH HULK Y EXT.
+ BCS FHCN ;IT CLEARS ON THIS SIDE
+ LDA YEXTBL,X ;GET FAMILY Y
+ CMP YTBL,Y ;CMP WITH HULK Y
+ BCC FHCN
+
+ LDA XTBL,X ;GET FAMILY X
+ CMP XEXTBL,Y ;COMPARE IT WITH HULK X EXT.
+ BCS FHCN ;IT CLEARS ON THIS SIDE
+ LDA XEXTBL,X ;GET FAMILY X
+ CMP XTBL,Y ;CMP WITH HULK X
+ BCC FHCN ;ITS A HIT
+
+* THE FAMILY MEMBER HAS BEEN SEVERELY KILLED
+* ENTER THE FAMILY DYING SOUND INTO THE SOUND QUEUE
+ LDA #SSKULL0
+ JSR DOTUNE
+ LDA #SSKULL1
+ JSR DOTUNE
+* NOW SET FAMILY ANIMATION TO #0 (SKULL) WITH HIGH BIT SET.
+* SET THE FAMILY CODE TO BE A MOMMY - #MOCODE
+* ALSO SET THE 'DYING' BIT IN STTBL
+* ALSO SET THE DIRECTION TO 8
+* THEN IMMEDIATELY GO TO THE FAMILY JUST-DYING ROUTINE
+ LDA #$00 ;SKULL ANIMATION STEP
+ STA SATBL,X
+ LDA #MOCODE
+ STA CRTBL,X
+ LDA #$02 ;BIT 1 IS ON
+ ORA STTBL,X
+ STA STTBL,X ;SET BIT 1 IN STATUS ENTRY
+ LDA #$08
+ STA DXTBL,X ;SET DIRECTION TO DYING DIRECTION
+ JMP FJUSTDIE ;LOAD IT THIS FRAME
+
+FHCN INY ;GO TO NEXT OBJECT
+ CPY SPTR ;SEE IF THAT WAS THE LAST
+ BNE FHCL
+
+* CHANGE ANIMATION STEP
+ DEC SATBL,X ;GET CURRENT STEP IN ANIMATION
+ BPL FMOV5 ;OK IF NONEGATIVE
+ LDA #$03 ;HIGHEST FAMILY ANIMATION STEP
+ STA SATBL,X ;NEW ANIMATION STEP
+ JMP FMOV5 ;NOW TRY TO LOAD THIS FAMILY
+
+FDYING ;A FAMILY MEMBER IS DYING
+ LDA SATBL,X ;HI BIT WILL BE SET IF PERSON JUST DIED
+ AND #$80
+ BEQ FDYING1 ;FAMILY HAS BEEN DYING - NOW REMOVE IT
+* NOW RESET HIGH BIT OF SATBL (LEAVING CORRECT ANIMATION STEP),
+* AND SET MTTBL TO A LARGE VALUE, AND LOAD THIS OBJECT
+FJUSTDIE LDA SATBL,X ;GET STEP WITH HI-BIT SET
+ AND #01111111B ;RESET HIGH BIT
+ STA SATBL,X
+ LDA #FDIEWAIT
+ STA MTTBL,X
+* NOW GO AHEAD AND DO A SPECIAL LOAD...
+ JMP FDYING2 ;GO AHEAD AND LOAD USING TABLE DATA
+
+FDYING1 ;A FAMILY MEMBER HAS BEEN DYING NOW FOR A LITTLE WHILE...
+ LDA #$00
+ STA STTBL,X ;INSTRUCTION TO UNLOADER TO REMOVE OBJECT
+ LDA #NULLCODE ;GET A NULL CREATURE TYPE
+ STA CRTBL,X
+* NOW GO AHEAD AND CALL THE UNLOADER (FROM SPECIAL ENTRY POINT).
+* SINCE STTBL,X=0 THE UNLOADER WILL SIMPLY REMOVE THIS OBJECT.
+
+FDYING2
+* DO A SPECIAL LOAD HERE WHICH DOES NOT NEED THE INTEND
+* VARIABLES TO BE SET... CORRECT DATA IS IN TABLES
+* FROM THIS ENTRY POINT THE UNLOADER SHOULD FETCH NEW STAMP
+* DATA USING GETSTAMP BUT SHOULD ASSUME THAT NO ZONE CHANGES WILL BE MADE
+* ON TO NEXT OBJECT
+ JMP OBJCONT
+
+
+FMOV5 ;NORMAL LOAD AFTER A FAMILY MEMBER MOVES
+* FIRST CALL GETSTAMP
+* NOW JSR TO A ROUTINE WHICH MOVES THE PERSON IN THE DL AND ZONOBJC. ***
+* INTENDED POSITION IS IN X,YINTEND. *********
+* THIS OBJECT'S INDEX IS IN Y. *********
+* THE ROUTINE SHOULD RETURN WITH THE ACTUAL NEW X AND Y POSITIONS*******
+* IN X,YINTEND *********
+* CHECK FOR COLLISION WITH AN ELECTRODE
+
+* NOW UPDATE THIS OBJECT'S X AND Y POSITIONS IN THE OBJECT DATA TABLES
+
+; JSR GETEXTEN ;GET CORRECT HEIGHT AND WID IN TEMP12,11
+; IT MAY BE NCESSARY TO UPDATE EXTENTS
+
+ LDA XINTEND
+ STA XTBL,X
+ LDA XXINTEND
+ STA XEXTBL,X
+
+ LDA YINTEND
+ STA YTBL,X
+ LDA YXINTEND
+ STA YEXTBL,X
+
+ JSR CHKOBJBD
+ LDA TEMP4 ;FLAG, NONZERO IF FAMILY AT EDGE
+ BEQ FMOV6
+ LDA #$00
+ STA DTTBL,X ;DIR WILL CHANGE NEXT FRAME
+
+FMOV6 LDA FSPEED ;GET TIME FOR NEXT MOVE
+ STA MTTBL,X ;SET TIMER
+ JMP OBJCONT ;GO ON TO NEXT OBJECT
+*
+
+******************************************
+*
+* HMOV -- MOVE HULKS
+*
+******************************************
+*
+* USE OF OBJECT DATA TABLE ENTRIES:
+*
+* DXTBL - DIRECTION (0-3)
+* DYTBL - UNUSED
+* DTTBL - # OF FRAMES TO DIRECTION CHANGE
+* SATBL - ANIMATION (0-3)
+* MISCTBL - DIRECTION TO JUMP AFTER BEING SHOT
+* CRTBL - 5
+*
+***********
+*
+* THIS IS THE ROUTINE FOR A DUMB HULK THAT WALKS RANDOMLY
+* IT CAN LATER BE MODIFIED SO THAT THEY ARE OCCAISIONALLY SMART
+* RIGHT NOW IT ABOUT THE SAME AS THE FAMILY ROUTINE
+
+HMOV
+ LDA MISCTBL,X ;LOAD DIRECTION TO JUMP
+ BEQ HMOV01 ;IF DIR IS 0, MOVE NORMALLY
+
+* MAKE HULK JUMP IN 4-BIT DIRECTION OF MISCTBL
+ TAY
+ LDA XTBL,X ;LOAD HULK POSITION
+ CLC
+ ADC XDIRTBL4,Y
+ CLC
+ ADC XDIRTBL4,Y ;HULK STEPS
+ STA XINTEND ;STORE NEW POSITION
+
+ LDA XEXTBL,X ;GET X EXTENT
+ CLC
+ ADC XDIRTBL4,Y ;MOVE THE OTHER EDGE
+ CLC
+ ADC XDIRTBL4,Y ;STEP
+ STA XXINTEND
+
+ LDA YTBL,X
+ CLC
+ ADC YDIRTBL4,Y ;ADD Y STEP. X REG WAS THE SAME
+ CLC
+ ADC YDIRTBL4,Y ;ADD Y STEP. X REG WAS THE SAME
+ STA YINTEND ;STORE NEW Y POS
+
+ LDA YEXTBL,X ;GET Y EXTENT
+ CLC
+ ADC YDIRTBL4,Y ;MOVE THE OTHER EDGE
+ CLC
+ ADC YDIRTBL4,Y ;MOVE THE OTHER EDGE
+ STA YXINTEND
+ LDA #$00
+ STA MISCTBL,X ;RESET DIR TO JUMP
+ JMP HMOV2
+
+
+HMOV01 DEC DTTBL,X ;COUNT FOR DIRECTION CHANGE
+ BPL HMOV1 ;JUMP PAST IF GO STRAIGHT
+ JSR RANDOM ;IF TIME TO TURN: GET A #
+ AND #MASK5
+ ADC #10 ;MINIMUM DIR TIMER INITIAL VALUE
+ STA DTTBL,X ;USE IT AS THE NEW TIMER FOR DIRECTION
+ JSR RANDOM ;PICK A NUMBER FOR DIRECTION
+ AND #$03 ;CHANGE IT INTO A NUMBER 0 TO 3 *****
+ STA DXTBL,X ;STORE NEW DIRECTION
+ JSR GETEXTEN ;GET THE NEW EXTENTS
+ LDA XTBL,X ;GET X POS
+ CLC
+ ADC TEMP11 ;ADD X SIZE
+ STA XEXTBL,X
+ LDA YTBL,X ;GET Y POS
+ CLC
+ ADC TEMP12 ;ADD Y SIZE
+ STA YEXTBL,X ;RENEW EXTENT
+HMOV1 LDA XTBL,X ;LOAD HULK POSITION
+ LDY DXTBL,X ;GET THE DIRECTION
+ CLC
+ ADC XDIRTBL,Y ;ADD X STEP FOR THE DIRECTION
+ CLC
+ ADC XDIRTBL,Y
+ CLC
+ ADC XDIRTBL,Y ;HULK STEPS
+ STA XINTEND ;STORE NEW POSITION
+
+ LDA XEXTBL,X ;GET X EXTENT
+ CLC
+ ADC XDIRTBL,Y ;MOVE THE OTHER EDGE
+ CLC
+ ADC XDIRTBL,Y
+ CLC
+ ADC XDIRTBL,Y ;STEP
+ STA XXINTEND
+
+ LDA YTBL,X
+ CLC
+ ADC YDIRTBL,Y ;ADD Y STEP. X REG WAS THE SAME
+ STA YINTEND ;STORE NEW Y POS
+
+ LDA YEXTBL,X ;GET Y EXTENT
+ CLC
+ ADC YDIRTBL,Y ;MOVE THE OTHER EDGE
+ STA YXINTEND
+
+* CHANGE ANIMATION STEP
+ DEC SATBL,X ;DECREMENT THE ANIMATION
+ BPL HMOV2 ;OK IF NONEGATIVE
+ LDA #$03 ;HIGHEST HULK ANIMATION STEP
+ STA SATBL,X ;NEW ANIMATION STEP
+
+HMOV2 JSR CHKINTBD
+ LDA TEMP4 ;FLAG, NONZERO IF AT EDGE
+ BEQ HMOV5
+ LDA #$00
+ STA DTTBL,X ;FORCE DIR CHANGE NEXT FRAME
+
+HMOV5
+* FIRST CALL GETSTAMP *********
+* NOW JSR TO A ROUTINE WHICH MOVES THE HULK IN THE DL AND ZONOBJC. *****
+* INTENDED POSITION IS IN X,YINTEND. *********
+* THIS OBJECT'S INDEX IS IN Y. *********
+* THE ROUTINE SHOULD RETURN WITH THE ACTUAL NEW X AND Y POSITIONS*******
+* IN X,YINTEND *********
+* ALSO REMEMBER TO CHECK ELECTRODE COLLISIONS SOMEWHERE *********
+
+* NOW UPDATE THIS OBJECT'S X AND Y POSITIONS IN THE OBJECT DATA TABLES
+
+; IT MAY BE NECESSARY TO UPDATE EXTENTS *********
+
+ LDA XINTEND
+ STA XTBL,X
+ LDA XXINTEND
+ STA XEXTBL,X
+
+ LDA YINTEND
+ STA YTBL,X
+ LDA YXINTEND
+ STA YEXTBL,X
+
+
+ LDA HSPEED ;GET THE NUMBER OF FRAMES TILL NEXT MOV
+ STA MTTBL,X ;SET TIMER
+
+ JMP OBJCONT ;GO ON TO NEXT OBJECT
+*
+
+******************************************
+*
+* SQMOV -- MOVE SPHEROIDS AND QUARKS
+*
+******************************************
+*
+* USE OF OBJECT DATA TABLE ENTRIES:
+* --SPHEROIDS-- --QUARKS-* DXTBL -
+* DXTBL - DELTA X DIRECTION ( 4 - 7 )
+* DYTBL - DELTA Y DIRECTION CHANGE TIMER
+* DTTBL - # OF BIRTHS REMAINING
+* SATBL - ANIMATION STEP (0-5)
+* MISCTBL - # OF MOVES UNTIL BIRTH
+* CRTBL - 6 7
+*
+***********
+*
+SQMOV DEC MISCTBL,X ;SEE IF IT'S TIME TO GIVE BIRTH
+ BPL SQMOV1 ;BRANCH BY IF NOT TIME
+* HERE CREATE AN ENFORCER OR TANK IN THE SMALL ANIMATION **************
+SQMOV1 LDA CRTBL,X ;GET CREATURE TYPE
+ CMP #7 ;SEE IF IT'S A QUARK
+ BCS QMOV ;BRANCH IF QUARK
+ CLC
+ LDA XTBL,X ;GET X POSITION
+ ADC DXTBL,X ;ADD dX TO CURRENT POSITION
+ STA XINTEND
+ LDA XEXTBL,X ;GET X EXTENT
+ ADC DXTBL,X
+ STA XXINTEND
+ LDA YTBL,X ; GET YPOS
+ ADC DYTBL,X ;ADD dY
+ STA YINTEND
+ LDA YEXTBL,X ;GET Y EXTENT
+ ADC DYTBL,X
+ STA YXINTEND
+
+* HERE INC OR DEC DX AND DY RANDOMLY TO CAUSE A CURVE ********
+
+* BE SURE THAT NEW X AND Y POSITIONS ARE SENT TO THE TBL'S ********
+
+ JMP OBJCONT
+
+
+QMOV CLC
+ LDY DXTBL,X ;GET THE DIRECTION
+ LDA XTBL,X
+ ADC XDIRTBL,Y ;MOVE ACCORDING TO THE DIRECTION
+ STA XINTEND
+ LDA XEXTBL,X
+ ADC XDIRTBL,Y
+ STA XXINTEND
+
+ LDA YTBL,X
+ ADC YDIRTBL,Y ;MOVE ACC TO DIR
+ STA YINTEND
+ LDA YEXTBL,X
+ ADC YDIRTBL,X
+ STA YXINTEND
+
+
+* CHANGE ANIMATION STEP
+ DEC SATBL,X ;DECRIMENT THE ANIMATION
+ BPL QMOV5 ;OK IF NONEGATIVE
+ LDA #$04 ;HIGHEST QUARK ANIMATION STEP
+ STA SATBL,X ;STORE NEW ANIMATION
+QMOV5 LDA #0 ;PUT A ZERO IN THE DIRECTION
+
+* HERE CALL THE ANIMATOR AND THE UNLOADER **************
+ DEC DYTBL,X ;DECREMENT DIR CHANGE TIMER
+ BPL QMOV1 ;BRANCH BY IF NOT DIR CHANGE TIME
+ JSR RANDOM ;GET A RANDOM NUMBER
+ AND #MASK3 ;FILTER IT TO A 0-7 DIRECTION
+ STA DXTBL,X ;STORE NEW DIRECTION
+QMOV1 NOP
+ JMP OBJCONT
+
+******************************************
+*
+* ETMOV -- MOVE ENFORCERS AND TANKS
+*
+******************************************
+*
+* USE OF OBJECT DATA TABLE ENTRIES:
+* --ENFORCER-- --TANK--
+* DXTBL - DELTA X DIRECTION (0-7)
+* DYTBL - DELTA Y DIRECTION CHANGE TIMER
+* DTTBL - DIRECTION CHANGE TIMER NOT USED
+* SATBL - 0 ALWAYS ANIMATION (0-3)
+* MISCTBL - # MOVES UNTIL NEXT SHOT
+* CRTBL - 8 9
+*
+***********
+*
+
+ETMOV JMP OBJCONT ;NOT READY YET
+* TIMER USED FOR FIRING TIMES
+
+******************************************
+*
+* BMOV -- MOVE BRAINS
+*
+******************************************
+*
+* USE OF OBJECT DATA TABLE ENTRIES:
+*
+* DXTBL - DIRECTION (0-7)
+* DYTBL - TARGET NUMBER (0 IF MC)
+* DTTBL - FAMILY SEEK TIMER
+* SATBL - ANIMATION (0-3)
+* MISCTBL - # OF MOVES UNTIL NEXT SHOT
+* CRTBL - A
+*
+***********
+*
+BMOV
+ LDA STTBL,X ;LOAD THIS BRAIN'S CURRENT STATUS
+ AND #$03 ;SEE IF BOTTOM 2 BITS ARE SET
+ BNE BMOV01 ;WILL BE 0 IF BRAIN IS DEAD AND GONE
+ LDA #NULLCODE ;STTBL IS 0, SO NULL OUT CRTBL
+ STA CRTBL,X
+ JMP OBJCONT ;NEVER WORRY ABOUT THIS BRAIN ANYMORE
+
+BMOV01 AND #00000010B ;GET ONLY BIT 1 - 'DYING' FLAG
+ BEQ BOK
+ JMP BDYING ;BRAIN IS DYING - DON'T MOVE
+* BRAIN IS ALIVE AND WELL
+BOK DEC MISCTBL,X ;DECREMENT # OF MOVE TILL SHOOT
+ BPL BMOV1 ;BRANCH IF NOT YET TIME FOR A C M
+
+* HERE CREATE A CRUISE MISSLE AT THE PLACE WHERE THIS BRAIN IS *********
+* AND RESET MISCTBL TO THE TIME FOR THE NEXT CM *********
+
+BMOV1 DEC DTTBL,X ;COUNT MOVES UNTIL TIME TO LOOK AT FAM
+ BMI BMOV8 ;IS IT TIME YET
+ JMP BMOVST ;JUST PLOW ON AHEAD
+BMOV8 LDA #$03 ;RESET TIMER
+ STA DTTBL,X
+
+* LOOK AT THE HUMAN POINTED TO IN THE BRAIN'S DYTBL.
+* IF THE HUMAN IS DEAD POINT TO THE NEXT HUMAN BUT CHASE MC THIS TIME.
+* THE NET RESULT IS THAT IF THERE IS A FAMILY MEMBER LEFT, THE
+* BRAIN WILL EVENTUALLY LATCH ON TO IT, OTHERWISE IT WILL CHASE MC.
+
+ LDY DYTBL,X ;GET THE POINTER TO THE TARGET
+ LDA CRTBL,Y
+ BNE BCHASE ;WE ARE ONTO A LIVE FAMILY MEMBER
+ INC DYTBL,X ;WE ARE ONLY CHASING MC
+ INY
+ CPY HPTR ;END OF THE HUMANS
+ BMI BCHASENF ;RESET THE AIM IF WE GOT TO THE END
+ LDA FPTR ;START AT BEGINING OF FAMILY
+ STA DYTBL,X
+BCHASENF LDA #$0 ;CHASE MC WHEN FAMILY IS DEAD
+ TAY ;WHEN Y IS 0 IT IS POINTING AT MC
+
+BCHASE
+ LDA #$0 ;PUT A ZERO INCREMENT IN X AND Y
+ STA TEMPX
+ STA TEMPY
+ LDA XTBL,Y ;GET TARGET'S X POSITION
+ CMP XEXTBL,X ;COMPARE WITH BRAIN'S RIGHT EDGE
+ BCC BCHASE1 ;NOT YET THERE
+ INC TEMPX
+BCHASE1 LDA XEXTBL,Y ;GET TARGET'S RIGHT EDGE
+ CMP XTBL,X ;COMPARE WITH BRAIN'S LEFT
+ BCS BCHASE2 ;NOT ON TOP
+ DEC TEMPX
+
+BCHASE2 LDA YTBL,Y ;GET TARGET'S Y POSITION
+ CMP YEXTBL,X ;COMPARE WITH BRAIN'S FAR EDGE
+ BCC BCHASE3 ;NOT YET THERE
+ INC TEMPY
+BCHASE3 LDA YEXTBL,Y ;GET TARGET'S FAR EDGE
+ CMP YTBL,X ;COMPARE WITH BRAIN'S NEAR
+ BCS BCHASE4 ;NOT ON TOP
+ DEC TEMPY
+
+* NOW THAT WE HAVE THE DIFERENCE IN TEMP X AND Y
+* CONVERT IT INTO STICK FORM WITH F SIGNIFYING A HIT
+BCHASE4
+ LDA #$0F
+ STA TEMP0
+ LDA TEMPX ;GET THE X DIFFERENCE
+ BPL BNOTLEFT
+ LDA #$0B ;CLEAR WEST BIT
+ STA TEMP0
+ BNE BTRYY
+BNOTLEFT BEQ BTRYY ;A CHECK FOR EAST
+ LDA #$07 ;CLEAR EAST BIT
+ STA TEMP0
+BTRYY LDA TEMPY
+ BPL BNOTUP ;IT SHOULD CLEAR THE NORTH BIT
+ LDA TEMP0
+ AND #$0E
+ STA TEMP0
+ BNE BSTICK ;THIS ALWAYS BRANCHES
+BNOTUP BEQ BSTICK
+ LDA TEMP0
+ AND #$0D ;CLEAR THE SOUTH BIT
+ STA TEMP0
+BSTICK STY TEMP1
+ LDA TEMP0 ;GET THE STICK FORM
+ CMP #$0F ;SEE IF COMPLETE OVERLAP
+ BEQ BPROG
+ TAY
+ LDA STICKTBL,Y ;GET 0-7 FORM
+ LDY TEMP1 ;GET BACK POINTER TO HUMAN
+ STA DXTBL,X ;STORE THE DIRECTION FOR THE BRAIN
+ JMP BMOVST
+
+BPROG LDA STTBL,Y ;GET THE HUMAN'S STATUS
+ AND #$03 ;CHECK BOTTOM 2 BITS
+ CMP #$01 ;WE ONLY WANT HEALTHY HUMANS
+ BNE BMOVST
+
+* IT'S PROGGING TIME THE PROGEE IS POINTED TO BY Y
+* THE FAMILY MEMBER HAS BEEN SEVERELY KILLED
+* ENTER THE FAMILY DYING SOUND INTO THE SOUND QUEUE
+ LDA #SSKULL0
+ JSR DOTUNE
+ LDA #SSKULL1
+ JSR DOTUNE
+* NOW SET FAMILY ANIMATION TO #0 (SKULL) WITH HIGH BIT SET.
+* SET THE FAMILY CODE TO BE A MOMMY - #MOCODE
+* ALSO SET THE 'DYING' BIT IN STTBL
+* ALSO SET THE DIRECTION TO 8
+* THE FAMILY WILL START DYING NEXT FRAME
+ LDA #$00 ;SKULL ANIMATION STEP
+ STA SATBL,Y
+ LDA #MOCODE
+ STA CRTBL,Y
+ LDA #$02 ;BIT 1 IS ON
+ ORA STTBL,Y
+ STA STTBL,Y ;SET BIT 1 IN STATUS ENTRY
+ LDA #$08
+ STA DXTBL,Y ;SET DIRECTION TO DYING DIRECTION
+ LDA #$0A ;WAIT A WHILE SO THAT IT BOES'NT LOOK
+ STA DTTBL,X ;AT SKULL FOR DIRECTION
+ JMP OBJCONT
+
+* MOVE THE BRAIN A STEP
+BMOVST LDY DXTBL,X ;GET THE CURRENT DIRECTION
+ LDA XTBL,X ;GET X POS
+ CLC
+ ADC XDIRTBL,Y ;ADD ONE STEP
+ STA XINTEND
+ LDA XEXTBL,X
+ CLC
+ ADC XDIRTBL,Y
+ STA XXINTEND
+
+ LDA YTBL,X ;GET Y POS
+ CLC
+ ADC YDIRTBL,Y ;MOVE ONE STEP
+ STA YINTEND
+ LDA YEXTBL,X
+ CLC
+ ADC YDIRTBL,Y
+ STA YXINTEND
+
+* RESET MOVE TIMER
+ LDA BSPEED ;GET TIME TO MOVE
+ STA MTTBL,X ;STORE IT FOR NEXT MOVE
+
+* CHANGE ANIMATION STEP
+ DEC SATBL,X ;DECRIMENT THE ANIMATION
+ BPL BMOV5 ;OK IF NONEGATIVE
+ LDA #$03 ;HIGHEST BRAIN ANIMATION STEP
+ STA SATBL,X ;NEW ANIMATION STEP
+
+ JSR GETEXTEN ;@@@@@@@@@@ TEMPORARILY RECHECK EXTENTS
+ LDA XINTEND
+ CLC
+ ADC TEMP11
+ STA XXINTEND
+ LDA YINTEND
+ ADC TEMP12
+ STA YXINTEND
+
+BMOV5 JSR CHKINTBD ;KEEP IT ON THE SCREEN
+* HERE JUMP TO THE UNLOADER ******************
+
+* STORE THE NEW POSITION
+ LDA XINTEND
+ STA XTBL,X
+ LDA XXINTEND
+ STA XEXTBL,X
+ LDA YINTEND
+ STA YTBL,X
+ LDA YXINTEND
+ STA YEXTBL,X
+ JMP OBJCONT ;NOT READY YET
+BDYING ;FOR NOW JUST MAKE IT GO AWAY
+* START BRAIN DEATH SOUND
+ LDA #SCREDIE
+ JSR DOTUNE
+
+ LDA #$00 ;DEAD STATUS
+ STA STTBL,X
+ DEC CRELEFT ;ONE LESS CREATURE
+ JMP OBJCONT
+*
+
+******************************************
+*
+* PMOV -- MOVE PROGS
+*
+******************************************
+*
+* USE OF OBJECT DATA TABLE ENTRIES:
+*
+* DXTBL - NOT
+* DYTBL - YET
+* DTTBL - DEFINED
+* SATBL -
+* MISCTBL -
+* CRTBL -
+*
+***********
+*
+
+PMOV JMP OBJCONT ;NOT READY YET
+*
+
+******************************************
+*
+* MMOV -- MOVE OBJECT MISSILES
+*
+******************************************
+*
+* USE OF OBJECT DATA TABLE ENTRIES:
+*
+* DXTBL - NOT
+* DYTBL - YET
+* DTTBL - DEFINED
+* SATBL -
+* MISCTBL -
+* CRTBL -
+*
+***********
+*
+
+MMOV JMP OBJCONT ;NOT READY YET
+*
+
+******************************************
+*
+* WAVEEND - DO SOMETHING INTERESTING BETWEEN WAVES
+*
+******************************************
+*
+*@@@@@@ FOR NOW - THIS IS JUST A HACK
+WAVEEND
+* START WAVE END SOUND
+ LDA #SRACKA
+ JSR DOTUNE
+
+ JSR DISPINIT
+ LDX #$FF
+WAVEEND1 STX BACKGRND
+ BRK
+ NOP
+ DEX
+ BNE WAVEEND1
+ RTS
+*
+
+******************************************
+*
+* MCDEATH -- JUMP HERE WHEN MC GETS KNOCKED OFF
+*
+******************************************
+*
+
+MCDEATH ;MC HAS KICKED THE BUCKET
+
+* START MC DEATH SOUND
+ LDA #SMCDIE
+ JSR DOTUNE
+
+*@@@@@@ FOR NOW, @@@@@@@@@@@@
+
+
+ LDX #$00
+MCD1 ;DO SOME FANCY COLOR CYCLING
+ STX P0C1
+ STX P0C2
+ STX P0C3
+ CLI
+ BRK ;GOTO KERNEL
+ NOP ;WE NEED A NOP HERE
+ INX
+ INX
+ BNE MCD1
+
+ LDX #$0F
+MCD2 STX P0C1
+ STX P0C2
+ STX P0C3
+ LDY #$4
+MCD3 BRK
+ NOP
+ DEY
+ BPL MCD3
+ DEX
+ BPL MCD2
+
+
+ JMP INIT ;RESTART
+*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
+
+*************
+*THIS ROUTINE MUST:
+* FREEZE EVERYTHING
+* DO SOME FUNNY COLOR CYCLING WITH MC
+* MAKE HIM DISAPPEAR
+* DECREMENT LIVES LEFT AND CHECK FOR END OF GAME *********
+* REARRANGE OBJECTS *********
+* GET RID OF MISSILES AND PROGS
+* REPACK ENFORCERS INTO SPHEROIDS
+* OPTIMIZE OBJTBL (ELIMINATE NULL OBJECTS)
+* FINALLY, EITHER GO TO TITLE PAGE, OR
+
+ JMP WAVESTRT
+*
+
+
+*****************************************
+*
+* GETSTAMP
+* EXTRACT POINTER TO STAMP PLUS OTHER STATISTICS
+* FROM THE TABLES GIVEN Y, CREDIR, AND STEP
+*
+******************************************
+*
+
+* POINTER TO THE ACTUAL STAMP IS RETURNED IN TEMP19 AND 20
+* ANIMATION STEP IS HANDLED DIRECTLY WITH THE OBJTBL
+* TEMP15 RETURNS THE WIDTH AND PALLETTE, ENCODED LIKE THE HEADER
+* TEMP12 IS THE HEIGHT OF THE PARTICULAR ANIMATION
+* TEMP11 IS WIDTH IN PIXELS
+* THE CREATURE DIRECTION SHOULD BE IN THE ACCUMALATOR ON CALLING
+
+* TEMPORARILY CHANGED TO GET THE DIRECTION FROM DXTBL
+* FOR ALL CREATURES LESS THAN SPHEROIDS OR EQAUL TO BRAIN
+
+
+GETSTAMP CLC
+ LDA #0 ;@@@ TEMPORARILY SET DIRECTION TO ZERO
+ LDY CRTBL,X ;GET THE CREATURE TYPE
+ CPY #$A ;@@@ SEE IF BRAIN
+ BEQ GETSTAM1 ;@@@
+ CPY #$F ;@@@ SEE IF ITS A SHOT
+ BEQ GETSTAM1 ;@@@ GET DIR FROM DXTBL IF IT IS
+ CPY #$6 ;@@@ SEE IF MO,D,MI OR H
+ BPL GETSTAM2 ;@@@ GO OUT IF NOT
+GETSTAM1 LDA DXTBL,X ;@@@ GET DIRECTION
+GETSTAM2 CLC
+ ADC CRETODST,Y ;ADD START OF DIRS FOR THAT CREATURE
+ TAY ;TO THE DIR WHICH IS IN THE ACC
+ LDA PALNWID,Y ;GET PALETTE AND WIDTH
+ STA TEMP15
+ LDA STAMPHGH,Y ;GET STAMP HEIGHT
+ STA TEMP12
+ LDA STAMPPWD,Y ;GET STAMP'S WIDTH IN PIXELS
+ STA TEMP11
+ LDA DIRTOSTE,Y ;GET START OF STEPS FOR THAT CRE + DIR
+ ADC SATBL,X ;ADD STEP OF ANIMATION TO GET STAMP #
+ TAY
+ LDA #H(STAMPS) ;GET HIGH POINTER TO STAMP
+ STA TEMP20
+ LDA STAMPL,Y ;GET LOW POINTER TO STAMP
+ STA TEMP19
+ RTS ;56 CYCLES
+
+
+*****************************************
+*
+* GETEXTEN
+* EXTRACT STATISTICS
+* FROM THE TABLES GIVEN X, CREDIR, AND STEP
+*
+******************************************
+*
+
+* THIS IS JUST A SUBSET OF GETSTAMP THAT ONLY WORRIES ABOUT EXTENTS
+* ANIMATION STEP IS HANDLED DIRECTLY WITH THE OBJTBL
+* TEMP12 IS THE HEIGHT OF THE PARTICULAR ANIMATION
+* TEMP11 IS WIDTH IN PIXELS
+* THE CREATURE DIRECTION SHOULD BE IN THE ACCUMALATOR ON CALLING
+* OBJECT INDEX IN X
+
+
+
+GETEXTEN STY TEMP4 ;SAVE Y
+ CLC
+ LDY CRTBL,X ;GET THE CREATURE TYPE
+ ADC CRETODST,Y ;ADD START OF DIRS FOR THAT CREATURE
+ TAY ;TO THE DIR WHICH IS IN THE ACC
+ LDA STAMPHGH,Y ;GET STAMP HEIGHT
+ STA TEMP12
+ LDA STAMPPWD,Y ;GET STAMP'S WIDTH IN PIXELS
+ STA TEMP11
+ LDY TEMP4 ;RESTORE Y
+ RTS ;THIS TAKES 31 CYCLES + JSR + RTS
+
+
+******************************************
+******************************************
+* *
+* MISCELLANEOUS ROUTINES *
+* *
+******************************************
+
+******************************************
+*
+* CHKOBJBD -- CHECK OBJECT BOUNDARIES
+* GIVEN A CREATURE INDEX IN X, THIS WILL LOOK AT
+* X AND Y POSITION AND EXTENTS AND MUNG THE ENTRIES IN
+* THE OBJECT DATA TABLES IF THE OBJECT IS OUT OF BOUNDS
+* TEMP4 IS A FLAG, > 0 IF OBJ HAD TO BE PUT BACK ONSCREEN
+*
+******************************************
+*
+CHKOBJBD
+ LDA #$00
+ STA TEMP4 ;FLAG STARTS OUT AS 0
+ LDA #MINX ;GET MIN X
+ SEC
+ SBC XTBL,X ;SUBTRACT X
+ BCC CHKOBD1 ;JUMP PAST IF OK
+ CLC
+ ADC XEXTBL,X ;ADD AMOUNT THAT IT'S OVER TO THE
+ STA XEXTBL,X ;CURRENT RIGHT EDGE
+ LDA #MINX ;SET LEFT EDGE OF CREATURE TO
+ STA XTBL,X ;THE MIN X
+ INC TEMP4 ;SET FLAG
+ JMP CHKOBDY ;GO ON TO DO Y
+CHKOBD1 LDA #MAXX ;GET MAX X
+ SEC
+ SBC XEXTBL,X ;SUBTRACT THE FAR EDGE
+ BCS CHKOBDY ;JUMP PAST IF OK
+ CLC
+ ADC XTBL,X ;ADD AMOUNT THAT IT'S OVER TO THE
+ STA XTBL,X ;CURRENT LEFT EDGE
+ LDA #MAXX ;SET RIGHT EDGE OF CREATURE TO
+ STA XEXTBL,X ;THE MAX X
+ INC TEMP4 ;SET FLAG
+CHKOBDY LDA #MINY ;GET MIN Y
+ SEC
+ SBC YTBL,X ;SUBTRACT Y
+ BCC CHKOBD2 ;JUMP PAST IF OK
+ CLC
+ ADC YEXTBL,X ;ADD AMOUNT THAT IT'S OVER TO THE
+ STA YEXTBL,X ;CURRENT TOP EDGE
+ LDA #MINY ;SET LEFT EDGE OF CREATURE TO
+ STA YTBL,X ;THE MIN Y
+ INC TEMP4 ;SET FLAG
+ RTS ;WE ARE OUT OF HERE
+CHKOBD2 LDA #MAXY ;GET MAX Y
+ SEC
+ SBC YEXTBL,X ;SUBTRACT THE FAR EDGE
+ BCS CHKOBD2-1 ;JUMP OUT IF OK - GO TO AN RTS
+ CLC
+ ADC YTBL,X ;ADD AMOUNT THAT IT'S OVER TO THE
+ STA YTBL,X ;CURRENT FAR EDGE
+ LDA #MAXY ;SET BOTTOM EDGE OF CREATURE TO
+ STA YEXTBL,X ;THE MAX Y
+ INC TEMP4 ;SET FLAG
+ RTS
+
+******************************************
+*
+* CHKINTBD -- CHECK INTENDED POSITION AND EXTENTS VERSUS BORDER
+* LOOKS AT X,YINTEND AND X,YXINTEND AND MUNGES IF NECESSARY
+* TEMP4 IS A FLAG, > 0 IF OBJ HAD TO BE PUT BACK ONSCREEN
+* NEEDS TO HAVE A VALID X INDEX
+*
+******************************************
+*
+CHKINTBD
+ LDA #0 ;RESET THE RESET FLAG
+ STA TEMP4
+ LDA XINTEND
+ CLC
+ ADC #$A
+ CMP #MINX+$A ;CHECK FOR RIGHT EDGE
+ BCC CHKINT1 ;RESET POSITION
+ LDA XXINTEND
+ CMP #MAXX ;CHECK FOR FAR EDGE
+ BCC CHKINTY ;GO ON TO Y
+CHKINT1 LDA XTBL,X ;GET ORIG X
+ STA XINTEND ;RESTORE TO ITS FORMER POSITION
+ LDA XEXTBL,X ;WHICH WAS HOPEFULLY ON SCREEN
+ STA XXINTEND
+ INC TEMP4 ;SET FLAG
+
+CHKINTY LDA YINTEND
+ CMP #MINY ;CHECK FOR NEAR EDGE
+ BCC CHKINT2 ;RESET POSITION
+ LDA YXINTEND
+ CMP #MAXY ;CHECK FOR FAR EDGE
+ BCS CHKINT2 ;GO ON TO Y
+ RTS
+CHKINT2 LDA YTBL,X ;GET ORIG Y
+ STA YINTEND ;RESTORE TO ITS FORMER POSITION
+ LDA YEXTBL,X ;WHICH WAS HOPEFULLY ON SCREEN
+ STA YXINTEND
+ INC TEMP4 ;SET FLAG TO A NON ZERO VALUE
+ RTS
+
+******************************************
+*
+* CHKXBD,CHKYBD -- TAKE AN X OR Y POSITION AND IF OFF SCREEN EDGE,
+* WILL PLACE AT SCREEN EDGE
+* CALLED WITH X OR Y POS IN A, RETURNS A
+*
+******************************************
+*
+
+CHKXBD CMP #MAXX ;TAKES XPOS IN ACC AND CHECKS FAR SIDE
+ BCC XBD1
+ LDA #MAXX ;PUT BACK ON SCREEN IF TOO FAR
+ JMP XBD2
+XBD1 CMP #MINX ;CHECK NEAR SIDE
+ BCS XBD2
+ LDA #MINX ;PUT IT BACK ON SCREEN
+XBD2 RTS
+
+CHKYBD CMP #MAXY
+ BCC YBD1 ;CHECK TOP
+ LDA #MAXY ;PUT IT BACK ON SCREEN
+ JMP YBD2
+YBD1 CMP #MINY ;CHECK BOTTOM
+ BCS YBD2
+ LDA #MINY ;PUT IT ON SCREEN
+YBD2 RTS
+*
+
+******************************************
+*
+* RANDOM - RETURN WITH A RANDOM NUBER 0 - 255 IN A
+*
+******************************************
+*
+RANDOM STY TEMP8 ;SAVE Y
+ LDA FRMCNT
+ ADC RNDM
+ ADC RNDM+1
+ LDY RNDM
+ STY RNDM+1
+ STA RNDM
+ LDY TEMP8 ;RESTORE Y
+ RTS
+
+
+******************************************
+*
+* RANDXY -- RETURNS RANDOM X AND Y POSITIONS IN VALID SCREEN AREA
+* RETURNS VALUES IN RANDOMX AND RANDOMY
+*
+******************************************
+*
+
+RANDXY JSR RANDOM ;GET A RANDOM NUMBER IN A
+ CMP #MINY ;MAKE SURE THAT IT IS WITHIN X RANGE
+ BCC RANDXY ;GO AGAIN IF OFF SCREEN
+ CMP #MAXX
+ BCS RANDXY
+ STA RANDOMX
+RANDXY1 JSR RANDOM ;GET ANOTHER RANDOM NUMBER FOR Y
+ CMP #MINY ;LIKEWISE Y IN RANGE
+ BCC RANDXY1 ;IF OUT OF BOUNDS FIND ANOTHER Y
+ CMP #MAXY
+ BCS RANDXY1
+ STA RANDOMY
+RANDXYDN RTS ;COMPLETELY CHECKS OUT
+*
+
+******************************************
+*
+* RANDXYBX -- RETURNS RANDOM X AND Y POSITIONS NOT TOO CLOSE TO CENTER
+* USEFUL FOR PLACING OBJECTS ON SCREEN AT START OF WAVE
+* RETURNS VALUES IN RANDOMX AND RANDOMY
+*
+******************************************
+*
+
+RANDXYBX JSR RANDOM ;GET A RANDOM NUMBER IN A
+ CMP #MINX ;MAKE SURE THAT IT IS WITHIN X RANGE
+ BCC RANDXYBX ;GO AGAIN IF OFF SCREEN
+ CMP #MAXX-HWID ;SUBTRACT HWID SO A LARGE OBJ DOESN'T HANG OFF
+ BCS RANDXYBX
+ STA RANDOMX
+RANDXYB1 JSR RANDOM ;GET ANOTHER RANDOM NUMBER FOR Y
+ CMP #MINY ;LIKEWISE Y IN RANGE
+ BCC RANDXYB1 ;IF OUT OF BOUNDS FIND ANOTHER Y
+ CMP #MAXY-HHEIGHT
+ BCS RANDXYB1
+ STA RANDOMY
+* NOW CHECK THAT X,Y IS NOT IN CENTER BOX
+ CMP #SBOXMINY-HHEIGHT ;Y-POS ALREADY IN A
+ BCC RANDXYBD ;OUTSIDE BOX
+ CMP #SBOXMAXY
+ BCS RANDXYBD ;OUTSIDE BOX
+ LDA RANDOMX ;THE X-POS WE GENERATED
+ CMP #SBOXMINX-HWID
+ BCC RANDXYBD ;OUTSIDE BOX
+ CMP #SBOXMAXX
+ BCC RANDXYBX ;TESTS FAIL SO X,Y IS INSIDE BOX
+RANDXYBD RTS ;COMPLETELY CHECKS OUT
+*
+
+******************************************
+*
+* RANDPM -- RANDOM PLUS/MINUS
+* RETURNS A RANDOM VALUE IN THE RANGE -TEMP4 TO +TEMP4
+* TEMP4 MUST BE 1,3,7,F,1F,3F, ETC.. BECAUSE IT IS USED AS A MASK
+*
+******************************************
+*
+
+RANDPM JSR RANDOM ;GET A RANDOM NUMBER 0 - 255
+ ROR A ;SET CARRY TO SOMETHING RANDOM
+ AND TEMP4
+ BCC RANDPMDN ;OK - LEAVE IT POSITIVE
+* MAKE A INTO -A
+ STA TEMP5
+ LDA #$00
+ SBC TEMP5 ;GET -A -- CARRY WAS ALREADY SET
+RANDPMDN RTS
+*
+
+******************************************
+*
+* RAND2 -- RANDOMLY RETURNS 0, 1 OR 2 IN THE ACCUMULATOR
+* USEFUL FOR CHOOSING RANDOM ANIMATION STEPS
+*
+******************************************
+*
+
+RAND2
+ JSR RANDOM
+ AND #MASK2
+ CMP #$03
+ BNE RAND20
+ LDA #$01
+
+RAND20 RTS
+*
+
+******************************************
+*
+* RESETSC -- RESET SCORES FOR BOTH PLAYERS
+*
+******************************************
+*
+
+RESETSC LDA #$00
+ STA SCORE1L
+ STA SCORE1M
+ STA SCORE1H
+ STA SCORE1V
+ STA SCORE2L
+ STA SCORE2M
+ STA SCORE2H
+ STA SCORE2V
+ RTS
+*
+*****************************************
+*
+* FSCORE PUT THE CORRECT SCORE FOR THE FAMILY
+* ONTO THE SCREEN AND CREDIT IT TO THE PLAYER
+*
+*****************************************
+
+FSCORE
+ LDA FAMLEVEL ;GET THE CURRENT FAMILY POINT VALUE
+ CLC
+ ADC #1 ;INCREMENT FAMILY VALUE
+ CMP #5 ;SEE IF OVER 5
+ BMI ZFSCORE ;A VERY TRANSIENT SYMBOL
+ LDA #5 ;RESET TO 5
+ZFSCORE STA FAMLEVEL ;RMEMBER THE POINT VALUE
+;HERE MUNGE THE ANIMATION TO GET THE NUMBER
+ CLC
+ ASL A
+ ASL A
+ ASL A
+ ASL A
+;THERE SHOULD BE A ROUTINE TO ADD TO THE PROPER PLAYER
+
+* START FAMILY PICKUP SOUND
+ LDA #SFPICK
+ JSR DOTUNE
+
+* FINALLY, RETURN WITH CURRENT LEVEL IN A
+ LDA FAMLEVEL
+ RTS
+
+******************************************
+* THROWAWAY ROUTINES
+******************************************
+
+*******************
+*
+* SETSTAT - THROWAWAY ROUTINE TO SET STTBL,X TO 1
+*
+SETSTAT LDA #$01
+ STA STTBL,X
+ RTS
+*
+
+
+
+********* END OF RSUBR.S ***************
+ EJE
diff --git a/RWAVE.S82 b/RWAVE.S82
new file mode 100644
index 0000000..8b74697
--- /dev/null
+++ b/RWAVE.S82
@@ -0,0 +1,953 @@
+******************************************************
+******************************************************
+*
+*
+* ROBOTRON 29-JULY-83
+* 2-AUGUST-83 12:00
+* 22-AUGUST-83 8:10
+*
+*
+* RWAVE.S - ROBOTRON WAVE-RELATED ROUTINES
+*
+******************************************************
+
+******************************************
+******************************************
+*
+* WAVESTRT-- SUBROUTINE TO INITIALIZE THINGS BEFORE EACH WAVE
+*
+* NOTE: THERE WILL HAVE TO BE AN ENTRY POINT INTO THIS*********
+* ROUTINE THAT WILL RESTART A WAVE WHEN THE MC DIES AND THEN RETURNS.
+* THIS POINT SHOULD BE AFTER THE INC OF WAVENUM AND AFTER THE LOAD
+* OF THE WAVE-START NUMBERS FROM ROM.
+*
+******************************************
+*
+WAVESTRT INC WAVENUM ;A NEW WAVE
+
+* INITIALIZE NUMBERS OF EACH OBJECT:
+* GET THE BLOCK OF STARTNUM NUMBERS FROM WAVETBL AND MOVE IT INTO
+* THE RAM LOCATIONS STARTING WITH GNUM.
+* HERE A Z80 WOULD BE NICE
+
+ LDA #$00
+ STA TEMP2 ;TEMP2 WILL BE USED FOR HI-BYTE OF WAVENUM*16
+ LDA WAVENUM ;THE CURRENT WAVE, 1 TO 255
+* TURN WAVE NUMBERS OVER 40 INTO THE RANGE 20 - 40
+WS1 CMP #40 ;LESS THAN 40?
+ BCC WS2 ;IF SO, CONTINUE
+ SEC
+ SBC #20 ;CHOP OFF 20
+ JMP WS1 ; AND TRY AGAIN
+* NOW A IS A WAVE # 1 - 40. MULTIPLY IT BY 16 TO GET WAVETBL OFFSET
+WS2 ASL A
+ ROL TEMP2
+ ASL A
+ ROL TEMP2
+ ASL A
+ ROL TEMP2
+ ASL A ;NOW A HAS LOW BYTE OF PRODUCT
+ ROL TEMP2 ;TEMP2 HAS HIGH BYTE OF PRODUCT
+* ADD OFFSET (JUST COMPUTED) TO #WAVETBL TO FIND BLOCK BASE ADDRESS
+ CLC
+ ADC #L(WAVETBL-$10) ;WAVETBL ACTUALLY STARTS WITH WAVE 1, NOT 0
+ STA TEMP0 ;LOW BYTE OF BLOCK BASE ADDRESS
+ LDA TEMP2
+ ADC #H(WAVETBL-$10)
+ STA TEMP1 ;HIGH BYTE OF BLOCK BASE ADDRESS
+* NOW (TEMP0) IS BLOCK BASE ADDRESS. LOOP THRU NUMBERS TO MOVE WITH Y
+ LDY #STARTNUM ;NUMBER OF NUMBERS TO MOVE
+WLOOP1 LDA (TEMP0),Y ;GET A NUMBER FROM WAVETBL IN ROM
+ STA GNUM,Y ;STORE IT IN RAM
+ DEY
+ BPL WLOOP1 ;Y NON-NEGATIVE - MORE TO MOVE
+
+**********NOW THE RAM VARIABLES ARE LOADED WITH START-OF-WAVE NUMBERS
+
+* ZERO OUT THE OBJECT DATA TABLES
+* LOOP FROM XTBL TO XTBL+MAXOBJS*NUMTBLS
+* THIS WILL WIPE OUT THE ENTIRE TOP PAGE OF THE TABLES, EVEN
+* ABOVE XTBL+MAXOBJS*NUMTBLS
+ LDA #L(XTBL)
+ STA TEMP0 ;TEMP0 IS LOW BYTE OF ADDRESS
+ LDA #H(XTBL)
+ STA TEMP1
+ LDY #$00 ;USE PURE INDIRECT STORE
+WSZLOOP LDA #$00 ;ZERO OUT OBJECT DATA TABLES LOOP
+ STA (TEMP0),Y ;ZERO A LOCATION
+ INC TEMP0
+ BNE WSZLOOP
+ INC TEMP1
+ LDA TEMP1
+ CMP #H(XTBL+MAXOBJS*NUMTBLS)
+ BCC WSZLOOP ;KEEP GOING IF TEMP1 LESS THAN TOP LOC
+ BEQ WSZLOOP ;ALSO GO IF EQUAL
+* NOW TEMP1 (HI BYTE OF INDEX) IS ABOVE UPPER LIMIT, SO WE ARE DONE
+
+
+* SET UP EACH TYPE OF OBJECT INDIVIDUALLY:
+* SET OBJECT DATA TABLE SEGMENT POINTER (FPTR, HPTR, ETC.)
+* CREATE SPECIFIED NUMBER OF OBJECTS IN OBJECT DATA TABLES
+* ( IF START-OF-WAVE NUMBER IS 0, CREATE 1 OBJECT
+* SO OTHER LOOPS WON'T GET SCREWED UP )
+* SET ALL OBJECT DATA TABLE VARIABLES
+* SET ALL VARIABLES GLOBAL TO A CERTAIN OBJECT TYPE (I.E. GSPEED)
+*
+* X IS A RUNNING POINTER INTO THE OBJECT DATA TABLES
+ LDX #$01
+* INITIALIZE NUMBER OF CREATURES LEFT
+ LDA #$00
+ STA CRELEFT
+*
+
+**********GRUNTS
+* NO NEED TO SET POINTER - OBJECT 1 IS ALWAYS THE FIRST GRUNT
+
+ LDY GNUM ;LOOP THRU ALL GRUNTS
+ BNE WSGGO ;AT LEAST 1 GRUNT - DISTRIBUTE GRUNTS
+* NO GRUNTS
+ LDA #NULLCODE
+ STA CRTBL,X ;STORE A NULL OBJECT
+ INX
+ JMP WSGCONT ;GO TO GLOBAL GRUNT VARIABLE SETUP
+
+WSGGO DEY ;Y INDEXES UNTIL NEGATIVE - FIX FENCEPOST ERROR
+WSGLOOP JSR RANDXYBX ;GET A VALID GRUNT POSITION
+ LDA RANDOMX
+ STA XTBL,X ;GRUNT XPOS
+ CLC
+ ADC #GWID ;COMPUTE EXTENT
+ STA XEXTBL,X ;GRUNT X EXTENT
+ LDA RANDOMY
+ STA YTBL,X ;GRUNT YPOS
+ CLC
+ ADC #GHEIGHT ;COMPUTE EXTENT
+ STA YEXTBL,X ;GRUNT Y EXTENT
+ TYA ;USE GRUNT # AS SEED TO GET GOOD DISTRIBUTION OF MOVE TIMERS
+ AND #MASK3 ;GET A NUMBER 0 - 7
+ CLC
+ ADC #WSWAIT
+ STA MTTBL,X ;NUMBER OF FRAMES UNTIL MOVE
+ JSR RAND2 ;GET A NUMBER, 0 - 2
+ CLC
+ ADC #$01 ;NUMBER, 1 - 3
+ STA SATBL,X ;GRUNT ANIMATION STEP
+ LDA #$00
+ STA DXTBL,X ;GRUNT DX (DIR) MUST ALWAYS BE 0
+ LDA #GCODE
+ STA CRTBL,X ;GRUNT OBJECT CODE
+ JSR SETSTAT ;FOR DEBUGGING @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
+* DLPHTBL,DLPLTBL AND DL2PTBL WILL BE SET UP BY THE LOAD AT THE END OF
+* THE WAVESTRT ROUTINE
+* DONE WITH THIS GRUNT, ON TO NEXT...
+ INC CRELEFT ;ANOTHER LIVING CREATURE IS CREATED
+ INX ;INCREMENT RUNNING POINTER
+ DEY
+ BPL WSGLOOP ;MORE GRUNTS TO SET UP
+
+* SET$GSPEED - NUMBER OF FRAMES BETWEEN GRUNT MOVES AT START
+* OF WAVE - THIS VARIABLE WILL BE CHANGED DURING THE WAVE
+WSGCONT LDA WAVENUM ;CURRENT WAVE NUMBER
+ CMP #$07 ;ONLY HAVE 7 WAVES IN TABLE
+ BCC LOOKGSP ;LOOK UP GSPEED FROM TABLE
+* WE ARE ABOVE WAVE 7, SET GSPEED TO #GSPMAX
+ LDA #GSPMAX
+ STA GSPEED
+ JMP WSG1
+LOOKGSP TAY ;PUT WAVE NUMBER IN Y
+ LDA GSPTBL-1,Y ;LOAD STARTING GSPEED - USE -1 BECAUSE NO WAVE 0
+ STA GSPEED
+WSG1 ;DONE WITH GRUNT SETUP
+
+**********FAMILY
+ STX FPTR ;SET POINTER TO START OF FAMILY
+
+ LDA MONUM ;CHECK IF NO FAMILY EXIST
+ BNE WSFLOOP ;IF AT LEAST 1 MOMMY, OK TO SET UP
+ LDA DNUM
+ BNE WSFLOOP ;IF AT LEAST 1 DADDY, OK TO SET UP
+ LDA MINUM
+ BNE WSFLOOP ;IF AT LEAST 1 MIKEY, OK TO SET UP
+* IF WE ARE HERE, NO FAMILY TO SET UP
+ LDA #NULLCODE
+ STA CRTBL,X ;STORE A NULL OBJECT
+ INX
+ JMP WSFCONT
+
+WSFLOOP LDA #$02 ;TEMP2 IS FAMILY FINISHED FLAG - MO,
+ STA TEMP2 ; D AND MI ROUTINES DEC THIS IF NO
+ ; MO, D OR MI TO SET UP. IF IT GOES NEGATIVE, WE ARE DONE
+* CHECK MOMMIES
+ DEC MONUM
+ BPL ADDMOMMY ;THERE ARE MOMMIES LEFT TO SET UP
+ DEC TEMP2 ;NO MOMMIES - DEC FAMILY FINISHED FLAG
+ JMP WSFCHKD ;MOVE ON TO DADDIES
+ADDMOMMY LDA #MOCODE
+ STA CRTBL,X ;STORE MOMMY CODE IN CRTBL
+ JSR ADDFAM
+* CHECK DADDIES
+WSFCHKD DEC DNUM
+ BPL ADDDADDY ;THERE ARE DADDIES LEFT TO SET UP
+ DEC TEMP2 ;NO DADDIES - DEC FAMILY FINISHED FLAG
+ JMP WSFCHKMI ;MOVE ON TO MIKEYS
+ADDDADDY LDA #DCODE
+ STA CRTBL,X ;STORE DADDY CODE IN CRTBL
+ JSR ADDFAM
+* CHECK MIKEYS
+WSFCHKMI DEC MINUM
+ BPL ADDMIKEY ;THERE ARE MIKEYS LEFT TO SET UP
+ DEC TEMP2 ;NO MIKEYS - DEC FAMILY FINISHED FLAG
+ JMP WSF1
+ADDMIKEY LDA #MICODE
+ STA CRTBL,X ;STORE MIKEY CODE IN CRTBL
+ JSR ADDFAM
+* CHECK IF THERE ARE NO FAMILY MEMBERS LEFT
+WSF1 LDA TEMP2
+ BPL WSFLOOP ;THERE ARE STILL MORE THINGS TO SET UP
+* NO MORE FAMILY TO ADD
+ JMP WSFCONT
+
+* SUBROUTINE TO PUT A FAMILY MEMBER INTO OBJECT DATA TABLES WITH STATE
+* VARIABLES SET UP. ASSUME CRTBL,X ALREADY LOADED WITH CORRECT CODE
+ADDFAM
+ JSR RANDXY ;GET A RANDOM POSITION
+ LDA RANDOMX
+ STA XTBL,X ;FAMILY XPOS
+ CLC
+ ADC #FWID ;COMPUTE EXTENT
+ STA XEXTBL,X ;FAMILY X EXTENT
+ LDA RANDOMY
+ STA YTBL,X ;FAMILY YPOS
+ CLC
+ ADC #FHEIGHT ;COMPUTE EXTENT
+ STA YEXTBL,X ;FAMILY Y EXTENT
+ JSR RANDOM
+ AND #MASK3 ;GET A NUMBER 0 - 7
+ STA DTTBL,X ;DIRECTION TIMER
+ STA MTTBL,X ;NUMBER OF FRAMES UNTIL MOVE
+ JSR RAND2 ;GET A NUMBER 0 - 2
+ STA SATBL,X ;FAMILY ANIMATION STEP
+ JSR RANDOM
+ AND #MASK3
+ STA DXTBL,X ;RANDOM DIRECTION 0 - 7
+ JSR SETSTAT ; FOR DEBUGGING @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
+* DLPHTBL,DLPLTBL AND DL2PTBL WILL BE SET UP BY THE LOAD AT THE END OF
+* THE WAVESTRT ROUTINE
+* DONE WITH THIS GRUNT, ON TO NEXT...
+ INX ;INCREMENT RUNNING POINTER
+ RTS
+
+WSFCONT
+* SET UP GLOBAL FAMILY VARIABLES
+ LDA #$05 ;MAY WANT TO USE A TABLE LOOKUP
+ STA FSPEED ;FAMILY SPEED
+ LDA #$00
+ STA FAMLEVEL ;RESET SCORE LEVEL FOR PICKING UP FAMILY
+
+
+**********HULKS
+ STX HPTR ;POINTER TO START OF HULKS
+
+ LDY HNUM ;LOOP THRU ALL HULKS
+ BNE WSHGO ;AT LEAST 1 HULK - DISTRIBUTE HULKS
+* NO HULKS
+ LDA #NULLCODE
+ STA CRTBL,X ;STORE A NULL OBJECT
+ INX
+ JMP WSHCONT ;GO TO GLOBAL HULK VARIABLE SETUP
+
+WSHGO DEY ; Y MUST DEC UNTIL NEGATIVE
+WSHLOOP JSR RANDXYBX ;GET A VALID HULK POSITION
+ LDA RANDOMX
+ STA XTBL,X ;HULK XPOS
+ CLC
+ ADC #HWID ;COMPUTE EXTENT
+ STA XEXTBL,X ;HULK X EXTENT
+ LDA RANDOMY
+ STA YTBL,X ;HULK YPOS
+ CLC
+ ADC #HHEIGHT ;COMPUTE EXTENT
+ STA YEXTBL,X ;HULK Y EXTENT
+ TYA ;USE HULK # AS SEED TO GET GOOD DISTRIBUTION OF MOVE TIMERS
+ AND #MASK3 ;GET A NUMBER 0 - 7
+ CLC
+ ADC #WSWAIT ;WAIT A LITTLE AFTER RES-IN
+ STA MTTBL,X ;NUMBER OF FRAMES UNTIL MOVE
+ JSR RAND2 ;GET A NUMBER 0 - 2
+ CLC
+ ADC #$01 ;GET A NUMBER 1, 2 OR 3
+ STA SATBL,X ;HULK ANIMATION STEP
+ JSR RANDOM
+ AND #MASK3
+ STA DTTBL,X ;# MOVES UNTIL DIR CHANGE
+ AND #MASK2
+ STA DXTBL,X ;DIRECTION MOVING
+ LDA #HCODE
+ STA CRTBL,X ;HULK OBJECT CODE
+ JSR SETSTAT ; FOR DEBUGGING @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
+* DLPHTBL,DLPLTBL AND DL2PTBL WILL BE SET UP BY THE LOAD AT THE END OF
+* THE WAVESTRT ROUTINE
+* DONE WITH THIS HULK, ON TO NEXT...
+ INX ;INCREMENT RUNNING POINTER
+ DEY
+ BPL WSHLOOP ;MORE HULKS TO SET UP
+
+WSHCONT ;SET UP VARIABLES GLOBAL TO HULKS
+* SET HSPEED - NUMBER OF FRAMES BETWEEN HULK MOVES
+ LDA WAVENUM ;CURRENT WAVE NUMBER
+ CMP #13 ;ONLY HAVE 13 WAVES IN TABLE
+ BCC LOOKHSP ;LOOK UP HSPEED FROM TABLE
+* WE ARE ABOVE WAVE 13, SET HSPEED TO #HSPMAX
+ LDA #HSPMAX
+ STA HSPEED
+ JMP WSH1
+LOOKHSP TAY ;PUT WAVE NUMBER IN Y
+ LDA HSPTBL-1,Y ;LOAD STARTING HSPEED - USE -1 BECAUSE NO WAVE 0
+ STA HSPEED
+WSH1 ;DONE WITH HULK SETUP
+
+**********SPHERIODS AND QUARKS
+ STX SPTR ;POINTER TO START OF SPHERIODS
+
+* SET UP GLOBAL SPHERIOD AND QUARK VARIABLES - NEEDED FOR INDIV. SETUP
+* SET SQBTIME -- BASE TIME UNTIL FIRST BIRTH IN A WAVE
+ LDA WAVENUM
+ CMP #17
+ BCC LOOKSQBT ;LOOK UP WAVE 1 THRU 17 IN THE TABLE
+* ABOVE WAVE 17, SET SQBTIME TO #SQBTMAX
+ LDA #SQBTMAX
+ STA SQBTIME
+ JMP WSSQ1
+LOOKSQBT TAY ;LOOK UP IN SQBTTBL
+ LDA SQBTTBL-1,Y
+ STA SQBTIME
+WSSQ1 ;SET UP INDIVIDUAL SPHEROIDS AND QUARKS NOW
+
+* SPHEROID LOOP
+ LDY SNUM ;LOOP THRU ALL SPHEROIDS
+ BNE WSSGO ;AT LEAST 1 SPHEROID - DISTRIBUTE THEM
+* NO SPHEROIDS
+ LDA #NULLCODE
+ STA CRTBL,X ;STORE A NULL OBJECT
+ INX
+ JMP WSSCONT ;GO ON TO QUARKS
+
+WSSGO DEY ;Y RUNS UNTIL NEGATIVE
+WSSLOOP JSR ADDSQ ;SET UP MOST STATE VARIABLES
+ LDA #SCODE
+ STA CRTBL,X
+ LDA #MAXSSPD
+ STA TEMP4
+ JSR RANDPM ;GET RANDOM NUM ON + OR - TEMP4
+ STA DXTBL,X ;START X SPEED
+ JSR RANDPM
+ STA DYTBL,X ;START Y SPEED
+* DONE WITH THIS SPHEROID, ON TO NEXT...
+ INC CRELEFT ;ANOTHER LIVING CREATURE IS CREATED
+ INX ;INCREMENT RUNNING POINTER
+ DEY
+ BPL WSSLOOP ;MORE SPHEROIDS TO SET UP
+
+WSSCONT STX QPTR ;START OF QUARKS
+
+* QUARK LOOP
+ LDY QNUM ;LOOP THRU ALL QUARKS
+ BNE WSQGO ;AT LEAST 1 QUARK - DISTRIBUTE THEM
+* NO QUARKS
+ LDA #NULLCODE
+ STA CRTBL,X ;STORE A NULL OBJECT
+ INX
+ JMP WSQCONT ;SET UP GLOBAL QUARK VARIABLES
+
+WSQGO DEY ;Y RUNS UNTIL NEGATIVE
+WSQLOOP JSR ADDSQ ;SET UP MOST STATE VARIABLES
+ LDA #QCODE
+ STA CRTBL,X
+ JSR RANDOM
+ AND #MASK3
+ STA DXTBL,X ;DIR MOVING
+ STA DYTBL,X ;DIR CHANGE TIMER
+* DONE WITH THIS QUARK, ON TO NEXT...
+ INC CRELEFT ;ANOTHER LIVING CREATURE IS CREATED
+ INX ;INCREMENT RUNNING POINTER
+ DEY
+ BPL WSQLOOP ;MORE QUARKS TO SET UP
+ JMP WSQCONT
+
+* SUBROUTINE TO SET UP STATE VARIABLES COMMON TO SPHEROIDS AND QUARKS
+ADDSQ ;OBJECT NUMBER IS IN X
+ JSR RANDXYBX ;GET A VALID POSITION
+ LDA RANDOMX
+ STA XTBL,X ;XPOS
+ CLC
+ ADC #SQWID ;COMPUTE EXTENT
+ STA XEXTBL,X ;X EXTENT
+ LDA RANDOMY
+ STA YTBL,X ;YPOS
+ CLC
+ ADC #SQHEIGHT ;COMPUTE EXTENT
+ STA YEXTBL,X ;Y EXTENT
+ JSR RANDOM
+ AND #MASK3
+ STA MTTBL,X ;# FRAMES UNTIL MOVE
+ LDA #SQBIRTHS
+ STA DTTBL,X ;# OF BIRTHS LEFT
+ LDA #SQSTEP1
+ STA SATBL,X ;STARTING ANIMATION STEP
+ JSR RANDOM
+ AND #MASK3
+ ADC SQBTIME
+ STA MISCTBL,X ;# MOVES UNTIL FIRST BIRTH
+* CALLING ROUTINE SHOULD SET UP SPECIFIC S + Q STATE VARIABLES:
+* SPHEROID: DELTA X AND DELTA Y
+* QUARK: DIR AND DIR CHANGE TIMER
+* BOTH: CREATURE TYPE
+*
+* DLPHTBL,DLPLTBL AND DL2PTBL WILL BE SET UP BY THE LOAD AT THE END OF
+* THE WAVESTRT ROUTINE
+ RTS
+
+WSQCONT ;SET UP VARIABLES GLOBAL TO QUARKS
+* SET QSPEED - NUMBER OF FRAMES BETWEEN QUARK MOVES
+ LDA WAVENUM ;CURRENT WAVE NUMBER
+ CMP #17 ;ONLY HAVE 17 WAVES IN TABLE
+ BCC LOOKQSP ;LOOK UP QSPEED FROM TABLE
+* WE ARE ABOVE WAVE 17, SET QSPEED TO #QSPMAX
+ LDA #QSPMAX
+ STA QSPEED
+ JMP WSSQ2
+LOOKQSP TAY ;PUT WAVE NUMBER IN Y
+ LDA QSPTBL-1,Y ;LOAD STARTING QSPEED - USE -1 BECAUSE NO WAVE 0
+ STA QSPEED
+WSSQ2 ;DONE WITH QUARKS
+
+**********ENFORCERS AND TANKS
+
+* ENFORCERS: ALLOCATE ENUM NULL ENFORCERS
+* (NORMALLY ENUM SHOULD BE SNUM * #SQBIRTHS)
+ STX EPTR ;POINTER TO START OF ENFORCERS
+* ENFORCER LOOP
+ LDY ENUM ;LOOP THRU ALL ENFORCERS
+ BNE WSEGO ;AT LEAST 1 ENFORCER - DISTRIBUTE THEM
+* NO ENFORCERS
+ LDA #NULLCODE
+ STA CRTBL,X ;STORE A NULL OBJECT
+ INX
+ JMP WSECONT ;SET UP GLOBAL ENFORCER VARIABLES
+
+WSEGO DEY ;Y RUNS UNTIL NEGATIVE
+WSELOOP LDA #NULLCODE
+ STA CRTBL,X ;STORE NULL OBJECT
+ INX
+ DEY
+ BPL WSELOOP ;MORE ENFORCERS TO ALLOCATE
+WSECONT ;SET UP VARIABLES GLOBAL TO ENFORCERS
+ ;THERE ARE NONE SO FAR
+
+* TANKS -- THEY ACTUALLY EXIST AT START OF WAVE
+ STX TPTR ;POINTER TO START OF TANKS
+
+ LDY TNUM ;LOOP THRU ALL TANKS
+ BNE WSTGO ;AT LEAST 1 TANK - DISTRIBUTE TANKS
+* NO TANKS
+ LDA #NULLCODE
+ STA CRTBL,X ;STORE A NULL OBJECT
+ INX
+ JMP WSTCONT ;GO TO GLOBAL TANK VARIABLE SETUP
+
+WSTGO DEY ;Y RUNS UNTIL NEGATIVE
+WSTLOOP JSR RANDXYBX ;GET A VALID TANK POSITION
+ LDA RANDOMX
+ STA XTBL,X ;TANK XPOS
+ CLC
+ ADC #TWID ;COMPUTE EXTENT
+ STA XEXTBL,X ;TANK X EXTENT
+ LDA RANDOMY
+ STA YTBL,X ;TANK YPOS
+ CLC
+ ADC #THEIGHT ;COMPUTE EXTENT
+ STA YEXTBL,X ;TANK Y EXTENT
+ TYA ;USE BRAIN # AS SEED TO GET GOOD DISTRIBUTION OF MOVE TIMERS
+ AND #MASK3 ;GET A NUMBER 0 - 7
+ STA MTTBL,X ;NUMBER OF FRAMES UNTIL MOVE
+ STA DXTBL,X
+ AND #MASK2
+ STA SATBL,X
+ STA DYTBL,X
+ JSR RANDOM
+ AND #MASK3
+ ADC #TSTIME ;BASE TIME BETWEEN TANK SHOTS
+ STA MISCTBL,X
+ LDA #TCODE
+ STA CRTBL,X
+* DLPHTBL,DLPLTBL AND DL2PTBL WILL BE SET UP BY THE LOAD AT THE END OF
+* THE WAVESTRT ROUTINE
+* DONE WITH THIS TANK, ON TO NEXT...
+ INC CRELEFT ;ANOTHER LIVING CREATURE IS CREATED
+ INX ;INCREMENT RUNNING POINTER
+ DEY
+ BPL WSTLOOP ;MORE TANKS TO SET UP
+
+WSTCONT ;SET UP VARIABLES GLOBAL TO TANKS
+* SET TSPEED - NUMBER OF FRAMES BETWEEN TANK MOVES
+ LDA WAVENUM ;CURRENT WAVE NUMBER
+ CMP #17 ;ONLY HAVE 17 WAVES IN TABLE
+ BCC LOOKTSP ;LOOK UP TSPEED FROM TABLE
+* WE ARE ABOVE WAVE 17, SET TSPEED TO #TSPMAX
+ LDA #TSPMAX
+ STA TSPEED
+ JMP WST1
+LOOKTSP TAY ;PUT WAVE NUMBER IN Y
+ LDA TSPTBL-1,Y ;LOAD STARTING TSPEED - USE -1 BECAUSE NO WAVE 0
+ STA TSPEED
+WST1 ;DONE WITH TANK SETUP
+
+**********BRAINS
+ STX BPTR ;POINTER TO START OF BRAINS
+
+ LDA FPTR
+ STA TEMP0 ;POINTER USED TO SET UP TARGETS
+
+ LDY BNUM ;LOOP THRU ALL BRAINS
+ BNE WSBGO ;AT LEAST 1 BRAIN - DISTRIBUTE BRAINS
+* NO BRAINS
+ LDA #NULLCODE
+ STA CRTBL,X ;STORE A NULL OBJECT
+ INX
+ JMP WSBCONT ;GO TO GLOBAL BRAIN VARIABLE SETUP
+
+WSBGO DEY ;Y RUNS UNTIL NEGATIVE
+WSBLOOP JSR RANDXYBX ;GET A VALID BRAIN POSITION
+ LDA RANDOMX
+ STA XTBL,X ;BRAIN XPOS
+ CLC
+ ADC #BWID ;COMPUTE EXTENT
+ STA XEXTBL,X ;BRAIN X EXTENT
+ LDA RANDOMY
+ STA YTBL,X ;BRAIN YPOS
+ CLC
+ ADC #BHEIGHT ;COMPUTE EXTENT
+ STA YEXTBL,X ;BRAIN Y EXTENT
+ TYA ;USE BRAIN # AS SEED TO GET GOOD DISTRIBUTION OF MOVE TIMERS
+ AND #MASK3 ;GET A NUMBER 0 - 7
+ STA MTTBL,X ;NUMBER OF FRAMES UNTIL MOVE
+ JSR RAND2 ;GET A NUMBER 0 - 2
+ STA SATBL,X ;BRAIN ANIMATION STEP
+ JSR RANDOM
+ AND #MASK3
+ STA DTTBL,X ;FAMILY SEEK TIMER
+ STA DXTBL,X ;DIRECTION MOVING
+
+* SELECT TARGET FROM FAMILY OBJECTS AND PUT IT IN DYTBL (0 IF NO FAMILY)
+WSBTARG LDA TEMP0
+ CMP HPTR
+ BCC WSB02 ;BRANCH IF TEMP0 IS STILL VALID
+* RESET TEMP0 TO FPTR
+ LDA FPTR
+ STA TEMP0
+WSB02 ;NOW PUT TEMP0 INTO DYTBL - BRAIN TARGET
+ STA DYTBL,X
+ INC TEMP0
+
+ JSR RANDOM
+ AND #MASK3
+ ADC BSTIME ;BASE TIME BEFORE BRAINS SHOOT
+ STA MISCTBL,X ;FRAMES UNTIL SHOOT
+ LDA #BCODE
+ STA CRTBL,X ;BRAIN OBJECT CODE
+ JSR SETSTAT ;FOR DEBUGGING @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
+* DLPHTBL,DLPLTBL AND DL2PTBL WILL BE SET UP BY THE LOAD AT THE END OF
+* THE WAVESTRT ROUTINE
+* DONE WITH THIS BRAIN, ON TO NEXT...
+ INC CRELEFT ;ANOTHER LIVING CREATURE IS CREATED
+ INX ;INCREMENT RUNNING POINTER
+ DEY
+ BPL WSBLOOP ;MORE BRAINS TO SET UP
+
+WSBCONT ;SET UP VARIABLES GLOBAL TO BRAINS
+* SET BSTIME AND BSPEED - BRAIN SHOOTING BASE TIME AND
+* NUMBER OF FRAMES BETWEEN BRAIN MOVES
+ LDA WAVENUM ;CURRENT WAVE NUMBER
+ CMP #15 ;ONLY HAVE 15 WAVES IN TABLE
+ BCC LOOKBS ;LOOK UP BSTIME AND BSPEED
+* WE ARE ABOVE WAVE 15, SET BSTIME=#BSTMAX, BSPEED=#BSPMAX
+ LDA #BSPMAX
+ STA BSPEED
+ LDA #BSTMAX
+ STA BSTIME
+ JMP WSB1
+LOOKBS TAY ;PUT WAVE NUMBER IN Y
+ LDA BSPTBL-1,Y ;LOAD STARTING BSTIME - USE -1 BECAUSE NO WAVE 0
+ STA BSPEED
+ LDA BSTTBL-1,Y
+ STA BSTIME
+WSB1 ;DONE WITH BRAIN SETUP
+
+***********PROGS
+* PROGS: ALLOCATE PNUM NULL PROGS
+ STX PPTR ;POINTER TO START OF PROGS
+* PROG LOOP
+ LDY PNUM ;LOOP THRU ALL PROGS
+ BNE WSPGO ;AT LEAST 1 PROG - DISTRIBUTE THEM
+* NO PROGS
+ LDA #NULLCODE
+ STA CRTBL,X ;STORE A NULL OBJECT
+ INX
+ JMP WSPCONT ;SET UP GLOBAL PROG VARIABLES
+
+WSPGO DEY ;Y RUNS UNTIL NEGATIVE
+WSPLOOP LDA #NULLCODE
+ STA CRTBL,X ;STORE NULL OBJECT
+ INX
+ DEY
+ BPL WSPLOOP ;MORE PROGS TO ALLOCATE
+WSPCONT ;SET UP VARIABLES GLOBAL TO PROGS
+ ;THERE ARE NONE SO FAR
+
+**********MISSILES
+ STX MPTR ;POINTER TO START OF MISSILES
+
+* COMPUTE NUMBER OF MISSILES TO ALLOCATE: TOTAL OF THE 3 MISSILE TYPES
+ CLC
+ LDA EMNUM
+ ADC CMNUM
+ ADC TMNUM
+ TAY ;Y IS INDEX FOR LOOP THRU ALL MISSILES
+ BNE WSMGO ;AT LEAST 1 MISSILE - DISTRIBUTE THEM
+* NO MISSILES
+ LDA #NULLCODE
+ STA CRTBL,X ;STORE A NULL OBJECT
+ INX
+ JMP WSMCONT ;GO TO GLOBAL MISSILE VARIABLE SETUP
+
+WSMGO DEY ;Y RUNS UNTIL NEGATIVE
+WSMLOOP LDA #NULLCODE
+ STA CRTBL,X ;STORE NULL OBJECT
+ INX
+ DEY
+ BPL WSMLOOP ;MORE PROGS TO ALLOCATE
+
+WSMCONT ;SET UP VARIABLES GLOBAL TO MISSILES
+* CURRENTLY WE HAVE NONE TO SET UP
+WSM1 ;DONE WITH MISSILE SETUP
+
+*@@@@@@@@@@@@@@@
+*@@ THIS IS A HACK TO ELIMINATE LOADER PROBLEMS
+*@@@@@
+*@@ SET UP NULL THINGS IN EACH ZONE AT THE END OF DISPLAY LIST
+
+ JMP SHOOM ;SKIP OVER THIS ;;;;;;;;;;;;;;;;;;
+
+ LDA #$01
+ STA STTBL,X
+ LDA #$05
+ STA CRTBL,X
+ LDA #$B0
+ STA XTBL,X
+ LDA #$B5
+ STA XEXTBL,X
+ LDA #$01
+ STA YTBL,X
+ LDA #$05
+ STA YEXTBL,X
+ INX
+
+ LDA #$01
+ STA STTBL,X
+ LDA #$05
+ STA CRTBL,X
+ LDA #$B0
+ STA XTBL,X
+ LDA #$B5
+ STA XEXTBL,X
+ LDA #$11
+ STA YTBL,X
+ LDA #$15
+ STA YEXTBL,X
+ INX
+
+ LDA #$01
+ STA STTBL,X
+ LDA #$05
+ STA CRTBL,X
+ LDA #$B0
+ STA XTBL,X
+ LDA #$B5
+ STA XEXTBL,X
+ LDA #$21
+ STA YTBL,X
+ LDA #$25
+ STA YEXTBL,X
+ INX
+
+ LDA #$01
+ STA STTBL,X
+ LDA #$05
+ STA CRTBL,X
+ LDA #$B0
+ STA XTBL,X
+ LDA #$B5
+ STA XEXTBL,X
+ LDA #$31
+ STA YTBL,X
+ LDA #$35
+ STA YEXTBL,X
+ INX
+
+ LDA #$01
+ STA STTBL,X
+ LDA #$05
+ STA CRTBL,X
+ LDA #$B0
+ STA XTBL,X
+ LDA #$B5
+ STA XEXTBL,X
+ LDA #$41
+ STA YTBL,X
+ LDA #$45
+ STA YEXTBL,X
+ INX
+
+ LDA #$01
+ STA STTBL,X
+ LDA #$05
+ STA CRTBL,X
+ LDA #$B0
+ STA XTBL,X
+ LDA #$B5
+ STA XEXTBL,X
+ LDA #$51
+ STA YTBL,X
+ LDA #$55
+ STA YEXTBL,X
+ INX
+
+ LDA #$01
+ STA STTBL,X
+ LDA #$05
+ STA CRTBL,X
+ LDA #$B0
+ STA XTBL,X
+ LDA #$B5
+ STA XEXTBL,X
+ LDA #$61
+ STA YTBL,X
+ LDA #$65
+ STA YEXTBL,X
+ INX
+
+ LDA #$01
+ STA STTBL,X
+ LDA #$05
+ STA CRTBL,X
+ LDA #$71
+ LDA #$B0
+ STA XTBL,X
+ LDA #$B5
+ STA XEXTBL,X
+ STA YTBL,X
+ LDA #$75
+ STA YEXTBL,X
+ INX
+
+ LDA #$01
+ STA STTBL,X
+ LDA #$05
+ STA CRTBL,X
+ LDA #$81
+ LDA #$B0
+ STA XTBL,X
+ LDA #$B5
+ STA XEXTBL,X
+ STA YTBL,X
+ LDA #$85
+ STA YEXTBL,X
+ INX
+
+ LDA #$01
+ STA STTBL,X
+ LDA #$05
+ STA CRTBL,X
+ LDA #$91
+ LDA #$B0
+ STA XTBL,X
+ LDA #$B5
+ STA XEXTBL,X
+ STA YTBL,X
+ LDA #$95
+ STA YEXTBL,X
+ INX
+
+ LDA #$01
+ STA STTBL,X
+ LDA #$05
+ STA CRTBL,X
+ LDA #$A1
+ LDA #$B0
+ STA XTBL,X
+ LDA #$B5
+ STA XEXTBL,X
+ STA YTBL,X
+ LDA #$A5
+ STA YEXTBL,X
+ INX
+*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
+
+SHOOM ;;;;;;;;;;;;
+
+
+*******************
+* WE HAVE FINISHED SETTING UP ALL THE OBJECTS IN THE OBJECT DATA TABLES.
+*******************
+* SET LAST ENTRY IN CRTBL TO $FF
+ LDA #$FF
+ STA CRTBL,X
+*
+
+
+**************************
+* NOW DO A LOAD WHICH SETS UP THE DISPLAY LIST AND ZONE LIST************
+* FOR ALL THE OBJECTS *********
+*************************
+
+* FINALLY, READY TO START PLAYING:
+ RTS ;END OF WAVESTART SUBROUTINE
+*
+********************************************************************************
+
+
+******************************************
+*
+* WAVESTMC - SET UP MC-RELATED STUFF AT WAVESTART
+*
+******************************************
+*
+
+WAVESTMC
+* INITIALIZE MC SHOT TABLES AND SHOT TIMER TO ZERO
+ LDA #$00
+ STA SDIRTBL ;SET DIRECTION CODE TO ZERO - NULL SHOT
+ STA SDIRTBL+1
+ STA SDIRTBL+2
+ STA SDIRTBL+3
+ STA SSATBL ;SET SHOT ANIMATION STEPS TO 0
+ STA SSATBL+1
+ STA SSATBL+2
+ STA SSATBL+3
+ STA MCSTMR ;LET MC SHOOT IMMEDIATELY
+ STA MCMTMR ;LET MC MOVE IMMEDIATELY
+
+ LDA #MCSCODE ;CREATURE TYPE OF MC SHOTS
+ STA SCRTBL ;SET SHOT CREATURE TYPES
+ STA SCRTBL+1
+ STA SCRTBL+2
+ STA SCRTBL+3
+
+* INITIALIZE MC POSITION AND MAKE HIM APPEAR
+ LDA #MCXINIT
+ STA MCXPOS ;MC X POSITION
+ LDA #MCXINIT+MCWID
+ STA MCXEX ;MC X EXTENT
+ LDA #MCYINIT
+ STA MCYPOS ;MC Y POSITION
+ LDA #MCYINIT+MCHEIGHT
+ STA MCYEX ;MC Y EXTENT
+ LDA #$00
+ STA SATBL ;MC START ANIMATION STEP
+ LDA #$0D ;DOWN DIRECTION - D
+ STA MCDIR ;MC START DIRECTION - SOUTH
+ LDA #$01
+ STA MCCTMR ;INITIALIZE MC COLLISION TIMER
+*
+ LDA #$01 ;INITIALIZE STTBL FOR MC @@@@@@@@@@@@@@@@@@@@@@@@@
+ STA STTBL ; THROWAWAY @@@@@@@@@@@@@@@@@@@@@@@@@@@
+*
+ RTS
+*
+
+
+********************************************************************************
+********************************************************************************
+
+*% THIS IS FOR DEVELOPMENT OF WAVESTART ROUTINES ONLY
+*%
+*% USE GLOBAL FIND/REPLACE IN THE EDITOR TO CUSTOMIZE THIS
+*% ALSO REMOVE THE *% AT THE BEGINNING OF EACH LINE
+*% WITH A F/*%//A
+*%
+*% CREATURE NAME: CREE
+*% CREATURE LETTER: @
+*% NUMBER OF WAVES STORED IN TABLE FOR GLOBAL DATA: %%
+
+**********CREES
+*% STX @PTR ;POINTER TO START OF CREES
+*%
+*% LDY @NUM ;LOOP THRU ALL CREES
+*% BNE WS@LOOP ;AT LEAST 1 CREE - DISTRIBUTE CREES
+* NO CREES
+*% LDA #NULLCODE
+*% STA CRTBL,X ;STORE A NULL OBJECT
+*% INX
+*% JMP WS@CONT ;GO TO GLOBAL CREE VARIABLE SETUP
+*%
+*%WS@LOOP JSR RANDXYBX ;GET A VALID CREE POSITION
+*% LDA RANDOMX
+*% STA XTBL,X ;CREE XPOS
+*% CLC
+*% ADC #@WID ;COMPUTE EXTENT
+*% STA XEXTBL,X ;CREE X EXTENT
+*% LDA RANDOMY
+*% STA YTBL,X ;CREE YPOS
+*% CLC
+*% ADC #@HEIGHT ;COMPUTE EXTENT
+*% STA YEXTBL,X ;CREE Y EXTENT
+*% TYA ;USE CREE # AS SEED TO GET GOOD DISTRIBUTION OF MOVE TIMERS
+*% AND #MASK3 ;GET A NUMBER 0 - 7
+*% STA MTTBL,X ;NUMBER OF FRAMES UNTIL MOVE
+*% JSR RAND2 ;GET A NUMBER 0 - 2
+*% STA SATBL,X ;CREE ANIMATION STEP
+*% JSR RANDOM
+*% AND #MASK3
+*% STA DTTBL,X ;# MOVES UNTIL DIR CHANGE
+*% AND #MASK2
+*% STA DXTBL,X ;DIRECTION MOVING
+*% LDA #@CODE
+*% STA CRTBL,X ;CREE OBJECT CODE
+* DLPHTBL,DLPLTBL AND DL2PTBL WILL BE SET UP BY THE LOAD AT THE END OF
+* THE WAVESTRT ROUTINE
+* DONE WITH THIS CREE, ON TO NEXT...
+*% INX ;INCREMENT RUNNING POINTER
+*% DEY
+*% BPL WS@LOOP ;MORE CREES TO SET UP
+*%
+*%WS@CONT ;SET UP VARIABLES GLOBAL TO CREES
+* SET @SPEED - NUMBER OF FRAMES BETWEEN CREE MOVES
+*% LDA WAVENUM ;CURRENT WAVE NUMBER
+*% CMP #%% ;ONLY HAVE %% WAVES IN TABLE
+*% BCC LOOK@SP ;LOOK UP @SPEED FROM TABLE
+* WE ARE ABOVE WAVE %%, SET @SPEED TO #@SPMAX
+*% LDA #@SPMAX
+*% STA @SPEED
+*% JMP WS@1
+*%LOOK@SP TAY ;PUT WAVE NUMBER IN Y
+*% LDA @SPTBL-1,Y ;LOAD STARTING @SPEED - USE -1 BECAUSE NO WAVE
+*% STA @SPEED
+*%WS@1 ;DONE WITH CREE SETUP
+
+
+*% THIS IS FOR DEVELOPMENT OF WAVESTART ROUTINES ONLY
+*%
+*% USE GLOBAL FIND/REPLACE IN THE EDITOR TO CUSTOMIZE THIS
+*% ALSO REMOVE THE *% AT THE BEGINNING OF EACH LINE
+*% WITH A F/*%//A
+*%
+*% CREATURE NAME: CREE
+*% CREATURE LETTER: @
+*% NUMBER OF WAVES STORED IN TABLE FOR GLOBAL DATA: %%
+
+*****************************************
+
+********** END OF RWAVE.S **************
+
+ EJE
+