mads 2.1.7 build 3 (13 Sep 23)
Source: dino.asm
     1 = 0008			SCR_HEIGHT = 8
     2 = 0040			WORLD_LENGTH = 64
     3 = 0010			DIFF_LEVELS = 16
     4
     5 				;  No internet
     6 				;---------------------------------------------------
     7 				    OPT r+
     8
     9 				;---------------------------------------------------
    10 				; Zpage variables
    11 				    .zpvar temp_w   .word = $80
    12 				    .zpvar temp_b   .byte
    13 				    .zpvar DinoWalkPhase    .byte
    14 				    .zpvar DinoState    .byte   ; 0/1 - walk, 2/3 - crouch, 4... - jump 
    15 				    .zpvar JumpPhase    .byte
    16 				;---------------------------------------------------
    17 				    icl 'lib/ATARISYS.ASM'
Source: ATARISYS.ASM
     1 				;****************************************************************************
     2 				;*                         ATARI PERSONAL COMPUTER                          *
     3 				;*                              SYSTEM EQUATES                              *
     4 				;****************************************************************************
     5 				;
     6 				; OPERATING SYSTEM EQUATE FILE
     7 				;
     8 				; MODULE ORIGIN TABLE
     9 				;
    10 				; VECTOR TABLE
    11 				;
    12 				; HANDLER ENTRY POINTS ARE CALL-
    13 				; ED OUT IN THE FOLLOWING VECTOR
    14 				; TABLE. THESE ARE THE ADDRESSES
    15 				; MINUS ONE.
    16 				;
    17 				; EXAMPLE FOR EDITOR
    18 				;
    19 				; E400     OPEN
    20 				;    2     CLOSE
    21 				;    4     GET
    22 				;    6     PUT
    23 				;    8     STATUS
    24 				;    A     SPECIAL
    25 				;    C     JUMP TO POWER ON INIT
    26 				;    F     NOT USED
    27 				;
    28 = E400			EDITRV	EQU	$E400	;EDITOR
    29 = E410			SCRENV	EQU	$E410	;TV SCREEN
    30 = E420			KEYBDV	EQU	$E420	;KEYBOARD
    31 = E430			PRINTV	EQU	$E430	;PRINTER
    32 = E440			CASETV	EQU	$E440	;CASSETTE
    33 				;
    34 				; JUMP VECTOR TABLE
    35 				;
    36 				; THE FOLLOWING IS A TABLE OF
    37 				; JUMP INSTRUCTIONS TO VARIOUS
    38 				; ENTRY POINTS IN THE OPERATING
    39 				; SYSTEM
    40 				;
    41 = E450			DISKIV	EQU	$E450	;DISK INITIALIZATION
    42 = E453			DSKINV	EQU	$E453	;DISK INTERFACE
    43 = E456			CIOV  	EQU	$E456	;CENTRAL I/O ROUTINE
    44 = E459			SIOV  	EQU	$E459	;SERIAL I/O ROUTINE
    45 = E45C			SETVBV	EQU	$E45C	;SET SYSTEM TIMERS
    46 = E45F			SYSVBV	EQU	$E45F	;VBLANK CALCULATIONS
    47 = E462			XITVBV	EQU	$E462	;EXIT VBLANK
    48 = E465			SIOINV	EQU	$E465	;SIO INITIALIZATION
    49 = E468			SENDEV	EQU	$E468	;SEND ENABLE ROUTINE
    50 = E46B			INTINV	EQU	$E46B	;INTRPT HANDLER INIT
    51 = E46E			CIOINV	EQU	$E46E	;CIO INITIALIZATION
    52 = E471			BLKBDV	EQU	$E471	;BLACKBOARD MODE
    53 = E474			WARMSV	EQU	$E474	;WARM START VECTOR
    54 = E477			COLDSV	EQU	$E477	;COLD START VECTOR
    55 = E47A			RBLOKV	EQU	$E47A	;CASSETTE READ BLOCK
    56 = E47D			CSOPIV	EQU	$E47D	;CASSETTE INPUT OPEN
    57 				;
    58 				; VECTORS ADDED FOR 800XL
    59 				;
    60 = E480			PUPDIV	EQU	$E480	;POWER UP DISPLAY
    61 = E483			SLFTSV	EQU	$E483	;SELF TEST PROGRAM
    62 = E486			PHENTV	EQU	$E486	;UPLOADED HANDLER ENTER
    63 = E489			PHULNV	EQU	$E489	;UPLOADED HANDLER UNLINK
    64 = E48C			PHINIV	EQU	$E48C	;UPLOADED HANDLER INIT
    65 				;
    66 				; OPERATING SYSTEM EQUATES
    67 				;
    68 				; COMMAND CODES FOR IOCBS
    69 				;
    70 = 0003			_OPEN  	EQU	$03	;OPEN FOR I/O
    71 = 0005			GETREC	EQU	$05	;GET RECORD (TEXT)
    72 = 0007			GETCHR	EQU	$07	;GET CHARACTER(S)
    73 = 0009			PUTREC	EQU	$09	;PUT RECORD (TEXT)
    74 = 000B			PUTCHR	EQU	$0B	;PUT CHARACTER(S)
    75 = 000C			_CLOSE 	EQU	$0C	;CLOSE DEVICE
    76 = 000D			STATIS	EQU	$0D	;STATUS REQUEST
    77 = 000E			SPECIL	EQU	$0E	;SPECIAL ENTRY COMMAND
    78 				;
    79 				; SPECIAL ENTRY COMMANDS
    80 				;
    81 = 0011			DRAWLN	EQU	$11	;DRAW LINE
    82 = 0012			FILLIN	EQU	$12	;FILL
    83 = 0020			RENAME	EQU	$20	;RENAME DISK FILE
    84 = 0021			DELETE	EQU	$21	;DELETE DISK FILE
    85 = 0022			FORMAT	EQU	$22	;FORMAT DISK
    86 = 0023			LOCKFL	EQU	$23	;LOCK FILE
    87 = 0024			UNLOCK	EQU	$24	;UNLOCK FILE
    88 = 0025			POINT 	EQU	$25	;POINT SECTOR
    89 = 0026			NOTE  	EQU	$26	;NOTE SECTOR
    90 = 00FF			IOCFRE	EQU	$FF	;IOCB "FREE"
    91 				;
    92 				; AUX1 EQUATES
    93 				; () INDICATES WHICH DEVICES
    94 				;
    95 = 0001			APPEND	EQU	$01	;WR APPEND(D)-SCN RD(E)
    96 = 0002			DIRECT	EQU	$02	;OPEN DIRECTORY(D)
    97 = 0004			OPNIN 	EQU	$04	;OPEN FOR INPUT(ALL)
    98 = 0008			OPNOT 	EQU	$08	;OPEN FOR OUTPUT(ALL)
    99 = 000C			OPNINO	EQU	$0C	;OPEN INPUT&OUTPUT(ALL)
   100 = 0010			MXDMOD	EQU	$10	;OPEN MIXED MODE(E,S)
   101 = 0020			INSCLR	EQU	$20	;OPEN W/O CLEAR(E,S)
   102 				;
   103 				; DEVICE NAMES
   104 				;
   105 = 0045			SCREDT	EQU	'E'	;SCREEN EDITOR (R/W)
   106 = 004B			KBD   	EQU	'K'	;KEYBOARD (R ONLY)
   107 = 0053			DISPLY	EQU	'S'	;SCREEN DISPLAY (R/W)
   108 = 0050			PRINTR	EQU	'P'	;PRINTER (W ONLY)
   109 = 0043			CASSET	EQU	'C'	;CASSETTE (R/W)
   110 = 0052			RS232 	EQU	'R'	;MODEM (R/W)
   111 = 0044			DISK  	EQU	'D'	;DISK (R/W)
   112 				;
   113 				;
   114 				;
   115 				; OPERATING SYSTEM STATUS CODES
   116 				;
   117 = 0001			SUCCES	EQU	$01	;SUCCESSFUL OPERATION
   118 = 0080			BRKABT	EQU	$80	;BREAK KEY ABORT
   119 = 0081			PRVOPN	EQU	$81	;IOCB ALREADY OPEN
   120 = 0082			NONDEV	EQU	$82	;NON-EXISTANT DEVICE
   121 = 0083			WRONLY	EQU	$83	;IOCB OPEN FOR W ONLY
   122 = 0084			NVALID	EQU	$84	;INVALID COMMAND
   123 = 0085			NOTOPN	EQU	$85	;DEVICE/FILE NOT OPEN
   124 = 0086			BADIOC	EQU	$86	;INVALID IOCB #
   125 = 0087			RDONLY	EQU	$87	;IOCB OPEN FOR R ONLY
   126 = 0088			EOFERR	EQU	$88	;END OF FILE
   127 = 0089			TRNRCD	EQU	$89	;TRUNCATED RECORD
   128 = 008A			TIMOUT	EQU	$8A	;PERIPHERAL TIMEOUT
   129 = 008B			DNACK 	EQU	$8B	;DEVICE NO ACKNOWLEDGE
   130 = 008C			FRMERR	EQU	$8C	;SERIAL BUS FRAME ERR
   131 = 008D			CRSROR	EQU	$8D	;CURSOR OVERRANGE
   132 = 008E			OVRRUN	EQU	$8E	;SERIAL DATA OVERRUN
   133 = 008F			CHKERR	EQU	$8F	;SERIAL CHECKSUM ERR
   134 = 0090			DERRER	EQU	$90	;PERIPHRAL DEVICE ERR
   135 = 0091			BADMOD	EQU	$91	;BAD SCREEN MODE #
   136 = 0092			FNCNOT	EQU	$92	;NONEXISTANT FUNCTION
   137 = 0093			SCRMEM	EQU	$93	;SCREEN MEM TOO SMALL
   138 = 00AA			FILENF  EQU $AA ;FILE NOT FOUND
   139 				;
   140 				; PAGE ZERO RAM ASSIGNMENTS
   141 				;
   142 = 0000			LNFLG 	EQU	$00	;LINBUG RAM
   143 = 0001			NGFLAG	EQU	$01	;POWER-UP SELF-TEST FLAG
   144 				;
   145 				; THESE LOCATIONS NOT CLEARED
   146 				;
   147 = 0002			CASINI	EQU	$02	;CASSETTE INIT LOC
   148 = 0004			RAMLO 	EQU	$04	;RAM POINTER MEM TST
   149 = 0006			TRAMSZ	EQU	$06	;TEMP REG RAM SIZE
   150 = 0007			TSTDAT	EQU	$07	;RAM TEST DATA REG
   151 				;
   152 				;CLEARED ON COLDSTART ONLY
   153 				;
   154 = 0008			WARMST	EQU	$08	;WARM START FLAG
   155 = 0009			BOOTQ 	EQU	$09	;SUCCESSFUL BOOT FLG
   156 = 000A			DOSVEC	EQU	$0A	;DOS START VECTOR
   157 = 000C			DOSINI	EQU	$0C	;DOS INIT ADDRESS
   158 = 000E			APPMHI	EQU	$0E	;APPL MEM HI LIMIT
   159 				;
   160 				;CLEARED ON COLD OR WARM START
   161 				;
   162 = 0010			POKMSK	EQU	$10	;MASK POKEY IRQ
   163 = 0011			BRKKEY	EQU	$11	;BREAK KEY FLAG
   164 = 0012			RTCLOK	EQU	$12	;REAL TIME CLOCK
   165 = 0015			BUFADR	EQU	$15	;INDIRECT BUFF ADDR
   166 = 0017			ICCOMT	EQU	$17	;COMMAND FOR VECTOR
   167 = 0018			DSKFMS	EQU	$18	;FMS POINTER
   168 = 001A			DSKUTL	EQU	$1A	;DISK UTILITIES PTR
   169 = 001C			ABUFPT	EQU	$1C	;RESERVED
   170 = 0020			ICHIDZ	EQU	$20	;HANDLER INDEX #
   171 = 0021			ICDNOZ	EQU	$21	;DEVICE NUMBER
   172 = 0022			ICCOMZ	EQU	$22	;COMMAND CODE
   173 = 0023			ICSTAZ	EQU	$23	;STATUS RETURN
   174 = 0024			ICBALZ	EQU	$24	;BUFFER ADDRESS
   175 = 0025			ICBAHZ	EQU	$25
   176 = 0026			ICPTLZ	EQU	$26	;PUT BYTE ROUTINE-1
   177 = 0027			ICPTHZ	EQU	$27
   178 = 0028			ICBLLZ	EQU	$28	;BUFFER LENGTH
   179 = 0029			ICBLHZ	EQU	$29
   180 = 002A			ICAX1Z	EQU	$2A	;AUXILIARY BYTES
   181 = 002B			ICAX2Z	EQU	$2B
   182 = 002C			ICSPRZ	EQU	$2C	;SPARE BYTES
   183 = 002E			ICIDNO	EQU	$2E	;IOCB # X 16
   184 = 002F			CIOCHR	EQU	$2F	;CIO CHARACTER BYTE
   185 = 0030			STATUS	EQU	$30	;INTERNAL STATUS
   186 = 0031			CHKSUM	EQU	$31	;CHECKSUM
   187 = 0032			BUFRLO	EQU	$32	;DATA BUFFER LO BYTE
   188 = 0033			BUFRHI	EQU	$33	;DATA BUFFER HI BYTE
   189 = 0034			BFENLO	EQU	$34	;NEXT BYTE PAST DATA
   190 = 0035			BFENHI	EQU	$35	;BUFFER (HI & LO)
   191 = 0036			LTEMP 	EQU	$36	;LOADER TEMP
   192 = 0038			BUFRFL	EQU	$38	;DATA BUFFR FULL FLG
   193 = 0039			RECVDN	EQU	$39	;RECIEVE DONE FLAG
   194 = 003A			XMTDON	EQU	$3A	;XMIT DONE FLAG
   195 = 003B			CHKSNT	EQU	$3B	;CHECKSUM SENT FLAG
   196 = 003C			NOCKSM	EQU	$3C	;NO CHKSUM SENT FLAG
   197 				;BPTR  	EQU	$3D	;CASSETTE DATA INDEX
   198 = 003E			FTYPE 	EQU	$3E	;INTERRECORD GAP TYPE
   199 = 003F			FEOF  	EQU	$3F	;END OF FILE FLAG
   200 = 0040			FREQ  	EQU	$40	;BEEP COUNT
   201 = 0041			SOUNDR	EQU	$41	;NOISY I/O FLAG
   202 = 0042			CRITIC	EQU	$42	;CRITICAL MODE
   203 = 0043			FMSZPG	EQU	$43	;FMS ZERO PAGE
   204 = 004A			ZCHAIN	EQU	$4A	;HANDLER LOADER TEMP
   205 = 004C			DSTAT 	EQU	$4C	;DISPLAY STATUS
   206 = 004D			ATRACT	EQU	$4D	;ATTRACT FLAG
   207 = 004E			DRKMSK	EQU	$4E	;DARK ATTRACT MASK
   208 = 004F			COLRSH	EQU	$4F	;COLOR SHIFTER
   209 = 0050			TMPCHR	EQU	$50	;TEMP STORAGE
   210 = 0051			HOLD1 	EQU	$51	;TEMP STORAGE
   211 = 0052			LMARGN	EQU	$52	;LEFT MARGIN (1)
   212 = 0053			RMARGN	EQU	$53	;RIGHT MARGIN (38)
   213 = 0054			ROWCRS	EQU	$54	;CURSOR COUNTERS
   214 = 0055			COLCRS	EQU	$55
   215 = 0057			DINDEX	EQU	$57	;DISPLAY MODE #
   216 = 0058			SAVMSC	EQU	$58	;SCREEN MEM ADDR
   217 = 005A			OLDROW	EQU	$5A	;DRAW START POSIT
   218 = 005B			OLDCOL	EQU	$5B
   219 = 005D			OLDCHR	EQU	$5D	;DATA UNDER CURSOR
   220 = 005E			OLDADR	EQU	$5E	;CURSOR MEM ADDR
   221 = 0060			FKDEF 	EQU	$60	;FUNC KEY DEFEAT POINTER
   222 = 0062			PALNTS	EQU	$62	;PAL/NTSC FLAG
   223 = 0063			LOGCOL	EQU	$63	;COL IN LOGICAL LINE
   224 = 0064			ADRESS	EQU	$64	;TEMP STORAGE
   225 = 0066			MLTEMP	EQU	$66	;TEMP STORAGE
   226 = 0068			SAVADR	EQU	$68	;TEMP STORAGE
   227 = 006A			RAMTOP	EQU	$6A	;AVAILABLE RAM PAGES
   228 = 006B			BUFCNT	EQU	$6B	;BUFFER COUNT
   229 = 006C			BUFSTR	EQU	$6C	;EDITOR GETCH POINTR
   230 = 006E			BITMSK	EQU	$6E	;BIT MASK
   231 = 006F			SHFAMT	EQU	$6F	;PIXEL JUSTIFICATION
   232 = 0070			ROWAC 	EQU	$70	;ROW ACCUMULATOR
   233 = 0072			COLAC 	EQU	$72	;COLUMN ACCUMULATOR
   234 = 0074			ENDPT 	EQU	$74	;LINE LENGTH
   235 = 0076			DELTAR	EQU	$76	;DELTA ROW
   236 = 0077			DELTAC	EQU	$77	;DELTA COLUMN
   237 = 0079			KEYDEF	EQU	$79	;KEY DEFEAT POINTER
   238 = 007B			SWPFLG	EQU	$7B	;SPLIT SCN CURS CNTL
   239 = 007C			HOLDCH	EQU	$7C	;KB CHAR TEMP HOLD
   240 = 007D			INSDAT	EQU	$7D	;TEMP STORAGE
   241 = 007E			COUNTR	EQU	$7E	;DRAW ITERATION CNT
   242 				;
   243 				; 80-FF ARE RESERVED FOR USER
   244 				;
   245 				; NOTE: SEE FLOATING POINT
   246 				; SUBROUTINE AREA FOR ZERO
   247 				; PAGE CELLS
   248 				;
   249 				; PAGE 1 - HARDWARE STACK
   250 				;
   251 				; PAGE TWO RAM ASSIGNMENTS
   252 				;
   253 = 0200			VDSLST	EQU	$0200	;DSP LIST NMI VECTOR
   254 = 0202			VPRCED	EQU	$0202	;PROCEED IRQ VECTOR
   255 = 0204			VINTER	EQU	$0204	;INTERUPT IRQ VECTOR
   256 = 0206			VBREAK	EQU	$0206	;BRK INST IRQ VECTOR
   257 = 0208			VKEYBD	EQU	$0208	;POKEY KB IRQ VECTOR
   258 = 020A			VSERIN	EQU	$020A	;POKEY INPUT RDY IRQ
   259 = 020C			VSEROR	EQU	$020C	;POKEY OUTPUT RDY
   260 = 020E			VSEROC	EQU	$020E	;POKEY OUTPUT DONE
   261 = 0210			VTIMR1	EQU	$0210	;POKEY TIMER 1 IRQ
   262 = 0212			VTIMR2	EQU	$0212	;POKEY TIMER 2 IRQ
   263 = 0214			VTIMR4	EQU	$0214	;POKEY TIMER 4 IRQ
   264 = 0216			VIMIRQ	EQU	$0216	;IMMED IRQ VECTOR
   265 = 0218			CDTMV1	EQU	$0218	;COUNT DOWN TIMER 1
   266 = 021A			CDTMV2	EQU	$021A	;COUNT DOWN TIMER 2
   267 = 021C			CDTMV3	EQU	$021C	;COUNT DOWN TIMER 3
   268 = 021E			CDTMV4	EQU	$021E	;COUNT DOWN TIMER 4
   269 = 0220			CDTMV5	EQU	$0220	;COUNT DOWN TIMER 5
   270 = 0222			VVBLKI	EQU	$0222	;IMM VBLK NMI VECTOR
   271 = 0224			VVBLKD	EQU	$0224	;DEF VBLK NMI VECTOR
   272 = 0226			CDTMA1	EQU	$0226	;CDTMV1 JSR ADDRESS
   273 = 0228			CDTMA2	EQU	$0228	;CDTMV2 JSR ADDRESS
   274 = 022A			CDTMF3	EQU	$022A	;CDTMV3 FLAG
   275 = 022B			SRTIMR	EQU	$022B	;SOFTWARE REPEAT TMR
   276 = 022C			CDTMF4	EQU	$022C	;CDTMV4 FLAG
   277 = 022D			INTEMP	EQU	$022D	;IAN'S TEMP
   278 = 022E			CDTMF5	EQU	$022E	;CDTMV5 FLAG
   279 = 022F			DMACTLS	EQU	$022F	;SAVE DMACTL REG
   280 = 0230			DLPTRS	EQU	$0230	;SAVE DISP LIST LO
   281 				;SDLSTH	EQU	$0231	;SAVE DISP LIST HI
   282 = 0232			SSKCTL	EQU	$0232	;SKCTL REGISTER RAM
   283 = 0233			LCOUNT	EQU	$0233	;LOADER TEMP
   284 = 0234			LPENH 	EQU	$0234	;LIGHT PEN HORIZONTAL
   285 = 0235			LPENV 	EQU	$0235	;LIGHT PEN VERTICAL
   286 = 0236			BRKKY 	EQU	$0236	;BREAK KEY VECTOR
   287 = 0238			RELADR	EQU	$0238	;LOADER REL ADDR
   288 = 023A			CDEVIC	EQU	$023A	;COMMAND BUFFER-DEV
   289 = 023B			CCOMND	EQU	$023B	;COMMAND BUFFER-CMND
   290 = 023C			CAUX1 	EQU	$023C	;COMMAND BUFFER AUX1
   291 = 023D			CAUX2 	EQU	$023D	;COMMAND BUFFER AUX2
   292 				;TEMP  	EQU	$023E	;TEMPORARY RAM CELL
   293 = 023F			ERRFLG	EQU	$023F	;DEVICE ERROR FLAG
   294 = 0240			DFLAGS	EQU	$0240	;DISK FLAGS(SECTOR1)
   295 = 0241			DBSECT	EQU	$0241	;# DISK BOOT SECTORS
   296 = 0242			BOOTAD	EQU	$0242	;DISK BOOT ADDRESS
   297 = 0244			COLDST	EQU	$0244	;COLDSTART FLAG 1=CS
   298 = 0245			RECLEN	EQU	$0245	;LOADER LENGTH
   299 = 0246			DSKTIM	EQU	$0246	;DISK TIME OUT REG
   300 = 026C			VSFLAG	EQU	$026C	;FINE SCROLL TEMP
   301 = 026D			KEYDIS	EQU	$026D	;KEY DISABLE FLAG
   302 = 026E			FINE  	EQU	$026E	;FINE SCROLL ENABLE(A1200)
   303 = 026F			GPRIOR	EQU	$026F	;GLOBAL PRIORITY
   304 = 0270			PADDL0	EQU	$0270	;POT 0 RAM CELL
   305 = 0271			PADDL1	EQU	$0271
   306 = 0272			PADDL2	EQU	$0272
   307 = 0273			PADDL3	EQU	$0273
   308 = 0278			STICK0	EQU	$0278	;JOYSTICK 0 RAM CELL
   309 = 0279			STICK1	EQU	$0279
   310 = 027C			PTRIG0	EQU	$027C	;PADDLE TRIGGER 0
   311 = 027D			PTRIG1	EQU	$027D
   312 = 027E			PTRIG2	EQU	$027E
   313 = 027F			PTRIG3	EQU	$027F
   314 = 0284			STRIG0	EQU	$0284	;JOYSTICK TRIGGER 0
   315 = 0285			STRIG1	EQU	$0285
   316 = 0288			HIBYTE	EQU	$0288	;LOADER
   317 = 0289			WMODE 	EQU	$0289	;CASSETTE R/W MODE
   318 = 028A			BLIM  	EQU	$028A	;CASSETTE RECORD SIZE
   319 = 028B			IMASK 	EQU	$028B
   320 = 028C			JVECK 	EQU	$028C	;JUMP VECTOR
   321 = 028E			NEWADR	EQU	$028E	;LOADER NEW ADDRESS
   322 = 0290			TXTROW	EQU	$0290	;TEXT ROWCRS
   323 = 0291			TXTCOL	EQU	$0291	;TEXT COLCRS
   324 = 0293			TINDEX	EQU	$0293	;TEXT INDEX
   325 = 0294			TXTMSC	EQU	$0294	;TEXT WINDOW MEM ADD
   326 = 0296			TXTOLD	EQU	$0296	;TEXT OLDROW & COL
   327 = 029C			CRETRY	EQU	$029C	;# COMMAND RETRIES
   328 = 029D			HOLD3 	EQU	$029D
   329 = 029E			SUBTMP	EQU	$029E
   330 = 029F			HOLD2 	EQU	$029F
   331 = 02A0			DMASK 	EQU	$02A0	;PIXEL LOCATION MASK
   332 = 02A1			TMPLBT	EQU	$02A1
   333 = 02A2			ESCFLG	EQU	$02A2	;ESCAPE FLAG
   334 = 02A3			TABMAP	EQU	$02A3	;TAB STOP MAP
   335 = 02B2			LOGMAP	EQU	$02B2 	;LINE START BIT MAP
   336 = 02B6			INVFLG	EQU	$02B6	;INVERSE VIDEO FLAG
   337 = 02B7			FILFLG	EQU	$02B7	;FILL FLAG FOR DRAW
   338 = 02B8			TMPROW	EQU	$02B8
   339 = 02B9			TMPCOL	EQU	$02B9
   340 = 02BB			SCRFLG	EQU	$02BB	;SET IF SCROLLING
   341 = 02BC			HOLD4 	EQU	$02BC	;TEMP USED BY DRAW
   342 = 02BD			DRETRY	EQU	$02BD	;# OF DEVICE RETRIES
   343 = 02BE			SHFLOK	EQU	$02BE	;SHIFT/CTL LOCK FLAG
   344 = 02BF			BOTSCR	EQU	$02BF	;BOTTOM OF SCREEN
   345 = 02C0			PCOLR0	EQU	$02C0	;P0 COLOR
   346 = 02C1			PCOLR1	EQU	$02C1	;P1 COLOR
   347 = 02C2			PCOLR2	EQU	$02C2	;P2 COLOR
   348 = 02C3			PCOLR3	EQU	$02C3	;P3 COLOR
   349 = 02C4			COLOR0	EQU	$02C4	;COLOR 0
   350 = 02C5			COLOR1	EQU	$02C5
   351 = 02C6			COLOR2	EQU	$02C6
   352 = 02C7			COLOR3	EQU	$02C7
   353 = 02C8			COLOR4	EQU	$02C8
   354 = 02C8			COLBAKS EQU COLOR4
   355 = 02C9			RUNADR	EQU	$02C9	;LOADER
   356 = 02CB			HIUSED	EQU	$02CB	;LOADER
   357 = 02CD			ZHIUSE	EQU	$02CD	;LOADER
   358 = 02CF			GBYTEA	EQU	$02CF	;LOADER
   359 = 02D1			LOADAD	EQU	$02D1	;LOADER
   360 = 02D3			ZLOADA	EQU	$02D3	;LOADER
   361 = 02D5			DSCTLN	EQU	$02D5	;DISK SECTOR LENGTH
   362 = 02D7			ACMISR	EQU	$02D7	;RESERVED
   363 = 02D9			KRPDEL	EQU	$02D9	;KEY REPEAT DELAY
   364 = 02DA			KEYREP	EQU	$02DA	;KEY REPEAT RATE(VBLANKS)
   365 = 02DB			NOCLIK	EQU	$02DB	;CLICK ENABLE/DISABLE
   366 = 02DC			HELPFG	EQU	$02DC	;HELP KEY FLAG
   367 = 02DD			DMASAV	EQU	$02DD	;DMA SAVE STATE
   368 = 02DE			PBPNT 	EQU	$02DE	;PRINT BUFFER POINTER
   369 = 02DF			PBUFSZ	EQU	$02DF	;PRINT BUFFER SIZE
   370 = 02E0			DOSRUN	EQU	$02E0	;DOS RUN/INIT ADDRESSES
   371 = 02E4			RAMSIZ	EQU	$02E4	;RAM SIZE-HIGH BYTE
   372 = 02E5			MEMTOP	EQU	$02E5	;TOP OF AVAIL MEMORY
   373 = 02E7			MEMLO 	EQU	$02E7	;BOTTOM OF AVAIL MEM
   374 = 02E9			HNDLOD	EQU	$02E9	;POLL FLAG (1200)
   375 = 02EA			DVSTAT	EQU	$02EA	;STATUS BUFFER
   376 = 02EE			CBAUDL	EQU	$02EE	;CASSETTE BAUD RATE
   377 = 02EF			CBAUDH	EQU	$02EF
   378 = 02F0			CRSINH	EQU	$02F0	;CURSOR INHIBIT 0=ON
   379 = 02F1			KEYDEL	EQU	$02F1	;KEY DELAY
   380 = 02F2			CH1	    EQU	$02F2	;PRIOR KB CHAR CODE
   381 = 02F3			CHACT 	EQU	$02F3	;CHACTL REGISTER RAM
   382 = 02F4			CHBAS 	EQU	$02F4	;CHBAS REGISTER RAM
   383 = 02F5			NEWROW	EQU	$02F5	;POINT DRAW GOES TO
   384 = 02F6			NEWCOL	EQU	$02F6
   385 = 02F8			ROWINC	EQU	$02F8	;ROW INCREMENT VALUE
   386 = 02F9			COLINC	EQU	$02F9	;COL INCREMENT VALUE
   387 = 02FA			CHAR  	EQU	$02FA	;INTERNAL CHAR CODE
   388 = 02FB			ATACHR	EQU	$02FB	;ATASCII CHARACTER
   389 = 02FC			CHKEY  	EQU	$02FC	;KB CHAR CODE (FIFO)
   390 = 02FD			FILDAT	EQU	$02FD	;RIGHT FILL DATA
   391 = 02FE			DSPFLG	EQU	$02FE	;DISPLAY FLAG
   392 = 02FF			SSFLAG	EQU	$02FF	;START/STOP FLAG
   393 				;
   394 				; PAGE THREE RAM ASSIGNMENTS
   395 				;
   396 = 0300			DDEVIC	EQU	$0300	;BUS I.D. NUMBER
   397 = 0301			DUNIT 	EQU	$0301	;UNIT NUMBER
   398 = 0302			DCOMND	EQU	$0302	;BUS COMMAND
   399 = 0303			DSTATS	EQU	$0303	;COMMAND TYPE/STATUS
   400 = 0304			DBUFLO	EQU	$0304	;DATA BUFFER LO BYTE
   401 = 0305			DBUFHI	EQU	$0305	;DATA BUFFER HI BYTE
   402 = 0306			DTIMLO	EQU	$0306	;DEVICE TIMEOUT SECS
   403 = 0307			DUNUSE	EQU	$0307	;UNUSED BYTE
   404 = 0308			DBYTLO	EQU	$0308	;# OF BYTES XFERRED
   405 = 0309			DBYTHI	EQU	$0309
   406 = 030A			DAUX1 	EQU	$030A	;COMMAND AUX BYTE 1
   407 = 030B			DAUX2 	EQU	$030B	;COMMAND AUX BYTE 2
   408 = 030C			TIMER1	EQU	$030C	;INITIAL TIMER VALUE
   409 = 030E			JMPERS	EQU	$030E	;OPTIONS (1200)
   410 = 030F			CASFLG	EQU	$030F	;CASSETE MODE IF SET
   411 = 0310			TIMER2	EQU	$0310	;FINAL TIMER VALUE
   412 				;TEMP1 	EQU	$0312	;TEMP STORAGE
   413 				;TEMP2 	EQU	$0313	;TEMP STORAGE
   414 = 0314			PTIMOT	EQU	$0314	;PRINTER TIMEOUT REG
   415 				;TEMP3 	EQU	$0315	;TEMP STORAGE
   416 = 0316			SAVIO 	EQU	$0316	;SAVE SERIAL IN DATA
   417 = 0317			TIMFLG	EQU	$0317	;TIMEOUT FLAG C BAUD
   418 = 0318			STACKP	EQU	$0318	;SIO STACK PTR SAVE
   419 = 0319			TSTAT 	EQU	$0319	;TEMP STATUS HOLDER
   420 = 031A			HATABS	EQU	$031A	;HANDLER ADDR TABLE
   421 = 033D			PUPBT1	EQU	$033D	;POWER/UP RESET
   422 = 033E			PUPBT2	EQU	$033E
   423 = 033F			PUPBT3	EQU	$033F
   424 = 0340			ICHID 	EQU	$0340	;HANDLER INDEX #
   425 = 0341			ICDNO 	EQU	$0341	;DEVICE NUMBER
   426 = 0342			ICCOM 	EQU	$0342	;COMMAND CODE
   427 = 0343			ICSTA 	EQU	$0343	;STATUS
   428 = 0344			ICBAL 	EQU	$0344	;BUFFER ADDR LO BYTE
   429 = 0345			ICBAH 	EQU	$0345	;BUFFER ADDR HI BYTE
   430 = 0346			ICPTL 	EQU	$0346	;PUT ROUTINE ADDR-1
   431 = 0347			ICPTH 	EQU	$0347
   432 = 0348			ICBLL 	EQU	$0348	;BUFFER LENGTH LO
   433 = 0349			ICBLH 	EQU	$0349	;BUFFER LENGTH HI
   434 = 034A			ICAX1 	EQU	$034A	;AUX BYTE 1
   435 = 034B			ICAX2 	EQU	$034B	;AUX BYTE 2
   436 = 034C			ICSPR 	EQU	$034C 	;SPARE BYTES
   437 = 03C0			PRNBUF	EQU	$03C0	;PRINTER BUFFER (40 BYTES)
   438 = 03E8			SUPERF	EQU	$03E8	;SCREEN EDITOR
   439 = 03E9			CKEY  	EQU	$03E9	;START KEY FLAG
   440 = 03EA			CASSBT	EQU	$03EA	;CASSETTE BOOT FLAG
   441 = 03EB			CARTCK	EQU	$03EB	;CARTRIDGE CHECKSUM
   442 = 03ED			ACMVAR	EQU	$03ED	;RESERVED
   443 = 03F9			MINTLK	EQU	$03F9	;RESERVED
   444 = 03FA			GINTLK	EQU	$03FA	;CART INTERLOCK
   445 = 03FB			CHLINK	EQU	$03FB	;HANDLER CHAIN
   446 				;
   447 				; PAGE FOUR RAM ASSIGNMENTS
   448 				;
   449 = 03FD			CASBUF	EQU	$03FD	;CASSETTE BUFFER (131 BYTES)
   450 = 0480			USAREA	EQU	$0480	;USER AREA
   451 				;
   452 				; PAGE FIVE AND SIX ARE RESERVED
   453 				; FOR USER WORK SPACE
   454 				;
   455 				;    COLLEEN MNEMONICS
   456 				;
   457 				; ---------------------------------------------------------------------------
   458 = D200			POKEY 	EQU	$D200
   459 				; ---------------------------------------------------------------------------
   460 				;
   461 				; READ
   462 				;
   463 = D200			POT0  	EQU	POKEY+$00
   464 = D201			POT1  	EQU	POKEY+$01
   465 = D202			POT2  	EQU	POKEY+$02
   466 = D203			POT3  	EQU	POKEY+$03
   467 = D204			POT4  	EQU	POKEY+$04
   468 = D205			POT5  	EQU	POKEY+$05
   469 = D206			POT6  	EQU	POKEY+$06
   470 = D207			POT7  	EQU	POKEY+$07
   471 = D208			ALLPOT	EQU	POKEY+$08
   472 = D209			KBCODE	EQU	POKEY+$09
   473 = D20A			RANDOM	EQU	POKEY+$0a
   474 = D20B			POTGO 	EQU	POKEY+$0b
   475 = D20D			SERIN 	EQU	POKEY+$0d
   476 = D20E			IRQST 	EQU	POKEY+$0e
   477 = D20F			SKSTAT	EQU	POKEY+$0f
   478 				;
   479 				; WRITE
   480 				;
   481 = D200			AUDF1 	EQU	POKEY+$00
   482 = D201			AUDC1 	EQU	POKEY+$01
   483 = D202			AUDF2 	EQU	POKEY+$02
   484 = D203			AUDC2 	EQU	POKEY+$03
   485 = D204			AUDF3 	EQU	POKEY+$04
   486 = D205			AUDC3 	EQU	POKEY+$05
   487 = D206			AUDF4 	EQU	POKEY+$06
   488 = D207			AUDC4 	EQU	POKEY+$07
   489 = D208			AUDCTL	EQU	POKEY+$08
   490 = D209			STIMER	EQU	POKEY+$09
   491 = D20A			SKRES 	EQU	POKEY+$0a
   492 = D20D			SEROUT	EQU	POKEY+$0d
   493 = D20E			IRQEN 	EQU	POKEY+$0e
   494 = D20F			SKCTL 	EQU	POKEY+$0f
   495 				;
   496 				;
   497 				;
   498 				; ---------------------------------------------------------------------------
   499 = D000			GTIA  	EQU	$D000
   500 				; ---------------------------------------------------------------------------
   501 				;
   502 				; WRITE
   503 				;
   504 = D000			HPOSP0	EQU	GTIA+$00
   505 = D001			HPOSP1	EQU	GTIA+$01
   506 = D002			HPOSP2	EQU	GTIA+$02
   507 = D003			HPOSP3	EQU	GTIA+$03
   508 = D004			HPOSM0	EQU	GTIA+$04
   509 = D005			HPOSM1	EQU	GTIA+$05
   510 = D006			HPOSM2	EQU	GTIA+$06
   511 = D007			HPOSM3	EQU	GTIA+$07
   512 = D008			SIZEP0	EQU	GTIA+$08
   513 = D009			SIZEP1	EQU	GTIA+$09
   514 = D00A			SIZEP2	EQU	GTIA+$0a
   515 = D00B			SIZEP3	EQU	GTIA+$0b
   516 = D00C			SIZEM 	EQU	GTIA+$0c
   517 = D00D			GRAFP0	EQU	GTIA+$0d
   518 = D00E			GRAFP1	EQU	GTIA+$0e
   519 = D00F			GRAFP2	EQU	GTIA+$0f
   520 = D010			GRAFP3	EQU	GTIA+$10
   521 = D011			GRAFM 	EQU	GTIA+$11
   522 = D012			COLPM0	EQU	GTIA+$12
   523 = D013			COLPM1	EQU	GTIA+$13
   524 = D014			COLPM2	EQU	GTIA+$14
   525 = D015			COLPM3	EQU	GTIA+$15
   526 = D016			COLPF0	EQU	GTIA+$16
   527 = D017			COLPF1	EQU	GTIA+$17
   528 = D018			COLPF2	EQU	GTIA+$18
   529 = D019			COLPF3	EQU	GTIA+$19
   530 = D01A			COLBAK	EQU	GTIA+$1a
   531 = D01B			PRIOR 	EQU	GTIA+$1b
   532 = D01C			VDELAY	EQU	GTIA+$1c
   533 = D01D			GRACTL	EQU	GTIA+$1d
   534 = D01E			HITCLR	EQU	GTIA+$1e
   535 = D01F			CONSOL	EQU	GTIA+$1f
   536 				;
   537 				; READ
   538 				;
   539 = D000			M0PF  	EQU	GTIA+$00
   540 = D001			M1PF  	EQU	GTIA+$01
   541 = D002			M2PF  	EQU	GTIA+$02
   542 = D003			M3PF  	EQU	GTIA+$03
   543 = D004			P0PF  	EQU	GTIA+$04
   544 = D005			P1PF  	EQU	GTIA+$05
   545 = D006			P2PF  	EQU	GTIA+$06
   546 = D007			P3PF  	EQU	GTIA+$07
   547 = D008			M0PL  	EQU	GTIA+$08
   548 = D009			M1PL  	EQU	GTIA+$09
   549 = D00A			M2PL  	EQU	GTIA+$0a
   550 = D00B			M3PL  	EQU	GTIA+$0b
   551 = D00C			P0PL  	EQU	GTIA+$0c
   552 = D00D			P1PL  	EQU	GTIA+$0d
   553 = D00E			P2PL  	EQU	GTIA+$0e
   554 = D00F			P3PL  	EQU	GTIA+$0f
   555 = D010			TRIG0 	EQU	GTIA+$10
   556 = D011			TRIG1 	EQU	GTIA+$11
   557 = D012			TRIG2 	EQU	GTIA+$12
   558 = D013			TRIG3 	EQU	GTIA+$13
   559 = D014			PAL     EQU GTIA+$14
   560 				;
   561 				;
   562 				; ---------------------------------------------------------------------------
   563 = D400			ANTIC 	EQU	$D400
   564 				; ---------------------------------------------------------------------------
   565 				;
   566 = D400			DMACTL	EQU	ANTIC+$00
   567 = D401			CHACTL	EQU	ANTIC+$01
   568 = D402			DLPTR	EQU	ANTIC+$02
   569 				;DLISTH	EQU	ANTIC+$03
   570 = D404			HSCROL	EQU	ANTIC+$04
   571 = D405			VSCROL	EQU	ANTIC+$05
   572 = D407			PMBASE	EQU	ANTIC+$07
   573 = D409			CHBASE	EQU	ANTIC+$09
   574 = D40A			WSYNC 	EQU	ANTIC+$0a
   575 = D40B			VCOUNT	EQU	ANTIC+$0b
   576 = D40C			PENH  	EQU	ANTIC+$0c
   577 = D40D			PENV  	EQU	ANTIC+$0d
   578 = D40E			NMIEN 	EQU	ANTIC+$0e
   579 = D40F			NMIRES	EQU	ANTIC+$0f
   580 = D40F			NMIST 	EQU	ANTIC+$0f
   581 				;
   582 				;
   583 				; ---------------------------------------------------------------------------
   584 = D300			PIA   	EQU	$D300
   585 				; ---------------------------------------------------------------------------
   586 				;
   587 = D300			PORTA 	EQU	PIA+0
   588 = D301			PORTB 	EQU	PIA+1
   589 = D302			PACTL 	EQU	PIA+2
   590 = D303			PBCTL 	EQU	PIA+3
   591 				;
   592 				; ---------------------------------------------------------------------------
   593 				;                 Atari ANTIC chip display list equates
   594 				; ---------------------------------------------------------------------------
   595 				;
   596 = 0001			JUMP	EQU	$01	; display list jump instruction (3 byte)
   597 = 0041			JVB	    EQU	$41	; display list jump and wait for vblank instruction (3)
   598 				;
   599 = 0010			SCH	    EQU	$10	; display list horizontal scrolling
   600 = 0020			SCV	    EQU	$20	; display list vertical scrolling
   601 = 0040			LMS	    EQU	$40	; display list load memory scan instruction (3 byte)
   602 = 0080			DLII	EQU	$80	; display list interrupt instruction
   603 				;
   604 = 0000			SKIP1	EQU	$00	; display list skip 1 scan line instruction
   605 = 0010			SKIP2	EQU	$10	; display list skip 2 scan lines instruction
   606 = 0020			SKIP3	EQU	$20	; display list skip 3 scan lines instruction
   607 = 0030			SKIP4	EQU	$30	; display list skip 4 scan lines instruction
   608 = 0040			SKIP5	EQU	$40	; display list skip 5 scan lines instruction
   609 = 0050			SKIP6	EQU	$50	; display list skip 6 scan lines instruction
   610 = 0060			SKIP7	EQU	$60	; display list skip 7 scan lines instruction
   611 = 0070			SKIP8	EQU	$70	; display list skip 8 scan lines instruction
   612 				;
   613 = 0002			MODE2	EQU	$02	; display list mode 2
   614 = 0004			MODE4	EQU	$04	; display list mode 4
   615 = 0008			MODE8	EQU	$08	; display list mode 8
   616 = 000E			MODEE	EQU	$0E	; display list mode E
   617 = 000F			MODEF	EQU	$0F	; display list mode F
   618 				; ---------------------------------------------------------------------------
   619 				; ENUMS
   620 				; ---------------------------------------------------------------------------
   621
   622 				.enum   @dmactl
   623 = 0000			    blank   =    %00
   624 = 0001			    narrow  =    %01
   625 = 0002			    standard=    %10
   626 = 0003			    wide    =    %11
   627 = 0004			    missiles=   %100
   628 = 0008			    players =  %1000
   629 = 0010			    lineX1  = %10000
   630 = 0000			    lineX2  = %00000
   631 = 0020			    dma =    %100000
   632 				.ende
   633
   634 = 003F			scr48   = @dmactl(wide|dma|players|missiles|lineX1)
   635 = 003E			scr40   = @dmactl(standard|dma|players|missiles|lineX1)
   636 = 003D			scr32   = @dmactl(narrow|dma|players|missiles|lineX1)
   637
   638 				.enum   @pmcntl
   639 = 0001			    missiles=   %1
   640 = 0002			    players =  %10
   641 = 0004			    trigs   = %100
   642 				.ende
   643
   644 				.enum   @gtictl
   645 = 0000			    prior0  =        %0
   646 = 0001			    prior1  =        %1
   647 = 0002			    prior2  =       %10
   648 = 0004			    prior4  =      %100
   649 = 0008			    prior8  =     %1000
   650 = 0010			    ply5    =    %10000 ; Fifth Player Enable
   651 = 0020			    mlc     =   %100000 ; Multiple Color Player Enable
   652 = 0040			    mode9   = %01000000
   653 = 0080			    mode10  = %10000000
   654 = 00C0			    mode11  = %11000000
   655 				.ende
   656 				; ---------------------------------------------------------------------------
   657 				; KBCODEs
   658 				; ---------------------------------------------------------------------------
   659 				.enum @kbcode
   660 = 00FF			    _none  = 255
   661 = 001C			    _esc   = 28
   662 = 001F			    _1     = 31
   663 = 001E			    _2     = 30
   664 = 001A			    _3     = 26
   665 = 0018			    _4     = 24
   666 = 001D			    _5     = 29
   667 = 001B			    _6     = 27
   668 = 0033			    _7     = 51
   669 = 0035			    _8     = 53
   670 = 0030			    _9     = 48
   671 = 0032			    _0     = 50
   672 = 0036			    _lt    = 54
   673 = 0037			    _gt    = 55
   674 = 0034			    _del   = 52
   675 = 002C			    _tab   = 44
   676 = 002F			    _Q     = 47
   677 = 002E			    _W     = 46
   678 = 002A			    _E     = 42
   679 = 0028			    _R     = 40
   680 = 002D			    _T     = 45
   681 = 002B			    _Y     = 43
   682 = 000B			    _U     = 11
   683 = 000D			    _I     = 13
   684 = 0008			    _O     = 8
   685 = 000A			    _P     = 10
   686 = 000E			    _min   = 14
   687 = 000E			    _up    =  14  ; cursor function 
   688 = 000F			    _eq    = 15
   689 = 000F			    _down  = 15 ; cursor function
   690 = 000C			    _ret   = 12
   691 = 003F			    _A     = 63
   692 = 003E			    _S     = 62
   693 = 003A			    _D     = 58
   694 = 0038			    _F     = 56
   695 = 003D			    _G     = 61
   696 = 0039			    _H     = 57
   697 = 0001			    _J     = 1
   698 = 0005			    _K     = 5
   699 = 0000			    _L     = 0
   700 = 0002			    _semicolon = 2
   701 = 0006			    _plus  = 6
   702 = 0006			    _left  = 6  ; cursor function
   703 = 0007			    _asterisk = 7
   704 = 0007			    _right = 7 ; cursor function
   705 = 003C			    _caps  = 60
   706 = 0017			    _Z     = 23
   707 = 0016			    _X     = 22
   708 = 0012			    _C     = 18
   709 = 0010			    _V     = 16
   710 = 0015			    _B     = 21
   711 = 0024			    _N     = 36
   712 = 0025			    _M     = 37
   713 = 0020			    _comma = 32
   714 = 0022			    _dot   = 34
   715 = 0026			    _slash = 38
   716 = 0027			    _atari = 39
   717 = 0011			    _help  = 17
   718 = 0003			    _F1    = 3
   719 = 0004			    _F2    = 4
   720 = 0013			    _F3    = 19
   721 = 0014			    _F4    = 20
   722 = 0021			    _space = 33
   723 				.ende
   724 = 009B			EOL = $9b
   724 = 0080			TEMP_W
   724 = 0082			TEMP_B
   724 = 0083			DINOWALKPHASE
   724 = 0084			DINOSTATE
   724 = 0085			JUMPPHASE
    18 				    icl 'lib/MACRO.ASM'
