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-3D92> 70 70 70 70 +     :15 .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 380F 52			      .BYTE MODE2+LMS+SCH   
    52 3810			LINE0_ADDR
    52 3810 00 30		        .WORD SCREEN+$100*#
    52 3812 52			      .BYTE MODE2+LMS+SCH   
    52 3813			LINE1_ADDR
    52 3813 00 31		        .WORD SCREEN+$100*#
    52 3815 52			      .BYTE MODE2+LMS+SCH   
    52 3816			LINE2_ADDR
    52 3816 00 32		        .WORD SCREEN+$100*#
    52 3818 52			      .BYTE MODE2+LMS+SCH   
    52 3819			LINE3_ADDR
    52 3819 00 33		        .WORD SCREEN+$100*#
    52 381B 52			      .BYTE MODE2+LMS+SCH   
    52 381C			LINE4_ADDR
    52 381C 00 34		        .WORD SCREEN+$100*#
    52 381E 52			      .BYTE MODE2+LMS+SCH   
    52 381F			LINE5_ADDR
    52 381F 00 35		        .WORD SCREEN+$100*#
    52 3821 52			      .BYTE MODE2+LMS+SCH   
    52 3822			LINE6_ADDR
    52 3822 00 36		        .WORD SCREEN+$100*#
    52 3824 52			      .BYTE MODE2+LMS+SCH   
    52 3825			LINE7_ADDR
    52 3825 00 37		        .WORD SCREEN+$100*#
Source: dino.asm
    56 3827 41			    .byte JVB   
    57 3828 00 38		    .word GameDL
    58 				;---------------------------------------------------
    59 				; World table without dino
    60 382A			WorldTable
    61 382A 00 00 00 00 00 00 +     :WORLD_LENGTH .byte 0 ; ground
    62 				;---------------------------------------------------
    63 386A			FirstSTART
    64 386A 20 0D 39		    jsr GenerateCharsets
    65 386D 20 46 3C		    jsr SetStart
    66 3870 20 70 3C		    jsr SetGameScreen
    67 3873 A9 00 8D 93 3D	    mva #0 diff_level
    68 				    
    69 				    ; test only (some object in the world)
    70 3878 A9 01		    lda #1  ;bird0
    71 387A 8D 34 38		    sta WorldTable+10
    72 387D A9 04		    lda #4  ;cactus
    73 387F 8D 3E 38		    sta WorldTable+20
    74 3882 A9 84		    lda #4+$80  ; cactus (second char)
    75 3884 8D 3F 38		    sta WorldTable+21
    76 				    ;
    77 3887 A2 05		    ldx #5 ; position
    78 3889 A0 00		    ldy #0  ; shape
    79 388B 20 48 3A		    jsr ShowDino
    80 388E A2 0A		    ldx #10 ; position
    81 3890 A0 01		    ldy #1  ; shape
    82 3892 20 48 3A		    jsr ShowDino
    83 3895 A2 0F		    ldx #15 ; position
    84 3897 A0 02		    ldy #2  ; shape
    85 3899 20 48 3A		    jsr ShowDino
    86 389C A2 14		    ldx #20 ; position
    87 389E A0 03		    ldy #3  ; shape
    88 38A0 20 48 3A		    jsr ShowDino
    89 38A3 A2 19		    ldx #25 ; position
    90 38A5 A0 04		    ldy #4  ; shape
    91 38A7 20 48 3A		    jsr ShowDino
    92 38AA A9 50 8D 20 37	    mva #$50 screen+$700+32
    93 38AF			EndLoop
    94 				    ;lda #$32
    95 				    ;sta COLBAK
    96 38AF 20 5F 39		    jsr WorldToScreen
    97 38B2 20 48 3A		    jsr ShowDino
    98 				    ;lda #$5f
    99 				    ;sta COLBAK
   100 38B5 20 0D 3C		    jsr CheckJoy
   101 				    ;waitRTC                   ; or waitRTC ?
   102 				    ;key
   103 38B8 A9 24 8D F4 02	    mva #>font2 chbas
   104 38BD			    waitRTC                   ; or waitRTC ?
Macro: WAITRTC [Source: MACRO.ASM]
     1 38BD A5 14			lda RTCLOK+2
     2 38BF C5 14		?wa	cmp RTCLOK+2
     3 38C1 F0 FC			beq ?wa
Source: dino.asm
   105 38C3 A9 03 8D 04 D4	    mva #3 hscrol
   106 				    ;waitRTC                   ; or waitRTC ?
   107 				    ;key
   108 38C8 A9 28 8D F4 02	    mva #>font3 chbas
   109 38CD			    waitRTC                   ; or waitRTC ?
