------- FILE c:\Users\Shane\Documents\my7800projects\Heofonfir\Lucelia_Movement_demo.78b.asm LEVEL 1 PASS 3 1 28000 ???? ; MACRO.H 2 28000 ???? 3 28000 ???? ; Based on the 2600 macro.h file. 4 28000 ???? ; Macros irrelevant to the 7800 have been removed, and the sleep macro 5 28000 ???? ; has been adapted to give accurate results on the 7800. 6 28000 ???? 7 28000 ???? ; Version 1.0 2019/12/11 (based on the 2600 Version 1.05, 13/NOVEMBER/2003) 8 28000 ???? 9 28000 ???? ; Available macros... 10 28000 ???? ; SLEEP n - sleep for n cycles 11 28000 ???? ; SET_POINTER - load a 16-bit absolute to a 16-bit variable 12 28000 ???? 13 28000 ???? ;------------------------------------------------------------------------------- 14 28000 ???? ; SLEEP duration 15 28000 ???? ; Original author: Thomas Jentzsch 16 28000 ???? ; Inserts code which takes the specified number of cycles to execute. This is 17 28000 ???? ; useful for code where precise timing is required. 18 28000 ???? ; ILLEGAL-OPCODE VERSION DOES NOT AFFECT FLAGS OR REGISTERS. 19 28000 ???? ; LEGAL OPCODE VERSION MAY AFFECT FLAGS 20 28000 ???? ; Uses illegal opcode (DASM 2.20.01 onwards). 21 28000 ???? 22 28000 ???? MAC sleep 23 28000 ???? .CYCLES SET {1} 24 28000 ???? 25 28000 ???? IF .CYCLES < 2 26 28000 ???? ECHO "MACRO ERROR: 'SLEEP': Duration must be > 1" 27 28000 ???? ERR 28 28000 ???? ENDIF 29 28000 ???? 30 28000 ???? IF .CYCLES & 1 31 28000 ???? IFNCONST NO_ILLEGAL_OPCODES 32 28000 ???? nop $80 33 28000 ???? ELSE 34 28000 ???? bit $80 35 28000 ???? ENDIF 36 28000 ???? .CYCLES SET .CYCLES - 3 37 28000 ???? ENDIF 38 28000 ???? 39 28000 ???? REPEAT .CYCLES / 2 40 28000 ???? nop 41 28000 ???? REPEND 42 28000 ???? ENDM ;usage: SLEEP n (n>1) 43 28000 ???? 44 28000 ???? ;------------------------------------------------------- 45 28000 ???? ; SET_POINTER 46 28000 ???? ; Original author: Manuel Rotschkar 47 28000 ???? ; 48 28000 ???? ; Sets a 2 byte RAM pointer to an absolute address. 49 28000 ???? ; 50 28000 ???? ; Usage: SET_POINTER pointer, address 51 28000 ???? ; Example: SET_POINTER SpritePTR, SpriteData 52 28000 ???? ; 53 28000 ???? ; Note: Alters the accumulator, NZ flags 54 28000 ???? ; IN 1: 2 byte RAM location reserved for pointer 55 28000 ???? ; IN 2: absolute address 56 28000 ???? 57 28000 ???? MAC set_pointer 58 28000 ???? .POINTER SET {1} 59 28000 ???? .ADDRESS SET {2} 60 28000 ???? 61 28000 ???? LDA #<.ADDRESS ; Get Lowbyte of Address 62 28000 ???? STA .POINTER ; Store in pointer 63 28000 ???? LDA #>.ADDRESS ; Get Hibyte of Address 64 28000 ???? STA .POINTER+1 ; Store in pointer+1 65 28000 ???? 66 28000 ???? ENDM 67 28000 ???? 68 28000 ???? ; EOF 69 28000 ???? ; Provided under the CC0 license. See the included LICENSE.txt for details. 70 28000 ???? 71 28000 ???? ; 7800MACRO.H 72 28000 ???? 73 28000 ???? ;------------------------------------------------------- 74 28000 ???? ; BOXCOLLISIONCHECK 75 28000 ???? ; author: Mike Saarna 76 28000 ???? ; 77 28000 ???? ; A general bounding box collision check. compares 2 rectangles of differing size 78 28000 ???? ; and shape for overlap. Carry is set for collision detected, clear for none. 79 28000 ???? ; 80 28000 ???? ; Usage: BOXCOLLISIONCHECK x1var,y1var,w1var,h1var,x2var,y2var,w2var,h2var 81 28000 ???? ; 82 28000 ???? 83 28000 ???? MAC boxcollisioncheck 84 28000 ???? .boxx1 SET {1} 85 28000 ???? .boxy1 SET {2} 86 28000 ???? .boxw1 SET {3} 87 28000 ???? .boxh1 SET {4} 88 28000 ???? .boxx2 SET {5} 89 28000 ???? .boxy2 SET {6} 90 28000 ???? .boxw2 SET {7} 91 28000 ???? .boxh2 SET {8} 92 28000 ???? 93 28000 ???? .DoXCollisionCheck 94 28000 ???? lda .boxx1 ;3 95 28000 ???? cmp .boxx2 ;2 96 28000 ???? bcs .X1isbiggerthanX2 ;2/3 97 28000 ???? .X2isbiggerthanX1 98 28000 ???? adc #.boxw1 ;2 99 28000 ???? cmp .boxx2 ;3 100 28000 ???? bcs .DoYCollisionCheck ;3/2 101 28000 ???? bcc .noboxcollision ;3 102 28000 ???? .X1isbiggerthanX2 103 28000 ???? clc ;2 104 28000 ???? sbc #.boxw2 ;2 105 28000 ???? cmp .boxx2 ;3 106 28000 ???? bcs .noboxcollision ;3/2 107 28000 ???? .DoYCollisionCheck 108 28000 ???? lda .boxy1 ;3 109 28000 ???? cmp .boxy2 ;3 110 28000 ???? bcs .Y1isbiggerthanY2 ;3/2 111 28000 ???? .Y2isbiggerthanY1 112 28000 ???? adc #.boxh1 ;2 113 28000 ???? cmp .boxy2 ;3 114 28000 ???? jmp .checkdone ;6 115 28000 ???? .Y1isbiggerthanY2 116 28000 ???? clc ;2 117 28000 ???? sbc #.boxh2 ;2 118 28000 ???? cmp .boxy2 ;3 119 28000 ???? bcs .noboxcollision ;3/2 120 28000 ???? .boxcollision 121 28000 ???? sec ;2 122 28000 ???? .byte $24 ; hardcoded "BIT [clc opcode]", used to skip over the following clc 123 28000 ???? .noboxcollision 124 28000 ???? clc ;2 125 28000 ???? .checkdone 126 28000 ???? 127 28000 ???? ENDM 128 28000 ???? 129 28000 ???? MAC median3 130 28000 ???? 131 28000 ???? ; A median filter (for smoothing paddle jitter) 132 28000 ???? ; this macro takes the current paddle value, compares it to historic 133 28000 ???? ; values, and replaces the current paddle value with the median. 134 28000 ???? ; 135 28000 ???? ; called as: MEDIAN3 STORAGE CURRENT 136 28000 ???? ; where STORAGE points to 3 consecutive bytes of memory. The first 2 137 28000 ???? ; must be dedicated to this MEDIAN filter. The last 1 is a temp. 138 28000 ???? ; where CURRENT is memory holding the new value you wish to compare to 139 28000 ???? ; the previous values, and update with the median value. 140 28000 ???? ; 141 28000 ???? ; returns: CURRENT (modified to contain median value) 142 28000 ???? ; 143 28000 ???? ; author: Mike Saarna (aka RevEng) 144 28000 ???? 145 28000 ???? .MedianBytes SET {1} 146 28000 ???? .NewValue SET {2} 147 28000 ???? 148 28000 ???? lda #0 149 28000 ???? ldy .NewValue 150 28000 ???? sty .MedianBytes+2 ; put the new value in the most "recent" slot 151 28000 ???? 152 28000 ???? ; build an index from relative size comparisons between our 3 values. 153 28000 ???? cpy .MedianBytes 154 28000 ???? rol 155 28000 ???? cpy .MedianBytes+1 156 28000 ???? rol 157 28000 ???? ldy .MedianBytes 158 28000 ???? cpy .MedianBytes+1 159 28000 ???? rol 160 28000 ???? tay 161 28000 ???? 162 28000 ???? ldx MedianOrderLUT,y ; convert the size-comparison index to an index to the median value 163 28000 ???? lda .MedianBytes,x 164 28000 ???? sta .NewValue ; we replace the new value memory with the median value 165 28000 ???? 166 28000 ???? ; then shift values from "newer" bytes to "older" bytes, leaving the 167 28000 ???? ; newest byte (.MedianBytes+2) empty for next time. 168 28000 ???? lda .MedianBytes+1 169 28000 ???? sta .MedianBytes 170 28000 ???? lda .MedianBytes+2 171 28000 ???? sta .MedianBytes+1 172 28000 ???? ifnconst MedianOrderLUT 173 28000 ???? jmp MedianOrderLUTend 174 28000 ???? MedianOrderLUT ; converts our "comparison index" to an index to the median value 175 28000 ???? .byte 0 ; 0 B2 < B0 < B1 176 28000 ???? .byte 1 ; 1 B2 < B1 < B0 177 28000 ???? .byte 2 ; 2 impossible 178 28000 ???? .byte 2 ; 3 B1 < B2 < B0 179 28000 ???? .byte 2 ; 4 B0 < B2 < B1 180 28000 ???? .byte 2 ; 5 impossible 181 28000 ???? .byte 1 ; 6 B0 < B1 < B2 182 28000 ???? .byte 0 ; 7 B1 < B0 < B2 183 28000 ???? MedianOrderLUTend 184 28000 ???? endif 185 28000 ???? ENDM 186 28000 ???? 187 28000 ???? MAC plotsprite 188 28000 ???? 189 28000 ???? ; A macro version of the plotsprite command. 190 28000 ???? ; This trades off rom space for speed. 191 28000 ???? ; It also doesn't check if the visible screen is displayed or not. 192 28000 ???? ; It has no training wheels. It is all rusty sharp edges. 193 28000 ???? 194 28000 ???? .GFXLabel SET {1} 195 28000 ???? .Palette SET {2} ; constant 196 28000 ???? .SpriteX SET {3} ; variable 197 28000 ???? .SpriteY SET {4} ; variable 198 28000 ???? .ByteOffset SET {5} ; variable 199 28000 ???? 200 28000 ???? lda .SpriteY 201 28000 ???? lsr 202 28000 ???? lsr 203 28000 ???? asr #%11111110 ; ensure carry is clear 204 28000 ???? if WZONEHEIGHT = 16 205 28000 ???? asr #%11111110 ; ensure carry is clear 206 28000 ???? endif 207 28000 ???? 208 28000 ???? tax 209 28000 ???? 210 28000 ???? lda DLPOINTL,x ; setup DL pointer for this zone 211 28000 ???? sta dlpnt 212 28000 ???? lda DLPOINTH,x ; setup DL pointer for this zone 213 28000 ???? sta dlpnt+1 214 28000 ???? 215 28000 ???? ldy dlend,x ; find the next new object position in this zone 216 28000 ???? 217 28000 ???? lda .ByteOffset 218 28000 ???? if {1}_width = 2 219 28000 ???? asl 220 28000 ???? endif 221 28000 ???? if {1}_width = 3 222 28000 ???? asl 223 28000 ???? adc .ByteOffset 224 28000 ???? endif 225 28000 ???? if {1}_width = 4 226 28000 ???? asl 227 28000 ???? asl 228 28000 ???? endif 229 28000 ???? if {1}_width = 5 230 28000 ???? asl 231 28000 ???? asl 232 28000 ???? adc .ByteOffset 233 28000 ???? endif 234 28000 ???? if {1}_width = 6 235 28000 ???? asl 236 28000 ???? adc .ByteOffset 237 28000 ???? asl 238 28000 ???? endif 239 28000 ???? if {1}_width = 7 240 28000 ???? asl 241 28000 ???? adc .ByteOffset 242 28000 ???? asl 243 28000 ???? adc .ByteOffset 244 28000 ???? endif 245 28000 ???? if {1}_width = 8 246 28000 ???? asl 247 28000 ???? asl 248 28000 ???? asl 249 28000 ???? endif 250 28000 ???? if {1}_width = 9 251 28000 ???? asl 252 28000 ???? asl 253 28000 ???? asl 254 28000 ???? adc .ByteOffset 255 28000 ???? endif 256 28000 ???? if {1}_width = 10 257 28000 ???? asl 258 28000 ???? asl 259 28000 ???? adc .ByteOffset 260 28000 ???? asl 261 28000 ???? endif 262 28000 ???? if {1}_width = 11 263 28000 ???? asl 264 28000 ???? asl 265 28000 ???? adc .ByteOffset 266 28000 ???? asl 267 28000 ???? adc .ByteOffset 268 28000 ???? endif 269 28000 ???? if {1}_width = 12 270 28000 ???? asl 271 28000 ???? adc .ByteOffset 272 28000 ???? asl 273 28000 ???? asl 274 28000 ???? endif 275 28000 ???? if {1}_width = 13 276 28000 ???? asl 277 28000 ???? adc .ByteOffset 278 28000 ???? asl 279 28000 ???? asl 280 28000 ???? adc .ByteOffset 281 28000 ???? endif 282 28000 ???? if {1}_width = 14 283 28000 ???? asl 284 28000 ???? adc .ByteOffset 285 28000 ???? asl 286 28000 ???? adc .ByteOffset 287 28000 ???? asl 288 28000 ???? endif 289 28000 ???? 290 28000 ???? adc #<.GFXLabel ; carry is clear via previous asl or asr 291 28000 ???? sta (dlpnt),y ; #1 - low byte object address 292 28000 ???? 293 28000 ???? iny 294 28000 ???? 295 28000 ???? lda #({1}_mode | %01000000) 296 28000 ???? sta (dlpnt),y ; #2 - graphics mode , indirect 297 28000 ???? 298 28000 ???? iny 299 28000 ???? 300 28000 ???? lda .SpriteY 301 28000 ???? and #(WZONEHEIGHT - 1) 302 28000 ???? cmp #1 ; clear carry if our sprite is just in this zone 303 28000 ???? ora #>.GFXLabel 304 28000 ???? sta (dlpnt),y ; #3 - hi byte object address 305 28000 ???? 306 28000 ???? iny 307 28000 ???? 308 28000 ???? lda #({1}_width_twoscompliment | (.Palette * 32)) 309 28000 ???? sta (dlpnt),y ; #4 - palette|width 310 28000 ???? 311 28000 ???? iny 312 28000 ???? 313 28000 ???? lda .SpriteX 314 28000 ???? sta (dlpnt),y ; #5 - x object position 315 28000 ???? 316 28000 ???? iny 317 28000 ???? sty dlend,x 318 28000 ???? 319 28000 ???? ifconst ALWAYSTERMINATE 320 28000 ???? iny 321 28000 ???? lda #0 322 28000 ???? sta (dlpnt),y 323 28000 ???? endif 324 28000 ???? 325 28000 ???? bcc .PLOTSPRITEend 326 28000 ???? 327 28000 ???? inx ; next zone 328 28000 ???? 329 28000 ???? lda DLPOINTL,x ; setup DL pointer for this zone 330 28000 ???? sta dlpnt 331 28000 ???? lda DLPOINTH,x ; setup DL pointer for this zone 332 28000 ???? sta dlpnt+1 333 28000 ???? 334 28000 ???? ldy dlend,x ; find the next new object position in this zone 335 28000 ???? 336 28000 ???? lda .ByteOffset 337 28000 ???? if {1}_width = 1 338 28000 ???? clc 339 28000 ???? endif 340 28000 ???? if {1}_width = 2 341 28000 ???? asl ; carry clear 342 28000 ???? endif 343 28000 ???? if {1}_width = 3 344 28000 ???? asl ; carry clear 345 28000 ???? adc .ByteOffset 346 28000 ???? endif 347 28000 ???? if {1}_width = 4 348 28000 ???? asl ; carry clear 349 28000 ???? asl 350 28000 ???? endif 351 28000 ???? if {1}_width = 5 352 28000 ???? asl ; carry clear 353 28000 ???? asl 354 28000 ???? adc .ByteOffset 355 28000 ???? endif 356 28000 ???? if {1}_width = 6 357 28000 ???? asl ; carry clear 358 28000 ???? adc .ByteOffset 359 28000 ???? asl 360 28000 ???? endif 361 28000 ???? if {1}_width = 7 362 28000 ???? asl ; carry clear 363 28000 ???? adc .ByteOffset 364 28000 ???? asl 365 28000 ???? endif 366 28000 ???? if {1}_width = 8 367 28000 ???? asl ; carry clear 368 28000 ???? asl 369 28000 ???? asl 370 28000 ???? endif 371 28000 ???? if {1}_width = 9 372 28000 ???? asl ; carry clear 373 28000 ???? asl 374 28000 ???? asl 375 28000 ???? adc .ByteOffset 376 28000 ???? endif 377 28000 ???? if {1}_width = 10 378 28000 ???? asl ; carry clear 379 28000 ???? asl 380 28000 ???? adc .ByteOffset 381 28000 ???? asl 382 28000 ???? endif 383 28000 ???? if {1}_width = 11 384 28000 ???? asl ; carry clear 385 28000 ???? asl 386 28000 ???? adc .ByteOffset 387 28000 ???? asl 388 28000 ???? adc .ByteOffset 389 28000 ???? endif 390 28000 ???? if {1}_width = 12 391 28000 ???? asl ; carry clear 392 28000 ???? adc .ByteOffset 393 28000 ???? asl 394 28000 ???? asl 395 28000 ???? endif 396 28000 ???? if {1}_width = 13 397 28000 ???? asl ; carry clear 398 28000 ???? adc .ByteOffset 399 28000 ???? asl 400 28000 ???? asl 401 28000 ???? adc .ByteOffset 402 28000 ???? endif 403 28000 ???? if {1}_width = 14 404 28000 ???? asl ; carry clear 405 28000 ???? adc .ByteOffset 406 28000 ???? asl 407 28000 ???? adc .ByteOffset 408 28000 ???? asl 409 28000 ???? endif 410 28000 ???? 411 28000 ???? adc #<.GFXLabel 412 28000 ???? sta (dlpnt),y ; #1 - low byte object address 413 28000 ???? 414 28000 ???? iny 415 28000 ???? 416 28000 ???? lda #({1}_mode | %01000000) 417 28000 ???? sta (dlpnt),y ; #2 - graphics mode , indirect 418 28000 ???? 419 28000 ???? iny 420 28000 ???? 421 28000 ???? lda .SpriteY 422 28000 ???? and #(WZONEHEIGHT - 1) 423 28000 ???? ora #>(.GFXLabel - (WZONEHEIGHT * 256)) ; start in the dma hole 424 28000 ???? sta (dlpnt),y ; #3 - hi byte object address 425 28000 ???? 426 28000 ???? iny 427 28000 ???? 428 28000 ???? lda #({1}_width_twoscompliment | (.Palette * 32)) 429 28000 ???? sta (dlpnt),y ; #4 - palette|width 430 28000 ???? 431 28000 ???? iny 432 28000 ???? 433 28000 ???? lda .SpriteX 434 28000 ???? sta (dlpnt),y ; #5 - x object position 435 28000 ???? 436 28000 ???? iny 437 28000 ???? sty dlend,x 438 28000 ???? 439 28000 ???? ifconst ALWAYSTERMINATE 440 28000 ???? iny 441 28000 ???? lda #0 442 28000 ???? sta (dlpnt),y 443 28000 ???? endif 444 28000 ???? 445 28000 ???? .PLOTSPRITEend 446 28000 ???? ENDM 447 28000 ???? 448 28000 ???? MAC sizeof 449 28000 ???? 450 28000 ???? ; echo's the size difference between the current address and the 451 28000 ???? ; a label that was passed as an argument. This is a quick way to 452 28000 ???? ; determine the size of a structure. 453 28000 ???? 454 28000 ???? .NAME SETSTR {1} 455 28000 ???? echo " The Size of",.NAME,"is:",[* - {1}]d,[* - {2}]d,"bytes." 456 28000 ???? ENDM 457 28000 ???? 458 28000 ???? ; 459 28000 ???? ; speakjet.inc 460 28000 ???? ; 461 28000 ???? ; 462 28000 ???? ; AtariVox Speech Synth Driver 463 28000 ???? ; 464 28000 ???? ; By Alex Herbert, 2004 465 28000 ???? ; 466 28000 ???? 467 28000 ???? 468 28000 ???? 469 28000 ???? 470 28000 ???? ; Constants 471 28000 ???? 472 28000 ???? 473 28000 ???? 00 01 SERIAL_OUTMASK equ $01 474 28000 ???? 00 02 SERIAL_RDYMASK equ $02 475 28000 ???? 476 28000 ???? 477 28000 ???? 478 28000 ???? ; Macros 479 28000 ???? 480 28000 ???? mac spkout 481 28000 ???? 482 28000 ???? ; check buffer-full status 483 28000 ???? lda SWCHA 484 28000 ???? and #SERIAL_RDYMASK 485 28000 ???? beq .speech_done 486 28000 ???? 487 28000 ???? ; get next speech byte 488 28000 ???? ldy #$00 489 28000 ???? lda (speech_addr),y 490 28000 ???? 491 28000 ???? ; invert data and check for end of string 492 28000 ???? eor #$ff 493 28000 ???? ;sta BACKGRND ; debug - uncomment to flash the background color with vox data 494 28000 ???? beq .speech_done 495 28000 ???? sta {1} 496 28000 ???? 497 28000 ???? ; increment speech pointer 498 28000 ???? inc speech_addr 499 28000 ???? bne .incaddr_skip 500 28000 ???? inc speech_addr+1 501 28000 ???? .incaddr_skip 502 28000 ???? 503 28000 ???? ; output byte as serial data 504 28000 ???? 505 28000 ???? sec ; start bit 506 28000 ???? .byteout_loop 507 28000 ???? ; put carry flag into bit 0 of SWACNT, perserving other bits 508 28000 ???? lda SWACNT ; 4 509 28000 ???? and #$fe ; 2 6 510 28000 ???? adc #$00 ; 2 8 511 28000 ???? sta SWACNT ; 4 12 512 28000 ???? 513 28000 ???? ; 10 bits sent? (1 start bit, 8 data bits, 1 stop bit) 514 28000 ???? cpy #$09 ; 2 14 515 28000 ???? beq .speech_done ; 2 16 516 28000 ???? iny ; 2 18 517 28000 ???? 518 28000 ???? ; the 7800 is 1.5x faster than the 2600. Waste more cycles here 519 28000 ???? ; to match the original baud rate... 520 28000 ???? ;ldx #$07 ; 2600 521 28000 ???? ldx #$0D 522 28000 ???? 523 28000 ???? .delay_loop 524 28000 ???? dex ; 525 28000 ???? bne .delay_loop ; 36 54 526 28000 ???? 527 28000 ???? ; shift next data bit into carry 528 28000 ???? lsr {1} ; 5 59 529 28000 ???? 530 28000 ???? ; and loop (branch always taken) 531 28000 ???? bpl .byteout_loop ; 3 62 cycles for loop 532 28000 ???? 533 28000 ???? .speech_done 534 28000 ???? 535 28000 ???? endm 536 28000 ???? 537 28000 ???? 538 28000 ???? mac speak 539 28000 ???? 540 28000 ???? lda #<{1} 541 28000 ???? sta speech_addr 542 28000 ???? lda #>{1} 543 28000 ???? sta speech_addr+1 544 28000 ???? 545 28000 ???? endm 546 28000 ???? 547 28000 ???? 548 28000 ???? 549 28000 ???? ; Provided under the CC0 license. See the included LICENSE.txt for details. 550 28000 ???? 551 28000 ???? processor 6502 552 28000 ???? ------- FILE 7800basic.h LEVEL 2 PASS 3 0 28000 ???? include "7800basic.h" 1 28000 ???? ; Provided under the CC0 license. See the included LICENSE.txt for details. 2 28000 ???? 3 28000 ???? processor 6502 ------- FILE 7800.h LEVEL 3 PASS 3 0 28000 ???? include "7800.h" 1 28000 ???? ; Provided under the CC0 license. See the included LICENSE.txt for details. 2 28000 ???? 3 28000 ???? ; 7800.h 4 28000 ???? ; Version 1.0, 2019/12/13 5 28000 ???? 6 28000 ???? ; This file defines hardware registers and memory mapping for the 7 28000 ???? ; Atari 7800. It is distributed as a companion machine-specific support package 8 28000 ???? ; for the DASM compiler. Updates to this file, DASM, and associated tools are 9 28000 ???? ; available at https://github.com/dasm-assembler/dasm 10 28000 ???? 11 28000 ???? 12 28000 ???? ; ******************** 7800 Hardware Adresses *************************** 13 28000 ???? ; 14 28000 ???? ; MEMORY MAP USAGE OF THE 7800 15 28000 ???? ; 16 28000 ???? ; 00 - 1F TIA REGISTERS 17 28000 ???? ; 20 - 3F MARIA REGISTERS 18 28000 ???? ; 40 - FF RAM block 0 (zero page) 19 28000 ???? ; 100 - 11F TIA (mirror of 0000-001f) 20 28000 ???? ; 120 - 13F MARIA (mirror of 0020-003f) 21 28000 ???? ; 140 - 1FF RAM block 1 (stack) 22 28000 ???? ; 200 - 21F TIA (mirror of 0000-001f) 23 28000 ???? ; 220 - 23F MARIA (mirror of 0020-003f) 24 28000 ???? ; 240 - 27F ??? 25 28000 ???? ; 280 - 2FF RIOT I/O ports and timers 26 28000 ???? ; 300 - 31F TIA (mirror of 0000-001f) 27 28000 ???? ; 320 - 33F MARIA (mirror of 0020-003f) 28 28000 ???? ; 340 - 3FF ??? 29 28000 ???? ; 400 - 47F unused address space 30 28000 ???? ; 480 - 4FF RIOT RAM 31 28000 ???? ; 500 - 57F unused address space 32 28000 ???? ; 580 - 5FF RIOT RAM (mirror of 0480-04ff) 33 28000 ???? ; 600 - 17FF unused address space 34 28000 ???? ; 1800 - 203F RAM 35 28000 ???? ; 2040 - 20FF RAM block 0 (mirror of 0000-001f) 36 28000 ???? ; 2100 - 213F RAM 37 28000 ???? ; 2140 - 21FF RAM block 1 (mirror of 0140-01ff) 38 28000 ???? ; 2200 - 27FF RAM 39 28000 ???? ; 2800 - 2FFF mirror of 1800-27ff 40 28000 ???? ; 3000 - 3FFF unused address space 41 28000 ???? ; 4000 - FF7F potential cartridge address space 42 28000 ???? ; FF80 - FFF9 RESERVED FOR ENCRYPTION 43 28000 ???? ; FFFA - FFFF 6502 VECTORS 44 28000 ???? 45 28000 ???? 46 28000 ???? ;****** 00-1F ********* TIA REGISTERS ****************** 47 28000 ???? 48 28000 ???? 00 01 INPTCTRL = $01 ;Input control. In same address space as TIA. write-only 49 28000 ???? 00 01 VBLANK = $01 ;VBLANK. D7=1:dump paddle caps to ground. write-only 50 28000 ???? 00 08 INPT0 = $08 ;Paddle Control Input 0 read-only 51 28000 ???? 00 09 INPT1 = $09 ;Paddle Control Input 1 read-only 52 28000 ???? 00 0a INPT2 = $0A ;Paddle Control Input 2 read-only 53 28000 ???? 00 0b INPT3 = $0B ;Paddle Control Input 3 read-only 54 28000 ???? 55 28000 ???? ; ** some common alternate names for INPT0/1/2/3 56 28000 ???? 00 08 INPT4B = $08 ;Joystick 0 Fire 1 read-only 57 28000 ???? 00 09 INPT4A = $09 ;Joystick 0 Fire 1 read-only 58 28000 ???? 00 0a INPT5B = $0A ;Joystick 1 Fire 0 read-only 59 28000 ???? 00 0b INPT5A = $0B ;Joystick 1 Fire 1 read-only 60 28000 ???? 00 08 INPT4R = $08 ;Joystick 0 Fire 1 read-only 61 28000 ???? 00 09 INPT4L = $09 ;Joystick 0 Fire 1 read-only 62 28000 ???? 00 0a INPT5R = $0A ;Joystick 1 Fire 0 read-only 63 28000 ???? 00 0b INPT5L = $0B ;Joystick 1 Fire 1 read-only 64 28000 ???? 65 28000 ???? 00 0c INPT4 = $0C ;Player 0 Fire Button Input read-only 66 28000 ???? 00 0d INPT5 = $0D ;Player 1 Fire Button Input read-only 67 28000 ???? 68 28000 ???? 00 15 AUDC0 = $15 ;Audio Control Channel 0 write-only 69 28000 ???? 00 16 AUDC1 = $16 ;Audio Control Channel 1 write-only 70 28000 ???? 00 17 AUDF0 = $17 ;Audio Frequency Channel 0 write-only 71 28000 ???? 00 18 AUDF1 = $18 ;Audio Frequency Channel 1 write-only 72 28000 ???? 00 19 AUDV0 = $19 ;Audio Volume Channel 0 write-only 73 28000 ???? 00 1a AUDV1 = $1A ;Audio Volume Channel 1 write-only 74 28000 ???? 75 28000 ???? ;****** 20-3F ********* MARIA REGISTERS *************** 76 28000 ???? 77 28000 ???? 00 20 BACKGRND = $20 ;Background Color write-only 78 28000 ???? 00 21 P0C1 = $21 ;Palette 0 - Color 1 write-only 79 28000 ???? 00 22 P0C2 = $22 ;Palette 0 - Color 2 write-only 80 28000 ???? 00 23 P0C3 = $23 ;Palette 0 - Color 3 write-only 81 28000 ???? 00 24 WSYNC = $24 ;Wait For Sync write-only 82 28000 ???? 00 25 P1C1 = $25 ;Palette 1 - Color 1 write-only 83 28000 ???? 00 26 P1C2 = $26 ;Palette 1 - Color 2 write-only 84 28000 ???? 00 27 P1C3 = $27 ;Palette 1 - Color 3 write-only 85 28000 ???? 00 28 MSTAT = $28 ;Maria Status read-only 86 28000 ???? 00 29 P2C1 = $29 ;Palette 2 - Color 1 write-only 87 28000 ???? 00 2a P2C2 = $2A ;Palette 2 - Color 2 write-only 88 28000 ???? 00 2b P2C3 = $2B ;Palette 2 - Color 3 write-only 89 28000 ???? 00 2c DPPH = $2C ;Display List List Pointer High write-only 90 28000 ???? 00 2d P3C1 = $2D ;Palette 3 - Color 1 write-only 91 28000 ???? 00 2e P3C2 = $2E ;Palette 3 - Color 2 write-only 92 28000 ???? 00 2f P3C3 = $2F ;Palette 3 - Color 3 write-only 93 28000 ???? 00 30 DPPL = $30 ;Display List List Pointer Low write-only 94 28000 ???? 00 31 P4C1 = $31 ;Palette 4 - Color 1 write-only 95 28000 ???? 00 32 P4C2 = $32 ;Palette 4 - Color 2 write-only 96 28000 ???? 00 33 P4C3 = $33 ;Palette 4 - Color 3 write-only 97 28000 ???? 00 34 CHARBASE = $34 ;Character Base Address write-only 98 28000 ???? 00 34 CHBASE = $34 ;Character Base Address write-only 99 28000 ???? 00 35 P5C1 = $35 ;Palette 5 - Color 1 write-only 100 28000 ???? 00 36 P5C2 = $36 ;Palette 5 - Color 2 write-only 101 28000 ???? 00 37 P5C3 = $37 ;Palette 5 - Color 3 write-only 102 28000 ???? 00 38 OFFSET = $38 ;Unused - Store zero here write-only 103 28000 ???? 00 39 P6C1 = $39 ;Palette 6 - Color 1 write-only 104 28000 ???? 00 3a P6C2 = $3A ;Palette 6 - Color 2 write-only 105 28000 ???? 00 3b P6C3 = $3B ;Palette 6 - Color 3 write-only 106 28000 ???? 00 3c CTRL = $3C ;Maria Control Register write-only 107 28000 ???? 00 3d P7C1 = $3D ;Palette 7 - Color 1 write-only 108 28000 ???? 00 3e P7C2 = $3E ;Palette 7 - Color 2 write-only 109 28000 ???? 00 3f P7C3 = $3F ;Palette 7 - Color 3 write-only 110 28000 ???? 111 28000 ???? 112 28000 ???? ;****** 280-2FF ******* PIA PORTS AND TIMERS ************ 113 28000 ???? 114 28000 ???? 02 80 SWCHA = $280 ;P0+P1 Joystick Directional Input read-write 115 28000 ???? 02 81 CTLSWA = $281 ;I/O Control for SCHWA read-write 116 28000 ???? 02 81 SWACNT = $281 ;VCS name for above read-write 117 28000 ???? 02 82 SWCHB = $282 ;Console Switches read-write 118 28000 ???? 02 83 CTLSWB = $283 ;I/O Control for SCHWB read-write 119 28000 ???? 02 83 SWBCNT = $283 ;VCS name for above read-write 120 28000 ???? 121 28000 ???? 02 84 INTIM = $284 ;Interval Timer Read read-only 122 28000 ???? 02 94 TIM1T = $294 ;Set 1 CLK Interval (838 nsec/interval) write-only 123 28000 ???? 02 95 TIMINT = $295 ;Interval Timer Interrupt read-only 124 28000 ???? 02 95 TIM8T = $295 ;Set 8 CLK Interval (6.7 usec/interval) write-only 125 28000 ???? 02 96 TIM64T = $296 ;Set 64 CLK Interval (63.6 usec/interval) write-only 126 28000 ???? 02 97 T1024T = $297 ;Set 1024 CLK Interval (858.2 usec/interval) write-only 127 28000 ???? 02 9e TIM64TI = $29E ;Interrupt timer 64T write-only 128 28000 ???? 129 28000 ???? ;XM 130 28000 ???? 04 70 XCTRL = $470 ; 7=YM2151 6=RAM@6k 5=RAM@4k 4=pokey@450 3=hsc 2=cart 1=RoF_bank1 0=RoF_bank2 131 28000 ???? 04 70 XCTRL1 = $470 132 28000 ???? 04 78 XCTRL2 = $478 133 28000 ???? 04 7c XCTRL3 = $47c 134 28000 ???? 04 71 XCTRL4 = $471 135 28000 ???? 04 72 XCTRL5 = $472 136 28000 ???? 137 28000 ???? ; Pokey register relative locations, since its base may be different 138 28000 ???? ; depending on the hardware. 139 28000 ???? 00 00 PAUDF0 = $0 ; extra audio channels and frequencies 140 28000 ???? 00 01 PAUDC0 = $1 141 28000 ???? 00 02 PAUDF1 = $2 142 28000 ???? 00 03 PAUDC1 = $3 143 28000 ???? 00 04 PAUDF2 = $4 144 28000 ???? 00 05 PAUDC2 = $5 145 28000 ???? 00 06 PAUDF3 = $6 146 28000 ???? 00 07 PAUDC3 = $7 147 28000 ???? 00 08 PAUDCTL = $8 ; Audio Control 148 28000 ???? 00 09 PSTIMER = $9 149 28000 ???? 00 0a PRANDOM = $A ; 17 bit polycounter pseudo random 150 28000 ???? 00 0f PSKCTL = $F ; Serial Port control ------- FILE 7800basic.h ------- FILE 7800basic_variable_redefs.h LEVEL 3 PASS 3 0 28000 ???? include "7800basic_variable_redefs.h" 1 28000 ???? ; This file contains variable mapping and other information for the current project. 2 28000 ???? 3 28000 ???? 00 00 heofonfir_bomb_bug_mode = $00 4 28000 ???? 00 1d heofonfir_bomb_bug_width_twoscompliment = $1d 5 28000 ???? 00 03 heofonfir_bomb_bug_width = $03 6 28000 ???? 00 00 heofonfir_bullet_mode = $00 7 28000 ???? 00 1f heofonfir_bullet_width_twoscompliment = $1f 8 28000 ???? 00 01 heofonfir_bullet_width = $01 9 28000 ???? 00 00 heofonfir_lucelia_layer_2nofire_8_mode = $00 10 28000 ???? 00 1d heofonfir_lucelia_layer_2nofire_8_width_twoscompliment = $1d 11 28000 ???? 00 03 heofonfir_lucelia_layer_2nofire_8_width = $03 12 28000 ???? 00 00 heofonfir_lucelia_layer_2nofire_7_mode = $00 13 28000 ???? 00 1d heofonfir_lucelia_layer_2nofire_7_width_twoscompliment = $1d 14 28000 ???? 00 03 heofonfir_lucelia_layer_2nofire_7_width = $03 15 28000 ???? 00 00 heofonfir_lucelia_layer_2nofire_6_mode = $00 16 28000 ???? 00 1d heofonfir_lucelia_layer_2nofire_6_width_twoscompliment = $1d 17 28000 ???? 00 03 heofonfir_lucelia_layer_2nofire_6_width = $03 18 28000 ???? 00 00 heofonfir_lucelia_layer_2nofire_5_mode = $00 19 28000 ???? 00 1d heofonfir_lucelia_layer_2nofire_5_width_twoscompliment = $1d 20 28000 ???? 00 03 heofonfir_lucelia_layer_2nofire_5_width = $03 21 28000 ???? 00 00 heofonfir_lucelia_layer_2nofire_4_mode = $00 22 28000 ???? 00 1d heofonfir_lucelia_layer_2nofire_4_width_twoscompliment = $1d 23 28000 ???? 00 03 heofonfir_lucelia_layer_2nofire_4_width = $03 24 28000 ???? 00 00 heofonfir_lucelia_layer_2nofire_3_mode = $00 25 28000 ???? 00 1d heofonfir_lucelia_layer_2nofire_3_width_twoscompliment = $1d 26 28000 ???? 00 03 heofonfir_lucelia_layer_2nofire_3_width = $03 27 28000 ???? 00 00 heofonfir_lucelia_layer_2nofire_2_mode = $00 28 28000 ???? 00 1d heofonfir_lucelia_layer_2nofire_2_width_twoscompliment = $1d 29 28000 ???? 00 03 heofonfir_lucelia_layer_2nofire_2_width = $03 30 28000 ???? 00 00 heofonfir_lucelia_layer_2nofire_1_mode = $00 31 28000 ???? 00 1d heofonfir_lucelia_layer_2nofire_1_width_twoscompliment = $1d 32 28000 ???? 00 03 heofonfir_lucelia_layer_2nofire_1_width = $03 33 28000 ???? 00 00 heofonfir_lucelia_layer1_8_mode = $00 34 28000 ???? 00 1d heofonfir_lucelia_layer1_8_width_twoscompliment = $1d 35 28000 ???? 00 03 heofonfir_lucelia_layer1_8_width = $03 36 28000 ???? 00 00 heofonfir_lucelia_layer1_7_mode = $00 37 28000 ???? 00 1d heofonfir_lucelia_layer1_7_width_twoscompliment = $1d 38 28000 ???? 00 03 heofonfir_lucelia_layer1_7_width = $03 39 28000 ???? 00 00 heofonfir_lucelia_layer1_6_mode = $00 40 28000 ???? 00 1d heofonfir_lucelia_layer1_6_width_twoscompliment = $1d 41 28000 ???? 00 03 heofonfir_lucelia_layer1_6_width = $03 42 28000 ???? 00 00 heofonfir_lucelia_layer1_5_mode = $00 43 28000 ???? 00 1d heofonfir_lucelia_layer1_5_width_twoscompliment = $1d 44 28000 ???? 00 03 heofonfir_lucelia_layer1_5_width = $03 45 28000 ???? 00 00 heofonfir_lucelia_layer1_4_mode = $00 46 28000 ???? 00 1d heofonfir_lucelia_layer1_4_width_twoscompliment = $1d 47 28000 ???? 00 03 heofonfir_lucelia_layer1_4_width = $03 48 28000 ???? 00 00 heofonfir_lucelia_layer1_3_mode = $00 49 28000 ???? 00 1d heofonfir_lucelia_layer1_3_width_twoscompliment = $1d 50 28000 ???? 00 03 heofonfir_lucelia_layer1_3_width = $03 51 28000 ???? 00 00 heofonfir_lucelia_layer1_2_mode = $00 52 28000 ???? 00 1d heofonfir_lucelia_layer1_2_width_twoscompliment = $1d 53 28000 ???? 00 03 heofonfir_lucelia_layer1_2_width = $03 54 28000 ???? 00 00 heofonfir_lucelia_layer1_1_mode = $00 55 28000 ???? 00 1d heofonfir_lucelia_layer1_1_width_twoscompliment = $1d 56 28000 ???? 00 03 heofonfir_lucelia_layer1_1_width = $03 57 28000 ???? 00 18 sfx_fire_a_length = .skipL0142-sfx_fire_a 58 28000 ???? 59 28000 ???? 00 01 BOXCOLLISION = 1 60 28000 ???? 00 42 heofonfir_bomb_bug_color3 = $42 61 28000 ???? 00 01 heofonfir_bomb_bug_color2 = $01 62 28000 ???? 00 36 heofonfir_bomb_bug_color1 = $36 63 28000 ???? 00 00 heofonfir_bomb_bug_color0 = $00 64 28000 ???? 00 28 heofonfir_bullet_color3 = $28 65 28000 ???? 00 2c heofonfir_bullet_color2 = $2c 66 28000 ???? 00 0f heofonfir_bullet_color1 = $0f 67 28000 ???? 00 00 heofonfir_bullet_color0 = $00 68 28000 ???? 00 26 heofonfir_lucelia_layer_2nofire_8_color3 = $26 69 28000 ???? 00 04 heofonfir_lucelia_layer_2nofire_8_color2 = $04 70 28000 ???? 00 3c heofonfir_lucelia_layer_2nofire_8_color1 = $3c 71 28000 ???? 00 00 heofonfir_lucelia_layer_2nofire_8_color0 = $00 72 28000 ???? 00 26 heofonfir_lucelia_layer_2nofire_7_color3 = $26 73 28000 ???? 00 04 heofonfir_lucelia_layer_2nofire_7_color2 = $04 74 28000 ???? 00 3c heofonfir_lucelia_layer_2nofire_7_color1 = $3c 75 28000 ???? 00 00 heofonfir_lucelia_layer_2nofire_7_color0 = $00 76 28000 ???? 00 26 heofonfir_lucelia_layer_2nofire_6_color3 = $26 77 28000 ???? 00 04 heofonfir_lucelia_layer_2nofire_6_color2 = $04 78 28000 ???? 00 3c heofonfir_lucelia_layer_2nofire_6_color1 = $3c 79 28000 ???? 00 00 heofonfir_lucelia_layer_2nofire_6_color0 = $00 80 28000 ???? 00 26 heofonfir_lucelia_layer_2nofire_5_color3 = $26 81 28000 ???? 00 04 heofonfir_lucelia_layer_2nofire_5_color2 = $04 82 28000 ???? 00 3c heofonfir_lucelia_layer_2nofire_5_color1 = $3c 83 28000 ???? 00 00 heofonfir_lucelia_layer_2nofire_5_color0 = $00 84 28000 ???? 00 26 heofonfir_lucelia_layer_2nofire_4_color3 = $26 85 28000 ???? 00 04 heofonfir_lucelia_layer_2nofire_4_color2 = $04 86 28000 ???? 00 3c heofonfir_lucelia_layer_2nofire_4_color1 = $3c 87 28000 ???? 00 00 heofonfir_lucelia_layer_2nofire_4_color0 = $00 88 28000 ???? 00 26 heofonfir_lucelia_layer_2nofire_3_color3 = $26 89 28000 ???? 00 04 heofonfir_lucelia_layer_2nofire_3_color2 = $04 90 28000 ???? 00 3c heofonfir_lucelia_layer_2nofire_3_color1 = $3c 91 28000 ???? 00 00 heofonfir_lucelia_layer_2nofire_3_color0 = $00 92 28000 ???? 00 26 heofonfir_lucelia_layer_2nofire_2_color3 = $26 93 28000 ???? 00 04 heofonfir_lucelia_layer_2nofire_2_color2 = $04 94 28000 ???? 00 3c heofonfir_lucelia_layer_2nofire_2_color1 = $3c 95 28000 ???? 00 00 heofonfir_lucelia_layer_2nofire_2_color0 = $00 96 28000 ???? 00 26 heofonfir_lucelia_layer_2nofire_1_color3 = $26 97 28000 ???? 00 04 heofonfir_lucelia_layer_2nofire_1_color2 = $04 98 28000 ???? 00 3c heofonfir_lucelia_layer_2nofire_1_color1 = $3c 99 28000 ???? 00 00 heofonfir_lucelia_layer_2nofire_1_color0 = $00 100 28000 ???? 00 28 heofonfir_lucelia_layer1_8_color3 = $28 101 28000 ???? 00 2c heofonfir_lucelia_layer1_8_color2 = $2c 102 28000 ???? 00 0f heofonfir_lucelia_layer1_8_color1 = $0f 103 28000 ???? 00 00 heofonfir_lucelia_layer1_8_color0 = $00 104 28000 ???? 00 28 heofonfir_lucelia_layer1_7_color3 = $28 105 28000 ???? 00 2c heofonfir_lucelia_layer1_7_color2 = $2c 106 28000 ???? 00 0f heofonfir_lucelia_layer1_7_color1 = $0f 107 28000 ???? 00 00 heofonfir_lucelia_layer1_7_color0 = $00 108 28000 ???? 00 28 heofonfir_lucelia_layer1_6_color3 = $28 109 28000 ???? 00 2c heofonfir_lucelia_layer1_6_color2 = $2c 110 28000 ???? 00 0f heofonfir_lucelia_layer1_6_color1 = $0f 111 28000 ???? 00 00 heofonfir_lucelia_layer1_6_color0 = $00 112 28000 ???? 00 28 heofonfir_lucelia_layer1_5_color3 = $28 113 28000 ???? 00 0f heofonfir_lucelia_layer1_5_color2 = $0f 114 28000 ???? 00 2c heofonfir_lucelia_layer1_5_color1 = $2c 115 28000 ???? 00 00 heofonfir_lucelia_layer1_5_color0 = $00 116 28000 ???? 00 28 heofonfir_lucelia_layer1_4_color3 = $28 117 28000 ???? 00 0f heofonfir_lucelia_layer1_4_color2 = $0f 118 28000 ???? 00 2c heofonfir_lucelia_layer1_4_color1 = $2c 119 28000 ???? 00 00 heofonfir_lucelia_layer1_4_color0 = $00 120 28000 ???? 00 28 heofonfir_lucelia_layer1_3_color3 = $28 121 28000 ???? 00 0f heofonfir_lucelia_layer1_3_color2 = $0f 122 28000 ???? 00 2c heofonfir_lucelia_layer1_3_color1 = $2c 123 28000 ???? 00 00 heofonfir_lucelia_layer1_3_color0 = $00 124 28000 ???? 00 28 heofonfir_lucelia_layer1_2_color3 = $28 125 28000 ???? 00 0f heofonfir_lucelia_layer1_2_color2 = $0f 126 28000 ???? 00 2c heofonfir_lucelia_layer1_2_color1 = $2c 127 28000 ???? 00 00 heofonfir_lucelia_layer1_2_color0 = $00 128 28000 ???? 00 28 heofonfir_lucelia_layer1_1_color3 = $28 129 28000 ???? 00 2c heofonfir_lucelia_layer1_1_color2 = $2c 130 28000 ???? 00 0f heofonfir_lucelia_layer1_1_color1 = $0f 131 28000 ???? 00 00 heofonfir_lucelia_layer1_1_color0 = $00 132 28000 ???? 01 5c isDead_flag = var28 133 28000 ???? 134 28000 ???? 01 5b enemy01_ypos = var27 135 28000 ???? 136 28000 ???? 01 5a enemy01_xpos = var26 137 28000 ???? 138 28000 ???? 01 59 player_flag = var25 139 28000 ???? 140 28000 ???? 01 58 player_bullet1_time = var24 141 28000 ???? 142 28000 ???? 01 57 customtemp3 = var23 143 28000 ???? 144 28000 ???? 01 56 customtemp2 = var22 145 28000 ???? 146 28000 ???? 01 55 customtemp1 = var21 147 28000 ???? 148 28000 ???? 01 54 temp_y = var20 149 28000 ???? 150 28000 ???? 01 53 temp_x = var19 151 28000 ???? 152 28000 ???? 01 52 temp_loop = var18 153 28000 ???? 154 28000 ???? 01 51 player_bullet_y3 = var17 155 28000 ???? 156 28000 ???? 01 50 player_bullet_x3 = var16 157 28000 ???? 158 28000 ???? 01 4f player_bullet_y2 = var15 159 28000 ???? 160 28000 ???? 01 4e player_bullet_x2 = var14 161 28000 ???? 162 28000 ???? 01 4d player_bullet_y1 = var13 163 28000 ???? 164 28000 ???? 01 4c player_bullet_x1 = var12 165 28000 ???? 166 28000 ???? 01 4b tiley = var11 167 28000 ???? 168 28000 ???? 01 4a tilex = var10 169 28000 ???? 170 28000 ???? 01 49 player_l2_AniFrame = var9 171 28000 ???? 172 28000 ???? 01 48 joyposright = var8 173 28000 ???? 174 28000 ???? 01 47 joyposleft = var7 175 28000 ???? 176 28000 ???? 01 46 joyposup = var6 177 28000 ???? 178 28000 ???? 01 45 joyposdown = var5 179 28000 ???? 180 28000 ???? 01 44 player_l1_AniFrame = var4 181 28000 ???? 182 28000 ???? 01 43 fire_debounce = var3 183 28000 ???? 184 28000 ???? 01 42 playerY = var2 185 28000 ???? 186 28000 ???? 01 41 playerX = var1 187 28000 ???? 188 28000 ???? 01 40 frameCounter = var0 189 28000 ???? 190 28000 ???? 00 01 EXTRADLMEMORY = 1 191 28000 ???? 00 01 NTSC = 1 192 28000 ???? 00 10 ZONEHEIGHT = 16 193 28000 ???? 00 01 SGRAM = 1 194 28000 ???? 00 08 bankswitchmode = 8 195 28000 ???? 00 01 ROM128K = 1 ------- FILE 7800basic.h 6 28000 ???? 7 28000 ???? ;************ 7800 overall RAM map ************** 8 28000 ???? 9 28000 ???? ; 40-FF zero page RAM 10 28000 ???? ; 140-1FF RAM (stack) 11 28000 ???? ; 1800-203F RAM 12 28000 ???? ; 2100-213F RAM 13 28000 ???? ; 2200-27FF RAM 14 28000 ???? 15 28000 ???? ;************ 7800basic RAM usage map ************** 16 28000 ???? 17 28000 ???? ; 40-FF numerous defines, listed below 18 28000 ???? ; 140-1FF RAM (stack) 19 28000 ???? 20 28000 ???? ; 1800-187F DLL (1800-18DF with page flipping enabled) 21 28000 ???? ; 1880-1FFF DLs (18E0-1FFF with page flipping enabled) 22 28000 ???? 23 28000 ???? ; 2000-203F Reserved 24 28000 ???? ; 2100-213F Reserved 25 28000 ???? ; 2200-27FF Free 26 28000 ???? 27 28000 ???? 1f e0 eeprombuffer = $1FE0 28 28000 ???? 18 00 DLLMEM = $1800 29 28000 ???? 00 70 DBOFFSET = $70 ; $E0 length DL is /2 for double-buffering 30 28000 ???? 31 28000 ???? - ifconst PLOTVALUEPAGE 32 28000 ???? -VALBUFFER = (PLOTVALUEPAGE*256) 33 28000 ???? else 34 28000 ???? 20 00 VALBUFFER = $2000 ; to $203F ** never let VALBUFFER straddle pages 35 28000 ???? endif 36 28000 ???? 37 28000 ???? 38 28000 ???? 21 00 pausestate = $2100 39 28000 ???? 21 01 dlzero = $2101 ; zero to force end of $2100 DL, which we use in vblank and overscan 40 28000 ???? 21 02 sINPT1 = $2102 ; save register for joy button joy0 41 28000 ???? 21 03 sINPT3 = $2103 ; save register for joy button joy1 42 28000 ???? 21 04 currentbank = $2104 43 28000 ???? 44 28000 ???? 21 05 currentrambank = $2105 45 28000 ???? 21 06 charactermode = $2106 46 28000 ???? 21 07 sCTRL = $2107 47 28000 ???? 21 08 pokeydetected = $2108 48 28000 ???? 21 09 paldetected = $2109 49 28000 ???? 21 0a avoxdetected = $210A 50 28000 ???? 21 0b sCHARBASE = $210B ; save register for CHARBASE 51 28000 ???? 52 28000 ???? 21 0c hsdevice = $210C 53 28000 ???? 21 0d hsdifficulty = $210D 54 28000 ???? 21 0e hserror = $210E 55 28000 ???? 21 0f hsgameslot = $210F 56 28000 ???? 21 10 hsnewscoreline = $2110 57 28000 ???? 21 11 hsnewscorerank = $2111 58 28000 ???? 21 12 HSRAMTable = $2112 ; to $212F (30 bytes) Format: III*5, SSS*5 59 28000 ???? 21 12 HSRAMInitials = $2112 ; see above 60 28000 ???? 21 21 HSRAMScores = $2121 ; see above 61 28000 ???? 62 28000 ???? 21 31 ssCTRL = $2131 63 28000 ???? 21 32 ssCHARBASE = $2132 64 28000 ???? 21 33 hsdisplaymode = $2133 65 28000 ???? 21 34 gamedifficulty = $2134 66 28000 ???? 21 35 hsinitialpos = $2135 67 28000 ???? 21 36 hsinitialhold = $2136 68 28000 ???? 21 37 hscursorx = $2137 69 28000 ???? 21 38 hsjoydebounce = $2138 70 28000 ???? 21 39 hsswcha = $2139 71 28000 ???? 21 3a hsinpt1 = $213A 72 28000 ???? 21 3b hscolorchaseindex = $213B 73 28000 ???? 21 3c visibleDLLstart = $213C 74 28000 ???? 21 3d overscanDLLstart = $213D 75 28000 ???? 21 3e frameslost = $213E 76 28000 ???? 77 28000 ???? 78 28000 ???? 00 40 rand = $40 79 28000 ???? 00 41 rand16 = $41 80 28000 ???? 00 42 temp1 = $42 81 28000 ???? 00 43 temp2 = $43 82 28000 ???? 00 44 temp3 = $44 83 28000 ???? 00 45 temp4 = $45 84 28000 ???? 00 46 temp5 = $46 85 28000 ???? 00 47 temp6 = $47 86 28000 ???? 00 48 temp7 = $48 87 28000 ???? 00 49 temp8 = $49 88 28000 ???? 00 4a temp9 = $4a 89 28000 ???? 90 28000 ???? 00 4b pokeybase = $4b 91 28000 ???? 00 4b pokeybaselo = $4b 92 28000 ???? 00 4c pokeybasehi = $4c 93 28000 ???? 94 28000 ???? 00 4d visibleover = $4d 95 28000 ???? 96 28000 ???? 00 4e sfx1pointlo = $4e 97 28000 ???? 00 4f sfx2pointlo = $4f 98 28000 ???? 00 50 sfx1pointhi = $50 99 28000 ???? 00 51 sfx2pointhi = $51 100 28000 ???? 101 28000 ???? 00 52 sfx1priority = $52 102 28000 ???? 00 53 sfx2priority = $53 103 28000 ???? 00 54 sfx1poffset = $54 104 28000 ???? 00 55 sfx2poffset = $55 105 28000 ???? 106 28000 ???? 00 56 sfx1frames = $56 107 28000 ???? 00 57 sfx2frames = $57 108 28000 ???? 00 58 sfx1tick = $58 109 28000 ???? 00 59 sfx2tick = $59 110 28000 ???? 111 28000 ???? 00 5a tempmath = $5a 112 28000 ???? 113 28000 ???? 00 5b pokey1pointlo = $5b 114 28000 ???? 00 5c pokey1pointhi = $5c 115 28000 ???? 00 5d pokey2pointlo = $5d 116 28000 ???? 00 5e pokey2pointhi = $5e 117 28000 ???? 00 5f pokey3pointlo = $5f 118 28000 ???? 00 60 pokey3pointhi = $60 119 28000 ???? 00 61 pokey4pointlo = $61 120 28000 ???? 00 62 pokey4pointhi = $62 121 28000 ???? 122 28000 ???? 00 63 dlpnt = $63 ; to $64 123 28000 ???? 00 65 dlend = $65 ; to $81 - for 28 possible visible dll entries 124 28000 ???? 00 82 dlendsave = $82 ; to $9e - for 28 possible visible dll entries 125 28000 ???? 126 28000 ???? 00 9f speech_addr = $9f 127 28000 ???? 00 a0 speech_addr_hi = $a0 128 28000 ???? 129 28000 ???? 00 a1 HSGameTableLo = $a1 130 28000 ???? 00 a2 HSGameTableHi = $a2 131 28000 ???? 00 a3 HSVoxHi = $a3 132 28000 ???? 00 a4 HSVoxLo = $a4 133 28000 ???? 134 28000 ???? ;channel pointers 135 28000 ???? 136 28000 ???? 00 a5 songchannel1layer1lo = $a5 137 28000 ???? 00 a6 songchannel2layer1lo = $a6 138 28000 ???? 00 a7 songchannel3layer1lo = $a7 139 28000 ???? 00 a8 songchannel4layer1lo = $a8 140 28000 ???? 141 28000 ???? 00 a9 songchannel1layer2lo = $a9 142 28000 ???? 00 aa songchannel2layer2lo = $aA 143 28000 ???? 00 ab songchannel3layer2lo = $aB 144 28000 ???? 00 ac songchannel4layer2lo = $aC 145 28000 ???? 146 28000 ???? 00 ad songchannel1layer3lo = $aD 147 28000 ???? 00 ae songchannel2layer3lo = $aE 148 28000 ???? 00 af songchannel3layer3lo = $aF 149 28000 ???? 00 b0 songchannel4layer3lo = $b0 150 28000 ???? 151 28000 ???? 00 b1 songchannel1layer1hi = $b1 152 28000 ???? 00 b2 songchannel2layer1hi = $b2 153 28000 ???? 00 b3 songchannel3layer1hi = $b3 154 28000 ???? 00 b4 songchannel4layer1hi = $b4 155 28000 ???? 156 28000 ???? 00 b5 songchannel1layer2hi = $b5 157 28000 ???? 00 b6 songchannel2layer2hi = $b6 158 28000 ???? 00 b7 songchannel3layer2hi = $b7 159 28000 ???? 00 b8 songchannel4layer2hi = $b8 160 28000 ???? 161 28000 ???? 00 b9 songchannel1layer3hi = $b9 162 28000 ???? 00 ba songchannel2layer3hi = $bA 163 28000 ???? 00 bb songchannel3layer3hi = $bB 164 28000 ???? 00 bc songchannel4layer3hi = $bC 165 28000 ???? 166 28000 ???? 00 bd songdatalo = $bd 167 28000 ???? 00 be songdatahi = $be 168 28000 ???? 169 28000 ???? 00 bf inactivechannelcount = $bf 170 28000 ???? 171 28000 ???? 172 28000 ???? 00 c0 songchannel1transpose = $c0 173 28000 ???? 00 c1 songchannel2transpose = $c1 174 28000 ???? 00 c2 songchannel3transpose = $c2 175 28000 ???? 00 c3 songchannel4transpose = $c3 176 28000 ???? 177 28000 ???? 00 c4 songstackindex = $c4 178 28000 ???? 179 28000 ???? 00 c5 songchannel1instrumentlo = $c5 180 28000 ???? 00 c6 songchannel2instrumentlo = $c6 181 28000 ???? 00 c7 songchannel3instrumentlo = $c7 182 28000 ???? 00 c8 songchannel4instrumentlo = $c8 183 28000 ???? 184 28000 ???? 00 c9 songchannel1instrumenthi = $c9 185 28000 ???? 00 ca songchannel2instrumenthi = $ca 186 28000 ???? 00 cb songchannel3instrumenthi = $cb 187 28000 ???? 00 cc songchannel4instrumenthi = $cc 188 28000 ???? 189 28000 ???? 00 cd sfx1notedata = $cd 190 28000 ???? 00 ce sfx2notedata = $ce 191 28000 ???? 192 28000 ???? 00 cf songloops = $cf 193 28000 ???? 194 28000 ???? 00 d0 songpointerlo = $D0 195 28000 ???? 00 d1 songpointerhi = $D1 196 28000 ???? 197 28000 ???? 00 d2 voxlock = $D2 198 28000 ???? 00 d3 voxqueuesize = $D3 199 28000 ???? 200 28000 ???? 00 d4 vblankroutines = $D4 201 28000 ???? 202 28000 ???? 00 d5 doublebufferstate = $D5 203 28000 ???? 00 d6 doublebufferdloffset = $D6 204 28000 ???? 00 d7 doublebufferbufferdirty = $D7 205 28000 ???? 206 28000 ???? 00 d8 inttemp1 = $D8 207 28000 ???? 00 d9 inttemp2 = $D9 208 28000 ???? 00 da inttemp3 = $DA 209 28000 ???? 00 db inttemp4 = $DB 210 28000 ???? 00 dc inttemp5 = $DC 211 28000 ???? 00 dd inttemp6 = $DD 212 28000 ???? 213 28000 ???? 00 de sfxschedulelock = $DE 214 28000 ???? 00 df sfxschedulemissed = $DF 215 28000 ???? 00 e0 sfxinstrumentlo = $E0 216 28000 ???? 00 e1 sfxinstrumenthi = $E1 217 28000 ???? 00 e2 sfxpitchoffset = $E2 218 28000 ???? 00 e3 sfxnoteindex = $E3 219 28000 ???? 220 28000 ???? 00 e4 CTLSWAs = $E4 221 28000 ???? 00 e5 CTLSWBs = $E5 222 28000 ???? 223 28000 ???? 00 e6 A = $e6 224 28000 ???? 00 e6 a = $e6 225 28000 ???? 00 e7 B = $e7 226 28000 ???? 00 e7 b = $e7 227 28000 ???? 00 e8 C = $e8 228 28000 ???? 00 e8 c = $e8 229 28000 ???? 00 e9 D = $e9 230 28000 ???? 00 e9 d = $e9 231 28000 ???? 00 ea E = $ea 232 28000 ???? 00 ea e = $ea 233 28000 ???? 00 eb F = $eb 234 28000 ???? 00 eb f = $eb 235 28000 ???? 00 ec G = $ec 236 28000 ???? 00 ec g = $ec 237 28000 ???? 00 ed H = $ed 238 28000 ???? 00 ed h = $ed 239 28000 ???? 00 ee I = $ee 240 28000 ???? 00 ee i = $ee 241 28000 ???? 00 ef J = $ef 242 28000 ???? 00 ef j = $ef 243 28000 ???? 00 f0 K = $f0 244 28000 ???? 00 f0 k = $f0 245 28000 ???? 00 f1 L = $f1 246 28000 ???? 00 f1 l = $f1 247 28000 ???? 00 f2 M = $f2 248 28000 ???? 00 f2 m = $f2 249 28000 ???? 00 f3 N = $f3 250 28000 ???? 00 f3 n = $f3 251 28000 ???? 00 f4 O = $f4 252 28000 ???? 00 f4 o = $f4 253 28000 ???? 00 f5 P = $f5 254 28000 ???? 00 f5 p = $f5 255 28000 ???? 00 f6 Q = $f6 256 28000 ???? 00 f6 q = $f6 257 28000 ???? 00 f7 R = $f7 258 28000 ???? 00 f7 r = $f7 259 28000 ???? 00 f8 S = $f8 260 28000 ???? 00 f8 s = $f8 261 28000 ???? 00 f9 T = $f9 262 28000 ???? 00 f9 t = $f9 263 28000 ???? 00 fa U = $fa 264 28000 ???? 00 fa u = $fa 265 28000 ???? 00 fb V = $fb 266 28000 ???? 00 fb v = $fb 267 28000 ???? 00 fc W = $fc 268 28000 ???? 00 fc w = $fc 269 28000 ???? 00 fd X = $fd 270 28000 ???? 00 fd x = $fd 271 28000 ???? 00 fe Y = $fe 272 28000 ???? 00 fe y = $fe 273 28000 ???? 00 ff Z = $ff 274 28000 ???? 00 ff z = $ff 275 28000 ???? 276 28000 ???? ; var0-var99 variables use the top of the stack 277 28000 ???? 01 40 var0 = $140 278 28000 ???? 01 41 var1 = $141 279 28000 ???? 01 42 var2 = $142 280 28000 ???? 01 43 var3 = $143 281 28000 ???? 01 44 var4 = $144 282 28000 ???? 01 45 var5 = $145 283 28000 ???? 01 46 var6 = $146 284 28000 ???? 01 47 var7 = $147 285 28000 ???? 01 48 var8 = $148 286 28000 ???? 01 49 var9 = $149 287 28000 ???? 01 4a var10 = $14a 288 28000 ???? 01 4b var11 = $14b 289 28000 ???? 01 4c var12 = $14c 290 28000 ???? 01 4d var13 = $14d 291 28000 ???? 01 4e var14 = $14e 292 28000 ???? 01 4f var15 = $14f 293 28000 ???? 01 50 var16 = $150 294 28000 ???? 01 51 var17 = $151 295 28000 ???? 01 52 var18 = $152 296 28000 ???? 01 53 var19 = $153 297 28000 ???? 01 54 var20 = $154 298 28000 ???? 01 55 var21 = $155 299 28000 ???? 01 56 var22 = $156 300 28000 ???? 01 57 var23 = $157 301 28000 ???? 01 58 var24 = $158 302 28000 ???? 01 59 var25 = $159 303 28000 ???? 01 5a var26 = $15a 304 28000 ???? 01 5b var27 = $15b 305 28000 ???? 01 5c var28 = $15c 306 28000 ???? 01 5d var29 = $15d 307 28000 ???? 01 5e var30 = $15e 308 28000 ???? 01 5f var31 = $15f 309 28000 ???? 01 60 var32 = $160 310 28000 ???? 01 61 var33 = $161 311 28000 ???? 01 62 var34 = $162 312 28000 ???? 01 63 var35 = $163 313 28000 ???? 01 64 var36 = $164 314 28000 ???? 01 65 var37 = $165 315 28000 ???? 01 66 var38 = $166 316 28000 ???? 01 67 var39 = $167 317 28000 ???? 01 68 var40 = $168 318 28000 ???? 01 69 var41 = $169 319 28000 ???? 01 6a var42 = $16a 320 28000 ???? 01 6b var43 = $16b 321 28000 ???? 01 6c var44 = $16c 322 28000 ???? 01 6d var45 = $16d 323 28000 ???? 01 6e var46 = $16e 324 28000 ???? 01 6f var47 = $16f 325 28000 ???? 01 70 var48 = $170 326 28000 ???? 01 71 var49 = $171 327 28000 ???? 01 72 var50 = $172 328 28000 ???? 01 73 var51 = $173 329 28000 ???? 01 74 var52 = $174 330 28000 ???? 01 75 var53 = $175 331 28000 ???? 01 76 var54 = $176 332 28000 ???? 01 77 var55 = $177 333 28000 ???? 01 78 var56 = $178 334 28000 ???? 01 79 var57 = $179 335 28000 ???? 01 7a var58 = $17a 336 28000 ???? 01 7b var59 = $17b 337 28000 ???? 01 7c var60 = $17c 338 28000 ???? 01 7d var61 = $17d 339 28000 ???? 01 7e var62 = $17e 340 28000 ???? 01 7f var63 = $17f 341 28000 ???? 01 80 var64 = $180 342 28000 ???? 01 81 var65 = $181 343 28000 ???? 01 82 var66 = $182 344 28000 ???? 01 83 var67 = $183 345 28000 ???? 01 84 var68 = $184 346 28000 ???? 01 85 var69 = $185 347 28000 ???? 01 86 var70 = $186 348 28000 ???? 01 87 var71 = $187 349 28000 ???? 01 88 var72 = $188 350 28000 ???? 01 89 var73 = $189 351 28000 ???? 01 8a var74 = $18a 352 28000 ???? 01 8b var75 = $18b 353 28000 ???? 01 8c var76 = $18c 354 28000 ???? 01 8d var77 = $18d 355 28000 ???? 01 8e var78 = $18e 356 28000 ???? 01 8f var79 = $18f 357 28000 ???? 01 90 var80 = $190 358 28000 ???? 01 91 var81 = $191 359 28000 ???? 01 92 var82 = $192 360 28000 ???? 01 93 var83 = $193 361 28000 ???? 01 94 var84 = $194 362 28000 ???? 01 95 var85 = $195 363 28000 ???? 01 96 var86 = $196 364 28000 ???? 01 97 var87 = $197 365 28000 ???? 01 98 var88 = $198 366 28000 ???? 01 99 var89 = $199 367 28000 ???? 01 9a var90 = $19a 368 28000 ???? 01 9b var91 = $19b 369 28000 ???? 01 9c var92 = $19c 370 28000 ???? 01 9d var93 = $19d 371 28000 ???? 01 9e var94 = $19e 372 28000 ???? 01 9f var95 = $19f 373 28000 ???? 01 a0 var96 = $1a0 374 28000 ???? 01 a1 var97 = $1a1 375 28000 ???? 01 a2 var98 = $1a2 376 28000 ???? 01 a3 var99 = $1a3 377 28000 ???? 378 U01c2 ???? SEG.U "7800basicRAM" 379 U01a4 ORG $1A4 380 U01a4 381 U01a4 ; MAX allocation locations are in comments... 382 U01a4 00 framecounter DS 1 ; $1A4 383 U01a5 00 countdownseconds DS 1 ; $1A5 384 U01a6 00 00 00 score0 DS 3 ; $1A6 $1A7 $1A8 385 U01a9 00 00 00 score1 DS 3 ; $1A9 $1AA $1AB 386 U01ac 00 pausebuttonflag DS 1 ; $1AC 387 U01ad 00 valbufend DS 1 ; $1AD 388 U01ae 00 valbufendsave DS 1 ; $1AE 389 U01af 00 finescrollx DS 1 ; $1AF 390 U01b0 00 finescrolly DS 1 ; $1B0 391 U01b1 00 joybuttonmode DS 1 ; $1B1 ; track joysticks that were changed to one-button mode 392 U01b2 00 interruptindex DS 1 ; $1B2 393 U01b3 394 U01b3 - ifconst DOUBLEBUFFER 395 U01b3 -doublebufferminimumframetarget DS 1 ; $1B3 396 U01b3 -doublebufferminimumframeindex DS 1 ; $1B4 397 U01b3 endif 398 U01b3 399 U01b3 00 pausedisable DS 1 ; $1B5 400 U01b4 00 XCTRL1s DS 1 ; $1B6 401 U01b5 402 U01b5 - ifconst AVOXVOICE 403 U01b5 -avoxenable DS 1 ; $1B7 404 U01b5 -tempavox DS 1 ; $1B8 405 U01b5 endif 406 U01b5 407 U01b5 - ifconst MUSICTRACKER 408 U01b5 -songtempo DS 1 ; $1B9 409 U01b5 -songtick DS 1 ; $1BA 410 U01b5 - 411 U01b5 -songchannel1layer1loops DS 1 ; $1BB 412 U01b5 -songchannel2layer1loops DS 1 ; $1BC 413 U01b5 -songchannel3layer1loops DS 1 ; $1BD 414 U01b5 -songchannel4layer1loops DS 1 ; $1BE 415 U01b5 - 416 U01b5 -songchannel1layer2loops DS 1 ; $1BF 417 U01b5 -songchannel2layer2loops DS 1 ; $1C0 418 U01b5 -songchannel3layer2loops DS 1 ; $1C1 419 U01b5 -songchannel4layer2loops DS 1 ; $1C2 420 U01b5 - 421 U01b5 -songchannel1layer3loops DS 1 ; $1C3 422 U01b5 -songchannel2layer3loops DS 1 ; $1C4 423 U01b5 -songchannel3layer3loops DS 1 ; $1C5 424 U01b5 -songchannel4layer3loops DS 1 ; $1C6 425 U01b5 - 426 U01b5 -songchannel1busywait DS 1 ; $1C7 427 U01b5 -songchannel2busywait DS 1 ; $1C8 428 U01b5 -songchannel3busywait DS 1 ; $1C9 429 U01b5 -songchannel4busywait DS 1 ; $1CA 430 U01b5 - 431 U01b5 -songchannel1stackdepth DS 1 ; $1CB 432 U01b5 -songchannel2stackdepth DS 1 ; $1CC 433 U01b5 -songchannel3stackdepth DS 1 ; $1CD 434 U01b5 -songchannel4stackdepth DS 1 ; $1CE 435 U01b5 endif 436 U01b5 437 U01b5 00 palframes DS 1 ; $1CF 438 U01b6 00 palfastframe DS 1 ; $1D0 439 U01b7 440 U01b7 - ifconst MOUSESUPPORT 441 U01b7 -port0resolution DS 1 ; $1D1 442 U01b7 -port1resolution DS 1 ; $1D2 443 U01b7 else 444 U01b7 - ifconst TRAKBALLSUPPORT 445 U01b7 -port0resolution DS 1 ; $1D1 446 U01b7 -port1resolution DS 1 ; $1D2 447 U01b7 endif 448 U01b7 endif 449 U01b7 450 U01b7 00 port0control DS 1 ; $1D3 451 U01b8 00 port1control DS 1 ; $1D4 452 U01b9 453 U01b9 ; port#control values... 454 U01b9 ; 1 = proline 455 U01b9 ; 2 = lightgun 456 U01b9 ; 3 = paddle 457 U01b9 ; 4 = trakball 458 U01b9 ; 5 = vcs joystick 459 U01b9 ; 6 = driving 460 U01b9 ; 7 = keypad 461 U01b9 ; 8 = st mouse/cx80 462 U01b9 ; 9 = amiga mouse 463 U01b9 ; 10 = atarivox 464 U01b9 465 U01b9 ; controller 0 data... 466 U01b9 00 paddleposition0 DS 1 ; $1D5 467 U01b9 01 b9 keypadmatrix0a = paddleposition0 468 U01b9 01 b9 drivingposition0 = paddleposition0 469 U01b9 01 b9 trakballx0 = paddleposition0 470 U01b9 01 b9 mousex0 = paddleposition0 471 U01b9 01 b9 lighttgunx0 = paddleposition0 472 U01ba 473 U01ba ; controller 1 data... 474 U01ba 00 paddleposition2 DS 1 ; $1D6 475 U01ba 01 ba keypadmatrix1a = paddleposition2 476 U01ba 01 ba drivingposition1 = paddleposition2 477 U01ba 01 ba trakballx1 = paddleposition2 478 U01ba 01 ba mousex1 = paddleposition2 479 U01ba 01 ba lightgunx1 = paddleposition2 480 U01bb 481 U01bb ; controller 0 altdata... 482 U01bb 00 paddleposition1 DS 1 ; $1D7 483 U01bb 01 bb keypadmatrix0b = paddleposition1 484 U01bb 01 bb trakbally0 = paddleposition1 485 U01bb 01 bb mousey0 = paddleposition1 486 U01bb 01 bb lightguny0 = paddleposition1 487 U01bc 488 U01bc ; controller 1 altdata... 489 U01bc 00 paddleposition3 DS 1 ; $1D8 490 U01bc 01 bc keypadmatrix1b = paddleposition3 491 U01bc 01 bc trakbally1 = paddleposition3 492 U01bc 01 bc mousey1 = paddleposition3 493 U01bc 01 bc lightguny1 = paddleposition3 494 U01bd 495 U01bd ; controller state save. for trakball state+dir codes, rotary position codes 496 U01bd 00 controller0statesave DS 1 ; $1D9 497 U01bd 01 bd paddleprevious0 = controller0statesave 498 U01bd 01 bd mousecodex0 = controller0statesave 499 U01bd 01 bd trakballcodex0 = controller0statesave 500 U01bd 01 bd keypadmatrix0c = controller0statesave 501 U01be 502 U01be 00 controller1statesave DS 1 ; $1DA 503 U01be 01 be paddleprevious2 = controller1statesave 504 U01be 01 be mousecodex1 = controller1statesave 505 U01be 01 be trakballcodex1 = controller1statesave 506 U01be 01 be keypadmatrix1c = controller1statesave 507 U01bf 508 U01bf 00 paddleprevious1 DS 1 ; $1DB 509 U01bf 01 bf keypadmatrix0d = paddleprevious1 510 U01bf 01 bf mousecodey0 = paddleprevious1 511 U01bf 01 bf trakballcodey0 = paddleprevious1 512 U01c0 513 U01c0 00 paddleprevious3 DS 1 ; $1DC 514 U01c0 01 c0 keypadmatrix1d = paddleprevious3 515 U01c0 01 c0 mousecodey1 = paddleprevious3 516 U01c0 01 c0 trakballcodey1 = paddleprevious3 517 U01c1 518 U01c1 - ifconst pokeysupport 519 U01c1 -pokey1frames DS 1 ; $1DD 520 U01c1 -pokey1tick DS 1 ; $1DE 521 U01c1 -pokey2frames DS 1 ; $1DF 522 U01c1 -pokey2tick DS 1 ; $1E0 523 U01c1 -pokey3frames DS 1 ; $1E1 524 U01c1 -pokey3tick DS 1 ; $1E2 525 U01c1 -pokey4frames DS 1 ; $1E3 526 U01c1 -pokey4tick DS 1 ; $1E4 527 U01c1 -pokey1priority DS 1 ; $1E5 528 U01c1 -pokey1offset DS 1 ; $1E6 529 U01c1 -pokey2priority DS 1 ; $1E7 530 U01c1 -pokey2offset DS 1 ; $1E8 531 U01c1 -pokey3priority DS 1 ; $1E9 532 U01c1 -pokey3offset DS 1 ; $1EA 533 U01c1 -pokey4priority DS 1 ; $1EB 534 U01c1 -pokey4offset DS 1 ; $1EC 535 U01c1 endif 536 U01c1 537 U01c1 ; see if we need an interrupthold byte... 538 U01c1 INTERRUPTNEEDED SET 0 539 U01c1 - ifconst .topscreenroutine 540 U01c1 -INTERRUPTNEEDED SET 1 541 U01c1 endif 542 U01c1 - ifconst .bottomscreenroutine 543 U01c1 -INTERRUPTNEEDED SET 1 544 U01c1 endif 545 U01c1 - ifconst .userinterrupt 546 U01c1 -INTERRUPTNEEDED SET 1 547 U01c1 endif 548 U01c1 - if INTERRUPTNEEDED = 1 549 U01c1 -interrupthold DS 1 ; $1ED 550 U01c1 endif 551 U01c1 552 U01c1 ifnconst CANARYOFF 553 U01c1 00 canary DS 1 ; $1EF 554 U01c2 endif 555 U01c2 556 U01c2 557 U01c2 - ifnconst bankswitchmode 558 U01c2 - echo " stack allowance:",[($1FF - .)/2]d,"nested subroutines." 559 U01c2 else stack allowance: 20 nested subroutines. 560 U01c2 echo " stack allowance:",[($1FF - .)/3]d,"nested subroutines." 561 U01c2 endif 562 U01c2 ifnconst CANARYOFF the canary is situated at: $1c1 563 U01c2 echo " the canary is situated at:",[canary] 564 U01c2 - else 565 U01c2 - echo " the canary is disabled." 566 U01c2 endif 567 U01c2 568 U01c2 ; $1EE - $1FF reserved for stack 569 U01c2 570 28000 ???? SEG "GAME" 571 28000 ???? ------- FILE c:\Users\Shane\Documents\my7800projects\Heofonfir\Lucelia_Movement_demo.78b.asm ------- FILE 7800basic_variable_redefs.h LEVEL 2 PASS 3 0 28000 ???? include "7800basic_variable_redefs.h" 1 28000 ???? ; This file contains variable mapping and other information for the current project. 2 28000 ???? 3 28000 ???? 00 00 heofonfir_bomb_bug_mode = $00 4 28000 ???? 00 1d heofonfir_bomb_bug_width_twoscompliment = $1d 5 28000 ???? 00 03 heofonfir_bomb_bug_width = $03 6 28000 ???? 00 00 heofonfir_bullet_mode = $00 7 28000 ???? 00 1f heofonfir_bullet_width_twoscompliment = $1f 8 28000 ???? 00 01 heofonfir_bullet_width = $01 9 28000 ???? 00 00 heofonfir_lucelia_layer_2nofire_8_mode = $00 10 28000 ???? 00 1d heofonfir_lucelia_layer_2nofire_8_width_twoscompliment = $1d 11 28000 ???? 00 03 heofonfir_lucelia_layer_2nofire_8_width = $03 12 28000 ???? 00 00 heofonfir_lucelia_layer_2nofire_7_mode = $00 13 28000 ???? 00 1d heofonfir_lucelia_layer_2nofire_7_width_twoscompliment = $1d 14 28000 ???? 00 03 heofonfir_lucelia_layer_2nofire_7_width = $03 15 28000 ???? 00 00 heofonfir_lucelia_layer_2nofire_6_mode = $00 16 28000 ???? 00 1d heofonfir_lucelia_layer_2nofire_6_width_twoscompliment = $1d 17 28000 ???? 00 03 heofonfir_lucelia_layer_2nofire_6_width = $03 18 28000 ???? 00 00 heofonfir_lucelia_layer_2nofire_5_mode = $00 19 28000 ???? 00 1d heofonfir_lucelia_layer_2nofire_5_width_twoscompliment = $1d 20 28000 ???? 00 03 heofonfir_lucelia_layer_2nofire_5_width = $03 21 28000 ???? 00 00 heofonfir_lucelia_layer_2nofire_4_mode = $00 22 28000 ???? 00 1d heofonfir_lucelia_layer_2nofire_4_width_twoscompliment = $1d 23 28000 ???? 00 03 heofonfir_lucelia_layer_2nofire_4_width = $03 24 28000 ???? 00 00 heofonfir_lucelia_layer_2nofire_3_mode = $00 25 28000 ???? 00 1d heofonfir_lucelia_layer_2nofire_3_width_twoscompliment = $1d 26 28000 ???? 00 03 heofonfir_lucelia_layer_2nofire_3_width = $03 27 28000 ???? 00 00 heofonfir_lucelia_layer_2nofire_2_mode = $00 28 28000 ???? 00 1d heofonfir_lucelia_layer_2nofire_2_width_twoscompliment = $1d 29 28000 ???? 00 03 heofonfir_lucelia_layer_2nofire_2_width = $03 30 28000 ???? 00 00 heofonfir_lucelia_layer_2nofire_1_mode = $00 31 28000 ???? 00 1d heofonfir_lucelia_layer_2nofire_1_width_twoscompliment = $1d 32 28000 ???? 00 03 heofonfir_lucelia_layer_2nofire_1_width = $03 33 28000 ???? 00 00 heofonfir_lucelia_layer1_8_mode = $00 34 28000 ???? 00 1d heofonfir_lucelia_layer1_8_width_twoscompliment = $1d 35 28000 ???? 00 03 heofonfir_lucelia_layer1_8_width = $03 36 28000 ???? 00 00 heofonfir_lucelia_layer1_7_mode = $00 37 28000 ???? 00 1d heofonfir_lucelia_layer1_7_width_twoscompliment = $1d 38 28000 ???? 00 03 heofonfir_lucelia_layer1_7_width = $03 39 28000 ???? 00 00 heofonfir_lucelia_layer1_6_mode = $00 40 28000 ???? 00 1d heofonfir_lucelia_layer1_6_width_twoscompliment = $1d 41 28000 ???? 00 03 heofonfir_lucelia_layer1_6_width = $03 42 28000 ???? 00 00 heofonfir_lucelia_layer1_5_mode = $00 43 28000 ???? 00 1d heofonfir_lucelia_layer1_5_width_twoscompliment = $1d 44 28000 ???? 00 03 heofonfir_lucelia_layer1_5_width = $03 45 28000 ???? 00 00 heofonfir_lucelia_layer1_4_mode = $00 46 28000 ???? 00 1d heofonfir_lucelia_layer1_4_width_twoscompliment = $1d 47 28000 ???? 00 03 heofonfir_lucelia_layer1_4_width = $03 48 28000 ???? 00 00 heofonfir_lucelia_layer1_3_mode = $00 49 28000 ???? 00 1d heofonfir_lucelia_layer1_3_width_twoscompliment = $1d 50 28000 ???? 00 03 heofonfir_lucelia_layer1_3_width = $03 51 28000 ???? 00 00 heofonfir_lucelia_layer1_2_mode = $00 52 28000 ???? 00 1d heofonfir_lucelia_layer1_2_width_twoscompliment = $1d 53 28000 ???? 00 03 heofonfir_lucelia_layer1_2_width = $03 54 28000 ???? 00 00 heofonfir_lucelia_layer1_1_mode = $00 55 28000 ???? 00 1d heofonfir_lucelia_layer1_1_width_twoscompliment = $1d 56 28000 ???? 00 03 heofonfir_lucelia_layer1_1_width = $03 57 28000 ???? 00 18 sfx_fire_a_length = .skipL0142-sfx_fire_a 58 28000 ???? 59 28000 ???? 00 01 BOXCOLLISION = 1 60 28000 ???? 00 42 heofonfir_bomb_bug_color3 = $42 61 28000 ???? 00 01 heofonfir_bomb_bug_color2 = $01 62 28000 ???? 00 36 heofonfir_bomb_bug_color1 = $36 63 28000 ???? 00 00 heofonfir_bomb_bug_color0 = $00 64 28000 ???? 00 28 heofonfir_bullet_color3 = $28 65 28000 ???? 00 2c heofonfir_bullet_color2 = $2c 66 28000 ???? 00 0f heofonfir_bullet_color1 = $0f 67 28000 ???? 00 00 heofonfir_bullet_color0 = $00 68 28000 ???? 00 26 heofonfir_lucelia_layer_2nofire_8_color3 = $26 69 28000 ???? 00 04 heofonfir_lucelia_layer_2nofire_8_color2 = $04 70 28000 ???? 00 3c heofonfir_lucelia_layer_2nofire_8_color1 = $3c 71 28000 ???? 00 00 heofonfir_lucelia_layer_2nofire_8_color0 = $00 72 28000 ???? 00 26 heofonfir_lucelia_layer_2nofire_7_color3 = $26 73 28000 ???? 00 04 heofonfir_lucelia_layer_2nofire_7_color2 = $04 74 28000 ???? 00 3c heofonfir_lucelia_layer_2nofire_7_color1 = $3c 75 28000 ???? 00 00 heofonfir_lucelia_layer_2nofire_7_color0 = $00 76 28000 ???? 00 26 heofonfir_lucelia_layer_2nofire_6_color3 = $26 77 28000 ???? 00 04 heofonfir_lucelia_layer_2nofire_6_color2 = $04 78 28000 ???? 00 3c heofonfir_lucelia_layer_2nofire_6_color1 = $3c 79 28000 ???? 00 00 heofonfir_lucelia_layer_2nofire_6_color0 = $00 80 28000 ???? 00 26 heofonfir_lucelia_layer_2nofire_5_color3 = $26 81 28000 ???? 00 04 heofonfir_lucelia_layer_2nofire_5_color2 = $04 82 28000 ???? 00 3c heofonfir_lucelia_layer_2nofire_5_color1 = $3c 83 28000 ???? 00 00 heofonfir_lucelia_layer_2nofire_5_color0 = $00 84 28000 ???? 00 26 heofonfir_lucelia_layer_2nofire_4_color3 = $26 85 28000 ???? 00 04 heofonfir_lucelia_layer_2nofire_4_color2 = $04 86 28000 ???? 00 3c heofonfir_lucelia_layer_2nofire_4_color1 = $3c 87 28000 ???? 00 00 heofonfir_lucelia_layer_2nofire_4_color0 = $00 88 28000 ???? 00 26 heofonfir_lucelia_layer_2nofire_3_color3 = $26 89 28000 ???? 00 04 heofonfir_lucelia_layer_2nofire_3_color2 = $04 90 28000 ???? 00 3c heofonfir_lucelia_layer_2nofire_3_color1 = $3c 91 28000 ???? 00 00 heofonfir_lucelia_layer_2nofire_3_color0 = $00 92 28000 ???? 00 26 heofonfir_lucelia_layer_2nofire_2_color3 = $26 93 28000 ???? 00 04 heofonfir_lucelia_layer_2nofire_2_color2 = $04 94 28000 ???? 00 3c heofonfir_lucelia_layer_2nofire_2_color1 = $3c 95 28000 ???? 00 00 heofonfir_lucelia_layer_2nofire_2_color0 = $00 96 28000 ???? 00 26 heofonfir_lucelia_layer_2nofire_1_color3 = $26 97 28000 ???? 00 04 heofonfir_lucelia_layer_2nofire_1_color2 = $04 98 28000 ???? 00 3c heofonfir_lucelia_layer_2nofire_1_color1 = $3c 99 28000 ???? 00 00 heofonfir_lucelia_layer_2nofire_1_color0 = $00 100 28000 ???? 00 28 heofonfir_lucelia_layer1_8_color3 = $28 101 28000 ???? 00 2c heofonfir_lucelia_layer1_8_color2 = $2c 102 28000 ???? 00 0f heofonfir_lucelia_layer1_8_color1 = $0f 103 28000 ???? 00 00 heofonfir_lucelia_layer1_8_color0 = $00 104 28000 ???? 00 28 heofonfir_lucelia_layer1_7_color3 = $28 105 28000 ???? 00 2c heofonfir_lucelia_layer1_7_color2 = $2c 106 28000 ???? 00 0f heofonfir_lucelia_layer1_7_color1 = $0f 107 28000 ???? 00 00 heofonfir_lucelia_layer1_7_color0 = $00 108 28000 ???? 00 28 heofonfir_lucelia_layer1_6_color3 = $28 109 28000 ???? 00 2c heofonfir_lucelia_layer1_6_color2 = $2c 110 28000 ???? 00 0f heofonfir_lucelia_layer1_6_color1 = $0f 111 28000 ???? 00 00 heofonfir_lucelia_layer1_6_color0 = $00 112 28000 ???? 00 28 heofonfir_lucelia_layer1_5_color3 = $28 113 28000 ???? 00 0f heofonfir_lucelia_layer1_5_color2 = $0f 114 28000 ???? 00 2c heofonfir_lucelia_layer1_5_color1 = $2c 115 28000 ???? 00 00 heofonfir_lucelia_layer1_5_color0 = $00 116 28000 ???? 00 28 heofonfir_lucelia_layer1_4_color3 = $28 117 28000 ???? 00 0f heofonfir_lucelia_layer1_4_color2 = $0f 118 28000 ???? 00 2c heofonfir_lucelia_layer1_4_color1 = $2c 119 28000 ???? 00 00 heofonfir_lucelia_layer1_4_color0 = $00 120 28000 ???? 00 28 heofonfir_lucelia_layer1_3_color3 = $28 121 28000 ???? 00 0f heofonfir_lucelia_layer1_3_color2 = $0f 122 28000 ???? 00 2c heofonfir_lucelia_layer1_3_color1 = $2c 123 28000 ???? 00 00 heofonfir_lucelia_layer1_3_color0 = $00 124 28000 ???? 00 28 heofonfir_lucelia_layer1_2_color3 = $28 125 28000 ???? 00 0f heofonfir_lucelia_layer1_2_color2 = $0f 126 28000 ???? 00 2c heofonfir_lucelia_layer1_2_color1 = $2c 127 28000 ???? 00 00 heofonfir_lucelia_layer1_2_color0 = $00 128 28000 ???? 00 28 heofonfir_lucelia_layer1_1_color3 = $28 129 28000 ???? 00 2c heofonfir_lucelia_layer1_1_color2 = $2c 130 28000 ???? 00 0f heofonfir_lucelia_layer1_1_color1 = $0f 131 28000 ???? 00 00 heofonfir_lucelia_layer1_1_color0 = $00 132 28000 ???? 01 5c isDead_flag = var28 133 28000 ???? 134 28000 ???? 01 5b enemy01_ypos = var27 135 28000 ???? 136 28000 ???? 01 5a enemy01_xpos = var26 137 28000 ???? 138 28000 ???? 01 59 player_flag = var25 139 28000 ???? 140 28000 ???? 01 58 player_bullet1_time = var24 141 28000 ???? 142 28000 ???? 01 57 customtemp3 = var23 143 28000 ???? 144 28000 ???? 01 56 customtemp2 = var22 145 28000 ???? 146 28000 ???? 01 55 customtemp1 = var21 147 28000 ???? 148 28000 ???? 01 54 temp_y = var20 149 28000 ???? 150 28000 ???? 01 53 temp_x = var19 151 28000 ???? 152 28000 ???? 01 52 temp_loop = var18 153 28000 ???? 154 28000 ???? 01 51 player_bullet_y3 = var17 155 28000 ???? 156 28000 ???? 01 50 player_bullet_x3 = var16 157 28000 ???? 158 28000 ???? 01 4f player_bullet_y2 = var15 159 28000 ???? 160 28000 ???? 01 4e player_bullet_x2 = var14 161 28000 ???? 162 28000 ???? 01 4d player_bullet_y1 = var13 163 28000 ???? 164 28000 ???? 01 4c player_bullet_x1 = var12 165 28000 ???? 166 28000 ???? 01 4b tiley = var11 167 28000 ???? 168 28000 ???? 01 4a tilex = var10 169 28000 ???? 170 28000 ???? 01 49 player_l2_AniFrame = var9 171 28000 ???? 172 28000 ???? 01 48 joyposright = var8 173 28000 ???? 174 28000 ???? 01 47 joyposleft = var7 175 28000 ???? 176 28000 ???? 01 46 joyposup = var6 177 28000 ???? 178 28000 ???? 01 45 joyposdown = var5 179 28000 ???? 180 28000 ???? 01 44 player_l1_AniFrame = var4 181 28000 ???? 182 28000 ???? 01 43 fire_debounce = var3 183 28000 ???? 184 28000 ???? 01 42 playerY = var2 185 28000 ???? 186 28000 ???? 01 41 playerX = var1 187 28000 ???? 188 28000 ???? 01 40 frameCounter = var0 189 28000 ???? 190 28000 ???? 00 01 EXTRADLMEMORY = 1 191 28000 ???? 00 01 NTSC = 1 192 28000 ???? 00 10 ZONEHEIGHT = 16 193 28000 ???? 00 01 SGRAM = 1 194 28000 ???? 00 08 bankswitchmode = 8 195 28000 ???? 00 01 ROM128K = 1 ------- FILE c:\Users\Shane\Documents\my7800projects\Heofonfir\Lucelia_Movement_demo.78b.asm 555 28000 ???? 556 28000 ???? ; A BEAD header gets automatically incorportated into the ROM header. 557 28000 ???? ; For more BEAD executable info, check out the spec... 558 28000 ???? ; http://7800.8bitdev.org/index.php/The_Atari_7800_BEAD_Execuable_Specification 559 28000 ???? 560 28000 ???? 00 01 GAMEDESCRIPTIONSET = 1 561 28000 ???? 4e 61 6d 65 GAMEDESCRIPTION = "Test Name" 562 28000 ???? 563 28000 ???? 00 40 BDHSC = %01000000 564 28000 ???? 00 20 BDYM = %00100000 565 28000 ???? 00 10 BDPOKEY = %00010000 566 28000 ???? 00 08 BDROF = %00001000 567 28000 ???? 00 00 BD16K = %00000000 568 28000 ???? 00 01 BD32K = %00000001 569 28000 ???? 00 02 BD48K = %00000010 570 28000 ???? 00 05 BD1800 = %00000101 571 28000 ???? 00 06 BD4000 = %00000110 572 28000 ???? 573 28000 ???? - ifconst ROM32K 574 28000 ???? -BEADHEADER = 1 575 28000 ???? endif 576 28000 ???? - ifconst ROM48K 577 28000 ???? -BEADHEADER = 1 578 28000 ???? endif 579 28000 ???? 580 28000 ???? - ifconst BEADHEADER 581 28000 ???? -BEADHARDWARE SET 0 582 28000 ???? - ifconst ROM16K 583 28000 ???? -BEADHARDWARE SET (BEADHARDWARE|BD16K) 584 28000 ???? - endif 585 28000 ???? - ifconst ROM32K 586 28000 ???? -BEADHARDWARE SET (BEADHARDWARE|BD32K) 587 28000 ???? - endif 588 28000 ???? - ifconst ROM48K 589 28000 ???? -BEADHARDWARE SET (BEADHARDWARE|BD48K) 590 28000 ???? - endif 591 28000 ???? - ifconst pokeysupport 592 28000 ???? -BEADHARDWARE SET (BEADHARDWARE|BDPOKEY) 593 28000 ???? - endif 594 28000 ???? - ifconst HSSUPPORT 595 28000 ???? -BEADHARDWARE SET (BEADHARDWARE|BDHSC) 596 28000 ???? - endif 597 28000 ???? endif 598 28000 ???? 599 28000 ???? ;start address of cart... 600 28000 ???? - ifconst ROM48K 601 28000 ???? - ORG $4000,0 602 28000 ???? - ifconst BEADHEADER 603 28000 ???? - .byte $BE,$AD,BEADHARDWARE 604 28000 ???? - ifconst GAMEDESCRIPTIONSET 605 28000 ???? - CLC 606 28000 ???? - BCC _SKIPDESCRIPTION 607 28000 ???? - .byte GAMEDESCRIPTION,0 608 28000 ???? -_SKIPDESCRIPTION 609 28000 ???? - endif 610 28000 ???? - jmp ($FFFC) 611 28000 ???? - endif 612 28000 ???? else 613 28000 ???? ifconst bankswitchmode 614 28000 ???? - ifconst ROMAT4K 615 28000 ???? - ORG $4000,0 616 28000 ???? - RORG $4000 617 28000 ???? else 618 8000 ORG $8000,0 619 8000 RORG $8000 620 8000 endif 621 8000 - else ; not bankswitchmode 622 8000 - ifconst ROM16K 623 8000 - ORG $C000,0 624 8000 - ifconst BEADHEADER 625 8000 - .byte $BE,$AD,BEADHARDWARE 626 8000 - ifconst GAMEDESCRIPTION 627 8000 - CLC 628 8000 - BCC _SKIPDESCRIPTION 629 8000 - .byte GAMEDESCRIPTION,0 630 8000 -_SKIPDESCRIPTION 631 8000 - endif 632 8000 - jmp ($FFFC) 633 8000 - endif 634 8000 - else 635 8000 - ifconst ROM8K 636 8000 - ORG $E000,0 637 8000 - else 638 8000 - ORG $8000,0 639 8000 - ifconst BEADHEADER 640 8000 - .byte $BE,$AD,BEADHARDWARE 641 8000 - ifconst GAMEDESCRIPTION 642 8000 - CLC 643 8000 - BCC _SKIPDESCRIPTION 644 8000 - .byte GAMEDESCRIPTION,0 645 8000 -_SKIPDESCRIPTION 646 8000 - endif 647 8000 - jmp ($FFFC) 648 8000 - endif 649 8000 - endif 650 8000 - endif 651 8000 endif 652 8000 endif 653 8000 654 8000 ;7800basic v0.18 Mar 14 2021 14:27:24 655 8000 SPACEOVERFLOW SET 0 656 8000 game 657 8000 . 658 8000 ;; 659 8000 660 8000 . 661 8000 ;; 662 8000 663 8000 . 664 8000 ;; 665 8000 666 8000 .L00 ;; set romsize 128kRAM 667 8000 668 8000 .L01 ;; set zoneheight 16 669 8000 670 8000 .L02 ;; set zoneprotection off 671 8000 672 8000 .L03 ;; set basepath graphics 673 8000 674 8000 .L04 ;; set tallsprite on 675 8000 676 8000 .L05 ;; set tv ntsc 677 8000 678 8000 .L06 ;; set extradlmemory on 679 8000 680 8000 .L07 ;; displaymode 160A 681 8000 682 8000 a9 40 lda #%01000000 ;Enable DMA, mode=160x2/160x4 683 8002 85 3c sta CTRL 684 8004 685 8004 8d 07 21 sta sCTRL 686 8007 687 8007 . 688 8007 ;; 689 8007 690 8007 . 691 8007 ;; 692 8007 693 8007 .L08 ;; dim frameCounter = var0 694 8007 695 8007 .L09 ;; dim playerX = var1 696 8007 697 8007 .L010 ;; dim playerY = var2 698 8007 699 8007 .L011 ;; dim fire_debounce = var3 700 8007 701 8007 .L012 ;; dim player_l1_AniFrame = var4 702 8007 703 8007 .L013 ;; dim joyposdown = var5 704 8007 705 8007 .L014 ;; dim joyposup = var6 706 8007 707 8007 .L015 ;; dim joyposleft = var7 708 8007 709 8007 .L016 ;; dim joyposright = var8 710 8007 711 8007 .L017 ;; dim player_l2_AniFrame = var9 712 8007 713 8007 .L018 ;; dim tilex = var10 714 8007 715 8007 .L019 ;; dim tiley = var11 716 8007 717 8007 .L020 ;; dim player_bullet_x1 = var12 718 8007 719 8007 .L021 ;; dim player_bullet_y1 = var13 720 8007 721 8007 .L022 ;; dim player_bullet_x2 = var14 722 8007 723 8007 .L023 ;; dim player_bullet_y2 = var15 724 8007 725 8007 .L024 ;; dim player_bullet_x3 = var16 726 8007 727 8007 .L025 ;; dim player_bullet_y3 = var17 728 8007 729 8007 .L026 ;; dim temp_loop = var18 730 8007 731 8007 .L027 ;; dim temp_x = var19 732 8007 733 8007 .L028 ;; dim temp_y = var20 734 8007 735 8007 .L029 ;; dim customtemp1 = var21 736 8007 737 8007 .L030 ;; dim customtemp2 = var22 738 8007 739 8007 .L031 ;; dim customtemp3 = var23 740 8007 741 8007 .L032 ;; dim player_bullet1_time = var24 742 8007 743 8007 .L033 ;; dim player_flag = var25 744 8007 745 8007 .L034 ;; dim enemy01_xpos = var26 746 8007 747 8007 .L035 ;; dim enemy01_ypos = var27 748 8007 749 8007 .L036 ;; dim isDead_flag = var28 750 8007 751 8007 . 752 8007 ;; 753 8007 754 8007 . 755 8007 ;; 756 8007 757 8007 . 758 8007 ;; 759 8007 760 8007 .L037 ;; P0C1 = $1C : P0C2 = $0F : P0C3 = $F7 761 8007 762 8007 a9 1c LDA #$1C 763 8009 85 21 STA P0C1 764 800b a9 0f LDA #$0F 765 800d 85 22 STA P0C2 766 800f a9 f7 LDA #$F7 767 8011 85 23 STA P0C3 768 8013 .L038 ;; P1C1 = $3D : P1C2 = $15 : P1C3 = $05 769 8013 770 8013 a9 3d LDA #$3D 771 8015 85 25 STA P1C1 772 8017 a9 15 LDA #$15 773 8019 85 26 STA P1C2 774 801b a9 05 LDA #$05 775 801d 85 27 STA P1C3 776 801f .L039 ;; P2C1 = $90 : P2C2 = $AF : P2C3 = $96 777 801f 778 801f a9 90 LDA #$90 779 8021 85 29 STA P2C1 780 8023 a9 af LDA #$AF 781 8025 85 2a STA P2C2 782 8027 a9 96 LDA #$96 783 8029 85 2b STA P2C3 784 802b .L040 ;; P3C1 = $77 : P3C2 = $6F : P3C3 = $7A 785 802b 786 802b a9 77 LDA #$77 787 802d 85 2d STA P3C1 788 802f a9 6f LDA #$6F 789 8031 85 2e STA P3C2 790 8033 a9 7a LDA #$7A 791 8035 85 2f STA P3C3 792 8037 .L041 ;; P4C1 = $E1 : P4C2 = $DD : P4C3 = $CA 793 8037 794 8037 a9 e1 LDA #$E1 795 8039 85 31 STA P4C1 796 803b a9 dd LDA #$DD 797 803d 85 32 STA P4C2 798 803f a9 ca LDA #$CA 799 8041 85 33 STA P4C3 800 8043 .L042 ;; P5C1 = $02 : P5C2 = $25 : P5C3 = $31 801 8043 802 8043 a9 02 LDA #$02 803 8045 85 35 STA P5C1 804 8047 a9 25 LDA #$25 805 8049 85 36 STA P5C2 806 804b a9 31 LDA #$31 807 804d 85 37 STA P5C3 808 804f .L043 ;; P6C1 = $07 : P6C2 = $0C : P6C3 = $0A 809 804f 810 804f a9 07 LDA #$07 811 8051 85 39 STA P6C1 812 8053 a9 0c LDA #$0C 813 8055 85 3a STA P6C2 814 8057 a9 0a LDA #$0A 815 8059 85 3b STA P6C3 816 805b .L044 ;; P7C1 = $50 : P7C2 = $78 : P7C3 = $64 817 805b 818 805b a9 50 LDA #$50 819 805d 85 3d STA P7C1 820 805f a9 78 LDA #$78 821 8061 85 3e STA P7C2 822 8063 a9 64 LDA #$64 823 8065 85 3f STA P7C3 824 8067 . 825 8067 ;; 826 8067 827 8067 .L045 ;; incgraphic player\heofonfir_lucelia_layer1_1.png 160A 828 8067 829 8067 .L046 ;; incgraphic player\heofonfir_lucelia_layer1_2.png 160A 830 8067 831 8067 .L047 ;; incgraphic player\heofonfir_lucelia_layer1_3.png 160A 832 8067 833 8067 .L048 ;; incgraphic player\heofonfir_lucelia_layer1_4.png 160A 834 8067 835 8067 .L049 ;; incgraphic player\heofonfir_lucelia_layer1_5.png 160A 836 8067 837 8067 .L050 ;; incgraphic player\heofonfir_lucelia_layer1_6.png 160A 838 8067 839 8067 .L051 ;; incgraphic player\heofonfir_lucelia_layer1_7.png 160A 840 8067 841 8067 .L052 ;; incgraphic player\heofonfir_lucelia_layer1_8.png 160A 842 8067 843 8067 .L053 ;; incgraphic player\heofonfir_lucelia_layer_2nofire_1.png 160A 844 8067 845 8067 .L054 ;; incgraphic player\heofonfir_lucelia_layer_2nofire_2.png 160A 846 8067 847 8067 .L055 ;; incgraphic player\heofonfir_lucelia_layer_2nofire_3.png 160A 848 8067 849 8067 .L056 ;; incgraphic player\heofonfir_lucelia_layer_2nofire_4.png 160A 850 8067 851 8067 .L057 ;; incgraphic player\heofonfir_lucelia_layer_2nofire_5.png 160A 852 8067 853 8067 .L058 ;; incgraphic player\heofonfir_lucelia_layer_2nofire_6.png 160A 854 8067 855 8067 .L059 ;; incgraphic player\heofonfir_lucelia_layer_2nofire_7.png 160A 856 8067 857 8067 .L060 ;; incgraphic player\heofonfir_lucelia_layer_2nofire_8.png 160A 858 8067 859 8067 .L061 ;; incgraphic heofonfir_bullet.png 160A 860 8067 861 8067 .L062 ;; incgraphic enemies\heofonfir_bomb_bug.png 160A 862 8067 863 8067 . 864 8067 ;; 865 8067 866 8067 . 867 8067 ;; 868 8067 869 8067 .L063 ;; playerX = 80 : playerY = 144 : player_l1_AniFrame = 1 : player_l2_AniFrame = 1 : frameCounter = 0 870 8067 871 8067 a9 50 LDA #80 872 8069 8d 41 01 STA playerX 873 806c a9 90 LDA #144 874 806e 8d 42 01 STA playerY 875 8071 a9 01 LDA #1 876 8073 8d 44 01 STA player_l1_AniFrame 877 8076 8d 49 01 STA player_l2_AniFrame 878 8079 a9 00 LDA #0 879 807b 8d 40 01 STA frameCounter 880 807e .L064 ;; joyposleft = 0 : joyposright = 0 : joyposup = 0 : joyposdown = 0 881 807e 882 807e a9 00 LDA #0 883 8080 8d 47 01 STA joyposleft 884 8083 8d 48 01 STA joyposright 885 8086 8d 46 01 STA joyposup 886 8089 8d 45 01 STA joyposdown 887 808c .L065 ;; player_bullet_x1 = 200 : player_bullet_y1 = 0 888 808c 889 808c a9 c8 LDA #200 890 808e 8d 4c 01 STA player_bullet_x1 891 8091 a9 00 LDA #0 892 8093 8d 4d 01 STA player_bullet_y1 893 8096 .L066 ;; player_bullet_x2 = 200 : player_bullet_y2 = 0 894 8096 895 8096 a9 c8 LDA #200 896 8098 8d 4e 01 STA player_bullet_x2 897 809b a9 00 LDA #0 898 809d 8d 4f 01 STA player_bullet_y2 899 80a0 .L067 ;; player_bullet_x3 = 200 : player_bullet_y3 = 0 900 80a0 901 80a0 a9 c8 LDA #200 902 80a2 8d 50 01 STA player_bullet_x3 903 80a5 a9 00 LDA #0 904 80a7 8d 51 01 STA player_bullet_y3 905 80aa . 906 80aa ;; 907 80aa 908 80aa ._main 909 80aa ;; _main 910 80aa 911 80aa .L068 ;; clearscreen 912 80aa 913 80aa 20 7f f0 jsr clearscreen 914 80ad . 915 80ad ;; 916 80ad 917 80ad .L069 ;; frameCounter = frameCounter + 1 918 80ad 919 80ad ad 40 01 LDA frameCounter 920 80b0 18 CLC 921 80b1 69 01 ADC #1 922 80b3 8d 40 01 STA frameCounter 923 80b6 .L070 ;; savescreen 924 80b6 925 80b6 20 a3 f0 jsr savescreen 926 80b9 .L071 ;; if switchreset then reboot 927 80b9 928 80b9 20 30 f4 jsr checkresetswitch 929 80bc d0 03 BNE .skipL071 930 80be .condpart0 931 80be 4c 1d f5 JMP START 932 80c1 .skipL071 933 80c1 ._mainloop 934 80c1 ;; _mainloop 935 80c1 936 80c1 .L072 ;; restorescreen 937 80c1 938 80c1 20 91 f0 jsr restorescreen 939 80c4 .L073 ;; BACKGRND = $00 940 80c4 941 80c4 a9 00 LDA #$00 942 80c6 85 20 STA BACKGRND 943 80c8 . 944 80c8 ;; 945 80c8 946 80c8 . 947 80c8 ;; 948 80c8 949 80c8 .L074 ;; if joy0up && joyposup = - 2 then gosub Set_Bullet_home 950 80c8 951 80c8 a9 10 lda #$10 952 80ca 2c 80 02 bit SWCHA 953 80cd d0 10 BNE .skipL074 954 80cf .condpart1 955 80cf ; complex condition detected 956 80cf a9 fe LDA #254 957 80d1 48 PHA 958 80d2 ba TSX 959 80d3 68 PLA 960 80d4 ad 46 01 LDA joyposup 961 80d7 dd 01 01 CMP $101,x 962 80da d0 03 BNE .skip1then 963 80dc .condpart2 964 80dc 20 72 82 jsr .Set_Bullet_home 965 80df 966 80df .skip1then 967 80df .skipL074 968 80df .L075 ;; if joy0down && joyposdown = - 2 then gosub Set_Bullet_home 969 80df 970 80df a9 20 lda #$20 971 80e1 2c 80 02 bit SWCHA 972 80e4 d0 10 BNE .skipL075 973 80e6 .condpart3 974 80e6 ; complex condition detected 975 80e6 a9 fe LDA #254 976 80e8 48 PHA 977 80e9 ba TSX 978 80ea 68 PLA 979 80eb ad 45 01 LDA joyposdown 980 80ee dd 01 01 CMP $101,x 981 80f1 d0 03 BNE .skip3then 982 80f3 .condpart4 983 80f3 20 72 82 jsr .Set_Bullet_home 984 80f6 985 80f6 .skip3then 986 80f6 .skipL075 987 80f6 .L076 ;; if joy0left && joyposleft = - 2 then gosub Set_Bullet_home 988 80f6 989 80f6 2c 80 02 bit SWCHA 990 80f9 70 10 BVS .skipL076 991 80fb .condpart5 992 80fb ; complex condition detected 993 80fb a9 fe LDA #254 994 80fd 48 PHA 995 80fe ba TSX 996 80ff 68 PLA 997 8100 ad 47 01 LDA joyposleft 998 8103 dd 01 01 CMP $101,x 999 8106 d0 03 BNE .skip5then 1000 8108 .condpart6 1001 8108 20 72 82 jsr .Set_Bullet_home 1002 810b 1003 810b .skip5then 1004 810b .skipL076 1005 810b .L077 ;; if joy0right && joyposright = - 2 then gosub Set_Bullet_home 1006 810b 1007 810b 2c 80 02 bit SWCHA 1008 810e 30 10 BMI .skipL077 1009 8110 .condpart7 1010 8110 ; complex condition detected 1011 8110 a9 fe LDA #254 1012 8112 48 PHA 1013 8113 ba TSX 1014 8114 68 PLA 1015 8115 ad 48 01 LDA joyposright 1016 8118 dd 01 01 CMP $101,x 1017 811b d0 03 BNE .skip7then 1018 811d .condpart8 1019 811d 20 72 82 jsr .Set_Bullet_home 1020 8120 1021 8120 .skip7then 1022 8120 .skipL077 1023 8120 .L078 ;; if joy0up then playerY = playerY - 1 : joyposup = 1 : joyposdown = 0 : joyposleft = 0 : joyposright = 0 1024 8120 1025 8120 a9 10 lda #$10 1026 8122 2c 80 02 bit SWCHA 1027 8125 d0 19 BNE .skipL078 1028 8127 .condpart9 1029 8127 ad 42 01 LDA playerY 1030 812a 38 SEC 1031 812b e9 01 SBC #1 1032 812d 8d 42 01 STA playerY 1033 8130 a9 01 LDA #1 1034 8132 8d 46 01 STA joyposup 1035 8135 a9 00 LDA #0 1036 8137 8d 45 01 STA joyposdown 1037 813a 8d 47 01 STA joyposleft 1038 813d 8d 48 01 STA joyposright 1039 8140 .skipL078 1040 8140 .L079 ;; if joy0down then playerY = playerY + 1 : joyposup = 0 : joyposdown = 1 : joyposleft = 0 : joyposright = 0 1041 8140 1042 8140 a9 20 lda #$20 1043 8142 2c 80 02 bit SWCHA 1044 8145 d0 1b BNE .skipL079 1045 8147 .condpart10 1046 8147 ad 42 01 LDA playerY 1047 814a 18 CLC 1048 814b 69 01 ADC #1 1049 814d 8d 42 01 STA playerY 1050 8150 a9 00 LDA #0 1051 8152 8d 46 01 STA joyposup 1052 8155 a9 01 LDA #1 1053 8157 8d 45 01 STA joyposdown 1054 815a a9 00 LDA #0 1055 815c 8d 47 01 STA joyposleft 1056 815f 8d 48 01 STA joyposright 1057 8162 .skipL079 1058 8162 .L080 ;; if joy0left then playerX = playerX - 1 : joyposup = 0 : joyposdown = 0 : joyposleft = 1 : joyposright = 0 1059 8162 1060 8162 2c 80 02 bit SWCHA 1061 8165 70 1b BVS .skipL080 1062 8167 .condpart11 1063 8167 ad 41 01 LDA playerX 1064 816a 38 SEC 1065 816b e9 01 SBC #1 1066 816d 8d 41 01 STA playerX 1067 8170 a9 00 LDA #0 1068 8172 8d 46 01 STA joyposup 1069 8175 8d 45 01 STA joyposdown 1070 8178 a9 01 LDA #1 1071 817a 8d 47 01 STA joyposleft 1072 817d a9 00 LDA #0 1073 817f 8d 48 01 STA joyposright 1074 8182 .skipL080 1075 8182 .L081 ;; if joy0right then playerX = playerX + 1 : joyposup = 0 : joyposdown = 0 : joyposleft = 0 : joyposright = 1 1076 8182 1077 8182 2c 80 02 bit SWCHA 1078 8185 30 19 BMI .skipL081 1079 8187 .condpart12 1080 8187 ad 41 01 LDA playerX 1081 818a 18 CLC 1082 818b 69 01 ADC #1 1083 818d 8d 41 01 STA playerX 1084 8190 a9 00 LDA #0 1085 8192 8d 46 01 STA joyposup 1086 8195 8d 45 01 STA joyposdown 1087 8198 8d 47 01 STA joyposleft 1088 819b a9 01 LDA #1 1089 819d 8d 48 01 STA joyposright 1090 81a0 .skipL081 1091 81a0 . 1092 81a0 ;; 1093 81a0 1094 81a0 .L082 ;; gosub check_collisions 1095 81a0 1096 81a0 20 b2 82 jsr .check_collisions 1097 81a3 1098 81a3 .L083 ;; if playerX > 152 then playerX = playerX - 1 1099 81a3 1100 81a3 a9 98 LDA #152 1101 81a5 cd 41 01 CMP playerX 1102 81a8 b0 09 BCS .skipL083 1103 81aa .condpart13 1104 81aa ad 41 01 LDA playerX 1105 81ad 38 SEC 1106 81ae e9 01 SBC #1 1107 81b0 8d 41 01 STA playerX 1108 81b3 .skipL083 1109 81b3 .L084 ;; if playerX < 1 then playerX = playerX + 1 1110 81b3 1111 81b3 ad 41 01 LDA playerX 1112 81b6 c9 01 CMP #1 1113 81b8 b0 09 BCS .skipL084 1114 81ba .condpart14 1115 81ba ad 41 01 LDA playerX 1116 81bd 18 CLC 1117 81be 69 01 ADC #1 1118 81c0 8d 41 01 STA playerX 1119 81c3 .skipL084 1120 81c3 .L085 ;; if playerY > 177 then playerY = playerY - 1 1121 81c3 1122 81c3 a9 b1 LDA #177 1123 81c5 cd 42 01 CMP playerY 1124 81c8 b0 09 BCS .skipL085 1125 81ca .condpart15 1126 81ca ad 42 01 LDA playerY 1127 81cd 38 SEC 1128 81ce e9 01 SBC #1 1129 81d0 8d 42 01 STA playerY 1130 81d3 .skipL085 1131 81d3 .L086 ;; if playerY < 1 then playerY = playerY + 1 1132 81d3 1133 81d3 ad 42 01 LDA playerY 1134 81d6 c9 01 CMP #1 1135 81d8 b0 09 BCS .skipL086 1136 81da .condpart16 1137 81da ad 42 01 LDA playerY 1138 81dd 18 CLC 1139 81de 69 01 ADC #1 1140 81e0 8d 42 01 STA playerY 1141 81e3 .skipL086 1142 81e3 . 1143 81e3 ;; 1144 81e3 1145 81e3 . 1146 81e3 ;; 1147 81e3 1148 81e3 . 1149 81e3 ;; 1150 81e3 1151 81e3 .L087 ;; gosub display_bullets 1152 81e3 1153 81e3 20 d0 84 jsr .display_bullets 1154 81e6 1155 81e6 .L088 ;; gosub draw_sprites 1156 81e6 1157 81e6 20 fb 81 jsr .draw_sprites 1158 81e9 1159 81e9 .L089 ;; gosub check_firebutton 1160 81e9 1161 81e9 20 82 83 jsr .check_firebutton 1162 81ec 1163 81ec .L090 ;; gosub move_bullets 1164 81ec 1165 81ec 20 25 84 jsr .move_bullets 1166 81ef 1167 81ef .L091 ;; gosub check_bullet_time 1168 81ef 1169 81ef 20 44 84 jsr .check_bullet_time 1170 81f2 1171 81f2 .L092 ;; gosub check_bullet_boundary 1172 81f2 1173 81f2 20 7a 84 jsr .check_bullet_boundary 1174 81f5 1175 81f5 .L093 ;; drawscreen 1176 81f5 1177 81f5 20 b3 f0 jsr drawscreen 1178 81f8 .L094 ;; goto _mainloop 1179 81f8 1180 81f8 4c c1 80 jmp ._mainloop 1181 81fb 1182 81fb . 1183 81fb ;; 1184 81fb 1185 81fb .draw_sprites 1186 81fb ;; draw_sprites 1187 81fb 1188 81fb .L095 ;; plotsprite heofonfir_lucelia_layer1_1 0 playerX playerY player_l1_AniFrame 1189 81fb 1190 81fb a9 00 lda #heofonfir_lucelia_layer1_1 1202 820c 85 43 sta temp2 1203 820e 1204 820e a9 1d lda #(0|heofonfir_lucelia_layer1_1_width_twoscompliment) 1205 8210 85 44 sta temp3 1206 8212 1207 8212 ad 41 01 lda playerX 1208 8215 85 45 sta temp4 1209 8217 1210 8217 ad 42 01 lda playerY 1211 821a 85 46 sta temp5 1212 821c 1213 821c a9 40 lda #(heofonfir_lucelia_layer1_1_mode|%01000000) 1214 821e 85 47 sta temp6 1215 8220 1216 8220 20 93 f2 jsr plotsprite 1217 8223 .L096 ;; plotsprite heofonfir_lucelia_layer_2nofire_1 1 playerX playerY player_l2_AniFrame 1218 8223 1219 8223 a9 18 lda #heofonfir_lucelia_layer_2nofire_1 1231 8234 85 43 sta temp2 1232 8236 1233 8236 a9 3d lda #(32|heofonfir_lucelia_layer_2nofire_1_width_twoscompliment) 1234 8238 85 44 sta temp3 1235 823a 1236 823a ad 41 01 lda playerX 1237 823d 85 45 sta temp4 1238 823f 1239 823f ad 42 01 lda playerY 1240 8242 85 46 sta temp5 1241 8244 1242 8244 a9 40 lda #(heofonfir_lucelia_layer_2nofire_1_mode|%01000000) 1243 8246 85 47 sta temp6 1244 8248 1245 8248 20 93 f2 jsr plotsprite 1246 824b .L097 ;; plotsprite heofonfir_bomb_bug 5 enemy01_xpos enemy01_ypos 1247 824b 1248 824b a9 31 lda #heofonfir_bomb_bug 1252 8251 85 43 sta temp2 1253 8253 1254 8253 a9 bd lda #(160|heofonfir_bomb_bug_width_twoscompliment) 1255 8255 85 44 sta temp3 1256 8257 1257 8257 ad 5a 01 lda enemy01_xpos 1258 825a 85 45 sta temp4 1259 825c 1260 825c ad 5b 01 lda enemy01_ypos 1261 825f 1262 825f 85 46 sta temp5 1263 8261 1264 8261 a9 40 lda #(heofonfir_bomb_bug_mode|%01000000) 1265 8263 85 47 sta temp6 1266 8265 1267 8265 20 93 f2 jsr plotsprite 1268 8268 .L098 ;; return 1269 8268 1270 8268 ba tsx 1271 8269 bd 02 01 lda $102,x 1272 826c f0 01 beq bankswitchret3 1273 826e 60 RTS 1274 826f bankswitchret3 1275 826f 4c 1d f4 JMP BS_return 1276 8272 . 1277 8272 ;; 1278 8272 1279 8272 . 1280 8272 ;; 1281 8272 1282 8272 .Set_Bullet_home 1283 8272 ;; Set_Bullet_home 1284 8272 1285 8272 .L099 ;; player_bullet_x1 = playerX + 4 : player_bullet_y1 = playerY - 1 1286 8272 1287 8272 ad 41 01 LDA playerX 1288 8275 18 CLC 1289 8276 69 04 ADC #4 1290 8278 8d 4c 01 STA player_bullet_x1 1291 827b ad 42 01 LDA playerY 1292 827e 38 SEC 1293 827f e9 01 SBC #1 1294 8281 8d 4d 01 STA player_bullet_y1 1295 8284 .L0100 ;; player_bullet_x2 = playerX + 4 : player_bullet_y2 = playerY - 1 1296 8284 1297 8284 ad 41 01 LDA playerX 1298 8287 18 CLC 1299 8288 69 04 ADC #4 1300 828a 8d 4e 01 STA player_bullet_x2 1301 828d ad 42 01 LDA playerY 1302 8290 38 SEC 1303 8291 e9 01 SBC #1 1304 8293 8d 4f 01 STA player_bullet_y2 1305 8296 .L0101 ;; player_bullet_x3 = playerX + 4 : player_bullet_y3 = playerY - 1 1306 8296 1307 8296 ad 41 01 LDA playerX 1308 8299 18 CLC 1309 829a 69 04 ADC #4 1310 829c 8d 50 01 STA player_bullet_x3 1311 829f ad 42 01 LDA playerY 1312 82a2 38 SEC 1313 82a3 e9 01 SBC #1 1314 82a5 8d 51 01 STA player_bullet_y3 1315 82a8 .L0102 ;; return 1316 82a8 1317 82a8 ba tsx 1318 82a9 bd 02 01 lda $102,x 1319 82ac f0 01 beq bankswitchret4 1320 82ae 60 RTS 1321 82af bankswitchret4 1322 82af 4c 1d f4 JMP BS_return 1323 82b2 . 1324 82b2 ;; 1325 82b2 1326 82b2 .check_collisions 1327 82b2 ;; check_collisions 1328 82b2 1329 82b2 .L0103 ;; if boxcollision ( playerX , playerY , 12 , 24 , enemy01_xpos , enemy01_ypos , 12 , 24 ) then enemy01_xpos = 200 : enemy01_ypos = 200 : player_flag = 1 : isDead_flag = 1 : goto _checkCollisionsExit 1330 82b2 1331 82b2 1332 82b2 18 clc ; one clc only. If we overflow we're screwed anyway. 1333 82b3 a0 0b ldy #(12-1) 1334 82b5 84 44 sty temp3 1335 82b7 a0 17 ldy #(24-1) 1336 82b9 84 45 sty temp4 1337 82bb ad 5a 01 lda enemy01_xpos 1338 82be 69 30 adc #48 1339 82c0 85 46 sta temp5 1340 82c2 ad 5b 01 lda enemy01_ypos 1341 82c5 69 20 adc #((256-WSCREENHEIGHT)/2) 1342 82c7 85 47 sta temp6 1343 82c9 a0 0b ldy #(12-1) 1344 82cb 84 48 sty temp7 1345 82cd a0 17 ldy #(24-1) 1346 82cf 84 49 sty temp8 1347 82d1 ad 42 01 lda playerY 1348 82d4 69 20 adc #((256-WSCREENHEIGHT)/2) 1349 82d6 a8 tay 1350 82d7 ad 41 01 lda playerX 1351 82da 69 30 adc #48 1352 82dc 20 74 f3 jsr boxcollision 1353 82df 1354 82df 90 13 BCC .skipL0103 1355 82e1 .condpart17 1356 82e1 a9 c8 LDA #200 1357 82e3 8d 5a 01 STA enemy01_xpos 1358 82e6 8d 5b 01 STA enemy01_ypos 1359 82e9 a9 01 LDA #1 1360 82eb 8d 59 01 STA player_flag 1361 82ee 8d 5c 01 STA isDead_flag 1362 82f1 4c 78 83 jmp ._checkCollisionsExit 1363 82f4 1364 82f4 .skipL0103 1365 82f4 .L0104 ;; if boxcollision ( player_bullet_x1 , player_bullet_y1 , 12 , 24 , enemy01_xpos , enemy01_ypos , 12 , 24 ) then enemy01_xpos = 200 : enemy01_ypos = 200 : player_flag = 1 : isDead_flag = 1 : goto _checkCollisionsExit 1366 82f4 1367 82f4 1368 82f4 18 clc ; one clc only. If we overflow we're screwed anyway. 1369 82f5 a0 0b ldy #(12-1) 1370 82f7 84 44 sty temp3 1371 82f9 a0 17 ldy #(24-1) 1372 82fb 84 45 sty temp4 1373 82fd ad 5a 01 lda enemy01_xpos 1374 8300 69 30 adc #48 1375 8302 85 46 sta temp5 1376 8304 ad 5b 01 lda enemy01_ypos 1377 8307 69 20 adc #((256-WSCREENHEIGHT)/2) 1378 8309 85 47 sta temp6 1379 830b a0 0b ldy #(12-1) 1380 830d 84 48 sty temp7 1381 830f a0 17 ldy #(24-1) 1382 8311 84 49 sty temp8 1383 8313 ad 4d 01 lda player_bullet_y1 1384 8316 69 20 adc #((256-WSCREENHEIGHT)/2) 1385 8318 a8 tay 1386 8319 ad 4c 01 lda player_bullet_x1 1387 831c 69 30 adc #48 1388 831e 20 74 f3 jsr boxcollision 1389 8321 1390 8321 90 13 BCC .skipL0104 1391 8323 .condpart18 1392 8323 a9 c8 LDA #200 1393 8325 8d 5a 01 STA enemy01_xpos 1394 8328 8d 5b 01 STA enemy01_ypos 1395 832b a9 01 LDA #1 1396 832d 8d 59 01 STA player_flag 1397 8330 8d 5c 01 STA isDead_flag 1398 8333 4c 78 83 jmp ._checkCollisionsExit 1399 8336 1400 8336 .skipL0104 1401 8336 .L0105 ;; if boxcollision ( player_bullet_x2 , player_bullet_y2 , 12 , 24 , enemy01_xpos , enemy01_ypos , 12 , 24 ) then enemy01_xpos = 200 : enemy01_ypos = 200 : player_flag = 1 : isDead_flag = 1 : goto _checkCollisionsExit 1402 8336 1403 8336 1404 8336 18 clc ; one clc only. If we overflow we're screwed anyway. 1405 8337 a0 0b ldy #(12-1) 1406 8339 84 44 sty temp3 1407 833b a0 17 ldy #(24-1) 1408 833d 84 45 sty temp4 1409 833f ad 5a 01 lda enemy01_xpos 1410 8342 69 30 adc #48 1411 8344 85 46 sta temp5 1412 8346 ad 5b 01 lda enemy01_ypos 1413 8349 69 20 adc #((256-WSCREENHEIGHT)/2) 1414 834b 85 47 sta temp6 1415 834d a0 0b ldy #(12-1) 1416 834f 84 48 sty temp7 1417 8351 a0 17 ldy #(24-1) 1418 8353 84 49 sty temp8 1419 8355 ad 4f 01 lda player_bullet_y2 1420 8358 69 20 adc #((256-WSCREENHEIGHT)/2) 1421 835a a8 tay 1422 835b ad 4e 01 lda player_bullet_x2 1423 835e 69 30 adc #48 1424 8360 20 74 f3 jsr boxcollision 1425 8363 1426 8363 90 13 BCC .skipL0105 1427 8365 .condpart19 1428 8365 a9 c8 LDA #200 1429 8367 8d 5a 01 STA enemy01_xpos 1430 836a 8d 5b 01 STA enemy01_ypos 1431 836d a9 01 LDA #1 1432 836f 8d 59 01 STA player_flag 1433 8372 8d 5c 01 STA isDead_flag 1434 8375 4c 78 83 jmp ._checkCollisionsExit 1435 8378 1436 8378 .skipL0105 1437 8378 ._checkCollisionsExit 1438 8378 ;; _checkCollisionsExit 1439 8378 1440 8378 .L0106 ;; return 1441 8378 1442 8378 ba tsx 1443 8379 bd 02 01 lda $102,x 1444 837c f0 01 beq bankswitchret5 1445 837e 60 RTS 1446 837f bankswitchret5 1447 837f 4c 1d f4 JMP BS_return 1448 8382 . 1449 8382 ;; 1450 8382 1451 8382 .check_firebutton 1452 8382 ;; check_firebutton 1453 8382 1454 8382 .L0107 ;; if fire_debounce > 0 && joy0fire then return 1455 8382 1456 8382 a9 00 LDA #0 1457 8384 cd 43 01 CMP fire_debounce 1458 8387 b0 0f BCS .skipL0107 1459 8389 .condpart20 1460 8389 2c 02 21 bit sINPT1 1461 838c 10 0a BPL .skip20then 1462 838e .condpart21 1463 838e ba tsx 1464 838f bd 02 01 lda $102,x 1465 8392 f0 01 beq bankswitchret6 1466 8394 60 RTS 1467 8395 bankswitchret6 1468 8395 4c 1d f4 JMP BS_return 1469 8398 .skip20then 1470 8398 .skipL0107 1471 8398 .L0108 ;; if !joy0fire then fire_debounce = 0 : return 1472 8398 1473 8398 2c 02 21 bit sINPT1 1474 839b 30 0f BMI .skipL0108 1475 839d .condpart22 1476 839d a9 00 LDA #0 1477 839f 8d 43 01 STA fire_debounce 1478 83a2 ba tsx 1479 83a3 bd 02 01 lda $102,x 1480 83a6 f0 01 beq bankswitchret7 1481 83a8 60 RTS 1482 83a9 bankswitchret7 1483 83a9 4c 1d f4 JMP BS_return 1484 83ac .skipL0108 1485 83ac .L0109 ;; temp5 = 255 1486 83ac 1487 83ac a9 ff LDA #255 1488 83ae 85 46 STA temp5 1489 83b0 .L0110 ;; for temp1 = 0 to 2 1490 83b0 1491 83b0 a9 00 LDA #0 1492 83b2 85 42 STA temp1 1493 83b4 .L0110fortemp1 1494 83b4 .L0111 ;; if player_bullet_x1[temp1]! = 200 then temp5 = temp1 1495 83b4 1496 83b4 a6 42 LDX temp1 1497 83b6 bd 4c 01 LDA player_bullet_x1,x 1498 83b9 c9 c8 CMP #200 1499 83bb d0 04 BNE .skipL0111 1500 83bd .condpart23 1501 83bd a5 42 LDA temp1 1502 83bf 85 46 STA temp5 1503 83c1 .skipL0111 1504 83c1 .L0112 ;; next 1505 83c1 1506 83c1 a5 42 LDA temp1 1507 83c3 c9 02 CMP #2 1508 83c5 e6 42 INC temp1 1509 83c7 if ((* - .L0110fortemp1) < 127) && ((* - .L0110fortemp1) > -128) 1510 83c7 90 eb bcc .L0110fortemp1 1511 83c9 - else 1512 83c9 - bcs .0skipL0110fortemp1 1513 83c9 - jmp .L0110fortemp1 1514 83c9 -.0skipL0110fortemp1 1515 83c9 endif 1516 83c9 .L0113 ;; if temp5 = 255 then return 1517 83c9 1518 83c9 a5 46 LDA temp5 1519 83cb c9 ff CMP #255 1520 83cd d0 0a BNE .skipL0113 1521 83cf .condpart24 1522 83cf ba tsx 1523 83d0 bd 02 01 lda $102,x 1524 83d3 f0 01 beq bankswitchret8 1525 83d5 60 RTS 1526 83d6 bankswitchret8 1527 83d6 4c 1d f4 JMP BS_return 1528 83d9 .skipL0113 1529 83d9 .L0114 ;; playsfx sfx_fire_a 1530 83d9 1531 83d9 ifnconst NOTIALOCKMUTE 1532 83d9 a9 01 lda #1 1533 83db 85 de sta sfxschedulelock 1534 83dd a9 22 lda #sfx_fire_a 1537 83e3 85 e1 sta sfxinstrumenthi 1538 83e5 a9 00 lda #0 1539 83e7 85 e2 sta sfxpitchoffset ; no pitch modification 1540 83e9 85 e3 sta sfxnoteindex ; not a musical note 1541 83eb 20 4b f2 jsr schedulesfx 1542 83ee a9 00 lda #0 1543 83f0 85 de sta sfxschedulelock 1544 83f2 endif ; NOTIALOCKMUTE 1545 83f2 .L0115 ;; fire_debounce = 255 1546 83f2 1547 83f2 a9 ff LDA #255 1548 83f4 8d 43 01 STA fire_debounce 1549 83f7 .L0116 ;; player_bullet1_time[temp5] = 200 1550 83f7 1551 83f7 a9 c8 LDA #200 1552 83f9 a6 46 LDX temp5 1553 83fb 9d 58 01 STA player_bullet1_time,x 1554 83fe .L0117 ;; player_bullet_x1[temp5] = playerX + 0 1555 83fe 1556 83fe ad 41 01 LDA playerX 1557 8401 18 CLC 1558 8402 69 00 ADC #0 1559 8404 a6 46 LDX temp5 1560 8406 9d 4c 01 STA player_bullet_x1,x 1561 8409 .L0118 ;; player_bullet_y1[temp5] = playerY - 8 1562 8409 1563 8409 ad 42 01 LDA playerY 1564 840c 38 SEC 1565 840d e9 08 SBC #8 1566 840f a6 46 LDX temp5 1567 8411 9d 4d 01 STA player_bullet_y1,x 1568 8414 .L0119 ;; temp5 = temp5 - 6 1569 8414 1570 8414 a5 46 LDA temp5 1571 8416 38 SEC 1572 8417 e9 06 SBC #6 1573 8419 85 46 STA temp5 1574 841b .L0120 ;; return 1575 841b 1576 841b ba tsx 1577 841c bd 02 01 lda $102,x 1578 841f f0 01 beq bankswitchret9 1579 8421 60 RTS 1580 8422 bankswitchret9 1581 8422 4c 1d f4 JMP BS_return 1582 8425 . 1583 8425 ;; 1584 8425 1585 8425 .move_bullets 1586 8425 ;; move_bullets 1587 8425 1588 8425 .L0121 ;; if player_bullet_y1 <> 200 then player_bullet_y1 - 4 1589 8425 1590 8425 ad 4d 01 LDA player_bullet_y1 1591 8428 c9 c8 CMP #200 1592 842a f0 00 BEQ .skipL0121 1593 842c .condpart25 1594 842c .skipL0121 1595 842c .L0122 ;; if player_bullet_y2 <> 200 then player_bullet_y2 - 4 1596 842c 1597 842c ad 4f 01 LDA player_bullet_y2 1598 842f c9 c8 CMP #200 1599 8431 f0 00 BEQ .skipL0122 1600 8433 .condpart26 1601 8433 .skipL0122 1602 8433 .L0123 ;; if player_bullet_y3 <> 200 then player_bullet_y3 - 4 1603 8433 1604 8433 ad 51 01 LDA player_bullet_y3 1605 8436 c9 c8 CMP #200 1606 8438 f0 00 BEQ .skipL0123 1607 843a .condpart27 1608 843a .skipL0123 1609 843a .L0124 ;; return 1610 843a 1611 843a ba tsx 1612 843b bd 02 01 lda $102,x 1613 843e f0 01 beq bankswitchret10 1614 8440 60 RTS 1615 8441 bankswitchret10 1616 8441 4c 1d f4 JMP BS_return 1617 8444 . 1618 8444 ;; 1619 8444 1620 8444 .check_bullet_time 1621 8444 ;; check_bullet_time 1622 8444 1623 8444 .L0125 ;; for temp1 = 0 to 2 1624 8444 1625 8444 a9 00 LDA #0 1626 8446 85 42 STA temp1 1627 8448 .L0125fortemp1 1628 8448 .L0126 ;; if player_bullet1_time[temp1] > 0 then player_bullet1_time[temp1] = player_bullet1_time[temp1] - 1 else player_bullet_y1[temp1] = 0 1629 8448 1630 8448 a9 00 LDA #0 1631 844a a6 42 LDX temp1 1632 844c dd 58 01 CMP player_bullet1_time,x 1633 844f b0 10 BCS .skipL0126 1634 8451 .condpart28 1635 8451 a6 42 LDX temp1 1636 8453 bd 58 01 LDA player_bullet1_time,x 1637 8456 38 SEC 1638 8457 e9 01 SBC #1 1639 8459 a6 42 LDX temp1 1640 845b 9d 58 01 STA player_bullet1_time,x 1641 845e 4c 68 84 jmp .skipelse0 1642 8461 .skipL0126 1643 8461 a9 00 LDA #0 1644 8463 a6 42 LDX temp1 1645 8465 9d 4d 01 STA player_bullet_y1,x 1646 8468 .skipelse0 1647 8468 .L0127 ;; next 1648 8468 1649 8468 a5 42 LDA temp1 1650 846a c9 02 CMP #2 1651 846c e6 42 INC temp1 1652 846e if ((* - .L0125fortemp1) < 127) && ((* - .L0125fortemp1) > -128) 1653 846e 90 d8 bcc .L0125fortemp1 1654 8470 - else 1655 8470 - bcs .1skipL0125fortemp1 1656 8470 - jmp .L0125fortemp1 1657 8470 -.1skipL0125fortemp1 1658 8470 endif 1659 8470 .L0128 ;; return 1660 8470 1661 8470 ba tsx 1662 8471 bd 02 01 lda $102,x 1663 8474 f0 01 beq bankswitchret11 1664 8476 60 RTS 1665 8477 bankswitchret11 1666 8477 4c 1d f4 JMP BS_return 1667 847a . 1668 847a ;; 1669 847a 1670 847a .check_bullet_boundary 1671 847a ;; check_bullet_boundary 1672 847a 1673 847a .L0129 ;; for temp1 = 0 to 2 1674 847a 1675 847a a9 00 LDA #0 1676 847c 85 42 STA temp1 1677 847e .L0129fortemp1 1678 847e .L0130 ;; temp_x = player_bullet_x1[temp1] 1679 847e 1680 847e a6 42 LDX temp1 1681 8480 bd 4c 01 LDA player_bullet_x1,x 1682 8483 8d 53 01 STA temp_x 1683 8486 .L0131 ;; temp_y = player_bullet_y1[temp2] 1684 8486 1685 8486 a6 43 LDX temp2 1686 8488 bd 4d 01 LDA player_bullet_y1,x 1687 848b 8d 54 01 STA temp_y 1688 848e .L0132 ;; if temp_x < 1 || temp_x > 167 then player_bullet_x1[temp1] = 200 1689 848e 1690 848e ad 53 01 LDA temp_x 1691 8491 c9 01 CMP #1 1692 8493 b0 03 BCS .skipL0132 1693 8495 .condpart29 1694 8495 4c 9f 84 jmp .condpart30 1695 8498 .skipL0132 1696 8498 a9 a7 LDA #167 1697 849a cd 53 01 CMP temp_x 1698 849d b0 07 BCS .skip5OR 1699 849f .condpart30 1700 849f a9 c8 LDA #200 1701 84a1 a6 42 LDX temp1 1702 84a3 9d 4c 01 STA player_bullet_x1,x 1703 84a6 .skip5OR 1704 84a6 .L0133 ;; if temp_y < 1 || temp_y > 207 then player_bullet_y1[temp2] = 200 1705 84a6 1706 84a6 ad 54 01 LDA temp_y 1707 84a9 c9 01 CMP #1 1708 84ab b0 03 BCS .skipL0133 1709 84ad .condpart31 1710 84ad 4c b7 84 jmp .condpart32 1711 84b0 .skipL0133 1712 84b0 a9 cf LDA #207 1713 84b2 cd 54 01 CMP temp_y 1714 84b5 b0 07 BCS .skip6OR 1715 84b7 .condpart32 1716 84b7 a9 c8 LDA #200 1717 84b9 a6 43 LDX temp2 1718 84bb 9d 4d 01 STA player_bullet_y1,x 1719 84be .skip6OR 1720 84be .L0134 ;; next 1721 84be 1722 84be a5 42 LDA temp1 1723 84c0 c9 02 CMP #2 1724 84c2 e6 42 INC temp1 1725 84c4 if ((* - .L0129fortemp1) < 127) && ((* - .L0129fortemp1) > -128) 1726 84c4 90 b8 bcc .L0129fortemp1 1727 84c6 - else 1728 84c6 - bcs .2skipL0129fortemp1 1729 84c6 - jmp .L0129fortemp1 1730 84c6 -.2skipL0129fortemp1 1731 84c6 endif 1732 84c6 .L0135 ;; return 1733 84c6 1734 84c6 ba tsx 1735 84c7 bd 02 01 lda $102,x 1736 84ca f0 01 beq bankswitchret12 1737 84cc 60 RTS 1738 84cd bankswitchret12 1739 84cd 4c 1d f4 JMP BS_return 1740 84d0 . 1741 84d0 ;; 1742 84d0 1743 84d0 .display_bullets 1744 84d0 ;; display_bullets 1745 84d0 1746 84d0 .L0136 ;; for temp_loop = 0 to 2 1747 84d0 1748 84d0 a9 00 LDA #0 1749 84d2 8d 52 01 STA temp_loop 1750 84d5 .L0136fortemp_loop 1751 84d5 .L0137 ;; temp_x = player_bullet_x1[temp_loop] 1752 84d5 1753 84d5 ae 52 01 LDX temp_loop 1754 84d8 bd 4c 01 LDA player_bullet_x1,x 1755 84db 8d 53 01 STA temp_x 1756 84de .L0138 ;; temp_y = player_bullet_y1[temp_loop] 1757 84de 1758 84de ae 52 01 LDX temp_loop 1759 84e1 bd 4d 01 LDA player_bullet_y1,x 1760 84e4 8d 54 01 STA temp_y 1761 84e7 .L0139 ;; if temp_x <> 200 then plotsprite heofonfir_bullet 0 temp_x temp_y 1762 84e7 1763 84e7 ad 53 01 LDA temp_x 1764 84ea c9 c8 CMP #200 1765 84ec f0 1d BEQ .skipL0139 1766 84ee .condpart33 1767 84ee a9 30 lda #heofonfir_bullet 1771 84f4 85 43 sta temp2 1772 84f6 1773 84f6 a9 1f lda #(0|heofonfir_bullet_width_twoscompliment) 1774 84f8 85 44 sta temp3 1775 84fa 1776 84fa ad 53 01 lda temp_x 1777 84fd 85 45 sta temp4 1778 84ff 1779 84ff ad 54 01 lda temp_y 1780 8502 1781 8502 85 46 sta temp5 1782 8504 1783 8504 a9 40 lda #(heofonfir_bullet_mode|%01000000) 1784 8506 85 47 sta temp6 1785 8508 1786 8508 20 93 f2 jsr plotsprite 1787 850b .skipL0139 1788 850b .L0140 ;; next 1789 850b 1790 850b ad 52 01 LDA temp_loop 1791 850e c9 02 CMP #2 1792 8510 ee 52 01 INC temp_loop 1793 8513 if ((* - .L0136fortemp_loop) < 127) && ((* - .L0136fortemp_loop) > -128) 1794 8513 90 c0 bcc .L0136fortemp_loop 1795 8515 - else 1796 8515 - bcs .3skipL0136fortemp_loop 1797 8515 - jmp .L0136fortemp_loop 1798 8515 -.3skipL0136fortemp_loop 1799 8515 endif 1800 8515 .L0141 ;; return 1801 8515 1802 8515 ba tsx 1803 8516 bd 02 01 lda $102,x 1804 8519 f0 01 beq bankswitchret13 1805 851b 60 RTS 1806 851c bankswitchret13 1807 851c 4c 1d f4 JMP BS_return 1808 851f . 1809 851f ;; 1810 851f 1811 851f . 1812 851f ;; 1813 851f 1814 851f .L0142 ;; data sfx_fire_a 1815 851f 1816 851f 4c 3a 85 JMP .skipL0142 1817 8522 sfx_fire_a 1818 8522 10 10 10 .byte.b $10,$10,$10 1819 8525 1820 8525 12 04 06 .byte.b $12,$04,$06 1821 8528 1822 8528 13 04 08 .byte.b $13,$04,$08 1823 852b 1824 852b 10 0c 0a .byte.b $10,$0C,$0A 1825 852e 1826 852e 0a 0c 0c .byte.b $0A,$0C,$0C 1827 8531 1828 8531 06 06 10 .byte.b $06,$06,$10 1829 8534 1830 8534 02 06 02 .byte.b $02,$06,$02 1831 8537 1832 8537 00 00 00 .byte.b $00,$00,$00 1833 853a 1834 853a .skipL0142 1835 853a sfx_fire_a_lo SET #sfx_fire_a 1837 853a DMAHOLEEND0 SET . 1838 853a gameend 1839 853a DMAHOLEEND0 SET . 6854 bytes of ROM space left in the main area of bank 1. 1840 853a echo " ",[($A000 - .)]d , "bytes of ROM space left in the main area of bank 1." 1841 853a - if ($A000 - .) < 0 1842 853a -SPACEOVERFLOW SET (SPACEOVERFLOW+1) 1843 853a endif 1844 853a 1845 a000 ORG $A000,0 ; ************* 1846 a000 1847 a000 RORG $A000 ; ************* 1848 a000 1849 a000 heofonfir_lucelia_layer1_1 1850 a000 00 6c 00 HEX 006c00 1851 a003 heofonfir_lucelia_layer1_2 1852 a003 00 aa 00 HEX 00aa00 1853 a006 heofonfir_lucelia_layer1_3 1854 a006 00 00 00 HEX 000000 1855 a009 heofonfir_lucelia_layer1_4 1856 a009 20 00 08 HEX 200008 1857 a00c heofonfir_lucelia_layer1_5 1858 a00c 00 00 00 HEX 000000 1859 a00f heofonfir_lucelia_layer1_6 1860 a00f 00 82 00 HEX 008200 1861 a012 heofonfir_lucelia_layer1_7 1862 a012 00 00 00 HEX 000000 1863 a015 heofonfir_lucelia_layer1_8 1864 a015 00 00 00 HEX 000000 1865 a018 heofonfir_lucelia_layer_2nofire_1 1866 a018 04 02 10 HEX 040210 1867 a01b heofonfir_lucelia_layer_2nofire_2 1868 a01b 00 00 00 HEX 000000 1869 a01e heofonfir_lucelia_layer_2nofire_3 1870 a01e 00 41 00 HEX 004100 1871 a021 heofonfir_lucelia_layer_2nofire_4 1872 a021 00 41 00 HEX 004100 1873 a024 heofonfir_lucelia_layer_2nofire_5 1874 a024 00 41 00 HEX 004100 1875 a027 heofonfir_lucelia_layer_2nofire_6 1876 a027 00 00 00 HEX 000000 1877 a02a heofonfir_lucelia_layer_2nofire_7 1878 a02a 00 41 00 HEX 004100 1879 a02d heofonfir_lucelia_layer_2nofire_8 1880 a02d 00 41 00 HEX 004100 1881 a030 heofonfir_bullet 1882 a030 00 HEX 00 1883 a031 heofonfir_bomb_bug 1884 a031 09 55 e0 HEX 0955e0 1885 a034 1886 a100 ORG $A100,0 ; ************* 1887 a100 1888 a100 RORG $A100 ; ************* 1889 a100 1890 a100 ;heofonfir_lucelia_layer1_1 1891 a100 00 6c 00 HEX 006c00 1892 a103 ;heofonfir_lucelia_layer1_2 1893 a103 00 9c 00 HEX 009c00 1894 a106 ;heofonfir_lucelia_layer1_3 1895 a106 00 aa 00 HEX 00aa00 1896 a109 ;heofonfir_lucelia_layer1_4 1897 a109 20 00 08 HEX 200008 1898 a10c ;heofonfir_lucelia_layer1_5 1899 a10c 00 00 00 HEX 000000 1900 a10f ;heofonfir_lucelia_layer1_6 1901 a10f 00 00 00 HEX 000000 1902 a112 ;heofonfir_lucelia_layer1_7 1903 a112 00 00 00 HEX 000000 1904 a115 ;heofonfir_lucelia_layer1_8 1905 a115 00 55 00 HEX 005500 1906 a118 ;heofonfir_lucelia_layer_2nofire_1 1907 a118 04 02 10 HEX 040210 1908 a11b ;heofonfir_lucelia_layer_2nofire_2 1909 a11b 04 02 10 HEX 040210 1910 a11e ;heofonfir_lucelia_layer_2nofire_3 1911 a11e 00 00 00 HEX 000000 1912 a121 ;heofonfir_lucelia_layer_2nofire_4 1913 a121 00 41 00 HEX 004100 1914 a124 ;heofonfir_lucelia_layer_2nofire_5 1915 a124 00 41 00 HEX 004100 1916 a127 ;heofonfir_lucelia_layer_2nofire_6 1917 a127 00 41 00 HEX 004100 1918 a12a ;heofonfir_lucelia_layer_2nofire_7 1919 a12a 00 41 00 HEX 004100 1920 a12d ;heofonfir_lucelia_layer_2nofire_8 1921 a12d 00 00 00 HEX 000000 1922 a130 ;heofonfir_bullet 1923 a130 00 HEX 00 1924 a131 ;heofonfir_bomb_bug 1925 a131 59 55 e7 HEX 5955e7 1926 a134 1927 a200 ORG $A200,0 ; ************* 1928 a200 1929 a200 RORG $A200 ; ************* 1930 a200 1931 a200 ;heofonfir_lucelia_layer1_1 1932 a200 00 2c 00 HEX 002c00 1933 a203 ;heofonfir_lucelia_layer1_2 1934 a203 00 9c 00 HEX 009c00 1935 a206 ;heofonfir_lucelia_layer1_3 1936 a206 80 9c 02 HEX 809c02 1937 a209 ;heofonfir_lucelia_layer1_4 1938 a209 20 aa 08 HEX 20aa08 1939 a20c ;heofonfir_lucelia_layer1_5 1940 a20c 00 00 00 HEX 000000 1941 a20f ;heofonfir_lucelia_layer1_6 1942 a20f 40 00 01 HEX 400001 1943 a212 ;heofonfir_lucelia_layer1_7 1944 a212 00 00 00 HEX 000000 1945 a215 ;heofonfir_lucelia_layer1_8 1946 a215 00 6c 00 HEX 006c00 1947 a218 ;heofonfir_lucelia_layer_2nofire_1 1948 a218 01 00 40 HEX 010040 1949 a21b ;heofonfir_lucelia_layer_2nofire_2 1950 a21b 04 02 10 HEX 040210 1951 a21e ;heofonfir_lucelia_layer_2nofire_3 1952 a21e 04 02 10 HEX 040210 1953 a221 ;heofonfir_lucelia_layer_2nofire_4 1954 a221 00 00 00 HEX 000000 1955 a224 ;heofonfir_lucelia_layer_2nofire_5 1956 a224 00 41 00 HEX 004100 1957 a227 ;heofonfir_lucelia_layer_2nofire_6 1958 a227 00 41 00 HEX 004100 1959 a22a ;heofonfir_lucelia_layer_2nofire_7 1960 a22a 00 41 00 HEX 004100 1961 a22d ;heofonfir_lucelia_layer_2nofire_8 1962 a22d 04 02 10 HEX 040210 1963 a230 ;heofonfir_bullet 1964 a230 00 HEX 00 1965 a231 ;heofonfir_bomb_bug 1966 a231 09 55 60 HEX 095560 1967 a234 1968 a300 ORG $A300,0 ; ************* 1969 a300 1970 a300 RORG $A300 ; ************* 1971 a300 1972 a300 ;heofonfir_lucelia_layer1_1 1973 a300 00 ab 00 HEX 00ab00 1974 a303 ;heofonfir_lucelia_layer1_2 1975 a303 00 1c 00 HEX 001c00 1976 a306 ;heofonfir_lucelia_layer1_3 1977 a306 80 9c 02 HEX 809c02 1978 a309 ;heofonfir_lucelia_layer1_4 1979 a309 20 9c 08 HEX 209c08 1980 a30c ;heofonfir_lucelia_layer1_5 1981 a30c 00 aa 00 HEX 00aa00 1982 a30f ;heofonfir_lucelia_layer1_6 1983 a30f 40 00 01 HEX 400001 1984 a312 ;heofonfir_lucelia_layer1_7 1985 a312 00 55 00 HEX 005500 1986 a315 ;heofonfir_lucelia_layer1_8 1987 a315 00 6c 00 HEX 006c00 1988 a318 ;heofonfir_lucelia_layer_2nofire_1 1989 a318 01 00 40 HEX 010040 1990 a31b ;heofonfir_lucelia_layer_2nofire_2 1991 a31b 01 00 40 HEX 010040 1992 a31e ;heofonfir_lucelia_layer_2nofire_3 1993 a31e 04 02 10 HEX 040210 1994 a321 ;heofonfir_lucelia_layer_2nofire_4 1995 a321 04 02 10 HEX 040210 1996 a324 ;heofonfir_lucelia_layer_2nofire_5 1997 a324 00 00 00 HEX 000000 1998 a327 ;heofonfir_lucelia_layer_2nofire_6 1999 a327 00 41 00 HEX 004100 2000 a32a ;heofonfir_lucelia_layer_2nofire_7 2001 a32a 00 00 00 HEX 000000 2002 a32d ;heofonfir_lucelia_layer_2nofire_8 2003 a32d 04 02 10 HEX 040210 2004 a330 ;heofonfir_bullet 2005 a330 00 HEX 00 2006 a331 ;heofonfir_bomb_bug 2007 a331 12 aa 84 HEX 12aa84 2008 a334 2009 a400 ORG $A400,0 ; ************* 2010 a400 2011 a400 RORG $A400 ; ************* 2012 a400 2013 a400 ;heofonfir_lucelia_layer1_1 2014 a400 00 69 00 HEX 006900 2015 a403 ;heofonfir_lucelia_layer1_2 2016 a403 00 57 00 HEX 005700 2017 a406 ;heofonfir_lucelia_layer1_3 2018 a406 80 1c 02 HEX 801c02 2019 a409 ;heofonfir_lucelia_layer1_4 2020 a409 08 9c 20 HEX 089c20 2021 a40c ;heofonfir_lucelia_layer1_5 2022 a40c 80 9c 02 HEX 809c02 2023 a40f ;heofonfir_lucelia_layer1_6 2024 a40f 40 55 01 HEX 405501 2025 a412 ;heofonfir_lucelia_layer1_7 2026 a412 00 6c 00 HEX 006c00 2027 a415 ;heofonfir_lucelia_layer1_8 2028 a415 00 2c 00 HEX 002c00 2029 a418 ;heofonfir_lucelia_layer_2nofire_1 2030 a418 00 00 00 HEX 000000 2031 a41b ;heofonfir_lucelia_layer_2nofire_2 2032 a41b 01 00 40 HEX 010040 2033 a41e ;heofonfir_lucelia_layer_2nofire_3 2034 a41e 01 00 40 HEX 010040 2035 a421 ;heofonfir_lucelia_layer_2nofire_4 2036 a421 04 02 10 HEX 040210 2037 a424 ;heofonfir_lucelia_layer_2nofire_5 2038 a424 04 02 10 HEX 040210 2039 a427 ;heofonfir_lucelia_layer_2nofire_6 2040 a427 00 00 00 HEX 000000 2041 a42a ;heofonfir_lucelia_layer_2nofire_7 2042 a42a 04 02 10 HEX 040210 2043 a42d ;heofonfir_lucelia_layer_2nofire_8 2044 a42d 01 00 40 HEX 010040 2045 a430 ;heofonfir_bullet 2046 a430 00 HEX 00 2047 a431 ;heofonfir_bomb_bug 2048 a431 49 e9 e3 HEX 49e9e3 2049 a434 2050 a500 ORG $A500,0 ; ************* 2051 a500 2052 a500 RORG $A500 ; ************* 2053 a500 2054 a500 ;heofonfir_lucelia_layer1_1 2055 a500 01 2c 40 HEX 012c40 2056 a503 ;heofonfir_lucelia_layer1_2 2057 a503 00 96 00 HEX 009600 2058 a506 ;heofonfir_lucelia_layer1_3 2059 a506 28 57 28 HEX 285728 2060 a509 ;heofonfir_lucelia_layer1_4 2061 a509 08 1c 20 HEX 081c20 2062 a50c ;heofonfir_lucelia_layer1_5 2063 a50c 80 9c 02 HEX 809c02 2064 a50f ;heofonfir_lucelia_layer1_6 2065 a50f 10 6c 04 HEX 106c04 2066 a512 ;heofonfir_lucelia_layer1_7 2067 a512 00 6c 00 HEX 006c00 2068 a515 ;heofonfir_lucelia_layer1_8 2069 a515 00 ab 00 HEX 00ab00 2070 a518 ;heofonfir_lucelia_layer_2nofire_1 2071 a518 00 00 00 HEX 000000 2072 a51b ;heofonfir_lucelia_layer_2nofire_2 2073 a51b 00 00 00 HEX 000000 2074 a51e ;heofonfir_lucelia_layer_2nofire_3 2075 a51e 01 00 40 HEX 010040 2076 a521 ;heofonfir_lucelia_layer_2nofire_4 2077 a521 01 00 40 HEX 010040 2078 a524 ;heofonfir_lucelia_layer_2nofire_5 2079 a524 04 02 10 HEX 040210 2080 a527 ;heofonfir_lucelia_layer_2nofire_6 2081 a527 04 02 10 HEX 040210 2082 a52a ;heofonfir_lucelia_layer_2nofire_7 2083 a52a 04 02 10 HEX 040210 2084 a52d ;heofonfir_lucelia_layer_2nofire_8 2085 a52d 01 00 40 HEX 010040 2086 a530 ;heofonfir_bullet 2087 a530 00 HEX 00 2088 a531 ;heofonfir_bomb_bug 2089 a531 27 be 78 HEX 27be78 2090 a534 2091 a600 ORG $A600,0 ; ************* 2092 a600 2093 a600 RORG $A600 ; ************* 2094 a600 2095 a600 ;heofonfir_lucelia_layer1_1 2096 a600 04 ab 10 HEX 04ab10 2097 a603 ;heofonfir_lucelia_layer1_2 2098 a603 0a 1c a0 HEX 0a1ca0 2099 a606 ;heofonfir_lucelia_layer1_3 2100 a606 02 96 80 HEX 029680 2101 a609 ;heofonfir_lucelia_layer1_4 2102 a609 02 57 80 HEX 025780 2103 a60c ;heofonfir_lucelia_layer1_5 2104 a60c 80 1c 02 HEX 801c02 2105 a60f ;heofonfir_lucelia_layer1_6 2106 a60f 10 6c 04 HEX 106c04 2107 a612 ;heofonfir_lucelia_layer1_7 2108 a612 40 2c 01 HEX 402c01 2109 a615 ;heofonfir_lucelia_layer1_8 2110 a615 00 69 00 HEX 006900 2111 a618 ;heofonfir_lucelia_layer_2nofire_1 2112 a618 00 00 00 HEX 000000 2113 a61b ;heofonfir_lucelia_layer_2nofire_2 2114 a61b 00 00 00 HEX 000000 2115 a61e ;heofonfir_lucelia_layer_2nofire_3 2116 a61e 00 00 00 HEX 000000 2117 a621 ;heofonfir_lucelia_layer_2nofire_4 2118 a621 01 00 40 HEX 010040 2119 a624 ;heofonfir_lucelia_layer_2nofire_5 2120 a624 01 00 40 HEX 010040 2121 a627 ;heofonfir_lucelia_layer_2nofire_6 2122 a627 04 02 10 HEX 040210 2123 a62a ;heofonfir_lucelia_layer_2nofire_7 2124 a62a 01 00 40 HEX 010040 2125 a62d ;heofonfir_lucelia_layer_2nofire_8 2126 a62d 00 00 00 HEX 000000 2127 a630 ;heofonfir_bullet 2128 a630 00 HEX 00 2129 a631 ;heofonfir_bomb_bug 2130 a631 27 be 78 HEX 27be78 2131 a634 2132 a700 ORG $A700,0 ; ************* 2133 a700 2134 a700 RORG $A700 ; ************* 2135 a700 2136 a700 ;heofonfir_lucelia_layer1_1 2137 a700 04 af 10 HEX 04af10 2138 a703 ;heofonfir_lucelia_layer1_2 2139 a703 20 57 08 HEX 205708 2140 a706 ;heofonfir_lucelia_layer1_3 2141 a706 00 1c 00 HEX 001c00 2142 a709 ;heofonfir_lucelia_layer1_4 2143 a709 00 96 00 HEX 009600 2144 a70c ;heofonfir_lucelia_layer1_5 2145 a70c 28 57 28 HEX 285728 2146 a70f ;heofonfir_lucelia_layer1_6 2147 a70f 10 2c 04 HEX 102c04 2148 a712 ;heofonfir_lucelia_layer1_7 2149 a712 40 ab 01 HEX 40ab01 2150 a715 ;heofonfir_lucelia_layer1_8 2151 a715 01 2c 40 HEX 012c40 2152 a718 ;heofonfir_lucelia_layer_2nofire_1 2153 a718 00 00 00 HEX 000000 2154 a71b ;heofonfir_lucelia_layer_2nofire_2 2155 a71b 00 00 00 HEX 000000 2156 a71e ;heofonfir_lucelia_layer_2nofire_3 2157 a71e 00 00 00 HEX 000000 2158 a721 ;heofonfir_lucelia_layer_2nofire_4 2159 a721 00 00 00 HEX 000000 2160 a724 ;heofonfir_lucelia_layer_2nofire_5 2161 a724 01 00 40 HEX 010040 2162 a727 ;heofonfir_lucelia_layer_2nofire_6 2163 a727 01 00 40 HEX 010040 2164 a72a ;heofonfir_lucelia_layer_2nofire_7 2165 a72a 01 00 40 HEX 010040 2166 a72d ;heofonfir_lucelia_layer_2nofire_8 2167 a72d 00 00 00 HEX 000000 2168 a730 ;heofonfir_bullet 2169 a730 00 HEX 00 2170 a731 ;heofonfir_bomb_bug 2171 a731 26 55 98 HEX 265598 2172 a734 2173 a800 ORG $A800,0 ; ************* 2174 a800 2175 a800 RORG $A800 ; ************* 2176 a800 2177 a800 ;heofonfir_lucelia_layer1_1 2178 a800 10 ab 04 HEX 10ab04 2179 a803 ;heofonfir_lucelia_layer1_2 2180 a803 80 5f 02 HEX 805f02 2181 a806 ;heofonfir_lucelia_layer1_3 2182 a806 00 57 00 HEX 005700 2183 a809 ;heofonfir_lucelia_layer1_4 2184 a809 00 1c 00 HEX 001c00 2185 a80c ;heofonfir_lucelia_layer1_5 2186 a80c 02 96 80 HEX 029680 2187 a80f ;heofonfir_lucelia_layer1_6 2188 a80f 04 ab 10 HEX 04ab10 2189 a812 ;heofonfir_lucelia_layer1_7 2190 a812 40 69 01 HEX 406901 2191 a815 ;heofonfir_lucelia_layer1_8 2192 a815 01 ab 40 HEX 01ab40 2193 a818 ;heofonfir_lucelia_layer_2nofire_1 2194 a818 00 00 00 HEX 000000 2195 a81b ;heofonfir_lucelia_layer_2nofire_2 2196 a81b 00 00 00 HEX 000000 2197 a81e ;heofonfir_lucelia_layer_2nofire_3 2198 a81e 00 00 00 HEX 000000 2199 a821 ;heofonfir_lucelia_layer_2nofire_4 2200 a821 00 00 00 HEX 000000 2201 a824 ;heofonfir_lucelia_layer_2nofire_5 2202 a824 00 00 00 HEX 000000 2203 a827 ;heofonfir_lucelia_layer_2nofire_6 2204 a827 01 00 40 HEX 010040 2205 a82a ;heofonfir_lucelia_layer_2nofire_7 2206 a82a 00 00 00 HEX 000000 2207 a82d ;heofonfir_lucelia_layer_2nofire_8 2208 a82d 00 00 00 HEX 000000 2209 a830 ;heofonfir_bullet 2210 a830 0c HEX 0c 2211 a831 ;heofonfir_bomb_bug 2212 a831 9e ff 9e HEX 9eff9e 2213 a834 2214 a900 ORG $A900,0 ; ************* 2215 a900 2216 a900 RORG $A900 ; ************* 2217 a900 2218 a900 ;heofonfir_lucelia_layer1_1 2219 a900 10 28 04 HEX 102804 2220 a903 ;heofonfir_lucelia_layer1_2 2221 a903 80 57 02 HEX 805702 2222 a906 ;heofonfir_lucelia_layer1_3 2223 a906 00 5f 00 HEX 005f00 2224 a909 ;heofonfir_lucelia_layer1_4 2225 a909 00 57 00 HEX 005700 2226 a90c ;heofonfir_lucelia_layer1_5 2227 a90c 00 1c 00 HEX 001c00 2228 a90f ;heofonfir_lucelia_layer1_6 2229 a90f 04 69 10 HEX 046910 2230 a912 ;heofonfir_lucelia_layer1_7 2231 a912 41 2c 41 HEX 412c41 2232 a915 ;heofonfir_lucelia_layer1_8 2233 a915 41 af 41 HEX 41af41 2234 a918 ;heofonfir_lucelia_layer_2nofire_1 2235 a918 00 00 00 HEX 000000 2236 a91b ;heofonfir_lucelia_layer_2nofire_2 2237 a91b 00 00 00 HEX 000000 2238 a91e ;heofonfir_lucelia_layer_2nofire_3 2239 a91e 00 00 00 HEX 000000 2240 a921 ;heofonfir_lucelia_layer_2nofire_4 2241 a921 00 00 00 HEX 000000 2242 a924 ;heofonfir_lucelia_layer_2nofire_5 2243 a924 00 00 00 HEX 000000 2244 a927 ;heofonfir_lucelia_layer_2nofire_6 2245 a927 00 00 00 HEX 000000 2246 a92a ;heofonfir_lucelia_layer_2nofire_7 2247 a92a 00 00 00 HEX 000000 2248 a92d ;heofonfir_lucelia_layer_2nofire_8 2249 a92d 00 00 00 HEX 000000 2250 a930 ;heofonfir_bullet 2251 a930 0c HEX 0c 2252 a931 ;heofonfir_bomb_bug 2253 a931 98 55 26 HEX 985526 2254 a934 2255 aa00 ORG $AA00,0 ; ************* 2256 aa00 2257 aa00 RORG $AA00 ; ************* 2258 aa00 2259 aa00 ;heofonfir_lucelia_layer1_1 2260 aa00 10 00 04 HEX 100004 2261 aa03 ;heofonfir_lucelia_layer1_2 2262 aa03 80 14 02 HEX 801402 2263 aa06 ;heofonfir_lucelia_layer1_3 2264 aa06 00 57 00 HEX 005700 2265 aa09 ;heofonfir_lucelia_layer1_4 2266 aa09 00 5f 00 HEX 005f00 2267 aa0c ;heofonfir_lucelia_layer1_5 2268 aa0c 00 57 00 HEX 005700 2269 aa0f ;heofonfir_lucelia_layer1_6 2270 aa0f 01 2c 40 HEX 012c40 2271 aa12 ;heofonfir_lucelia_layer1_7 2272 aa12 11 ab 44 HEX 11ab44 2273 aa15 ;heofonfir_lucelia_layer1_8 2274 aa15 44 ab 11 HEX 44ab11 2275 aa18 ;heofonfir_lucelia_layer_2nofire_1 2276 aa18 00 00 00 HEX 000000 2277 aa1b ;heofonfir_lucelia_layer_2nofire_2 2278 aa1b 00 00 00 HEX 000000 2279 aa1e ;heofonfir_lucelia_layer_2nofire_3 2280 aa1e 00 00 00 HEX 000000 2281 aa21 ;heofonfir_lucelia_layer_2nofire_4 2282 aa21 00 00 00 HEX 000000 2283 aa24 ;heofonfir_lucelia_layer_2nofire_5 2284 aa24 00 00 00 HEX 000000 2285 aa27 ;heofonfir_lucelia_layer_2nofire_6 2286 aa27 00 00 00 HEX 000000 2287 aa2a ;heofonfir_lucelia_layer_2nofire_7 2288 aa2a 00 00 00 HEX 000000 2289 aa2d ;heofonfir_lucelia_layer_2nofire_8 2290 aa2d 00 00 00 HEX 000000 2291 aa30 ;heofonfir_bullet 2292 aa30 08 HEX 08 2293 aa31 ;heofonfir_bomb_bug 2294 aa31 98 ff 26 HEX 98ff26 2295 aa34 2296 ab00 ORG $AB00,0 ; ************* 2297 ab00 2298 ab00 RORG $AB00 ; ************* 2299 ab00 2300 ab00 ;heofonfir_lucelia_layer1_1 2301 ab00 40 00 01 HEX 400001 2302 ab03 ;heofonfir_lucelia_layer1_2 2303 ab03 00 00 00 HEX 000000 2304 ab06 ;heofonfir_lucelia_layer1_3 2305 ab06 00 14 00 HEX 001400 2306 ab09 ;heofonfir_lucelia_layer1_4 2307 ab09 00 57 00 HEX 005700 2308 ab0c ;heofonfir_lucelia_layer1_5 2309 ab0c 00 5f 00 HEX 005f00 2310 ab0f ;heofonfir_lucelia_layer1_6 2311 ab0f 00 ab 00 HEX 00ab00 2312 ab12 ;heofonfir_lucelia_layer1_7 2313 ab12 04 af 10 HEX 04af10 2314 ab15 ;heofonfir_lucelia_layer1_8 2315 ab15 44 28 11 HEX 442811 2316 ab18 ;heofonfir_lucelia_layer_2nofire_1 2317 ab18 00 00 00 HEX 000000 2318 ab1b ;heofonfir_lucelia_layer_2nofire_2 2319 ab1b 00 00 00 HEX 000000 2320 ab1e ;heofonfir_lucelia_layer_2nofire_3 2321 ab1e 00 00 00 HEX 000000 2322 ab21 ;heofonfir_lucelia_layer_2nofire_4 2323 ab21 00 00 00 HEX 000000 2324 ab24 ;heofonfir_lucelia_layer_2nofire_5 2325 ab24 00 00 00 HEX 000000 2326 ab27 ;heofonfir_lucelia_layer_2nofire_6 2327 ab27 00 00 00 HEX 000000 2328 ab2a ;heofonfir_lucelia_layer_2nofire_7 2329 ab2a 00 00 00 HEX 000000 2330 ab2d ;heofonfir_lucelia_layer_2nofire_8 2331 ab2d 00 00 00 HEX 000000 2332 ab30 ;heofonfir_bullet 2333 ab30 08 HEX 08 2334 ab31 ;heofonfir_bomb_bug 2335 ab31 20 55 08 HEX 205508 2336 ab34 2337 ac00 ORG $AC00,0 ; ************* 2338 ac00 2339 ac00 RORG $AC00 ; ************* 2340 ac00 2341 ac00 ;heofonfir_lucelia_layer1_1 2342 ac00 40 00 01 HEX 400001 2343 ac03 ;heofonfir_lucelia_layer1_2 2344 ac03 00 00 00 HEX 000000 2345 ac06 ;heofonfir_lucelia_layer1_3 2346 ac06 00 00 00 HEX 000000 2347 ac09 ;heofonfir_lucelia_layer1_4 2348 ac09 00 14 00 HEX 001400 2349 ac0c ;heofonfir_lucelia_layer1_5 2350 ac0c 00 57 00 HEX 005700 2351 ac0f ;heofonfir_lucelia_layer1_6 2352 ac0f 00 af 00 HEX 00af00 2353 ac12 ;heofonfir_lucelia_layer1_7 2354 ac12 00 ab 00 HEX 00ab00 2355 ac15 ;heofonfir_lucelia_layer1_8 2356 ac15 10 00 04 HEX 100004 2357 ac18 ;heofonfir_lucelia_layer_2nofire_1 2358 ac18 00 00 00 HEX 000000 2359 ac1b ;heofonfir_lucelia_layer_2nofire_2 2360 ac1b 00 00 00 HEX 000000 2361 ac1e ;heofonfir_lucelia_layer_2nofire_3 2362 ac1e 00 00 00 HEX 000000 2363 ac21 ;heofonfir_lucelia_layer_2nofire_4 2364 ac21 00 00 00 HEX 000000 2365 ac24 ;heofonfir_lucelia_layer_2nofire_5 2366 ac24 00 00 00 HEX 000000 2367 ac27 ;heofonfir_lucelia_layer_2nofire_6 2368 ac27 00 00 00 HEX 000000 2369 ac2a ;heofonfir_lucelia_layer_2nofire_7 2370 ac2a 00 00 00 HEX 000000 2371 ac2d ;heofonfir_lucelia_layer_2nofire_8 2372 ac2d 00 00 00 HEX 000000 2373 ac30 ;heofonfir_bullet 2374 ac30 08 HEX 08 2375 ac31 ;heofonfir_bomb_bug 2376 ac31 20 3c 08 HEX 203c08 2377 ac34 2378 ad00 ORG $AD00,0 ; ************* 2379 ad00 2380 ad00 RORG $AD00 ; ************* 2381 ad00 2382 ad00 ;heofonfir_lucelia_layer1_1 2383 ad00 40 00 01 HEX 400001 2384 ad03 ;heofonfir_lucelia_layer1_2 2385 ad03 00 00 00 HEX 000000 2386 ad06 ;heofonfir_lucelia_layer1_3 2387 ad06 00 00 00 HEX 000000 2388 ad09 ;heofonfir_lucelia_layer1_4 2389 ad09 00 00 00 HEX 000000 2390 ad0c ;heofonfir_lucelia_layer1_5 2391 ad0c 00 14 00 HEX 001400 2392 ad0f ;heofonfir_lucelia_layer1_6 2393 ad0f 00 ab 00 HEX 00ab00 2394 ad12 ;heofonfir_lucelia_layer1_7 2395 ad12 00 28 00 HEX 002800 2396 ad15 ;heofonfir_lucelia_layer1_8 2397 ad15 00 00 00 HEX 000000 2398 ad18 ;heofonfir_lucelia_layer_2nofire_1 2399 ad18 00 00 00 HEX 000000 2400 ad1b ;heofonfir_lucelia_layer_2nofire_2 2401 ad1b 00 00 00 HEX 000000 2402 ad1e ;heofonfir_lucelia_layer_2nofire_3 2403 ad1e 00 00 00 HEX 000000 2404 ad21 ;heofonfir_lucelia_layer_2nofire_4 2405 ad21 00 00 00 HEX 000000 2406 ad24 ;heofonfir_lucelia_layer_2nofire_5 2407 ad24 00 00 00 HEX 000000 2408 ad27 ;heofonfir_lucelia_layer_2nofire_6 2409 ad27 00 00 00 HEX 000000 2410 ad2a ;heofonfir_lucelia_layer_2nofire_7 2411 ad2a 00 00 00 HEX 000000 2412 ad2d ;heofonfir_lucelia_layer_2nofire_8 2413 ad2d 00 00 00 HEX 000000 2414 ad30 ;heofonfir_bullet 2415 ad30 04 HEX 04 2416 ad31 ;heofonfir_bomb_bug 2417 ad31 00 14 00 HEX 001400 2418 ad34 2419 ae00 ORG $AE00,0 ; ************* 2420 ae00 2421 ae00 RORG $AE00 ; ************* 2422 ae00 2423 ae00 ;heofonfir_lucelia_layer1_1 2424 ae00 00 00 00 HEX 000000 2425 ae03 ;heofonfir_lucelia_layer1_2 2426 ae03 00 00 00 HEX 000000 2427 ae06 ;heofonfir_lucelia_layer1_3 2428 ae06 00 00 00 HEX 000000 2429 ae09 ;heofonfir_lucelia_layer1_4 2430 ae09 00 00 00 HEX 000000 2431 ae0c ;heofonfir_lucelia_layer1_5 2432 ae0c 00 00 00 HEX 000000 2433 ae0f ;heofonfir_lucelia_layer1_6 2434 ae0f 00 28 00 HEX 002800 2435 ae12 ;heofonfir_lucelia_layer1_7 2436 ae12 00 00 00 HEX 000000 2437 ae15 ;heofonfir_lucelia_layer1_8 2438 ae15 00 00 00 HEX 000000 2439 ae18 ;heofonfir_lucelia_layer_2nofire_1 2440 ae18 00 00 00 HEX 000000 2441 ae1b ;heofonfir_lucelia_layer_2nofire_2 2442 ae1b 00 00 00 HEX 000000 2443 ae1e ;heofonfir_lucelia_layer_2nofire_3 2444 ae1e 00 00 00 HEX 000000 2445 ae21 ;heofonfir_lucelia_layer_2nofire_4 2446 ae21 00 00 00 HEX 000000 2447 ae24 ;heofonfir_lucelia_layer_2nofire_5 2448 ae24 00 00 00 HEX 000000 2449 ae27 ;heofonfir_lucelia_layer_2nofire_6 2450 ae27 00 00 00 HEX 000000 2451 ae2a ;heofonfir_lucelia_layer_2nofire_7 2452 ae2a 00 00 00 HEX 000000 2453 ae2d ;heofonfir_lucelia_layer_2nofire_8 2454 ae2d 00 00 00 HEX 000000 2455 ae30 ;heofonfir_bullet 2456 ae30 04 HEX 04 2457 ae31 ;heofonfir_bomb_bug 2458 ae31 00 00 00 HEX 000000 2459 ae34 2460 af00 ORG $AF00,0 ; ************* 2461 af00 2462 af00 RORG $AF00 ; ************* 2463 af00 2464 af00 ;heofonfir_lucelia_layer1_1 2465 af00 00 00 00 HEX 000000 2466 af03 ;heofonfir_lucelia_layer1_2 2467 af03 00 00 00 HEX 000000 2468 af06 ;heofonfir_lucelia_layer1_3 2469 af06 00 00 00 HEX 000000 2470 af09 ;heofonfir_lucelia_layer1_4 2471 af09 00 00 00 HEX 000000 2472 af0c ;heofonfir_lucelia_layer1_5 2473 af0c 00 00 00 HEX 000000 2474 af0f ;heofonfir_lucelia_layer1_6 2475 af0f 00 00 00 HEX 000000 2476 af12 ;heofonfir_lucelia_layer1_7 2477 af12 00 00 00 HEX 000000 2478 af15 ;heofonfir_lucelia_layer1_8 2479 af15 00 00 00 HEX 000000 2480 af18 ;heofonfir_lucelia_layer_2nofire_1 2481 af18 00 00 00 HEX 000000 2482 af1b ;heofonfir_lucelia_layer_2nofire_2 2483 af1b 00 00 00 HEX 000000 2484 af1e ;heofonfir_lucelia_layer_2nofire_3 2485 af1e 00 00 00 HEX 000000 2486 af21 ;heofonfir_lucelia_layer_2nofire_4 2487 af21 00 00 00 HEX 000000 2488 af24 ;heofonfir_lucelia_layer_2nofire_5 2489 af24 00 00 00 HEX 000000 2490 af27 ;heofonfir_lucelia_layer_2nofire_6 2491 af27 00 00 00 HEX 000000 2492 af2a ;heofonfir_lucelia_layer_2nofire_7 2493 af2a 00 00 00 HEX 000000 2494 af2d ;heofonfir_lucelia_layer_2nofire_8 2495 af2d 00 00 00 HEX 000000 2496 af30 ;heofonfir_bullet 2497 af30 04 HEX 04 2498 af31 ;heofonfir_bomb_bug 2499 af31 00 00 00 HEX 000000 2500 af34 2501 b000 ORG $B000,0 ; ************* 2502 b000 2503 b000 RORG $B000 ; ************* 2504 b000 - if SPACEOVERFLOW > 0 2505 b000 - echo "" 2506 b000 - echo "######## ERROR: space overflow detected in",[SPACEOVERFLOW]d,"areas." 2507 b000 - echo "######## look above for areas with negative ROM space left." 2508 b000 - echo "######## Aborting assembly." 2509 b000 - ERR 2510 b000 endif 2511 b000 2512 b000 2513 b000 ; Provided under the CC0 license. See the included LICENSE.txt for details. 2514 b000 2515 b000 - ifnconst bankswitchmode 2516 b000 - if ( * < $f000 ) 2517 b000 - ORG $F000 2518 b000 - endif 2519 b000 else 2520 b000 ifconst ROM128K 2521 b000 if ( * < $f000 ) 2522 27000 ORG $27000 2523 27000 RORG $F000 2524 27000 endif 2525 27000 endif 2526 27000 - ifconst ROM144K 2527 27000 - if ( * < $f000 ) 2528 27000 - ORG $27000 2529 27000 - RORG $F000 2530 27000 - endif 2531 27000 endif 2532 27000 - ifconst ROM256K 2533 27000 - if ( * < $f000 ) 2534 27000 - ORG $47000 2535 27000 - RORG $F000 2536 27000 - endif 2537 27000 endif 2538 27000 - ifconst ROM272K 2539 27000 - if ( * < $f000 ) 2540 27000 - ORG $47000 2541 27000 - RORG $F000 2542 27000 - endif 2543 27000 endif 2544 27000 - ifconst ROM512K 2545 27000 - if ( * < $f000 ) 2546 27000 - ORG $87000 2547 27000 - RORG $F000 2548 27000 - endif 2549 27000 endif 2550 27000 - ifconst ROM528K 2551 27000 - if ( * < $f000 ) 2552 27000 - ORG $87000 2553 27000 - RORG $F000 2554 27000 - endif 2555 27000 endif 2556 27000 endif 2557 27000 2558 27000 ; all of these "modules" have conditional clauses in them, so even though 2559 27000 ; they're always included here, they don't take up rom unless the user 2560 27000 ; explicitly enables support for the feature. 2561 27000 2562 27000 ifnconst included.7800vox.asm ------- FILE 7800vox.asm LEVEL 2 PASS 3 0 27000 include 7800vox.asm 1 27000 ; Provided under the CC0 license. See the included LICENSE.txt for details. 2 27000 3 27000 ; AtariVox 7800basic wrapper 4 27000 5 27000 ; to be called with 6 27000 ; A=# of bytes 7 27000 ; 8 27000 9 27000 - ifconst HSSUPPORT 10 27000 - 11 27000 -AVoxReadBytes 12 27000 - sta temp8 13 27000 - jsr i2c_startwrite 14 27000 - bcs eeprom_error 15 27000 - 16 27000 - lda HSVoxHi 17 27000 - jsr i2c_txbyte 18 27000 - lda HSVoxLo 19 27000 - jsr i2c_txbyte 20 27000 - jsr i2c_stopwrite 21 27000 - 22 27000 - jsr i2c_startread 23 27000 - 24 27000 - ldx #0 25 27000 -AVoxReadBytesLoop 26 27000 - jsr i2c_rxbyte 27 27000 - sta eeprombuffer,x 28 27000 - inx 29 27000 - cpx temp8 30 27000 - bne AVoxReadBytesLoop 31 27000 - jsr i2c_stopread 32 27000 - lda #0 33 27000 - rts 34 27000 - 35 27000 - ; to be called with 36 27000 - ; A=# of bytes 37 27000 - ; 38 27000 - 39 27000 -AVoxWriteBytes 40 27000 - sta temp8 41 27000 - jsr i2c_startwrite 42 27000 - bcs eeprom_error 43 27000 - 44 27000 - lda HSVoxHi 45 27000 - jsr i2c_txbyte 46 27000 - lda HSVoxLo 47 27000 - jsr i2c_txbyte 48 27000 - 49 27000 - ldx #$00 50 27000 -AVoxWriteBytesLoop 51 27000 - lda eeprombuffer,x 52 27000 - jsr i2c_txbyte 53 27000 - inx 54 27000 - cpx temp8 55 27000 - bne AVoxWriteBytesLoop 56 27000 - jsr i2c_stopwrite 57 27000 - 58 27000 - lda #0 59 27000 - rts 60 27000 - 61 27000 -eeprom_error 62 27000 - lda #$ff 63 27000 - rts 64 27000 - 65 27000 -AVoxDetect 66 27000 - 67 27000 - jsr i2c_startwrite 68 27000 - bcs eeprom_error 69 27000 - lda #$30 70 27000 - jsr i2c_txbyte 71 27000 - lda #$00 72 27000 - jsr i2c_txbyte 73 27000 - jsr i2c_stopwrite 74 27000 - rts 75 27000 - 76 27000 - include "i2c7800.inc" 77 27000 - I2C_SUBS temp9 78 27000 - 79 27000 endif 80 27000 ------- FILE c:\Users\Shane\Documents\my7800projects\Heofonfir\Lucelia_Movement_demo.78b.asm 2564 27000 endif 2565 27000 ifnconst included.pokeysound.asm ------- FILE pokeysound.asm LEVEL 2 PASS 3 0 27000 include pokeysound.asm 1 27000 ; Provided under the CC0 license. See the included LICENSE.txt for details. 2 27000 3 27000 4 27000 - ifconst pokeysupport 5 27000 - 6 27000 -pokeysoundmodulestart 7 27000 - 8 27000 -mutepokey 9 27000 - lda #0 10 27000 - ldy #7 11 27000 -mutepokeyloop 12 27000 - sta pokey1pointlo,y 13 27000 - sta (pokeybaselo),y 14 27000 - dey 15 27000 - bpl mutepokeyloop 16 27000 - rts 17 27000 - 18 27000 -checkpokeyplaying 19 27000 - ldx #6 20 27000 -checkpokeyplayingloop 21 27000 - lda pokey1pointlo,x 22 27000 - ora pokey1pointhi,x 23 27000 - beq pokeychannelinactive 24 27000 - jsr playpokeysfxA ; x=channel*2 25 27000 -pokeychannelinactive 26 27000 - dex 27 27000 - dex 28 27000 - bpl checkpokeyplayingloop 29 27000 - rts 30 27000 - 31 27000 -playpokeysfxA 32 27000 - txa 33 27000 - tay 34 27000 - lda pokey1tick,x 35 27000 - beq playpokeysfxAcont 36 27000 - sec 37 27000 - sbc #1 38 27000 - sta pokey1tick,x ; sound resolution is >1 frame, and we're mid-tock... 39 27000 - rts 40 27000 - 41 27000 -playpokeysfxAcont 42 27000 - lda pokey1frames,x ; set the frame countdown for this sound chunk 43 27000 - sta pokey1tick,x 44 27000 - 45 27000 - lda pokey1priority,x ; decrease the sound's priority if its non-zero 46 27000 - beq playpokeysfxAcont2 47 27000 - sec 48 27000 - sbc #1 49 27000 - sta pokey1priority,x 50 27000 -playpokeysfxAcont2 51 27000 - 52 27000 - ; *** FREQUENCY 53 27000 - lda (pokey1pointlo,x) 54 27000 - sta inttemp1 55 27000 - clc 56 27000 - adc pokey1offset,x ; take into account any pitch modification 57 27000 - sta (pokeybaselo),y ; PAUDF0,0 58 27000 - 59 27000 - ;advance the data pointer +1 60 27000 - inc pokey1pointlo,x 61 27000 - bne skippokeyhiinc1 62 27000 - inc pokey1pointhi,x 63 27000 -skippokeyhiinc1 64 27000 - 65 27000 - ; *** WAVE 66 27000 - lda (pokey1pointlo,x) 67 27000 - asl 68 27000 - asl 69 27000 - asl 70 27000 - asl ; x16 71 27000 - 72 27000 - ;advance the data pointer +1 73 27000 - inc pokey1pointlo,x 74 27000 - bne skippokeyhiinc2 75 27000 - inc pokey1pointhi,x 76 27000 -skippokeyhiinc2 77 27000 - 78 27000 - ora (pokey1pointlo,x) 79 27000 - iny 80 27000 - sta (pokeybaselo),y 81 27000 - 82 27000 - ora inttemp1 ; check if F|C|V=0 83 27000 - beq zeropokeypoint ; if so, we're at the end of the sound. 84 27000 - 85 27000 - ; advance the pointer +1, on to the next sound chunk 86 27000 - inc pokey1pointlo,x 87 27000 - bne skippokeyhiinc3 88 27000 - inc pokey1pointhi,x 89 27000 -skippokeyhiinc3 90 27000 - rts 91 27000 - 92 27000 -zeropokeypoint 93 27000 - sta pokey1pointlo,x 94 27000 - sta pokey1pointhi,x 95 27000 - sta pokey1priority,x 96 27000 - rts 97 27000 - 98 27000 -schedulepokeysfx 99 27000 - ldx #6 100 27000 -schedulepokeysfxloop 101 27000 - lda pokey1pointlo,x 102 27000 - ora pokey1pointhi,x 103 27000 - bne schedulespokeysearch 104 27000 - jmp schedulepokeyX ; we found an unused channel, so use it... 105 27000 -schedulespokeysearch 106 27000 - dex 107 27000 - dex 108 27000 - bpl schedulepokeysfxloop 109 27000 - 110 27000 - ; if we're here, all 4 channels are presently playing a sound... 111 27000 - ldy #1 112 27000 - lda (sfxinstrumentlo),y ; peek at the priority of this sfx... 113 27000 - bne schedulepokeysfxcont1 114 27000 - rts ; ...and skip it if it's 0 priority 115 27000 -schedulepokeysfxcont1 116 27000 - 117 27000 - ; figure out which current sound has the lowest priority... 118 27000 - lda #0 119 27000 - sta temp8 120 27000 - lda pokey1priority 121 27000 - sta temp9 122 27000 - ldx #6 123 27000 -findlowprioritypokeyloop 124 27000 - lda pokey1priority,x 125 27000 - cmp temp9 126 27000 - bcs findlowprioritypokeyloopcontinue 127 27000 - sta temp9 128 27000 - stx temp8 129 27000 -findlowprioritypokeyloopcontinue 130 27000 - dex 131 27000 - dex 132 27000 - bne findlowprioritypokeyloop 133 27000 - ldx temp8 ; the low priority channel we'll interrupt 134 27000 - 135 27000 -schedulepokeyX 136 27000 - ;called with X=2*pokey channel to play on... 137 27000 - ldy #1 ; get priority and sound-resolution (in frames) 138 27000 - lda (sfxinstrumentlo),y 139 27000 - sta pokey1priority,x 140 27000 - iny 141 27000 - lda (sfxinstrumentlo),y 142 27000 - sta pokey1frames,x 143 27000 - 144 27000 - lda sfxinstrumentlo 145 27000 - clc 146 27000 - adc #3 147 27000 - sta pokey1pointlo,x 148 27000 - lda sfxinstrumenthi 149 27000 - adc #0 150 27000 - sta pokey1pointhi,x 151 27000 - lda temp3 152 27000 - sta pokey1offset,x 153 27000 - lda #0 154 27000 - sta pokey1tick,x 155 27000 - rts 156 27000 - 157 27000 - ; pokey detection routine. we check for pokey in the XBOARD/XM location, 158 27000 - ; and the standard $4000 location. 159 27000 - ; if pokey the pokey is present, this routine will reset it. 160 27000 - 161 27000 -detectpokeylocation 162 27000 - ;XBoard/XM... 163 27000 - ldx #2 164 27000 -detectpokeyloop 165 27000 - lda XCTRL1s 166 27000 - ora #%00010100 167 27000 - and POKEYXMMASK,x 168 27000 - sta XCTRL1s 169 27000 - sta XCTRL1 170 27000 - 171 27000 - lda POKEYCHECKLO,x 172 27000 - sta pokeybaselo 173 27000 - lda POKEYCHECKHI,x 174 27000 - sta pokeybasehi 175 27000 - jsr checkforpokey 176 27000 - lda pokeydetected 177 27000 - beq foundpokeychip 178 27000 - dex 179 27000 - bpl detectpokeyloop 180 27000 -foundpokeychip 181 27000 - eor #$ff ; invert state for 7800basic if...then test 182 27000 - sta pokeydetected 183 27000 - rts 184 27000 - 185 27000 -POKEYXMMASK 186 27000 - ; XM POKEY on XM POKEY off XM POKEY off 187 27000 - .byte %11111111, %11101111, %11101111 188 27000 - 189 27000 -POKEYCHECKLO 190 27000 - .byte <$0450, <$0450, <$4000 191 27000 -POKEYCHECKHI 192 27000 - .byte >$0450, >$0450, >$4000 193 27000 - 194 27000 -checkforpokey 195 27000 - ldy #$0f 196 27000 - lda #$00 197 27000 - sta pokeydetected ; start off by assuming pokey will be detected 198 27000 -resetpokeyregistersloop 199 27000 - sta (pokeybase),y 200 27000 - dey 201 27000 - bpl resetpokeyregistersloop 202 27000 - 203 27000 - ldy #PAUDCTL 204 27000 - sta (pokeybase),y 205 27000 - ldy #PSKCTL 206 27000 - sta (pokeybase),y 207 27000 - 208 27000 - ; let the dust settle... 209 27000 - nop 210 27000 - nop 211 27000 - nop 212 27000 - 213 27000 - lda #4 214 27000 - sta temp9 215 27000 -pokeycheckloop1 216 27000 - ; we're in reset, so the RANDOM register should read $ff... 217 27000 - ldy #PRANDOM 218 27000 - lda (pokeybase),y 219 27000 - cmp #$ff 220 27000 - bne nopokeydetected 221 27000 - dec temp9 222 27000 - bne pokeycheckloop1 223 27000 - 224 27000 - ; take pokey out of reset... 225 27000 - ldy #PSKCTL 226 27000 - lda #3 227 27000 - sta (pokeybase),y 228 27000 - ldy #PAUDCTL 229 27000 - lda #0 230 27000 - sta (pokeybase),y 231 27000 - 232 27000 - ; let the dust settle again... 233 27000 - nop 234 27000 - nop 235 27000 - nop 236 27000 - 237 27000 - lda #4 238 27000 - sta temp9 239 27000 -pokeycheckloop2 240 27000 - ; we're out of reset, so RANDOM should read non-$ff... 241 27000 - ldy #PRANDOM 242 27000 - lda (pokeybase),y 243 27000 - cmp #$ff 244 27000 - beq skippokeycheckreturn 245 27000 - rts 246 27000 -skippokeycheckreturn 247 27000 - dec temp9 248 27000 - bne pokeycheckloop2 249 27000 -nopokeydetected 250 27000 - dec pokeydetected ; pokeydetected=#$ff 251 27000 - rts 252 27000 - 253 27000 -pokeysoundmoduleend 254 27000 - 255 27000 - echo " pokeysound assembly: ",[(pokeysoundmoduleend-pokeysoundmodulestart)]d," bytes" 256 27000 - 257 27000 endif ------- FILE c:\Users\Shane\Documents\my7800projects\Heofonfir\Lucelia_Movement_demo.78b.asm 2567 27000 endif 2568 27000 ifnconst included.tracker.asm ------- FILE tracker.asm LEVEL 2 PASS 3 0 27000 include tracker.asm 1 27000 ; Provided under the CC0 license. See the included LICENSE.txt for details. 2 27000 3 27000 4 27000 - ifconst MUSICTRACKER 5 27000 - ; ** songtempo lists how many 256ths of a frame a 16th note lasts 6 27000 - ; ** the player operates on a 16th note grid. 7 27000 - 8 27000 -servicesongover 9 27000 - rts 10 27000 -servicesong 11 27000 - lda songtempo 12 27000 - beq servicesongover ; ** if song is off/paused then return 13 27000 -servicesongcontinue 14 27000 - lda sfxschedulelock 15 27000 - sta sfxschedulemissed 16 27000 - bne servicesongover 17 27000 - lda songtempo 18 27000 - clc 19 27000 - adc songtick ; add songtempo to songtick until it rolls over 20 27000 - sta songtick ; this is how we break away from 50/60Hz timing. 21 27000 - bcc servicesongover 22 27000 - ; ** if we're here a new 16th note has passed 23 27000 - ; ** check if a new note is due on any of the 4 channels 24 27000 -servicesongredo 25 27000 - ldx #3 26 27000 -checkchannelloop 27 27000 - dec songchannel1busywait,x 28 27000 - bpl carryoncheckingchannel 29 27000 - txa 30 27000 - pha ; save X for the loop 31 27000 - jsr processsongdata 32 27000 - pla ; restore X for the loop 33 27000 - tax 34 27000 -carryoncheckingchannel 35 27000 - dex 36 27000 - bpl checkchannelloop 37 27000 - lda inactivechannelcount 38 27000 - cmp #15 39 27000 - bne skipstopsong 40 27000 - lda songloops 41 27000 - bne doasongloop 42 27000 - ;lda #0 43 27000 - sta songtempo ; all channels are done. stop the song 44 27000 - rts 45 27000 -doasongloop 46 27000 - bmi skipsongloopadjust 47 27000 - dec songloops 48 27000 -skipsongloopadjust 49 27000 - jsr setsongchannels 50 27000 - jmp servicesongredo 51 27000 -skipstopsong 52 27000 - rts 53 27000 - 54 27000 -processsongdata 55 27000 - ; channel needs processing 56 27000 - ; X=channel # 57 27000 - 58 27000 - txa 59 27000 - clc 60 27000 - adc songchannel1stackdepth,x ; stack depth value will be 0, 4, or 8 61 27000 - tay 62 27000 - 63 27000 - 64 27000 - ; ** indirect x is cumbersome with mult-byte commands. 65 27000 - ; ** setup a pointer to the song data for indirect y addressing. 66 27000 - lda songchannel1layer1lo,y 67 27000 - sta songdatalo 68 27000 - lda songchannel1layer1hi,y 69 27000 - sta songdatahi 70 27000 - ora songdatalo 71 27000 - bne channelhasdata 72 27000 - ;channel data is pointing at $0000 73 27000 - lda #$7F 74 27000 - sta songchannel1busywait,x ; skip a bunch of notes 75 27000 -setchannelcountbits 76 27000 - lda channel2bits,x 77 27000 - ora inactivechannelcount 78 27000 - sta inactivechannelcount 79 27000 - rts 80 27000 -channelhasdata 81 27000 - 82 27000 - sty songstackindex 83 27000 - ldy #0 84 27000 - lda (songdatalo),y ; ** load in the next byte of song data, so we can decode it 85 27000 - cmp #$ff 86 27000 - bne carryoncheckingdatatype ; ** $ff=pattern end marker 87 27000 - jmp handlechannelEOD 88 27000 - 89 27000 -carryoncheckingdatatype 90 27000 - and #$F0 91 27000 - cmp #$C0 92 27000 - beq handlechannelrest ; 0000XXXX=rest 93 27000 - cmp #$F0 94 27000 - beq handlemultibytecommand 95 27000 - cmp #$D0 96 27000 - beq handlesemiup 97 27000 - cmp #$E0 98 27000 - beq handlesemidown 99 27000 -handlenotedata 100 27000 - ; ** TODO: note playing is a terrible choice for fall-through 101 27000 - 102 27000 - ; ** its simple note data, prepare arguments for schedulesfx 103 27000 - 104 27000 - ; ** set the note length 105 27000 - lda (songdatalo),y 106 27000 - and #$0F 107 27000 - sta songchannel1busywait,x 108 27000 - 109 27000 - ; ** load the instrument 110 27000 - lda songchannel1instrumentlo,x 111 27000 - sta sfxinstrumentlo 112 27000 - lda songchannel1instrumenthi,x 113 27000 - sta sfxinstrumenthi 114 27000 - 115 27000 - ; ** get the note, and transpose 116 27000 - lda (songdatalo),y 117 27000 - lsr 118 27000 - lsr 119 27000 - lsr 120 27000 - lsr 121 27000 - clc 122 27000 - adc songchannel1transpose,x ; ** add it to the transpose index 123 27000 - ; ** its up the respective SFX scheduler to handle and save the note data 124 27000 - sta sfxnoteindex 125 27000 - 126 27000 - lda #0 127 27000 - sta sfxpitchoffset 128 27000 - 129 27000 - jsr schedulesfx 130 27000 - 131 27000 - jmp advancethesongpointer1byte ; advance to the next data byte and exit 132 27000 - 133 27000 -handlechannelrest 134 27000 - ; ** set the note length 135 27000 - lda (songdatalo),y 136 27000 - and #$0F 137 27000 - sta songchannel1busywait,x 138 27000 - jmp advancethesongpointer1byte ; advance to the next data byte and exit 139 27000 - 140 27000 -handlesemiup 141 27000 - lda (songdatalo),y ; ** reload the song data, so we can get at the lower nibble 142 27000 - and #$0f ; ** since we need to mask the nibble of the subtracted value, 143 27000 - clc 144 27000 -handlesemidownentry 145 27000 - adc songchannel1transpose,x ; ** add it to the transpose index 146 27000 - sta songchannel1transpose,x 147 27000 - jsr advancethesongpointer1byte 148 27000 - jmp processsongdata ; semi doesn't have note length, so process the next data byte... 149 27000 - 150 27000 -handlesemidown 151 27000 - lda (songdatalo),y ; ** reload the song data, so we can get at the lower nibble 152 27000 - and #$0f ; ** since we need to mask the nibble of the subtracted value, 153 27000 - eor #$ff ; ** its easier if we negate it, and then add it instead. 154 27000 - sec 155 27000 - jmp handlesemidownentry 156 27000 - 157 27000 -handlemultibytecommand 158 27000 - lda (songdatalo),y ; ** reload the song data, so we can get at the lower nibble 159 27000 - and #$0f ; ** since we need to mask the nibble of the subtracted value, 160 27000 - cmp #$08 ; ** load new instrument? 161 27000 - bne nothandleinstrumentchange 162 27000 -handleinstrumentchange 163 27000 - iny 164 27000 - lda (songdatalo),y 165 27000 - sta songchannel1instrumentlo,x 166 27000 - iny 167 27000 - lda (songdatalo),y 168 27000 - sta songchannel1instrumenthi,x 169 27000 - lda #3 170 27000 - jsr advancethesongpointerNbytes ; advance 3 bytes 171 27000 - jmp processsongdata 172 27000 - 173 27000 -nothandleinstrumentchange 174 27000 - cmp #$09 ; ** absolute tempo change? 175 27000 - bne nothandletempochange 176 27000 - lda #0 177 27000 - sta songtempo 178 27000 -handlerelativetempochange 179 27000 - iny 180 27000 - lda (songdatalo),y 181 27000 - clc 182 27000 - adc songtempo 183 27000 - sta songtempo 184 27000 - lda #2 185 27000 - jsr advancethesongpointerNbytes ; advance 2 bytes 186 27000 - jmp processsongdata 187 27000 - 188 27000 -nothandletempochange 189 27000 - cmp #$0A ; ** relative tempo change?: 190 27000 - beq handlerelativetempochange 191 27000 - cmp #$0B ; ** octave/semi change? 192 27000 - beq handleoctavesemichange 193 27000 -handlepatterndata 194 27000 - ; ** if we're here its a pattern/loop "subroutine" 195 27000 - ; ** move the channel's "stack" pointer and populate the new stack level 196 27000 - 197 27000 - lda #4 198 27000 - clc 199 27000 - adc songchannel1stackdepth,x 200 27000 - sta songchannel1stackdepth,x ; stack depth value will be 0, 4, or 8 201 27000 - 202 27000 - stx inttemp6 ; about to invalidate x. save it. 203 27000 - lda songstackindex 204 27000 - adc #4 205 27000 - tax 206 27000 - 207 27000 - lda (songdatalo),y 208 27000 - and #$7 209 27000 - sta songchannel1layer1loops,x 210 27000 - iny 211 27000 - lda (songdatalo),y 212 27000 - sta songchannel1layer1lo,x 213 27000 - iny 214 27000 - lda (songdatalo),y 215 27000 - sta songchannel1layer1hi,x 216 27000 - 217 27000 - ldx inttemp6 ; restore x with the channel # 218 27000 - 219 27000 - ; ** advance will operate on the old stack level, since we didn't store the updated songstackindex... 220 27000 - lda #3 221 27000 - jsr advancethesongpointerNbytes ; advance 3 bytes 222 27000 - 223 27000 - ; ** ...but the new stack level will be correctly picked up when we process the next byte. 224 27000 - jmp processsongdata 225 27000 - 226 27000 -handlechannelEOD 227 27000 - ; ** check if there are loops remaining on the pattern 228 27000 - stx inttemp6 229 27000 - ldx songstackindex 230 27000 - dec songchannel1layer1loops,x 231 27000 - bmi handlechannelEODnoloop 232 27000 - ; ** loops are remaining. set the pattern pointer to the pattern start, which is contained after the EOD 233 27000 - iny 234 27000 - lda (songdatalo),y 235 27000 - sta songchannel1layer1lo,x 236 27000 - iny 237 27000 - lda (songdatalo),y 238 27000 - sta songchannel1layer1hi,x 239 27000 - ldx inttemp6 240 27000 - jmp processsongdata ; EOD handling doesn't have note length, so process the next data byte... 241 27000 - 242 27000 -handlechannelEODnoloop 243 27000 - ; this pattern/loop is done playing. "pop" the stack 244 27000 - ldx inttemp6 245 27000 - lda songchannel1stackdepth,x 246 27000 - beq handlerootchannelEOD 247 27000 - sec 248 27000 - sbc #4 249 27000 - sta songchannel1stackdepth,x 250 27000 - jmp processsongdata ; EOD handling doesn't have note length, so process the next data byte... 251 27000 - 252 27000 -handlerootchannelEOD 253 27000 - ; this channel is done. point it to $ff data so we no longer process this channel. 254 27000 - lda #0 255 27000 - sta songchannel1layer1lo,x 256 27000 - sta songchannel1layer1hi,x 257 27000 - sta songchannel1busywait,x 258 27000 - jmp setchannelcountbits 259 27000 - rts 260 27000 - 261 27000 -nothandlepatternchange 262 27000 -handleoctavesemichange 263 27000 - iny 264 27000 - lda (songdatalo),y 265 27000 - sta songchannel1transpose,x 266 27000 - lda #2 267 27000 - jsr advancethesongpointerNbytes ; advance 2 bytes 268 27000 - jmp processsongdata 269 27000 - 270 27000 -advancethesongpointer1byte 271 27000 - txa 272 27000 - ldx songstackindex 273 27000 - inc songchannel1layer1lo,x 274 27000 - bne skiphiadvancethesongpointer1byte 275 27000 - inc songchannel1layer1hi,x 276 27000 -skiphiadvancethesongpointer1byte 277 27000 - tax 278 27000 - rts 279 27000 - 280 27000 -advancethesongpointerNbytes 281 27000 - ; entered with A=# of byte to advance 282 27000 - stx inttemp6 283 27000 - ldx songstackindex 284 27000 - clc 285 27000 - adc songchannel1layer1lo,x 286 27000 - sta songchannel1layer1lo,x 287 27000 - lda #0 288 27000 - adc songchannel1layer1hi,x 289 27000 - sta songchannel1layer1hi,x 290 27000 - ldx inttemp6 291 27000 - rts 292 27000 - 293 27000 -clearsongmemory 294 27000 - lda #0 295 27000 - ldx #(songchannel4instrumenthi-songchannel1layer1lo) 296 27000 -clearsongmemoryloop1 297 27000 - sta songchannel1layer1lo,x 298 27000 - dex 299 27000 - bpl clearsongmemoryloop1 300 27000 - 301 27000 - ldx #(songchannel4stackdepth-songchannel1layer1loops) 302 27000 -clearsongmemoryloop2 303 27000 - sta songchannel1layer1loops,x 304 27000 - dex 305 27000 - bpl clearsongmemoryloop2 306 27000 - 307 27000 - lda #$ff 308 27000 - ldx #3 309 27000 -clearsongmemoryloop3 310 27000 - sta songchannel1busywait,x 311 27000 - dex 312 27000 - bpl clearsongmemoryloop3 313 27000 - rts 314 27000 - 315 27000 -setsongchannels 316 27000 - jsr clearsongmemory 317 27000 - ldy #7 318 27000 - ldx #3 319 27000 -setsongchannelsloop 320 27000 - lda (songpointerlo),y 321 27000 - sta songchannel1layer1hi,x 322 27000 - dey 323 27000 - lda (songpointerlo),y 324 27000 - sta songchannel1layer1lo,x 325 27000 - dex 326 27000 - dey 327 27000 - bpl setsongchannelsloop 328 27000 - rts 329 27000 - 330 27000 -channel2bits 331 27000 - .byte 1,2,4,8 332 27000 - 333 27000 -tiatrackeroctavenotes 334 27000 - ifconst BUZZBASS 335 27000 -LOWC = 15 336 27000 - else 337 27000 -LOWC = 14 338 27000 - endif 339 27000 - ; ****** ELECTRONIC (0 to 11) 340 27000 - .byte LOWC,20 ; c0 16.1Hz 341 27000 - .byte LOWC,18 ; c#0 342 27000 - .byte LOWC,17 ; d0 343 27000 - .byte LOWC,16 ; d#0 344 27000 - .byte LOWC,15 ; e0 345 27000 - .byte LOWC,14 ; f0 (very off) 346 27000 - .byte LOWC,14 ; f#0 347 27000 - .byte LOWC,13 ; g0 348 27000 - .byte LOWC,12 ; g#0 349 27000 - .byte LOWC,11 ; a0 350 27000 - .byte LOWC,11 ; a#0 (very off) 351 27000 - .byte LOWC,10 ; b0 30.7Hz 352 27000 - 353 27000 - ; ****** SLIGHTLY BUZZY (12 to 23) 354 27000 - .byte 6,30 ; c1 32.7Hz 355 27000 - .byte 6,28 ; c#1 356 27000 - .byte 6,27 ; d1 357 27000 - .byte 6,25 ; d#1 358 27000 - .byte 6,24 ; e1 359 27000 - .byte 6,22 ; f1 360 27000 - .byte 6,21 ; f#1 361 27000 - .byte 6,20 ; g1 362 27000 - .byte 6,18 ; g#1 363 27000 - .byte 6,17 ; a1 364 27000 - .byte 6,16 ; a#1 365 27000 - .byte 6,15 ; b1 63.4Hz 366 27000 - 367 27000 - ; ****** BUZZY (24 to 39) 368 27000 - .byte 1,31 ; c2 65.5 369 27000 - .byte 1,30 ; c#2 67.6 370 27000 - .byte 1,27 ; d2 72.3 371 27000 - .byte 1,26 ; d#2 77.6 372 27000 - .byte 1,24 ; e2 373 27000 - .byte 1,23 ; f2 374 27000 - .byte 1,22 ; f#2 375 27000 - .byte 1,20 ; g2 376 27000 - .byte 1,19 ; g#2 377 27000 - .byte 1,18 ; a2 378 27000 - .byte 1,17 ; a#2 379 27000 - .byte 1,16 ; b2 380 27000 - .byte 1,15 ; c3 126.8Hz 381 27000 - .byte 1,14 ; c#3 382 27000 - .byte 1,13 ; d3 149.7Hz 383 27000 - .byte 1,12 ; d#3 161.2Hz (very off) 384 27000 - ; ****** PURE (40 to 71) - best key is A3 Major 385 27000 - .byte 12,31 ; e3 163.8Hz 386 27000 - .byte 12,29 ; f3 387 27000 - .byte 12,28 ; f#3 388 27000 - .byte 12,26 ; g3 389 27000 - .byte 12,24 ; g#3 390 27000 - .byte 12,23 ; a3 songs in key of A benefit from Perceptual Tuning 391 27000 - .byte 12,22 ; a#3 392 27000 - .byte 12,20 ; b3 393 27000 - .byte 12,19 ; c4 (middle C) 394 27000 - .byte 12,18 ; c#4 395 27000 - .byte 12,17 ; d4 396 27000 - .byte 12,16 ; d#4 397 27000 - .byte 12,15 ; e4 398 27000 - .byte 12,14 ; f4 399 27000 - .byte 12,13 ; f#4 400 27000 - .byte 12,12 ; g4 (very off) 401 27000 - .byte 12,12 ; g#4 402 27000 - .byte 12,11 ; a4 403 27000 - .byte 12,10 ; a#4 404 27000 - .byte 4,31 ; b4 405 27000 - .byte 4,29 ; c5 406 27000 - .byte 4,28 ; c#5 407 27000 - .byte 4,26 ; d5 408 27000 - .byte 4,24 ; d#5 409 27000 - .byte 4,23 ; e5 410 27000 - .byte 4,22 ; f5 411 27000 - .byte 4,20 ; f#5 412 27000 - .byte 4,19 ; g5 413 27000 - .byte 4,18 ; g#5 414 27000 - .byte 4,17 ; a5 415 27000 - .byte 4,16 ; a#5 416 27000 - .byte 4,15 ; b5 417 27000 - 418 27000 - ; ****** TUNED WIND (72 to 83) 419 27000 - .byte 8,30 ; c 420 27000 - .byte 8,28 ; c# 421 27000 - .byte 8,27 ; d 422 27000 - .byte 8,25 ; d# 423 27000 - .byte 8,24 ; e 424 27000 - .byte 8,22 ; f 425 27000 - .byte 8,21 ; f# 426 27000 - .byte 8,20 ; g 427 27000 - .byte 8,18 ; g# 428 27000 - .byte 8,17 ; a 429 27000 - .byte 8,16 ; a# 430 27000 - .byte 8,15 ; b 431 27000 - 432 27000 - include "tiadrumkit.asm" 433 27000 - 434 27000 endif ;MUSICTRACKER ------- FILE c:\Users\Shane\Documents\my7800projects\Heofonfir\Lucelia_Movement_demo.78b.asm 2570 27000 endif 2571 27000 ifnconst included.hiscore.asm ------- FILE hiscore.asm LEVEL 2 PASS 3 0 27000 include hiscore.asm 1 27000 ; Provided under the CC0 license. See the included LICENSE.txt for details. 2 27000 3 27000 - ifconst HSSUPPORT 4 27000 -detectatarivoxeeprom 5 27000 -hiscoremodulestart 6 27000 - ; do a test to see if atarivox eeprom can be accessed, and save results 7 27000 - jsr AVoxDetect 8 27000 - eor #$ff ; invert for easy 7800basic if...then logic 9 27000 - sta avoxdetected 10 27000 - lda #$0 11 27000 - sta SWACNT 12 27000 - lda avoxdetected 13 27000 - rts 14 27000 - 15 27000 -detecthsc 16 27000 - ; check for the HSC ROM signature... 17 27000 - lda XCTRL1s 18 27000 - ora #%00001100 19 27000 - sta XCTRL1s 20 27000 - sta XCTRL1 21 27000 - lda $3900 22 27000 - eor #$C6 23 27000 - bne detecthscfail 24 27000 - lda $3904 25 27000 - eor #$FE 26 27000 - bne detecthscfail 27 27000 - ; check if it's initialized... 28 27000 - ldy #0 29 27000 - lda #$ff 30 27000 -checkhscinit 31 27000 - and $1000,y 32 27000 - dey 33 27000 - bpl checkhscinit 34 27000 - cmp #$ff 35 27000 - bne hscisalreadyinit 36 27000 - ; if we're here, we need to do a minimal HSC init... 37 27000 - ldy #$28 38 27000 -hscinitloop1 39 27000 - lda hscheader,y 40 27000 - sta $1000,y 41 27000 - dey 42 27000 - bpl hscinitloop1 43 27000 - ldy #$89 44 27000 - lda #$7F 45 27000 -hscinitloop2 46 27000 - sta $10B3,y 47 27000 - dey 48 27000 - cpy #$ff 49 27000 - bne hscinitloop2 50 27000 -hscisalreadyinit 51 27000 - lda #$ff 52 27000 - rts 53 27000 -hscheader 54 27000 - .byte $00,$00,$68,$83,$AA,$55,$9C,$FF,$07,$12,$02,$1F,$00,$00,$00,$00 55 27000 - .byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 56 27000 - .byte $00,$00,$00,$00,$00,$00,$00,$00,$03 57 27000 -detecthscfail 58 27000 - lda XCTRL1s 59 27000 - and #%11110111 60 27000 - sta XCTRL1s 61 27000 - lda #0 62 27000 - rts 63 27000 endif ; HSSUPPORT 64 27000 65 27000 - ifconst HSSUPPORT 66 27000 - ifnconst hiscorefont 67 27000 - echo "" 68 27000 - echo "WARNING: High score support is enabled, but the hiscorefont.png was" 69 27000 - echo " NOT imported with incgraphic. The high score display code" 70 27000 - echo " has been omitted from this build." 71 27000 - echo "" 72 27000 - else 73 27000 -hscdrawscreen 74 27000 - 75 27000 - ; we use 20 lines on a 24 line display 76 27000 - ; HSSCOREY to dynamically centers based on 77 27000 - ;HSSCOREY = 0 78 27000 -HSSCOREY = ((WZONECOUNT*WZONEHEIGHT/8)-22)/2 79 27000 -HSCURSORY = ((HSSCOREY/(WZONEHEIGHT/8))*WZONEHEIGHT) 80 27000 - 81 27000 - ifconst HSSCORESIZE 82 27000 -SCORESIZE = HSSCORESIZE 83 27000 - else 84 27000 -SCORESIZE = 6 85 27000 - endif 86 27000 - 87 27000 - ;save shadow registers for later return... 88 27000 - lda sCTRL 89 27000 - sta ssCTRL 90 27000 - lda sCHARBASE 91 27000 - sta ssCHARBASE 92 27000 - lda #$60 93 27000 - sta charactermode 94 27000 - jsr drawwait 95 27000 - jsr blacken320colors 96 27000 - jsr clearscreen 97 27000 - 98 27000 - ;set the character base to the HSC font 99 27000 - lda #>hiscorefont 100 27000 - sta CHARBASE 101 27000 - sta sCHARBASE 102 27000 - lda #%01000011 ;Enable DMA, mode=320A 103 27000 - sta CTRL 104 27000 - sta sCTRL 105 27000 - 106 27000 - lda #60 107 27000 - sta hsjoydebounce 108 27000 - 109 27000 - lda #0 110 27000 - sta hscursorx 111 27000 - sta framecounter 112 27000 - ifnconst HSCOLORCHASESTART 113 27000 - lda #$8D ; default is blue. why not? 114 27000 - else 115 27000 - lda #HSCOLORCHASESTART 116 27000 - endif 117 27000 - sta hscolorchaseindex 118 27000 - 119 27000 - lda #$0F 120 27000 - sta P0C2 ; base text is white 121 27000 - 122 27000 - jsr hschasecolors 123 27000 - ; ** plot all of the initials 124 27000 - lda #HSRAMInitials 127 27000 - sta temp2 ; charmaphi 128 27000 - lda #32+29 ; palette=0-29 | 32-(width=3) 129 27000 - sta temp3 ; palette/width 130 27000 - lda #104 131 27000 - sta temp4 ; X 132 27000 - lda #((HSSCOREY+6)/(WZONEHEIGHT/8)) 133 27000 - sta temp5 ; Y 134 27000 -plothsinitialsloop 135 27000 - jsr plotcharacters 136 27000 - clc 137 27000 - lda temp3 138 27000 - adc #32 139 27000 - sta temp3 140 27000 - inc temp5 141 27000 - if WZONEHEIGHT = 8 142 27000 - inc temp5 143 27000 - endif 144 27000 - clc 145 27000 - lda #3 146 27000 - adc temp1 147 27000 - sta temp1 148 27000 - cmp #(<(HSRAMInitials+15)) 149 27000 - bcc plothsinitialsloop 150 27000 - 151 27000 - ifconst HSGAMENAMELEN 152 27000 - ;plot the game name... 153 27000 - lda #HSGAMENAMEtable 156 27000 - sta temp2 ; charmaphi 157 27000 - lda #(32-HSGAMENAMELEN) ; palette=0*29 | 32-(width=3) 158 27000 - sta temp3 ; palette/width 159 27000 - lda #(80-(HSGAMENAMELEN*2)) 160 27000 - sta temp4 ; X 161 27000 - lda #((HSSCOREY+0)/(WZONEHEIGHT/8)) 162 27000 - sta temp5 ; Y 163 27000 - jsr plotcharacters 164 27000 - endif ; HSGAMENAMELEN 165 27000 - 166 27000 - ;plot "difficulty"... 167 27000 - ldy gamedifficulty 168 27000 - ifnconst HSNOLEVELNAMES 169 27000 - lda highscoredifficultytextlo,y 170 27000 - sta temp1 171 27000 - lda highscoredifficultytexthi,y 172 27000 - sta temp2 173 27000 - sec 174 27000 - lda #32 175 27000 - sbc highscoredifficultytextlen,y 176 27000 - sta temp3 ; palette/width 177 27000 - sec 178 27000 - lda #40 179 27000 - sbc highscoredifficultytextlen,y 180 27000 - asl 181 27000 - sta temp4 ; X 182 27000 - else 183 27000 - lda #HSHIGHSCOREStext 186 27000 - sta temp2 ; charmaphi 187 27000 - lda #(32-11) ; palette=0*29 | 32-(width=3) 188 27000 - sta temp3 ; palette/width 189 27000 - lda #(80-(11*2)) 190 27000 - sta temp4 ; X 191 27000 - endif ; HSNOLEVELNAMES 192 27000 - 193 27000 - lda #((HSSCOREY+2)/(WZONEHEIGHT/8)) 194 27000 - sta temp5 ; Y 195 27000 - jsr plotcharacters 196 27000 - ldy hsdisplaymode ; 0=attact mode, 1=player eval, 2=player 1 eval, 3=player 2 player eval, 4=player 2 player evel (joy1) 197 27000 - bne carronwithscoreevaluation 198 27000 - jmp donoscoreevaluation 199 27000 -carronwithscoreevaluation 200 27000 - dey 201 27000 - lda highscorelabeltextlo,y 202 27000 - sta temp1 203 27000 - lda highscorelabeltexthi,y 204 27000 - sta temp2 205 27000 - sec 206 27000 - lda #(32-15) ; palette=0*29 | 32-(width=3) 207 27000 - sta temp3 ; palette/width 208 27000 - lda highscorelabeladjust1,y 209 27000 - sta temp4 ; X 210 27000 - lda #((HSSCOREY+18)/(WZONEHEIGHT/8)) 211 27000 - sta temp5 ; Y 212 27000 - jsr plotcharacters 213 27000 - 214 27000 - ldy hsdisplaymode ; 0=attact mode, 1=player eval, 2=player 1 eval, 3=player 2 player eval, 4=player 2 player evel (joy1) 215 27000 - dey 216 27000 - ;plot the current player score... 217 27000 - lda #(32-SCORESIZE) ; palette=0*32 218 27000 - sta temp3 ; palette/width 219 27000 - lda highscorelabeladjust2,y 220 27000 - sta temp4 ; X 221 27000 - lda #((HSSCOREY+18)/(WZONEHEIGHT/8)) 222 27000 - sta temp5 ; Y 223 27000 - 224 27000 - lda scorevarlo,y 225 27000 - sta temp7 ; score variable lo 226 27000 - lda scorevarhi,y 227 27000 - sta temp8 ; score variable hi 228 27000 - 229 27000 - lda #(hiscorefont_mode | %01100000) ; charactermode 230 27000 - sta temp9 231 27000 - 232 27000 - lda #<(hiscorefont+33) ; +33 to get to '0' character 233 27000 - sta temp1 ; charmaplo 234 27000 - lda #>(hiscorefont+33) 235 27000 - sta temp2 ; charmaphi 236 27000 - lda #SCORESIZE 237 27000 - sta temp6 238 27000 - ifnconst DOUBLEWIDE 239 27000 - jsr plotvalue 240 27000 - else 241 27000 - jsr plotvaluedw 242 27000 - endif 243 27000 - 244 27000 -USED_PLOTVALUE = 1 ; ensure that plotvalue gets compiled in 245 27000 - 246 27000 - ifconst HSGAMERANKS 247 27000 - 248 27000 - ldx #$ff ; start at 0 after the inx... 249 27000 -comparescore2rankloop 250 27000 - inx 251 27000 - ldy #0 252 27000 - lda rankvalue_0,x 253 27000 - cmp (temp7),y 254 27000 - bcc score2rankloopdone 255 27000 - bne comparescore2rankloop 256 27000 - iny 257 27000 - lda rankvalue_1,x 258 27000 - cmp (temp7),y 259 27000 - bcc score2rankloopdone 260 27000 - bne comparescore2rankloop 261 27000 - iny 262 27000 - lda (temp7),y 263 27000 - cmp rankvalue_2,x 264 27000 - bcs score2rankloopdone 265 27000 - jmp comparescore2rankloop 266 27000 -score2rankloopdone 267 27000 - stx hsnewscorerank 268 27000 - 269 27000 - lda ranklabello,x 270 27000 - sta temp1 271 27000 - lda ranklabelhi,x 272 27000 - sta temp2 273 27000 - sec 274 27000 - lda #32 ; palette=0*29 | 32-(width=3) 275 27000 - sbc ranklabellengths,x 276 27000 - sta temp3 ; palette/width 277 27000 - sec 278 27000 - lda #(40+6) 279 27000 - sbc ranklabellengths,x 280 27000 - asl 281 27000 - sta temp4 ; X 282 27000 - lda #((HSSCOREY+20)/(WZONEHEIGHT/8)) 283 27000 - sta temp5 ; Y 284 27000 - jsr plotcharacters 285 27000 - 286 27000 - ldx hsnewscorerank 287 27000 - 288 27000 - lda #highscoreranklabel 291 27000 - sta temp2 292 27000 - 293 27000 - lda #(32-5) ; palette=0*29 | 32-(width=3) 294 27000 - sta temp3 ; palette/width 295 27000 - lda #(40-6) 296 27000 - sec 297 27000 - sbc ranklabellengths,x 298 27000 - asl 299 27000 - sta temp4 ; X 300 27000 - lda #((HSSCOREY+20)/(WZONEHEIGHT/8)) 301 27000 - sta temp5 ; Y 302 27000 - jsr plotcharacters 303 27000 - endif 304 27000 - 305 27000 - 306 27000 - ; ** which line did this player beat? 307 27000 - lda #$ff 308 27000 - sta hsnewscoreline 309 27000 - ldx #$fd 310 27000 -comparescoreadd2x 311 27000 - inx 312 27000 -comparescoreadd1x 313 27000 - inx 314 27000 -comparescore2lineloop 315 27000 - inc hsnewscoreline 316 27000 - inx ; initialrun, x=0 317 27000 - cpx #15 318 27000 - beq nohighscoreforyou 319 27000 - ldy #0 320 27000 - lda HSRAMScores,x 321 27000 - cmp (temp7),y ; first score digit 322 27000 - bcc score2lineloopdonedel1x 323 27000 - bne comparescoreadd2x 324 27000 - iny 325 27000 - inx 326 27000 - lda HSRAMScores,x 327 27000 - cmp (temp7),y 328 27000 - bcc score2lineloopdonedel2x 329 27000 - bne comparescoreadd1x 330 27000 - iny 331 27000 - inx 332 27000 - lda (temp7),y 333 27000 - cmp HSRAMScores,x 334 27000 - bcs score2lineloopdonedel3x 335 27000 - jmp comparescore2lineloop 336 27000 -nohighscoreforyou 337 27000 - lda #$ff 338 27000 - sta hsnewscoreline 339 27000 - sta countdownseconds 340 27000 - jmp donoscoreevaluation 341 27000 -score2lineloopdonedel3x 342 27000 - dex 343 27000 -score2lineloopdonedel2x 344 27000 - dex 345 27000 -score2lineloopdonedel1x 346 27000 - dex 347 27000 - 348 27000 - ; 0 1 2 349 27000 - ; 3 4 5 350 27000 - ; 6 7 8 351 27000 - ; 9 0 1 352 27000 - ; 2 3 4 353 27000 - 354 27000 - stx temp9 355 27000 - cpx #11 356 27000 - beq postsortscoresuploop 357 27000 - ldx #11 358 27000 -sortscoresuploop 359 27000 - lda HSRAMScores,x 360 27000 - sta HSRAMScores+3,x 361 27000 - lda HSRAMInitials,x 362 27000 - sta HSRAMInitials+3,x 363 27000 - dex 364 27000 - cpx temp9 365 27000 - bne sortscoresuploop 366 27000 -postsortscoresuploop 367 27000 - 368 27000 - ;stick the score and cleared initials in the slot... 369 27000 - inx 370 27000 - ldy #0 371 27000 - sty hsinitialhold 372 27000 - lda (temp7),y 373 27000 - sta HSRAMScores,x 374 27000 - iny 375 27000 - lda (temp7),y 376 27000 - sta HSRAMScores+1,x 377 27000 - iny 378 27000 - lda (temp7),y 379 27000 - sta HSRAMScores+2,x 380 27000 - lda #0 381 27000 - sta HSRAMInitials,x 382 27000 - lda #29 383 27000 - sta HSRAMInitials+1,x 384 27000 - sta HSRAMInitials+2,x 385 27000 - 386 27000 - stx hsinitialpos 387 27000 - 388 27000 - ifconst vox_highscore 389 27000 - lda <#vox_highscore 390 27000 - sta speech_addr 391 27000 - lda >#vox_highscore 392 27000 - sta speech_addr+1 393 27000 - endif 394 27000 - ifconst sfx_highscore 395 27000 - lda <#sfx_highscore 396 27000 - sta temp1 397 27000 - lda >#sfx_highscore 398 27000 - sta temp2 399 27000 - lda #0 400 27000 - sta temp3 401 27000 - jsr schedulesfx 402 27000 - endif 403 27000 - ifconst songdatastart_song_highscore 404 27000 - lda #songchanneltable_song_highscore 407 27000 - sta songpointerhi 408 27000 - lda #73 409 27000 - sta songtempo 410 27000 - jsr setsongchannels 411 27000 - endif 412 27000 - 413 27000 - 414 27000 -donoscoreevaluation 415 27000 - 416 27000 - lda #(32+(32-SCORESIZE)) ; palette=0*32 | 32-(width=6) 417 27000 - sta temp3 ; palette/width 418 27000 - lda #(72+(4*(6-SCORESIZE))) 419 27000 - sta temp4 ; X 420 27000 - lda #((HSSCOREY+6)/(WZONEHEIGHT/8)) 421 27000 - sta temp5 ; Y 422 27000 - lda #HSRAMScores 425 27000 - sta temp8 ; score variable hi 426 27000 - lda #(hiscorefont_mode | %01100000) ; charactermode 427 27000 - sta temp9 428 27000 -plothsscoresloop 429 27000 - lda #<(hiscorefont+33) ; +33 to get to '0' character 430 27000 - sta temp1 ; charmaplo 431 27000 - lda #>(hiscorefont+33) 432 27000 - sta temp2 ; charmaphi 433 27000 - lda #6 434 27000 - sta temp6 435 27000 - ifnconst DOUBLEWIDE 436 27000 - jsr plotvalue 437 27000 - else 438 27000 - jsr plotvaluedw 439 27000 - endif 440 27000 - clc 441 27000 - lda temp3 442 27000 - adc #32 443 27000 - sta temp3 444 27000 - inc temp5 445 27000 - if WZONEHEIGHT = 8 446 27000 - inc temp5 447 27000 - endif 448 27000 - clc 449 27000 - lda #3 450 27000 - adc temp7 451 27000 - sta temp7 452 27000 - cmp #(<(HSRAMScores+15)) 453 27000 - bcc plothsscoresloop 454 27000 -plothsindex 455 27000 - lda #32+31 ; palette=0*32 | 32-(width=1) 456 27000 - sta temp3 ; palette/width 457 27000 - lda #44 458 27000 - sta temp4 ; X 459 27000 - lda #((HSSCOREY+6)/(WZONEHEIGHT/8)) 460 27000 - sta temp5 ; Y 461 27000 - lda #hsgameslotnumbers 464 27000 - sta temp8 ; score variable hi 465 27000 - lda #(hiscorefont_mode | %01100000) ; charactermode 466 27000 - sta temp9 467 27000 -plothsindexloop 468 27000 - lda #<(hiscorefont+33) 469 27000 - sta temp1 ; charmaplo 470 27000 - lda #>(hiscorefont+33) 471 27000 - sta temp2 ; charmaphi 472 27000 - lda #1 473 27000 - sta temp6 ; number of characters 474 27000 - ifnconst DOUBLEWIDE 475 27000 - jsr plotvalue 476 27000 - else 477 27000 - jsr plotvaluedw 478 27000 - endif 479 27000 - clc 480 27000 - lda temp3 481 27000 - adc #32 482 27000 - sta temp3 483 27000 - inc temp5 484 27000 - if WZONEHEIGHT = 8 485 27000 - inc temp5 486 27000 - endif 487 27000 - inc temp7 488 27000 - lda temp7 489 27000 - cmp #(<(hsgameslotnumbers+5)) 490 27000 - bcc plothsindexloop 491 27000 - 492 27000 - jsr savescreen 493 27000 - ifnconst HSSECONDS 494 27000 - lda #6 495 27000 - else 496 27000 - lda #HSSECONDS 497 27000 - endif 498 27000 - 499 27000 - sta countdownseconds 500 27000 - 501 27000 -keepdisplayinghs 502 27000 - jsr restorescreen 503 27000 - 504 27000 - jsr setuphsinpt1 505 27000 - 506 27000 - lda hsnewscoreline 507 27000 - bpl carryonkeepdisplayinghs 508 27000 - jmp skipenterscorecontrol 509 27000 -carryonkeepdisplayinghs 510 27000 - 511 27000 - 512 27000 - ifnconst HSSECONDS 513 27000 - lda #6 514 27000 - else 515 27000 - lda #HSSECONDS 516 27000 - endif 517 27000 - 518 27000 - sta countdownseconds 519 27000 - 520 27000 - ;plot the "cursor" initial sprite... 521 27000 - lda hsinitialhold 522 27000 - 523 27000 - sta temp1 524 27000 - lda #>(hiscorefont+32) 525 27000 - sta temp2 526 27000 - lda #31 ; palette=0*32 | 32-(width=1) 527 27000 - sta temp3 ; palette/width 528 27000 - lda hscursorx 529 27000 - asl 530 27000 - asl 531 27000 - clc 532 27000 - adc #104 533 27000 - sta temp4 ; X 534 27000 - lda hsnewscoreline 535 27000 - asl 536 27000 - asl 537 27000 - asl 538 27000 - asl 539 27000 - adc #((3*16)+HSCURSORY) 540 27000 - sta temp5 ; Y 541 27000 - lda #%01000000 542 27000 - sta temp6 543 27000 - jsr plotsprite 544 27000 - 545 27000 - ldx hscursorx 546 27000 - ldy hsdisplaymode 547 27000 - lda SWCHA 548 27000 - cpy #3 549 27000 - bne hsskipadjustjoystick1 550 27000 - asl 551 27000 - asl 552 27000 - asl 553 27000 - asl 554 27000 -hsskipadjustjoystick1 555 27000 - sta hsswcha 556 27000 - lda SWCHB 557 27000 - and #%00000010 558 27000 - bne hsskipselectswitch 559 27000 - lda #%00010000 560 27000 - sta hsswcha 561 27000 - bne hsdodebouncecheck 562 27000 -hsskipselectswitch 563 27000 - lda hsswcha 564 27000 - and #%00110000 565 27000 - cmp #%00110000 566 27000 - beq hsjoystickskipped 567 27000 -hsdodebouncecheck 568 27000 - lda hsjoydebounce 569 27000 - beq hsdontdebounce 570 27000 - jmp hspostjoystick 571 27000 -hsdontdebounce 572 27000 - ldx #1 ; small tick sound 573 27000 - jsr playhssfx 574 27000 - lda hsswcha 575 27000 - and #%00110000 576 27000 - ldx hscursorx 577 27000 - cmp #%00100000 ; check down 578 27000 - bne hsjoycheckup 579 27000 - ldy hsinitialhold 580 27000 - cpx #0 581 27000 - bne skipavoid31_1 582 27000 - cpy #0 ; if we're about to change to the <- char (#31) then double-decrement to skip over it 583 27000 - bne skipavoid31_1 584 27000 - dey 585 27000 -skipavoid31_1 586 27000 - dey 587 27000 - jmp hssetdebounce 588 27000 -hsjoycheckup 589 27000 - cmp #%00010000 ; check up 590 27000 - bne hsjoystickskipped 591 27000 - ldy hsinitialhold 592 27000 - cpx #0 593 27000 - bne skipavoid31_2 594 27000 - cpy #30 ; if we're about to change to the <- char (#31) then double-increment to skip over it 595 27000 - bne skipavoid31_2 596 27000 - iny 597 27000 -skipavoid31_2 598 27000 - iny 599 27000 -hssetdebounce 600 27000 - tya 601 27000 - and #31 602 27000 - sta hsinitialhold 603 27000 - lda #15 604 27000 - sta hsjoydebounce 605 27000 - bne hspostjoystick 606 27000 -hsjoystickskipped 607 27000 - ; check the fire button only when the stick isn't engaged 608 27000 - lda hsinpt1 609 27000 - bpl hsbuttonskipped 610 27000 - lda hsjoydebounce 611 27000 - beq hsfiredontdebounce 612 27000 - bne hspostjoystick 613 27000 -hsfiredontdebounce 614 27000 - lda hsinitialhold 615 27000 - cmp #31 616 27000 - beq hsmovecursorback 617 27000 - inc hscursorx 618 27000 - inc hsinitialpos 619 27000 - lda hscursorx 620 27000 - cmp #3 621 27000 - bne skiphsentryisdone 622 27000 - lda #0 623 27000 - sta framecounter 624 27000 - lda #$ff 625 27000 - sta hsnewscoreline 626 27000 - dec hsinitialpos 627 27000 - bne skiphsentryisdone 628 27000 -hsmovecursorback 629 27000 - lda hscursorx 630 27000 - beq skiphsmovecursorback 631 27000 - lda #29 632 27000 - ldx hsinitialpos 633 27000 - sta HSRAMInitials,x 634 27000 - dec hsinitialpos 635 27000 - dec hscursorx 636 27000 - dex 637 27000 - lda HSRAMInitials,x 638 27000 - sta hsinitialhold 639 27000 -skiphsmovecursorback 640 27000 -skiphsentryisdone 641 27000 - ldx #0 642 27000 - jsr playhssfx 643 27000 - lda #20 644 27000 - sta hsjoydebounce 645 27000 - bne hspostjoystick 646 27000 - 647 27000 -hsbuttonskipped 648 27000 - lda #0 649 27000 - sta hsjoydebounce 650 27000 -hspostjoystick 651 27000 - 652 27000 - ldx hsinitialpos 653 27000 - lda hsinitialhold 654 27000 - sta HSRAMInitials,x 655 27000 - 656 27000 - jmp skiphschasecolors 657 27000 - 658 27000 -skipenterscorecontrol 659 27000 - jsr hschasecolors 660 27000 - jsr setuphsinpt1 661 27000 - lda hsjoydebounce 662 27000 - bne skiphschasecolors 663 27000 - lda hsinpt1 664 27000 - bmi returnfromhs 665 27000 -skiphschasecolors 666 27000 - 667 27000 - jsr drawscreen 668 27000 - 669 27000 - lda countdownseconds 670 27000 - beq returnfromhs 671 27000 - jmp keepdisplayinghs 672 27000 -returnfromhs 673 27000 - 674 27000 - ifconst songdatastart_song_highscore 675 27000 - lda hsdisplaymode 676 27000 - beq skipclearHSCsong 677 27000 - lda #0 678 27000 - sta songtempo 679 27000 -skipclearHSCsong 680 27000 - endif 681 27000 - jsr drawwait 682 27000 - jsr clearscreen 683 27000 - lda #0 684 27000 - ldy #7 685 27000 - jsr blacken320colors 686 27000 - lda ssCTRL 687 27000 - sta sCTRL 688 27000 - lda ssCHARBASE 689 27000 - sta sCHARBASE 690 27000 - rts 691 27000 - 692 27000 -setuphsinpt1 693 27000 - lda #$ff 694 27000 - sta hsinpt1 695 27000 - lda hsjoydebounce 696 27000 - beq skipdebounceadjust 697 27000 - dec hsjoydebounce 698 27000 - bne skipstorefirebuttonstatus 699 27000 -skipdebounceadjust 700 27000 - lda SWCHB 701 27000 - and #%00000001 702 27000 - bne hscheckresetover 703 27000 - lda #$ff 704 27000 - sta hsinpt1 705 27000 - rts 706 27000 -hscheckresetover 707 27000 - ldx hsdisplaymode 708 27000 - cpx #3 709 27000 - bne hsskipadjustjoyfire1 710 27000 - lda sINPT3 711 27000 - jmp hsskipadjustjoyfire1done 712 27000 -hsskipadjustjoyfire1 713 27000 - lda sINPT1 714 27000 -hsskipadjustjoyfire1done 715 27000 - sta hsinpt1 716 27000 -skipstorefirebuttonstatus 717 27000 - rts 718 27000 - 719 27000 -blacken320colors 720 27000 - ldy #7 721 27000 -blacken320colorsloop 722 27000 - sta P0C2,y 723 27000 - dey 724 27000 - bpl blacken320colorsloop 725 27000 - rts 726 27000 - 727 27000 -hschasecolors 728 27000 - lda framecounter 729 27000 - and #3 730 27000 - bne hschasecolorsreturn 731 27000 - inc hscolorchaseindex 732 27000 - lda hscolorchaseindex 733 27000 - 734 27000 - sta P5C2 735 27000 - sbc #$02 736 27000 - sta P4C2 737 27000 - sbc #$02 738 27000 - sta P3C2 739 27000 - sbc #$02 740 27000 - sta P2C2 741 27000 - sbc #$02 742 27000 - sta P1C2 743 27000 -hschasecolorsreturn 744 27000 - rts 745 27000 - 746 27000 -playhssfx 747 27000 - lda hssfx_lo,x 748 27000 - sta temp1 749 27000 - lda hssfx_hi,x 750 27000 - sta temp2 751 27000 - lda #0 752 27000 - sta temp3 753 27000 - jmp schedulesfx 754 27000 - 755 27000 -hssfx_lo 756 27000 - .byte sfx_hsletterpositionchange, >sfx_hslettertick 759 27000 - 760 27000 -sfx_hsletterpositionchange 761 27000 - .byte $10,$18,$00 762 27000 - .byte $02,$06,$08 763 27000 - .byte $02,$06,$04 764 27000 - .byte $00,$00,$00 765 27000 -sfx_hslettertick 766 27000 - .byte $10,$18,$00 767 27000 - .byte $00,$00,$0a 768 27000 - .byte $00,$00,$00 769 27000 - 770 27000 -highscorelabeladjust1 771 27000 - .byte (80-(14*2)-(SCORESIZE*2)),(80-(16*2)-(SCORESIZE*2)),(80-(16*2)-(SCORESIZE*2)),(80-(16*2)-(SCORESIZE*2)) 772 27000 -highscorelabeladjust2 773 27000 - .byte (80+(14*2)-(SCORESIZE*2)),(80+(16*2)-(SCORESIZE*2)),(80+(16*2)-(SCORESIZE*2)),(80+(16*2)-(SCORESIZE*2)) 774 27000 - 775 27000 -scorevarlo 776 27000 - .byte <(score0+((6-SCORESIZE)/2)),<(score0+((6-SCORESIZE)/2)),<(score1+((6-SCORESIZE)/2)),<(score1+((6-SCORESIZE)/2)) 777 27000 -scorevarhi 778 27000 - .byte >(score0+((6-SCORESIZE)/2)),>(score0+((6-SCORESIZE)/2)),>(score1+((6-SCORESIZE)/2)),>(score1+((6-SCORESIZE)/2)) 779 27000 - 780 27000 - ifnconst HSNOLEVELNAMES 781 27000 -highscoredifficultytextlo 782 27000 - .byte easylevelname, >mediumlevelname, >hardlevelname, >expertlevelname 785 27000 - ifnconst HSCUSTOMLEVELNAMES 786 27000 -highscoredifficultytextlen 787 27000 - .byte 22, 30, 26, 24 788 27000 - 789 27000 -easylevelname 790 27000 - .byte $04,$00,$12,$18,$1d,$0b,$04,$15,$04,$0b,$1d,$07,$08,$06,$07,$1d,$12,$02,$0e,$11,$04,$12 791 27000 -mediumlevelname 792 27000 - .byte $08,$0d,$13,$04,$11,$0c,$04,$03,$08,$00,$13,$04,$1d,$0b,$04,$15,$04,$0b,$1d,$07,$08,$06,$07,$1d,$12,$02,$0e,$11,$04,$12 793 27000 -hardlevelname 794 27000 - .byte $00,$03,$15,$00,$0d,$02,$04,$03,$1d,$0b,$04,$15,$04,$0b,$1d,$07,$08,$06,$07,$1d,$12,$02,$0e,$11,$04,$12 795 27000 -expertlevelname 796 27000 - .byte $04,$17,$0f,$04,$11,$13,$1d,$0b,$04,$15,$04,$0b,$1d,$07,$08,$06,$07,$1d,$12,$02,$0e,$11,$04,$12 797 27000 - else 798 27000 - include "7800hsgamediffnames.asm" 799 27000 - endif ; HSCUSTOMLEVELNAMES 800 27000 - else 801 27000 -HSHIGHSCOREStext 802 27000 - .byte $07,$08,$06,$07,$1d,$12,$02,$0e,$11,$04,$12 803 27000 - endif ; HSNOLEVELNAMES 804 27000 - 805 27000 -highscorelabeltextlo 806 27000 - .byte player0label, >player1label, >player2label, >player2label 809 27000 - 810 27000 -player0label 811 27000 - .byte $0f,$0b,$00,$18,$04,$11,$1d,$12,$02,$0e,$11,$04,$1a,$1d,$1d 812 27000 - 813 27000 -player1label 814 27000 - .byte $0f,$0b,$00,$18,$04,$11,$1d,$22,$1d,$12,$02,$0e,$11,$04,$1a 815 27000 - 816 27000 -player2label 817 27000 - .byte $0f,$0b,$00,$18,$04,$11,$1d,$23,$1d,$12,$02,$0e,$11,$04,$1a 818 27000 - 819 27000 - 820 27000 - ifconst HSGAMENAMELEN 821 27000 -HSGAMENAMEtable 822 27000 - include "7800hsgamename.asm" 823 27000 - endif 824 27000 - ifconst HSGAMERANKS 825 27000 - include "7800hsgameranks.asm" 826 27000 -highscoreranklabel 827 27000 - .byte $11,$00,$0d,$0a,$1a 828 27000 - endif 829 27000 - 830 27000 - ;ensure our table doesn't wrap a page... 831 27000 - if ((<*)>251) 832 27000 - align 256 833 27000 - endif 834 27000 -hsgameslotnumbers 835 27000 - .byte 33,34,35,36,37 836 27000 - endif 837 27000 - 838 27000 -loaddifficultytable 839 27000 - lda gamedifficulty 840 27000 - and #$03 ; ensure the user hasn't selected an invalid difficulty 841 27000 - sta gamedifficulty 842 27000 - cmp hsdifficulty ; check game difficulty is the same as RAM table 843 27000 - bne loaddifficultytablecontinue1 844 27000 - rts ; this high score difficulty table is already loaded 845 27000 -loaddifficultytablecontinue1 846 27000 - lda gamedifficulty 847 27000 - sta hsdifficulty 848 27000 - ;we need to check the device for the table 849 27000 - lda hsdevice 850 27000 - bne loaddifficultytablecontinue2 851 27000 - ; there's no save device. clear out this table. 852 27000 - jmp cleardifficultytablemem 853 27000 -loaddifficultytablecontinue2 854 27000 - lda hsdevice 855 27000 - and #1 856 27000 - beq memdeviceisntHSC 857 27000 - jmp loaddifficultytableHSC 858 27000 -memdeviceisntHSC 859 27000 - jmp loaddifficultytableAVOX 860 27000 - 861 27000 -savedifficultytable 862 27000 - ;*** we need to check wich device we should use... 863 27000 - lda hsdevice 864 27000 - bne savedifficultytablerealdevice 865 27000 - rts ; its a ram device 866 27000 -savedifficultytablerealdevice 867 27000 - and #1 868 27000 - beq savememdeviceisntHSC 869 27000 - jmp savedifficultytableHSC 870 27000 -savememdeviceisntHSC 871 27000 - jmp savedifficultytableAVOX 872 27000 - 873 27000 -savedifficultytableAVOX 874 27000 - ; the load call already setup the memory structure and atarivox memory location 875 27000 - jsr savealoadedHSCtablecontinue 876 27000 -savedifficultytableAVOXskipconvert 877 27000 - lda #HSIDHI 878 27000 - sta eeprombuffer 879 27000 - lda #HSIDLO 880 27000 - sta eeprombuffer+1 881 27000 - lda hsdifficulty 882 27000 - sta eeprombuffer+2 883 27000 - lda #32 884 27000 - jsr AVoxWriteBytes 885 27000 - rts 886 27000 - 887 27000 -savedifficultytableHSC 888 27000 - ;we always load a table before reaching here, so the 889 27000 - ;memory structures from the load should be intact... 890 27000 - ldy hsgameslot 891 27000 - bpl savealoadedHSCtable 892 27000 - rts 893 27000 -savealoadedHSCtable 894 27000 - lda HSCGameDifficulty,y 895 27000 - cmp #$7F 896 27000 - bne savealoadedHSCtablecontinue 897 27000 - jsr initializeHSCtableentry 898 27000 -savealoadedHSCtablecontinue 899 27000 - ;convert our RAM table to HSC format and write it out... 900 27000 - ldy #0 901 27000 - ldx #0 902 27000 -savedifficultytableScores 903 27000 - 904 27000 - lda HSRAMInitials,x 905 27000 - sta temp3 906 27000 - lda HSRAMInitials+1,x 907 27000 - sta temp4 908 27000 - lda HSRAMInitials+2,x 909 27000 - sta temp5 910 27000 - jsr encodeHSCInitials ; takes 3 byte initials from temp3,4,5 and stores 2 byte initials in temp1,2 911 27000 - 912 27000 - lda temp1 913 27000 - sta (HSGameTableLo),y 914 27000 - iny 915 27000 - lda temp2 916 27000 - sta (HSGameTableLo),y 917 27000 - iny 918 27000 - 919 27000 - lda HSRAMScores,x 920 27000 - sta (HSGameTableLo),y 921 27000 - iny 922 27000 - lda HSRAMScores+1,x 923 27000 - sta (HSGameTableLo),y 924 27000 - iny 925 27000 - lda HSRAMScores+2,x 926 27000 - sta (HSGameTableLo),y 927 27000 - iny 928 27000 - inx 929 27000 - inx 930 27000 - inx ; +3 931 27000 - cpx #15 932 27000 - bne savedifficultytableScores 933 27000 - rts 934 27000 - 935 27000 -loaddifficultytableHSC 936 27000 - ; routine responsible for loading the difficulty table from HSC 937 27000 - jsr findindexHSC 938 27000 - ldy hsgameslot 939 27000 - lda HSCGameDifficulty,y 940 27000 - cmp #$7F 941 27000 - bne loaddifficultytableHSCcontinue 942 27000 - ;there was an error. use a new RAM table instead... 943 27000 - jsr initializeHSCtableentry 944 27000 - jmp cleardifficultytablemem 945 27000 -loaddifficultytableHSCcontinue 946 27000 - ; parse the data into the HS memory... 947 27000 - ldy #0 948 27000 - ldx #0 949 27000 -loaddifficultytableScores 950 27000 - lda (HSGameTableLo),y 951 27000 - sta temp1 952 27000 - iny 953 27000 - lda (HSGameTableLo),y 954 27000 - sta temp2 955 27000 - jsr decodeHSCInitials ; takes 2 byte initials from temp1,2 and stores 3 byte initials in temp3,4,5 956 27000 - iny 957 27000 - lda (HSGameTableLo),y 958 27000 - sta HSRAMScores,x 959 27000 - lda temp3 960 27000 - sta HSRAMInitials,x 961 27000 - inx 962 27000 - iny 963 27000 - lda (HSGameTableLo),y 964 27000 - sta HSRAMScores,x 965 27000 - lda temp4 966 27000 - sta HSRAMInitials,x 967 27000 - inx 968 27000 - iny 969 27000 - lda (HSGameTableLo),y 970 27000 - sta HSRAMScores,x 971 27000 - lda temp5 972 27000 - sta HSRAMInitials,x 973 27000 - inx 974 27000 - iny 975 27000 - cpx #15 976 27000 - bne loaddifficultytableScores 977 27000 - rts 978 27000 - 979 27000 -decodeHSCInitials 980 27000 - ; takes 2 byte initials from temp1,2 and stores 3 byte initials in temp3,4,5 981 27000 - ; 2 bytes are packed in the form: 22211111 22_33333 982 27000 - lda #0 983 27000 - sta temp4 984 27000 - lda temp1 985 27000 - and #%00011111 986 27000 - sta temp3 987 27000 - 988 27000 - lda temp2 989 27000 - and #%00011111 990 27000 - sta temp5 991 27000 - 992 27000 - lda temp1 993 27000 - asl 994 27000 - rol temp4 995 27000 - asl 996 27000 - rol temp4 997 27000 - asl 998 27000 - rol temp4 999 27000 - lda temp2 1000 27000 - asl 1001 27000 - rol temp4 1002 27000 - asl 1003 27000 - rol temp4 1004 27000 - rts 1005 27000 -encodeHSCInitials 1006 27000 - ; takes 3 byte initials from temp3,4,5 and stores 2 byte initials in temp1,2 1007 27000 - ; 2 bytes are packed in the form: 22211111 22_33333 1008 27000 - ; start with packing temp1... 1009 27000 - lda temp4 1010 27000 - and #%00011100 1011 27000 - sta temp1 1012 27000 - asl temp1 1013 27000 - asl temp1 1014 27000 - asl temp1 1015 27000 - lda temp3 1016 27000 - and #%00011111 1017 27000 - ora temp1 1018 27000 - sta temp1 1019 27000 - ; ...temp1 is now packed, on to temp2... 1020 27000 - lda temp5 1021 27000 - asl 1022 27000 - asl 1023 27000 - ror temp4 1024 27000 - ror 1025 27000 - ror temp4 1026 27000 - ror 1027 27000 - sta temp2 1028 27000 - rts 1029 27000 - 1030 27000 -findindexHSCerror 1031 27000 - ;the HSC is stuffed. return the bad slot flag 1032 27000 - ldy #$ff 1033 27000 - sty hsgameslot 1034 27000 - rts 1035 27000 - 1036 27000 -findindexHSC 1037 27000 -HSCGameID1 = $1029 1038 27000 -HSCGameID2 = $106E 1039 27000 -HSCGameDifficulty = $10B3 1040 27000 -HSCGameIndex = $10F8 1041 27000 - ; routine responsible for finding the game index from HSC 1042 27000 - ; call with x=0 to create a new table if none exist, call with x=$ff to avoid creating new tables 1043 27000 - ; the HS loading routine will use x=$ff, the HS saving routine will use x=0 1044 27000 - ldy #69 ; start +1 to account for the dey 1045 27000 -findindexHSCloop 1046 27000 - dey 1047 27000 - bmi findindexHSCerror 1048 27000 - lda HSCGameDifficulty,y 1049 27000 - cmp #$7F 1050 27000 - beq findourindexHSC 1051 27000 - cmp gamedifficulty 1052 27000 - bne findindexHSCloop 1053 27000 - lda HSCGameID1,y 1054 27000 - cmp #HSIDHI 1055 27000 - bne findindexHSCloop 1056 27000 - lda HSCGameID2,y 1057 27000 - cmp #HSIDLO 1058 27000 - bne findindexHSCloop 1059 27000 -findourindexHSC 1060 27000 - ; if we're here we found our index in the table 1061 27000 - ; or we found the first empty one 1062 27000 - sty hsgameslot 1063 27000 - jsr setupHSCGamepointer ; setup the pointer to the HS Table for this game... 1064 27000 - rts 1065 27000 - 1066 27000 - 1067 27000 -initializeHSCtableentry 1068 27000 - ldy hsgameslot 1069 27000 - ; we need to make a new entry... 1070 27000 - lda #HSIDHI 1071 27000 - sta HSCGameID1,y 1072 27000 - lda #HSIDLO 1073 27000 - sta HSCGameID2,y 1074 27000 - lda gamedifficulty 1075 27000 - sta HSCGameDifficulty,y 1076 27000 - ldx #0 1077 27000 -fixHSDGameDifficultylistLoop 1078 27000 - inx 1079 27000 - txa 1080 27000 - sta HSCGameIndex,y 1081 27000 - iny 1082 27000 - cpy #69 1083 27000 - bne fixHSDGameDifficultylistLoop 1084 27000 - rts 1085 27000 - 1086 27000 -setupHSCGamepointer 1087 27000 - ; this routines sets (HSGameTableLo) pointing to the game's HS table 1088 27000 - lda #$17 1089 27000 - sta HSGameTableHi 1090 27000 - lda #$FA 1091 27000 - sta HSGameTableLo 1092 27000 -setupHSCGamepointerLoop 1093 27000 - lda HSGameTableLo 1094 27000 - sec 1095 27000 - sbc #25 1096 27000 - sta HSGameTableLo 1097 27000 - lda HSGameTableHi 1098 27000 - sbc #0 1099 27000 - sta HSGameTableHi 1100 27000 - iny 1101 27000 - cpy #69 1102 27000 - bne setupHSCGamepointerLoop 1103 27000 - rts 1104 27000 - 1105 27000 -loaddifficultytableAVOX 1106 27000 - ; routine responsible for loading the difficulty table from Avox 1107 27000 - ; we reuse HSC routines to format data to/from our Avox RAM buffer... 1108 27000 - lda #>(eeprombuffer+3) 1109 27000 - sta HSGameTableHi 1110 27000 - lda #<(eeprombuffer+3) 1111 27000 - sta HSGameTableLo 1112 27000 - 1113 27000 - ; the start location in EEPROM, subtract 32... 1114 27000 - lda #$5F 1115 27000 - sta HSVoxHi 1116 27000 - lda #$E0 1117 27000 - sta HSVoxLo 1118 27000 - lda #0 1119 27000 - sta temp1 1120 27000 -loaddifficultytableAVOXloop 1121 27000 - inc temp1 1122 27000 - beq loaddifficultytableAVOXfull 1123 27000 - clc 1124 27000 - lda HSVoxLo 1125 27000 - adc #32 1126 27000 - sta HSVoxLo 1127 27000 - lda HSVoxHi 1128 27000 - adc #0 1129 27000 - sta HSVoxHi 1130 27000 - lda #3 1131 27000 - jsr AVoxReadBytes ; read in 3 bytes, ID1,ID2,Difficulty 1132 27000 - lda eeprombuffer 1133 27000 - cmp #$FF 1134 27000 - beq loaddifficultytableAVOXempty 1135 27000 - cmp #HSIDHI 1136 27000 - bne loaddifficultytableAVOXloop 1137 27000 - lda eeprombuffer+1 1138 27000 - cmp #HSIDLO 1139 27000 - bne loaddifficultytableAVOXloop 1140 27000 - lda eeprombuffer+2 1141 27000 - cmp gamedifficulty 1142 27000 - bne loaddifficultytableAVOXloop 1143 27000 -loaddifficultytableAVOXdone 1144 27000 - lda #32 1145 27000 - jsr AVoxReadBytes 1146 27000 - jsr loaddifficultytableHSCcontinue 1147 27000 - rts 1148 27000 -loaddifficultytableAVOXfull 1149 27000 - lda #0 1150 27000 - sta hsdevice ; looks like all 255 entries are taken... disable it. 1151 27000 -loaddifficultytableAVOXempty 1152 27000 - jmp cleardifficultytablemem 1153 27000 - rts 1154 27000 - 1155 27000 -cleardifficultytablemem 1156 27000 - ldy #29 1157 27000 - lda #0 1158 27000 -cleardifficultytablememloop 1159 27000 - sta HSRAMTable,y 1160 27000 - dey 1161 27000 - bpl cleardifficultytablememloop 1162 27000 - rts 1163 27000 -hiscoremoduleend 1164 27000 - 1165 27000 - echo " hiscore assembly: ",[(hiscoremoduleend-hiscoremodulestart)]d," bytes" 1166 27000 - 1167 27000 - ifconst DOUBLEWIDE 1168 27000 -plotvaluedw 1169 27000 -plotdigitcount = temp6 1170 27000 - lda #0 1171 27000 - tay 1172 27000 - ldx valbufend 1173 27000 - 1174 27000 - lda plotdigitcount 1175 27000 - and #1 1176 27000 - beq pvnibble2chardw 1177 27000 - lda #0 1178 27000 - sta VALBUFFER,x ; just in case we skip this digit 1179 27000 - beq pvnibble2char_skipnibbledw 1180 27000 - 1181 27000 -pvnibble2chardw 1182 27000 - ; high nibble... 1183 27000 - lda (temp7),y 1184 27000 - and #$f0 1185 27000 - lsr 1186 27000 - lsr 1187 27000 - lsr 1188 27000 - lsr 1189 27000 - 1190 27000 - clc 1191 27000 - adc temp1 ; add the offset to character graphics to our value 1192 27000 - sta VALBUFFER,x 1193 27000 - inx 1194 27000 - dec plotdigitcount 1195 27000 -pvnibble2char_skipnibbledw 1196 27000 - ; low nibble... 1197 27000 - lda (temp7),y 1198 27000 - and #$0f 1199 27000 - clc 1200 27000 - adc temp1 ; add the offset to character graphics to our value 1201 27000 - sta VALBUFFER,x 1202 27000 - inx 1203 27000 - iny 1204 27000 - 1205 27000 - dec plotdigitcount 1206 27000 - bne pvnibble2chardw 1207 27000 - ;point to the start of our valuebuffer 1208 27000 - clc 1209 27000 - lda #VALBUFFER 1213 27000 - adc #0 1214 27000 - sta temp2 1215 27000 - 1216 27000 - ;advance valbufend to the end of our value buffer 1217 27000 - stx valbufend 1218 27000 - 1219 27000 - ifnconst plotvalueonscreen 1220 27000 - jmp plotcharacters 1221 27000 - else 1222 27000 - jmp plotcharacterslive 1223 27000 - endif 1224 27000 - endif ; DOUBLEWIDE 1225 27000 - 1226 27000 endif ; HSSUPPORT 1227 27000 ------- FILE c:\Users\Shane\Documents\my7800projects\Heofonfir\Lucelia_Movement_demo.78b.asm 2573 27000 endif 2574 27000 ; Provided under the CC0 license. See the included LICENSE.txt for details. 2575 27000 2576 27000 ;standard routimes needed for pretty much all games 2577 27000 2578 27000 ; some definitions used with "set debug color" 2579 27000 00 91 DEBUGCALC = $91 2580 27000 00 41 DEBUGWASTE = $41 2581 27000 00 c1 DEBUGDRAW = $C1 2582 27000 2583 27000 ;NMI and IRQ handlers 2584 27000 NMI 2585 27000 ;VISIBLEOVER is 255 while the screen is drawn, and 0 right after the visible screen is done. 2586 27000 48 pha ; save A 2587 27001 d8 cld 2588 27002 a5 4d lda visibleover 2589 27004 49 ff eor #255 2590 27006 85 4d sta visibleover 2591 27008 - ifconst DEBUGINTERRUPT 2592 27008 - and #$93 2593 27008 - sta BACKGRND 2594 27008 endif 2595 27008 8a txa ; save X 2596 27009 48 pha 2597 2700a 98 tya ; save Y 2598 2700b 48 pha 2599 2700c ce b2 01 dec interruptindex 2600 2700f d0 03 bne skipreallyoffvisible 2601 27011 4c 6b f0 jmp reallyoffvisible 2602 27014 skipreallyoffvisible 2603 27014 a5 4d lda visibleover 2604 27016 d0 03 bne carryontopscreenroutine 2605 27018 - ifconst .bottomscreenroutine 2606 27018 - lda interrupthold 2607 27018 - beq skipbottomroutine 2608 27018 - jsr .bottomscreenroutine 2609 27018 -skipbottomroutine 2610 27018 endif 2611 27018 4c 79 f0 jmp NMIexit 2612 2701b carryontopscreenroutine 2613 2701b - ifconst .topscreenroutine 2614 2701b - lda interrupthold 2615 2701b - beq skiptoproutine 2616 2701b - jsr .topscreenroutine 2617 2701b -skiptoproutine 2618 2701b endif 2619 2701b ifnconst CANARYOFF 2620 2701b ad c1 01 lda canary 2621 2701e f0 07 beq skipcanarytriggered 2622 27020 a9 45 lda #$45 2623 27022 85 20 sta BACKGRND 2624 27024 4c 63 f0 jmp skipbrkolorset ; common crash dump routine, if available 2625 27027 skipcanarytriggered 2626 27027 endif 2627 27027 2628 27027 ee 3e 21 inc frameslost ; this is balanced with a "dec frameslost" when drawscreen is called. 2629 2702a 2630 2702a ; ** Other important routines that need to regularly run, and can run onscreen. 2631 2702a ; ** Atarivox can't go here, because Maria might interrupt it while it's bit-banging. 2632 2702a 2633 2702a - ifconst LONGCONTROLLERREAD 2634 2702a -longcontrollerreads ; ** controllers that take a lot of time to read. We use much of the visible screen here. 2635 2702a - ldy port1control 2636 2702a - lda longreadtype,y 2637 2702a - beq LLRET1 2638 2702a - tay 2639 2702a - lda longreadroutinehiP1,y 2640 2702a - sta inttemp4 2641 2702a - lda longreadroutineloP1,y 2642 2702a - sta inttemp3 2643 2702a - jmp (inttemp3) 2644 2702a -LLRET1 2645 2702a - ldy port0control 2646 2702a - lda longreadtype,y 2647 2702a - beq LLRET0 2648 2702a - tay 2649 2702a - lda longreadroutinehiP0,y 2650 2702a - sta inttemp4 2651 2702a - lda longreadroutineloP0,y 2652 2702a - sta inttemp3 2653 2702a - jmp (inttemp3) 2654 2702a -LLRET0 2655 2702a - 2656 2702a - 2657 2702a - ifconst PADDLERANGE 2658 2702a -TIMEVAL = PADDLERANGE 2659 2702a - else 2660 2702a -TIMEVAL = 160 2661 2702a - endif 2662 2702a -TIMEOFFSET = 10 2663 2702a - 2664 2702a endif ; LONGCONTROLLERREAD 2665 2702a 2666 2702a 2667 2702a 20 d8 f1 jsr servicesfxchannels 2668 2702d - ifconst MUSICTRACKER 2669 2702d - jsr servicesong 2670 2702d endif ; MUSICTRACKER 2671 2702d 2672 2702d ee a4 01 inc framecounter 2673 27030 ad a4 01 lda framecounter 2674 27033 29 3f and #63 2675 27035 d0 08 bne skipcountdownseconds 2676 27037 ad a5 01 lda countdownseconds 2677 2703a f0 03 beq skipcountdownseconds 2678 2703c ce a5 01 dec countdownseconds 2679 2703f skipcountdownseconds 2680 2703f 2681 2703f a2 01 ldx #1 2682 27041 buttonreadloop 2683 27041 8a txa 2684 27042 48 pha 2685 27043 bc b7 01 ldy port0control,x 2686 27046 b9 bb f1 lda buttonhandlerlo,y 2687 27049 85 da sta inttemp3 2688 2704b b9 b0 f1 lda buttonhandlerhi,y 2689 2704e 85 db sta inttemp4 2690 27050 05 da ora inttemp3 2691 27052 f0 03 beq buttonreadloopreturn 2692 27054 6c da 00 jmp (inttemp3) 2693 27057 buttonreadloopreturn 2694 27057 68 pla 2695 27058 aa tax 2696 27059 ca dex 2697 2705a 10 e5 bpl buttonreadloop 2698 2705c 2699 2705c - ifconst KEYPADSUPPORT 2700 2705c - jsr keypadrowselect 2701 2705c endif ; KEYPADSUPPORT 2702 2705c 2703 2705c 2704 2705c - ifconst DOUBLEBUFFER 2705 2705c - lda doublebufferminimumframeindex 2706 2705c - beq skipdoublebufferminimumframeindexadjust 2707 2705c - dec doublebufferminimumframeindex 2708 2705c -skipdoublebufferminimumframeindexadjust 2709 2705c endif 2710 2705c 2711 2705c 4c 79 f0 jmp NMIexit 2712 2705f 2713 2705f IRQ ; the only source of non-nmi interrupt should be the BRK opcode. 2714 2705f ifnconst BREAKPROTECTOFF 2715 2705f a9 1a lda #$1A 2716 27061 85 20 sta BACKGRND 2717 27063 skipbrkolorset 2718 27063 skipbrkdetected 2719 27063 a9 60 lda #$60 2720 27065 8d 07 21 sta sCTRL 2721 27068 85 3c sta CTRL 2722 2706a ifnconst hiscorefont 2723 2706a 02 .byte.b $02 ; KIL/JAM 2724 2706b - else ; hiscorefont is present 2725 2706b - ifconst CRASHDUMP 2726 2706b - bit MSTAT 2727 2706b - bpl skipbrkdetected ; wait for vblank to ensure we're clear of NMI 2728 2706b - 2729 2706b - ifconst dumpbankswitch 2730 2706b - lda dumpbankswitch 2731 2706b - pha 2732 2706b - endif 2733 2706b - 2734 2706b - ; bankswitch if needed, to get to the hiscore font 2735 2706b - ifconst bankswitchmode 2736 2706b - ifconst included.hiscore.asm.bank 2737 2706b - ifconst MCPDEVCART 2738 2706b - lda #($18 | included.hiscore.asm.bank) 2739 2706b - sta $3000 2740 2706b - else 2741 2706b - lda #(included.hiscore.asm.bank) 2742 2706b - sta $8000 2743 2706b - endif 2744 2706b - endif ; included.hiscore.asm.bank 2745 2706b - endif ; bankswitchmode 2746 2706b - 2747 2706b - ifconst DOUBLEBUFFER 2748 2706b - ;turn off double-buffering, if on... 2749 2706b - lda #>DLLMEM 2750 2706b - sta DPPH 2751 2706b - lda #hiscorefont 2795 2706b - sta CHARBASE 2796 2706b - sta sCHARBASE 2797 2706b - lda #%01000011 ;Enable DMA, mode=320A 2798 2706b - sta CTRL 2799 2706b - sta sCTRL 2800 2706b - .byte $02 ; KIL/JAM 2801 2706b -hiscorehexlut 2802 2706b - ; 0 1 2 3 4 5 6 7 8 9 A B C D E F 2803 2706b - .byte 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 0, 1, 2, 3, 4, 5 2804 2706b -show2700 2805 2706b - ; lo mode hi width=29 x EODL 2806 2706b - .byte $00, %01100000, $27, 3, 20, 0,0,0 2807 2706b - else ; CRASHDUMP 2808 2706b - .byte $02 ; KIL/JAM 2809 2706b - endif ; crashdump 2810 2706b endif ; hiscorefont 2811 2706b - else 2812 2706b - RTI 2813 2706b endif 2814 2706b 2815 2706b - ifconst LONGCONTROLLERREAD 2816 2706b - 2817 2706b -longreadtype 2818 2706b - .byte 0, 0, 0, 1 ; NONE PROLINE LIGHTGUN PADDLE 2819 2706b - .byte 2, 0, 3, 0 ; TRKBALL VCSSTICK DRIVING KEYPAD 2820 2706b - .byte 3, 3, 0 ; STMOUSE AMOUSE ATARIVOX 2821 2706b - 2822 2706b -longreadroutineloP0 2823 2706b - .byte LLRET0 ; 0 = no routine 2830 2706b - .byte >paddleport0update ; 1 = paddle 2831 2706b - .byte >trakball0update ; 2 = trackball 2832 2706b - .byte >mouse0update ; 3 = mouse 2833 2706b - 2834 2706b -longreadroutineloP1 2835 2706b - .byte LLRET1 ; 0 = no routine 2842 2706b - .byte >paddleport1update ; 1 = paddle 2843 2706b - .byte >trakball1update ; 2 = trackball 2844 2706b - .byte >mouse1update ; 3 = mouse 2845 2706b - 2846 2706b - 2847 2706b -SETTIM64T 2848 2706b - bne skipdefaulttime 2849 2706b - ifnconst PADDLESMOOTHINGOFF 2850 2706b - lda #(TIMEVAL+TIMEOFFSET+1) 2851 2706b - else 2852 2706b - lda #(TIMEVAL+TIMEOFFSET) 2853 2706b - endif 2854 2706b -skipdefaulttime 2855 2706b - tay 2856 2706b - dey 2857 2706b -.setTIM64Tloop 2858 2706b - sta TIM64T 2859 2706b - cpy INTIM 2860 2706b - bne .setTIM64Tloop 2861 2706b - rts 2862 2706b endif ; LONGCONTROLLERREAD 2863 2706b 2864 2706b reallyoffvisible 2865 2706b 85 24 sta WSYNC 2866 2706d 2867 2706d a9 00 lda #0 2868 2706f 85 4d sta visibleover 2869 27071 - ifconst DEBUGINTERRUPT 2870 27071 - sta BACKGRND 2871 27071 endif 2872 27071 2873 27071 a9 03 lda #3 2874 27073 8d b2 01 sta interruptindex 2875 27076 2876 27076 20 52 f1 jsr uninterruptableroutines 2877 27079 2878 27079 - ifconst .userinterrupt 2879 27079 - lda interrupthold 2880 27079 - beq skipuserintroutine 2881 27079 - jsr .userinterrupt 2882 27079 -skipuserintroutine 2883 27079 endif 2884 27079 2885 27079 - ifconst KEYPADSUPPORT 2886 27079 - jsr keypadcolumnread 2887 27079 endif 2888 27079 2889 27079 NMIexit 2890 27079 68 pla 2891 2707a a8 tay 2892 2707b 68 pla 2893 2707c aa tax 2894 2707d 68 pla 2895 2707e 40 RTI 2896 2707f 2897 2707f clearscreen 2898 2707f a2 0b ldx #(WZONECOUNT-1) 2899 27081 a9 00 lda #0 2900 27083 clearscreenloop 2901 27083 95 65 sta dlend,x 2902 27085 ca dex 2903 27086 10 fb bpl clearscreenloop 2904 27088 a9 00 lda #0 2905 2708a 8d ad 01 sta valbufend ; clear the bcd value buffer 2906 2708d 8d ae 01 sta valbufendsave 2907 27090 60 rts 2908 27091 2909 27091 restorescreen 2910 27091 a2 0b ldx #(WZONECOUNT-1) 2911 27093 a9 00 lda #0 2912 27095 restorescreenloop 2913 27095 b5 82 lda dlendsave,x 2914 27097 95 65 sta dlend,x 2915 27099 ca dex 2916 2709a 10 f9 bpl restorescreenloop 2917 2709c ad ae 01 lda valbufendsave 2918 2709f 8d ad 01 sta valbufend 2919 270a2 60 rts 2920 270a3 2921 270a3 savescreen 2922 270a3 a2 0b ldx #(WZONECOUNT-1) 2923 270a5 savescreenloop 2924 270a5 b5 65 lda dlend,x 2925 270a7 95 82 sta dlendsave,x 2926 270a9 ca dex 2927 270aa 10 f9 bpl savescreenloop 2928 270ac ad ad 01 lda valbufend 2929 270af 8d ae 01 sta valbufendsave 2930 270b2 - ifconst DOUBLEBUFFER 2931 270b2 - lda doublebufferstate 2932 270b2 - beq savescreenrts 2933 270b2 - lda #1 2934 270b2 - sta doublebufferbufferdirty 2935 270b2 -savescreenrts 2936 270b2 endif ; DOUBLEBUFFER 2937 270b2 60 rts 2938 270b3 2939 270b3 drawscreen 2940 270b3 2941 270b3 - ifconst interrupthold 2942 270b3 - lda #$FF 2943 270b3 - sta interrupthold ; if the user called drawscreen, we're ready for interrupts 2944 270b3 endif 2945 270b3 2946 270b3 a9 00 lda #0 2947 270b5 85 42 sta temp1 ; not B&W if we're here... 2948 270b7 2949 270b7 drawscreenwait 2950 270b7 a5 4d lda visibleover 2951 270b9 d0 fc bne drawscreenwait ; make sure the visible screen isn't being drawn 2952 270bb 2953 270bb ;restore some registers in case the game changed them mid-screen... 2954 270bb ad 07 21 lda sCTRL 2955 270be 05 42 ora temp1 2956 270c0 85 3c sta CTRL 2957 270c2 ad 0b 21 lda sCHARBASE 2958 270c5 85 34 sta CHARBASE 2959 270c7 2960 270c7 ;ensure all of the display list is terminated... 2961 270c7 20 38 f1 jsr terminatedisplaylist 2962 270ca 2963 270ca ifnconst pauseroutineoff 2964 270ca 20 d5 f0 jsr pauseroutine 2965 270cd endif ; pauseroutineoff 2966 270cd 2967 270cd ; Make sure the visible screen has *started* before we exit. That way we can rely on drawscreen 2968 270cd ; delaying a full frame, but still allowing time for basic calculations. 2969 270cd visiblescreenstartedwait 2970 270cd a5 4d lda visibleover 2971 270cf f0 fc beq visiblescreenstartedwait 2972 270d1 visiblescreenstartedwaitdone 2973 270d1 ce 3e 21 dec frameslost ; ; this gets balanced with an "inc frameslost" by an NMI at the top of the screen 2974 270d4 60 rts 2975 270d5 2976 270d5 ifnconst pauseroutineoff 2977 270d5 ; check to see if pause was pressed and released 2978 270d5 pauseroutine 2979 270d5 ad b3 01 lda pausedisable 2980 270d8 d0 4e bne leavepauseroutine 2981 270da a9 08 lda #8 2982 270dc 2c 82 02 bit SWCHB 2983 270df f0 29 beq pausepressed 2984 270e1 2985 270e1 ifnconst SOFTRESETASPAUSEOFF 2986 270e1 ifnconst MOUSESUPPORT 2987 270e1 ifnconst TRAKBALLSUPPORT 2988 270e1 ad 80 02 lda SWCHA ; then check the soft "RESET" joysick code... 2989 270e4 29 70 and #%01110000 ; _LDU 2990 270e6 f0 22 beq pausepressed 2991 270e8 endif 2992 270e8 endif 2993 270e8 endif 2994 270e8 2995 270e8 ;pause isn't pressed 2996 270e8 a9 00 lda #0 2997 270ea 8d ac 01 sta pausebuttonflag ; clear pause hold state in case its set 2998 270ed 2999 270ed ;check if we're in an already paused state 3000 270ed ad 00 21 lda pausestate 3001 270f0 f0 36 beq leavepauseroutine ; nope, leave 3002 270f2 3003 270f2 c9 01 cmp #1 ; last frame was the start of pausing 3004 270f4 f0 2b beq enterpausestate2 ; move from state 1 to 2 3005 270f6 3006 270f6 c9 02 cmp #2 3007 270f8 f0 34 beq carryonpausing 3008 270fa 3009 270fa ;pausestate must be >2, which means we're ending an unpause 3010 270fa a9 00 lda #0 3011 270fc 8d ac 01 sta pausebuttonflag 3012 270ff 8d 00 21 sta pausestate 3013 27102 ad 07 21 lda sCTRL 3014 27105 85 3c sta CTRL 3015 27107 4c 28 f1 jmp leavepauseroutine 3016 2710a 3017 2710a pausepressed 3018 2710a ;pause is pressed 3019 2710a ad ac 01 lda pausebuttonflag 3020 2710d c9 ff cmp #$ff 3021 2710f f0 1d beq carryonpausing 3022 27111 3023 27111 ;its a new press, increment the state 3024 27111 ee 00 21 inc pausestate 3025 27114 3026 27114 ;silence volume at the start and end of pausing 3027 27114 a9 00 lda #0 3028 27116 85 19 sta AUDV0 3029 27118 85 1a sta AUDV1 3030 2711a 3031 2711a - ifconst pokeysupport 3032 2711a - ldy #7 3033 2711a -pausesilencepokeyaudioloop 3034 2711a - sta (pokeybase),y 3035 2711a - dey 3036 2711a - bpl pausesilencepokeyaudioloop 3037 2711a endif ; pokeysupport 3038 2711a 3039 2711a a9 ff lda #$ff 3040 2711c 8d ac 01 sta pausebuttonflag 3041 2711f d0 0d bne carryonpausing 3042 27121 3043 27121 enterpausestate2 3044 27121 a9 02 lda #2 3045 27123 8d 00 21 sta pausestate 3046 27126 d0 06 bne carryonpausing 3047 27128 leavepauseroutine 3048 27128 ad 07 21 lda sCTRL 3049 2712b 85 3c sta CTRL 3050 2712d 60 rts 3051 2712e carryonpausing 3052 2712e - ifconst .pause 3053 2712e - jsr .pause 3054 2712e endif ; .pause 3055 2712e ad 07 21 lda sCTRL 3056 27131 09 80 ora #%10000000 ; turn off colorburst during pause... 3057 27133 85 3c sta CTRL 3058 27135 4c d5 f0 jmp pauseroutine 3059 27138 endif ; pauseroutineoff 3060 27138 3061 27138 3062 27138 - ifconst DOUBLEBUFFER 3063 27138 -skipterminatedisplaylistreturn 3064 27138 - rts 3065 27138 endif ; DOUBLEBUFFER 3066 27138 terminatedisplaylist 3067 27138 - ifconst DOUBLEBUFFER 3068 27138 - lda doublebufferstate 3069 27138 - bne skipterminatedisplaylistreturn ; double-buffering runs it's own DL termination code 3070 27138 endif ; DOUBLEBUFFER 3071 27138 terminatedisplaybuffer 3072 27138 ;add DL end entry on each DL 3073 27138 a2 0b ldx #(WZONECOUNT-1) 3074 2713a dlendloop 3075 2713a bd 1a f6 lda DLPOINTL,x 3076 2713d - ifconst DOUBLEBUFFER 3077 2713d - clc 3078 2713d - adc doublebufferdloffset 3079 2713d endif ; DOUBLEBUFFER 3080 2713d 85 63 sta dlpnt 3081 2713f bd 0e f6 lda DLPOINTH,x 3082 27142 - ifconst DOUBLEBUFFER 3083 27142 - adc #0 3084 27142 endif ; DOUBLEBUFFER 3085 27142 85 64 sta dlpnt+1 3086 27144 b4 65 ldy dlend,x 3087 27146 a9 00 lda #$00 3088 27148 dlendmoreloops 3089 27148 c8 iny 3090 27149 91 63 sta (dlpnt),y 3091 2714b - ifconst FRAMESKIPGLITCHFIXWEAK 3092 2714b - cpy #DLLASTOBJ+1 3093 2714b - beq dlendthiszonedone 3094 2714b - iny 3095 2714b - iny 3096 2714b - iny 3097 2714b - iny 3098 2714b - iny 3099 2714b - sta (dlpnt),y 3100 2714b -dlendthiszonedone 3101 2714b endif FRAMESKIPGLITCHFIXWEAK 3102 2714b - ifconst FRAMESKIPGLITCHFIX 3103 2714b - iny 3104 2714b - iny 3105 2714b - iny 3106 2714b - iny 3107 2714b - cpy #DLLASTOBJ-1 3108 2714b - bcc dlendmoreloops 3109 2714b endif ; FRAMESKIPGLITCHFIX 3110 2714b ca dex 3111 2714c 10 ec bpl dlendloop 3112 2714e 3113 2714e ifnconst pauseroutineoff 3114 2714e 20 d5 f0 jsr pauseroutine 3115 27151 endif ; pauseroutineoff 3116 27151 60 rts 3117 27152 3118 27152 uninterruptableroutines 3119 27152 ; this is for routines that must happen off the visible screen, each frame. 3120 27152 3121 27152 - ifconst AVOXVOICE 3122 27152 - jsr serviceatarivoxqueue 3123 27152 endif 3124 27152 3125 27152 a9 00 lda #0 3126 27154 8d b6 01 sta palfastframe 3127 27157 ad 09 21 lda paldetected 3128 2715a f0 10 beq skippalframeadjusting 3129 2715c ; ** PAL console is detected. we increment palframes to accurately count 5 frames, 3130 2715c ae b5 01 ldx palframes 3131 2715f e8 inx 3132 27160 e0 05 cpx #5 3133 27162 d0 05 bne palframeskipdone 3134 27164 ee b6 01 inc palfastframe 3135 27167 a2 00 ldx #0 3136 27169 palframeskipdone 3137 27169 8e b5 01 stx palframes 3138 2716c skippalframeadjusting 3139 2716c 3140 2716c - ifconst MUSICTRACKER 3141 2716c - ; We normally run the servicesong routine from the top-screen interrupt, but if it 3142 2716c - ; happens to interrupt the scheduling of a sound effect in the game code, we skip it. 3143 2716c - ; If that happens, we try again here. Chances are very small we'll run into the same 3144 2716c - ; problem twice, and if we do, we just drop a musical note or two. 3145 2716c - lda sfxschedulemissed 3146 2716c - beq servicesongwasnotmissed 3147 2716c - jsr servicesong 3148 2716c -servicesongwasnotmissed 3149 2716c endif ; MUSICTRACKER 3150 2716c 3151 2716c 60 rts 3152 2716d 3153 2716d serviceatarivoxqueue 3154 2716d - ifconst AVOXVOICE 3155 2716d - lda voxlock 3156 2716d - bne skipvoxprocessing ; the vox is in the middle of speech address update 3157 2716d -skipvoxqueuesizedec 3158 2716d - jmp processavoxvoice 3159 2716d -skipvoxprocessing 3160 2716d - rts 3161 2716d - 3162 2716d -processavoxvoice 3163 2716d - lda avoxenable 3164 2716d - bne avoxfixport 3165 2716d - SPKOUT tempavox 3166 2716d - rts 3167 2716d -avoxfixport 3168 2716d - lda #0 ; restore the port to all bits as inputs... 3169 2716d - sta CTLSWA 3170 2716d - rts 3171 2716d -silenceavoxvoice 3172 2716d - SPEAK avoxsilentdata 3173 2716d - rts 3174 2716d -avoxsilentdata 3175 2716d - .byte 31,255 3176 2716d else 3177 2716d 60 rts 3178 2716e endif ; AVOXVOICE 3179 2716e 3180 2716e joybuttonhandler 3181 2716e 8a txa 3182 2716f 0a asl 3183 27170 a8 tay 3184 27171 b9 08 00 lda INPT0,y 3185 27174 4a lsr 3186 27175 9d 02 21 sta sINPT1,x 3187 27178 b9 09 00 lda INPT1,y 3188 2717b 29 80 and #%10000000 3189 2717d 1d 02 21 ora sINPT1,x 3190 27180 9d 02 21 sta sINPT1,x 3191 27183 3192 27183 b5 0c lda INPT4,x 3193 27185 30 19 bmi .skip1bjoyfirecheck 3194 27187 ;one button joystick is down 3195 27187 49 80 eor #%10000000 3196 27189 9d 02 21 sta sINPT1,x 3197 2718c 3198 2718c ad b1 01 lda joybuttonmode 3199 2718f 3d a3 f1 and twobuttonmask,x 3200 27192 f0 0c beq .skip1bjoyfirecheck 3201 27194 ad b1 01 lda joybuttonmode 3202 27197 1d a3 f1 ora twobuttonmask,x 3203 2719a 8d b1 01 sta joybuttonmode 3204 2719d 8d 82 02 sta SWCHB 3205 271a0 .skip1bjoyfirecheck 3206 271a0 4c 57 f0 jmp buttonreadloopreturn 3207 271a3 3208 271a3 twobuttonmask 3209 271a3 04 10 .byte.b %00000100,%00010000 3210 271a5 3211 271a5 gunbuttonhandler ; outside of the conditional, so our button handler LUT is valid 3212 271a5 - ifconst LIGHTGUNSUPPORT 3213 271a5 - cpx #0 3214 271a5 - bne secondportgunhandler 3215 271a5 -firstportgunhandler 3216 271a5 - lda SWCHA 3217 271a5 - asl 3218 271a5 - asl 3219 271a5 - asl ; shift D4 to D7 3220 271a5 - and #%10000000 3221 271a5 - eor #%10000000 3222 271a5 - sta sINPT1 3223 271a5 - jmp buttonreadloopreturn 3224 271a5 -secondportgunhandler 3225 271a5 - lda SWCHA 3226 271a5 - lsr ; shift D0 into carry 3227 271a5 - lsr ; shift carry into D7 3228 271a5 - and #%10000000 3229 271a5 - eor #%10000000 3230 271a5 - sta sINPT3 3231 271a5 - jmp buttonreadloopreturn 3232 271a5 endif ; LIGHTGUNSUPPORT 3233 271a5 3234 271a5 controlsusing2buttoncode 3235 271a5 00 .byte.b 0 ; 00=no controller plugged in 3236 271a6 01 .byte.b 1 ; 01=proline joystick 3237 271a7 00 .byte.b 0 ; 02=lightgun 3238 271a8 00 .byte.b 0 ; 03=paddle 3239 271a9 01 .byte.b 1 ; 04=trakball 3240 271aa 01 .byte.b 1 ; 05=vcs joystick 3241 271ab 01 .byte.b 1 ; 06=driving control 3242 271ac 00 .byte.b 0 ; 07=keypad control 3243 271ad 00 .byte.b 0 ; 08=st mouse/cx80 3244 271ae 00 .byte.b 0 ; 09=amiga mouse 3245 271af 01 .byte.b 1 ; 10=atarivox 3246 271b0 3247 271b0 buttonhandlerhi 3248 271b0 00 .byte.b 0 ; 00=no controller plugged in 3249 271b1 f1 .byte.b >joybuttonhandler ; 01=proline joystick 3250 271b2 f1 .byte.b >gunbuttonhandler ; 02=lightgun 3251 271b3 f4 .byte.b >paddlebuttonhandler ; 03=paddle 3252 271b4 f1 .byte.b >joybuttonhandler ; 04=trakball 3253 271b5 f1 .byte.b >joybuttonhandler ; 05=vcs joystick 3254 271b6 f1 .byte.b >joybuttonhandler ; 06=driving control 3255 271b7 00 .byte.b 0 ; 07=keypad 3256 271b8 f4 .byte.b >mousebuttonhandler ; 08=st mouse 3257 271b9 f4 .byte.b >mousebuttonhandler ; 09=amiga mouse 3258 271ba f1 .byte.b >joybuttonhandler ; 10=atarivox 3259 271bb buttonhandlerlo 3260 271bb 00 .byte.b 0 ; 00=no controller plugged in 3261 271bc 6e .byte.b $0F means the sound is looped while priority is active 3362 27219 3363 27219 05 d9 ora inttemp2 3364 2721b 05 d8 ora inttemp1 ; check if F|C|V=0 3365 2721d f0 23 beq zerosfx ; if so, we're at the end of the sound. 3366 2721f 3367 2721f advancesfxpointer 3368 2721f ; advance the pointer to the next sound chunk 3369 2721f c8 iny 3370 27220 84 da sty inttemp3 3371 27222 18 clc 3372 27223 b5 4e lda sfx1pointlo,x 3373 27225 65 da adc inttemp3 3374 27227 95 4e sta sfx1pointlo,x 3375 27229 b5 50 lda sfx1pointhi,x 3376 2722b 69 00 adc #0 3377 2722d 95 50 sta sfx1pointhi,x 3378 2722f 4c da f1 jmp servicesfxchannelsloop 3379 27232 3380 27232 sfxsoundloop 3381 27232 48 pha 3382 27233 b5 52 lda sfx1priority,x 3383 27235 d0 04 bne sfxsoundloop_carryon 3384 27237 68 pla ; fix the stack before we go 3385 27238 4c 1f f2 jmp advancesfxpointer 3386 2723b sfxsoundloop_carryon 3387 2723b 68 pla 3388 2723c 29 f0 and #$F0 3389 2723e 4a lsr 3390 2723f 4a lsr 3391 27240 4a lsr 3392 27241 4a lsr 3393 27242 3394 27242 zerosfx 3395 27242 95 4e sta sfx1pointlo,x 3396 27244 95 50 sta sfx1pointhi,x 3397 27246 95 52 sta sfx1priority,x 3398 27248 4c da f1 jmp servicesfxchannelsloop 3399 2724b 3400 2724b 3401 2724b schedulesfx 3402 2724b ; called with sfxinstrumentlo=data sfxpitchoffset=pitch-offset sfxnoteindex=note index 3403 2724b a0 00 ldy #0 3404 2724d b1 e0 lda (sfxinstrumentlo),y 3405 2724f - ifconst pokeysupport 3406 2724f - cmp #$20 ; POKEY? 3407 2724f - bne scheduletiasfx 3408 2724f - jmp schedulepokeysfx 3409 2724f endif 3410 2724f scheduletiasfx 3411 2724f ;cmp #$10 ; TIA? 3412 2724f ;beq continuescheduletiasfx 3413 2724f ; rts ; unhandled!!! 3414 2724f continuescheduletiasfx 3415 2724f ifnconst TIASFXMONO 3416 2724f a5 4e lda sfx1pointlo 3417 27251 05 50 ora sfx1pointhi 3418 27253 f0 13 beq schedulesfx1 ;if channel 1 is idle, use it 3419 27255 a5 4f lda sfx2pointlo 3420 27257 05 51 ora sfx2pointhi 3421 27259 f0 11 beq schedulesfx2 ;if channel 2 is idle, use it 3422 2725b ; Both channels are scheduled. 3423 2725b a0 01 ldy #1 3424 2725d b1 e0 lda (sfxinstrumentlo),y 3425 2725f d0 01 bne interruptsfx 3426 27261 60 rts ; the new sound has 0 priority and both channels are busy. Skip playing it. 3427 27262 interruptsfx 3428 27262 ;Compare which active sound has a lower priority. We'll interrupt the lower one. 3429 27262 a5 52 lda sfx1priority 3430 27264 c5 53 cmp sfx2priority 3431 27266 b0 04 bcs schedulesfx2 3432 27268 endif ; !TIASFXMONO 3433 27268 3434 27268 schedulesfx1 3435 27268 a2 00 ldx #0 ; channel 1 3436 2726a ifnconst TIASFXMONO 3437 2726a f0 02 beq skipschedulesfx2 3438 2726c schedulesfx2 3439 2726c a2 01 ldx #1 ; channel 2 3440 2726e skipschedulesfx2 3441 2726e endif ; !TIASFXMONO 3442 2726e 3443 2726e - ifconst MUSICTRACKER 3444 2726e - lda sfxnoteindex 3445 2726e - bpl skipdrumkitoverride 3446 2726e - and #$7F ; subtract 128 3447 2726e - sec 3448 2726e - sbc #4 ; drums start at 132, i.e. octave 10 3449 2726e - asl 3450 2726e - tay 3451 2726e - lda tiadrumkitdefinition,y 3452 2726e - sta sfxinstrumentlo 3453 2726e - iny 3454 2726e - lda tiadrumkitdefinition,y 3455 2726e - sta sfxinstrumenthi 3456 2726e - lda #0 3457 2726e - sta sfxnoteindex ; and tell the driver it's a non-pitched instrument 3458 2726e -skipdrumkitoverride 3459 2726e endif ; MUSICTRACKER 3460 2726e a0 01 ldy #1 ; get priority and sound-resolution (in frames) 3461 27270 b1 e0 lda (sfxinstrumentlo),y 3462 27272 95 52 sta sfx1priority,x 3463 27274 c8 iny 3464 27275 b1 e0 lda (sfxinstrumentlo),y 3465 27277 95 56 sta sfx1frames,x 3466 27279 a5 e0 lda sfxinstrumentlo 3467 2727b 18 clc 3468 2727c 69 03 adc #3 3469 2727e 95 4e sta sfx1pointlo,x 3470 27280 a5 e1 lda sfxinstrumenthi 3471 27282 69 00 adc #0 3472 27284 95 50 sta sfx1pointhi,x 3473 27286 a5 e2 lda sfxpitchoffset 3474 27288 95 54 sta sfx1poffset,x 3475 2728a a9 00 lda #0 3476 2728c 95 58 sta sfx1tick,x 3477 2728e a5 e3 lda sfxnoteindex 3478 27290 95 cd sta sfx1notedata,x 3479 27292 60 rts 3480 27293 3481 27293 plotsprite 3482 27293 ifnconst NODRAWWAIT 3483 27293 - ifconst DOUBLEBUFFER 3484 27293 - lda doublebufferstate 3485 27293 - bne skipplotspritewait 3486 27293 endif ; DOUBLEBUFFER 3487 27293 - ifconst DEBUGWAITCOLOR 3488 27293 - lda #$41 3489 27293 - sta BACKGRND 3490 27293 endif 3491 27293 plotspritewait 3492 27293 a5 4d lda visibleover 3493 27295 d0 fc bne plotspritewait 3494 27297 skipplotspritewait 3495 27297 - ifconst DEBUGWAITCOLOR 3496 27297 - lda #$0 3497 27297 - sta BACKGRND 3498 27297 endif 3499 27297 endif 3500 27297 3501 27297 ;arguments: 3502 27297 ; temp1=lo graphicdata 3503 27297 ; temp2=hi graphicdata 3504 27297 ; temp3=palette | width byte 3505 27297 ; temp4=x 3506 27297 ; temp5=y 3507 27297 ; temp6=mode 3508 27297 a5 46 lda temp5 ;Y position 3509 27299 4a lsr ; 2 - Divide by 8 or 16 3510 2729a 4a lsr ; 2 3511 2729b 4a lsr ; 2 3512 2729c if WZONEHEIGHT = 16 3513 2729c 4a lsr ; 2 3514 2729d endif 3515 2729d 3516 2729d aa tax 3517 2729e 3518 2729e ifnconst NOLIMITCHECKING 3519 2729e 3520 2729e ; the next block allows for vertical masking, and ensures we don't overwrite non-DL memory 3521 2729e 3522 2729e c9 0c cmp #WZONECOUNT 3523 272a0 3524 272a0 90 0a bcc continueplotsprite1 ; the sprite is fully on-screen, so carry on... 3525 272a2 ; otherwise, check to see if the bottom half is in zone 0... 3526 272a2 3527 272a2 if WZONEHEIGHT = 16 3528 272a2 c9 0f cmp #15 3529 272a4 - else 3530 272a4 - cmp #31 3531 272a4 endif 3532 272a4 3533 272a4 d0 05 bne exitplotsprite1 3534 272a6 a2 00 ldx #0 3535 272a8 4c e1 f2 jmp continueplotsprite2 3536 272ab exitplotsprite1 3537 272ab 60 rts 3538 272ac 3539 272ac continueplotsprite1 3540 272ac endif 3541 272ac 3542 272ac bd 1a f6 lda DLPOINTL,x ;Get pointer to DL that this sprite starts in 3543 272af - ifconst DOUBLEBUFFER 3544 272af - clc 3545 272af - adc doublebufferdloffset 3546 272af endif ; DOUBLEBUFFER 3547 272af 85 63 sta dlpnt 3548 272b1 bd 0e f6 lda DLPOINTH,x 3549 272b4 - ifconst DOUBLEBUFFER 3550 272b4 - adc #0 3551 272b4 endif ; DOUBLEBUFFER 3552 272b4 85 64 sta dlpnt+1 3553 272b6 3554 272b6 ;Create DL entry for upper part of sprite 3555 272b6 3556 272b6 b4 65 ldy dlend,x ;Get the index to the end of this DL 3557 272b8 3558 272b8 - ifconst CHECKOVERWRITE 3559 272b8 - cpy #DLLASTOBJ 3560 272b8 - beq checkcontinueplotsprite2 3561 272b8 -continueplotsprite1a 3562 272b8 endif 3563 272b8 3564 272b8 a5 42 lda temp1 ; graphic data, lo byte 3565 272ba 91 63 sta (dlpnt),y ;Low byte of data address 3566 272bc 3567 272bc ifnconst ATOMICSPRITEUPDATE 3568 272bc c8 iny 3569 272bd a5 47 lda temp6 3570 272bf 91 63 sta (dlpnt),y 3571 272c1 - else 3572 272c1 - iny 3573 272c1 - sty temp8 3574 272c1 endif 3575 272c1 3576 272c1 c8 iny 3577 272c2 3578 272c2 a5 46 lda temp5 ;Y position 3579 272c4 29 0f and #(WZONEHEIGHT - 1) 3580 272c6 c9 01 cmp #1 ; clear carry if our sprite is just in this zone 3581 272c8 05 43 ora temp2 ; graphic data, hi byte 3582 272ca 91 63 sta (dlpnt),y 3583 272cc 3584 272cc 3585 272cc c8 iny 3586 272cd a5 44 lda temp3 ;palette|width 3587 272cf 91 63 sta (dlpnt),y 3588 272d1 3589 272d1 c8 iny 3590 272d2 a5 45 lda temp4 ;Horizontal position 3591 272d4 91 63 sta (dlpnt),y 3592 272d6 3593 272d6 c8 iny 3594 272d7 94 65 sty dlend,x 3595 272d9 3596 272d9 - ifconst ALWAYSTERMINATE 3597 272d9 - iny 3598 272d9 - lda #0 3599 272d9 - sta (dlpnt),y 3600 272d9 endif 3601 272d9 3602 272d9 - ifconst ATOMICSPRITEUPDATE 3603 272d9 - ldy temp8 3604 272d9 - lda temp6 3605 272d9 - sta (dlpnt),y 3606 272d9 endif 3607 272d9 3608 272d9 checkcontinueplotsprite2 3609 272d9 3610 272d9 90 33 bcc doneSPDL ;branch if the sprite was fully in the last zone 3611 272db 3612 272db ;Create DL entry for lower part of sprite 3613 272db 3614 272db e8 inx ;Next region 3615 272dc 3616 272dc ifnconst NOLIMITCHECKING 3617 272dc e0 0c cpx #WZONECOUNT 3618 272de 3619 272de 90 01 bcc continueplotsprite2 ; the second half of the sprite is fully on-screen, so carry on... 3620 272e0 60 rts 3621 272e1 continueplotsprite2 3622 272e1 endif 3623 272e1 3624 272e1 bd 1a f6 lda DLPOINTL,x ;Get pointer to next DL 3625 272e4 - ifconst DOUBLEBUFFER 3626 272e4 - clc 3627 272e4 - adc doublebufferdloffset 3628 272e4 endif ; DOUBLEBUFFER 3629 272e4 85 63 sta dlpnt 3630 272e6 bd 0e f6 lda DLPOINTH,x 3631 272e9 - ifconst DOUBLEBUFFER 3632 272e9 - adc #0 3633 272e9 endif ; DOUBLEBUFFER 3634 272e9 85 64 sta dlpnt+1 3635 272eb b4 65 ldy dlend,x ;Get the index to the end of this DL 3636 272ed 3637 272ed - ifconst CHECKOVERWRITE 3638 272ed - cpy #DLLASTOBJ 3639 272ed - bne continueplotsprite2a 3640 272ed - rts 3641 272ed -continueplotsprite2a 3642 272ed endif 3643 272ed 3644 272ed a5 42 lda temp1 ; graphic data, lo byte 3645 272ef 91 63 sta (dlpnt),y 3646 272f1 3647 272f1 ifnconst ATOMICSPRITEUPDATE 3648 272f1 c8 iny 3649 272f2 a5 47 lda temp6 3650 272f4 91 63 sta (dlpnt),y 3651 272f6 - else 3652 272f6 - iny 3653 272f6 - sty temp8 3654 272f6 endif 3655 272f6 3656 272f6 c8 iny 3657 272f7 3658 272f7 a5 46 lda temp5 ;Y position 3659 272f9 0b 0f anc #(WZONEHEIGHT - 1) ; undocumented. A=A&IMM, then move bit 7 into carry 3660 272fb 05 43 ora temp2 ; graphic data, hi byte 3661 272fd e9 0f sbc #(WZONEHEIGHT-1) ; start at the DMA hole. -1 because carry is clear 3662 272ff 91 63 sta (dlpnt),y 3663 27301 3664 27301 c8 iny 3665 27302 3666 27302 a5 44 lda temp3 ;palette|width 3667 27304 91 63 sta (dlpnt),y 3668 27306 3669 27306 c8 iny 3670 27307 3671 27307 a5 45 lda temp4 ;Horizontal position 3672 27309 91 63 sta (dlpnt),y 3673 2730b 3674 2730b c8 iny 3675 2730c 94 65 sty dlend,x 3676 2730e 3677 2730e - ifconst ALWAYSTERMINATE 3678 2730e - iny 3679 2730e - lda #0 3680 2730e - sta (dlpnt),y 3681 2730e endif 3682 2730e 3683 2730e - ifconst ATOMICSPRITEUPDATE 3684 2730e - ldy temp8 3685 2730e - lda temp6 3686 2730e - sta (dlpnt),y 3687 2730e endif 3688 2730e 3689 2730e doneSPDL 3690 2730e 60 rts 3691 2730f 3692 2730f 3693 2730f lockzonex 3694 2730f - ifconst ZONELOCKS 3695 2730f - ldy dlend,x 3696 2730f - cpy #DLLASTOBJ 3697 2730f - beq lockzonexreturn ; the zone is either stuffed or locked. abort! 3698 2730f - lda DLPOINTL,x 3699 2730f - ifconst DOUBLEBUFFER 3700 2730f - clc 3701 2730f - adc doublebufferdloffset 3702 2730f - endif ; DOUBLEBUFFER 3703 2730f - sta dlpnt 3704 2730f - lda DLPOINTH,x 3705 2730f - ifconst DOUBLEBUFFER 3706 2730f - adc #0 3707 2730f - endif ; DOUBLEBUFFER 3708 2730f - sta dlpnt+1 3709 2730f - iny 3710 2730f - lda #0 3711 2730f - sta (dlpnt),y 3712 2730f - dey 3713 2730f - tya 3714 2730f - ldy #(DLLASTOBJ-1) 3715 2730f - sta (dlpnt),y 3716 2730f - iny 3717 2730f - sty dlend,x 3718 2730f -lockzonexreturn 3719 2730f - rts 3720 2730f endif ; ZONELOCKS 3721 2730f unlockzonex 3722 2730f - ifconst ZONELOCKS 3723 2730f - ldy dlend,x 3724 2730f - cpy #DLLASTOBJ 3725 2730f - bne unlockzonexreturn ; if the zone isn't stuffed, it's not locked. abort! 3726 2730f - lda DLPOINTL,x 3727 2730f - ifconst DOUBLEBUFFER 3728 2730f - clc 3729 2730f - adc doublebufferdloffset 3730 2730f - endif ; DOUBLEBUFFER 3731 2730f - sta dlpnt 3732 2730f - lda DLPOINTH,x 3733 2730f - ifconst DOUBLEBUFFER 3734 2730f - adc #0 3735 2730f - endif ; DOUBLEBUFFER 3736 2730f - sta dlpnt+1 3737 2730f - dey 3738 2730f - ;ldy #(DLLASTOBJ-1) 3739 2730f - lda (dlpnt),y 3740 2730f - tay 3741 2730f - sty dlend,x 3742 2730f -unlockzonexreturn 3743 2730f endif ; ZONELOCKS 3744 2730f 60 rts 3745 27310 3746 27310 plotcharloop 3747 27310 ; ** read from a data indirectly pointed to from temp8,temp9 3748 27310 ; ** format is: lo_data, hi_data, palette|width, x, y 3749 27310 ; ** format ends with lo_data | hi_data = 0 3750 27310 3751 27310 - ifconst DOUBLEBUFFER 3752 27310 - lda doublebufferstate 3753 27310 - bne skipplotcharloopwait 3754 27310 endif ; DOUBLEBUFFER 3755 27310 - ifconst DEBUGWAITCOLOR 3756 27310 - lda #$61 3757 27310 - sta BACKGRND 3758 27310 endif 3759 27310 plotcharloopwait 3760 27310 a5 4d lda visibleover 3761 27312 d0 fc bne plotcharloopwait 3762 27314 - ifconst DEBUGWAITCOLOR 3763 27314 - lda #0 3764 27314 - sta BACKGRND 3765 27314 endif 3766 27314 skipplotcharloopwait 3767 27314 plotcharlooploop 3768 27314 a0 00 ldy #0 3769 27316 b1 49 lda (temp8),y 3770 27318 85 42 sta temp1 3771 2731a c8 iny 3772 2731b b1 49 lda (temp8),y 3773 2731d 85 43 sta temp2 3774 2731f 05 42 ora temp1 3775 27321 d0 01 bne plotcharloopcontinue 3776 27323 ;the pointer=0, so return 3777 27323 60 rts 3778 27324 plotcharloopcontinue 3779 27324 c8 iny 3780 27325 b1 49 lda (temp8),y 3781 27327 85 44 sta temp3 3782 27329 c8 iny 3783 2732a b1 49 lda (temp8),y 3784 2732c 85 45 sta temp4 3785 2732e c8 iny 3786 2732f b1 49 lda (temp8),y 3787 27331 ;sta temp5 ; not needed with our late entry. 3788 27331 20 4a f3 jsr plotcharactersskipentry 3789 27334 a5 49 lda temp8 3790 27336 18 clc 3791 27337 69 05 adc #5 3792 27339 85 49 sta temp8 3793 2733b a5 4a lda temp9 3794 2733d 69 00 adc #0 3795 2733f 85 4a sta temp9 3796 27341 4c 14 f3 jmp plotcharlooploop 3797 27344 3798 27344 plotcharacters 3799 27344 - ifconst DOUBLEBUFFER 3800 27344 - lda doublebufferstate 3801 27344 - bne skipplotcharacterswait 3802 27344 endif ; DOUBLEBUFFER 3803 27344 - ifconst DEBUGWAITCOLOR 3804 27344 - lda #$41 3805 27344 - sta BACKGRND 3806 27344 endif 3807 27344 plotcharacterswait 3808 27344 a5 4d lda visibleover 3809 27346 d0 fc bne plotcharacterswait 3810 27348 - ifconst DEBUGWAITCOLOR 3811 27348 - sta BACKGRND 3812 27348 endif 3813 27348 skipplotcharacterswait 3814 27348 ;arguments: 3815 27348 ; temp1=lo charactermap 3816 27348 ; temp2=hi charactermap 3817 27348 ; temp3=palette | width byte 3818 27348 ; temp4=x 3819 27348 ; temp5=y 3820 27348 3821 27348 a5 46 lda temp5 ;Y position 3822 2734a 3823 2734a plotcharactersskipentry 3824 2734a 3825 2734a ;ifconst ZONEHEIGHT 3826 2734a ; if ZONEHEIGHT = 16 3827 2734a ; and #$0F 3828 2734a ; endif 3829 2734a ; if ZONEHEIGHT = 8 3830 2734a ; and #$1F 3831 2734a ; endif 3832 2734a ;else 3833 2734a ; and #$0F 3834 2734a ;endif 3835 2734a 3836 2734a aa tax 3837 2734b bd 1a f6 lda DLPOINTL,x ;Get pointer to DL that the characters are in 3838 2734e - ifconst DOUBLEBUFFER 3839 2734e - clc 3840 2734e - adc doublebufferdloffset 3841 2734e endif ; DOUBLEBUFFER 3842 2734e 85 63 sta dlpnt 3843 27350 bd 0e f6 lda DLPOINTH,x 3844 27353 - ifconst DOUBLEBUFFER 3845 27353 - adc #0 3846 27353 endif ; DOUBLEBUFFER 3847 27353 85 64 sta dlpnt+1 3848 27355 3849 27355 ;Create DL entry for the characters 3850 27355 3851 27355 b4 65 ldy dlend,x ;Get the index to the end of this DL 3852 27357 3853 27357 - ifconst CHECKOVERWRITE 3854 27357 - cpy #DLLASTOBJ 3855 27357 - bne continueplotcharacters 3856 27357 - rts 3857 27357 -continueplotcharacters 3858 27357 endif 3859 27357 3860 27357 a5 42 lda temp1 ; character map data, lo byte 3861 27359 91 63 sta (dlpnt),y ;(1) store low address 3862 2735b 3863 2735b c8 iny 3864 2735c ad 06 21 lda charactermode 3865 2735f 91 63 sta (dlpnt),y ;(2) store mode 3866 27361 3867 27361 c8 iny 3868 27362 a5 43 lda temp2 ; character map, hi byte 3869 27364 91 63 sta (dlpnt),y ;(3) store high address 3870 27366 3871 27366 c8 iny 3872 27367 a5 44 lda temp3 ;palette|width 3873 27369 91 63 sta (dlpnt),y ;(4) store palette|width 3874 2736b 3875 2736b c8 iny 3876 2736c a5 45 lda temp4 ;Horizontal position 3877 2736e 91 63 sta (dlpnt),y ;(5) store horizontal position 3878 27370 3879 27370 c8 iny 3880 27371 94 65 sty dlend,x ; save display list end byte 3881 27373 60 rts 3882 27374 3883 27374 3884 27374 - ifconst plotvalueonscreen 3885 27374 -plotcharacterslive 3886 27374 - ; a version of plotcharacters that draws live and minimally disrupts the screen... 3887 27374 - 3888 27374 - ;arguments: 3889 27374 - ; temp1=lo charactermap 3890 27374 - ; temp2=hi charactermap 3891 27374 - ; temp3=palette | width byte 3892 27374 - ; temp4=x 3893 27374 - ; temp5=y 3894 27374 - 3895 27374 - lda temp5 ;Y position 3896 27374 - 3897 27374 - tax 3898 27374 - lda DLPOINTL,x ;Get pointer to DL that the characters are in 3899 27374 - ifconst DOUBLEBUFFER 3900 27374 - clc 3901 27374 - adc doublebufferdloffset 3902 27374 - endif ; DOUBLEBUFFER 3903 27374 - sta dlpnt 3904 27374 - lda DLPOINTH,x 3905 27374 - ifconst DOUBLEBUFFER 3906 27374 - adc #0 3907 27374 - endif ; DOUBLEBUFFER 3908 27374 - sta dlpnt+1 3909 27374 - 3910 27374 - ;Create DL entry for the characters 3911 27374 - 3912 27374 - ldy dlend,x ;Get the index to the end of this DL 3913 27374 - 3914 27374 - ifconst CHECKOVERWRITE 3915 27374 - cpy #DLLASTOBJ 3916 27374 - bne continueplotcharacterslive 3917 27374 - rts 3918 27374 -continueplotcharacterslive 3919 27374 - endif 3920 27374 - 3921 27374 - lda temp1 ; character map data, lo byte 3922 27374 - sta (dlpnt),y ;(1) store low address 3923 27374 - 3924 27374 - iny 3925 27374 - ; we don't add the second byte yet, since the charmap could briefly 3926 27374 - ; render without a proper character map address, width, or position. 3927 27374 - lda charactermode 3928 27374 - sta (dlpnt),y ;(2) store mode 3929 27374 - 3930 27374 - iny 3931 27374 - lda temp2 ; character map, hi byte 3932 27374 - sta (dlpnt),y ;(3) store high address 3933 27374 - 3934 27374 - iny 3935 27374 - lda temp3 ;palette|width 3936 27374 - sta (dlpnt),y ;(4) store palette|width 3937 27374 - 3938 27374 - iny 3939 27374 - lda temp4 ;Horizontal position 3940 27374 - sta (dlpnt),y ;(5) store horizontal position 3941 27374 - 3942 27374 - iny 3943 27374 - sty dlend,x ; save display list end byte 3944 27374 - 3945 27374 - rts 3946 27374 endif ;plotcharacterslive 3947 27374 3948 27374 - ifconst USED_PLOTVALUE 3949 27374 -plotvalue 3950 27374 - ; calling 7800basic command: 3951 27374 - ; plotvalue digit_gfx palette variable/data number_of_digits screen_x screen_y 3952 27374 - ; ...displays the variable as BCD digits 3953 27374 - ; 3954 27374 - ; asm sub arguments: 3955 27374 - ; temp1=lo charactermap 3956 27374 - ; temp2=hi charactermap 3957 27374 - ; temp3=palette | width byte 3958 27374 - ; temp4=x 3959 27374 - ; temp5=y 3960 27374 - ; temp6=number of digits 3961 27374 - ; temp7=lo variable 3962 27374 - ; temp8=hi variable 3963 27374 - ; temp9=character mode 3964 27374 - 3965 27374 -plotdigitcount = temp6 3966 27374 - 3967 27374 - ifconst ZONELOCKS 3968 27374 - ldx temp5 3969 27374 - ldy dlend,x 3970 27374 - cpy #DLLASTOBJ 3971 27374 - bne carryonplotvalue 3972 27374 - rts 3973 27374 -carryonplotvalue 3974 27374 - endif 3975 27374 - 3976 27374 - lda #0 3977 27374 - tay 3978 27374 - ldx valbufend 3979 27374 - 3980 27374 - lda plotdigitcount 3981 27374 - and #1 3982 27374 - beq pvnibble2char 3983 27374 - lda #0 3984 27374 - sta VALBUFFER,x ; just in case we skip this digit 3985 27374 - beq pvnibble2char_skipnibble 3986 27374 - 3987 27374 -pvnibble2char 3988 27374 - ; high nibble... 3989 27374 - lda (temp7),y 3990 27374 - and #$f0 3991 27374 - lsr 3992 27374 - lsr 3993 27374 - lsr 3994 27374 - ifnconst DOUBLEWIDE ; multiply value by 2 for double-width 3995 27374 - lsr 3996 27374 - endif 3997 27374 - 3998 27374 - clc 3999 27374 - adc temp1 ; add the offset to character graphics to our value 4000 27374 - sta VALBUFFER,x 4001 27374 - inx 4002 27374 - dec plotdigitcount 4003 27374 - 4004 27374 -pvnibble2char_skipnibble 4005 27374 - ; low nibble... 4006 27374 - lda (temp7),y 4007 27374 - and #$0f 4008 27374 - ifconst DOUBLEWIDE ; multiply value by 2 for double-width 4009 27374 - asl 4010 27374 - endif 4011 27374 - clc 4012 27374 - adc temp1 ; add the offset to character graphics to our value 4013 27374 - sta VALBUFFER,x 4014 27374 - inx 4015 27374 - iny 4016 27374 - 4017 27374 - dec plotdigitcount 4018 27374 - bne pvnibble2char 4019 27374 - 4020 27374 - ;point to the start of our valuebuffer 4021 27374 - clc 4022 27374 - lda #VALBUFFER 4026 27374 - adc #0 4027 27374 - sta temp2 4028 27374 - 4029 27374 - ;advance valbufend to the end of our value buffer 4030 27374 - stx valbufend 4031 27374 - 4032 27374 - ifnconst plotvalueonscreen 4033 27374 - jmp plotcharacters 4034 27374 - else 4035 27374 - jmp plotcharacterslive 4036 27374 - endif 4037 27374 - 4038 27374 endif ; USED_PLOTVALUE 4039 27374 4040 27374 4041 27374 - ifconst USED_PLOTVALUEEXTRA 4042 27374 -plotdigitcount = temp6 4043 27374 -plotvalueextra 4044 27374 - ; calling 7800basic command: 4045 27374 - ; plotvalue digit_gfx palette variable/data number_of_digits screen_x screen_y 4046 27374 - ; ...displays the variable as BCD digits 4047 27374 - ; 4048 27374 - ; asm sub arguments: 4049 27374 - ; temp1=lo charactermap 4050 27374 - ; temp2=hi charactermap 4051 27374 - ; temp3=palette | width byte 4052 27374 - ; temp4=x 4053 27374 - ; temp5=y 4054 27374 - ; temp6=number of digits 4055 27374 - ; temp7=lo variable 4056 27374 - ; temp8=hi variable 4057 27374 - 4058 27374 - lda #0 4059 27374 - tay 4060 27374 - ldx valbufend 4061 27374 - ifnconst plotvalueonscreen 4062 27374 - sta VALBUFFER,x 4063 27374 - endif 4064 27374 - 4065 27374 - lda plotdigitcount 4066 27374 - and #1 4067 27374 - 4068 27374 - bne pvnibble2char_skipnibbleextra 4069 27374 - 4070 27374 -pvnibble2charextra 4071 27374 - ; high nibble... 4072 27374 - lda (temp7),y 4073 27374 - and #$f0 4074 27374 - lsr 4075 27374 - lsr 4076 27374 - ifnconst DOUBLEWIDE ; multiply value by 2 for double-width 4077 27374 - lsr 4078 27374 - endif 4079 27374 - clc 4080 27374 - adc temp1 ; add the offset to character graphics to our value 4081 27374 - sta VALBUFFER,x 4082 27374 - inx 4083 27374 - 4084 27374 - ; second half of the digit 4085 27374 - clc 4086 27374 - adc #1 4087 27374 - sta VALBUFFER,x 4088 27374 - inx 4089 27374 - 4090 27374 -pvnibble2char_skipnibbleextra 4091 27374 - ; low nibble... 4092 27374 - lda (temp7),y 4093 27374 - and #$0f 4094 27374 - ifconst DOUBLEWIDE ; multiply value by 2 for double-width 4095 27374 - asl 4096 27374 - endif 4097 27374 - asl 4098 27374 - 4099 27374 - clc 4100 27374 - adc temp1 ; add the offset to character graphics to our value 4101 27374 - sta VALBUFFER,x 4102 27374 - inx 4103 27374 - 4104 27374 - clc 4105 27374 - adc #1 4106 27374 - sta VALBUFFER,x 4107 27374 - inx 4108 27374 - iny 4109 27374 - 4110 27374 - dec plotdigitcount 4111 27374 - bne pvnibble2charextra 4112 27374 - 4113 27374 - ;point to the start of our valuebuffer 4114 27374 - clc 4115 27374 - lda #VALBUFFER 4119 27374 - adc #0 4120 27374 - sta temp2 4121 27374 - 4122 27374 - ;advance valbufend to the end of our value buffer 4123 27374 - stx valbufend 4124 27374 - 4125 27374 - ifnconst plotvalueonscreen 4126 27374 - jmp plotcharacters 4127 27374 - else 4128 27374 - jmp plotcharacterslive 4129 27374 - endif 4130 27374 endif ; USED_PLOTVALUEEXTRA 4131 27374 4132 27374 boxcollision 4133 27374 ifconst BOXCOLLISION 4134 27374 ; the worst case cycle-time for the code below is 43 cycles. 4135 27374 ; unfortunately, prior to getting here we've burned 44 cycles in argument setup. eep! 4136 27374 4137 27374 ;__boxx1 = accumulator 4138 27374 ;__boxy1 = y 4139 27374 00 44 __boxw1 = temp3 4140 27374 00 45 __boxh1 = temp4 4141 27374 4142 27374 00 46 __boxx2 = temp5 4143 27374 00 47 __boxy2 = temp6 4144 27374 00 48 __boxw2 = temp7 4145 27374 00 49 __boxh2 = temp8 4146 27374 4147 27374 DoXCollisionCheck 4148 27374 ;lda __boxx1 ; skipped. already in the accumulator 4149 27374 c5 46 cmp __boxx2 ;3 4150 27376 b0 07 bcs X1isbiggerthanX2 ;2/3 4151 27378 X2isbiggerthanX1 4152 27378 ; carry is clear 4153 27378 65 44 adc __boxw1 ;3 4154 2737a c5 46 cmp __boxx2 ;3 4155 2737c b0 08 bcs DoYCollisionCheck ;3/2 4156 2737e 60 rts ;6 - carry clear, no collision 4157 2737f X1isbiggerthanX2 4158 2737f 18 clc ;2 4159 27380 e5 48 sbc __boxw2 ;3 4160 27382 c5 46 cmp __boxx2 ;3 4161 27384 b0 13 bcs noboxcollision ;3/2 4162 27386 DoYCollisionCheck 4163 27386 98 tya ; 2 ; use to be "lda __boxy1" 4164 27387 c5 47 cmp __boxy2 ;3 4165 27389 b0 05 bcs Y1isbiggerthanY2 ;3/2 4166 2738b Y2isbiggerthanY1 4167 2738b ; carry is clear 4168 2738b 65 45 adc __boxh1 ;3 4169 2738d c5 47 cmp __boxy2 ;3 4170 2738f 60 rts ;6 4171 27390 Y1isbiggerthanY2 4172 27390 18 clc ;2 4173 27391 e5 49 sbc __boxh2 ;3 4174 27393 c5 47 cmp __boxy2 ;3 4175 27395 b0 02 bcs noboxcollision ;3/2 4176 27397 yesboxcollision 4177 27397 38 sec ;2 4178 27398 60 rts ;6 4179 27399 noboxcollision 4180 27399 18 clc ;2 4181 2739a 60 rts ;6 4182 2739b endif ; BOXCOLLISION 4183 2739b 4184 2739b randomize 4185 2739b a5 40 lda rand 4186 2739d 4a lsr 4187 2739e 26 41 rol rand16 4188 273a0 90 02 bcc noeor 4189 273a2 49 b4 eor #$B4 4190 273a4 noeor 4191 273a4 85 40 sta rand 4192 273a6 45 41 eor rand16 4193 273a8 60 rts 4194 273a9 4195 273a9 ; *** bcd conversion routine courtesy Omegamatrix 4196 273a9 ; *** http://atariage.com/forums/blog/563/entry-10832-hex-to-bcd-conversion-0-99/ 4197 273a9 converttobcd 4198 273a9 ;value to convert is in the accumulator 4199 273a9 85 42 sta temp1 4200 273ab 4a lsr 4201 273ac 65 42 adc temp1 4202 273ae 6a ror 4203 273af 4a lsr 4204 273b0 4a lsr 4205 273b1 65 42 adc temp1 4206 273b3 6a ror 4207 273b4 65 42 adc temp1 4208 273b6 6a ror 4209 273b7 4a lsr 4210 273b8 29 3c and #$3C 4211 273ba 85 43 sta temp2 4212 273bc 4a lsr 4213 273bd 65 43 adc temp2 4214 273bf 65 42 adc temp1 4215 273c1 60 rts ; return the result in the accumulator 4216 273c2 4217 273c2 ; Y and A contain multiplicands, result in A 4218 273c2 mul8 4219 273c2 84 42 sty temp1 4220 273c4 85 43 sta temp2 4221 273c6 a9 00 lda #0 4222 273c8 reptmul8 4223 273c8 46 43 lsr temp2 4224 273ca 90 03 bcc skipmul8 4225 273cc 18 clc 4226 273cd 65 42 adc temp1 4227 273cf ;bcs donemul8 might save cycles? 4228 273cf skipmul8 4229 273cf ;beq donemul8 might save cycles? 4230 273cf 06 42 asl temp1 4231 273d1 d0 f5 bne reptmul8 4232 273d3 donemul8 4233 273d3 60 rts 4234 273d4 4235 273d4 div8 4236 273d4 ; A=numerator Y=denominator, result in A 4237 273d4 c0 02 cpy #2 4238 273d6 90 0a bcc div8end+1 ;div by 0 = bad, div by 1=no calc needed, so bail out 4239 273d8 84 42 sty temp1 4240 273da a0 ff ldy #$ff 4241 273dc div8loop 4242 273dc e5 42 sbc temp1 4243 273de c8 iny 4244 273df b0 fb bcs div8loop 4245 273e1 div8end 4246 273e1 98 tya 4247 273e2 ; result in A 4248 273e2 60 rts 4249 273e3 4250 273e3 ; Y and A contain multiplicands, result in temp2,A=low, temp1=high 4251 273e3 mul16 4252 273e3 84 42 sty temp1 4253 273e5 85 43 sta temp2 4254 273e7 4255 273e7 a9 00 lda #0 4256 273e9 a2 08 ldx #8 4257 273eb 46 42 lsr temp1 4258 273ed mul16_1 4259 273ed 90 03 bcc mul16_2 4260 273ef 18 clc 4261 273f0 65 43 adc temp2 4262 273f2 mul16_2 4263 273f2 6a ror 4264 273f3 66 42 ror temp1 4265 273f5 ca dex 4266 273f6 d0 f5 bne mul16_1 4267 273f8 85 43 sta temp2 4268 273fa 60 rts 4269 273fb 4270 273fb ; div int/int 4271 273fb ; numerator in A, denom in temp1 4272 273fb ; returns with quotient in A, remainder in temp1 4273 273fb div16 4274 273fb 85 43 sta temp2 4275 273fd 84 42 sty temp1 4276 273ff a9 00 lda #0 4277 27401 a2 08 ldx #8 4278 27403 06 43 asl temp2 4279 27405 div16_1 4280 27405 2a rol 4281 27406 c5 42 cmp temp1 4282 27408 90 02 bcc div16_2 4283 2740a e5 42 sbc temp1 4284 2740c div16_2 4285 2740c 26 43 rol temp2 4286 2740e ca dex 4287 2740f d0 f4 bne div16_1 4288 27411 85 42 sta temp1 4289 27413 a5 43 lda temp2 4290 27415 60 rts 4291 27416 4292 27416 ifconst bankswitchmode 4293 27416 BS_jsr 4294 27416 - ifconst dumpbankswitch 4295 27416 - sta dumpbankswitch 4296 27416 endif 4297 27416 - ifconst MCPDEVCART 4298 27416 - ora #$18 4299 27416 - sta $3000 4300 27416 else 4301 27416 8d 00 80 sta $8000 4302 27419 endif 4303 27419 68 pla 4304 2741a aa tax 4305 2741b 68 pla 4306 2741c 60 rts 4307 2741d 4308 2741d BS_return 4309 2741d 68 pla ; bankswitch bank 4310 2741e - ifconst dumpbankswitch 4311 2741e - sta dumpbankswitch 4312 2741e endif 4313 2741e - ifconst BANKRAM 4314 2741e - sta currentbank 4315 2741e - ora currentrambank 4316 2741e endif 4317 2741e - ifconst MCPDEVCART 4318 2741e - ora #$18 4319 2741e - sta $3000 4320 2741e else 4321 2741e 8d 00 80 sta $8000 4322 27421 endif 4323 27421 68 pla ; bankswitch $0 flag 4324 27422 60 rts 4325 27423 endif 4326 27423 4327 27423 checkselectswitch 4328 27423 ad 82 02 lda SWCHB ; first check the real select switch... 4329 27426 29 02 and #%00000010 4330 27428 ifnconst MOUSESUPPORT 4331 27428 f0 05 beq checkselectswitchreturn ; switch is pressed 4332 2742a ad 80 02 lda SWCHA ; then check the soft "select" joysick code... 4333 2742d 29 b0 and #%10110000 ; R_DU 4334 2742f endif ; MOUSESUPPORT 4335 2742f checkselectswitchreturn 4336 2742f 60 rts 4337 27430 4338 27430 checkresetswitch 4339 27430 ad 82 02 lda SWCHB ; first check the real reset switch... 4340 27433 29 01 and #%00000001 4341 27435 ifnconst MOUSESUPPORT 4342 27435 f0 05 beq checkresetswitchreturn ; switch is pressed 4343 27437 ad 80 02 lda SWCHA ; then check the soft "reset" joysick code... 4344 2743a 29 70 and #%01110000 ; _LDU 4345 2743c endif ; MOUSESUPPORT 4346 2743c checkresetswitchreturn 4347 2743c 60 rts 4348 2743d 4349 2743d - ifconst FINESCROLLENABLED 4350 2743d -finescrolldlls 4351 2743d - ldx temp1 ; first DLL index x3 4352 2743d - lda DLLMEM,x 4353 2743d - and #%11110000 4354 2743d - ora finescrolly 4355 2743d - sta DLLMEM,x 4356 2743d - 4357 2743d - ldx temp2 ; last DLL index x3 4358 2743d - lda DLLMEM,x 4359 2743d - and #%11110000 4360 2743d - ora finescrolly 4361 2743d - eor #(WZONEHEIGHT-1) 4362 2743d - sta DLLMEM,x 4363 2743d - rts 4364 2743d endif ; FINESCROLLENABLED 4365 2743d 4366 2743d - ifconst USED_ADJUSTVISIBLE 4367 2743d -adjustvisible 4368 2743d - ; called with temp1=first visible zone *3, temp2=last visible zone *3 4369 2743d - jsr waitforvblankstart ; ensure vblank just started 4370 2743d - ldx visibleDLLstart 4371 2743d -findfirstinterrupt 4372 2743d - lda DLLMEM,x 4373 2743d - bmi foundfirstinterrupt 4374 2743d - inx 4375 2743d - inx 4376 2743d - inx 4377 2743d - bne findfirstinterrupt 4378 2743d -foundfirstinterrupt 4379 2743d - and #%01111111 ; clear the interrupt bit 4380 2743d - sta DLLMEM,x 4381 2743d - ifconst DOUBLEBUFFER 4382 2743d - sta DLLMEM+DBOFFSET,x 4383 2743d - endif ; DOUBLEBUFFER 4384 2743d - ldx overscanDLLstart 4385 2743d -findlastinterrupt 4386 2743d - lda DLLMEM,x 4387 2743d - bmi foundlastinterrupt 4388 2743d - dex 4389 2743d - dex 4390 2743d - dex 4391 2743d - bne findlastinterrupt 4392 2743d -foundlastinterrupt 4393 2743d - and #%01111111 ; clear the interrupt bit 4394 2743d - sta DLLMEM,x 4395 2743d - ifconst DOUBLEBUFFER 4396 2743d - sta DLLMEM+DBOFFSET,x 4397 2743d - endif ; DOUBLEBUFFER 4398 2743d - ;now we need to set the new interrupts 4399 2743d - clc 4400 2743d - lda temp1 4401 2743d - adc visibleDLLstart 4402 2743d - tax 4403 2743d - lda DLLMEM,x 4404 2743d - ora #%10000000 4405 2743d - sta DLLMEM,x 4406 2743d - ifconst DOUBLEBUFFER 4407 2743d - sta DLLMEM+DBOFFSET,x 4408 2743d - endif ; DOUBLEBUFFER 4409 2743d - clc 4410 2743d - lda temp2 4411 2743d - adc visibleDLLstart 4412 2743d - tax 4413 2743d - lda DLLMEM,x 4414 2743d - ora #%10000000 4415 2743d - sta DLLMEM,x 4416 2743d - ifconst DOUBLEBUFFER 4417 2743d - sta DLLMEM+DBOFFSET,x 4418 2743d - endif ; DOUBLEBUFFER 4419 2743d - jsr vblankresync 4420 2743d - rts 4421 2743d endif ; USED_ADJUSTVISIBLE 4422 2743d 4423 2743d vblankresync 4424 2743d 20 db f4 jsr waitforvblankstart ; ensure vblank just started 4425 27440 a9 00 lda #0 4426 27442 85 4d sta visibleover 4427 27444 a9 03 lda #3 4428 27446 8d b2 01 sta interruptindex 4429 27449 60 rts 4430 2744a 4431 2744a createallgamedlls 4432 2744a a2 00 ldx #0 4433 2744c a9 19 lda #NVLINES 4434 2744e ac 09 21 ldy paldetected 4435 27451 f0 03 beq skipcreatePALpadding 4436 27453 18 clc 4437 27454 69 15 adc #21 4438 27456 skipcreatePALpadding 4439 27456 20 8b f4 jsr createnonvisibledlls 4440 27459 8e 3c 21 stx visibleDLLstart 4441 2745c 20 bc f4 jsr createvisiblezones 4442 2745f 8e 3d 21 stx overscanDLLstart 4443 27462 createallgamedllscontinue 4444 27462 a9 50 lda #(NVLINES+55) ; extras for PAL 4445 27464 20 8b f4 jsr createnonvisibledlls 4446 27467 4447 27467 ae 3c 21 ldx visibleDLLstart 4448 2746a bd 00 18 lda DLLMEM,x 4449 2746d 09 80 ora #%10000000 ; NMI 1 - start of visible screen 4450 2746f 9d 00 18 sta DLLMEM,x 4451 27472 - ifconst DOUBLEBUFFER 4452 27472 - sta DLLMEM+DBOFFSET,x 4453 27472 endif ; DOUBLEBUFFER 4454 27472 4455 27472 ae 3d 21 ldx overscanDLLstart 4456 27475 bd 00 18 lda DLLMEM,x 4457 27478 09 83 ora #%10000011 ; NMI 2 - end of visible screen 4458 2747a 29 f3 and #%11110011 ; change this to a 1-line DLL, so there's time enough for the "deeper overscan" DLL 4459 2747c 9d 00 18 sta DLLMEM,x 4460 2747f - ifconst DOUBLEBUFFER 4461 2747f - sta DLLMEM+DBOFFSET,x 4462 2747f endif ; DOUBLEBUFFER 4463 2747f 4464 2747f e8 inx 4465 27480 e8 inx 4466 27481 e8 inx 4467 27482 4468 27482 bd 00 18 lda DLLMEM,x 4469 27485 09 80 ora #%10000000 ; NMI 3 - deeper overscan 4470 27487 9d 00 18 sta DLLMEM,x 4471 2748a - ifconst DOUBLEBUFFER 4472 2748a - sta DLLMEM+DBOFFSET,x 4473 2748a endif ; DOUBLEBUFFER 4474 2748a 4475 2748a 60 rts 4476 2748b 4477 2748b createnonvisibledlls 4478 2748b 85 42 sta temp1 4479 2748d 4a lsr 4480 2748e 4a lsr 4481 2748f 4a lsr 4482 27490 4a lsr ; /16 4483 27491 f0 09 beq skipcreatenonvisibledlls1loop 4484 27493 a8 tay 4485 27494 createnonvisibledlls1loop 4486 27494 a9 4f lda #%01001111 ;low nibble=16 lines, high nibble=Holey DMA 4487 27496 20 ab f4 jsr createblankdllentry 4488 27499 88 dey 4489 2749a d0 f8 bne createnonvisibledlls1loop 4490 2749c skipcreatenonvisibledlls1loop 4491 2749c a5 42 lda temp1 4492 2749e 29 0f and #%00001111 4493 274a0 f0 08 beq createnonvisibledllsreturn 4494 274a2 38 sec 4495 274a3 e9 01 sbc #1 4496 274a5 09 40 ora #%01000000 4497 274a7 20 ab f4 jsr createblankdllentry 4498 274aa createnonvisibledllsreturn 4499 274aa 60 rts 4500 274ab 4501 274ab createblankdllentry 4502 274ab 9d 00 18 sta DLLMEM,x 4503 274ae - ifconst DOUBLEBUFFER 4504 274ae - sta DLLMEM+DBOFFSET,x 4505 274ae endif ; DOUBLEBUFFER 4506 274ae e8 inx 4507 274af a9 21 lda #$21 ; blank 4508 274b1 9d 00 18 sta DLLMEM,x 4509 274b4 - ifconst DOUBLEBUFFER 4510 274b4 - sta DLLMEM+DBOFFSET,x 4511 274b4 endif ; DOUBLEBUFFER 4512 274b4 e8 inx 4513 274b5 a9 00 lda #$00 4514 274b7 9d 00 18 sta DLLMEM,x 4515 274ba - ifconst DOUBLEBUFFER 4516 274ba - sta DLLMEM+DBOFFSET,x 4517 274ba endif ; DOUBLEBUFFER 4518 274ba e8 inx 4519 274bb 60 rts 4520 274bc 4521 274bc createvisiblezones 4522 274bc a0 00 ldy #0 4523 274be createvisiblezonesloop 4524 274be b9 26 f6 lda.w DLHEIGHT,y 4525 274c1 09 40 ora #(WZONEHEIGHT * 4) ; set Holey DMA for 8 or 16 tall zones 4526 274c3 9d 00 18 sta DLLMEM,x 4527 274c6 - ifconst DOUBLEBUFFER 4528 274c6 - sta DLLMEM+DBOFFSET,x 4529 274c6 endif ; DOUBLEBUFFER 4530 274c6 e8 inx 4531 274c7 b9 0e f6 lda DLPOINTH,y 4532 274ca 9d 00 18 sta DLLMEM,x 4533 274cd - ifconst DOUBLEBUFFER 4534 274cd - sta DLLMEM+DBOFFSET,x 4535 274cd endif ; DOUBLEBUFFER 4536 274cd e8 inx 4537 274ce b9 1a f6 lda DLPOINTL,y 4538 274d1 9d 00 18 sta DLLMEM,x 4539 274d4 - ifconst DOUBLEBUFFER 4540 274d4 - clc 4541 274d4 - adc #DOUBLEBUFFEROFFSET 4542 274d4 - sta DLLMEM+DBOFFSET,x 4543 274d4 - bcc skiphidoublebufferadjust ; dlls are big endian, so we need to fix the hi byte after-the-fact... 4544 274d4 - inc DLLMEM+DBOFFSET-1,x 4545 274d4 -skiphidoublebufferadjust 4546 274d4 endif ; DOUBLEBUFFER 4547 274d4 e8 inx 4548 274d5 c8 iny 4549 274d6 c0 0c cpy #WZONECOUNT 4550 274d8 d0 e4 bne createvisiblezonesloop 4551 274da 60 rts 4552 274db 4553 274db waitforvblankstart 4554 274db vblankendwait 4555 274db 24 28 BIT MSTAT 4556 274dd 30 fc bmi vblankendwait 4557 274df vblankstartwait 4558 274df 24 28 BIT MSTAT 4559 274e1 10 fc bpl vblankstartwait 4560 274e3 60 rts 4561 274e4 4562 274e4 - ifconst DOUBLEBUFFER 4563 274e4 -flipdisplaybufferreturn 4564 274e4 - rts 4565 274e4 -flipdisplaybuffer 4566 274e4 - ifconst interrupthold 4567 274e4 - lda #$FF 4568 274e4 - sta interrupthold 4569 274e4 - endif 4570 274e4 - lda doublebufferstate 4571 274e4 - beq flipdisplaybufferreturn ; exit if we're not in double-buffer 4572 274e4 - 4573 274e4 - jsr terminatedisplaybuffer ; terminate the working buffer before we flip 4574 274e4 - 4575 274e4 - lda doublebufferstate 4576 274e4 - lsr ; /2, so we'll see 0 or 1, rather than 1 or 3 4577 274e4 - tax 4578 274e4 - 4579 274e4 - ; ensure we don't flip mid-display. otherwise the displayed DL will be the one the game is working on. 4580 274e4 - 4581 274e4 -flipdisplaybufferwait1 4582 274e4 - lda visibleover 4583 274e4 - beq flipdisplaybufferwait1 4584 274e4 - 4585 274e4 -flipdisplaybufferwait 4586 274e4 - lda visibleover 4587 274e4 - bne flipdisplaybufferwait 4588 274e4 - 4589 274e4 - lda doublebufferminimumframetarget 4590 274e4 - beq skipminimumframecode 4591 274e4 - lda doublebufferminimumframeindex 4592 274e4 - bne flipdisplaybufferwait1 4593 274e4 - lda doublebufferminimumframetarget 4594 274e4 - sta doublebufferminimumframeindex 4595 274e4 -skipminimumframecode 4596 274e4 - 4597 274e4 - lda DLLMEMLutHi,x 4598 274e4 - sta DPPH 4599 274e4 - lda DLLMEMLutLo,x 4600 274e4 - sta DPPL 4601 274e4 - 4602 274e4 - lda NewPageflipstate,x 4603 274e4 - sta doublebufferstate 4604 274e4 - lda NewPageflipoffset,x 4605 274e4 - sta doublebufferdloffset 4606 274e4 - 4607 274e4 - lda doublebufferbufferdirty 4608 274e4 - beq flipdisplaybufferreturn 4609 274e4 - 4610 274e4 - ; The doublebuffer buffer is dirty, so the game code must have issued a savescreen recently. 4611 274e4 - ; To make savescreen work with the new working buffer, we need to copy over the saved objects 4612 274e4 - ; from the displayed buffer to the working buffer... 4613 274e4 - 4614 274e4 - lda doublebufferdloffset 4615 274e4 - eor #DOUBLEBUFFEROFFSET 4616 274e4 - sta temp6 ; make temp6 the anti-doublebufferdloffset variable 4617 274e4 - 4618 274e4 - ldx #(WZONECOUNT-1) 4619 274e4 -copybufferzoneloop 4620 274e4 - 4621 274e4 - lda DLPOINTL,x 4622 274e4 - clc 4623 274e4 - adc doublebufferdloffset 4624 274e4 - sta temp1 4625 274e4 - lda DLPOINTH,x 4626 274e4 - adc #0 4627 274e4 - sta temp2 4628 274e4 - 4629 274e4 - lda DLPOINTL,x 4630 274e4 - clc 4631 274e4 - adc temp6 4632 274e4 - sta temp3 4633 274e4 - lda DLPOINTH,x 4634 274e4 - adc #0 4635 274e4 - sta temp4 4636 274e4 - 4637 274e4 - lda dlendsave,x 4638 274e4 - tay 4639 274e4 -copybuffercharsloop 4640 274e4 - lda (temp3),y 4641 274e4 - sta (temp1),y 4642 274e4 - dey 4643 274e4 - bpl copybuffercharsloop 4644 274e4 - dex 4645 274e4 - bpl copybufferzoneloop 4646 274e4 - lda #0 4647 274e4 - sta doublebufferbufferdirty 4648 274e4 - rts 4649 274e4 - 4650 274e4 -doublebufferoff 4651 274e4 - lda #1 4652 274e4 - sta doublebufferstate 4653 274e4 - jsr flipdisplaybuffer 4654 274e4 - lda #0 4655 274e4 - sta doublebufferstate 4656 274e4 - sta doublebufferdloffset 4657 274e4 - rts 4658 274e4 - 4659 274e4 -DLLMEMLutLo 4660 274e4 - .byte DLLMEM,>(DLLMEM+DBOFFSET) 4663 274e4 -NewPageflipstate 4664 274e4 - .byte 3,1 4665 274e4 -NewPageflipoffset 4666 274e4 - .byte DOUBLEBUFFEROFFSET,0 4667 274e4 - 4668 274e4 endif ; DOUBLEBUFFER 4669 274e4 4670 274e4 - ifconst MOUSESUPPORT 4671 274e4 - 4672 274e4 -rotationalcompare 4673 274e4 - ; old = 00 01 10 11 4674 274e4 - .byte $00, $01, $ff, $00 ; new=00 4675 274e4 - .byte $ff, $00, $00, $01 ; new=01 4676 274e4 - .byte $01, $00, $00, $ff ; new=10 4677 274e4 - .byte $00, $ff, $01, $00 ; new=11 4678 274e4 - 4679 274e4 - ; 0000YyXx st mouse 4680 274e4 - 4681 274e4 - ; 0000xyXY amiga mouse 4682 274e4 - 4683 274e4 - ifconst MOUSEXONLY 4684 274e4 -amigatoataribits ; swap bits 1 and 4... 4685 274e4 - .byte %0000, %0000, %0010, %0010 4686 274e4 - .byte %0000, %0000, %0010, %0010 4687 274e4 - .byte %0001, %0001, %0011, %0011 4688 274e4 - .byte %0001, %0001, %0011, %0011 4689 274e4 - 4690 274e4 - ; null change bits 4691 274e4 - .byte %0000, %0001, %0010, %0011 4692 274e4 - .byte %0000, %0001, %0010, %0011 4693 274e4 - .byte %0000, %0001, %0010, %0011 4694 274e4 - .byte %0000, %0001, %0010, %0011 4695 274e4 - 4696 274e4 - else ; !MOUSEXONLY 4697 274e4 - 4698 274e4 -amigatoataribits ; swap bits 1 and 4... 4699 274e4 - .byte %0000, %1000, %0010, %1010 4700 274e4 - .byte %0100, %1100, %0110, %1110 4701 274e4 - .byte %0001, %1001, %0011, %1011 4702 274e4 - .byte %0101, %1101, %0111, %1111 4703 274e4 - ; null change bits 4704 274e4 - .byte %0000, %0001, %0010, %0011 4705 274e4 - .byte %0100, %0101, %0110, %0111 4706 274e4 - .byte %1000, %1001, %1010, %1011 4707 274e4 - .byte %1100, %1101, %1110, %1111 4708 274e4 - endif ; !MOUSEXONLY 4709 274e4 - 4710 274e4 endif ; MOUSESUPPORT 4711 274e4 4712 274e4 mouse0update 4713 274e4 - ifconst MOUSE0SUPPORT 4714 274e4 - 4715 274e4 -mousetableselect = inttemp2 4716 274e4 -mousexdelta = inttemp3 4717 274e4 -mouseydelta = inttemp4 4718 274e4 -lastSWCHA = inttemp6 4719 274e4 - 4720 274e4 - ; 0000YyXx st mouse 4721 274e4 - ; 0000xyXY amiga mouse 4722 274e4 - 4723 274e4 - lda #$ff 4724 274e4 - sta lastSWCHA 4725 274e4 - 4726 274e4 - ldy port0control 4727 274e4 - 4728 274e4 - lda #%00010000 4729 274e4 - cpy #9 ; AMIGA? 4730 274e4 - bne skipamigabitsfix0 4731 274e4 - lda #0 4732 274e4 -skipamigabitsfix0 4733 274e4 - sta mousetableselect 4734 274e4 - ifconst DRIVINGBOOST 4735 274e4 - cpy #6 ; DRIVING? 4736 274e4 - bne skipdriving0setup 4737 274e4 - ; swap mousex0 and mousey0. mousex seen by the 7800basic program 4738 274e4 - ; trails the actual mousex0, so we can smoothly interpolate toward 4739 274e4 - ; the actual position. This actual position is stored in mousey0 4740 274e4 - ; after the driver has run. 4741 274e4 - ldx mousex0 4742 274e4 - lda mousey0 4743 274e4 - stx mousey0 4744 274e4 - sta mousex0 4745 274e4 -skipdriving0setup 4746 274e4 - endif ; DRIVINGBOOST 4747 274e4 - 4748 274e4 - lda #0 4749 274e4 - sta mousexdelta 4750 274e4 - sta mouseydelta 4751 274e4 - 4752 274e4 - ifnconst MOUSETIME 4753 274e4 - ifnconst MOUSEXONLY 4754 274e4 - lda #180 ; minimum for x+y 4755 274e4 - else 4756 274e4 - lda #100 ; minimum for just x 4757 274e4 - endif 4758 274e4 - else 4759 274e4 - lda #MOUSETIME 4760 274e4 - endif 4761 274e4 - jsr SETTIM64T ; INTIM is in Y 4762 274e4 - 4763 274e4 -mouse0updateloop 4764 274e4 - lda SWCHA 4765 274e4 - asr #%11110000 ; Undocumented. A = A & #IMM, then LSR A. 4766 274e4 - cmp lastSWCHA 4767 274e4 - beq mouse0loopcondition 4768 274e4 - sta lastSWCHA 4769 274e4 - lsr 4770 274e4 - lsr 4771 274e4 - lsr 4772 274e4 - 4773 274e4 - ora mousetableselect ; atari/amiga decoding table selection 4774 274e4 - 4775 274e4 - ; st mice encode on different bits/joystick-lines than amiga mice... 4776 274e4 - ; 0000YyXx st mouse 4777 274e4 - ; 0000xyXY amiga mouse 4778 274e4 - ; ...so can shuffle the amiga bits to reuse the st driver. 4779 274e4 - tay 4780 274e4 - lax amigatoataribits,y 4781 274e4 - 4782 274e4 - ifnconst MOUSEXONLY 4783 274e4 - ; first the Y... 4784 274e4 - and #%00001100 4785 274e4 - ora mousecodey0 4786 274e4 - tay 4787 274e4 - lda rotationalcompare,y 4788 274e4 - clc 4789 274e4 - adc mouseydelta 4790 274e4 - sta mouseydelta 4791 274e4 - tya 4792 274e4 - lsr 4793 274e4 - lsr 4794 274e4 - sta mousecodey0 4795 274e4 - txa 4796 274e4 - ; ...then the X... 4797 274e4 - and #%00000011 4798 274e4 - tax 4799 274e4 - endif ; !MOUSEXONLY 4800 274e4 - 4801 274e4 - asl 4802 274e4 - asl 4803 274e4 - ora mousecodex0 4804 274e4 - tay 4805 274e4 - lda rotationalcompare,y 4806 274e4 - adc mousexdelta ; carry was clear by previous ASL 4807 274e4 - sta mousexdelta 4808 274e4 - stx mousecodex0 4809 274e4 -mouse0loopcondition 4810 274e4 - lda TIMINT 4811 274e4 - bpl mouse0updateloop 4812 274e4 - 4813 274e4 - ; *** adapt to selected device resolution. 4814 274e4 - ldx port0control 4815 274e4 - 4816 274e4 - ifconst PRECISIONMOUSING 4817 274e4 - ldy port0resolution 4818 274e4 - bne mouse0halveddone 4819 274e4 - cpx #6 ; half-resolution is no good for driving wheels 4820 274e4 - beq mouse0halveddone 4821 274e4 - ; resolution=0 is half mouse resolution, necessary for precision 4822 274e4 - ; mousing on a 160x240 screen with a 1000 dpi mouse. 4823 274e4 - 4824 274e4 - lda mousexdelta 4825 274e4 - cmp #$80 4826 274e4 - ror ; do a signed divide by 2. 4827 274e4 - clc 4828 274e4 - adc mousex0 4829 274e4 - sta mousex0 4830 274e4 - ifnconst MOUSEXONLY 4831 274e4 - lda mouseydelta 4832 274e4 - clc 4833 274e4 - adc mousey0 4834 274e4 - sta mousey0 4835 274e4 - endif 4836 274e4 - ; at half resolution we just exit after updating x and y 4837 274e4 - jmp LLRET0 4838 274e4 -mouse0halveddone 4839 274e4 - endif ; PRECISIONMOUSING 4840 274e4 - 4841 274e4 - ifnconst MOUSEXONLY 4842 274e4 - asl mouseydelta ; *2 because Y resolution is finer 4843 274e4 - ldy port0resolution 4844 274e4 - dey 4845 274e4 - lda #0 4846 274e4 -mousey0resolutionfix 4847 274e4 - clc 4848 274e4 - adc mouseydelta 4849 274e4 - dey 4850 274e4 - bpl mousey0resolutionfix 4851 274e4 - clc 4852 274e4 - adc mousey0 4853 274e4 - sta mousey0 4854 274e4 - endif ; MOUSEXONLY 4855 274e4 - 4856 274e4 - ldy port0resolution 4857 274e4 - dey 4858 274e4 - lda #0 4859 274e4 -mousex0resolutionfix 4860 274e4 - clc 4861 274e4 - adc mousexdelta 4862 274e4 - dey 4863 274e4 - bpl mousex0resolutionfix 4864 274e4 - ifnconst DRIVINGBOOST 4865 274e4 - clc 4866 274e4 - adc mousex0 4867 274e4 - sta mousex0 4868 274e4 - else 4869 274e4 - cpx #6 4870 274e4 - beq carryonmouse0boost 4871 274e4 - clc 4872 274e4 - adc mousex0 4873 274e4 - sta mousex0 4874 274e4 - jmp LLRET0 4875 274e4 -carryonmouse0boost 4876 274e4 - sta mousexdelta 4877 274e4 - clc 4878 274e4 - adc mousecodey0 4879 274e4 - sta mousecodey0 4880 274e4 - clc 4881 274e4 - adc mousex0 4882 274e4 - tay ; save the target X 4883 274e4 - adc mousey0 ; average in the smoothly-trailing X 4884 274e4 - ror 4885 274e4 - sta mousex0 ; mousex0 now has the smoothly trailing X 4886 274e4 - sty mousey0 ; and mousey0 has the the target X 4887 274e4 - 4888 274e4 - ; check to see if the coordinate wrapped. If so, undo the averaging code. 4889 274e4 - ; A has mousex0, the smoothly trailing X 4890 274e4 - sbc mousey0 ; less the target X 4891 274e4 - bpl skipabsolutedrive0 4892 274e4 - eor #$ff 4893 274e4 -skipabsolutedrive0 4894 274e4 - cmp #64 ; just an unreasonably large change 4895 274e4 - bcc skipdrivewrapfix0 4896 274e4 - sty mousex0 ; if X wrapped, we catch the trailing X up to the target X 4897 274e4 -skipdrivewrapfix0 4898 274e4 - 4899 274e4 - ; get rid of the tweening if the distance travelled was very small 4900 274e4 - lda mousexdelta 4901 274e4 - cmp port0resolution 4902 274e4 - bcs skipbetweenfix0 4903 274e4 - lda mousex0 4904 274e4 - sta mousey0 4905 274e4 -skipbetweenfix0 4906 274e4 - 4907 274e4 -drivingboostreductioncheck0 4908 274e4 - ; The below code amounts to mousecodey0=mousecodey0-(mousecodey0/8) 4909 274e4 - ; +ve mousecodey0 is converted to -ve to do the calculation, and then 4910 274e4 - ; negated again because truncation during BCD math results in 4911 274e4 - ; differing magnitudes, depending if the value is +ve or -ve. 4912 274e4 -driving0fix 4913 274e4 - lax mousecodey0 4914 274e4 - cmp #$80 4915 274e4 - bcs driving0skipnegate1 4916 274e4 - eor #$FF 4917 274e4 - adc #1 4918 274e4 - sta mousecodey0 4919 274e4 -driving0skipnegate1 4920 274e4 - cmp #$80 4921 274e4 - ror 4922 274e4 - cmp #$80 4923 274e4 - ror 4924 274e4 - cmp #$80 4925 274e4 - ror 4926 274e4 - sta inttemp1 4927 274e4 - lda mousecodey0 4928 274e4 - sec 4929 274e4 - sbc inttemp1 4930 274e4 - cpx #$80 4931 274e4 - bcs driving0skipnegate2 4932 274e4 - eor #$FF 4933 274e4 - adc #1 4934 274e4 -driving0skipnegate2 4935 274e4 - sta mousecodey0 4936 274e4 -drivingboostdone0 4937 274e4 - endif ; DRIVINGBOOST 4938 274e4 - 4939 274e4 - jmp LLRET0 4940 274e4 - 4941 274e4 endif ; MOUSE0SUPPORT 4942 274e4 4943 274e4 mouse1update 4944 274e4 - ifconst MOUSE1SUPPORT 4945 274e4 - 4946 274e4 -mousetableselect = inttemp2 4947 274e4 -mousexdelta = inttemp3 4948 274e4 -mouseydelta = inttemp4 4949 274e4 -lastSWCHA = inttemp6 4950 274e4 - 4951 274e4 - ; 0000YyXx st mouse 4952 274e4 - ; 0000xyXY amiga mouse 4953 274e4 - 4954 274e4 - lda #$ff 4955 274e4 - sta lastSWCHA 4956 274e4 - 4957 274e4 - ldy port1control 4958 274e4 - 4959 274e4 - lda #%00010000 4960 274e4 - cpy #9 ; AMIGA? 4961 274e4 - bne skipamigabitsfix1 4962 274e4 - lda #0 4963 274e4 -skipamigabitsfix1 4964 274e4 - sta mousetableselect 4965 274e4 - ifconst DRIVINGBOOST 4966 274e4 - cpy #6 ; DRIVING? 4967 274e4 - bne skipdriving1setup 4968 274e4 - ; swap mousex1 and mousey1. mousex seen by the 7800basic program 4969 274e4 - ; trails the actual mousex1, so we can smoothly interpolate toward 4970 274e4 - ; the actual position. This actual position is stored in mousey1 4971 274e4 - ; after the driver has run. 4972 274e4 - ldx mousex1 4973 274e4 - lda mousey1 4974 274e4 - stx mousey1 4975 274e4 - sta mousex1 4976 274e4 -skipdriving1setup 4977 274e4 - endif ; DRIVINGBOOST 4978 274e4 - 4979 274e4 - lda #0 4980 274e4 - sta mousexdelta 4981 274e4 - sta mouseydelta 4982 274e4 - 4983 274e4 - ifnconst MOUSETIME 4984 274e4 - ifnconst MOUSEXONLY 4985 274e4 - lda #180 ; minimum for x+y 4986 274e4 - else 4987 274e4 - lda #100 ; minimum for just x 4988 274e4 - endif 4989 274e4 - else 4990 274e4 - lda #MOUSETIME 4991 274e4 - endif 4992 274e4 - jsr SETTIM64T ; INTIM is in Y 4993 274e4 - 4994 274e4 -mouse1updateloop 4995 274e4 - lda SWCHA 4996 274e4 - and #%00001111 4997 274e4 - cmp lastSWCHA 4998 274e4 - beq mouse1loopcondition 4999 274e4 - sta lastSWCHA 5000 274e4 - 5001 274e4 - ora mousetableselect ; atari/amiga decoding table selection 5002 274e4 - 5003 274e4 - ; st mice encode on different bits/joystick-lines than amiga mice... 5004 274e4 - ; 0000YyXx st mouse 5005 274e4 - ; 0000xyXY amiga mouse 5006 274e4 - ; ...so can shuffle the amiga bits to reuse the st driver. 5007 274e4 - tay 5008 274e4 - lax amigatoataribits,y 5009 274e4 - 5010 274e4 - ifnconst MOUSEXONLY 5011 274e4 - ; first the Y... 5012 274e4 - and #%00001100 5013 274e4 - ora mousecodey1 5014 274e4 - tay 5015 274e4 - lda rotationalcompare,y 5016 274e4 - clc 5017 274e4 - adc mouseydelta 5018 274e4 - sta mouseydelta 5019 274e4 - tya 5020 274e4 - lsr 5021 274e4 - lsr 5022 274e4 - sta mousecodey1 5023 274e4 - txa 5024 274e4 - ; ...then the X... 5025 274e4 - and #%00000011 5026 274e4 - tax 5027 274e4 - endif ; !MOUSEXONLY 5028 274e4 - 5029 274e4 - asl 5030 274e4 - asl 5031 274e4 - ora mousecodex1 5032 274e4 - tay 5033 274e4 - lda rotationalcompare,y 5034 274e4 - adc mousexdelta ; carry was clear by previous ASL 5035 274e4 - sta mousexdelta 5036 274e4 - stx mousecodex1 5037 274e4 -mouse1loopcondition 5038 274e4 - lda TIMINT 5039 274e4 - bpl mouse1updateloop 5040 274e4 - 5041 274e4 - ; *** adapt to selected device resolution. 5042 274e4 - ldx port1control 5043 274e4 - 5044 274e4 - ifconst PRECISIONMOUSING 5045 274e4 - ldy port1resolution 5046 274e4 - bne mouse1halveddone 5047 274e4 - cpx #6 ; half-resolution is no good for driving wheels 5048 274e4 - beq mouse1halveddone 5049 274e4 - ; resolution=0 is half mouse resolution, necessary for precision 5050 274e4 - ; mousing on a 160x240 screen with a 1000 dpi mouse. 5051 274e4 - 5052 274e4 - lda mousexdelta 5053 274e4 - cmp #$80 5054 274e4 - ror ; do a signed divide by 2. 5055 274e4 - clc 5056 274e4 - adc mousex1 5057 274e4 - sta mousex1 5058 274e4 - ifnconst MOUSEXONLY 5059 274e4 - lda mouseydelta 5060 274e4 - clc 5061 274e4 - adc mousey1 5062 274e4 - sta mousey1 5063 274e4 - endif 5064 274e4 - ; at half resolution we just exit after updating x and y 5065 274e4 - jmp LLRET1 5066 274e4 -mouse1halveddone 5067 274e4 - endif ; PRECISIONMOUSING 5068 274e4 - 5069 274e4 - ifnconst MOUSEXONLY 5070 274e4 - asl mouseydelta ; *2 because Y resolution is finer 5071 274e4 - ldy port1resolution 5072 274e4 - dey 5073 274e4 - lda #0 5074 274e4 -mousey1resolutionfix 5075 274e4 - clc 5076 274e4 - adc mouseydelta 5077 274e4 - dey 5078 274e4 - bpl mousey1resolutionfix 5079 274e4 - clc 5080 274e4 - adc mousey1 5081 274e4 - sta mousey1 5082 274e4 - endif ; MOUSEXONLY 5083 274e4 - 5084 274e4 - ldy port1resolution 5085 274e4 - dey 5086 274e4 - lda #0 5087 274e4 -mousex1resolutionfix 5088 274e4 - clc 5089 274e4 - adc mousexdelta 5090 274e4 - dey 5091 274e4 - bpl mousex1resolutionfix 5092 274e4 - ifnconst DRIVINGBOOST 5093 274e4 - clc 5094 274e4 - adc mousex1 5095 274e4 - sta mousex1 5096 274e4 - else 5097 274e4 - cpx #6 5098 274e4 - beq carryonmouse1boost 5099 274e4 - clc 5100 274e4 - adc mousex1 5101 274e4 - sta mousex1 5102 274e4 - jmp LLRET1 5103 274e4 -carryonmouse1boost 5104 274e4 - sta mousexdelta 5105 274e4 - clc 5106 274e4 - adc mousecodey1 5107 274e4 - sta mousecodey1 5108 274e4 - clc 5109 274e4 - adc mousex1 5110 274e4 - tay ; save the target X 5111 274e4 - adc mousey1 ; average in the smoothly-trailing X 5112 274e4 - ror 5113 274e4 - sta mousex1 ; mousex0 now has the smoothly trailing X 5114 274e4 - sty mousey1 ; and mousey0 has the the target X 5115 274e4 - 5116 274e4 - ; check to see if the coordinate wrapped. If so, undo the averaging code. 5117 274e4 - ; A has mousex1, the smoothly trailing X 5118 274e4 - sbc mousey1 ; less the target X 5119 274e4 - bpl skipabsolutedrive1 5120 274e4 - eor #$ff 5121 274e4 -skipabsolutedrive1 5122 274e4 - cmp #64 ; just an unreasonably large change 5123 274e4 - bcc skipdrivewrapfix1 5124 274e4 - sty mousex1 ; if X wrapped, we catch the trailing X up to the target X 5125 274e4 -skipdrivewrapfix1 5126 274e4 - 5127 274e4 - ; get rid of the tweening if the distance travelled was very small 5128 274e4 - lda mousexdelta 5129 274e4 - cmp port1resolution 5130 274e4 - bcs skipbetweenfix1 5131 274e4 - lda mousex1 5132 274e4 - sta mousey1 5133 274e4 -skipbetweenfix1 5134 274e4 - 5135 274e4 -drivingboostreductioncheck1 5136 274e4 - ; The below code amounts to mousecodey0=mousecodey0-(mousecodey0/8) 5137 274e4 - ; +ve mousecodey0 is converted to -ve to do the calculation, and then 5138 274e4 - ; negated again because truncation during BCD math results in 5139 274e4 - ; differing magnitudes, depending if the value is +ve or -ve. 5140 274e4 -driving1fix 5141 274e4 - lax mousecodey1 5142 274e4 - cmp #$80 5143 274e4 - bcs driving0skipnegate1 5144 274e4 - eor #$FF 5145 274e4 - adc #1 5146 274e4 - sta mousecodey1 5147 274e4 -driving0skipnegate1 5148 274e4 - cmp #$80 5149 274e4 - ror 5150 274e4 - cmp #$80 5151 274e4 - ror 5152 274e4 - cmp #$80 5153 274e4 - ror 5154 274e4 - sta inttemp1 5155 274e4 - lda mousecodey1 5156 274e4 - sec 5157 274e4 - sbc inttemp1 5158 274e4 - cpx #$80 5159 274e4 - bcs driving1skipnegate2 5160 274e4 - eor #$FF 5161 274e4 - adc #1 5162 274e4 -driving1skipnegate2 5163 274e4 - sta mousecodey1 5164 274e4 -drivingboostdone1 5165 274e4 - endif ; DRIVINGBOOST 5166 274e4 - 5167 274e4 - jmp LLRET1 5168 274e4 - 5169 274e4 endif ; MOUSE1SUPPORT 5170 274e4 5171 274e4 5172 274e4 trakball0update 5173 274e4 - ifconst TRAKBALL0SUPPORT 5174 274e4 - ifnconst TRAKTIME 5175 274e4 - ifnconst TRAKXONLY 5176 274e4 - lda #180 ; minimum for x+y 5177 274e4 - else ; !TRAKXONLY 5178 274e4 - lda #100 ; minimum for just x 5179 274e4 - endif ; !TRAKXONLY 5180 274e4 - else ; !TRAKTIME 5181 274e4 - lda #TRAKTIME 5182 274e4 - endif ; !TRAKTIME 5183 274e4 - jsr SETTIM64T ; INTIM is in Y 5184 274e4 - ldx #0 5185 274e4 - ifnconst TRAKXONLY 5186 274e4 - ldy #0 5187 274e4 - endif ; TRAKXONLY 5188 274e4 -trakball0updateloop 5189 274e4 - lda SWCHA 5190 274e4 - and #%00110000 5191 274e4 - cmp trakballcodex0 5192 274e4 - sta trakballcodex0 5193 274e4 - beq trakball0movementXdone 5194 274e4 - and #%00010000 5195 274e4 - beq trakball0negativeX 5196 274e4 -trakball0positiveX 5197 274e4 - ;(2 from beq) 5198 274e4 - inx ; 2 5199 274e4 - jmp trakball0movementXdone ; 3 5200 274e4 -trakball0negativeX 5201 274e4 - ;(3 from beq) 5202 274e4 - dex ; 2 5203 274e4 - nop ; 2 5204 274e4 -trakball0movementXdone 5205 274e4 - 5206 274e4 - ifnconst TRAKXONLY 5207 274e4 - lda SWCHA 5208 274e4 - and #%11000000 5209 274e4 - cmp trakballcodey0 5210 274e4 - sta trakballcodey0 5211 274e4 - beq trakball0movementYdone 5212 274e4 - and #%01000000 5213 274e4 - beq trakball0negativeY 5214 274e4 -trakball0positiveY 5215 274e4 - ;(2 from beq) 5216 274e4 - iny ; 2 5217 274e4 - jmp trakball0movementYdone ; 3 5218 274e4 -trakball0negativeY 5219 274e4 - ;(3 from beq) 5220 274e4 - dey ; 2 5221 274e4 - nop ; 2 5222 274e4 -trakball0movementYdone 5223 274e4 - endif ; !TRAKXONLY 5224 274e4 - 5225 274e4 - lda TIMINT 5226 274e4 - bpl trakball0updateloop 5227 274e4 - lda #0 5228 274e4 - cpx #0 5229 274e4 - beq trakball0skipXadjust 5230 274e4 - clc 5231 274e4 -trakball0Xloop 5232 274e4 - adc port0resolution 5233 274e4 - dex 5234 274e4 - bne trakball0Xloop 5235 274e4 - clc 5236 274e4 - adc trakballx0 5237 274e4 - sta trakballx0 5238 274e4 -trakball0skipXadjust 5239 274e4 - ifnconst TRAKXONLY 5240 274e4 - lda #0 5241 274e4 - cpy #0 5242 274e4 - beq trakball0skipYadjust 5243 274e4 - clc 5244 274e4 -trakball0yloop 5245 274e4 - adc port0resolution 5246 274e4 - dey 5247 274e4 - bne trakball0yloop 5248 274e4 - clc 5249 274e4 - adc trakbally0 5250 274e4 - sta trakbally0 5251 274e4 -trakball0skipYadjust 5252 274e4 - endif ; !TRAKXONLY 5253 274e4 - 5254 274e4 - jmp LLRET0 5255 274e4 endif 5256 274e4 5257 274e4 5258 274e4 5259 274e4 trakball1update 5260 274e4 - ifconst TRAKBALL1SUPPORT 5261 274e4 - ifnconst TRAKTIME 5262 274e4 - ifnconst TRAKXONLY 5263 274e4 - lda #180 ; minimum for x+y 5264 274e4 - else ; !TRAKXONLY 5265 274e4 - lda #100 ; minimum for just x 5266 274e4 - endif ; !TRAKXONLY 5267 274e4 - else ; !TRAKTIME 5268 274e4 - lda #TRAKTIME 5269 274e4 - endif ; !TRAKTIME 5270 274e4 - jsr SETTIM64T ; INTIM is in Y 5271 274e4 - ldx #0 5272 274e4 - ifnconst TRAKXONLY 5273 274e4 - ldy #0 5274 274e4 - endif ; TRAKXONLY 5275 274e4 -trakball1updateloop 5276 274e4 - lda SWCHA 5277 274e4 - and #%00000011 5278 274e4 - cmp trakballcodex1 5279 274e4 - sta trakballcodex1 5280 274e4 - beq trakball1movementXdone 5281 274e4 - and #%00000001 5282 274e4 - beq trakball1negativeX 5283 274e4 -trakball1positiveX 5284 274e4 - ;(2 from beq) 5285 274e4 - inx ; 2 5286 274e4 - jmp trakball1movementXdone ; 3 5287 274e4 -trakball1negativeX 5288 274e4 - ;(3 from beq) 5289 274e4 - dex ; 2 5290 274e4 - nop ; 2 5291 274e4 -trakball1movementXdone 5292 274e4 - 5293 274e4 - ifnconst TRAKXONLY 5294 274e4 - lda SWCHA 5295 274e4 - and #%00001100 5296 274e4 - cmp trakballcodey1 5297 274e4 - sta trakballcodey1 5298 274e4 - beq trakball1movementYdone 5299 274e4 - and #%00000100 5300 274e4 - beq trakball1negativeY 5301 274e4 -trakball1positiveY 5302 274e4 - ;(2 from beq) 5303 274e4 - iny ; 2 5304 274e4 - jmp trakball1movementYdone ; 3 5305 274e4 -trakball1negativeY 5306 274e4 - ;(3 from beq) 5307 274e4 - dey ; 2 5308 274e4 - nop ; 2 5309 274e4 -trakball1movementYdone 5310 274e4 - endif ; !TRAKXONLY 5311 274e4 - 5312 274e4 - lda TIMINT 5313 274e4 - bpl trakball1updateloop 5314 274e4 - lda #0 5315 274e4 - cpx #0 5316 274e4 - beq trakball1skipXadjust 5317 274e4 - clc 5318 274e4 -trakball1Xloop 5319 274e4 - adc port1resolution 5320 274e4 - dex 5321 274e4 - bne trakball1Xloop 5322 274e4 - clc 5323 274e4 - adc trakballx1 5324 274e4 - sta trakballx1 5325 274e4 -trakball1skipXadjust 5326 274e4 - ifnconst TRAKXONLY 5327 274e4 - lda #0 5328 274e4 - cpy #0 5329 274e4 - beq trakball1skipYadjust 5330 274e4 - clc 5331 274e4 -trakball1yloop 5332 274e4 - adc port1resolution 5333 274e4 - dey 5334 274e4 - bne trakball1yloop 5335 274e4 - clc 5336 274e4 - adc trakbally1 5337 274e4 - sta trakbally1 5338 274e4 -trakball1skipYadjust 5339 274e4 - endif ; !TRAKXONLY 5340 274e4 - 5341 274e4 - jmp LLRET1 5342 274e4 endif 5343 274e4 5344 274e4 5345 274e4 paddleport0update 5346 274e4 - ifconst PADDLE0SUPPORT 5347 274e4 - lda #6 5348 274e4 - sta VBLANK ; start charging the paddle caps 5349 274e4 - lda #0 ; use PADDLE timing 5350 274e4 - jsr SETTIM64T ; INTIM is in Y 5351 274e4 - 5352 274e4 -paddleport0updateloop 5353 274e4 - lda INPT0 5354 274e4 - bmi skippaddle0setposition 5355 274e4 - sty paddleposition0 5356 274e4 -skippaddle0setposition 5357 274e4 - ifconst TWOPADDLESUPPORT 5358 274e4 - lda INPT1 5359 274e4 - bmi skippaddle1setposition 5360 274e4 - sty paddleposition1 5361 274e4 -skippaddle1setposition 5362 274e4 - endif 5363 274e4 - ldy INTIM 5364 274e4 - cpy #TIMEOFFSET 5365 274e4 - bcs paddleport0updateloop 5366 274e4 - 5367 274e4 - lda #%10000110 5368 274e4 - sta VBLANK ; dump paddles to ground... this may not be great for genesis controllers 5369 274e4 - sec 5370 274e4 - lda paddleposition0 5371 274e4 - sbc #TIMEOFFSET 5372 274e4 - ifconst PADDLESCALEX2 5373 274e4 - asl 5374 274e4 - endif 5375 274e4 - 5376 274e4 - ifnconst PADDLESMOOTHINGOFF 5377 274e4 - clc 5378 274e4 - adc paddleprevious0 5379 274e4 - ror 5380 274e4 - sta paddleprevious0 5381 274e4 - endif 5382 274e4 - 5383 274e4 - sta paddleposition0 5384 274e4 - 5385 274e4 - ifconst TWOPADDLESUPPORT 5386 274e4 - sec 5387 274e4 - lda paddleposition1 5388 274e4 - sbc #TIMEOFFSET 5389 274e4 - ifconst PADDLESCALEX2 5390 274e4 - asl 5391 274e4 - endif 5392 274e4 - 5393 274e4 - ifnconst PADDLESMOOTHINGOFF 5394 274e4 - clc 5395 274e4 - adc paddleprevious1 5396 274e4 - ror 5397 274e4 - sta paddleprevious1 5398 274e4 - endif 5399 274e4 - sta paddleposition1 5400 274e4 - endif ; TWOPADDLESUPPORT 5401 274e4 - 5402 274e4 - jmp LLRET0 5403 274e4 endif 5404 274e4 5405 274e4 paddleport1update 5406 274e4 - ifconst PADDLE1SUPPORT 5407 274e4 - lda #6 5408 274e4 - sta VBLANK ; start charging the paddle caps 5409 274e4 - 5410 274e4 - lda #0 ; use PADDLE timing 5411 274e4 - jsr SETTIM64T ; INTIM is in Y 5412 274e4 - 5413 274e4 -paddleport1updateloop 5414 274e4 - lda INPT2 5415 274e4 - bmi skippaddle2setposition 5416 274e4 - sty paddleposition2 5417 274e4 -skippaddle2setposition 5418 274e4 - ifconst TWOPADDLESUPPORT 5419 274e4 - lda INPT3 5420 274e4 - bmi skippaddle3setposition 5421 274e4 - sty paddleposition3 5422 274e4 -skippaddle3setposition 5423 274e4 - endif 5424 274e4 - ldy INTIM 5425 274e4 - cpy #TIMEOFFSET 5426 274e4 - bcs paddleport1updateloop 5427 274e4 - 5428 274e4 - lda #%10000110 5429 274e4 - sta VBLANK ; dump paddles to ground... this may not be great for genesis controllers 5430 274e4 - sec 5431 274e4 - lda paddleposition2 5432 274e4 - sbc #TIMEOFFSET 5433 274e4 - ifconst PADDLESCALEX2 5434 274e4 - asl 5435 274e4 - endif 5436 274e4 - 5437 274e4 - ifnconst PADDLESMOOTHINGOFF 5438 274e4 - clc 5439 274e4 - adc paddleprevious2 5440 274e4 - ror 5441 274e4 - sta paddleprevious2 5442 274e4 - endif 5443 274e4 - 5444 274e4 - sta paddleposition2 5445 274e4 - 5446 274e4 - ifconst TWOPADDLESUPPORT 5447 274e4 - sec 5448 274e4 - lda paddleposition3 5449 274e4 - sbc #TIMEOFFSET 5450 274e4 - ifconst PADDLESCALEX2 5451 274e4 - asl 5452 274e4 - endif 5453 274e4 - 5454 274e4 - ifnconst PADDLESMOOTHINGOFF 5455 274e4 - clc 5456 274e4 - adc paddleprevious3 5457 274e4 - ror 5458 274e4 - sta paddleprevious3 5459 274e4 - endif 5460 274e4 - sta paddleposition3 5461 274e4 - endif ; TWOPADDLESUPPORT 5462 274e4 - 5463 274e4 - jmp LLRET1 5464 274e4 endif 5465 274e4 5466 274e4 5467 274e4 paddlebuttonhandler ; outside of conditional, for button-handler LUT 5468 274e4 - ifconst PADDLESUPPORT 5469 274e4 - ; x=0|1 for port, rather than paddle #. 5470 274e4 - ; Only the first paddle button will integrate into "joy0fire" testing. If the 5471 274e4 - ; game wants to support 2 paddles, up to the game to instead test the 5472 274e4 - ; joystick right+left directions instead. 5473 274e4 - lda SWCHA ; top of nibble is first paddle button 5474 274e4 - cpx #0 ; port 0? 5475 274e4 - beq skippaddleport2shift 5476 274e4 - asl ; shift second port to upper nibble 5477 274e4 - asl 5478 274e4 - asl 5479 274e4 - asl 5480 274e4 -skippaddleport2shift 5481 274e4 - and #%10000000 5482 274e4 - eor #%10000000 ; invert 5483 274e4 - sta sINPT1,x 5484 274e4 - jmp buttonreadloopreturn 5485 274e4 endif ; PADDLESUPPORT 5486 274e4 5487 274e4 mousebuttonhandler ; outside of conditional, for button-handler LUT 5488 274e4 - ifconst MOUSESUPPORT 5489 274e4 - ; stick the mouse buttons in the correct shadow register... 5490 274e4 - txa 5491 274e4 - asl 5492 274e4 - tay ; y=x*2 5493 274e4 - lda INPT4,x 5494 274e4 - eor #%10000000 5495 274e4 - lsr 5496 274e4 - sta sINPT1,x 5497 274e4 - 5498 274e4 - lda INPT1,y 5499 274e4 - and #%10000000 5500 274e4 - eor #%10000000 5501 274e4 - ora sINPT1,x 5502 274e4 - sta sINPT1,x 5503 274e4 - jmp buttonreadloopreturn 5504 274e4 endif ; MOUSESUPPORT 5505 274e4 5506 274e4 - ifconst KEYPADSUPPORT 5507 274e4 - ; ** select keypad rows 0 to 3 over 4 frames... 5508 274e4 -keypadrowselect 5509 274e4 - ldy #0 5510 274e4 - lda port0control 5511 274e4 - cmp #7 5512 274e4 - bne skipport0val 5513 274e4 - iny ; y=y+1 5514 274e4 -skipport0val 5515 274e4 - lda port1control 5516 274e4 - cmp #7 5517 274e4 - bne skipport1val 5518 274e4 - iny 5519 274e4 - iny ; y=y+2 5520 274e4 -skipport1val 5521 274e4 - lda keyrowdirectionmask,y 5522 274e4 - sta CTLSWA 5523 274e4 - tya 5524 274e4 - asl 5525 274e4 - asl 5526 274e4 - sta inttemp1 5527 274e4 - lda framecounter 5528 274e4 - and #3 5529 274e4 - ora inttemp1 5530 274e4 - tax 5531 274e4 - lda keyrowselectvalue,x 5532 274e4 - sta SWCHA 5533 274e4 - rts 5534 274e4 - 5535 274e4 -keyrowdirectionmask 5536 274e4 - .byte #%00000000 ; 0 : port0=input port1=input 5537 274e4 - .byte #%11110000 ; 1 : port0=output port1=input 5538 274e4 - .byte #%00001111 ; 2 : port0=input port1=output 5539 274e4 - .byte #%11111111 ; 3 : port0=output port1=output 5540 274e4 - 5541 274e4 -keyrowselectvalue 5542 274e4 - .byte #%00000000, #%00000000, #%00000000, #%00000000 ; no row selected, all pins high, always 5543 274e4 - .byte #%11100000, #%11010000, #%10110000, #%01110000 ; p0 keypad in 5544 274e4 - .byte #%00001110, #%00001101, #%00001011, #%00000111 ; p1 keypad in 5545 274e4 - .byte #%11101110, #%11011101, #%10111011, #%01110111 ; p0+p1 keypads in 5546 274e4 endif ; KEYPADSUPPORT 5547 274e4 5548 274e4 - ifconst KEYPADSUPPORT 5549 274e4 - ; TODO - split into compile-time KEYPAD0SUPPORT and KEYPAD1SUPPORT 5550 274e4 -keypadcolumnread 5551 274e4 - lda port0control 5552 274e4 - cmp #7 5553 274e4 - bne skipkeypadcolumnread0 5554 274e4 - lda framecounter 5555 274e4 - and #3 5556 274e4 - asl ; x2 because keypad variables are interleaved 5557 274e4 - tax 5558 274e4 - lda #0 5559 274e4 - sta keypadmatrix0a,x 5560 274e4 - lda INPT0 5561 274e4 - cmp #$80 5562 274e4 - rol keypadmatrix0a,x 5563 274e4 - lda INPT1 5564 274e4 - cmp #$80 5565 274e4 - rol keypadmatrix0a,x 5566 274e4 - lda INPT4 5567 274e4 - cmp #$80 5568 274e4 - rol keypadmatrix0a,x 5569 274e4 - lda keypadmatrix0a,x 5570 274e4 - eor #%00000111 5571 274e4 - sta keypadmatrix0a,x 5572 274e4 -skipkeypadcolumnread0 5573 274e4 - 5574 274e4 - lda port1control 5575 274e4 - cmp #7 5576 274e4 - bne skipkeypadcolumnread1 5577 274e4 - lda framecounter 5578 274e4 - and #3 5579 274e4 - asl ; x2 because keypad variables are interleaved 5580 274e4 - tax 5581 274e4 - lda #0 5582 274e4 - sta keypadmatrix1a,x 5583 274e4 - rol keypadmatrix1a,x 5584 274e4 - lda INPT2 5585 274e4 - cmp #$80 5586 274e4 - rol keypadmatrix1a,x 5587 274e4 - lda INPT3 5588 274e4 - cmp #$80 5589 274e4 - rol keypadmatrix1a,x 5590 274e4 - lda INPT5 5591 274e4 - cmp #$80 5592 274e4 - rol keypadmatrix1a,x 5593 274e4 - lda keypadmatrix1a,x 5594 274e4 - eor #%00000111 5595 274e4 - sta keypadmatrix1a,x 5596 274e4 -skipkeypadcolumnread1 5597 274e4 - rts 5598 274e4 endif ; KEYPADSUPPORT 5599 274e4 5600 274e4 setportforinput 5601 274e4 a5 e4 lda CTLSWAs 5602 274e6 3d ef f4 and allpinsinputlut,x 5603 274e9 85 e4 sta CTLSWAs 5604 274eb 8d 81 02 sta CTLSWA 5605 274ee 60 rts 5606 274ef 5607 274ef allpinsinputlut 5608 274ef 0f f0 .byte.b $0F, $F0 5609 274f1 5610 274f1 setonebuttonmode 5611 274f1 a9 06 lda #6 ; in case we're in unlocked-bios mode 5612 274f3 85 01 sta VBLANK ; if we were on paddles, the line is grounded out. 5613 274f5 a9 14 lda #$14 5614 274f7 8d 83 02 sta CTLSWB ; set both 2-button disable bits to writable 5615 274fa a5 e5 lda CTLSWBs 5616 274fc 1d 05 f5 ora thisjoy2buttonbit,x 5617 274ff 85 e5 sta CTLSWBs 5618 27501 8d 82 02 sta SWCHB ; turn off the 2-button disable bits 5619 27504 60 rts 5620 27505 5621 27505 thisjoy2buttonbit 5622 27505 04 10 .byte.b $04, $10 5623 27507 5624 27507 settwobuttonmode 5625 27507 a9 06 lda #6 ; in case we're in unlocked-bios mode 5626 27509 85 01 sta VBLANK ; if we were on paddles, the line is grounded out. 5627 2750b a9 14 lda #$14 5628 2750d 8d 83 02 sta CTLSWB ; set both 2-button disable bits to writable 5629 27510 a5 e5 lda CTLSWBs 5630 27512 3d 1b f5 and thisjoy2buttonmask,x 5631 27515 85 e5 sta CTLSWBs 5632 27517 8d 82 02 sta SWCHB 5633 2751a 60 rts 5634 2751b 5635 2751b thisjoy2buttonmask 5636 2751b fb ef .byte.b $fb, $ef 5637 2751d 5638 2751d ; Provided under the CC0 license. See the included LICENSE.txt for details. 5639 2751d 5640 2751d START 5641 2751d start 5642 2751d 5643 2751d ;******** more or less the Atari recommended startup procedure 5644 2751d 5645 2751d 78 sei 5646 2751e d8 cld 5647 2751f 5648 2751f ifnconst NOTIALOCK 5649 2751f a9 07 lda #$07 5650 27521 - else 5651 27521 - lda #$06 5652 27521 endif 5653 27521 85 01 sta INPTCTRL ;lock 7800 into 7800 mode 5654 27523 a9 7f lda #$7F 5655 27525 85 3c sta CTRL ;disable DMA 5656 27527 a9 00 lda #$00 5657 27529 85 38 sta OFFSET 5658 2752b ifnconst NOTIALOCK 5659 2752b 85 01 sta INPTCTRL 5660 2752d 85 20 sta BACKGRND ; black default, in case a flash cart is using something else 5661 2752f endif 5662 2752f a2 ff ldx #$FF 5663 27531 9a txs 5664 27532 5665 27532 ;************** Clear Memory 5666 27532 5667 27532 a2 40 ldx #$40 5668 27534 a9 00 lda #$00 5669 27536 crloop1 5670 27536 95 00 sta $00,x ;Clear zero page 5671 27538 9d 00 01 sta $100,x ;Clear page 1 5672 2753b e8 inx 5673 2753c d0 f8 bne crloop1 5674 2753e 5675 2753e 5676 2753e a0 00 ldy #$00 ;Clear Ram 5677 27540 a9 18 lda #$18 ;Start at $1800 5678 27542 85 81 sta $81 5679 27544 a9 00 lda #$00 5680 27546 85 80 sta $80 5681 27548 crloop3 5682 27548 a9 00 lda #$00 5683 2754a 91 80 sta ($80),y ;Store data 5684 2754c c8 iny ;Next byte 5685 2754d d0 f9 bne crloop3 ;Branch if not done page 5686 2754f e6 81 inc $81 ;Next page 5687 27551 a5 81 lda $81 5688 27553 c9 20 cmp #$20 ;End at $1FFF 5689 27555 d0 f1 bne crloop3 ;Branch if not 5690 27557 5691 27557 a0 00 ldy #$00 ;Clear Ram 5692 27559 a9 22 lda #$22 ;Start at $2200 5693 2755b 85 81 sta $81 5694 2755d a9 00 lda #$00 5695 2755f 85 80 sta $80 5696 27561 crloop4 5697 27561 a9 00 lda #$00 5698 27563 91 80 sta ($80),y ;Store data 5699 27565 c8 iny ;Next byte 5700 27566 d0 f9 bne crloop4 ;Branch if not done page 5701 27568 e6 81 inc $81 ;Next page 5702 2756a a5 81 lda $81 5703 2756c c9 27 cmp #$27 ;End at $27FF 5704 2756e d0 f1 bne crloop4 ;Branch if not 5705 27570 5706 27570 a2 00 ldx #$00 5707 27572 a9 00 lda #$00 5708 27574 crloop5 ;Clear 2100-213F, 2000-203F 5709 27574 9d 00 20 sta $2000,x 5710 27577 9d 00 21 sta $2100,x 5711 2757a e8 inx 5712 2757b e0 40 cpx #$40 5713 2757d d0 f5 bne crloop5 5714 2757f 5715 2757f 85 80 sta $80 5716 27581 85 81 sta $81 5717 27583 85 82 sta $82 5718 27585 85 83 sta $83 5719 27587 5720 27587 ;seed random number with hopefully-random timer value 5721 27587 a9 01 lda #1 5722 27589 0d 84 02 ora INTIM 5723 2758c 85 40 sta rand 5724 2758e 5725 2758e ; detect the console type... 5726 2758e pndetectvblankstart 5727 2758e a5 28 lda MSTAT 5728 27590 10 fc bpl pndetectvblankstart ; if we're not in VBLANK, wait for it to start 5729 27592 pndetectvblankover 5730 27592 a5 28 lda MSTAT 5731 27594 30 fc bmi pndetectvblankover ; then wait for it to be over 5732 27596 a0 00 ldy #$00 5733 27598 a2 00 ldx #$00 5734 2759a pndetectvblankhappening 5735 2759a a5 28 lda MSTAT 5736 2759c 30 07 bmi pndetectinvblank ; if VBLANK starts, exit our counting loop 5737 2759e 85 24 sta WSYNC 5738 275a0 85 24 sta WSYNC 5739 275a2 e8 inx 5740 275a3 d0 f5 bne pndetectvblankhappening 5741 275a5 pndetectinvblank 5742 275a5 e0 7d cpx #125 5743 275a7 90 02 bcc pndetecispal 5744 275a9 a0 01 ldy #$01 5745 275ab pndetecispal 5746 275ab 8c 09 21 sty paldetected 5747 275ae 5748 275ae 20 4a f4 jsr createallgamedlls 5749 275b1 5750 275b1 a9 18 lda #>DLLMEM 5751 275b3 85 2c sta DPPH 5752 275b5 a9 00 lda # 255 5947 2760e -DOUBLEBUFFEROFFSET = 255 5948 2760e else 5949 2760e 00 f2 DOUBLEBUFFEROFFSET = (DLLASTOBJ+2) 5950 2760e endif 5951 2760e 5952 2760e ifconst EXTRADLMEMORY 5953 2760e SECONDDLHALFSTART SET $2300 5954 2760e endif 5955 2760e 5956 2760e DLPOINTH 5957 2760e DLINDEX SET 0 5958 2760e REPEAT WZONECOUNT 5959 2760e TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5960 2760e ifconst EXTRADLMEMORY 5961 2760e - if TMPMEMADDRESS > $1FFF 5962 2760e -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5963 2760e else 5964 2760e - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5965 2760e -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5966 2760e -SECONDDLHALFSTART SET TMPMEMADDRESS 5967 2760e endif 5968 2760e endif ; TMPMEMADDRESS > $1FFF 5969 2760e endif ; EXTRADLMEMORY 5970 2760e ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 5971 2760e 18 .byte.b >TMPMEMADDRESS 5972 2760e DLINDEX SET DLINDEX + 1 5958 2760e REPEND 5959 2760e TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5960 2760f ifconst EXTRADLMEMORY 5961 2760f - if TMPMEMADDRESS > $1FFF 5962 2760f -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5963 2760f else 5964 2760f - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5965 2760f -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5966 2760f -SECONDDLHALFSTART SET TMPMEMADDRESS 5967 2760f endif 5968 2760f endif ; TMPMEMADDRESS > $1FFF 5969 2760f endif ; EXTRADLMEMORY 5970 2760f ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 5971 2760f 19 .byte.b >TMPMEMADDRESS 5972 2760f DLINDEX SET DLINDEX + 1 5958 2760f REPEND 5959 2760f TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5960 27610 ifconst EXTRADLMEMORY 5961 27610 - if TMPMEMADDRESS > $1FFF 5962 27610 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5963 27610 else 5964 27610 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5965 27610 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5966 27610 -SECONDDLHALFSTART SET TMPMEMADDRESS 5967 27610 endif 5968 27610 endif ; TMPMEMADDRESS > $1FFF 5969 27610 endif ; EXTRADLMEMORY 5970 27610 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 5971 27610 1a .byte.b >TMPMEMADDRESS 5972 27610 DLINDEX SET DLINDEX + 1 5958 27610 REPEND 5959 27610 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5960 27611 ifconst EXTRADLMEMORY 5961 27611 - if TMPMEMADDRESS > $1FFF 5962 27611 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5963 27611 else 5964 27611 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5965 27611 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5966 27611 -SECONDDLHALFSTART SET TMPMEMADDRESS 5967 27611 endif 5968 27611 endif ; TMPMEMADDRESS > $1FFF 5969 27611 endif ; EXTRADLMEMORY 5970 27611 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 5971 27611 1b .byte.b >TMPMEMADDRESS 5972 27611 DLINDEX SET DLINDEX + 1 5958 27611 REPEND 5959 27611 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5960 27612 ifconst EXTRADLMEMORY 5961 27612 - if TMPMEMADDRESS > $1FFF 5962 27612 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5963 27612 else 5964 27612 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5965 27612 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5966 27612 -SECONDDLHALFSTART SET TMPMEMADDRESS 5967 27612 endif 5968 27612 endif ; TMPMEMADDRESS > $1FFF 5969 27612 endif ; EXTRADLMEMORY 5970 27612 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 5971 27612 1c .byte.b >TMPMEMADDRESS 5972 27612 DLINDEX SET DLINDEX + 1 5958 27612 REPEND 5959 27612 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5960 27613 ifconst EXTRADLMEMORY 5961 27613 - if TMPMEMADDRESS > $1FFF 5962 27613 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5963 27613 else 5964 27613 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5965 27613 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5966 27613 -SECONDDLHALFSTART SET TMPMEMADDRESS 5967 27613 endif 5968 27613 endif ; TMPMEMADDRESS > $1FFF 5969 27613 endif ; EXTRADLMEMORY 5970 27613 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 5971 27613 1d .byte.b >TMPMEMADDRESS 5972 27613 DLINDEX SET DLINDEX + 1 5958 27613 REPEND 5959 27613 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5960 27614 ifconst EXTRADLMEMORY 5961 27614 - if TMPMEMADDRESS > $1FFF 5962 27614 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5963 27614 else 5964 27614 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5965 27614 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5966 27614 -SECONDDLHALFSTART SET TMPMEMADDRESS 5967 27614 endif 5968 27614 endif ; TMPMEMADDRESS > $1FFF 5969 27614 endif ; EXTRADLMEMORY 5970 27614 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 5971 27614 1e .byte.b >TMPMEMADDRESS 5972 27614 DLINDEX SET DLINDEX + 1 5958 27614 REPEND 5959 27614 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5960 27615 ifconst EXTRADLMEMORY 5961 27615 - if TMPMEMADDRESS > $1FFF 5962 27615 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5963 27615 else 5964 27615 if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5965 27615 TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5966 27615 SECONDDLHALFSTART SET TMPMEMADDRESS 5967 27615 endif 5968 27615 endif ; TMPMEMADDRESS > $1FFF 5969 27615 endif ; EXTRADLMEMORY 5970 27615 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 5971 27615 22 .byte.b >TMPMEMADDRESS 5972 27615 DLINDEX SET DLINDEX + 1 5958 27615 REPEND 5959 27615 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5960 27616 ifconst EXTRADLMEMORY 5961 27616 if TMPMEMADDRESS > $1FFF 5962 27616 TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5963 27616 - else 5964 27616 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5965 27616 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5966 27616 -SECONDDLHALFSTART SET TMPMEMADDRESS 5967 27616 - endif 5968 27616 endif ; TMPMEMADDRESS > $1FFF 5969 27616 endif ; EXTRADLMEMORY 5970 27616 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 5971 27616 23 .byte.b >TMPMEMADDRESS 5972 27616 DLINDEX SET DLINDEX + 1 5958 27616 REPEND 5959 27616 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5960 27617 ifconst EXTRADLMEMORY 5961 27617 if TMPMEMADDRESS > $1FFF 5962 27617 TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5963 27617 - else 5964 27617 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5965 27617 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5966 27617 -SECONDDLHALFSTART SET TMPMEMADDRESS 5967 27617 - endif 5968 27617 endif ; TMPMEMADDRESS > $1FFF 5969 27617 endif ; EXTRADLMEMORY 5970 27617 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 5971 27617 24 .byte.b >TMPMEMADDRESS 5972 27617 DLINDEX SET DLINDEX + 1 5958 27617 REPEND 5959 27617 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5960 27618 ifconst EXTRADLMEMORY 5961 27618 if TMPMEMADDRESS > $1FFF 5962 27618 TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5963 27618 - else 5964 27618 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5965 27618 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5966 27618 -SECONDDLHALFSTART SET TMPMEMADDRESS 5967 27618 - endif 5968 27618 endif ; TMPMEMADDRESS > $1FFF 5969 27618 endif ; EXTRADLMEMORY 5970 27618 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 5971 27618 25 .byte.b >TMPMEMADDRESS 5972 27618 DLINDEX SET DLINDEX + 1 5958 27618 REPEND 5959 27618 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5960 27619 ifconst EXTRADLMEMORY 5961 27619 if TMPMEMADDRESS > $1FFF 5962 27619 TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5963 27619 - else 5964 27619 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5965 27619 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5966 27619 -SECONDDLHALFSTART SET TMPMEMADDRESS 5967 27619 - endif 5968 27619 endif ; TMPMEMADDRESS > $1FFF 5969 27619 endif ; EXTRADLMEMORY 5970 27619 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 5971 27619 26 .byte.b >TMPMEMADDRESS 5972 27619 DLINDEX SET DLINDEX + 1 5973 2761a REPEND 5974 2761a 5975 2761a ifconst EXTRADLMEMORY $2235 to $27ff was claimed as extra DL memory. 5976 2761a echo " ",[SECONDDLHALFSTART],"to",[$27FF],"was claimed as extra DL memory." 5977 2761a endif 5978 2761a 5979 2761a 5980 2761a DLPOINTL 5981 2761a DLINDEX SET 0 5982 2761a REPEAT WZONECOUNT 5983 2761a TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5984 2761a ifconst EXTRADLMEMORY 5985 2761a - if TMPMEMADDRESS > $1FFF 5986 2761a -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5987 2761a else 5988 2761a - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5989 2761a -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5990 2761a endif 5991 2761a endif ; TMPMEMADDRESS > $1FFF 5992 2761a endif ; EXTRADLMEMORY 5993 2761a 80 .byte.b $1FFF 5986 2761b -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5987 2761b else 5988 2761b - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5989 2761b -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5990 2761b endif 5991 2761b endif ; TMPMEMADDRESS > $1FFF 5992 2761b endif ; EXTRADLMEMORY 5993 2761b 75 .byte.b $1FFF 5986 2761c -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5987 2761c else 5988 2761c - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5989 2761c -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5990 2761c endif 5991 2761c endif ; TMPMEMADDRESS > $1FFF 5992 2761c endif ; EXTRADLMEMORY 5993 2761c 6a .byte.b $1FFF 5986 2761d -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5987 2761d else 5988 2761d - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5989 2761d -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5990 2761d endif 5991 2761d endif ; TMPMEMADDRESS > $1FFF 5992 2761d endif ; EXTRADLMEMORY 5993 2761d 60 .byte.b $1FFF 5986 2761e -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5987 2761e else 5988 2761e - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5989 2761e -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5990 2761e endif 5991 2761e endif ; TMPMEMADDRESS > $1FFF 5992 2761e endif ; EXTRADLMEMORY 5993 2761e 55 .byte.b $1FFF 5986 2761f -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5987 2761f else 5988 2761f - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5989 2761f -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5990 2761f endif 5991 2761f endif ; TMPMEMADDRESS > $1FFF 5992 2761f endif ; EXTRADLMEMORY 5993 2761f 4a .byte.b $1FFF 5986 27620 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5987 27620 else 5988 27620 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5989 27620 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5990 27620 endif 5991 27620 endif ; TMPMEMADDRESS > $1FFF 5992 27620 endif ; EXTRADLMEMORY 5993 27620 40 .byte.b $1FFF 5986 27621 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5987 27621 else 5988 27621 if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5989 27621 TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5990 27621 endif 5991 27621 endif ; TMPMEMADDRESS > $1FFF 5992 27621 endif ; EXTRADLMEMORY 5993 27621 35 .byte.b $1FFF 5986 27622 TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5987 27622 - else 5988 27622 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5989 27622 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5990 27622 - endif 5991 27622 endif ; TMPMEMADDRESS > $1FFF 5992 27622 endif ; EXTRADLMEMORY 5993 27622 2a .byte.b $1FFF 5986 27623 TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5987 27623 - else 5988 27623 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5989 27623 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5990 27623 - endif 5991 27623 endif ; TMPMEMADDRESS > $1FFF 5992 27623 endif ; EXTRADLMEMORY 5993 27623 20 .byte.b $1FFF 5986 27624 TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5987 27624 - else 5988 27624 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5989 27624 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5990 27624 - endif 5991 27624 endif ; TMPMEMADDRESS > $1FFF 5992 27624 endif ; EXTRADLMEMORY 5993 27624 15 .byte.b $1FFF 5986 27625 TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5987 27625 - else 5988 27625 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5989 27625 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5990 27625 - endif 5991 27625 endif ; TMPMEMADDRESS > $1FFF 5992 27625 endif ; EXTRADLMEMORY 5993 27625 0a .byte.b $1FFF 6003 27626 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6004 27626 else 6005 27626 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6006 27626 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6007 27626 endif 6008 27626 endif ; TMPMEMADDRESS > $1FFF 6009 27626 endif ; EXTRADLMEMORY 6010 27626 6011 27626 18 80 ZONE0ADDRESS = TMPMEMADDRESS 6012 27626 6013 27626 DLINDEX SET DLINDEX + 1 5999 27626 REPEND 6000 27626 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 6001 27626 ifconst EXTRADLMEMORY 6002 27626 - if TMPMEMADDRESS > $1FFF 6003 27626 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6004 27626 else 6005 27626 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6006 27626 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6007 27626 endif 6008 27626 endif ; TMPMEMADDRESS > $1FFF 6009 27626 endif ; EXTRADLMEMORY 6010 27626 6011 27626 19 75 ZONE1ADDRESS = TMPMEMADDRESS 6012 27626 6013 27626 DLINDEX SET DLINDEX + 1 5999 27626 REPEND 6000 27626 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 6001 27626 ifconst EXTRADLMEMORY 6002 27626 - if TMPMEMADDRESS > $1FFF 6003 27626 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6004 27626 else 6005 27626 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6006 27626 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6007 27626 endif 6008 27626 endif ; TMPMEMADDRESS > $1FFF 6009 27626 endif ; EXTRADLMEMORY 6010 27626 6011 27626 1a 6a ZONE2ADDRESS = TMPMEMADDRESS 6012 27626 6013 27626 DLINDEX SET DLINDEX + 1 5999 27626 REPEND 6000 27626 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 6001 27626 ifconst EXTRADLMEMORY 6002 27626 - if TMPMEMADDRESS > $1FFF 6003 27626 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6004 27626 else 6005 27626 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6006 27626 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6007 27626 endif 6008 27626 endif ; TMPMEMADDRESS > $1FFF 6009 27626 endif ; EXTRADLMEMORY 6010 27626 6011 27626 1b 60 ZONE3ADDRESS = TMPMEMADDRESS 6012 27626 6013 27626 DLINDEX SET DLINDEX + 1 5999 27626 REPEND 6000 27626 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 6001 27626 ifconst EXTRADLMEMORY 6002 27626 - if TMPMEMADDRESS > $1FFF 6003 27626 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6004 27626 else 6005 27626 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6006 27626 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6007 27626 endif 6008 27626 endif ; TMPMEMADDRESS > $1FFF 6009 27626 endif ; EXTRADLMEMORY 6010 27626 6011 27626 1c 55 ZONE4ADDRESS = TMPMEMADDRESS 6012 27626 6013 27626 DLINDEX SET DLINDEX + 1 5999 27626 REPEND 6000 27626 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 6001 27626 ifconst EXTRADLMEMORY 6002 27626 - if TMPMEMADDRESS > $1FFF 6003 27626 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6004 27626 else 6005 27626 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6006 27626 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6007 27626 endif 6008 27626 endif ; TMPMEMADDRESS > $1FFF 6009 27626 endif ; EXTRADLMEMORY 6010 27626 6011 27626 1d 4a ZONE5ADDRESS = TMPMEMADDRESS 6012 27626 6013 27626 DLINDEX SET DLINDEX + 1 5999 27626 REPEND 6000 27626 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 6001 27626 ifconst EXTRADLMEMORY 6002 27626 - if TMPMEMADDRESS > $1FFF 6003 27626 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6004 27626 else 6005 27626 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6006 27626 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6007 27626 endif 6008 27626 endif ; TMPMEMADDRESS > $1FFF 6009 27626 endif ; EXTRADLMEMORY 6010 27626 6011 27626 1e 40 ZONE6ADDRESS = TMPMEMADDRESS 6012 27626 6013 27626 DLINDEX SET DLINDEX + 1 5999 27626 REPEND 6000 27626 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 6001 27626 ifconst EXTRADLMEMORY 6002 27626 - if TMPMEMADDRESS > $1FFF 6003 27626 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6004 27626 else 6005 27626 if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6006 27626 TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6007 27626 endif 6008 27626 endif ; TMPMEMADDRESS > $1FFF 6009 27626 endif ; EXTRADLMEMORY 6010 27626 6011 27626 22 35 ZONE7ADDRESS = TMPMEMADDRESS 6012 27626 6013 27626 DLINDEX SET DLINDEX + 1 5999 27626 REPEND 6000 27626 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 6001 27626 ifconst EXTRADLMEMORY 6002 27626 if TMPMEMADDRESS > $1FFF 6003 27626 TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6004 27626 - else 6005 27626 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6006 27626 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6007 27626 - endif 6008 27626 endif ; TMPMEMADDRESS > $1FFF 6009 27626 endif ; EXTRADLMEMORY 6010 27626 6011 27626 23 2a ZONE8ADDRESS = TMPMEMADDRESS 6012 27626 6013 27626 DLINDEX SET DLINDEX + 1 5999 27626 REPEND 6000 27626 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 6001 27626 ifconst EXTRADLMEMORY 6002 27626 if TMPMEMADDRESS > $1FFF 6003 27626 TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6004 27626 - else 6005 27626 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6006 27626 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6007 27626 - endif 6008 27626 endif ; TMPMEMADDRESS > $1FFF 6009 27626 endif ; EXTRADLMEMORY 6010 27626 6011 27626 24 20 ZONE9ADDRESS = TMPMEMADDRESS 6012 27626 6013 27626 DLINDEX SET DLINDEX + 1 5999 27626 REPEND 6000 27626 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 6001 27626 ifconst EXTRADLMEMORY 6002 27626 if TMPMEMADDRESS > $1FFF 6003 27626 TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6004 27626 - else 6005 27626 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6006 27626 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6007 27626 - endif 6008 27626 endif ; TMPMEMADDRESS > $1FFF 6009 27626 endif ; EXTRADLMEMORY 6010 27626 6011 27626 25 15 ZONE10ADDRESS = TMPMEMADDRESS 6012 27626 6013 27626 DLINDEX SET DLINDEX + 1 5999 27626 REPEND 6000 27626 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 6001 27626 ifconst EXTRADLMEMORY 6002 27626 if TMPMEMADDRESS > $1FFF 6003 27626 TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6004 27626 - else 6005 27626 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6006 27626 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6007 27626 - endif 6008 27626 endif ; TMPMEMADDRESS > $1FFF 6009 27626 endif ; EXTRADLMEMORY 6010 27626 6011 27626 26 0a ZONE11ADDRESS = TMPMEMADDRESS 6012 27626 6013 27626 DLINDEX SET DLINDEX + 1 6014 27626 REPEND 6015 27626 6016 27626 $1880 to $23ff used as zone memory, allowing 48 display objects per zone. 6017 27626 echo " ",[WDLMEMSTART],"to",[WDLMEMEND],"used as zone memory, allowing",[(DLLASTOBJ/5)]d,"display objects per zone." 6018 27626 6019 27626 DLHEIGHT 6020 27626 REPEAT WZONECOUNT 6021 27626 0f .byte.b (WZONEHEIGHT-1) 6020 27626 REPEND 6021 27627 0f .byte.b (WZONEHEIGHT-1) 6020 27627 REPEND 6021 27628 0f .byte.b (WZONEHEIGHT-1) 6020 27628 REPEND 6021 27629 0f .byte.b (WZONEHEIGHT-1) 6020 27629 REPEND 6021 2762a 0f .byte.b (WZONEHEIGHT-1) 6020 2762a REPEND 6021 2762b 0f .byte.b (WZONEHEIGHT-1) 6020 2762b REPEND 6021 2762c 0f .byte.b (WZONEHEIGHT-1) 6020 2762c REPEND 6021 2762d 0f .byte.b (WZONEHEIGHT-1) 6020 2762d REPEND 6021 2762e 0f .byte.b (WZONEHEIGHT-1) 6020 2762e REPEND 6021 2762f 0f .byte.b (WZONEHEIGHT-1) 6020 2762f REPEND 6021 27630 0f .byte.b (WZONEHEIGHT-1) 6020 27630 REPEND 6021 27631 0f .byte.b (WZONEHEIGHT-1) 6022 27632 REPEND 6023 27632 6024 27632 ; Provided under the CC0 license. See the included LICENSE.txt for details. 6025 27632 6026 27632 ; a simple guard, than ensures the 7800basic code hasn't 6027 27632 ; spilled into the encryption area... 2380 bytes left in the 7800basic reserved area. 6028 27632 echo " ",($FF7E-*)d,"bytes left in the 7800basic reserved area." 6029 27632 - if (*>$FF7D) 6030 27632 - ERR ; abort the assembly 6031 27632 endif 6032 27632 ; Provided under the CC0 license. See the included LICENSE.txt for details. 6033 27632 6034 27632 - ifconst DEV 6035 27632 - ifnconst ZONEHEIGHT 6036 27632 - echo "* the 4k 7800basic area has",[($FF7E - *)]d,"bytes free." 6037 27632 - else 6038 27632 - if ZONEHEIGHT = 8 6039 27632 - echo "* the 4k 7800basic area has",[($FF7E - *)]d,"bytes free." 6040 27632 - else 6041 27632 - echo "* the 4k 7800basic area has",[($FF7E - *)]d,"bytes free." 6042 27632 - endif 6043 27632 - endif 6044 27632 endif 6045 27632 6046 27632 ; FF7E/FF7F contains the 7800basic crc checksum word 6047 27632 6048 27632 ; FF80 - FFF7 contains the 7800 encryption key 6049 27632 6050 27632 - ifnconst bankswitchmode 6051 27632 - ORG $FFF8 6052 27632 else 6053 27632 ifconst ROM128K 6054 27ff8 ORG $27FF8 6055 27ff8 RORG $FFF8 6056 27ff8 endif 6057 27ff8 - ifconst ROM144K 6058 27ff8 - ORG $27FF8 6059 27ff8 - RORG $FFF8 6060 27ff8 endif 6061 27ff8 - ifconst ROM256K 6062 27ff8 - ORG $47FF8 6063 27ff8 - RORG $FFF8 6064 27ff8 endif 6065 27ff8 - ifconst ROM272K 6066 27ff8 - ORG $47FF8 6067 27ff8 - RORG $FFF8 6068 27ff8 endif 6069 27ff8 - ifconst ROM512K 6070 27ff8 - ORG $87FF8 6071 27ff8 - RORG $FFF8 6072 27ff8 endif 6073 27ff8 - ifconst ROM528K 6074 27ff8 - ORG $87FF8 6075 27ff8 - RORG $FFF8 6076 27ff8 endif 6077 27ff8 endif 6078 27ff8 6079 27ff8 6080 27ff8 ff .byte.b $FF ; region verification. $FF=all regions 6081 27ff9 f7 .byte.b $F7 ; high nibble: encryption check from $N000 to $FF7F. we only hash the last 4k for faster boot. 6082 27ffa ; low nibble : N=7 atari rainbow start, N=3 no atari rainbow 6083 27ffa 6084 27ffa ;Vectors 6085 27ffa 00 f0 .word.w NMI 6086 27ffc 1d f5 .word.w START 6087 27ffe 5f f0 .word.w IRQ 6088 28000