Source: MACRO.ASM
     1 				;-------------------------------------
     2 				  .MACRO ROLW
     3 				     ROL :1
     4 				    ROL :1+1
     5 				  .ENDM
     6 				;-------------------------------------
     7 				  .MACRO ASLW
     8 				    ASL :1
     9 				    ROL :1+1
    10 				  .ENDM
    11 				;-------------------------------------
    12 				  .MACRO RORW
    13 				    ROR :1+1
    14 				    ROR :1
    15 				  .ENDM
    16 				;-------------------------------------
    17 				  .MACRO LSRW
    18 				    LSR :1+1
    19 				    ROR :1
    20 				  .ENDM
    21
    22 				;-------------------------------------
    23 				         .MACRO VMAIN
    24 				;	VMAIN #WORD,interrupt.vector
    25 				; interrupt.vector:
    26 				;    0 - VIMIRQ
    27 				;    1 - TIMCNT1
    28 				;    2 - TIMCNT2
    29 				;    3 - TIMCNT3
    30 				;    4 - TIMCNT4
    31 				;    5 - TIMCNT5
    32 				;    6 - VVBLKI
    33 				;    7 - VVBLKD
    34 				;    8 - TIMVEC1
    35 				;    9 - TIMVEC2
    36 				;	Initialises Vertical Blank Interrupts
    37 				;       (works only with system interrupts ON)
    38 				         LDY # <:1
    39 				         LDX # >:1
    40 				         LDA #:2
    41 				         JSR SETVBV
    42 				         .ENDM
    43 				;-------------------------------------
    44 				         .MACRO VDLI
    45 				;	VDLI #WORD
    46 				;	Initialises Display List Interrupts
    47 				         LDY # <:1
    48 				         LDX # >:1
    49 				         LDA #$C0
    50 				         STY $0200
    51 				         STX $0201
    52 				         STA NMIEN
    53 				         .ENDM
    54 				;-------------------------------------
    55 				        .MACRO VDL
    56 				;   VDL #WORD
    57 				;   Changes Display List addres
    58 				; and sets width of the screen
    59 				;    vdl dl,$01 - narrow screen (32 bytes)
    60 				;    vdl dl,$02 - normal screen (40 bytes)
    61 				;    vdl dl,$03 - wide screen   (48 bytes)
    62 				;       (works only with system interrupts ON)
    63 				
    64 				         .if %0=2
    65 				           lda dmactls
    66 				           and #$fc
    67 				           ora #%2
    68 				           sta dmactls
    69 				         .endif
    70 				
    71 				         LDA # <%1
    72 				         STA DLPTRS
    73 				         LDA # >%1
    74 				         STA DLPTRS+1
    75 				         .ENDM
    76 				;-------------------------------------
    77 				      .MACRO halt
    78 				?stop  
    79 				      lda RANDOM 
    80 				      and #$05
    81 				      sta COLBAK
    82 				      jmp ?stop
    83 				      .ENDM
    84 				;-------------------------------------
    85 				         .MACRO KEY
    86 				;	KEY
    87 				;	waits for releasing and pressing "any key"
    88 				         PHA
    89 				?CK1      LDA SKSTAT
    90 				         AND #$04
    91 				         BEQ ?CK1
    92 				?CK       LDA SKSTAT
    93 				         AND #$04
    94 				         BNE ?CK
    95 				         PLA
    96 				         .ENDM
    97 				;-------------------------------------
    98 					.MACRO WAIT
    99 				;	WAIT
   100 				;	waits one frame (1/50 s(PAL) or 1/60s(NTSC))
   101 				?ze	LDA VCOUNT
   102 					cmp #16	; if line<16 then wait for line>15 (long VBI protection)
   103 					bcc ?ze
   104 					sbc #10	; last lines correction
   105 				?wa	cmp VCOUNT
   106 					bcc ?wa
   107 				?wf	cmp VCOUNT
   108 					bcs ?wf
   109 					.ENDM
   110 				;-------------------------------------
   111 					.macro waitRTC
   112 					lda RTCLOK+2
   113 				?wa	cmp RTCLOK+2
   114 					beq ?wa
   115 					.endm
   116 				;-------------------------------------
   117 				    .macro negw
   118 				    ; negate the given word (0-a)
   119 				;-------------------------------------
   120 				        sec
   121 				        lda #$00
   122 				        sbc :1
   123 				        sta :1
   124 				        lda #$00
   125 				        sbc :1+1
   126 				        sta :1+1
   127 				    .endm
   128 				;-------------------------------------
   129 				    .macro randomize
   130 				    ;usage: randomize floor ceiling
   131 				    ;returns (in A) a random .byte between "floor" and "ceiling"
   132 				    .if :2 < :1
   133 				      .error "floor higher than ceiling"
   134 				    .endif
   135 				?rand
   136 				      lda random
   137 				      cmp #:2+1-:1 ;ceiling
   138 				      bcs ?rand
   139 				    .if %1>0    ; if floor = 0 - no add offset
   140 				      adc #:1
   141 				    .endif
   142 				    .endm
   143 				;-------------------------------------
   144 				    .macro phx
   145 				      txa
   146 				      pha
   147 				    .endm
   148 				;-------------------------------------
   149 				    .macro phy
   150 				      tya
   151 				      pha
   152 				    .endm
   153 				;-------------------------------------
   154 				    .macro plx
   155 				      pla
   156 				      tax
   157 				    .endm
   158 				;-------------------------------------
   159 				    .macro ply
   160 				      pla
   161 				      tay
   162 				    .endm
   163 				;-------------------------------------
   164 				    .macro txy
   165 				      txa
   166 				      tay
   167 				    .endm
   168 				;-------------------------------------
   169 				    .macro tyx
   170 				      tya
   171 				      tax
   172 				    .endm
   173 				;-------------------------------------
   174 				    .macro pause
   175 				      ;waits :1 number (byte) of frames
   176 				      ldx #:1
   177 				?PAUSELOOP
   178 				      wait
   179 				      dex
   180 				      bne ?PAUSELOOP
   181 				    .ENDM
   182
    19 				;---------------------------------------------------
    20 				    ; dark screean and BASIC off
    21 				    ORG $2000
    22 FFFF> 2000-2024> A9 00 +     mva #0 dmactls             ; dark screen
    23 2005 A9 FF 8D 01 D3	    mva #$ff portb
    24 				    ; and wait one frame :)
    25 200A F0 13200C		 wait                   