Macro: WAITRTC [Source: MACRO.ASM]
     1 38CD A5 14			lda RTCLOK+2
     2 38CF C5 14		?wa	cmp RTCLOK+2
     3 38D1 F0 FC			beq ?wa
Source: dino.asm
   110 38D3 A9 02 8D 04 D4	    mva #2 hscrol
   111 38D8 20 78 39		    jsr WorldShift  ; better place (flickering)
   112 				    ;waitRTC                   ; or waitRTC ?
   113 				    ;key
   114 38DB A9 2C 8D F4 02	    mva #>font4 chbas
   115 38E0			    waitRTC                   ; or waitRTC ?
Macro: WAITRTC [Source: MACRO.ASM]
     1 38E0 A5 14			lda RTCLOK+2
     2 38E2 C5 14		?wa	cmp RTCLOK+2
     3 38E4 F0 FC			beq ?wa
Source: dino.asm
   116 38E6 A9 01 8D 04 D4	    mva #1 hscrol
   117 				    ;waitRTC                   ; or waitRTC ?
   118 				    ;key
   119 38EB 20 BA 39		    jsr Animate
   120 38EE A9 20 8D F4 02	    mva #>font1 chbas
   121 38F3			    waitRTC                   ; or waitRTC ?
Macro: WAITRTC [Source: MACRO.ASM]
     1 38F3 A5 14			lda RTCLOK+2
     2 38F5 C5 14		?wa	cmp RTCLOK+2
     3 38F7 F0 FC			beq ?wa
Source: dino.asm
   122 38F9 A9 04 8D 04 D4	    mva #4 hscrol
   123 38FE 4C AF 38		    jmp EndLoop
   124 3901			    halt
Macro: HALT [Source: MACRO.ASM]
     1 3901			?stop  
     2 3901 AD 0A D2		      lda RANDOM 
     3 3904 29 05		      and #$05
     4 3906 8D 1A D0		      sta COLBAK
     5 3909 4C 01 39		      jmp ?stop
Source: dino.asm
   125 390C 60			    rts
   126
   127 				;-----------------------------------------------
   128 				; Generation of character sets 2,3 and 4 of 1
   129 				; By copying and horizontal shift dino
   130 				;-----------------------------------------------
   131 390D			.proc GenerateCharsets
   132 				    ; copy charset 1 to 2,3 and 4 (but not dino chars)
   133 390D A0 00		    ldy #0
   134 390F			CopyLoop
   135 390F B9 00 20		    lda font1,y
   136 3912 99 00 24		    sta font2,y
   137 3915 99 00 28		    sta font3,y
   138 3918 99 00 2C		    sta font4,y
   139 391B B9 00 22		    lda font1+$200,y
   140 391E 99 00 26		    sta font2+$200,y
   141 3921 99 00 2A		    sta font3+$200,y
   142 3924 99 00 2E		    sta font4+$200,y
   143 3927 B9 00 23		    lda font1+$300,y
   144 392A 99 00 27		    sta font2+$300,y
   145 392D 99 00 2B		    sta font3+$300,y
   146 3930 99 00 2F		    sta font4+$300,y
   147 3933 C8			    iny
   148 3934 D0 D9		    bne CopyLoop
   149 				    
   150 3936 60			    rts
   151 				.endp
   152 				;-----------------------------------------------
   153 3937			.proc ClearWorld
   154 3937 A0 3F		    ldy #WORLD_LENGTH-1 ; world size
   155 3939 A9 00		    lda #0  ; ground
   156 393B 99 2A 38		@   sta WorldTable,y
   157 393E 88			    dey
   158 393F 10 FA		    bpl @-
   159 3941 60			    rts
   160 				.endp
   161 3942			.proc ClearScreen
   162 3942 A0 2C		    ldy #44 ; visible screen len
   163 3944 A9 00		    lda #0
   164 3946			ClearLoop
   165 3946 99 00 37		    sta screen+$700,y
   166 3949 99 00 36		    sta screen+$600,y
   167 394C 99 00 35		    sta screen+$500,y
   168 394F 99 00 34		    sta screen+$400,y
   169 3952 99 00 33		    sta screen+$300,y
   170 3955 99 00 32		    sta screen+$200,y
   171 3958 99 00 31		    sta screen+$100,y
   172 395B 88			    dey
   173 395C D0 E8		    bne ClearLoop
   174 395E 60			    rts
   175 				.endp
   176 				;-----------------------------------------------
   177 395F			.proc WorldToScreen
   178 395F 20 42 39		    jsr ClearScreen
   179 3962 A2 00		    ldx #0  ; start position
   180 3964 86 82		    stx temp_b
   181 3966			ToScreenLoop
   182 3966 BD 2A 38		    lda WorldTable,x
   183 3969 30 04		    bmi NothingToDraw
   184 396B A8			    tay
   185 396C 20 ED 39		    jsr ShowObject
   186 396F			NothingToDraw
   187 396F E6 82		    inc temp_b
   188 3971 A6 82		    ldx temp_b
   189 3973 E0 40		    cpx #WORLD_LENGTH
   190 3975 D0 EF		    bne ToScreenLoop
   191 3977 60			    rts
   192 				.endp
   193 				;-----------------------------------------------
   194 3978			.proc WorldShift
   195 3978 A0 00		    ldy #0
   196 397A			Shift
   197 397A B9 2B 38		    lda WorldTable+1,y
   198 397D 99 2A 38		    sta WorldTable,y
   199 3980 C8			    iny
   200 3981 C0 3F		    cpy #WORLD_LENGTH-1
   201 3983 D0 F5		    bne Shift
   202 3985 A9 00		    lda #0  ;ground
   203 3987 99 2A 38		    sta WorldTable,y
   204 				    ; now we can insert random object to world end
   205 				    
   206 				    ; check if there is enough of the gap between obstacles
   207 				    
   208 				    ; get the gap for the given difficulty level
   209 398A AE 93 3D		    ldx diff_level
   210 398D A9 40		    lda #WORLD_LENGTH
   211 398F 38			    sec
   212 3990 FD 83 3D		    sbc diff_object_gap,x
   213 3993 AA			    tax 
   214
   215 				    ; is there a gap?
   216 				@
   217 3994 BD 2A 38		    lda WorldTable,x
   218 3997 D0 20		    bne noInsert
   219 3999 E8			    inx
   220 399A E0 40		    cpx #WORLD_LENGTH
   221 399C D0 F6		    bne @-
   222 				    ;all zeroes
   223 399E			insertObject
   224 399E AD 0A D2		    lda RANDOM
   225 39A1 29 01		    and #%00000001  ; insert 50/50
   226 39A3 F0 14		    beq noInsert
   227 39A5			    randomize 8 13  ; cactuses and hole