Macro: WAIT [Source: MACRO.ASM]
     3 200C AD 0B D4		?ze	LDA VCOUNT
     4 200F C9 10			cmp #16	; if line<16 then wait for line>15 (long VBI protection)
     5 2011 90 F9			bcc ?ze
     6 2013 E9 0A			sbc #10	; last lines correction
     7 2015 CD 0B D4		?wa	cmp VCOUNT
     8 2018 90 FB			bcc ?wa
     9 201A CD 0B D4		?wf	cmp VCOUNT
    10 201D B0 FB			bcs ?wf
Source: dino.asm
    seq:wait                   ; or waitRTC ?
    26 201F A9 FF 8D 01 D3	    mva #$ff portb        ; BASIC off
    27 2024 60			    rts
    28 02E2-02E3> 00 20		    ini $2000
    29 				;---------------------------------------------------
    30
    31 				    org $2000
    32 				;---------------------------------------------------
    33 				; 4 charsets for fine scroll
    34 2000			font1
    35 2000-2FFF> 00 00 00 00 +     ins 'artwork/dino1.fnt'  ; 1 charset
    36 = 2400			font2 = font1+$400
    37 2400 00 00 00 00 00 00 +     ins 'artwork/dino2.fnt'  ; 2 charset
    38 = 2800			font3 = font2+$400
    39 2800 00 00 00 00 00 00 +     ins 'artwork/dino3.fnt'  ; 3 charset
    40 = 2C00			font4 = font3+$400
    41 2C00 00 00 00 00 00 00 +     ins 'artwork/dino4.fnt'  ; 4 charset
    42 				    org font4+$400
    43 				; screen data
    44 				; SCR_HEIGHT lines 256bytes each
    45 3000			screen
    46 = 3000			    .ds $100*SCR_HEIGHT
    47 				; display list
    48 3800			GameDL
    49 3800-3CEF> 70 70 70 70 +     :10 .byte SKIP8   ; empty lines
    50
    51 				    .rept SCR_HEIGHT, #
    52 				      .BYTE MODE2+LMS+SCH   
    53 				LINE:1_ADDR
    54 				        .WORD SCREEN+$100*#
    55 				    .endr
Source: REPT
    52 380A 52			      .BYTE MODE2+LMS+SCH   
    52 380B			LINE0_ADDR
    52 380B 00 30		        .WORD SCREEN+$100*#
    52 380D 52			      .BYTE MODE2+LMS+SCH   
    52 380E			LINE1_ADDR
    52 380E 00 31		        .WORD SCREEN+$100*#
    52 3810 52			      .BYTE MODE2+LMS+SCH   
    52 3811			LINE2_ADDR
    52 3811 00 32		        .WORD SCREEN+$100*#
    52 3813 52			      .BYTE MODE2+LMS+SCH   
    52 3814			LINE3_ADDR
    52 3814 00 33		        .WORD SCREEN+$100*#
    52 3816 52			      .BYTE MODE2+LMS+SCH   
    52 3817			LINE4_ADDR
    52 3817 00 34		        .WORD SCREEN+$100*#
    52 3819 52			      .BYTE MODE2+LMS+SCH   
    52 381A			LINE5_ADDR
    52 381A 00 35		        .WORD SCREEN+$100*#
    52 381C 52			      .BYTE MODE2+LMS+SCH   
    52 381D			LINE6_ADDR
    52 381D 00 36		        .WORD SCREEN+$100*#
    52 381F 52			      .BYTE MODE2+LMS+SCH   
    52 3820			LINE7_ADDR
    52 3820 00 37		        .WORD SCREEN+$100*#