Macro: RANDOMIZE [Source: MACRO.ASM]
     6 39A5			?rand
     7 39A5 AD 0A D2		      lda random
     8 39A8 C9 06		      cmp #13+1-8 ;ceiling
     9 39AA B0 F9		      bcs ?rand
    11 39AC 69 08		      adc #8
Source: dino.asm
   228 39AE 8D 68 38		    sta WorldTable+WORLD_LENGTH-2
   229 39B1 09 80		    ora #$80
   230 39B3 8D 69 38		    sta WorldTable+WORLD_LENGTH-1
   231 39B6 EE 93 3D		    inc diff_level
   232 				    
   233 				    
   234 				    
   235 39B9			noInsert    
   236 39B9 60			    rts
   237 				.endp
   238 				;-----------------------------------------------
   239 39BA			.proc Animate
   240 39BA A0 40		    ldy #WORLD_LENGTH
   241 39BC B9 2A 38		@   lda WorldTable,y
   242 39BF AA			    tax
   243 39C0 29 7F		    and #%01111111
   244 39C2 F0 0A		    beq NoBird
   245 39C4 C9 08		    cmp #8 ; first cactus
   246 39C6 B0 06		    bcs NoBird
   247 				    ; then animate bird
   248 39C8 8A			    txa
   249 39C9 49 01		    eor #%0000001
   250 39CB 99 2A 38		    sta WorldTable,y
   251 39CE			NoBird
   252 39CE 88			    dey
   253 39CF 10 EB		    bpl @-
   254 				    ; animate Dino
   255 39D1 A5 83		    lda DinoWalkPhase
   256 39D3 49 01		    eor #%00000001
   257 39D5 85 83		    sta DinoWalkPhase
   258 				    ; jump
   259 39D7 A5 84		    lda DinoState
   260 39D9 C9 04		    cmp #4  ; jump state
   261 39DB D0 0F		    bne NoJump
   262 39DD A5 85		    lda JumpPhase
   263 39DF C9 07		    cmp #JumpLen  ; max jump phase
   264 39E1 F0 03		    beq EndJump
   265 39E3 E6 85		    inc JumpPhase
   266 39E5 60			    rts
   267 39E6			EndJump
   268 39E6 A9 00		    lda #0
   269 39E8 85 85		    sta JumpPhase
   270 39EA 85 84		    sta DinoState
   271 39EC			NoJump
   272 39EC 60			    rts
   273 				.endp
   274 				;-----------------------------------------------
   275 				; Show Object on screen
   276 				; X - y position
   277 				; Y - shape nr
   278 				;-----------------------------------------------
   279 39ED			.proc ShowObject
   280 39ED B9 65 3D		    lda ShapesTableL,y
   281 39F0 85 80		    sta temp_w
   282 39F2 B9 74 3D		    lda ShapesTableH,y
   283 39F5 85 81		    sta temp_w+1
   284 39F7 A0 00		    ldy #0
   285 39F9			ObjectLoop
   286 39F9 B1 80		    lda (temp_w),y
   287 39FB 30 03		    bmi @+
   288 39FD 9D 00 34		    sta screen+$400,x
   289 3A00 18 A5 80 69 02 85 + @   adw temp_w #2
   290 3A0B B1 80		    lda (temp_w),y
   291 3A0D 30 03		    bmi @+
   292 3A0F 9D 00 35		    sta screen+$500,x
   293 3A12 18 A5 80 69 02 85 + @   adw temp_w #2
   294 3A1D B1 80		    lda (temp_w),y
   295 3A1F 30 03		    bmi @+
   296 3A21 9D 00 36		    sta screen+$600,x
   297 3A24 18 A5 80 69 02 85 + @   adw temp_w #2
   298 3A2F B1 80		    lda (temp_w),y
   299 3A31 30 03		    bmi @+
   300 3A33 9D 00 37		    sta screen+$700,x
   301 3A36 38 A5 80 E9 06 85 + @   sbw temp_w #6
   302 3A41 E8			    inx
   303 3A42 C8			    iny
   304 3A43 C0 02		    cpy #2  ; object width
   305 3A45 D0 B2		    bne ObjectLoop
   306 3A47 60			    rts
   307 				.endp
   308 				;-----------------------------------------------
   309 				; Show Dino on screen (test)
   310 				;-----------------------------------------------
   311 3A48			.proc ShowDino
   312 3A48 A2 05		    ldx #5 ; position
   313 3A4A A5 84		    lda DinoState
   314 3A4C 05 83		    ora DinoWalkPhase  ; shape
   315 3A4E A8			    tay
   316 3A4F B9 E9 3C		    lda DinoShapesTableL,y
   317 3A52 85 80		    sta temp_w
   318 3A54 B9 EF 3C		    lda DinoShapesTableH,y
   319 3A57 85 81		    sta temp_w+1
   320 3A59 C0 04		    cpy #4  ; jump
   321 3A5B F0 55		    beq Jump
   322 3A5D C0 05		    cpy #5  ; jump
   323 3A5F F0 51		    beq Jump
   324 3A61 A0 00		    ldy #0
   325 3A63			DinoLoop
   326 3A63 B1 80		    lda (temp_w),y
   327 3A65 30 03		    bmi @+
   328 3A67 9D 00 34		    sta screen+$400,x
   329 3A6A 18 A5 80 69 05 85 + @   adw temp_w #5
   330 3A75 B1 80		    lda (temp_w),y
   331 3A77 30 03		    bmi @+
   332 3A79 9D 00 35		    sta screen+$500,x
   333 3A7C 18 A5 80 69 05 85 + @   adw temp_w #5
   334 3A87 B1 80		    lda (temp_w),y
   335 3A89 30 03		    bmi @+
   336 3A8B 9D 00 36		    sta screen+$600,x
   337 3A8E 18 A5 80 69 05 85 + @   adw temp_w #5
   338 3A99 B1 80		    lda (temp_w),y
   339 3A9B 30 03		    bmi @+
   340 3A9D 9D 00 37		    sta screen+$700,x
   341 3AA0 38 A5 80 E9 0F 85 + @   sbw temp_w #15
   342 3AAB E8			    inx
   343 3AAC C8			    iny
   344 3AAD C0 05		    cpy #5  ; dino width
   345 3AAF D0 B2		    bne DinoLoop
   346 3AB1 60			    rts
   347 3AB2			Jump
   348 3AB2 A4 85		    ldy JumpPhase
   349 3AB4 B9 94 3D		    lda DinoJumpTr,y
   350 3AB7 C9 02		    cmp #2
   351 3AB9 F0 5F		    beq jPhase2
   352 3ABB C9 03		    cmp #3
   353 3ABD D0 03 4C 6B 3B	    jeq jPhase3
   354 3AC2 C9 04		    cmp #4
   355 3AC4 D0 03 4C BC 3B	    jeq jPhase4
   356 3AC9			jPhase1
   357 3AC9 A0 00		    ldy #0
   358 3ACB			DinoLoop1
   359 3ACB B1 80		    lda (temp_w),y
   360 3ACD 30 03		    bmi @+
   361 3ACF 9D 00 33		    sta screen+$300,x
   362 3AD2 18 A5 80 69 05 85 + @   adw temp_w #5
   363 3ADD B1 80		    lda (temp_w),y
   364 3ADF 30 03		    bmi @+
   365 3AE1 9D 00 34		    sta screen+$400,x
   366 3AE4 18 A5 80 69 05 85 + @   adw temp_w #5
   367 3AEF B1 80		    lda (temp_w),y
   368 3AF1 30 03		    bmi @+
   369 3AF3 9D 00 35		    sta screen+$500,x
   370 3AF6 18 A5 80 69 05 85 + @   adw temp_w #5
   371 3B01 B1 80		    lda (temp_w),y
   372 3B03 30 03		    bmi @+
   373 3B05 9D 00 36		    sta screen+$600,x
   374 3B08 38 A5 80 E9 0F 85 + @   sbw temp_w #15
   375 3B13 E8			    inx
   376 3B14 C8			    iny
   377 3B15 C0 05		    cpy #5  ; dino width
   378 3B17 D0 B2		    bne DinoLoop1
   379 3B19 60			    rts
   380 3B1A			jPhase2
   381 3B1A A0 00		    ldy #0
   382 3B1C			DinoLoop2
   383 3B1C B1 80		    lda (temp_w),y
   384 3B1E 30 03		    bmi @+
   385 3B20 9D 00 32		    sta screen+$200,x
   386 3B23 18 A5 80 69 05 85 + @   adw temp_w #5
   387 3B2E B1 80		    lda (temp_w),y
   388 3B30 30 03		    bmi @+
   389 3B32 9D 00 33		    sta screen+$300,x
   390 3B35 18 A5 80 69 05 85 + @   adw temp_w #5
   391 3B40 B1 80		    lda (temp_w),y
   392 3B42 30 03		    bmi @+
   393 3B44 9D 00 34		    sta screen+$400,x
   394 3B47 18 A5 80 69 05 85 + @   adw temp_w #5
   395 3B52 B1 80		    lda (temp_w),y
   396 3B54 30 03		    bmi @+
   397 3B56 9D 00 35		    sta screen+$500,x
   398 3B59 38 A5 80 E9 0F 85 + @   sbw temp_w #15
   399 3B64 E8			    inx
   400 3B65 C8			    iny
   401 3B66 C0 05		    cpy #5  ; dino width
   402 3B68 D0 B2		    bne DinoLoop2
   403 3B6A 60			    rts
   404 3B6B			jPhase3
   405 3B6B A0 00		    ldy #0
   406 3B6D			DinoLoop3
   407 3B6D B1 80		    lda (temp_w),y
   408 3B6F 30 03		    bmi @+
   409 3B71 9D 00 31		    sta screen+$100,x
   410 3B74 18 A5 80 69 05 85 + @   adw temp_w #5
   411 3B7F B1 80		    lda (temp_w),y
   412 3B81 30 03		    bmi @+
   413 3B83 9D 00 32		    sta screen+$200,x
   414 3B86 18 A5 80 69 05 85 + @   adw temp_w #5
   415 3B91 B1 80		    lda (temp_w),y
   416 3B93 30 03		    bmi @+
   417 3B95 9D 00 33		    sta screen+$300,x
   418 3B98 18 A5 80 69 05 85 + @   adw temp_w #5
   419 3BA3 B1 80		    lda (temp_w),y
   420 3BA5 30 03		    bmi @+
   421 3BA7 9D 00 34		    sta screen+$400,x
   422 3BAA 38 A5 80 E9 0F 85 + @   sbw temp_w #15
   423 3BB5 E8			    inx
   424 3BB6 C8			    iny
   425 3BB7 C0 05		    cpy #5  ; dino width
   426 3BB9 D0 B2		    bne DinoLoop3
   427 3BBB 60			    rts
   428 3BBC			jPhase4
   429 3BBC A0 00		    ldy #0
   430 3BBE			DinoLoop4
   431 3BBE B1 80		    lda (temp_w),y
   432 3BC0 30 03		    bmi @+
   433 3BC2 9D 00 30		    sta screen,x
   434 3BC5 18 A5 80 69 05 85 + @   adw temp_w #5
   435 3BD0 B1 80		    lda (temp_w),y
   436 3BD2 30 03		    bmi @+
   437 3BD4 9D 00 31		    sta screen+$100,x
   438 3BD7 18 A5 80 69 05 85 + @   adw temp_w #5
   439 3BE2 B1 80		    lda (temp_w),y
   440 3BE4 30 03		    bmi @+
   441 3BE6 9D 00 32		    sta screen+$200,x
   442 3BE9 18 A5 80 69 05 85 + @   adw temp_w #5
   443 3BF4 B1 80		    lda (temp_w),y
   444 3BF6 30 03		    bmi @+
   445 3BF8 9D 00 33		    sta screen+$300,x
   446 3BFB 38 A5 80 E9 0F 85 + @   sbw temp_w #15
   447 3C06 E8			    inx
   448 3C07 C8			    iny
   449 3C08 C0 05		    cpy #5  ; dino width
   450 3C0A D0 B2		    bne DinoLoop4
   451 3C0C 60			    rts
   452 				.endp
   453 				;-----------------------------------------------
   454 3C0D			.proc CheckJoy
   455 3C0D A5 84		    lda DinoState
   456 3C0F C9 04		    cmp #4  ; jump state
   457 3C11 F0 24		    beq NoChange
   458 3C13 AD 78 02		    lda STICK0
   459 3C16 29 02		    and #%00000010  ; down
   460 3C18 F0 27		    beq Down
   461 3C1A AD 78 02		    lda STICK0
   462 3C1D 29 01		    and #%00000001  ; up
   463 3C1F F0 17		    beq Up
   464 				    ; check keyboard
   465 3C21 AD 0F D2		    lda SKSTAT
   466 3C24 C9 F7		    cmp #$f7    ; SHIFT
   467 3C26 F0 19		    beq Down
   468 3C28 C9 FF		    cmp #$ff
   469 3C2A F0 07		    beq Walk
   470 3C2C AD 09 D2		    lda kbcode
   471 3C2F C9 21		    cmp #@kbcode._space
   472 3C31 F0 05		    beq Up
   473 3C33			Walk
   474 3C33 A9 00		    lda #0
   475 3C35 85 84		    sta DinoState
   476 3C37			NoChange
   477 3C37 60			    rts
   478 3C38 A9 04		Up  lda #4
   479 3C3A 85 84		    sta DinoState
   480 3C3C A9 00		    lda #0
   481 3C3E 85 85		    sta JumpPhase
   482 3C40 60			    rts
   483 3C41			Down
   484 3C41 A9 02		    lda #2
   485 3C43 85 84		    sta DinoState
   486 3C45 60			    rts
   487 				.endp
   488 				;-----------------------------------------------
   489 3C46			.proc SetStart
   490 3C46 20 37 39		    jsr ClearWorld
   491 3C49 A9 00		    lda #0
   492 3C4B 85 83		    sta DinoWalkPhase
   493 3C4D A9 00		    lda #0
   494 3C4F 85 84		    sta DinoState
   495 3C51 8D C5 02		    sta COLOR1
   496 3C54 A0 00		    ldy #0
   497 3C56			FadeColor
   498 3C56 8C C6 02		    sty COLOR2
   499 3C59 8C C8 02		    sty COLOR4
   500 3C5C			    waitRTC