Source: dino.asm
    56 3822 41			    .byte JVB   
    57 3823 00 38		    .word GameDL
    58 				;---------------------------------------------------
    59 				; World table without dino
    60 3825			WorldTable
    61 3825 00 00 00 00 00 00 +     :WORLD_LENGTH .byte 0 ; ground
    62 				;---------------------------------------------------
    63 3865			FirstSTART
    64 3865 20 20 39		    jsr GenerateCharsets
    65 3868 20 E9 3B		    jsr SetStart
    66 386B 20 F5 3B		    jsr SetGameScreen
    67 386E A9 00 8D F0 3C	    mva #0 diff_level
    68 				    
    69 				    ; test only (some object in the world)
    70 3873 A9 01		    lda #1  ;bird0
    71 3875 8D 2F 38		    sta WorldTable+10
    72 3878 A9 04		    lda #4  ;cactus
    73 387A 8D 39 38		    sta WorldTable+20
    74 387D A9 84		    lda #4+$80  ; cactus (second char)
    75 387F 8D 3A 38		    sta WorldTable+21
    76 				    ;
    77 3882 A2 05		    ldx #5 ; position
    78 3884 A0 00		    ldy #0  ; shape
    79 3886 20 55 3A		    jsr ShowDino
    80 3889 A2 0A		    ldx #10 ; position
    81 388B A0 01		    ldy #1  ; shape
    82 388D 20 55 3A		    jsr ShowDino
    83 3890 A2 0F		    ldx #15 ; position
    84 3892 A0 02		    ldy #2  ; shape
    85 3894 20 55 3A		    jsr ShowDino
    86 3897 A2 14		    ldx #20 ; position
    87 3899 A0 03		    ldy #3  ; shape
    88 389B 20 55 3A		    jsr ShowDino
    89 389E A2 19		    ldx #25 ; position
    90 38A0 A0 04		    ldy #4  ; shape
    91 38A2 20 55 3A		    jsr ShowDino
    92 38A5 A9 50 8D 20 37	    mva #$50 screen+$700+32
    93 38AA			EndLoop
    94 38AA 20 85 39		    jsr WorldShift
    95 38AD 20 6C 39		    jsr WorldToScreen
    96 38B0 20 C2 3B		    jsr CheckJoy
    97 38B3 20 55 3A		    jsr ShowDino
    98 38B6			    waitRTC                   ; or waitRTC ?
Macro: WAITRTC [Source: MACRO.ASM]
     1 38B6 A5 14			lda RTCLOK+2
     2 38B8 C5 14		?wa	cmp RTCLOK+2
     3 38BA F0 FC			beq ?wa
Source: dino.asm
    99 				    ;key
   100 38BC A9 24 8D F4 02	    mva #>font2 chbas
   101 38C1			    waitRTC                   ; or waitRTC ?
Macro: WAITRTC [Source: MACRO.ASM]
     1 38C1 A5 14			lda RTCLOK+2
     2 38C3 C5 14		?wa	cmp RTCLOK+2
     3 38C5 F0 FC			beq ?wa
Source: dino.asm
   102 38C7 A9 03 8D 04 D4	    mva #3 hscrol
   103 38CC			    waitRTC                   ; or waitRTC ?
Macro: WAITRTC [Source: MACRO.ASM]
     1 38CC A5 14			lda RTCLOK+2
     2 38CE C5 14		?wa	cmp RTCLOK+2
     3 38D0 F0 FC			beq ?wa
Source: dino.asm
   104 				    ;key
   105 38D2 A9 28 8D F4 02	    mva #>font3 chbas
   106 38D7			    waitRTC                   ; or waitRTC ?
Macro: WAITRTC [Source: MACRO.ASM]
     1 38D7 A5 14			lda RTCLOK+2
     2 38D9 C5 14		?wa	cmp RTCLOK+2
     3 38DB F0 FC			beq ?wa
Source: dino.asm
   107 38DD A9 02 8D 04 D4	    mva #2 hscrol
   108 38E2			    waitRTC                   ; or waitRTC ?
Macro: WAITRTC [Source: MACRO.ASM]
     1 38E2 A5 14			lda RTCLOK+2
     2 38E4 C5 14		?wa	cmp RTCLOK+2
     3 38E6 F0 FC			beq ?wa
Source: dino.asm
   109 				    ;key
   110 38E8 A9 2C 8D F4 02	    mva #>font4 chbas
   111 38ED			    waitRTC                   ; or waitRTC ?
Macro: WAITRTC [Source: MACRO.ASM]
     1 38ED A5 14			lda RTCLOK+2
     2 38EF C5 14		?wa	cmp RTCLOK+2
     3 38F1 F0 FC			beq ?wa
Source: dino.asm
   112 38F3 A9 01 8D 04 D4	    mva #1 hscrol
   113 38F8			    waitRTC                   ; or waitRTC ?
Macro: WAITRTC [Source: MACRO.ASM]
     1 38F8 A5 14			lda RTCLOK+2
     2 38FA C5 14		?wa	cmp RTCLOK+2
     3 38FC F0 FC			beq ?wa
Source: dino.asm
   114 				    ;key
   115 38FE 20 C7 39		    jsr Animate
   116 3901 A9 20 8D F4 02	    mva #>font1 chbas
   117 3906			    waitRTC                   ; or waitRTC ?
Macro: WAITRTC [Source: MACRO.ASM]
     1 3906 A5 14			lda RTCLOK+2
     2 3908 C5 14		?wa	cmp RTCLOK+2
     3 390A F0 FC			beq ?wa
Source: dino.asm
   118 390C A9 04 8D 04 D4	    mva #4 hscrol
   119 3911 4C AA 38		    jmp EndLoop
   120 3914			    halt
Macro: HALT [Source: MACRO.ASM]
     1 3914			?stop  
     2 3914 AD 0A D2		      lda RANDOM 
     3 3917 29 05		      and #$05
     4 3919 8D 1A D0		      sta COLBAK
     5 391C 4C 14 39		      jmp ?stop
Source: dino.asm
   121 391F 60			    rts
   122
   123 				;-----------------------------------------------
   124 				; Generation of character sets 2,3 and 4 of 1
   125 				; By copying and horizontal shift dino
   126 				;-----------------------------------------------
   127 3920			.proc GenerateCharsets
   128 				    ; copy charset 1 to 2,3 and 4 (but not dino chars)
   129 3920 A0 00		    ldy #0
   130 3922			CopyLoop
   131 3922 B9 00 20		    lda font1,y
   132 3925 99 00 24		    sta font2,y
   133 3928 99 00 28		    sta font3,y
   134 392B 99 00 2C		    sta font4,y
   135 392E B9 00 22		    lda font1+$200,y
   136 3931 99 00 26		    sta font2+$200,y
   137 3934 99 00 2A		    sta font3+$200,y
   138 3937 99 00 2E		    sta font4+$200,y
   139 393A B9 00 23		    lda font1+$300,y
   140 393D 99 00 27		    sta font2+$300,y
   141 3940 99 00 2B		    sta font3+$300,y
   142 3943 99 00 2F		    sta font4+$300,y
   143 3946 C8			    iny
   144 3947 D0 D9		    bne CopyLoop
   145 				    
   146 3949 60			    rts
   147 				.endp
   148 				;-----------------------------------------------
   149 394A			.proc ClearWorld
   150 394A A0 3F		    ldy #WORLD_LENGTH-1 ; world size
   151 394C A9 00		    lda #0  ; ground
   152 394E 99 25 38		@   sta WorldTable,y
   153 3951 88			    dey
   154 3952 10 FA		    bpl @-
   155 3954 60			    rts
   156 				.endp
   157 3955			.proc ClearScreen
   158 3955 A0 40		    ldy #WORLD_LENGTH ; TODO: shouldn't be -1?
   159 3957 A9 00		    lda #0
   160 3959			ClearLoop
   161 3959 99 00 37		    sta screen+$700,y
   162 395C 99 00 36		    sta screen+$600,y
   163 395F 99 00 35		    sta screen+$500,y
   164 3962 99 00 34		    sta screen+$400,y
   165 3965 99 00 33		    sta screen+$300,y
   166 3968 88			    dey
   167 3969 10 EE		    bpl ClearLoop
   168 396B 60			    rts
   169 				.endp
   170 				;-----------------------------------------------
   171 396C			.proc WorldToScreen
   172 396C 20 55 39		    jsr ClearScreen
   173 396F A2 00		    ldx #0  ; start position
   174 3971 86 82		    stx temp_b
   175 3973			ToScreenLoop
   176 3973 BD 25 38		    lda WorldTable,x
   177 3976 30 04		    bmi NothingToDraw
   178 3978 A8			    tay
   179 3979 20 FA 39		    jsr ShowObject
   180 397C			NothingToDraw
   181 397C E6 82		    inc temp_b
   182 397E A6 82		    ldx temp_b
   183 3980 E0 40		    cpx #WORLD_LENGTH
   184 3982 D0 EF		    bne ToScreenLoop
   185 3984 60			    rts
   186 				.endp
   187 				;-----------------------------------------------
   188 3985			.proc WorldShift
   189 3985 A0 00		    ldy #0
   190 3987			Shift
   191 3987 B9 26 38		    lda WorldTable+1,y
   192 398A 99 25 38		    sta WorldTable,y
   193 398D C8			    iny
   194 398E C0 3F		    cpy #WORLD_LENGTH-1
   195 3990 D0 F5		    bne Shift
   196 3992 A9 00		    lda #0  ;ground
   197 3994 99 25 38		    sta WorldTable,y
   198 				    ; now we can insert random object to world end
   199 				    
   200 				    ; check if there is enough of the gap between obstacles
   201 				    
   202 				    ; get the gap for the given difficulty level
   203 3997 AE F0 3C		    ldx diff_level
   204 399A A9 40		    lda #WORLD_LENGTH
   205 399C 38			    sec
   206 399D FD E0 3C		    sbc diff_object_gap,x
   207 39A0 AA			    tax 
   208
   209 				    ; is there a gap?
   210 				@
   211 39A1 BD 25 38		    lda WorldTable,x
   212 39A4 D0 20		    bne noInsert
   213 39A6 E8			    inx
   214 39A7 E0 40		    cpx #WORLD_LENGTH
   215 39A9 D0 F6		    bne @-
   216 				    ;all zeroes
   217 39AB			insertObject
   218 39AB AD 0A D2		    lda RANDOM
   219 39AE 29 01		    and #%00000001  ; insert 50/50
   220 39B0 F0 14		    beq noInsert
   221 39B2			    randomize 8 10  ; cactuses