Macro: WAITRTC [Source: MACRO.ASM]
     1 3C5C A5 14			lda RTCLOK+2
     2 3C5E C5 14		?wa	cmp RTCLOK+2
     3 3C60 F0 FC			beq ?wa
Source: dino.asm
   501 3C62 C8			    iny
   502 3C63 C0 10		    cpy #$10
   503 3C65 D0 EF		    bne FadeColor
   504 3C67 A9 0F		    lda #$0f
   505 3C69 8D C6 02		    sta COLOR2
   506 3C6C 8D C8 02		    sta COLOR4
   507 3C6F 60			    rts
   508 				.endp
   509 				;-----------------------------------------------
   510 3C70			.proc SetGameScreen
   511 3C70 A9 00 8D 30 02 A9 +     mwa #GameDL dlptrs
   512 3C7A A9 3E		    lda #%00111110  ; normal screen width, DL on, P/M on
   513 3C7C 8D 2F 02		    sta dmactls
   514 3C7F A9 20 8D F4 02	    mva #>font1 chbas
   515 3C84 60			    rts
   516 				.endp
   517 				;--------------------------------------------------
   518 3C85			    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 3C85			dino_run_0  ; anly '0' jumps
     7 3C85 FF 23 27 2B FF	    .by $ff, $23, $27, $2b, $ff ; '.   .'
     8 3C8A 20 24 28 2C FF	    .by $20, $24, $28, $2c, $ff ; ' ## .'
     9 3C8F 21 25 29 FF FF	    .by $21, $25, $29, $ff, $ff ; '## ..'
    10 3C94 22 26 2A FF FF	    .by $22, $26, $2a, $ff, $ff ; '## ..'
    11 3C99			dino_run_1
    12 3C99 FF 23 27 2B FF	    .by $ff, $23, $27, $2b, $ff ; '.   .'
    13 3C9E 20 24 28 2C FF	    .by $20, $24, $28, $2c, $ff ; ' ## .'
    14 3CA3 21 25 29 FF FF	    .by $21, $25, $29, $ff, $ff ; '## ..'
    15 3CA8 2D 2E 2F FF FF	    .by $2d, $2e, $2f, $ff, $ff ; '## ..'
    16 3CAD			dino_run_2
    17 3CAD FF 23 27 2B FF	    .by $ff, $23, $27, $2b, $ff ; '.   .'
    18 3CB2 20 24 28 2C FF	    .by $20, $24, $28, $2c, $ff ; ' ## .'
    19 3CB7 21 25 29 FF FF	    .by $21, $25, $29, $ff, $ff ; '## ..'
    20 3CBC 30 31 32 FF FF	    .by $30, $31, $32, $ff, $ff ; '## ..'
    21 3CC1			dino_crouch_1
    22 3CC1 FF FF FF FF FF	    .by $ff, $ff, $ff, $ff, $ff ; '.....'
    23 3CC6 FF FF FF FF FF	    .by $ff, $ff, $ff, $ff, $ff ; '.....'
    24 3CCB 33 34 35 36 37	    .by $33, $34, $35, $36, $37 ; '#### '
    25 3CD0 38 39 3A 3B 3C	    .by $38, $39, $3a, $3b, $3c ; '#### '
    26 3CD5			dino_crouch_2
    27 3CD5 FF FF FF FF FF	    .by $ff, $ff, $ff, $ff, $ff ; '.....'
    28 3CDA FF FF FF FF FF	    .by $ff, $ff, $ff, $ff, $ff ; '.....'
    29 3CDF 33 34 35 36 37	    .by $33, $34, $35, $36, $37 ; '#### '
    30 3CE4 3D 3E 3F 3B 3C	    .by $3d, $3e, $3f, $3b, $3c ; '#### '
    31 3CE9			DinoShapesTableL
    32 3CE9 99			    .by <dino_run_1
    33 3CEA AD			    .by <dino_run_2
    34 3CEB C1			    .by <dino_crouch_1
    35 3CEC D5			    .by <dino_crouch_2
    36 3CED 85			    .by <dino_run_0 ; jump
    37 3CEE 85			    .by <dino_run_0 ; jump
    38 3CEF			DinoShapesTableH
    39 3CEF 3C			    .by >dino_run_1
    40 3CF0 3C			    .by >dino_run_2
    41 3CF1 3C			    .by >dino_crouch_1
    42 3CF2 3C			    .by >dino_crouch_2
    43 3CF3 3C			    .by >dino_run_0 ; jump
    44 3CF4 3C			    .by >dino_run_0 ; jump
    45 				; other objects
    46 3CF5			ground_0
    47 3CF5 FF FF		    .by $ff, $ff    ; '..'
    48 3CF7 FF FF		    .by $ff, $ff    ; '..'
    49 3CF9 FF FF		    .by $ff, $ff    ; '..'
    50 3CFB 52 52		    .by $52, $52    ; '##'
    51 3CFD			bird_0
    52 3CFD FF FF		    .by $ff, $ff    ; '..'
    53 3CFF FF FF		    .by $ff, $ff    ; '..'
    54 3D01 40 41		    .by $40, $41    ; '##'
    55 3D03 52 52		    .by $52, $52    ; '##'
    56 3D05			bird_1
    57 3D05 FF FF		    .by $ff, $ff    ; '..'
    58 3D07 40 41		    .by $40, $41    ; '##'
    59 3D09 FF FF		    .by $ff, $ff    ; '..'
    60 3D0B 52 52		    .by $52, $52    ; '##'
    61 3D0D			bird_2
    62 3D0D 40 41		    .by $40, $41    ; '##'
    63 3D0F FF FF		    .by $ff, $ff    ; '..'
    64 3D11 FF FF		    .by $ff, $ff    ; ''.'
    65 3D13 52 52		    .by $52, $52    ; '##'
    66 3D15			bird_0a
    67 3D15 FF FF		    .by $ff, $ff    ; '..'
    68 3D17 FF FF		    .by $ff, $ff    ; '..'
    69 3D19 42 43		    .by $42, $43    ; '##'
    70 3D1B 52 52		    .by $52, $52    ; '##'
    71 3D1D			bird_1a
    72 3D1D FF FF		    .by $ff, $ff    ; '..'
    73 3D1F 42 43		    .by $42, $43    ; '##'
    74 3D21 FF FF		    .by $ff, $ff    ; '..'
    75 3D23 52 52		    .by $52, $52    ; '##'
    76 3D25			bird_2a
    77 3D25 42 43		    .by $42, $43    ; '##'
    78 3D27 FF FF		    .by $ff, $ff    ; '..'
    79 3D29 FF FF		    .by $ff, $ff    ; ''.'
    80 3D2B 52 52		    .by $52, $52    ; '##'
    81 3D2D			cactus_0
    82 3D2D FF FF		    .by $ff, $ff    ; '..'
    83 3D2F FF FF		    .by $ff, $ff    ; '..'
    84 3D31 46 47		    .by $46, $47    ; '##'
    85 3D33 44 45		    .by $44, $45    ; '##'
    86 3D35			cactus_1
    87 3D35 FF FF		    .by $ff, $ff    ; '..'
    88 3D37 FF FF		    .by $ff, $ff    ; '..'
    89 3D39 4A 4B		    .by $4a, $4b    ; '##'
    90 3D3B 48 49		    .by $48, $49    ; '##'
    91 3D3D			cactus_2
    92 3D3D FF FF		    .by $ff, $ff    ; '..'
    93 3D3F 50 51		    .by $50, $51    ; '##'
    94 3D41 4E 4F		    .by $4e, $4f    ; '##'
    95 3D43 4C 4D		    .by $4c, $4d    ; '##'
    96 3D45			cactus_3
    97 3D45 FF FF		    .by $ff, $ff    ; '..'
    98 3D47 57 FF		    .by $57, $ff    ; '#.'
    99 3D49 56 FF		    .by $56, $ff    ; '#.'
   100 3D4B 55 52		    .by $55, $52    ; '##'
   101 3D4D			cactus_4
   102 3D4D FF FF		    .by $ff, $ff    ; '..'
   103 3D4F FF FF		    .by $ff, $ff    ; '..'
   104 3D51 59 FF		    .by $59, $ff    ; '#.'
   105 3D53 58 52		    .by $58, $52    ; '##'
   106 3D55			ground_1
   107 3D55 FF FF		    .by $ff, $ff    ; '..'
   108 3D57 FF FF		    .by $ff, $ff    ; '..'
   109 3D59 FF FF		    .by $ff, $ff    ; '..'
   110 3D5B 53 54		    .by $53, $54    ; '##'
   111 3D5D			ground_2
   112 3D5D FF FF		    .by $ff, $ff    ; '..'
   113 3D5F FF FF		    .by $ff, $ff    ; '..'
   114 3D61 FF FF		    .by $ff, $ff    ; '..'
   115 3D63 5A 52		    .by $5a, $52    ; '##'
   116
   117 3D65			ShapesTableL
   118 3D65 F5			    .by <ground_0
   119 3D66 F5			    .by <ground_0
   120 3D67 FD			    .by <bird_0
   121 3D68 15			    .by <bird_0a
   122 3D69 05			    .by <bird_1
   123 3D6A 1D			    .by <bird_1a
   124 3D6B 0D			    .by <bird_2
   125 3D6C 25			    .by <bird_2a
   126 3D6D 2D			    .by <cactus_0
   127 3D6E 35			    .by <cactus_1
   128 3D6F 3D			    .by <cactus_2
   129 3D70 45			    .by <cactus_3
   130 3D71 4D			    .by <cactus_4
   131 3D72 55			    .by <ground_1
   132 3D73 5D			    .by <ground_2
   133 3D74			ShapesTableH
   134 3D74 3C			    .by >ground_0
   135 3D75 3C			    .by >ground_0
   136 3D76 3C			    .by >bird_0
   137 3D77 3D			    .by >bird_0a
   138 3D78 3D			    .by >bird_1
   139 3D79 3D			    .by >bird_1a
   140 3D7A 3D			    .by >bird_2
   141 3D7B 3D			    .by >bird_2a
   142 3D7C 3D			    .by >cactus_0
   143 3D7D 3D			    .by >cactus_1
   144 3D7E 3D			    .by >cactus_2
   145 3D7F 3D			    .by >cactus_3
   146 3D80 3D			    .by >cactus_4
   147 3D81 3D			    .by >ground_1
   148 3D82 3D			    .by >ground_2
   149 3D83			diff_object_gap ; min distance between obstacles by difficulty level
   150 3D83 14 13 12 11 10 0F +     :DIFF_LEVELS .by 20-#
   151 				;----------vars----------
   152 = 3D93			diff_level  .ds 1
   153 3D94-3D9B> 01 02 03 04 + DinoJumpTr  .by 1,2,3,4,4,3,2,1
   154 = 0007			JumpLen = 7
   155 				.endif  ; .IF *>0
   519 				;--------------------------------------------------
   520
   521 02E0-02E1> 6A 38		    run FirstSTART