Macro: RANDOMIZE [Source: MACRO.ASM]
     6 39B2			?rand
     7 39B2 AD 0A D2		      lda random
     8 39B5 C9 03		      cmp #10+1-8 ;ceiling
     9 39B7 B0 F9		      bcs ?rand
    11 39B9 69 08		      adc #8
Source: dino.asm
   222 39BB 8D 63 38		    sta WorldTable+WORLD_LENGTH-2
   223 39BE 09 80		    ora #$80
   224 39C0 8D 64 38		    sta WorldTable+WORLD_LENGTH-1
   225 39C3 EE F0 3C		    inc diff_level
   226 				    
   227 				    
   228 				    
   229 39C6			noInsert    
   230 39C6 60			    rts
   231 				.endp
   232 				;-----------------------------------------------
   233 39C7			.proc Animate
   234 39C7 A0 40		    ldy #WORLD_LENGTH
   235 39C9 B9 25 38		@   lda WorldTable,y
   236 39CC AA			    tax
   237 39CD 29 7F		    and #%01111111
   238 39CF F0 0A		    beq NoBird
   239 39D1 C9 08		    cmp #8 ; first cactus
   240 39D3 B0 06		    bcs NoBird
   241 				    ; then animate bird
   242 39D5 8A			    txa
   243 39D6 49 01		    eor #%0000001
   244 39D8 99 25 38		    sta WorldTable,y
   245 39DB			NoBird
   246 39DB 88			    dey
   247 39DC 10 EB		    bpl @-
   248 				    ; animate Dino
   249 39DE A5 83		    lda DinoWalkPhase
   250 39E0 49 01		    eor #%00000001
   251 39E2 85 83		    sta DinoWalkPhase
   252 				    ; jump
   253 39E4 A5 84		    lda DinoState
   254 39E6 C9 04		    cmp #4  ; jump state
   255 39E8 D0 0F		    bne NoJump
   256 39EA A5 85		    lda JumpPhase
   257 39EC C9 06		    cmp #6  ; max jump phase
   258 39EE F0 03		    beq EndJump
   259 39F0 E6 85		    inc JumpPhase
   260 39F2 60			    rts
   261 39F3			EndJump
   262 39F3 A9 00		    lda #0
   263 39F5 85 85		    sta JumpPhase
   264 39F7 85 84		    sta DinoState
   265 39F9			NoJump
   266 39F9 60			    rts
   267 				.endp
   268 				;-----------------------------------------------
   269 				; Show Object on screen
   270 				; X - y position
   271 				; Y - shape nr
   272 				;-----------------------------------------------
   273 39FA			.proc ShowObject
   274 39FA B9 CA 3C		    lda ShapesTableL,y
   275 39FD 85 80		    sta temp_w
   276 39FF B9 D5 3C		    lda ShapesTableH,y
   277 3A02 85 81		    sta temp_w+1
   278 3A04 A0 00		    ldy #0
   279 3A06			ObjectLoop
   280 3A06 B1 80		    lda (temp_w),y
   281 3A08 30 03		    bmi @+
   282 3A0A 9D 00 34		    sta screen+$400,x
   283 3A0D 18 A5 80 69 02 85 + @   adw temp_w #2
   284 3A18 B1 80		    lda (temp_w),y
   285 3A1A 30 03		    bmi @+
   286 3A1C 9D 00 35		    sta screen+$500,x
   287 3A1F 18 A5 80 69 02 85 + @   adw temp_w #2
   288 3A2A B1 80		    lda (temp_w),y
   289 3A2C 30 03		    bmi @+
   290 3A2E 9D 00 36		    sta screen+$600,x
   291 3A31 18 A5 80 69 02 85 + @   adw temp_w #2
   292 3A3C B1 80		    lda (temp_w),y
   293 3A3E 30 03		    bmi @+
   294 3A40 9D 00 37		    sta screen+$700,x
   295 3A43 38 A5 80 E9 06 85 + @   sbw temp_w #6
   296 3A4E E8			    inx
   297 3A4F C8			    iny
   298 3A50 C0 02		    cpy #2  ; object width
   299 3A52 D0 B2		    bne ObjectLoop
   300 3A54 60			    rts
   301 				.endp
   302 				;-----------------------------------------------
   303 				; Show Dino on screen (test)
   304 				;-----------------------------------------------
   305 3A55			.proc ShowDino
   306 3A55 A2 05		    ldx #5 ; position
   307 3A57 A5 84		    lda DinoState
   308 3A59 05 83		    ora DinoWalkPhase  ; shape
   309 3A5B A8			    tay
   310 3A5C B9 6E 3C		    lda DinoShapesTableL,y
   311 3A5F 85 80		    sta temp_w
   312 3A61 B9 74 3C		    lda DinoShapesTableH,y
   313 3A64 85 81		    sta temp_w+1
   314 3A66 C0 04		    cpy #4  ; jump
   315 3A68 F0 55		    beq Jump
   316 3A6A C0 05		    cpy #5  ; jump
   317 3A6C F0 51		    beq Jump
   318 3A6E A0 00		    ldy #0
   319 3A70			DinoLoop
   320 3A70 B1 80		    lda (temp_w),y
   321 3A72 30 03		    bmi @+
   322 3A74 9D 00 34		    sta screen+$400,x
   323 3A77 18 A5 80 69 05 85 + @   adw temp_w #5
   324 3A82 B1 80		    lda (temp_w),y
   325 3A84 30 03		    bmi @+
   326 3A86 9D 00 35		    sta screen+$500,x
   327 3A89 18 A5 80 69 05 85 + @   adw temp_w #5
   328 3A94 B1 80		    lda (temp_w),y
   329 3A96 30 03		    bmi @+
   330 3A98 9D 00 36		    sta screen+$600,x
   331 3A9B 18 A5 80 69 05 85 + @   adw temp_w #5
   332 3AA6 B1 80		    lda (temp_w),y
   333 3AA8 30 03		    bmi @+
   334 3AAA 9D 00 37		    sta screen+$700,x
   335 3AAD 38 A5 80 E9 0F 85 + @   sbw temp_w #15
   336 3AB8 E8			    inx
   337 3AB9 C8			    iny
   338 3ABA C0 05		    cpy #5  ; dino width
   339 3ABC D0 B2		    bne DinoLoop
   340 3ABE 60			    rts
   341 3ABF			Jump
   342 3ABF A4 85		    ldy JumpPhase
   343 3AC1 B9 F1 3C		    lda DinoJumpTr,y
   344 3AC4 C9 02		    cmp #2
   345 3AC6 F0 58		    beq jPhase2
   346 3AC8 C9 03		    cmp #3
   347 3ACA D0 03 4C 71 3B	    jeq jPhase3
   348 3ACF			jPhase1
   349 3ACF A0 00		    ldy #0
   350 3AD1			DinoLoop1
   351 3AD1 B1 80		    lda (temp_w),y
   352 3AD3 30 03		    bmi @+
   353 3AD5 9D 00 33		    sta screen+$300,x
   354 3AD8 18 A5 80 69 05 85 + @   adw temp_w #5
   355 3AE3 B1 80		    lda (temp_w),y
   356 3AE5 30 03		    bmi @+
   357 3AE7 9D 00 34		    sta screen+$400,x
   358 3AEA 18 A5 80 69 05 85 + @   adw temp_w #5
   359 3AF5 B1 80		    lda (temp_w),y
   360 3AF7 30 03		    bmi @+
   361 3AF9 9D 00 35		    sta screen+$500,x
   362 3AFC 18 A5 80 69 05 85 + @   adw temp_w #5
   363 3B07 B1 80		    lda (temp_w),y
   364 3B09 30 03		    bmi @+
   365 3B0B 9D 00 36		    sta screen+$600,x
   366 3B0E 38 A5 80 E9 0F 85 + @   sbw temp_w #15
   367 3B19 E8			    inx
   368 3B1A C8			    iny
   369 3B1B C0 05		    cpy #5  ; dino width
   370 3B1D D0 B2		    bne DinoLoop1
   371 3B1F 60			    rts
   372 3B20			jPhase2
   373 3B20 A0 00		    ldy #0
   374 3B22			DinoLoop2
   375 3B22 B1 80		    lda (temp_w),y
   376 3B24 30 03		    bmi @+
   377 3B26 9D 00 32		    sta screen+$200,x
   378 3B29 18 A5 80 69 05 85 + @   adw temp_w #5
   379 3B34 B1 80		    lda (temp_w),y
   380 3B36 30 03		    bmi @+
   381 3B38 9D 00 33		    sta screen+$300,x
   382 3B3B 18 A5 80 69 05 85 + @   adw temp_w #5
   383 3B46 B1 80		    lda (temp_w),y
   384 3B48 30 03		    bmi @+
   385 3B4A 9D 00 34		    sta screen+$400,x
   386 3B4D 18 A5 80 69 05 85 + @   adw temp_w #5
   387 3B58 B1 80		    lda (temp_w),y
   388 3B5A 30 03		    bmi @+
   389 3B5C 9D 00 35		    sta screen+$500,x
   390 3B5F 38 A5 80 E9 0F 85 + @   sbw temp_w #15
   391 3B6A E8			    inx
   392 3B6B C8			    iny
   393 3B6C C0 05		    cpy #5  ; dino width
   394 3B6E D0 B2		    bne DinoLoop2
   395 3B70 60			    rts
   396 3B71			jPhase3
   397 3B71 A0 00		    ldy #0
   398 3B73			DinoLoop3
   399 3B73 B1 80		    lda (temp_w),y
   400 3B75 30 03		    bmi @+
   401 3B77 9D 00 31		    sta screen+$100,x
   402 3B7A 18 A5 80 69 05 85 + @   adw temp_w #5
   403 3B85 B1 80		    lda (temp_w),y
   404 3B87 30 03		    bmi @+
   405 3B89 9D 00 32		    sta screen+$200,x
   406 3B8C 18 A5 80 69 05 85 + @   adw temp_w #5
   407 3B97 B1 80		    lda (temp_w),y
   408 3B99 30 03		    bmi @+
   409 3B9B 9D 00 33		    sta screen+$300,x
   410 3B9E 18 A5 80 69 05 85 + @   adw temp_w #5
   411 3BA9 B1 80		    lda (temp_w),y
   412 3BAB 30 03		    bmi @+
   413 3BAD 9D 00 34		    sta screen+$400,x
   414 3BB0 38 A5 80 E9 0F 85 + @   sbw temp_w #15
   415 3BBB E8			    inx
   416 3BBC C8			    iny
   417 3BBD C0 05		    cpy #5  ; dino width
   418 3BBF D0 B2		    bne DinoLoop3
   419 3BC1 60			    rts
   420 				.endp
   421 				;-----------------------------------------------
   422 3BC2			.proc CheckJoy
   423 3BC2 A5 84		    lda DinoState
   424 3BC4 C9 04		    cmp #4  ; jump state
   425 3BC6 F0 12		    beq NoChange
   426 3BC8 AD 78 02		    lda STICK0
   427 3BCB 29 02		    and #%00000010  ; down
   428 3BCD F0 15		    beq Down
   429 3BCF AD 78 02		    lda STICK0
   430 3BD2 29 01		    and #%00000001  ; up
   431 3BD4 F0 05		    beq Up
   432 				    ; no change state (temporary set to 0)
   433 3BD6 A9 00		    lda #0
   434 3BD8 85 84		    sta DinoState
   435 3BDA			NoChange
   436 3BDA 60			    rts
   437 3BDB A9 04		Up  lda #4
   438 3BDD 85 84		    sta DinoState
   439 3BDF A9 00		    lda #0
   440 3BE1 85 85		    sta JumpPhase
   441 3BE3 60			    rts
   442 3BE4			Down
   443 3BE4 A9 02		    lda #2
   444 3BE6 85 84		    sta DinoState
   445 3BE8 60			    rts
   446 				.endp
   447 				;-----------------------------------------------
   448 3BE9			.proc SetStart
   449 3BE9 20 4A 39		    jsr ClearWorld
   450 3BEC A9 00		    lda #0
   451 3BEE 85 83		    sta DinoWalkPhase
   452 3BF0 A9 00		    lda #0
   453 3BF2 85 84		    sta DinoState
   454 3BF4 60			    rts
   455 				.endp
   456 				;-----------------------------------------------
   457 3BF5			.proc SetGameScreen
   458 3BF5 A9 00 8D 30 02 A9 +     mwa #GameDL dlptrs
   459 3BFF A9 3E		    lda #%00111110  ; normal screen width, DL on, P/M on
   460 3C01 8D 2F 02		    sta dmactls
   461 3C04 A9 20 8D F4 02	    mva #>font1 chbas
   462 3C09 60			    rts
   463 				.endp
   464 				;--------------------------------------------------
   465 3C0A			    icl 'artwork/shapes.asm'
Source: shapes.asm
     1 				;   @com.wudsn.ide.asm.mainsourcefile=dino.asm
     2
     3 				    .IF *>0 ;this is a trick that prevents compiling this file alone
     4
     5 				; dno run
     6 3C0A			dino_run_0  ; anly '0' jumps
     7 3C0A FF 23 27 2B FF	    .by $ff, $23, $27, $2b, $ff ; '.   .'
     8 3C0F 20 24 28 2C FF	    .by $20, $24, $28, $2c, $ff ; ' ## .'
     9 3C14 21 25 29 FF FF	    .by $21, $25, $29, $ff, $ff ; '## ..'
    10 3C19 22 26 2A FF FF	    .by $22, $26, $2a, $ff, $ff ; '## ..'
    11 3C1E			dino_run_1
    12 3C1E FF 23 27 2B FF	    .by $ff, $23, $27, $2b, $ff ; '.   .'
    13 3C23 20 24 28 2C FF	    .by $20, $24, $28, $2c, $ff ; ' ## .'
    14 3C28 21 25 29 FF FF	    .by $21, $25, $29, $ff, $ff ; '## ..'
    15 3C2D 2D 2E 2F FF FF	    .by $2d, $2e, $2f, $ff, $ff ; '## ..'
    16 3C32			dino_run_2
    17 3C32 FF 23 27 2B FF	    .by $ff, $23, $27, $2b, $ff ; '.   .'
    18 3C37 20 24 28 2C FF	    .by $20, $24, $28, $2c, $ff ; ' ## .'
    19 3C3C 21 25 29 FF FF	    .by $21, $25, $29, $ff, $ff ; '## ..'
    20 3C41 30 31 32 FF FF	    .by $30, $31, $32, $ff, $ff ; '## ..'
    21 3C46			dino_crouch_1
    22 3C46 FF FF FF FF FF	    .by $ff, $ff, $ff, $ff, $ff ; '.....'
    23 3C4B FF FF FF FF FF	    .by $ff, $ff, $ff, $ff, $ff ; '.....'
    24 3C50 33 34 35 36 37	    .by $33, $34, $35, $36, $37 ; '#### '
    25 3C55 38 39 3A 3B 3C	    .by $38, $39, $3a, $3b, $3c ; '#### '
    26 3C5A			dino_crouch_2
    27 3C5A FF FF FF FF FF	    .by $ff, $ff, $ff, $ff, $ff ; '.....'
    28 3C5F FF FF FF FF FF	    .by $ff, $ff, $ff, $ff, $ff ; '.....'
    29 3C64 33 34 35 36 37	    .by $33, $34, $35, $36, $37 ; '#### '
    30 3C69 3D 3E 3F 3B 3C	    .by $3d, $3e, $3f, $3b, $3c ; '#### '
    31 3C6E			DinoShapesTableL
    32 3C6E 1E			    .by <dino_run_1
    33 3C6F 32			    .by <dino_run_2
    34 3C70 46			    .by <dino_crouch_1
    35 3C71 5A			    .by <dino_crouch_2
    36 3C72 0A			    .by <dino_run_0 ; jump
    37 3C73 0A			    .by <dino_run_0 ; jump
    38 3C74			DinoShapesTableH
    39 3C74 3C			    .by >dino_run_1
    40 3C75 3C			    .by >dino_run_2
    41 3C76 3C			    .by >dino_crouch_1
    42 3C77 3C			    .by >dino_crouch_2
    43 3C78 3C			    .by >dino_run_0 ; jump
    44 3C79 3C			    .by >dino_run_0 ; jump
    45 				; other objects
    46 3C7A			ground_0
    47 3C7A FF FF		    .by $ff, $ff    ; '..'
    48 3C7C FF FF		    .by $ff, $ff    ; '..'
    49 3C7E FF FF		    .by $ff, $ff    ; '..'
    50 3C80 52 52		    .by $52, $52    ; '##'
    51 3C82			bird_0
    52 3C82 FF FF		    .by $ff, $ff    ; '..'
    53 3C84 FF FF		    .by $ff, $ff    ; '..'
    54 3C86 40 41		    .by $40, $41    ; '##'
    55 3C88 52 52		    .by $52, $52    ; '##'
    56 3C8A			bird_1
    57 3C8A FF FF		    .by $ff, $ff    ; '..'
    58 3C8C 40 41		    .by $40, $41    ; '##'
    59 3C8E FF FF		    .by $ff, $ff    ; '..'
    60 3C90 52 52		    .by $52, $52    ; '##'
    61 3C92			bird_2
    62 3C92 40 41		    .by $40, $41    ; '##'
    63 3C94 FF FF		    .by $ff, $ff    ; '..'
    64 3C96 FF FF		    .by $ff, $ff    ; ''.'
    65 3C98 52 52		    .by $52, $52    ; '##'
    66 3C9A			bird_0a
    67 3C9A FF FF		    .by $ff, $ff    ; '..'
    68 3C9C FF FF		    .by $ff, $ff    ; '..'
    69 3C9E 42 43		    .by $42, $43    ; '##'
    70 3CA0 52 52		    .by $52, $52    ; '##'
    71 3CA2			bird_1a
    72 3CA2 FF FF		    .by $ff, $ff    ; '..'
    73 3CA4 42 43		    .by $42, $43    ; '##'
    74 3CA6 FF FF		    .by $ff, $ff    ; '..'
    75 3CA8 52 52		    .by $52, $52    ; '##'
    76 3CAA			bird_2a
    77 3CAA 42 43		    .by $42, $43    ; '##'
    78 3CAC FF FF		    .by $ff, $ff    ; '..'
    79 3CAE FF FF		    .by $ff, $ff    ; ''.'
    80 3CB0 52 52		    .by $52, $52    ; '##'
    81 3CB2			cactus_0
    82 3CB2 FF FF		    .by $ff, $ff    ; '..'
    83 3CB4 FF FF		    .by $ff, $ff    ; '..'
    84 3CB6 46 47		    .by $46, $47    ; '##'
    85 3CB8 44 45		    .by $44, $45    ; '##'
    86 3CBA			cactus_1
    87 3CBA FF FF		    .by $ff, $ff    ; '..'
    88 3CBC FF FF		    .by $ff, $ff    ; '..'
    89 3CBE 4A 4B		    .by $4a, $4b    ; '##'
    90 3CC0 48 49		    .by $48, $49    ; '##'
    91 3CC2			cactus_2
    92 3CC2 FF FF		    .by $ff, $ff    ; '..'
    93 3CC4 50 51		    .by $50, $51    ; '##'
    94 3CC6 4E 4F		    .by $4e, $4f    ; '##'
    95 3CC8 4C 4D		    .by $4c, $4d    ; '##'
    96
    97 3CCA			ShapesTableL
    98 3CCA 7A			    .by <ground_0
    99 3CCB 7A			    .by <ground_0
   100 3CCC 82			    .by <bird_0
   101 3CCD 9A			    .by <bird_0a
   102 3CCE 8A			    .by <bird_1
   103 3CCF A2			    .by <bird_1a
   104 3CD0 92			    .by <bird_2
   105 3CD1 AA			    .by <bird_2a
   106 3CD2 B2			    .by <cactus_0
   107 3CD3 BA			    .by <cactus_1
   108 3CD4 C2			    .by <cactus_2
   109 3CD5			ShapesTableH
   110 3CD5 3C			    .by >ground_0
   111 3CD6 3C			    .by >ground_0
   112 3CD7 3C			    .by >bird_0
   113 3CD8 3C			    .by >bird_0a
   114 3CD9 3C			    .by >bird_1
   115 3CDA 3C			    .by >bird_1a
   116 3CDB 3C			    .by >bird_2
   117 3CDC 3C			    .by >bird_2a
   118 3CDD 3C			    .by >cactus_0
   119 3CDE 3C			    .by >cactus_1
   120 3CDF 3C			    .by >cactus_2
   121 3CE0			diff_object_gap ; min distance between obstacles by difficulty level
   122 3CE0 14 13 12 11 10 0F +     :DIFF_LEVELS .by 20-#
   123 				;----------vars----------
   124 = 3CF0			diff_level  .ds 1
   125 3CF1-3CF6> 01 02 03 03 + DinoJumpTr  .by 1,2,3,3,2,1
   126 				.endif  ; .IF *>0
   466 				;--------------------------------------------------
   467
   468 02E0-02E1> 65 38		    run FirstSTART
