------- FILE c:\Users\Shane\Documents\my7800projects\Heofonfir\shooting_test.78b.asm LEVEL 1 PASS 3 1 10000 ???? ; MACRO.H 2 10000 ???? 3 10000 ???? ; Based on the 2600 macro.h file. 4 10000 ???? ; Macros irrelevant to the 7800 have been removed, and the sleep macro 5 10000 ???? ; has been adapted to give accurate results on the 7800. 6 10000 ???? 7 10000 ???? ; Version 1.0 2019/12/11 (based on the 2600 Version 1.05, 13/NOVEMBER/2003) 8 10000 ???? 9 10000 ???? ; Available macros... 10 10000 ???? ; SLEEP n - sleep for n cycles 11 10000 ???? ; SET_POINTER - load a 16-bit absolute to a 16-bit variable 12 10000 ???? 13 10000 ???? ;------------------------------------------------------------------------------- 14 10000 ???? ; SLEEP duration 15 10000 ???? ; Original author: Thomas Jentzsch 16 10000 ???? ; Inserts code which takes the specified number of cycles to execute. This is 17 10000 ???? ; useful for code where precise timing is required. 18 10000 ???? ; ILLEGAL-OPCODE VERSION DOES NOT AFFECT FLAGS OR REGISTERS. 19 10000 ???? ; LEGAL OPCODE VERSION MAY AFFECT FLAGS 20 10000 ???? ; Uses illegal opcode (DASM 2.20.01 onwards). 21 10000 ???? 22 10000 ???? MAC sleep 23 10000 ???? .CYCLES SET {1} 24 10000 ???? 25 10000 ???? IF .CYCLES < 2 26 10000 ???? ECHO "MACRO ERROR: 'SLEEP': Duration must be > 1" 27 10000 ???? ERR 28 10000 ???? ENDIF 29 10000 ???? 30 10000 ???? IF .CYCLES & 1 31 10000 ???? IFNCONST NO_ILLEGAL_OPCODES 32 10000 ???? nop $80 33 10000 ???? ELSE 34 10000 ???? bit $80 35 10000 ???? ENDIF 36 10000 ???? .CYCLES SET .CYCLES - 3 37 10000 ???? ENDIF 38 10000 ???? 39 10000 ???? REPEAT .CYCLES / 2 40 10000 ???? nop 41 10000 ???? REPEND 42 10000 ???? ENDM ;usage: SLEEP n (n>1) 43 10000 ???? 44 10000 ???? ;------------------------------------------------------- 45 10000 ???? ; SET_POINTER 46 10000 ???? ; Original author: Manuel Rotschkar 47 10000 ???? ; 48 10000 ???? ; Sets a 2 byte RAM pointer to an absolute address. 49 10000 ???? ; 50 10000 ???? ; Usage: SET_POINTER pointer, address 51 10000 ???? ; Example: SET_POINTER SpritePTR, SpriteData 52 10000 ???? ; 53 10000 ???? ; Note: Alters the accumulator, NZ flags 54 10000 ???? ; IN 1: 2 byte RAM location reserved for pointer 55 10000 ???? ; IN 2: absolute address 56 10000 ???? 57 10000 ???? MAC set_pointer 58 10000 ???? .POINTER SET {1} 59 10000 ???? .ADDRESS SET {2} 60 10000 ???? 61 10000 ???? LDA #<.ADDRESS ; Get Lowbyte of Address 62 10000 ???? STA .POINTER ; Store in pointer 63 10000 ???? LDA #>.ADDRESS ; Get Hibyte of Address 64 10000 ???? STA .POINTER+1 ; Store in pointer+1 65 10000 ???? 66 10000 ???? ENDM 67 10000 ???? 68 10000 ???? ; EOF 69 10000 ???? ; Provided under the CC0 license. See the included LICENSE.txt for details. 70 10000 ???? 71 10000 ???? ; 7800MACRO.H 72 10000 ???? 73 10000 ???? ;------------------------------------------------------- 74 10000 ???? ; BOXCOLLISIONCHECK 75 10000 ???? ; author: Mike Saarna 76 10000 ???? ; 77 10000 ???? ; A general bounding box collision check. compares 2 rectangles of differing size 78 10000 ???? ; and shape for overlap. Carry is set for collision detected, clear for none. 79 10000 ???? ; 80 10000 ???? ; Usage: BOXCOLLISIONCHECK x1var,y1var,w1var,h1var,x2var,y2var,w2var,h2var 81 10000 ???? ; 82 10000 ???? 83 10000 ???? MAC boxcollisioncheck 84 10000 ???? .boxx1 SET {1} 85 10000 ???? .boxy1 SET {2} 86 10000 ???? .boxw1 SET {3} 87 10000 ???? .boxh1 SET {4} 88 10000 ???? .boxx2 SET {5} 89 10000 ???? .boxy2 SET {6} 90 10000 ???? .boxw2 SET {7} 91 10000 ???? .boxh2 SET {8} 92 10000 ???? 93 10000 ???? .DoXCollisionCheck 94 10000 ???? lda .boxx1 ;3 95 10000 ???? cmp .boxx2 ;2 96 10000 ???? bcs .X1isbiggerthanX2 ;2/3 97 10000 ???? .X2isbiggerthanX1 98 10000 ???? adc #.boxw1 ;2 99 10000 ???? cmp .boxx2 ;3 100 10000 ???? bcs .DoYCollisionCheck ;3/2 101 10000 ???? bcc .noboxcollision ;3 102 10000 ???? .X1isbiggerthanX2 103 10000 ???? clc ;2 104 10000 ???? sbc #.boxw2 ;2 105 10000 ???? cmp .boxx2 ;3 106 10000 ???? bcs .noboxcollision ;3/2 107 10000 ???? .DoYCollisionCheck 108 10000 ???? lda .boxy1 ;3 109 10000 ???? cmp .boxy2 ;3 110 10000 ???? bcs .Y1isbiggerthanY2 ;3/2 111 10000 ???? .Y2isbiggerthanY1 112 10000 ???? adc #.boxh1 ;2 113 10000 ???? cmp .boxy2 ;3 114 10000 ???? jmp .checkdone ;6 115 10000 ???? .Y1isbiggerthanY2 116 10000 ???? clc ;2 117 10000 ???? sbc #.boxh2 ;2 118 10000 ???? cmp .boxy2 ;3 119 10000 ???? bcs .noboxcollision ;3/2 120 10000 ???? .boxcollision 121 10000 ???? sec ;2 122 10000 ???? .byte $24 ; hardcoded "BIT [clc opcode]", used to skip over the following clc 123 10000 ???? .noboxcollision 124 10000 ???? clc ;2 125 10000 ???? .checkdone 126 10000 ???? 127 10000 ???? ENDM 128 10000 ???? 129 10000 ???? MAC median3 130 10000 ???? 131 10000 ???? ; A median filter (for smoothing paddle jitter) 132 10000 ???? ; this macro takes the current paddle value, compares it to historic 133 10000 ???? ; values, and replaces the current paddle value with the median. 134 10000 ???? ; 135 10000 ???? ; called as: MEDIAN3 STORAGE CURRENT 136 10000 ???? ; where STORAGE points to 3 consecutive bytes of memory. The first 2 137 10000 ???? ; must be dedicated to this MEDIAN filter. The last 1 is a temp. 138 10000 ???? ; where CURRENT is memory holding the new value you wish to compare to 139 10000 ???? ; the previous values, and update with the median value. 140 10000 ???? ; 141 10000 ???? ; returns: CURRENT (modified to contain median value) 142 10000 ???? ; 143 10000 ???? ; author: Mike Saarna (aka RevEng) 144 10000 ???? 145 10000 ???? .MedianBytes SET {1} 146 10000 ???? .NewValue SET {2} 147 10000 ???? 148 10000 ???? lda #0 149 10000 ???? ldy .NewValue 150 10000 ???? sty .MedianBytes+2 ; put the new value in the most "recent" slot 151 10000 ???? 152 10000 ???? ; build an index from relative size comparisons between our 3 values. 153 10000 ???? cpy .MedianBytes 154 10000 ???? rol 155 10000 ???? cpy .MedianBytes+1 156 10000 ???? rol 157 10000 ???? ldy .MedianBytes 158 10000 ???? cpy .MedianBytes+1 159 10000 ???? rol 160 10000 ???? tay 161 10000 ???? 162 10000 ???? ldx MedianOrderLUT,y ; convert the size-comparison index to an index to the median value 163 10000 ???? lda .MedianBytes,x 164 10000 ???? sta .NewValue ; we replace the new value memory with the median value 165 10000 ???? 166 10000 ???? ; then shift values from "newer" bytes to "older" bytes, leaving the 167 10000 ???? ; newest byte (.MedianBytes+2) empty for next time. 168 10000 ???? lda .MedianBytes+1 169 10000 ???? sta .MedianBytes 170 10000 ???? lda .MedianBytes+2 171 10000 ???? sta .MedianBytes+1 172 10000 ???? ifnconst MedianOrderLUT 173 10000 ???? jmp MedianOrderLUTend 174 10000 ???? MedianOrderLUT ; converts our "comparison index" to an index to the median value 175 10000 ???? .byte 0 ; 0 B2 < B0 < B1 176 10000 ???? .byte 1 ; 1 B2 < B1 < B0 177 10000 ???? .byte 2 ; 2 impossible 178 10000 ???? .byte 2 ; 3 B1 < B2 < B0 179 10000 ???? .byte 2 ; 4 B0 < B2 < B1 180 10000 ???? .byte 2 ; 5 impossible 181 10000 ???? .byte 1 ; 6 B0 < B1 < B2 182 10000 ???? .byte 0 ; 7 B1 < B0 < B2 183 10000 ???? MedianOrderLUTend 184 10000 ???? endif 185 10000 ???? ENDM 186 10000 ???? 187 10000 ???? MAC plotsprite 188 10000 ???? 189 10000 ???? ; A macro version of the plotsprite command. 190 10000 ???? ; This trades off rom space for speed. 191 10000 ???? ; It also doesn't check if the visible screen is displayed or not. 192 10000 ???? ; It has no training wheels. It is all rusty sharp edges. 193 10000 ???? 194 10000 ???? .GFXLabel SET {1} 195 10000 ???? .Palette SET {2} ; constant 196 10000 ???? .SpriteX SET {3} ; variable 197 10000 ???? .SpriteY SET {4} ; variable 198 10000 ???? .ByteOffset SET {5} ; variable 199 10000 ???? 200 10000 ???? lda .SpriteY 201 10000 ???? lsr 202 10000 ???? lsr 203 10000 ???? asr #%11111110 ; ensure carry is clear 204 10000 ???? if WZONEHEIGHT = 16 205 10000 ???? asr #%11111110 ; ensure carry is clear 206 10000 ???? endif 207 10000 ???? 208 10000 ???? tax 209 10000 ???? 210 10000 ???? lda DLPOINTL,x ; setup DL pointer for this zone 211 10000 ???? sta dlpnt 212 10000 ???? lda DLPOINTH,x ; setup DL pointer for this zone 213 10000 ???? sta dlpnt+1 214 10000 ???? 215 10000 ???? ldy dlend,x ; find the next new object position in this zone 216 10000 ???? 217 10000 ???? lda .ByteOffset 218 10000 ???? if {1}_width = 2 219 10000 ???? asl 220 10000 ???? endif 221 10000 ???? if {1}_width = 3 222 10000 ???? asl 223 10000 ???? adc .ByteOffset 224 10000 ???? endif 225 10000 ???? if {1}_width = 4 226 10000 ???? asl 227 10000 ???? asl 228 10000 ???? endif 229 10000 ???? if {1}_width = 5 230 10000 ???? asl 231 10000 ???? asl 232 10000 ???? adc .ByteOffset 233 10000 ???? endif 234 10000 ???? if {1}_width = 6 235 10000 ???? asl 236 10000 ???? adc .ByteOffset 237 10000 ???? asl 238 10000 ???? endif 239 10000 ???? if {1}_width = 7 240 10000 ???? asl 241 10000 ???? adc .ByteOffset 242 10000 ???? asl 243 10000 ???? adc .ByteOffset 244 10000 ???? endif 245 10000 ???? if {1}_width = 8 246 10000 ???? asl 247 10000 ???? asl 248 10000 ???? asl 249 10000 ???? endif 250 10000 ???? if {1}_width = 9 251 10000 ???? asl 252 10000 ???? asl 253 10000 ???? asl 254 10000 ???? adc .ByteOffset 255 10000 ???? endif 256 10000 ???? if {1}_width = 10 257 10000 ???? asl 258 10000 ???? asl 259 10000 ???? adc .ByteOffset 260 10000 ???? asl 261 10000 ???? endif 262 10000 ???? if {1}_width = 11 263 10000 ???? asl 264 10000 ???? asl 265 10000 ???? adc .ByteOffset 266 10000 ???? asl 267 10000 ???? adc .ByteOffset 268 10000 ???? endif 269 10000 ???? if {1}_width = 12 270 10000 ???? asl 271 10000 ???? adc .ByteOffset 272 10000 ???? asl 273 10000 ???? asl 274 10000 ???? endif 275 10000 ???? if {1}_width = 13 276 10000 ???? asl 277 10000 ???? adc .ByteOffset 278 10000 ???? asl 279 10000 ???? asl 280 10000 ???? adc .ByteOffset 281 10000 ???? endif 282 10000 ???? if {1}_width = 14 283 10000 ???? asl 284 10000 ???? adc .ByteOffset 285 10000 ???? asl 286 10000 ???? adc .ByteOffset 287 10000 ???? asl 288 10000 ???? endif 289 10000 ???? 290 10000 ???? adc #<.GFXLabel ; carry is clear via previous asl or asr 291 10000 ???? sta (dlpnt),y ; #1 - low byte object address 292 10000 ???? 293 10000 ???? iny 294 10000 ???? 295 10000 ???? lda #({1}_mode | %01000000) 296 10000 ???? sta (dlpnt),y ; #2 - graphics mode , indirect 297 10000 ???? 298 10000 ???? iny 299 10000 ???? 300 10000 ???? lda .SpriteY 301 10000 ???? and #(WZONEHEIGHT - 1) 302 10000 ???? cmp #1 ; clear carry if our sprite is just in this zone 303 10000 ???? ora #>.GFXLabel 304 10000 ???? sta (dlpnt),y ; #3 - hi byte object address 305 10000 ???? 306 10000 ???? iny 307 10000 ???? 308 10000 ???? lda #({1}_width_twoscompliment | (.Palette * 32)) 309 10000 ???? sta (dlpnt),y ; #4 - palette|width 310 10000 ???? 311 10000 ???? iny 312 10000 ???? 313 10000 ???? lda .SpriteX 314 10000 ???? sta (dlpnt),y ; #5 - x object position 315 10000 ???? 316 10000 ???? iny 317 10000 ???? sty dlend,x 318 10000 ???? 319 10000 ???? ifconst ALWAYSTERMINATE 320 10000 ???? iny 321 10000 ???? lda #0 322 10000 ???? sta (dlpnt),y 323 10000 ???? endif 324 10000 ???? 325 10000 ???? bcc .PLOTSPRITEend 326 10000 ???? 327 10000 ???? inx ; next zone 328 10000 ???? 329 10000 ???? lda DLPOINTL,x ; setup DL pointer for this zone 330 10000 ???? sta dlpnt 331 10000 ???? lda DLPOINTH,x ; setup DL pointer for this zone 332 10000 ???? sta dlpnt+1 333 10000 ???? 334 10000 ???? ldy dlend,x ; find the next new object position in this zone 335 10000 ???? 336 10000 ???? lda .ByteOffset 337 10000 ???? if {1}_width = 1 338 10000 ???? clc 339 10000 ???? endif 340 10000 ???? if {1}_width = 2 341 10000 ???? asl ; carry clear 342 10000 ???? endif 343 10000 ???? if {1}_width = 3 344 10000 ???? asl ; carry clear 345 10000 ???? adc .ByteOffset 346 10000 ???? endif 347 10000 ???? if {1}_width = 4 348 10000 ???? asl ; carry clear 349 10000 ???? asl 350 10000 ???? endif 351 10000 ???? if {1}_width = 5 352 10000 ???? asl ; carry clear 353 10000 ???? asl 354 10000 ???? adc .ByteOffset 355 10000 ???? endif 356 10000 ???? if {1}_width = 6 357 10000 ???? asl ; carry clear 358 10000 ???? adc .ByteOffset 359 10000 ???? asl 360 10000 ???? endif 361 10000 ???? if {1}_width = 7 362 10000 ???? asl ; carry clear 363 10000 ???? adc .ByteOffset 364 10000 ???? asl 365 10000 ???? endif 366 10000 ???? if {1}_width = 8 367 10000 ???? asl ; carry clear 368 10000 ???? asl 369 10000 ???? asl 370 10000 ???? endif 371 10000 ???? if {1}_width = 9 372 10000 ???? asl ; carry clear 373 10000 ???? asl 374 10000 ???? asl 375 10000 ???? adc .ByteOffset 376 10000 ???? endif 377 10000 ???? if {1}_width = 10 378 10000 ???? asl ; carry clear 379 10000 ???? asl 380 10000 ???? adc .ByteOffset 381 10000 ???? asl 382 10000 ???? endif 383 10000 ???? if {1}_width = 11 384 10000 ???? asl ; carry clear 385 10000 ???? asl 386 10000 ???? adc .ByteOffset 387 10000 ???? asl 388 10000 ???? adc .ByteOffset 389 10000 ???? endif 390 10000 ???? if {1}_width = 12 391 10000 ???? asl ; carry clear 392 10000 ???? adc .ByteOffset 393 10000 ???? asl 394 10000 ???? asl 395 10000 ???? endif 396 10000 ???? if {1}_width = 13 397 10000 ???? asl ; carry clear 398 10000 ???? adc .ByteOffset 399 10000 ???? asl 400 10000 ???? asl 401 10000 ???? adc .ByteOffset 402 10000 ???? endif 403 10000 ???? if {1}_width = 14 404 10000 ???? asl ; carry clear 405 10000 ???? adc .ByteOffset 406 10000 ???? asl 407 10000 ???? adc .ByteOffset 408 10000 ???? asl 409 10000 ???? endif 410 10000 ???? 411 10000 ???? adc #<.GFXLabel 412 10000 ???? sta (dlpnt),y ; #1 - low byte object address 413 10000 ???? 414 10000 ???? iny 415 10000 ???? 416 10000 ???? lda #({1}_mode | %01000000) 417 10000 ???? sta (dlpnt),y ; #2 - graphics mode , indirect 418 10000 ???? 419 10000 ???? iny 420 10000 ???? 421 10000 ???? lda .SpriteY 422 10000 ???? and #(WZONEHEIGHT - 1) 423 10000 ???? ora #>(.GFXLabel - (WZONEHEIGHT * 256)) ; start in the dma hole 424 10000 ???? sta (dlpnt),y ; #3 - hi byte object address 425 10000 ???? 426 10000 ???? iny 427 10000 ???? 428 10000 ???? lda #({1}_width_twoscompliment | (.Palette * 32)) 429 10000 ???? sta (dlpnt),y ; #4 - palette|width 430 10000 ???? 431 10000 ???? iny 432 10000 ???? 433 10000 ???? lda .SpriteX 434 10000 ???? sta (dlpnt),y ; #5 - x object position 435 10000 ???? 436 10000 ???? iny 437 10000 ???? sty dlend,x 438 10000 ???? 439 10000 ???? ifconst ALWAYSTERMINATE 440 10000 ???? iny 441 10000 ???? lda #0 442 10000 ???? sta (dlpnt),y 443 10000 ???? endif 444 10000 ???? 445 10000 ???? .PLOTSPRITEend 446 10000 ???? ENDM 447 10000 ???? 448 10000 ???? ; 449 10000 ???? ; speakjet.inc 450 10000 ???? ; 451 10000 ???? ; 452 10000 ???? ; AtariVox Speech Synth Driver 453 10000 ???? ; 454 10000 ???? ; By Alex Herbert, 2004 455 10000 ???? ; 456 10000 ???? 457 10000 ???? 458 10000 ???? 459 10000 ???? 460 10000 ???? ; Constants 461 10000 ???? 462 10000 ???? 463 10000 ???? 00 01 SERIAL_OUTMASK equ $01 464 10000 ???? 00 02 SERIAL_RDYMASK equ $02 465 10000 ???? 466 10000 ???? 467 10000 ???? 468 10000 ???? ; Macros 469 10000 ???? 470 10000 ???? mac spkout 471 10000 ???? 472 10000 ???? ; check buffer-full status 473 10000 ???? lda SWCHA 474 10000 ???? and #SERIAL_RDYMASK 475 10000 ???? beq .speech_done 476 10000 ???? 477 10000 ???? ; get next speech byte 478 10000 ???? ldy #$00 479 10000 ???? lda (speech_addr),y 480 10000 ???? 481 10000 ???? ; invert data and check for end of string 482 10000 ???? eor #$ff 483 10000 ???? ;sta BACKGRND ; debug - uncomment to flash the background color with vox data 484 10000 ???? beq .speech_done 485 10000 ???? sta {1} 486 10000 ???? 487 10000 ???? ; increment speech pointer 488 10000 ???? inc speech_addr 489 10000 ???? bne .incaddr_skip 490 10000 ???? inc speech_addr+1 491 10000 ???? .incaddr_skip 492 10000 ???? 493 10000 ???? ; output byte as serial data 494 10000 ???? 495 10000 ???? sec ; start bit 496 10000 ???? .byteout_loop 497 10000 ???? ; put carry flag into bit 0 of SWACNT, perserving other bits 498 10000 ???? lda SWACNT ; 4 499 10000 ???? and #$fe ; 2 6 500 10000 ???? adc #$00 ; 2 8 501 10000 ???? sta SWACNT ; 4 12 502 10000 ???? 503 10000 ???? ; 10 bits sent? (1 start bit, 8 data bits, 1 stop bit) 504 10000 ???? cpy #$09 ; 2 14 505 10000 ???? beq .speech_done ; 2 16 506 10000 ???? iny ; 2 18 507 10000 ???? 508 10000 ???? ; the 7800 is 1.5x faster than the 2600. Waste more cycles here 509 10000 ???? ; to match the original baud rate... 510 10000 ???? ;ldx #$07 ; 2600 511 10000 ???? ldx #$0D 512 10000 ???? 513 10000 ???? .delay_loop 514 10000 ???? dex ; 515 10000 ???? bne .delay_loop ; 36 54 516 10000 ???? 517 10000 ???? ; shift next data bit into carry 518 10000 ???? lsr {1} ; 5 59 519 10000 ???? 520 10000 ???? ; and loop (branch always taken) 521 10000 ???? bpl .byteout_loop ; 3 62 cycles for loop 522 10000 ???? 523 10000 ???? .speech_done 524 10000 ???? 525 10000 ???? endm 526 10000 ???? 527 10000 ???? 528 10000 ???? mac speak 529 10000 ???? 530 10000 ???? lda #<{1} 531 10000 ???? sta speech_addr 532 10000 ???? lda #>{1} 533 10000 ???? sta speech_addr+1 534 10000 ???? 535 10000 ???? endm 536 10000 ???? 537 10000 ???? 538 10000 ???? 539 10000 ???? ; Provided under the CC0 license. See the included LICENSE.txt for details. 540 10000 ???? 541 10000 ???? processor 6502 542 10000 ???? ------- FILE 7800basic.h LEVEL 2 PASS 3 0 10000 ???? include "7800basic.h" 1 10000 ???? ; Provided under the CC0 license. See the included LICENSE.txt for details. 2 10000 ???? 3 10000 ???? processor 6502 ------- FILE 7800.h LEVEL 3 PASS 3 0 10000 ???? include "7800.h" 1 10000 ???? ; Provided under the CC0 license. See the included LICENSE.txt for details. 2 10000 ???? 3 10000 ???? ; 7800.h 4 10000 ???? ; Version 1.0, 2019/12/13 5 10000 ???? 6 10000 ???? ; This file defines hardware registers and memory mapping for the 7 10000 ???? ; Atari 7800. It is distributed as a companion machine-specific support package 8 10000 ???? ; for the DASM compiler. Updates to this file, DASM, and associated tools are 9 10000 ???? ; available at https://github.com/dasm-assembler/dasm 10 10000 ???? 11 10000 ???? 12 10000 ???? ; ******************** 7800 Hardware Adresses *************************** 13 10000 ???? ; 14 10000 ???? ; MEMORY MAP USAGE OF THE 7800 15 10000 ???? ; 16 10000 ???? ; 00 - 1F TIA REGISTERS 17 10000 ???? ; 20 - 3F MARIA REGISTERS 18 10000 ???? ; 40 - FF RAM block 0 (zero page) 19 10000 ???? ; 100 - 11F TIA (mirror of 0000-001f) 20 10000 ???? ; 120 - 13F MARIA (mirror of 0020-003f) 21 10000 ???? ; 140 - 1FF RAM block 1 (stack) 22 10000 ???? ; 200 - 21F TIA (mirror of 0000-001f) 23 10000 ???? ; 220 - 23F MARIA (mirror of 0020-003f) 24 10000 ???? ; 240 - 27F ??? 25 10000 ???? ; 280 - 2FF RIOT I/O ports and timers 26 10000 ???? ; 300 - 31F TIA (mirror of 0000-001f) 27 10000 ???? ; 320 - 33F MARIA (mirror of 0020-003f) 28 10000 ???? ; 340 - 3FF ??? 29 10000 ???? ; 400 - 47F unused address space 30 10000 ???? ; 480 - 4FF RIOT RAM 31 10000 ???? ; 500 - 57F unused address space 32 10000 ???? ; 580 - 5FF RIOT RAM (mirror of 0480-04ff) 33 10000 ???? ; 600 - 17FF unused address space 34 10000 ???? ; 1800 - 203F RAM 35 10000 ???? ; 2040 - 20FF RAM block 0 (mirror of 0000-001f) 36 10000 ???? ; 2100 - 213F RAM 37 10000 ???? ; 2140 - 21FF RAM block 1 (mirror of 0140-01ff) 38 10000 ???? ; 2200 - 27FF RAM 39 10000 ???? ; 2800 - 2FFF mirror of 1800-27ff 40 10000 ???? ; 3000 - 3FFF unused address space 41 10000 ???? ; 4000 - FF7F potential cartridge address space 42 10000 ???? ; FF80 - FFF9 RESERVED FOR ENCRYPTION 43 10000 ???? ; FFFA - FFFF 6502 VECTORS 44 10000 ???? 45 10000 ???? 46 10000 ???? ;****** 00-1F ********* TIA REGISTERS ****************** 47 10000 ???? 48 10000 ???? 00 01 INPTCTRL = $01 ;Input control. In same address space as TIA. write-only 49 10000 ???? 00 01 VBLANK = $01 ;VBLANK. D7=1:dump paddle caps to ground. write-only 50 10000 ???? 00 08 INPT0 = $08 ;Paddle Control Input 0 read-only 51 10000 ???? 00 09 INPT1 = $09 ;Paddle Control Input 1 read-only 52 10000 ???? 00 0a INPT2 = $0A ;Paddle Control Input 2 read-only 53 10000 ???? 00 0b INPT3 = $0B ;Paddle Control Input 3 read-only 54 10000 ???? 55 10000 ???? ; ** some common alternate names for INPT0/1/2/3 56 10000 ???? 00 08 INPT4B = $08 ;Joystick 0 Fire 1 read-only 57 10000 ???? 00 09 INPT4A = $09 ;Joystick 0 Fire 1 read-only 58 10000 ???? 00 0a INPT5B = $0A ;Joystick 1 Fire 0 read-only 59 10000 ???? 00 0b INPT5A = $0B ;Joystick 1 Fire 1 read-only 60 10000 ???? 00 08 INPT4R = $08 ;Joystick 0 Fire 1 read-only 61 10000 ???? 00 09 INPT4L = $09 ;Joystick 0 Fire 1 read-only 62 10000 ???? 00 0a INPT5R = $0A ;Joystick 1 Fire 0 read-only 63 10000 ???? 00 0b INPT5L = $0B ;Joystick 1 Fire 1 read-only 64 10000 ???? 65 10000 ???? 00 0c INPT4 = $0C ;Player 0 Fire Button Input read-only 66 10000 ???? 00 0d INPT5 = $0D ;Player 1 Fire Button Input read-only 67 10000 ???? 68 10000 ???? 00 15 AUDC0 = $15 ;Audio Control Channel 0 write-only 69 10000 ???? 00 16 AUDC1 = $16 ;Audio Control Channel 1 write-only 70 10000 ???? 00 17 AUDF0 = $17 ;Audio Frequency Channel 0 write-only 71 10000 ???? 00 18 AUDF1 = $18 ;Audio Frequency Channel 1 write-only 72 10000 ???? 00 19 AUDV0 = $19 ;Audio Volume Channel 0 write-only 73 10000 ???? 00 1a AUDV1 = $1A ;Audio Volume Channel 1 write-only 74 10000 ???? 75 10000 ???? ;****** 20-3F ********* MARIA REGISTERS *************** 76 10000 ???? 77 10000 ???? 00 20 BACKGRND = $20 ;Background Color write-only 78 10000 ???? 00 21 P0C1 = $21 ;Palette 0 - Color 1 write-only 79 10000 ???? 00 22 P0C2 = $22 ;Palette 0 - Color 2 write-only 80 10000 ???? 00 23 P0C3 = $23 ;Palette 0 - Color 3 write-only 81 10000 ???? 00 24 WSYNC = $24 ;Wait For Sync write-only 82 10000 ???? 00 25 P1C1 = $25 ;Palette 1 - Color 1 write-only 83 10000 ???? 00 26 P1C2 = $26 ;Palette 1 - Color 2 write-only 84 10000 ???? 00 27 P1C3 = $27 ;Palette 1 - Color 3 write-only 85 10000 ???? 00 28 MSTAT = $28 ;Maria Status read-only 86 10000 ???? 00 29 P2C1 = $29 ;Palette 2 - Color 1 write-only 87 10000 ???? 00 2a P2C2 = $2A ;Palette 2 - Color 2 write-only 88 10000 ???? 00 2b P2C3 = $2B ;Palette 2 - Color 3 write-only 89 10000 ???? 00 2c DPPH = $2C ;Display List List Pointer High write-only 90 10000 ???? 00 2d P3C1 = $2D ;Palette 3 - Color 1 write-only 91 10000 ???? 00 2e P3C2 = $2E ;Palette 3 - Color 2 write-only 92 10000 ???? 00 2f P3C3 = $2F ;Palette 3 - Color 3 write-only 93 10000 ???? 00 30 DPPL = $30 ;Display List List Pointer Low write-only 94 10000 ???? 00 31 P4C1 = $31 ;Palette 4 - Color 1 write-only 95 10000 ???? 00 32 P4C2 = $32 ;Palette 4 - Color 2 write-only 96 10000 ???? 00 33 P4C3 = $33 ;Palette 4 - Color 3 write-only 97 10000 ???? 00 34 CHARBASE = $34 ;Character Base Address write-only 98 10000 ???? 00 34 CHBASE = $34 ;Character Base Address write-only 99 10000 ???? 00 35 P5C1 = $35 ;Palette 5 - Color 1 write-only 100 10000 ???? 00 36 P5C2 = $36 ;Palette 5 - Color 2 write-only 101 10000 ???? 00 37 P5C3 = $37 ;Palette 5 - Color 3 write-only 102 10000 ???? 00 38 OFFSET = $38 ;Unused - Store zero here write-only 103 10000 ???? 00 39 P6C1 = $39 ;Palette 6 - Color 1 write-only 104 10000 ???? 00 3a P6C2 = $3A ;Palette 6 - Color 2 write-only 105 10000 ???? 00 3b P6C3 = $3B ;Palette 6 - Color 3 write-only 106 10000 ???? 00 3c CTRL = $3C ;Maria Control Register write-only 107 10000 ???? 00 3d P7C1 = $3D ;Palette 7 - Color 1 write-only 108 10000 ???? 00 3e P7C2 = $3E ;Palette 7 - Color 2 write-only 109 10000 ???? 00 3f P7C3 = $3F ;Palette 7 - Color 3 write-only 110 10000 ???? 111 10000 ???? 112 10000 ???? ;****** 280-2FF ******* PIA PORTS AND TIMERS ************ 113 10000 ???? 114 10000 ???? 02 80 SWCHA = $280 ;P0+P1 Joystick Directional Input read-write 115 10000 ???? 02 81 CTLSWA = $281 ;I/O Control for SCHWA read-write 116 10000 ???? 02 81 SWACNT = $281 ;VCS name for above read-write 117 10000 ???? 02 82 SWCHB = $282 ;Console Switches read-write 118 10000 ???? 02 83 CTLSWB = $283 ;I/O Control for SCHWB read-write 119 10000 ???? 02 83 SWBCNT = $283 ;VCS name for above read-write 120 10000 ???? 121 10000 ???? 02 84 INTIM = $284 ;Interval Timer Read read-only 122 10000 ???? 02 94 TIM1T = $294 ;Set 1 CLK Interval (838 nsec/interval) write-only 123 10000 ???? 02 95 TIMINT = $295 ;Interval Timer Interrupt read-only 124 10000 ???? 02 95 TIM8T = $295 ;Set 8 CLK Interval (6.7 usec/interval) write-only 125 10000 ???? 02 96 TIM64T = $296 ;Set 64 CLK Interval (63.6 usec/interval) write-only 126 10000 ???? 02 97 T1024T = $297 ;Set 1024 CLK Interval (858.2 usec/interval) write-only 127 10000 ???? 02 9e TIM64TI = $29E ;Interrupt timer 64T write-only 128 10000 ???? 129 10000 ???? ;XM 130 10000 ???? 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 10000 ???? 04 70 XCTRL1 = $470 132 10000 ???? 04 78 XCTRL2 = $478 133 10000 ???? 04 7c XCTRL3 = $47c 134 10000 ???? 04 71 XCTRL4 = $471 135 10000 ???? 04 72 XCTRL5 = $472 136 10000 ???? 137 10000 ???? ; Pokey register relative locations, since its base may be different 138 10000 ???? ; depending on the hardware. 139 10000 ???? 00 00 PAUDF0 = $0 ; extra audio channels and frequencies 140 10000 ???? 00 01 PAUDC0 = $1 141 10000 ???? 00 02 PAUDF1 = $2 142 10000 ???? 00 03 PAUDC1 = $3 143 10000 ???? 00 04 PAUDF2 = $4 144 10000 ???? 00 05 PAUDC2 = $5 145 10000 ???? 00 06 PAUDF3 = $6 146 10000 ???? 00 07 PAUDC3 = $7 147 10000 ???? 00 08 PAUDCTL = $8 ; Audio Control 148 10000 ???? 00 09 PSTIMER = $9 149 10000 ???? 00 0a PRANDOM = $A ; 17 bit polycounter pseudo random 150 10000 ???? 00 0f PSKCTL = $F ; Serial Port control ------- FILE 7800basic.h ------- FILE 7800basic_variable_redefs.h LEVEL 3 PASS 3 0 10000 ???? include "7800basic_variable_redefs.h" 1 10000 ???? ; This file contains variable mapping and other information for the current project. 2 10000 ???? 3 10000 ???? 00 00 heofonfir_lucelia_160b_wip_tallsprite_02_mode = $00 4 10000 ???? 00 00 heofonfir_lucelia_160b_wip_tallsprite_02_width_twoscompliment = $00 5 10000 ???? 00 00 heofonfir_lucelia_160b_wip_tallsprite_02_width = $00 6 10000 ???? 00 80 heofonfir_lucelia_160b_wip_tallsprite_01_mode = $80 7 10000 ???? 00 1a heofonfir_lucelia_160b_wip_tallsprite_01_width_twoscompliment = $1a 8 10000 ???? 00 06 heofonfir_lucelia_160b_wip_tallsprite_01_width = $06 9 10000 ???? 00 80 heofonfir_lucelia_160b_wip_tallsprite_00_mode = $80 10 10000 ???? 00 1a heofonfir_lucelia_160b_wip_tallsprite_00_width_twoscompliment = $1a 11 10000 ???? 00 06 heofonfir_lucelia_160b_wip_tallsprite_00_width = $06 12 10000 ???? 00 80 heofonfir_lucelia_160b_wip_mode = $80 13 10000 ???? 00 1a heofonfir_lucelia_160b_wip_width_twoscompliment = $1a 14 10000 ???? 00 06 heofonfir_lucelia_160b_wip_width = $06 15 10000 ???? 00 00 heofonfir_bullet_mode = $00 16 10000 ???? 00 1f heofonfir_bullet_width_twoscompliment = $1f 17 10000 ???? 00 01 heofonfir_bullet_width = $01 18 10000 ???? 00 00 heofonfir_push_fire_banner01_mode = $00 19 10000 ???? 00 16 heofonfir_push_fire_banner01_width_twoscompliment = $16 20 10000 ???? 00 0a heofonfir_push_fire_banner01_width = $0a 21 10000 ???? 00 00 heofonfir_push_fire_banner00_mode = $00 22 10000 ???? 00 16 heofonfir_push_fire_banner00_width_twoscompliment = $16 23 10000 ???? 00 0a heofonfir_push_fire_banner00_width = $0a 24 10000 ???? 00 00 heofonfir_font_mode = $00 25 10000 ???? 00 11 heofonfir_font_width_twoscompliment = $11 26 10000 ???? 00 4f heofonfir_font_width = $4f 27 10000 ???? 00 00 atascii_mode = $00 28 10000 ???? 00 0a atascii_width_twoscompliment = $0a 29 10000 ???? 00 f6 atascii_width = $f6 30 10000 ???? 00 54 sfx_pulsecannon_length = .skipL073-sfx_pulsecannon 31 10000 ???? 32 10000 ???? 00 00 heofonfir_lucelia_160b_wip_tallsprite_01_color15 = 0 33 10000 ???? 00 00 heofonfir_lucelia_160b_wip_tallsprite_01_color14 = 0 34 10000 ???? 00 00 heofonfir_lucelia_160b_wip_tallsprite_01_color13 = 0 35 10000 ???? 00 00 heofonfir_lucelia_160b_wip_tallsprite_01_color12 = 0 36 10000 ???? 00 00 heofonfir_lucelia_160b_wip_tallsprite_01_color11 = 0 37 10000 ???? 00 00 heofonfir_lucelia_160b_wip_tallsprite_01_color10 = 0 38 10000 ???? 00 00 heofonfir_lucelia_160b_wip_tallsprite_01_color9 = 0 39 10000 ???? 00 00 heofonfir_lucelia_160b_wip_tallsprite_01_color8 = 0 40 10000 ???? 00 00 heofonfir_lucelia_160b_wip_tallsprite_01_color7 = 0 41 10000 ???? 00 00 heofonfir_lucelia_160b_wip_tallsprite_01_color6 = 0 42 10000 ???? 00 04 heofonfir_lucelia_160b_wip_tallsprite_01_color5 = $04 43 10000 ???? 00 2c heofonfir_lucelia_160b_wip_tallsprite_01_color4 = $2c 44 10000 ???? 00 0f heofonfir_lucelia_160b_wip_tallsprite_01_color3 = $0f 45 10000 ???? 00 28 heofonfir_lucelia_160b_wip_tallsprite_01_color2 = $28 46 10000 ???? 00 3c heofonfir_lucelia_160b_wip_tallsprite_01_color1 = $3c 47 10000 ???? 00 00 heofonfir_lucelia_160b_wip_tallsprite_01_color0 = $00 48 10000 ???? 00 00 heofonfir_lucelia_160b_wip_tallsprite_00_color15 = 0 49 10000 ???? 00 00 heofonfir_lucelia_160b_wip_tallsprite_00_color14 = 0 50 10000 ???? 00 00 heofonfir_lucelia_160b_wip_tallsprite_00_color13 = 0 51 10000 ???? 00 00 heofonfir_lucelia_160b_wip_tallsprite_00_color12 = 0 52 10000 ???? 00 00 heofonfir_lucelia_160b_wip_tallsprite_00_color11 = 0 53 10000 ???? 00 00 heofonfir_lucelia_160b_wip_tallsprite_00_color10 = 0 54 10000 ???? 00 00 heofonfir_lucelia_160b_wip_tallsprite_00_color9 = 0 55 10000 ???? 00 00 heofonfir_lucelia_160b_wip_tallsprite_00_color8 = 0 56 10000 ???? 00 00 heofonfir_lucelia_160b_wip_tallsprite_00_color7 = 0 57 10000 ???? 00 00 heofonfir_lucelia_160b_wip_tallsprite_00_color6 = 0 58 10000 ???? 00 04 heofonfir_lucelia_160b_wip_tallsprite_00_color5 = $04 59 10000 ???? 00 2c heofonfir_lucelia_160b_wip_tallsprite_00_color4 = $2c 60 10000 ???? 00 0f heofonfir_lucelia_160b_wip_tallsprite_00_color3 = $0f 61 10000 ???? 00 28 heofonfir_lucelia_160b_wip_tallsprite_00_color2 = $28 62 10000 ???? 00 3c heofonfir_lucelia_160b_wip_tallsprite_00_color1 = $3c 63 10000 ???? 00 00 heofonfir_lucelia_160b_wip_tallsprite_00_color0 = $00 64 10000 ???? 00 00 heofonfir_lucelia_160b_wip_color15 = 0 65 10000 ???? 00 00 heofonfir_lucelia_160b_wip_color14 = 0 66 10000 ???? 00 00 heofonfir_lucelia_160b_wip_color13 = 0 67 10000 ???? 00 00 heofonfir_lucelia_160b_wip_color12 = 0 68 10000 ???? 00 00 heofonfir_lucelia_160b_wip_color11 = 0 69 10000 ???? 00 00 heofonfir_lucelia_160b_wip_color10 = 0 70 10000 ???? 00 00 heofonfir_lucelia_160b_wip_color9 = 0 71 10000 ???? 00 00 heofonfir_lucelia_160b_wip_color8 = 0 72 10000 ???? 00 00 heofonfir_lucelia_160b_wip_color7 = 0 73 10000 ???? 00 00 heofonfir_lucelia_160b_wip_color6 = 0 74 10000 ???? 00 04 heofonfir_lucelia_160b_wip_color5 = $04 75 10000 ???? 00 2c heofonfir_lucelia_160b_wip_color4 = $2c 76 10000 ???? 00 0f heofonfir_lucelia_160b_wip_color3 = $0f 77 10000 ???? 00 28 heofonfir_lucelia_160b_wip_color2 = $28 78 10000 ???? 00 3c heofonfir_lucelia_160b_wip_color1 = $3c 79 10000 ???? 00 00 heofonfir_lucelia_160b_wip_color0 = $00 80 10000 ???? 00 28 heofonfir_bullet_color3 = $28 81 10000 ???? 00 2c heofonfir_bullet_color2 = $2c 82 10000 ???? 00 0f heofonfir_bullet_color1 = $0f 83 10000 ???? 00 00 heofonfir_bullet_color0 = $00 84 10000 ???? 00 0f heofonfir_push_fire_banner_color3 = heofonfir_push_fire_banner00_color3 85 10000 ???? 00 2c heofonfir_push_fire_banner_color2 = heofonfir_push_fire_banner00_color2 86 10000 ???? 00 28 heofonfir_push_fire_banner_color1 = heofonfir_push_fire_banner00_color1 87 10000 ???? 00 0f heofonfir_push_fire_banner01_color3 = $0f 88 10000 ???? 00 2c heofonfir_push_fire_banner01_color2 = $2c 89 10000 ???? 00 28 heofonfir_push_fire_banner01_color1 = $28 90 10000 ???? 00 00 heofonfir_push_fire_banner01_color0 = $00 91 10000 ???? 00 0f heofonfir_push_fire_banner00_color3 = $0f 92 10000 ???? 00 2c heofonfir_push_fire_banner00_color2 = $2c 93 10000 ???? 00 28 heofonfir_push_fire_banner00_color1 = $28 94 10000 ???? 00 00 heofonfir_push_fire_banner00_color0 = $00 95 10000 ???? 00 00 heofonfir_font_color3 = 0 96 10000 ???? 00 28 heofonfir_font_color2 = $28 97 10000 ???? 00 0f heofonfir_font_color1 = $0f 98 10000 ???? 00 00 heofonfir_font_color0 = $00 99 10000 ???? 00 00 atascii_color1 = $00 100 10000 ???? 00 0f atascii_color0 = $0f 101 10000 ???? 01 4f player_lucelia_layer2leftarm_aniframe = var15 102 10000 ???? 103 10000 ???? 01 4e player_lucelia_layer2rightarm_aniframe = var14 104 10000 ???? 105 10000 ???? 01 4d player_lucelia_layer2nofire_aniframe = var13 106 10000 ???? 107 10000 ???? 01 4c player_lucelia_layer1_aniframe = var12 108 10000 ???? 109 10000 ???? 01 4b player_bullet_slowdown = var11 110 10000 ???? 111 10000 ???? 01 4a player_flag = var10 112 10000 ???? 113 10000 ???? 01 49 joyposright = var9 114 10000 ???? 115 10000 ???? 01 48 joyposleft = var8 116 10000 ???? 117 10000 ???? 01 47 joyposdown = var7 118 10000 ???? 119 10000 ???? 01 46 joyposup = var6 120 10000 ???? 121 10000 ???? 01 45 player_bullet_y = var5 122 10000 ???? 123 10000 ???? 01 44 player_bullet_x = var4 124 10000 ???? 125 10000 ???? 01 43 fire_Debounce = var3 126 10000 ???? 127 10000 ???? 01 42 player_y = var2 128 10000 ???? 129 10000 ???? 01 41 player_x = var1 130 10000 ???? 131 10000 ???? 01 40 frameCounter = var0 132 10000 ???? 133 10000 ???? 00 01 NTSC = 1 134 10000 ???? 00 e0 SCREENHEIGHT = 224 135 10000 ???? 00 01 DOUBLEWIDE = 1 136 10000 ???? 00 01 collisionwrap = 1 137 10000 ???? 00 01 CHECKOVERWRITE = 1 138 10000 ???? 00 08 ZONEHEIGHT = 8 139 10000 ???? 00 01 ROM32K = 1 ------- FILE 7800basic.h 6 10000 ???? 7 10000 ???? ;************ 7800 overall RAM map ************** 8 10000 ???? 9 10000 ???? ; 40-FF zero page RAM 10 10000 ???? ; 140-1FF RAM (stack) 11 10000 ???? ; 1800-203F RAM 12 10000 ???? ; 2100-213F RAM 13 10000 ???? ; 2200-27FF RAM 14 10000 ???? 15 10000 ???? ;************ 7800basic RAM usage map ************** 16 10000 ???? 17 10000 ???? ; 40-FF numerous defines, listed below 18 10000 ???? ; 140-1FF RAM (stack) 19 10000 ???? 20 10000 ???? ; 1800-187F DLL (1800-18DF with page flipping enabled) 21 10000 ???? ; 1880-1FFF DLs (18E0-1FFF with page flipping enabled) 22 10000 ???? 23 10000 ???? ; 2000-203F Reserved 24 10000 ???? ; 2100-213F Reserved 25 10000 ???? ; 2200-27FF Free 26 10000 ???? 27 10000 ???? 1f e0 eeprombuffer = $1FE0 28 10000 ???? 18 00 DLLMEM = $1800 29 10000 ???? 00 70 DBOFFSET = $70 ; $E0 length DL is /2 for double-buffering 30 10000 ???? 31 10000 ???? - ifconst PLOTVALUEPAGE 32 10000 ???? -VALBUFFER = (PLOTVALUEPAGE*256) 33 10000 ???? else 34 10000 ???? 20 00 VALBUFFER = $2000 ; to $203F ** never let VALBUFFER straddle pages 35 10000 ???? endif 36 10000 ???? 37 10000 ???? 38 10000 ???? 21 00 pausestate = $2100 39 10000 ???? 21 01 dlzero = $2101 ; zero to force end of $2100 DL, which we use in vblank and overscan 40 10000 ???? 21 02 sINPT1 = $2102 ; save register for joy button joy0 41 10000 ???? 21 03 sINPT3 = $2103 ; save register for joy button joy1 42 10000 ???? 21 04 currentbank = $2104 43 10000 ???? 44 10000 ???? 21 05 currentrambank = $2105 45 10000 ???? 21 06 charactermode = $2106 46 10000 ???? 21 07 sCTRL = $2107 47 10000 ???? 21 08 pokeydetected = $2108 48 10000 ???? 21 09 paldetected = $2109 49 10000 ???? 21 0a avoxdetected = $210A 50 10000 ???? 21 0b sCHARBASE = $210B ; save register for CHARBASE 51 10000 ???? 52 10000 ???? 21 0c hsdevice = $210C 53 10000 ???? 21 0d hsdifficulty = $210D 54 10000 ???? 21 0e hserror = $210E 55 10000 ???? 21 0f hsgameslot = $210F 56 10000 ???? 21 10 hsnewscoreline = $2110 57 10000 ???? 21 11 hsnewscorerank = $2111 58 10000 ???? 21 12 HSRAMTable = $2112 ; to $212F (30 bytes) Format: III*5, SSS*5 59 10000 ???? 21 12 HSRAMInitials = $2112 ; see above 60 10000 ???? 21 21 HSRAMScores = $2121 ; see above 61 10000 ???? 62 10000 ???? 21 31 ssCTRL = $2131 63 10000 ???? 21 32 ssCHARBASE = $2132 64 10000 ???? 21 33 hsdisplaymode = $2133 65 10000 ???? 21 34 gamedifficulty = $2134 66 10000 ???? 21 35 hsinitialpos = $2135 67 10000 ???? 21 36 hsinitialhold = $2136 68 10000 ???? 21 37 hscursorx = $2137 69 10000 ???? 21 38 hsjoydebounce = $2138 70 10000 ???? 21 39 hsswcha = $2139 71 10000 ???? 21 3a hsinpt1 = $213A 72 10000 ???? 21 3b hscolorchaseindex = $213B 73 10000 ???? 21 3c visibleDLLstart = $213C 74 10000 ???? 21 3d overscanDLLstart = $213D 75 10000 ???? 21 3e frameslost = $213E 76 10000 ???? 77 10000 ???? 78 10000 ???? 00 40 rand = $40 79 10000 ???? 00 41 rand16 = $41 80 10000 ???? 00 42 temp1 = $42 81 10000 ???? 00 43 temp2 = $43 82 10000 ???? 00 44 temp3 = $44 83 10000 ???? 00 45 temp4 = $45 84 10000 ???? 00 46 temp5 = $46 85 10000 ???? 00 47 temp6 = $47 86 10000 ???? 00 48 temp7 = $48 87 10000 ???? 00 49 temp8 = $49 88 10000 ???? 00 4a temp9 = $4a 89 10000 ???? 90 10000 ???? 00 4b pokeybase = $4b 91 10000 ???? 00 4b pokeybaselo = $4b 92 10000 ???? 00 4c pokeybasehi = $4c 93 10000 ???? 94 10000 ???? 00 4d visibleover = $4d 95 10000 ???? 96 10000 ???? 00 4e sfx1pointlo = $4e 97 10000 ???? 00 4f sfx2pointlo = $4f 98 10000 ???? 00 50 sfx1pointhi = $50 99 10000 ???? 00 51 sfx2pointhi = $51 100 10000 ???? 101 10000 ???? 00 52 sfx1priority = $52 102 10000 ???? 00 53 sfx2priority = $53 103 10000 ???? 00 54 sfx1poffset = $54 104 10000 ???? 00 55 sfx2poffset = $55 105 10000 ???? 106 10000 ???? 00 56 sfx1frames = $56 107 10000 ???? 00 57 sfx2frames = $57 108 10000 ???? 00 58 sfx1tick = $58 109 10000 ???? 00 59 sfx2tick = $59 110 10000 ???? 111 10000 ???? 00 5a tempmath = $5a 112 10000 ???? 113 10000 ???? 00 5b pokey1pointlo = $5b 114 10000 ???? 00 5c pokey1pointhi = $5c 115 10000 ???? 00 5d pokey2pointlo = $5d 116 10000 ???? 00 5e pokey2pointhi = $5e 117 10000 ???? 00 5f pokey3pointlo = $5f 118 10000 ???? 00 60 pokey3pointhi = $60 119 10000 ???? 00 61 pokey4pointlo = $61 120 10000 ???? 00 62 pokey4pointhi = $62 121 10000 ???? 122 10000 ???? 00 63 dlpnt = $63 ; to $64 123 10000 ???? 00 65 dlend = $65 ; to $81 - for 28 possible visible dll entries 124 10000 ???? 00 82 dlendsave = $82 ; to $9e - for 28 possible visible dll entries 125 10000 ???? 126 10000 ???? 00 9f speech_addr = $9f 127 10000 ???? 00 a0 speech_addr_hi = $a0 128 10000 ???? 129 10000 ???? 00 a1 HSGameTableLo = $a1 130 10000 ???? 00 a2 HSGameTableHi = $a2 131 10000 ???? 00 a3 HSVoxHi = $a3 132 10000 ???? 00 a4 HSVoxLo = $a4 133 10000 ???? 134 10000 ???? ;channel pointers 135 10000 ???? 136 10000 ???? 00 a5 songchannel1layer1lo = $a5 137 10000 ???? 00 a6 songchannel2layer1lo = $a6 138 10000 ???? 00 a7 songchannel3layer1lo = $a7 139 10000 ???? 00 a8 songchannel4layer1lo = $a8 140 10000 ???? 141 10000 ???? 00 a9 songchannel1layer2lo = $a9 142 10000 ???? 00 aa songchannel2layer2lo = $aA 143 10000 ???? 00 ab songchannel3layer2lo = $aB 144 10000 ???? 00 ac songchannel4layer2lo = $aC 145 10000 ???? 146 10000 ???? 00 ad songchannel1layer3lo = $aD 147 10000 ???? 00 ae songchannel2layer3lo = $aE 148 10000 ???? 00 af songchannel3layer3lo = $aF 149 10000 ???? 00 b0 songchannel4layer3lo = $b0 150 10000 ???? 151 10000 ???? 00 b1 songchannel1layer1hi = $b1 152 10000 ???? 00 b2 songchannel2layer1hi = $b2 153 10000 ???? 00 b3 songchannel3layer1hi = $b3 154 10000 ???? 00 b4 songchannel4layer1hi = $b4 155 10000 ???? 156 10000 ???? 00 b5 songchannel1layer2hi = $b5 157 10000 ???? 00 b6 songchannel2layer2hi = $b6 158 10000 ???? 00 b7 songchannel3layer2hi = $b7 159 10000 ???? 00 b8 songchannel4layer2hi = $b8 160 10000 ???? 161 10000 ???? 00 b9 songchannel1layer3hi = $b9 162 10000 ???? 00 ba songchannel2layer3hi = $bA 163 10000 ???? 00 bb songchannel3layer3hi = $bB 164 10000 ???? 00 bc songchannel4layer3hi = $bC 165 10000 ???? 166 10000 ???? 00 bd songdatalo = $bd 167 10000 ???? 00 be songdatahi = $be 168 10000 ???? 169 10000 ???? 00 bf inactivechannelcount = $bf 170 10000 ???? 171 10000 ???? 172 10000 ???? 00 c0 songchannel1transpose = $c0 173 10000 ???? 00 c1 songchannel2transpose = $c1 174 10000 ???? 00 c2 songchannel3transpose = $c2 175 10000 ???? 00 c3 songchannel4transpose = $c3 176 10000 ???? 177 10000 ???? 00 c4 songstackindex = $c4 178 10000 ???? 179 10000 ???? 00 c5 songchannel1instrumentlo = $c5 180 10000 ???? 00 c6 songchannel2instrumentlo = $c6 181 10000 ???? 00 c7 songchannel3instrumentlo = $c7 182 10000 ???? 00 c8 songchannel4instrumentlo = $c8 183 10000 ???? 184 10000 ???? 00 c9 songchannel1instrumenthi = $c9 185 10000 ???? 00 ca songchannel2instrumenthi = $ca 186 10000 ???? 00 cb songchannel3instrumenthi = $cb 187 10000 ???? 00 cc songchannel4instrumenthi = $cc 188 10000 ???? 189 10000 ???? 00 cd sfx1notedata = $cd 190 10000 ???? 00 ce sfx2notedata = $ce 191 10000 ???? 192 10000 ???? 00 cf songloops = $cf 193 10000 ???? 194 10000 ???? 00 d0 songpointerlo = $D0 195 10000 ???? 00 d1 songpointerhi = $D1 196 10000 ???? 197 10000 ???? 00 d2 voxlock = $D2 198 10000 ???? 00 d3 voxqueuesize = $D3 199 10000 ???? 200 10000 ???? 00 d4 vblankroutines = $D4 201 10000 ???? 202 10000 ???? 00 d5 doublebufferstate = $D5 203 10000 ???? 00 d6 doublebufferdloffset = $D6 204 10000 ???? 00 d7 doublebufferbufferdirty = $D7 205 10000 ???? 206 10000 ???? 00 d8 inttemp1 = $D8 207 10000 ???? 00 d9 inttemp2 = $D9 208 10000 ???? 00 da inttemp3 = $DA 209 10000 ???? 00 db inttemp4 = $DB 210 10000 ???? 00 dc inttemp5 = $DC 211 10000 ???? 00 dd inttemp6 = $DD 212 10000 ???? 213 10000 ???? 00 de sfxschedulelock = $DE 214 10000 ???? 00 df sfxschedulemissed = $DF 215 10000 ???? 00 e0 sfxinstrumentlo = $E0 216 10000 ???? 00 e1 sfxinstrumenthi = $E1 217 10000 ???? 00 e2 sfxpitchoffset = $E2 218 10000 ???? 00 e3 sfxnoteindex = $E3 219 10000 ???? 220 10000 ???? 00 e4 CTLSWAs = $E4 221 10000 ???? 00 e5 CTLSWBs = $E5 222 10000 ???? 223 10000 ???? 00 e6 A = $e6 224 10000 ???? 00 e6 a = $e6 225 10000 ???? 00 e7 B = $e7 226 10000 ???? 00 e7 b = $e7 227 10000 ???? 00 e8 C = $e8 228 10000 ???? 00 e8 c = $e8 229 10000 ???? 00 e9 D = $e9 230 10000 ???? 00 e9 d = $e9 231 10000 ???? 00 ea E = $ea 232 10000 ???? 00 ea e = $ea 233 10000 ???? 00 eb F = $eb 234 10000 ???? 00 eb f = $eb 235 10000 ???? 00 ec G = $ec 236 10000 ???? 00 ec g = $ec 237 10000 ???? 00 ed H = $ed 238 10000 ???? 00 ed h = $ed 239 10000 ???? 00 ee I = $ee 240 10000 ???? 00 ee i = $ee 241 10000 ???? 00 ef J = $ef 242 10000 ???? 00 ef j = $ef 243 10000 ???? 00 f0 K = $f0 244 10000 ???? 00 f0 k = $f0 245 10000 ???? 00 f1 L = $f1 246 10000 ???? 00 f1 l = $f1 247 10000 ???? 00 f2 M = $f2 248 10000 ???? 00 f2 m = $f2 249 10000 ???? 00 f3 N = $f3 250 10000 ???? 00 f3 n = $f3 251 10000 ???? 00 f4 O = $f4 252 10000 ???? 00 f4 o = $f4 253 10000 ???? 00 f5 P = $f5 254 10000 ???? 00 f5 p = $f5 255 10000 ???? 00 f6 Q = $f6 256 10000 ???? 00 f6 q = $f6 257 10000 ???? 00 f7 R = $f7 258 10000 ???? 00 f7 r = $f7 259 10000 ???? 00 f8 S = $f8 260 10000 ???? 00 f8 s = $f8 261 10000 ???? 00 f9 T = $f9 262 10000 ???? 00 f9 t = $f9 263 10000 ???? 00 fa U = $fa 264 10000 ???? 00 fa u = $fa 265 10000 ???? 00 fb V = $fb 266 10000 ???? 00 fb v = $fb 267 10000 ???? 00 fc W = $fc 268 10000 ???? 00 fc w = $fc 269 10000 ???? 00 fd X = $fd 270 10000 ???? 00 fd x = $fd 271 10000 ???? 00 fe Y = $fe 272 10000 ???? 00 fe y = $fe 273 10000 ???? 00 ff Z = $ff 274 10000 ???? 00 ff z = $ff 275 10000 ???? 276 10000 ???? ; var0-var99 variables use the top of the stack 277 10000 ???? 01 40 var0 = $140 278 10000 ???? 01 41 var1 = $141 279 10000 ???? 01 42 var2 = $142 280 10000 ???? 01 43 var3 = $143 281 10000 ???? 01 44 var4 = $144 282 10000 ???? 01 45 var5 = $145 283 10000 ???? 01 46 var6 = $146 284 10000 ???? 01 47 var7 = $147 285 10000 ???? 01 48 var8 = $148 286 10000 ???? 01 49 var9 = $149 287 10000 ???? 01 4a var10 = $14a 288 10000 ???? 01 4b var11 = $14b 289 10000 ???? 01 4c var12 = $14c 290 10000 ???? 01 4d var13 = $14d 291 10000 ???? 01 4e var14 = $14e 292 10000 ???? 01 4f var15 = $14f 293 10000 ???? 01 50 var16 = $150 294 10000 ???? 01 51 var17 = $151 295 10000 ???? 01 52 var18 = $152 296 10000 ???? 01 53 var19 = $153 297 10000 ???? 01 54 var20 = $154 298 10000 ???? 01 55 var21 = $155 299 10000 ???? 01 56 var22 = $156 300 10000 ???? 01 57 var23 = $157 301 10000 ???? 01 58 var24 = $158 302 10000 ???? 01 59 var25 = $159 303 10000 ???? 01 5a var26 = $15a 304 10000 ???? 01 5b var27 = $15b 305 10000 ???? 01 5c var28 = $15c 306 10000 ???? 01 5d var29 = $15d 307 10000 ???? 01 5e var30 = $15e 308 10000 ???? 01 5f var31 = $15f 309 10000 ???? 01 60 var32 = $160 310 10000 ???? 01 61 var33 = $161 311 10000 ???? 01 62 var34 = $162 312 10000 ???? 01 63 var35 = $163 313 10000 ???? 01 64 var36 = $164 314 10000 ???? 01 65 var37 = $165 315 10000 ???? 01 66 var38 = $166 316 10000 ???? 01 67 var39 = $167 317 10000 ???? 01 68 var40 = $168 318 10000 ???? 01 69 var41 = $169 319 10000 ???? 01 6a var42 = $16a 320 10000 ???? 01 6b var43 = $16b 321 10000 ???? 01 6c var44 = $16c 322 10000 ???? 01 6d var45 = $16d 323 10000 ???? 01 6e var46 = $16e 324 10000 ???? 01 6f var47 = $16f 325 10000 ???? 01 70 var48 = $170 326 10000 ???? 01 71 var49 = $171 327 10000 ???? 01 72 var50 = $172 328 10000 ???? 01 73 var51 = $173 329 10000 ???? 01 74 var52 = $174 330 10000 ???? 01 75 var53 = $175 331 10000 ???? 01 76 var54 = $176 332 10000 ???? 01 77 var55 = $177 333 10000 ???? 01 78 var56 = $178 334 10000 ???? 01 79 var57 = $179 335 10000 ???? 01 7a var58 = $17a 336 10000 ???? 01 7b var59 = $17b 337 10000 ???? 01 7c var60 = $17c 338 10000 ???? 01 7d var61 = $17d 339 10000 ???? 01 7e var62 = $17e 340 10000 ???? 01 7f var63 = $17f 341 10000 ???? 01 80 var64 = $180 342 10000 ???? 01 81 var65 = $181 343 10000 ???? 01 82 var66 = $182 344 10000 ???? 01 83 var67 = $183 345 10000 ???? 01 84 var68 = $184 346 10000 ???? 01 85 var69 = $185 347 10000 ???? 01 86 var70 = $186 348 10000 ???? 01 87 var71 = $187 349 10000 ???? 01 88 var72 = $188 350 10000 ???? 01 89 var73 = $189 351 10000 ???? 01 8a var74 = $18a 352 10000 ???? 01 8b var75 = $18b 353 10000 ???? 01 8c var76 = $18c 354 10000 ???? 01 8d var77 = $18d 355 10000 ???? 01 8e var78 = $18e 356 10000 ???? 01 8f var79 = $18f 357 10000 ???? 01 90 var80 = $190 358 10000 ???? 01 91 var81 = $191 359 10000 ???? 01 92 var82 = $192 360 10000 ???? 01 93 var83 = $193 361 10000 ???? 01 94 var84 = $194 362 10000 ???? 01 95 var85 = $195 363 10000 ???? 01 96 var86 = $196 364 10000 ???? 01 97 var87 = $197 365 10000 ???? 01 98 var88 = $198 366 10000 ???? 01 99 var89 = $199 367 10000 ???? 01 9a var90 = $19a 368 10000 ???? 01 9b var91 = $19b 369 10000 ???? 01 9c var92 = $19c 370 10000 ???? 01 9d var93 = $19d 371 10000 ???? 01 9e var94 = $19e 372 10000 ???? 01 9f var95 = $19f 373 10000 ???? 01 a0 var96 = $1a0 374 10000 ???? 01 a1 var97 = $1a1 375 10000 ???? 01 a2 var98 = $1a2 376 10000 ???? 01 a3 var99 = $1a3 377 10000 ???? 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 ifnconst CANARYOFF 538 U01c1 00 canary DS 1 ; $1ED 539 U01c2 endif 540 U01c2 541 U01c2 ifnconst bankswitchmode stack allowance: 30 nested subroutines. 542 U01c2 echo " stack allowance:",[($1FF - .)/2]d,"nested subroutines." 543 U01c2 - else 544 U01c2 - echo " stack allowance:",[($1FF - .)/3]d,"nested subroutines." 545 U01c2 endif 546 U01c2 ifnconst CANARYOFF the canary is situated at: $1c1 547 U01c2 echo " the canary is situated at:",[canary] 548 U01c2 - else 549 U01c2 - echo " the canary is disabled." 550 U01c2 endif 551 U01c2 552 U01c2 ; $1EE - $1FF reserved for stack 553 U01c2 554 10000 ???? SEG "GAME" 555 10000 ???? ------- FILE c:\Users\Shane\Documents\my7800projects\Heofonfir\shooting_test.78b.asm ------- FILE 7800basic_variable_redefs.h LEVEL 2 PASS 3 0 10000 ???? include "7800basic_variable_redefs.h" 1 10000 ???? ; This file contains variable mapping and other information for the current project. 2 10000 ???? 3 10000 ???? 00 00 heofonfir_lucelia_160b_wip_tallsprite_02_mode = $00 4 10000 ???? 00 00 heofonfir_lucelia_160b_wip_tallsprite_02_width_twoscompliment = $00 5 10000 ???? 00 00 heofonfir_lucelia_160b_wip_tallsprite_02_width = $00 6 10000 ???? 00 80 heofonfir_lucelia_160b_wip_tallsprite_01_mode = $80 7 10000 ???? 00 1a heofonfir_lucelia_160b_wip_tallsprite_01_width_twoscompliment = $1a 8 10000 ???? 00 06 heofonfir_lucelia_160b_wip_tallsprite_01_width = $06 9 10000 ???? 00 80 heofonfir_lucelia_160b_wip_tallsprite_00_mode = $80 10 10000 ???? 00 1a heofonfir_lucelia_160b_wip_tallsprite_00_width_twoscompliment = $1a 11 10000 ???? 00 06 heofonfir_lucelia_160b_wip_tallsprite_00_width = $06 12 10000 ???? 00 80 heofonfir_lucelia_160b_wip_mode = $80 13 10000 ???? 00 1a heofonfir_lucelia_160b_wip_width_twoscompliment = $1a 14 10000 ???? 00 06 heofonfir_lucelia_160b_wip_width = $06 15 10000 ???? 00 00 heofonfir_bullet_mode = $00 16 10000 ???? 00 1f heofonfir_bullet_width_twoscompliment = $1f 17 10000 ???? 00 01 heofonfir_bullet_width = $01 18 10000 ???? 00 00 heofonfir_push_fire_banner01_mode = $00 19 10000 ???? 00 16 heofonfir_push_fire_banner01_width_twoscompliment = $16 20 10000 ???? 00 0a heofonfir_push_fire_banner01_width = $0a 21 10000 ???? 00 00 heofonfir_push_fire_banner00_mode = $00 22 10000 ???? 00 16 heofonfir_push_fire_banner00_width_twoscompliment = $16 23 10000 ???? 00 0a heofonfir_push_fire_banner00_width = $0a 24 10000 ???? 00 00 heofonfir_font_mode = $00 25 10000 ???? 00 11 heofonfir_font_width_twoscompliment = $11 26 10000 ???? 00 4f heofonfir_font_width = $4f 27 10000 ???? 00 00 atascii_mode = $00 28 10000 ???? 00 0a atascii_width_twoscompliment = $0a 29 10000 ???? 00 f6 atascii_width = $f6 30 10000 ???? 00 54 sfx_pulsecannon_length = .skipL073-sfx_pulsecannon 31 10000 ???? 32 10000 ???? 00 00 heofonfir_lucelia_160b_wip_tallsprite_01_color15 = 0 33 10000 ???? 00 00 heofonfir_lucelia_160b_wip_tallsprite_01_color14 = 0 34 10000 ???? 00 00 heofonfir_lucelia_160b_wip_tallsprite_01_color13 = 0 35 10000 ???? 00 00 heofonfir_lucelia_160b_wip_tallsprite_01_color12 = 0 36 10000 ???? 00 00 heofonfir_lucelia_160b_wip_tallsprite_01_color11 = 0 37 10000 ???? 00 00 heofonfir_lucelia_160b_wip_tallsprite_01_color10 = 0 38 10000 ???? 00 00 heofonfir_lucelia_160b_wip_tallsprite_01_color9 = 0 39 10000 ???? 00 00 heofonfir_lucelia_160b_wip_tallsprite_01_color8 = 0 40 10000 ???? 00 00 heofonfir_lucelia_160b_wip_tallsprite_01_color7 = 0 41 10000 ???? 00 00 heofonfir_lucelia_160b_wip_tallsprite_01_color6 = 0 42 10000 ???? 00 04 heofonfir_lucelia_160b_wip_tallsprite_01_color5 = $04 43 10000 ???? 00 2c heofonfir_lucelia_160b_wip_tallsprite_01_color4 = $2c 44 10000 ???? 00 0f heofonfir_lucelia_160b_wip_tallsprite_01_color3 = $0f 45 10000 ???? 00 28 heofonfir_lucelia_160b_wip_tallsprite_01_color2 = $28 46 10000 ???? 00 3c heofonfir_lucelia_160b_wip_tallsprite_01_color1 = $3c 47 10000 ???? 00 00 heofonfir_lucelia_160b_wip_tallsprite_01_color0 = $00 48 10000 ???? 00 00 heofonfir_lucelia_160b_wip_tallsprite_00_color15 = 0 49 10000 ???? 00 00 heofonfir_lucelia_160b_wip_tallsprite_00_color14 = 0 50 10000 ???? 00 00 heofonfir_lucelia_160b_wip_tallsprite_00_color13 = 0 51 10000 ???? 00 00 heofonfir_lucelia_160b_wip_tallsprite_00_color12 = 0 52 10000 ???? 00 00 heofonfir_lucelia_160b_wip_tallsprite_00_color11 = 0 53 10000 ???? 00 00 heofonfir_lucelia_160b_wip_tallsprite_00_color10 = 0 54 10000 ???? 00 00 heofonfir_lucelia_160b_wip_tallsprite_00_color9 = 0 55 10000 ???? 00 00 heofonfir_lucelia_160b_wip_tallsprite_00_color8 = 0 56 10000 ???? 00 00 heofonfir_lucelia_160b_wip_tallsprite_00_color7 = 0 57 10000 ???? 00 00 heofonfir_lucelia_160b_wip_tallsprite_00_color6 = 0 58 10000 ???? 00 04 heofonfir_lucelia_160b_wip_tallsprite_00_color5 = $04 59 10000 ???? 00 2c heofonfir_lucelia_160b_wip_tallsprite_00_color4 = $2c 60 10000 ???? 00 0f heofonfir_lucelia_160b_wip_tallsprite_00_color3 = $0f 61 10000 ???? 00 28 heofonfir_lucelia_160b_wip_tallsprite_00_color2 = $28 62 10000 ???? 00 3c heofonfir_lucelia_160b_wip_tallsprite_00_color1 = $3c 63 10000 ???? 00 00 heofonfir_lucelia_160b_wip_tallsprite_00_color0 = $00 64 10000 ???? 00 00 heofonfir_lucelia_160b_wip_color15 = 0 65 10000 ???? 00 00 heofonfir_lucelia_160b_wip_color14 = 0 66 10000 ???? 00 00 heofonfir_lucelia_160b_wip_color13 = 0 67 10000 ???? 00 00 heofonfir_lucelia_160b_wip_color12 = 0 68 10000 ???? 00 00 heofonfir_lucelia_160b_wip_color11 = 0 69 10000 ???? 00 00 heofonfir_lucelia_160b_wip_color10 = 0 70 10000 ???? 00 00 heofonfir_lucelia_160b_wip_color9 = 0 71 10000 ???? 00 00 heofonfir_lucelia_160b_wip_color8 = 0 72 10000 ???? 00 00 heofonfir_lucelia_160b_wip_color7 = 0 73 10000 ???? 00 00 heofonfir_lucelia_160b_wip_color6 = 0 74 10000 ???? 00 04 heofonfir_lucelia_160b_wip_color5 = $04 75 10000 ???? 00 2c heofonfir_lucelia_160b_wip_color4 = $2c 76 10000 ???? 00 0f heofonfir_lucelia_160b_wip_color3 = $0f 77 10000 ???? 00 28 heofonfir_lucelia_160b_wip_color2 = $28 78 10000 ???? 00 3c heofonfir_lucelia_160b_wip_color1 = $3c 79 10000 ???? 00 00 heofonfir_lucelia_160b_wip_color0 = $00 80 10000 ???? 00 28 heofonfir_bullet_color3 = $28 81 10000 ???? 00 2c heofonfir_bullet_color2 = $2c 82 10000 ???? 00 0f heofonfir_bullet_color1 = $0f 83 10000 ???? 00 00 heofonfir_bullet_color0 = $00 84 10000 ???? 00 0f heofonfir_push_fire_banner_color3 = heofonfir_push_fire_banner00_color3 85 10000 ???? 00 2c heofonfir_push_fire_banner_color2 = heofonfir_push_fire_banner00_color2 86 10000 ???? 00 28 heofonfir_push_fire_banner_color1 = heofonfir_push_fire_banner00_color1 87 10000 ???? 00 0f heofonfir_push_fire_banner01_color3 = $0f 88 10000 ???? 00 2c heofonfir_push_fire_banner01_color2 = $2c 89 10000 ???? 00 28 heofonfir_push_fire_banner01_color1 = $28 90 10000 ???? 00 00 heofonfir_push_fire_banner01_color0 = $00 91 10000 ???? 00 0f heofonfir_push_fire_banner00_color3 = $0f 92 10000 ???? 00 2c heofonfir_push_fire_banner00_color2 = $2c 93 10000 ???? 00 28 heofonfir_push_fire_banner00_color1 = $28 94 10000 ???? 00 00 heofonfir_push_fire_banner00_color0 = $00 95 10000 ???? 00 00 heofonfir_font_color3 = 0 96 10000 ???? 00 28 heofonfir_font_color2 = $28 97 10000 ???? 00 0f heofonfir_font_color1 = $0f 98 10000 ???? 00 00 heofonfir_font_color0 = $00 99 10000 ???? 00 00 atascii_color1 = $00 100 10000 ???? 00 0f atascii_color0 = $0f 101 10000 ???? 01 4f player_lucelia_layer2leftarm_aniframe = var15 102 10000 ???? 103 10000 ???? 01 4e player_lucelia_layer2rightarm_aniframe = var14 104 10000 ???? 105 10000 ???? 01 4d player_lucelia_layer2nofire_aniframe = var13 106 10000 ???? 107 10000 ???? 01 4c player_lucelia_layer1_aniframe = var12 108 10000 ???? 109 10000 ???? 01 4b player_bullet_slowdown = var11 110 10000 ???? 111 10000 ???? 01 4a player_flag = var10 112 10000 ???? 113 10000 ???? 01 49 joyposright = var9 114 10000 ???? 115 10000 ???? 01 48 joyposleft = var8 116 10000 ???? 117 10000 ???? 01 47 joyposdown = var7 118 10000 ???? 119 10000 ???? 01 46 joyposup = var6 120 10000 ???? 121 10000 ???? 01 45 player_bullet_y = var5 122 10000 ???? 123 10000 ???? 01 44 player_bullet_x = var4 124 10000 ???? 125 10000 ???? 01 43 fire_Debounce = var3 126 10000 ???? 127 10000 ???? 01 42 player_y = var2 128 10000 ???? 129 10000 ???? 01 41 player_x = var1 130 10000 ???? 131 10000 ???? 01 40 frameCounter = var0 132 10000 ???? 133 10000 ???? 00 01 NTSC = 1 134 10000 ???? 00 e0 SCREENHEIGHT = 224 135 10000 ???? 00 01 DOUBLEWIDE = 1 136 10000 ???? 00 01 collisionwrap = 1 137 10000 ???? 00 01 CHECKOVERWRITE = 1 138 10000 ???? 00 08 ZONEHEIGHT = 8 139 10000 ???? 00 01 ROM32K = 1 ------- FILE c:\Users\Shane\Documents\my7800projects\Heofonfir\shooting_test.78b.asm 545 10000 ???? 546 10000 ???? ; A BEAD header gets automatically incorportated into the ROM header. 547 10000 ???? ; For more BEAD executable info, check out the spec... 548 10000 ???? ; http://7800.8bitdev.org/index.php/The_Atari_7800_BEAD_Execuable_Specification 549 10000 ???? 550 10000 ???? 00 01 GAMEDESCRIPTIONSET = 1 551 10000 ???? 4e 61 6d 65 GAMEDESCRIPTION = "Test Name" 552 10000 ???? 553 10000 ???? 00 40 BDHSC = %01000000 554 10000 ???? 00 20 BDYM = %00100000 555 10000 ???? 00 10 BDPOKEY = %00010000 556 10000 ???? 00 08 BDROF = %00001000 557 10000 ???? 00 00 BD16K = %00000000 558 10000 ???? 00 01 BD32K = %00000001 559 10000 ???? 00 02 BD48K = %00000010 560 10000 ???? 00 05 BD1800 = %00000101 561 10000 ???? 00 06 BD4000 = %00000110 562 10000 ???? 563 10000 ???? - ifconst ROM16K 564 10000 ???? -BEADHEADER = 1 565 10000 ???? endif 566 10000 ???? ifconst ROM32K 567 10000 ???? 00 01 BEADHEADER = 1 568 10000 ???? endif 569 10000 ???? - ifconst ROM48K 570 10000 ???? -BEADHEADER = 1 571 10000 ???? endif 572 10000 ???? 573 10000 ???? ifconst BEADHEADER 574 10000 ???? BEADHARDWARE SET 0 575 10000 ???? - ifconst ROM16K 576 10000 ???? -BEADHARDWARE SET (BEADHARDWARE|BD16K) 577 10000 ???? endif 578 10000 ???? ifconst ROM32K 579 10000 ???? BEADHARDWARE SET (BEADHARDWARE|BD32K) 580 10000 ???? endif 581 10000 ???? - ifconst ROM48K 582 10000 ???? -BEADHARDWARE SET (BEADHARDWARE|BD48K) 583 10000 ???? endif 584 10000 ???? - ifconst pokeysupport 585 10000 ???? -BEADHARDWARE SET (BEADHARDWARE|BDPOKEY) 586 10000 ???? endif 587 10000 ???? - ifconst HSSUPPORT 588 10000 ???? -BEADHARDWARE SET (BEADHARDWARE|BDHSC) 589 10000 ???? endif 590 10000 ???? endif 591 10000 ???? 592 10000 ???? ;start address of cart... 593 10000 ???? - ifconst ROM48K 594 10000 ???? - ORG $4000,0 595 10000 ???? - ifconst BEADHEADER 596 10000 ???? - .byte $BE,$AD,BEADHARDWARE 597 10000 ???? - ifconst GAMEDESCRIPTIONSET 598 10000 ???? - CLC 599 10000 ???? - BCC _SKIPDESCRIPTION 600 10000 ???? - .byte GAMEDESCRIPTION,0 601 10000 ???? -_SKIPDESCRIPTION 602 10000 ???? - endif 603 10000 ???? - jmp ($FFFC) 604 10000 ???? - endif 605 10000 ???? else 606 10000 ???? - ifconst bankswitchmode 607 10000 ???? - ifconst ROMAT4K 608 10000 ???? - ORG $4000,0 609 10000 ???? - RORG $4000 610 10000 ???? - else 611 10000 ???? - ORG $8000,0 612 10000 ???? - RORG $8000 613 10000 ???? - endif 614 10000 ???? else ; not bankswitchmode 615 10000 ???? - ifconst ROM16K 616 10000 ???? - ORG $C000,0 617 10000 ???? - ifconst BEADHEADER 618 10000 ???? - .byte $BE,$AD,BEADHARDWARE 619 10000 ???? - ifconst GAMEDESCRIPTION 620 10000 ???? - CLC 621 10000 ???? - BCC _SKIPDESCRIPTION 622 10000 ???? - .byte GAMEDESCRIPTION,0 623 10000 ???? -_SKIPDESCRIPTION 624 10000 ???? - endif 625 10000 ???? - jmp ($FFFC) 626 10000 ???? - endif 627 10000 ???? else 628 10000 ???? - ifconst ROM8K 629 10000 ???? - ORG $E000,0 630 10000 ???? else 631 8000 ORG $8000,0 632 8000 ifconst BEADHEADER 633 8000 be ad 01 .byte.b $BE,$AD,BEADHARDWARE 634 8003 - ifconst GAMEDESCRIPTION 635 8003 - CLC 636 8003 - BCC _SKIPDESCRIPTION 637 8003 - .byte GAMEDESCRIPTION,0 638 8003 -_SKIPDESCRIPTION 639 8003 endif 640 8003 6c fc ff jmp ($FFFC) 641 8006 endif 642 8006 endif 643 8006 endif 644 8006 endif 645 8006 endif 646 8006 647 8006 ;7800basic v0.16 Nov 21 2020 15:38:52 648 8006 SPACEOVERFLOW SET 0 649 8006 game 650 8006 . 651 8006 ;; 652 8006 653 8006 .L00 ;; set romsize 32k 654 8006 655 8006 .L01 ;; set zoneheight 8 656 8006 657 8006 .L02 ;; set zoneprotection on 658 8006 659 8006 .L03 ;; set collisionwrap on 660 8006 661 8006 .L04 ;; set doublewide on 662 8006 663 8006 .L05 ;; set tallsprite on 664 8006 665 8006 .L06 ;; set screenheight 224 666 8006 667 8006 .L07 ;; set basepath graphics 668 8006 669 8006 .L08 ;; set tv ntsc 670 8006 671 8006 .L09 ;; displaymode 160A 672 8006 673 8006 a9 50 lda #%01010000 ;Enable DMA, mode=160x2/160x4, 2x character width 674 8008 85 3c sta CTRL 675 800a 676 800a 8d 07 21 sta sCTRL 677 800d 678 800d . 679 800d ;; 680 800d 681 800d .L010 ;; characterset atascii 682 800d 683 800d a9 d0 lda #>atascii 684 800f 8d 0b 21 sta sCHARBASE 685 8012 686 8012 85 34 sta CHARBASE 687 8014 a9 60 lda #(atascii_mode | %01100000) 688 8016 8d 06 21 sta charactermode 689 8019 690 8019 .L011 ;; alphachars ASCII 691 8019 692 8019 . 693 8019 ;; 694 8019 695 8019 .L012 ;; dim frameCounter = var0 696 8019 697 8019 .L013 ;; dim player_x = var1 698 8019 699 8019 .L014 ;; dim player_y = var2 700 8019 701 8019 .L015 ;; dim fire_Debounce = var3 702 8019 703 8019 .L016 ;; dim player_bullet_x = var4 704 8019 705 8019 .L017 ;; dim player_bullet_y = var5 706 8019 707 8019 .L018 ;; dim joyposup = var6 708 8019 709 8019 .L019 ;; dim joyposdown = var7 710 8019 711 8019 .L020 ;; dim joyposleft = var8 712 8019 713 8019 .L021 ;; dim joyposright = var9 714 8019 715 8019 .L022 ;; dim player_flag = var10 716 8019 717 8019 .L023 ;; dim player_bullet_slowdown = var11 718 8019 719 8019 .rem ;; rem dim player_lucelia_layer1_aniframe = var12 720 8019 721 8019 .rem ;; rem dim player_lucelia_layer2nofire_aniframe = var13 722 8019 723 8019 .rem ;; rem dim player_lucelia_layer2rightarm_aniframe = var14 724 8019 725 8019 .rem ;; rem dim player_lucelia_layer2leftarm_aniframe = var15 726 8019 727 8019 . 728 8019 ;; 729 8019 730 8019 .L024 ;; P0C1 = $F7 : P0C2 = $1C : P0C3 = $0F 731 8019 732 8019 a9 f7 LDA #$F7 733 801b 85 21 STA P0C1 734 801d a9 1c LDA #$1C 735 801f 85 22 STA P0C2 736 8021 a9 0f LDA #$0F 737 8023 85 23 STA P0C3 738 8025 .L025 ;; P1C1 = $05 : P1C2 = $15 : P1C3 = $3D 739 8025 740 8025 a9 05 LDA #$05 741 8027 85 25 STA P1C1 742 8029 a9 15 LDA #$15 743 802b 85 26 STA P1C2 744 802d a9 3d LDA #$3D 745 802f 85 27 STA P1C3 746 8031 .L026 ;; P2C1 = $90 : P2C2 = $96 : P2C3 = $AF 747 8031 748 8031 a9 90 LDA #$90 749 8033 85 29 STA P2C1 750 8035 a9 96 LDA #$96 751 8037 85 2a STA P2C2 752 8039 a9 af LDA #$AF 753 803b 85 2b STA P2C3 754 803d .L027 ;; P3C1 = $77 : P3C2 = $7A : P3C3 = $6F 755 803d 756 803d a9 77 LDA #$77 757 803f 85 2d STA P3C1 758 8041 a9 7a LDA #$7A 759 8043 85 2e STA P3C2 760 8045 a9 6f LDA #$6F 761 8047 85 2f STA P3C3 762 8049 .L028 ;; P4C1 = $E1 : P4C2 = $CA : P4C3 = $DD 763 8049 764 8049 a9 e1 LDA #$E1 765 804b 85 31 STA P4C1 766 804d a9 ca LDA #$CA 767 804f 85 32 STA P4C2 768 8051 a9 dd LDA #$DD 769 8053 85 33 STA P4C3 770 8055 .L029 ;; P5C1 = $02 : P5C2 = $31 : P5C3 = $25 771 8055 772 8055 a9 02 LDA #$02 773 8057 85 35 STA P5C1 774 8059 a9 31 LDA #$31 775 805b 85 36 STA P5C2 776 805d a9 25 LDA #$25 777 805f 85 37 STA P5C3 778 8061 .L030 ;; P6C1 = $07 : P6C2 = $0A : P6C3 = $0C 779 8061 780 8061 a9 07 LDA #$07 781 8063 85 39 STA P6C1 782 8065 a9 0a LDA #$0A 783 8067 85 3a STA P6C2 784 8069 a9 0c LDA #$0C 785 806b 85 3b STA P6C3 786 806d .L031 ;; P7C1 = $50 : P7C2 = $64 : P7C3 = $78 787 806d 788 806d a9 50 LDA #$50 789 806f 85 3d STA P7C1 790 8071 a9 64 LDA #$64 791 8073 85 3e STA P7C2 792 8075 a9 78 LDA #$78 793 8077 85 3f STA P7C3 794 8079 . 795 8079 ;; 796 8079 797 8079 .L032 ;; incgraphic atascii.png 160A 798 8079 799 8079 .L033 ;; incgraphic heofonfir_font.png 160A 0 1 2 3 800 8079 801 8079 .L034 ;; incbanner heofonfir_push_fire_banner.png 160A 0 1 2 3 802 8079 803 8079 .L035 ;; incgraphic heofonfir_bullet.png 160A 804 8079 805 8079 .L036 ;; incgraphic player\heofonfir_lucelia_160b_wip.png 160B 806 8079 807 8079 . 808 8079 ;; 809 8079 810 8079 . 811 8079 ;; 812 8079 813 8079 . 814 8079 ;; 815 8079 816 8079 . 817 8079 ;; 818 8079 819 8079 . 820 8079 ;; 821 8079 822 8079 . 823 8079 ;; 824 8079 825 8079 . 826 8079 ;; 827 8079 828 8079 . 829 8079 ;; 830 8079 831 8079 . 832 8079 ;; 833 8079 834 8079 . 835 8079 ;; 836 8079 837 8079 . 838 8079 ;; 839 8079 840 8079 . 841 8079 ;; 842 8079 843 8079 . 844 8079 ;; 845 8079 846 8079 . 847 8079 ;; 848 8079 849 8079 . 850 8079 ;; 851 8079 852 8079 . 853 8079 ;; 854 8079 855 8079 . 856 8079 ;; 857 8079 858 8079 . 859 8079 ;; 860 8079 861 8079 . 862 8079 ;; 863 8079 864 8079 . 865 8079 ;; 866 8079 867 8079 . 868 8079 ;; 869 8079 870 8079 . 871 8079 ;; 872 8079 873 8079 . 874 8079 ;; 875 8079 876 8079 . 877 8079 ;; 878 8079 879 8079 . 880 8079 ;; 881 8079 882 8079 . 883 8079 ;; 884 8079 885 8079 . 886 8079 ;; 887 8079 888 8079 . 889 8079 ;; 890 8079 891 8079 . 892 8079 ;; 893 8079 894 8079 . 895 8079 ;; 896 8079 897 8079 . 898 8079 ;; 899 8079 900 8079 . 901 8079 ;; 902 8079 903 8079 . 904 8079 ;; 905 8079 906 8079 . 907 8079 ;; 908 8079 909 8079 .plot 910 8079 ;; plot 911 8079 912 8079 . 913 8079 ;; 914 8079 915 8079 .L037 ;; player_x = 56 : player_y = 176 916 8079 917 8079 a9 38 LDA #56 918 807b 8d 41 01 STA player_x 919 807e a9 b0 LDA #176 920 8080 8d 42 01 STA player_y 921 8083 .L038 ;; player_bullet_x = 0 : player_bullet_y = 0 922 8083 923 8083 a9 00 LDA #0 924 8085 8d 44 01 STA player_bullet_x 925 8088 8d 45 01 STA player_bullet_y 926 808b .L039 ;; joyposup = 0 : joyposdown = 0 : joyposleft = 0 : joyposright = 0 927 808b 928 808b a9 00 LDA #0 929 808d 8d 46 01 STA joyposup 930 8090 8d 47 01 STA joyposdown 931 8093 8d 48 01 STA joyposleft 932 8096 8d 49 01 STA joyposright 933 8099 .L040 ;; player_bullet_slowdown = 0 934 8099 935 8099 a9 00 LDA #0 936 809b 8d 4b 01 STA player_bullet_slowdown 937 809e . 938 809e ;; 939 809e 940 809e .titlescreen_loop 941 809e ;; titlescreen_loop 942 809e 943 809e .L041 ;; clearscreen 944 809e 945 809e 20 8c f0 jsr clearscreen 946 80a1 .L042 ;; plotbanner heofonfir_push_fire_banner 0 44 10 947 80a1 948 80a1 a9 16 lda #(0|heofonfir_push_fire_banner00_width_twoscompliment) 949 80a3 85 44 sta temp3 950 80a5 951 80a5 a9 2c lda #44 952 80a7 85 45 sta temp4 953 80a9 954 80a9 a9 0a lda #10 955 80ab 956 80ab 85 46 sta temp5 957 80ad 958 80ad a9 40 lda #(heofonfir_push_fire_banner00_mode|%01000000) 959 80af 85 47 sta temp6 960 80b1 961 80b1 a9 4f lda #<(heofonfir_push_fire_banner00 + 0) 962 80b3 85 42 sta temp1 963 80b5 964 80b5 a9 e0 lda #>(heofonfir_push_fire_banner00 + 0) 965 80b7 85 43 sta temp2 966 80b9 967 80b9 20 a0 f2 jsr plotsprite 968 80bc 18 clc 969 80bd a9 08 lda #8 970 80bf 65 46 adc temp5 971 80c1 85 46 sta temp5 972 80c3 a9 59 lda #<(heofonfir_push_fire_banner01 + 0) 973 80c5 85 42 sta temp1 974 80c7 975 80c7 a9 e0 lda #>(heofonfir_push_fire_banner01 + 0) 976 80c9 85 43 sta temp2 977 80cb 978 80cb 20 a0 f2 jsr plotsprite 979 80ce .L043 ;; if joy0fire0 then clearscreen : savescreen : goto main 980 80ce 981 80ce 2c 02 21 bit sINPT1 982 80d1 50 09 BVC .skipL043 983 80d3 .condpart0 984 80d3 20 8c f0 jsr clearscreen 985 80d6 20 b0 f0 jsr savescreen 986 80d9 4c ed 80 jmp .main 987 80dc 988 80dc .skipL043 989 80dc .L044 ;; if switchreset then reboot 990 80dc 991 80dc 20 85 f4 jsr checkresetswitch 992 80df d0 03 BNE .skipL044 993 80e1 .condpart1 994 80e1 4c 72 f5 JMP START 995 80e4 .skipL044 996 80e4 .L045 ;; savescreen 997 80e4 998 80e4 20 b0 f0 jsr savescreen 999 80e7 .L046 ;; drawscreen 1000 80e7 1001 80e7 20 c0 f0 jsr drawscreen 1002 80ea .L047 ;; goto titlescreen_loop 1003 80ea 1004 80ea 4c 9e 80 jmp .titlescreen_loop 1005 80ed 1006 80ed . 1007 80ed ;; 1008 80ed 1009 80ed .main 1010 80ed ;; main 1011 80ed 1012 80ed .L048 ;; frameCounter = 0 1013 80ed 1014 80ed a9 00 LDA #0 1015 80ef 8d 40 01 STA frameCounter 1016 80f2 .mainloop 1017 80f2 ;; mainloop 1018 80f2 1019 80f2 .L049 ;; frameCounter = frameCounter + 1 1020 80f2 1021 80f2 ad 40 01 LDA frameCounter 1022 80f5 18 CLC 1023 80f6 69 01 ADC #1 1024 80f8 8d 40 01 STA frameCounter 1025 80fb .L050 ;; BACKGRND = $00 1026 80fb 1027 80fb a9 00 LDA #$00 1028 80fd 85 20 STA BACKGRND 1029 80ff .L051 ;; if switchreset then reboot 1030 80ff 1031 80ff 20 85 f4 jsr checkresetswitch 1032 8102 d0 03 BNE .skipL051 1033 8104 .condpart2 1034 8104 4c 72 f5 JMP START 1035 8107 .skipL051 1036 8107 . 1037 8107 ;; 1038 8107 1039 8107 .L052 ;; player_bullet_slowdown = player_bullet_slowdown + 1 1040 8107 1041 8107 ad 4b 01 LDA player_bullet_slowdown 1042 810a 18 CLC 1043 810b 69 01 ADC #1 1044 810d 8d 4b 01 STA player_bullet_slowdown 1045 8110 .L053 ;; if player_bullet_slowdown > 8 then player_bullet_slowdown = 0 1046 8110 1047 8110 a9 08 LDA #8 1048 8112 cd 4b 01 CMP player_bullet_slowdown 1049 8115 b0 05 BCS .skipL053 1050 8117 .condpart3 1051 8117 a9 00 LDA #0 1052 8119 8d 4b 01 STA player_bullet_slowdown 1053 811c .skipL053 1054 811c . 1055 811c ;; 1056 811c 1057 811c . 1058 811c ;; 1059 811c 1060 811c . 1061 811c ;; 1062 811c 1063 811c .L054 ;; plotsprite heofonfir_lucelia_160b_wip 0 player_x player_y 1064 811c 1065 811c a9 64 lda #heofonfir_lucelia_160b_wip 1069 8122 85 43 sta temp2 1070 8124 1071 8124 a9 1a lda #(0|heofonfir_lucelia_160b_wip_width_twoscompliment) 1072 8126 85 44 sta temp3 1073 8128 1074 8128 ad 41 01 lda player_x 1075 812b 85 45 sta temp4 1076 812d 1077 812d ad 42 01 lda player_y 1078 8130 1079 8130 85 46 sta temp5 1080 8132 1081 8132 a9 c0 lda #(heofonfir_lucelia_160b_wip_mode|%01000000) 1082 8134 85 47 sta temp6 1083 8136 1084 8136 20 a0 f2 jsr plotsprite 1085 8139 ; +tall sprite replot 1086 8139 18 clc 1087 813a a5 42 lda temp1 1088 813c 69 06 adc #heofonfir_lucelia_160b_wip_width 1089 813e 85 42 sta temp1 1090 8140 a5 46 lda temp5 1091 8142 69 08 adc #WZONEHEIGHT 1092 8144 85 46 sta temp5 1093 8146 20 a0 f2 jsr plotsprite 1094 8149 ; +tall sprite replot 1095 8149 18 clc 1096 814a a5 42 lda temp1 1097 814c 69 06 adc #heofonfir_lucelia_160b_wip_width 1098 814e 85 42 sta temp1 1099 8150 a5 46 lda temp5 1100 8152 69 08 adc #WZONEHEIGHT 1101 8154 85 46 sta temp5 1102 8156 20 a0 f2 jsr plotsprite 1103 8159 .L055 ;; plotvalue heofonfir_font 0 score0 8 25 1 1104 8159 1105 8159 a9 00 lda #heofonfir_font 1109 815f 85 43 sta temp2 1110 8161 1111 8161 ad 06 21 lda charactermode 1112 8164 85 4a sta temp9 1113 8166 a9 60 lda #(heofonfir_font_mode | %01100000) 1114 8168 8d 06 21 sta charactermode 1115 816b a9 18 lda #24 ; width in two's complement 1116 816d 09 00 ora #0 ; palette left shifted 5 bits 1117 816f 85 44 sta temp3 1118 8171 a9 19 lda #25 1119 8173 85 45 sta temp4 1120 8175 1121 8175 a9 01 lda #1 1122 8177 85 46 sta temp5 1123 8179 1124 8179 a9 08 lda #8 1125 817b 85 47 sta temp6 1126 817d 1127 817d a9 a6 lda #score0 1131 8183 85 49 sta temp8 1132 8185 1133 8185 20 8e f3 jsr plotvalue 1134 8185 00 01 USED_PLOTVALUE = 1 1135 8188 a5 4a lda temp9 1136 818a 8d 06 21 sta charactermode 1137 818d .L056 ;; plotvalue heofonfir_font 0 score1 2 151 1 1138 818d 1139 818d a9 00 lda #heofonfir_font 1143 8193 85 43 sta temp2 1144 8195 1145 8195 ad 06 21 lda charactermode 1146 8198 85 4a sta temp9 1147 819a a9 60 lda #(heofonfir_font_mode | %01100000) 1148 819c 8d 06 21 sta charactermode 1149 819f a9 1e lda #30 ; width in two's complement 1150 81a1 09 00 ora #0 ; palette left shifted 5 bits 1151 81a3 85 44 sta temp3 1152 81a5 a9 97 lda #151 1153 81a7 85 45 sta temp4 1154 81a9 1155 81a9 a9 01 lda #1 1156 81ab 85 46 sta temp5 1157 81ad 1158 81ad a9 02 lda #2 1159 81af 85 47 sta temp6 1160 81b1 1161 81b1 a9 a9 lda #score1 1165 81b7 85 49 sta temp8 1166 81b9 1167 81b9 20 8e f3 jsr plotvalue 1168 81b9 00 01 USED_PLOTVALUE = 1 1169 81bc a5 4a lda temp9 1170 81be 8d 06 21 sta charactermode 1171 81c1 .L057 ;; plotchars "score" 0 1 1 1172 81c1 1173 81c1 a9 65 lda #<"score" 1174 81c3 85 42 sta temp1 1175 81c5 1176 81c5 a9 72 lda #>"score" 1177 81c7 85 43 sta temp2 1178 81c9 1179 81c9 a9 00 lda #0 1180 81cb 38 sec 1181 81cc e9 00 sbc # 1182 81ce 29 1f and #%00011111 1183 81d0 09 00 ora #0 ; palette left shifted 5 bits 1184 81d2 85 44 sta temp3 1185 81d4 a9 01 lda #1 1186 81d6 85 45 sta temp4 1187 81d8 1188 81d8 a9 01 lda #1 1189 81da 1190 81da 85 46 sta temp5 1191 81dc 1192 81dc 20 59 f3 jsr plotcharacters 1193 81df .L058 ;; plotchars "lives" 0 126 1 1194 81df 1195 81df a9 73 lda #<"lives" 1196 81e1 85 42 sta temp1 1197 81e3 1198 81e3 a9 65 lda #>"lives" 1199 81e5 85 43 sta temp2 1200 81e7 1201 81e7 a9 00 lda #0 1202 81e9 38 sec 1203 81ea e9 00 sbc # 1204 81ec 29 1f and #%00011111 1205 81ee 09 00 ora #0 ; palette left shifted 5 bits 1206 81f0 85 44 sta temp3 1207 81f2 a9 7e lda #126 1208 81f4 85 45 sta temp4 1209 81f6 1210 81f6 a9 01 lda #1 1211 81f8 1212 81f8 85 46 sta temp5 1213 81fa 1214 81fa 20 59 f3 jsr plotcharacters 1215 81fd .L059 ;; plotchars "wpn" 0 1 2 1216 81fd 1217 81fd a9 6e lda #<"wpn" 1218 81ff 85 42 sta temp1 1219 8201 1220 8201 a9 70 lda #>"wpn" 1221 8203 85 43 sta temp2 1222 8205 1223 8205 a9 00 lda #0 1224 8207 38 sec 1225 8208 e9 00 sbc # 1226 820a 29 1f and #%00011111 1227 820c 09 00 ora #0 ; palette left shifted 5 bits 1228 820e 85 44 sta temp3 1229 8210 a9 01 lda #1 1230 8212 85 45 sta temp4 1231 8214 1232 8214 a9 02 lda #2 1233 8216 1234 8216 85 46 sta temp5 1235 8218 1236 8218 20 59 f3 jsr plotcharacters 1237 821b .L060 ;; if switchreset then reboot 1238 821b 1239 821b 20 85 f4 jsr checkresetswitch 1240 821e d0 03 BNE .skipL060 1241 8220 .condpart4 1242 8220 4c 72 f5 JMP START 1243 8223 .skipL060 1244 8223 .L061 ;; if joy0up then player_y = player_y - 1 : joyposup = 1 : joyposdown = 0 : joyposleft = 0 : joyposright = 0 1245 8223 1246 8223 a9 10 lda #$10 1247 8225 2c 80 02 bit SWCHA 1248 8228 d0 19 BNE .skipL061 1249 822a .condpart5 1250 822a ad 42 01 LDA player_y 1251 822d 38 SEC 1252 822e e9 01 SBC #1 1253 8230 8d 42 01 STA player_y 1254 8233 a9 01 LDA #1 1255 8235 8d 46 01 STA joyposup 1256 8238 a9 00 LDA #0 1257 823a 8d 47 01 STA joyposdown 1258 823d 8d 48 01 STA joyposleft 1259 8240 8d 49 01 STA joyposright 1260 8243 .skipL061 1261 8243 .L062 ;; if joy0down then player_y = player_y + 1 : joyposup = 0 : joyposdown = 1 : joyposleft = 0 : joyposright = 0 1262 8243 1263 8243 a9 20 lda #$20 1264 8245 2c 80 02 bit SWCHA 1265 8248 d0 1b BNE .skipL062 1266 824a .condpart6 1267 824a ad 42 01 LDA player_y 1268 824d 18 CLC 1269 824e 69 01 ADC #1 1270 8250 8d 42 01 STA player_y 1271 8253 a9 00 LDA #0 1272 8255 8d 46 01 STA joyposup 1273 8258 a9 01 LDA #1 1274 825a 8d 47 01 STA joyposdown 1275 825d a9 00 LDA #0 1276 825f 8d 48 01 STA joyposleft 1277 8262 8d 49 01 STA joyposright 1278 8265 .skipL062 1279 8265 .L063 ;; if joy0left then player_x = player_x - 1 : joyposup = 0 : joyposdown = 0 : joyposleft = 1 : joyposright = 0 1280 8265 1281 8265 2c 80 02 bit SWCHA 1282 8268 70 1b BVS .skipL063 1283 826a .condpart7 1284 826a ad 41 01 LDA player_x 1285 826d 38 SEC 1286 826e e9 01 SBC #1 1287 8270 8d 41 01 STA player_x 1288 8273 a9 00 LDA #0 1289 8275 8d 46 01 STA joyposup 1290 8278 8d 47 01 STA joyposdown 1291 827b a9 01 LDA #1 1292 827d 8d 48 01 STA joyposleft 1293 8280 a9 00 LDA #0 1294 8282 8d 49 01 STA joyposright 1295 8285 .skipL063 1296 8285 .L064 ;; if joy0right then player_x = player_x + 1 : joyposup = 0 : joyposdown = 0 : joyposleft = 0 : joyposright = 1 1297 8285 1298 8285 2c 80 02 bit SWCHA 1299 8288 30 19 BMI .skipL064 1300 828a .condpart8 1301 828a ad 41 01 LDA player_x 1302 828d 18 CLC 1303 828e 69 01 ADC #1 1304 8290 8d 41 01 STA player_x 1305 8293 a9 00 LDA #0 1306 8295 8d 46 01 STA joyposup 1307 8298 8d 47 01 STA joyposdown 1308 829b 8d 48 01 STA joyposleft 1309 829e a9 01 LDA #1 1310 82a0 8d 49 01 STA joyposright 1311 82a3 .skipL064 1312 82a3 .L065 ;; if joy0left && player_x > 160 then player_x = player_x - 1 1313 82a3 1314 82a3 2c 80 02 bit SWCHA 1315 82a6 70 10 BVS .skipL065 1316 82a8 .condpart9 1317 82a8 a9 a0 LDA #160 1318 82aa cd 41 01 CMP player_x 1319 82ad b0 09 BCS .skip9then 1320 82af .condpart10 1321 82af ad 41 01 LDA player_x 1322 82b2 38 SEC 1323 82b3 e9 01 SBC #1 1324 82b5 8d 41 01 STA player_x 1325 82b8 .skip9then 1326 82b8 .skipL065 1327 82b8 .L066 ;; if joy0right && player_x < 1 then player_x = player_x + 1 1328 82b8 1329 82b8 2c 80 02 bit SWCHA 1330 82bb 30 10 BMI .skipL066 1331 82bd .condpart11 1332 82bd ad 41 01 LDA player_x 1333 82c0 c9 01 CMP #1 1334 82c2 b0 09 BCS .skip11then 1335 82c4 .condpart12 1336 82c4 ad 41 01 LDA player_x 1337 82c7 18 CLC 1338 82c8 69 01 ADC #1 1339 82ca 8d 41 01 STA player_x 1340 82cd .skip11then 1341 82cd .skipL066 1342 82cd .L067 ;; if joy0up && player_y > 224 then player_y = player_y - 1 1343 82cd 1344 82cd a9 10 lda #$10 1345 82cf 2c 80 02 bit SWCHA 1346 82d2 d0 10 BNE .skipL067 1347 82d4 .condpart13 1348 82d4 a9 e0 LDA #224 1349 82d6 cd 42 01 CMP player_y 1350 82d9 b0 09 BCS .skip13then 1351 82db .condpart14 1352 82db ad 42 01 LDA player_y 1353 82de 38 SEC 1354 82df e9 01 SBC #1 1355 82e1 8d 42 01 STA player_y 1356 82e4 .skip13then 1357 82e4 .skipL067 1358 82e4 .L068 ;; if joy0down && player_y < 1 then player_y = player_y + 1 1359 82e4 1360 82e4 a9 20 lda #$20 1361 82e6 2c 80 02 bit SWCHA 1362 82e9 d0 10 BNE .skipL068 1363 82eb .condpart15 1364 82eb ad 42 01 LDA player_y 1365 82ee c9 01 CMP #1 1366 82f0 b0 09 BCS .skip15then 1367 82f2 .condpart16 1368 82f2 ad 42 01 LDA player_y 1369 82f5 18 CLC 1370 82f6 69 01 ADC #1 1371 82f8 8d 42 01 STA player_y 1372 82fb .skip15then 1373 82fb .skipL068 1374 82fb .L069 ;; if joy0fire0 then player_bullet_y = player_bullet_y + 8 : fire_Debounce = 1 : playsfx sfx_pulsecannon 1375 82fb 1376 82fb 2c 02 21 bit sINPT1 1377 82fe 50 27 BVC .skipL069 1378 8300 .condpart17 1379 8300 ad 45 01 LDA player_bullet_y 1380 8303 18 CLC 1381 8304 69 08 ADC #8 1382 8306 8d 45 01 STA player_bullet_y 1383 8309 a9 01 LDA #1 1384 830b 8d 43 01 STA fire_Debounce 1385 830e a9 01 lda #1 1386 8310 85 de sta sfxschedulelock 1387 8312 a9 03 lda #sfx_pulsecannon 1390 8318 85 e1 sta sfxinstrumenthi 1391 831a a9 00 lda #0 1392 831c 85 e2 sta sfxpitchoffset ; no pitch modification 1393 831e 85 e3 sta sfxnoteindex ; not a musical note 1394 8320 20 58 f2 jsr schedulesfx 1395 8323 a9 00 lda #0 1396 8325 85 de sta sfxschedulelock 1397 8327 .skipL069 1398 8327 .L070 ;; if !joy0fire0 then fire_Debounce = 0 1399 8327 1400 8327 2c 02 21 bit sINPT1 1401 832a 70 05 BVS .skipL070 1402 832c .condpart18 1403 832c a9 00 LDA #0 1404 832e 8d 43 01 STA fire_Debounce 1405 8331 .skipL070 1406 8331 . 1407 8331 ;; 1408 8331 1409 8331 .L071 ;; goto mainloop 1410 8331 1411 8331 4c f2 80 jmp .mainloop 1412 8334 1413 8334 .L072 ;; dmahole 0 1414 8334 1415 8334 4c 00 d8 jmp dmahole_0 1416 8337 gameend 1417 8337 DMAHOLEEND0 SET . 19657 bytes of ROM space left in the main area. 1418 8337 echo " ",[($D000 - gameend)]d , "bytes of ROM space left in the main area." 1419 8337 - if ($D000 - gameend) < 0 1420 8337 -SPACEOVERFLOW SET (SPACEOVERFLOW+1) 1421 8337 endif 1422 8337 1423 d000 ORG $D000,0 ; ************* 1424 d000 1425 d000 atascii 1426 d000 00 00 00 00* HEX 0000000000000000000000000000000000000000000000000000000000000000 1427 d020 00 00 00 00* HEX 0000000000000000000000000000000000000000000000000000000000000000 1428 d040 00 00 00 00* HEX 0000000000000000000000000000000000000000000000000500000000000000 1429 d060 00 00 00 00* HEX 0000000000000000000000000000000000000000000005000000000000000000 1430 d080 00 00 00 00* HEX 0000000000000000000000000000000000000000000000000000000000000000 1431 d0a0 00 00 00 00* HEX 0000000000000000000000000000000000000000000000000000000000000000 1432 d0c0 00 00 00 00* HEX 0000000000000000000000000000155000000000055000000000000000000000 1433 d0e0 14 00 00 14* HEX 14000014000000000000000000000000000015400000 1434 d0f6 1435 d100 ORG $D100,0 ; ************* 1436 d100 1437 d100 ;atascii 1438 d100 00 00 00 00* HEX 0000000000000000000000000000000000000000000000000000000000000000 1439 d120 00 00 00 00* HEX 0000000000000000000000000000000000000000000000000000000000000000 1440 d140 00 00 01 40* HEX 0000014000001414014010140545000000541500000000000140000001401000 1441 d160 05 50 15 54* HEX 0550155415540550005005500550050005500540014001400014000014000140 1442 d180 05 54 14 14* HEX 0554141415500550154015541400055414141554055014141554140514140550 1443 d1a0 14 00 05 14* HEX 1400051414140550014015540140140514140140155401540014154000005555 1444 d1c0 00 00 05 54* HEX 0000055415500550055405500140001414140550001414140550140514140550 1445 d1e0 14 00 00 14* HEX 14000014140015500054055401400514141400501554 1446 d1f6 1447 d200 ORG $D200,0 ; ************* 1448 d200 1449 d200 ;atascii 1450 d200 00 00 00 00* HEX 0000000000000000000000000000000000000000000000000000000000000000 1451 d220 00 00 00 00* HEX 0000000000000000000000000000000000000000000000000000000000000000 1452 d240 00 00 00 00* HEX 0000000000005555155014141414000001500540141401400140000001401400 1453 d260 14 14 01 40* HEX 1414014005001414155414141414050014140050014001400050155405000000 1454 d280 14 00 15 54* HEX 1400155414141414145014001400141414140140141414501400140514541414 1455 d2a0 14 00 14 50* HEX 1400145014500014014014140550151514140140140001400050014000000000 1456 d2c0 00 00 14 14* HEX 0000141414141400141414000140055414140140001414500140144514141414 1457 d2e0 15 50 05 54* HEX 15500554140000140140141405500554055005540500 1458 d2f6 1459 d300 ORG $D300,0 ; ************* 1460 d300 1461 d300 ;atascii 1462 d300 00 00 00 00* HEX 0000000000000000000000000000000000000000000000000000000000000000 1463 d320 00 00 00 00* HEX 0000000000000000000000000000000000000000000000000000000000000000 1464 d340 00 00 01 40* HEX 0000014000001414001405001455000001400140055001400000000000000500 1465 d360 15 14 01 40* HEX 1514014001400050145000141414014014140014000000000140000001400140 1466 d380 14 54 14 14* HEX 1454141414141400141414001400145414140140001415401400144515541414 1467 d3a0 15 50 14 14* HEX 1550141415500014014014141414155505500140050001400140014014050000 1468 d3c0 00 00 05 54* HEX 0000055414141400141415540140141414140140001415400140155514141414 1469 d3e0 14 14 14 14* HEX 14141414140005500140141414141555014014140140 1470 d3f6 1471 d400 ORG $D400,0 ; ************* 1472 d400 1473 d400 ;atascii 1474 d400 00 00 00 00* HEX 0000000000000000000000000000000000000000000000000000000000000000 1475 d420 00 00 00 00* HEX 0000000000000000000000000000000000000000000000000000000000000000 1476 d440 00 00 01 40* HEX 0000014014141414055001400540014001400140555515540000155400000140 1477 d460 14 54 01 40* HEX 1454014000500140055015501550005005500554014001400500000000500050 1478 d480 14 54 14 14* HEX 1454141415501400141415501550140015540140001415401400155515541414 1479 d4a0 14 14 14 14* HEX 1414141414140550014014141414144505500550014001400500014005140000 1480 d4c0 01 40 00 14* HEX 0140001415501400055414140554141415500540001414500140155514141414 1481 d4e0 14 14 14 14* HEX 14141414141414000140141414141445055014140050 1482 d4f6 1483 d500 ORG $D500,0 ; ************* 1484 d500 1485 d500 ;atascii 1486 d500 00 00 00 00* HEX 0000000000000000000000000000000000000000000000000000000000000000 1487 d520 00 00 00 00* HEX 0000000000000000000000000000000000000000000000000000000000000000 1488 d540 00 00 01 40* HEX 0000014014145555140014500150014001500540055001400000000000000050 1489 d560 14 14 05 40* HEX 1414054014140050015014001400001414141414014001400140155401401414 1490 d580 14 14 05 50* HEX 1414055014141414145014001400140014140140001414501400151515141414 1491 d5a0 14 14 14 14* HEX 1414141414141400014014141414140514141414005001401400014001500000 1492 d5c0 01 40 05 50* HEX 0140055014000550001405500140055414000000000014000140141415500550 1493 d5e0 15 50 05 54* HEX 15500554155005541554141414141405141414141554 1494 d5f6 1495 d600 ORG $D600,0 ; ************* 1496 d600 1497 d600 ;atascii 1498 d600 00 00 00 00* HEX 0000000000000000000000000000000000000000000000000000000000000000 1499 d620 00 00 00 00* HEX 0000000000000000000000000000000000000000000000000000000000000000 1500 d640 00 00 01 40* HEX 0000014014141414055414140514014000541500141401400000000000000014 1501 d660 05 50 01 40* HEX 0550014005501554005015540550155405500550000000000050000005000550 1502 d680 05 50 01 40* HEX 0550014015500550154015541554055414141554001414141400140514140550 1503 d6a0 15 50 05 50* HEX 1550055015500550155414141414140514141414155401541000154000400000 1504 d6c0 01 40 00 00* HEX 0140000014000000001400000054000014000140001414000540000000000000 1505 d6e0 00 00 00 00* HEX 00000000000000000140000000000000000000000000 1506 d6f6 1507 d700 ORG $D700,0 ; ************* 1508 d700 1509 d700 ;atascii 1510 d700 00 00 00 00* HEX 0000000000000000000000000000000000000000000000000000000000000000 1511 d720 00 00 00 00* HEX 0000000000000000000000000000000000000000000000000000000000000000 1512 d740 00 00 00 00* HEX 0000000000000000014000000150000000000000000000000000000000000000 1513 d760 00 00 00 00* HEX 0000000000000000000000000000000000000000000000000014000014000000 1514 d780 00 00 00 00* HEX 0000000000000000000000000000000000000000000000000000000000000000 1515 d7a0 00 00 00 00* HEX 0000000000000000000000000000000000000000000000000000000000000000 1516 d7c0 00 00 00 00* HEX 0000000000000000000000000000000000000000000000000000000000000000 1517 d7e0 00 00 00 00* HEX 00000000000000000000000000000000000000000000 1518 d7f6 1519 d800 ORG $D800,0 ; ************* 1520 d800 dmahole_0 1521 d800 DMAHOLESTART0 SET . 1522 d800 . 1523 d800 ;; 1524 d800 1525 d800 . 1526 d800 ;; 1527 d800 1528 d800 . 1529 d800 ;; 1530 d800 1531 d800 . 1532 d800 ;; 1533 d800 1534 d800 . 1535 d800 ;; 1536 d800 1537 d800 . 1538 d800 ;; 1539 d800 1540 d800 .L073 ;; data sfx_pulsecannon 1541 d800 1542 d800 4c 57 d8 JMP .skipL073 1543 d803 sfx_pulsecannon 1544 d803 10 10 00 .byte.b $10,$10,$00 1545 d806 1546 d806 1e 0c 0a .byte.b $1E,$0C,$0A 1547 d809 1548 d809 07 06 0f .byte.b $07,$06,$0F 1549 d80c 1550 d80c 07 06 0f .byte.b $07,$06,$0F 1551 d80f 1552 d80f 1e 06 0f .byte.b $1E,$06,$0F 1553 d812 1554 d812 17 0c 0b .byte.b $17,$0C,$0B 1555 d815 1556 d815 1b 0c 0b .byte.b $1B,$0C,$0B 1557 d818 1558 d818 1e 0c 0f .byte.b $1E,$0C,$0F 1559 d81b 1560 d81b 07 06 0f .byte.b $07,$06,$0F 1561 d81e 1562 d81e 07 06 0f .byte.b $07,$06,$0F 1563 d821 1564 d821 1e 06 08 .byte.b $1E,$06,$08 1565 d824 1566 d824 17 0c 06 .byte.b $17,$0C,$06 1567 d827 1568 d827 1b 0c 0f .byte.b $1B,$0C,$0F 1569 d82a 1570 d82a 1e 0c 0f .byte.b $1E,$0C,$0F 1571 d82d 1572 d82d 07 06 0f .byte.b $07,$06,$0F 1573 d830 1574 d830 07 06 0f .byte.b $07,$06,$0F 1575 d833 1576 d833 0a 06 0a .byte.b $0A,$06,$0A 1577 d836 1578 d836 17 0c 0a .byte.b $17,$0C,$0A 1579 d839 1580 d839 1e 0c 04 .byte.b $1E,$0C,$04 1581 d83c 1582 d83c 1e 06 09 .byte.b $1E,$06,$09 1583 d83f 1584 d83f 1b 04 05 .byte.b $1B,$04,$05 1585 d842 1586 d842 07 06 0f .byte.b $07,$06,$0F 1587 d845 1588 d845 0a 06 09 .byte.b $0A,$06,$09 1589 d848 1590 d848 17 0c 0d .byte.b $17,$0C,$0D 1591 d84b 1592 d84b 1b 0c 09 .byte.b $1B,$0C,$09 1593 d84e 1594 d84e 0a 06 05 .byte.b $0A,$06,$05 1595 d851 1596 d851 17 0c 03 .byte.b $17,$0C,$03 1597 d854 1598 d854 00 00 00 .byte.b $00,$00,$00 1599 d857 1600 d857 .skipL073 1601 d857 00 03 sfx_pulsecannon_lo = #sfx_pulsecannon 1603 d857 DMAHOLEEND0 SET . 1961 bytes of ROM space left in DMA hole 0. 1604 d857 echo " "," "," "," ",[(256*WZONEHEIGHT)-(DMAHOLEEND0 - DMAHOLESTART0)]d , "bytes of ROM space left in DMA hole 0." 1605 d857 - if ((256*WZONEHEIGHT)-(DMAHOLEEND0 - DMAHOLESTART0)) < 0 1606 d857 -SPACEOVERFLOW SET (SPACEOVERFLOW+1) 1607 d857 endif 1608 d857 1609 e000 ORG $E000,0 ; ************* 1610 e000 1611 e000 heofonfir_font 1612 e000 08 2a 2a 08* HEX 082a2a0802280802080822280a282a202a222a08222a22222a200a2228080808 1613 e020 22 22 08 2a* HEX 2222082a202020082020002002220808222a220000020822aa0a28082020202a 1614 e040 08 22 2a 22* HEX 08222a22082a08082a008000802aa8 1615 e04f heofonfir_push_fire_banner00 1616 e04f 82 20 a2 80* HEX 8220a28000a820882020 1617 e059 heofonfir_push_fire_banner01 1618 e059 00 00 00 00* HEX 00000000000000000000 1619 e063 heofonfir_bullet 1620 e063 0c HEX 0c 1621 e064 heofonfir_lucelia_160b_wip 1622 e064 10 00 64 80* HEX 100064801000 1623 e06a heofonfir_lucelia_160b_wip_tallsprite_00 1624 e06a 00 10 00 10* HEX 001000100000 1625 e070 heofonfir_lucelia_160b_wip_tallsprite_01 1626 e070 00 84 00 00* HEX 008400008400 1627 e076 1628 e100 ORG $E100,0 ; ************* 1629 e100 1630 e100 ;heofonfir_font 1631 e100 12 54 54 12* HEX 1254541206521206121266521452546056665412665466665660166652181218 1632 e120 66 66 18 54* HEX 6666185440604010406000480444121044544400000612655416521160606056 1633 e140 12 66 54 66* HEX 126654661854181854018001805550 1634 e14f ;heofonfir_push_fire_banner00 1635 e14f a0 00 02 00* HEX a0000200008000000020 1636 e159 ;heofonfir_push_fire_banner01 1637 e159 40 41 41 10* HEX 40414110004054401410 1638 e163 ;heofonfir_bullet 1639 e163 0c HEX 0c 1640 e164 ;heofonfir_lucelia_160b_wip 1641 e164 00 40 e0 c0* HEX 0040e0c04000 1642 e16a ;heofonfir_lucelia_160b_wip_tallsprite_00 1643 e16a 00 10 40 50* HEX 001040500000 1644 e170 ;heofonfir_lucelia_160b_wip_tallsprite_01 1645 e170 00 84 00 00* HEX 008400008400 1646 e176 1647 e200 ORG $E200,0 ; ************* 1648 e200 1649 e200 ;heofonfir_font 1650 e200 66 18 48 46* HEX 6618484606066606664666666066606066661846666066666660666606186612 1651 e220 56 66 18 48* HEX 566618480040200800400012101044000000110000066466006626666a686066 1652 e240 66 66 00 66* HEX 6666006612481a181201a001800520 1653 e24f ;heofonfir_push_fire_banner00 1654 e24f 88 00 02 00* HEX 88000200008020000020 1655 e259 ;heofonfir_push_fire_banner01 1656 e259 41 10 11 10* HEX 41101110004010404000 1657 e263 ;heofonfir_bullet 1658 e263 08 HEX 08 1659 e264 ;heofonfir_lucelia_160b_wip 1660 e264 00 10 64 90* HEX 001064900000 1661 e26a ;heofonfir_lucelia_160b_wip_tallsprite_00 1662 e26a 00 10 60 50* HEX 001060500000 1663 e270 ;heofonfir_lucelia_160b_wip_tallsprite_01 1664 e270 00 40 00 00* HEX 004000004000 1665 e276 1666 e300 ORG $E300,0 ; ************* 1667 e300 1668 e300 ;heofonfir_font 1669 e300 66 18 18 04* HEX 66181804260464064406666460666a6866661806646066666668666404186666 1670 e320 56 44 1a 18* HEX 56441a180000601800000004400000000000000000064866aa46446656526066 1671 e340 66 66 2a 66* HEX 66662a666612561a66054801a01048 1672 e34f ;heofonfir_push_fire_banner00 1673 e34f 88 00 02 00* HEX 88000200008000000020 1674 e359 ;heofonfir_push_fire_banner01 1675 e359 41 10 11 10* HEX 41101110004010404000 1676 e363 ;heofonfir_bullet 1677 e363 08 HEX 08 1678 e364 ;heofonfir_lucelia_160b_wip 1679 e364 00 00 64 80* HEX 000064800000 1680 e36a ;heofonfir_lucelia_160b_wip_tallsprite_00 1681 e36a 00 10 64 90* HEX 001064900000 1682 e370 ;heofonfir_lucelia_160b_wip_tallsprite_01 1683 e370 00 40 00 00* HEX 004000004000 1684 e376 1685 e400 ORG $E400,0 ; ************* 1686 e400 1687 e400 ;heofonfir_font 1688 e400 66 18 12 58* HEX 6618125856505006121656526066545064561806526056666652665210186666 1689 e420 66 12 56 18* HEX 6612561800006012000000000000000000000028000618555416126566666066 1690 e440 56 44 54 66* HEX 564454666604565666119005486018 1691 e44f ;heofonfir_push_fire_banner00 1692 e44f cc 00 03 00* HEX cc00030000c000000030 1693 e459 ;heofonfir_push_fire_banner01 1694 e459 41 10 51 10* HEX 41105110004010404010 1695 e463 ;heofonfir_bullet 1696 e463 08 HEX 08 1697 e464 ;heofonfir_lucelia_160b_wip 1698 e464 00 00 20 00* HEX 000020000000 1699 e46a ;heofonfir_lucelia_160b_wip_tallsprite_00 1700 e46a 30 30 e0 f0* HEX 3030e0f03000 1701 e470 ;heofonfir_lucelia_160b_wip_tallsprite_01 1702 e470 00 40 00 00* HEX 004000004000 1703 e476 1704 e500 ORG $E500,0 ; ************* 1705 e500 1706 e500 ;heofonfir_font 1707 e500 66 18 26 12* HEX 6618261266606006666666666066606060661806666056666666666660186666 1708 e520 66 66 66 12* HEX 6666661200006026000000000000000000000052020410660006266654666044 1709 e540 66 18 00 66* HEX 661800666610545666054019986010 1710 e54f ;heofonfir_push_fire_banner00 1711 e54f 88 00 02 00* HEX 88000200008000000020 1712 e559 ;heofonfir_push_fire_banner01 1713 e559 41 11 41 10* HEX 41114110004010405410 1714 e563 ;heofonfir_bullet 1715 e563 04 HEX 04 1716 e564 ;heofonfir_lucelia_160b_wip 1717 e564 00 00 55 80* HEX 000055800000 1718 e56a ;heofonfir_lucelia_160b_wip_tallsprite_00 1719 e56a 30 30 a0 b0* HEX 3030a0b03000 1720 e570 ;heofonfir_lucelia_160b_wip_tallsprite_01 1721 e570 00 40 00 00* HEX 004000004000 1722 e576 1723 e600 ORG $E600,0 ; ************* 1724 e600 1725 e600 ;heofonfir_font 1726 e600 44 58 44 26* HEX 44584426666a4a26444444644a646a6a4a661a0666605664666444644a1a6666 1727 e620 66 66 66 26* HEX 666666260000404420200000000000000000000406020864aa16444460666a18 1728 e640 44 18 2a 66* HEX 44182a66446a185644018019981a40 1729 e64f ;heofonfir_push_fire_banner00 1730 e64f 88 00 00 00* HEX 88000000008000000020 1731 e659 ;heofonfir_push_fire_banner01 1732 e659 41 11 01 10* HEX 41110110004010404410 1733 e663 ;heofonfir_bullet 1734 e663 04 HEX 04 1735 e664 ;heofonfir_lucelia_160b_wip 1736 e664 00 00 55 80* HEX 000055800000 1737 e66a ;heofonfir_lucelia_160b_wip_tallsprite_00 1738 e66a 30 11 64 a0* HEX 301164a03000 1739 e670 ;heofonfir_lucelia_160b_wip_tallsprite_01 1740 e670 00 10 00 10* HEX 001000100000 1741 e676 1742 e700 ORG $E700,0 ; ************* 1743 e700 1744 e700 ;heofonfir_font 1745 e700 10 10 10 54* HEX 1010105444541454101010501450545414445404444044505450105014544444 1746 e720 44 44 44 54* HEX 4444445400000010404000000000000000000010040410115404101140545410 1747 e740 10 10 54 54* HEX 101054541054104410010011100500 1748 e74f ;heofonfir_push_fire_banner00 1749 e74f 50 00 00 00* HEX 50000000005400000010 1750 e759 ;heofonfir_push_fire_banner01 1751 e759 82 22 02 20* HEX 822202200080a0a08820 1752 e763 ;heofonfir_bullet 1753 e763 04 HEX 04 1754 e764 ;heofonfir_lucelia_160b_wip 1755 e764 00 00 11 00* HEX 000011000000 1756 e76a ;heofonfir_lucelia_160b_wip_tallsprite_00 1757 e76a 10 11 64 a0* HEX 101164a01000 1758 e770 ;heofonfir_lucelia_160b_wip_tallsprite_01 1759 e770 00 10 00 10* HEX 001000100000 1760 e776 - if SPACEOVERFLOW > 0 1761 e776 - echo "" 1762 e776 - echo "######## ERROR: space overflow detected in",[SPACEOVERFLOW]d,"areas." 1763 e776 - echo "######## look above for areas with negative ROM space left." 1764 e776 - echo "######## Aborting assembly." 1765 e776 - ERR 1766 e776 endif 1767 e776 1768 e776 1769 e776 ; Provided under the CC0 license. See the included LICENSE.txt for details. 1770 e776 1771 e776 ifnconst bankswitchmode 1772 e776 if ( * < $f000 ) 1773 f000 ORG $F000 1774 f000 endif 1775 f000 - else 1776 f000 - ifconst ROM128K 1777 f000 - if ( * < $f000 ) 1778 f000 - ORG $27000 1779 f000 - RORG $F000 1780 f000 - endif 1781 f000 - endif 1782 f000 - ifconst ROM144K 1783 f000 - if ( * < $f000 ) 1784 f000 - ORG $27000 1785 f000 - RORG $F000 1786 f000 - endif 1787 f000 - endif 1788 f000 - ifconst ROM256K 1789 f000 - if ( * < $f000 ) 1790 f000 - ORG $47000 1791 f000 - RORG $F000 1792 f000 - endif 1793 f000 - endif 1794 f000 - ifconst ROM272K 1795 f000 - if ( * < $f000 ) 1796 f000 - ORG $47000 1797 f000 - RORG $F000 1798 f000 - endif 1799 f000 - endif 1800 f000 - ifconst ROM512K 1801 f000 - if ( * < $f000 ) 1802 f000 - ORG $87000 1803 f000 - RORG $F000 1804 f000 - endif 1805 f000 - endif 1806 f000 - ifconst ROM528K 1807 f000 - if ( * < $f000 ) 1808 f000 - ORG $87000 1809 f000 - RORG $F000 1810 f000 - endif 1811 f000 - endif 1812 f000 endif 1813 f000 1814 f000 ; all of these "modules" have conditional clauses in them, so even though 1815 f000 ; they're always included here, they don't take up rom unless the user 1816 f000 ; explicitly enables support for the feature. 1817 f000 1818 f000 ifnconst included.7800vox.asm ------- FILE 7800vox.asm LEVEL 2 PASS 3 0 f000 include 7800vox.asm 1 f000 ; Provided under the CC0 license. See the included LICENSE.txt for details. 2 f000 3 f000 ; AtariVox 7800basic wrapper 4 f000 5 f000 ; to be called with 6 f000 ; A=# of bytes 7 f000 ; 8 f000 9 f000 - ifconst HSSUPPORT 10 f000 - 11 f000 -AVoxReadBytes 12 f000 - sta temp8 13 f000 - jsr i2c_startwrite 14 f000 - bcs eeprom_error 15 f000 - 16 f000 - lda HSVoxHi 17 f000 - jsr i2c_txbyte 18 f000 - lda HSVoxLo 19 f000 - jsr i2c_txbyte 20 f000 - jsr i2c_stopwrite 21 f000 - 22 f000 - jsr i2c_startread 23 f000 - 24 f000 - ldx #0 25 f000 -AVoxReadBytesLoop 26 f000 - jsr i2c_rxbyte 27 f000 - sta eeprombuffer,x 28 f000 - inx 29 f000 - cpx temp8 30 f000 - bne AVoxReadBytesLoop 31 f000 - jsr i2c_stopread 32 f000 - lda #0 33 f000 - rts 34 f000 - 35 f000 - ; to be called with 36 f000 - ; A=# of bytes 37 f000 - ; 38 f000 - 39 f000 -AVoxWriteBytes 40 f000 - sta temp8 41 f000 - jsr i2c_startwrite 42 f000 - bcs eeprom_error 43 f000 - 44 f000 - lda HSVoxHi 45 f000 - jsr i2c_txbyte 46 f000 - lda HSVoxLo 47 f000 - jsr i2c_txbyte 48 f000 - 49 f000 - ldx #$00 50 f000 -AVoxWriteBytesLoop 51 f000 - lda eeprombuffer,x 52 f000 - jsr i2c_txbyte 53 f000 - inx 54 f000 - cpx temp8 55 f000 - bne AVoxWriteBytesLoop 56 f000 - jsr i2c_stopwrite 57 f000 - 58 f000 - lda #0 59 f000 - rts 60 f000 - 61 f000 -eeprom_error 62 f000 - lda #$ff 63 f000 - rts 64 f000 - 65 f000 -AVoxDetect 66 f000 - 67 f000 - jsr i2c_startwrite 68 f000 - bcs eeprom_error 69 f000 - lda #$30 70 f000 - jsr i2c_txbyte 71 f000 - lda #$00 72 f000 - jsr i2c_txbyte 73 f000 - jsr i2c_stopwrite 74 f000 - rts 75 f000 - 76 f000 - include "i2c7800.inc" 77 f000 - I2C_SUBS temp9 78 f000 - 79 f000 endif 80 f000 ------- FILE c:\Users\Shane\Documents\my7800projects\Heofonfir\shooting_test.78b.asm 1820 f000 endif 1821 f000 ifnconst included.pokeysound.asm ------- FILE pokeysound.asm LEVEL 2 PASS 3 0 f000 include pokeysound.asm 1 f000 ; Provided under the CC0 license. See the included LICENSE.txt for details. 2 f000 3 f000 4 f000 - ifconst pokeysupport 5 f000 - 6 f000 -pokeysoundmodulestart 7 f000 - 8 f000 -mutepokey 9 f000 - lda #0 10 f000 - ldy #7 11 f000 -mutepokeyloop 12 f000 - sta pokey1pointlo,y 13 f000 - sta (pokeybaselo),y 14 f000 - dey 15 f000 - bpl mutepokeyloop 16 f000 - rts 17 f000 - 18 f000 -checkpokeyplaying 19 f000 - ldx #6 20 f000 -checkpokeyplayingloop 21 f000 - lda pokey1pointlo,x 22 f000 - ora pokey1pointhi,x 23 f000 - beq pokeychannelinactive 24 f000 - jsr playpokeysfxA ; x=channel*2 25 f000 -pokeychannelinactive 26 f000 - dex 27 f000 - dex 28 f000 - bpl checkpokeyplayingloop 29 f000 - rts 30 f000 - 31 f000 -playpokeysfxA 32 f000 - txa 33 f000 - tay 34 f000 - lda pokey1tick,x 35 f000 - beq playpokeysfxAcont 36 f000 - sec 37 f000 - sbc #1 38 f000 - sta pokey1tick,x ; sound resolution is >1 frame, and we're mid-tock... 39 f000 - rts 40 f000 - 41 f000 -playpokeysfxAcont 42 f000 - lda pokey1frames,x ; set the frame countdown for this sound chunk 43 f000 - sta pokey1tick,x 44 f000 - 45 f000 - lda pokey1priority,x ; decrease the sound's priority if its non-zero 46 f000 - beq playpokeysfxAcont2 47 f000 - sec 48 f000 - sbc #1 49 f000 - sta pokey1priority,x 50 f000 -playpokeysfxAcont2 51 f000 - 52 f000 - ; *** FREQUENCY 53 f000 - lda (pokey1pointlo,x) 54 f000 - sta temp1 55 f000 - clc 56 f000 - adc pokey1offset,x ; take into account any pitch modification 57 f000 - sta (pokeybaselo),y ; PAUDF0,0 58 f000 - 59 f000 - ;advance the data pointer +1 60 f000 - inc pokey1pointlo,x 61 f000 - bne skippokeyhiinc1 62 f000 - inc pokey1pointhi,x 63 f000 -skippokeyhiinc1 64 f000 - 65 f000 - ; *** WAVE 66 f000 - lda (pokey1pointlo,x) 67 f000 - asl 68 f000 - asl 69 f000 - asl 70 f000 - asl ; x16 71 f000 - 72 f000 - ;advance the data pointer +1 73 f000 - inc pokey1pointlo,x 74 f000 - bne skippokeyhiinc2 75 f000 - inc pokey1pointhi,x 76 f000 -skippokeyhiinc2 77 f000 - 78 f000 - ora (pokey1pointlo,x) 79 f000 - iny 80 f000 - sta (pokeybaselo),y 81 f000 - 82 f000 - ora temp1 ; check if F|C|V=0 83 f000 - beq zeropokeypoint ; if so, we're at the end of the sound. 84 f000 - 85 f000 - ; advance the pointer +1, on to the next sound chunk 86 f000 - inc pokey1pointlo,x 87 f000 - bne skippokeyhiinc3 88 f000 - inc pokey1pointhi,x 89 f000 -skippokeyhiinc3 90 f000 - rts 91 f000 - 92 f000 -zeropokeypoint 93 f000 - sta pokey1pointlo,x 94 f000 - sta pokey1pointhi,x 95 f000 - sta pokey1priority,x 96 f000 - rts 97 f000 - 98 f000 -schedulepokeysfx 99 f000 - ldx #6 100 f000 -schedulepokeysfxloop 101 f000 - lda pokey1pointlo,x 102 f000 - ora pokey1pointhi,x 103 f000 - bne schedulespokeysearch 104 f000 - jmp schedulepokeyX ; we found an unused channel, so use it... 105 f000 -schedulespokeysearch 106 f000 - dex 107 f000 - dex 108 f000 - bpl schedulepokeysfxloop 109 f000 - 110 f000 - ; if we're here, all 4 channels are presently playing a sound... 111 f000 - ldy #1 112 f000 - lda (temp1),y ; peek at the priority of this sfx... 113 f000 - bne schedulepokeysfxcont1 114 f000 - rts ; ...and skip it if it's 0 priority 115 f000 -schedulepokeysfxcont1 116 f000 - 117 f000 - ; figure out which current sound has the lowest priority... 118 f000 - lda #0 119 f000 - sta temp8 120 f000 - lda pokey1priority 121 f000 - sta temp9 122 f000 - ldx #6 123 f000 -findlowprioritypokeyloop 124 f000 - lda pokey1priority,x 125 f000 - cmp temp9 126 f000 - bcs findlowprioritypokeyloopcontinue 127 f000 - sta temp9 128 f000 - stx temp8 129 f000 -findlowprioritypokeyloopcontinue 130 f000 - dex 131 f000 - dex 132 f000 - bne findlowprioritypokeyloop 133 f000 - ldx temp8 ; the low priority channel we'll interrupt 134 f000 - 135 f000 -schedulepokeyX 136 f000 - ;called with X=2*pokey channel to play on... 137 f000 - ldy #1 ; get priority and sound-resolution (in frames) 138 f000 - lda (temp1),y 139 f000 - sta pokey1priority,x 140 f000 - iny 141 f000 - lda (temp1),y 142 f000 - sta pokey1frames,x 143 f000 - 144 f000 - lda temp1 145 f000 - clc 146 f000 - adc #3 147 f000 - sta pokey1pointlo,x 148 f000 - lda temp2 149 f000 - adc #0 150 f000 - sta pokey1pointhi,x 151 f000 - lda temp3 152 f000 - sta pokey1offset,x 153 f000 - lda #0 154 f000 - sta pokey1tick,x 155 f000 - rts 156 f000 - 157 f000 - ; pokey detection routine. we check for pokey in the XBOARD/XM location, 158 f000 - ; and the standard $4000 location. 159 f000 - ; if pokey the pokey is present, this routine will reset it. 160 f000 - 161 f000 -detectpokeylocation 162 f000 - ;XBoard/XM... 163 f000 - ldx #2 164 f000 -detectpokeyloop 165 f000 - lda XCTRL1s 166 f000 - ora #%00010100 167 f000 - and POKEYXMMASK,x 168 f000 - sta XCTRL1s 169 f000 - sta XCTRL1 170 f000 - 171 f000 - lda POKEYCHECKLO,x 172 f000 - sta pokeybaselo 173 f000 - lda POKEYCHECKHI,x 174 f000 - sta pokeybasehi 175 f000 - jsr checkforpokey 176 f000 - lda pokeydetected 177 f000 - beq foundpokeychip 178 f000 - dex 179 f000 - bpl detectpokeyloop 180 f000 -foundpokeychip 181 f000 - eor #$ff ; invert state for 7800basic if...then test 182 f000 - sta pokeydetected 183 f000 - rts 184 f000 - 185 f000 -POKEYXMMASK 186 f000 - ; XM POKEY on XM POKEY off XM POKEY off 187 f000 - .byte %11111111, %11101111, %11101111 188 f000 - 189 f000 -POKEYCHECKLO 190 f000 - .byte <$0450, <$0450, <$4000 191 f000 -POKEYCHECKHI 192 f000 - .byte >$0450, >$0450, >$4000 193 f000 - 194 f000 -checkforpokey 195 f000 - ldy #$0f 196 f000 - lda #$00 197 f000 - sta pokeydetected ; start off by assuming pokey will be detected 198 f000 -resetpokeyregistersloop 199 f000 - sta (pokeybase),y 200 f000 - dey 201 f000 - bpl resetpokeyregistersloop 202 f000 - 203 f000 - ldy #PAUDCTL 204 f000 - sta (pokeybase),y 205 f000 - ldy #PSKCTL 206 f000 - sta (pokeybase),y 207 f000 - 208 f000 - ; let the dust settle... 209 f000 - nop 210 f000 - nop 211 f000 - nop 212 f000 - 213 f000 - lda #4 214 f000 - sta temp9 215 f000 -pokeycheckloop1 216 f000 - ; we're in reset, so the RANDOM register should read $ff... 217 f000 - ldy #PRANDOM 218 f000 - lda (pokeybase),y 219 f000 - cmp #$ff 220 f000 - bne nopokeydetected 221 f000 - dec temp9 222 f000 - bne pokeycheckloop1 223 f000 - 224 f000 - ; take pokey out of reset... 225 f000 - ldy #PSKCTL 226 f000 - lda #3 227 f000 - sta (pokeybase),y 228 f000 - ldy #PAUDCTL 229 f000 - lda #0 230 f000 - sta (pokeybase),y 231 f000 - 232 f000 - ; let the dust settle again... 233 f000 - nop 234 f000 - nop 235 f000 - nop 236 f000 - 237 f000 - lda #4 238 f000 - sta temp9 239 f000 -pokeycheckloop2 240 f000 - ; we're out of reset, so RANDOM should read non-$ff... 241 f000 - ldy #PRANDOM 242 f000 - lda (pokeybase),y 243 f000 - cmp #$ff 244 f000 - beq skippokeycheckreturn 245 f000 - rts 246 f000 -skippokeycheckreturn 247 f000 - dec temp9 248 f000 - bne pokeycheckloop2 249 f000 -nopokeydetected 250 f000 - dec pokeydetected ; pokeydetected=#$ff 251 f000 - rts 252 f000 - 253 f000 -pokeysoundmoduleend 254 f000 - 255 f000 - echo " pokeysound assembly: ",[(pokeysoundmoduleend-pokeysoundmodulestart)]d," bytes" 256 f000 - 257 f000 endif ------- FILE c:\Users\Shane\Documents\my7800projects\Heofonfir\shooting_test.78b.asm 1823 f000 endif 1824 f000 ifnconst included.tracker.asm ------- FILE tracker.asm LEVEL 2 PASS 3 0 f000 include tracker.asm 1 f000 ; Provided under the CC0 license. See the included LICENSE.txt for details. 2 f000 3 f000 4 f000 - ifconst MUSICTRACKER 5 f000 - ; ** songtempo lists how many 256ths of a frame a 16th note lasts 6 f000 - ; ** the player operates on a 16th note grid. 7 f000 - 8 f000 -servicesongover 9 f000 - rts 10 f000 -servicesong 11 f000 - lda songtempo 12 f000 - beq servicesongover ; ** if song is off/paused then return 13 f000 -servicesongcontinue 14 f000 - lda sfxschedulelock 15 f000 - sta sfxschedulemissed 16 f000 - bne servicesongover 17 f000 - lda songtempo 18 f000 - clc 19 f000 - adc songtick ; add songtempo to songtick until it rolls over 20 f000 - sta songtick ; this is how we break away from 50/60Hz timing. 21 f000 - bcc servicesongover 22 f000 - ; ** if we're here a new 16th note has passed 23 f000 - ; ** check if a new note is due on any of the 4 channels 24 f000 -servicesongredo 25 f000 - ldx #3 26 f000 -checkchannelloop 27 f000 - dec songchannel1busywait,x 28 f000 - bpl carryoncheckingchannel 29 f000 - txa 30 f000 - pha ; save X for the loop 31 f000 - jsr processsongdata 32 f000 - pla ; restore X for the loop 33 f000 - tax 34 f000 -carryoncheckingchannel 35 f000 - dex 36 f000 - bpl checkchannelloop 37 f000 - lda inactivechannelcount 38 f000 - cmp #15 39 f000 - bne skipstopsong 40 f000 - lda songloops 41 f000 - bne doasongloop 42 f000 - ;lda #0 43 f000 - sta songtempo ; all channels are done. stop the song 44 f000 - rts 45 f000 -doasongloop 46 f000 - bmi skipsongloopadjust 47 f000 - dec songloops 48 f000 -skipsongloopadjust 49 f000 - jsr setsongchannels 50 f000 - jmp servicesongredo 51 f000 -skipstopsong 52 f000 - rts 53 f000 - 54 f000 -processsongdata 55 f000 - ; channel needs processing 56 f000 - ; X=channel # 57 f000 - 58 f000 - txa 59 f000 - clc 60 f000 - adc songchannel1stackdepth,x ; stack depth value will be 0, 4, or 8 61 f000 - tay 62 f000 - 63 f000 - 64 f000 - ; ** indirect x is cumbersome with mult-byte commands. 65 f000 - ; ** setup a pointer to the song data for indirect y addressing. 66 f000 - lda songchannel1layer1lo,y 67 f000 - sta songdatalo 68 f000 - lda songchannel1layer1hi,y 69 f000 - sta songdatahi 70 f000 - ora songdatalo 71 f000 - bne channelhasdata 72 f000 - ;channel data is pointing at $0000 73 f000 - lda #$7F 74 f000 - sta songchannel1busywait,x ; skip a bunch of notes 75 f000 -setchannelcountbits 76 f000 - lda channel2bits,x 77 f000 - ora inactivechannelcount 78 f000 - sta inactivechannelcount 79 f000 - rts 80 f000 -channelhasdata 81 f000 - 82 f000 - sty songstackindex 83 f000 - ldy #0 84 f000 - lda (songdatalo),y ; ** load in the next byte of song data, so we can decode it 85 f000 - cmp #$ff 86 f000 - bne carryoncheckingdatatype ; ** $ff=pattern end marker 87 f000 - jmp handlechannelEOD 88 f000 - 89 f000 -carryoncheckingdatatype 90 f000 - and #$F0 91 f000 - cmp #$C0 92 f000 - beq handlechannelrest ; 0000XXXX=rest 93 f000 - cmp #$F0 94 f000 - beq handlemultibytecommand 95 f000 - cmp #$D0 96 f000 - beq handlesemiup 97 f000 - cmp #$E0 98 f000 - beq handlesemidown 99 f000 -handlenotedata 100 f000 - ; ** TODO: note playing is a terrible choice for fall-through 101 f000 - 102 f000 - ; ** its simple note data, prepare arguments for schedulesfx 103 f000 - 104 f000 - ; ** set the note length 105 f000 - lda (songdatalo),y 106 f000 - and #$0F 107 f000 - sta songchannel1busywait,x 108 f000 - 109 f000 - ; ** load the instrument 110 f000 - lda songchannel1instrumentlo,x 111 f000 - sta sfxinstrumentlo 112 f000 - lda songchannel1instrumenthi,x 113 f000 - sta sfxinstrumenthi 114 f000 - 115 f000 - ; ** get the note, and transpose 116 f000 - lda (songdatalo),y 117 f000 - lsr 118 f000 - lsr 119 f000 - lsr 120 f000 - lsr 121 f000 - clc 122 f000 - adc songchannel1transpose,x ; ** add it to the transpose index 123 f000 - ; ** its up the respective SFX scheduler to handle and save the note data 124 f000 - sta sfxnoteindex 125 f000 - 126 f000 - lda #0 127 f000 - sta sfxpitchoffset 128 f000 - 129 f000 - jsr schedulesfx 130 f000 - 131 f000 - jmp advancethesongpointer1byte ; advance to the next data byte and exit 132 f000 - 133 f000 -handlechannelrest 134 f000 - ; ** set the note length 135 f000 - lda (songdatalo),y 136 f000 - and #$0F 137 f000 - sta songchannel1busywait,x 138 f000 - jmp advancethesongpointer1byte ; advance to the next data byte and exit 139 f000 - 140 f000 -handlesemiup 141 f000 - lda (songdatalo),y ; ** reload the song data, so we can get at the lower nibble 142 f000 - and #$0f ; ** since we need to mask the nibble of the subtracted value, 143 f000 - clc 144 f000 -handlesemidownentry 145 f000 - adc songchannel1transpose,x ; ** add it to the transpose index 146 f000 - sta songchannel1transpose,x 147 f000 - jsr advancethesongpointer1byte 148 f000 - jmp processsongdata ; semi doesn't have note length, so process the next data byte... 149 f000 - 150 f000 -handlesemidown 151 f000 - lda (songdatalo),y ; ** reload the song data, so we can get at the lower nibble 152 f000 - and #$0f ; ** since we need to mask the nibble of the subtracted value, 153 f000 - eor #$ff ; ** its easier if we negate it, and then add it instead. 154 f000 - sec 155 f000 - jmp handlesemidownentry 156 f000 - 157 f000 -handlemultibytecommand 158 f000 - lda (songdatalo),y ; ** reload the song data, so we can get at the lower nibble 159 f000 - and #$0f ; ** since we need to mask the nibble of the subtracted value, 160 f000 - cmp #$08 ; ** load new instrument? 161 f000 - bne nothandleinstrumentchange 162 f000 -handleinstrumentchange 163 f000 - iny 164 f000 - lda (songdatalo),y 165 f000 - sta songchannel1instrumentlo,x 166 f000 - iny 167 f000 - lda (songdatalo),y 168 f000 - sta songchannel1instrumenthi,x 169 f000 - lda #3 170 f000 - jsr advancethesongpointerNbytes ; advance 3 bytes 171 f000 - jmp processsongdata 172 f000 - 173 f000 -nothandleinstrumentchange 174 f000 - cmp #$09 ; ** absolute tempo change? 175 f000 - bne nothandletempochange 176 f000 - lda #0 177 f000 - sta songtempo 178 f000 -handlerelativetempochange 179 f000 - iny 180 f000 - lda (songdatalo),y 181 f000 - clc 182 f000 - adc songtempo 183 f000 - sta songtempo 184 f000 - lda #2 185 f000 - jsr advancethesongpointerNbytes ; advance 2 bytes 186 f000 - jmp processsongdata 187 f000 - 188 f000 -nothandletempochange 189 f000 - cmp #$0A ; ** relative tempo change?: 190 f000 - beq handlerelativetempochange 191 f000 - cmp #$0B ; ** octave/semi change? 192 f000 - beq handleoctavesemichange 193 f000 -handlepatterndata 194 f000 - ; ** if we're here its a pattern/loop "subroutine" 195 f000 - ; ** move the channel's "stack" pointer and populate the new stack level 196 f000 - 197 f000 - lda #4 198 f000 - clc 199 f000 - adc songchannel1stackdepth,x 200 f000 - sta songchannel1stackdepth,x ; stack depth value will be 0, 4, or 8 201 f000 - 202 f000 - stx inttemp6 ; about to invalidate x. save it. 203 f000 - lda songstackindex 204 f000 - adc #4 205 f000 - tax 206 f000 - 207 f000 - lda (songdatalo),y 208 f000 - and #$7 209 f000 - sta songchannel1layer1loops,x 210 f000 - iny 211 f000 - lda (songdatalo),y 212 f000 - sta songchannel1layer1lo,x 213 f000 - iny 214 f000 - lda (songdatalo),y 215 f000 - sta songchannel1layer1hi,x 216 f000 - 217 f000 - ldx inttemp6 ; restore x with the channel # 218 f000 - 219 f000 - ; ** advance will operate on the old stack level, since we didn't store the updated songstackindex... 220 f000 - lda #3 221 f000 - jsr advancethesongpointerNbytes ; advance 3 bytes 222 f000 - 223 f000 - ; ** ...but the new stack level will be correctly picked up when we process the next byte. 224 f000 - jmp processsongdata 225 f000 - 226 f000 -handlechannelEOD 227 f000 - ; ** check if there are loops remaining on the pattern 228 f000 - stx inttemp6 229 f000 - ldx songstackindex 230 f000 - dec songchannel1layer1loops,x 231 f000 - bmi handlechannelEODnoloop 232 f000 - ; ** loops are remaining. set the pattern pointer to the pattern start, which is contained after the EOD 233 f000 - iny 234 f000 - lda (songdatalo),y 235 f000 - sta songchannel1layer1lo,x 236 f000 - iny 237 f000 - lda (songdatalo),y 238 f000 - sta songchannel1layer1hi,x 239 f000 - ldx inttemp6 240 f000 - jmp processsongdata ; EOD handling doesn't have note length, so process the next data byte... 241 f000 - 242 f000 -handlechannelEODnoloop 243 f000 - ; this pattern/loop is done playing. "pop" the stack 244 f000 - ldx inttemp6 245 f000 - lda songchannel1stackdepth,x 246 f000 - beq handlerootchannelEOD 247 f000 - sec 248 f000 - sbc #4 249 f000 - sta songchannel1stackdepth,x 250 f000 - jmp processsongdata ; EOD handling doesn't have note length, so process the next data byte... 251 f000 - 252 f000 -handlerootchannelEOD 253 f000 - ; this channel is done. point it to $ff data so we no longer process this channel. 254 f000 - lda #0 255 f000 - sta songchannel1layer1lo,x 256 f000 - sta songchannel1layer1hi,x 257 f000 - sta songchannel1busywait,x 258 f000 - jmp setchannelcountbits 259 f000 - rts 260 f000 - 261 f000 -nothandlepatternchange 262 f000 -handleoctavesemichange 263 f000 - iny 264 f000 - lda (songdatalo),y 265 f000 - sta songchannel1transpose,x 266 f000 - lda #2 267 f000 - jsr advancethesongpointerNbytes ; advance 2 bytes 268 f000 - jmp processsongdata 269 f000 - 270 f000 -advancethesongpointer1byte 271 f000 - txa 272 f000 - ldx songstackindex 273 f000 - inc songchannel1layer1lo,x 274 f000 - bne skiphiadvancethesongpointer1byte 275 f000 - inc songchannel1layer1hi,x 276 f000 -skiphiadvancethesongpointer1byte 277 f000 - tax 278 f000 - rts 279 f000 - 280 f000 -advancethesongpointerNbytes 281 f000 - ; entered with A=# of byte to advance 282 f000 - stx inttemp6 283 f000 - ldx songstackindex 284 f000 - clc 285 f000 - adc songchannel1layer1lo,x 286 f000 - sta songchannel1layer1lo,x 287 f000 - lda #0 288 f000 - adc songchannel1layer1hi,x 289 f000 - sta songchannel1layer1hi,x 290 f000 - ldx inttemp6 291 f000 - rts 292 f000 - 293 f000 -clearsongmemory 294 f000 - lda #0 295 f000 - ldx #(songchannel4instrumenthi-songchannel1layer1lo) 296 f000 -clearsongmemoryloop1 297 f000 - sta songchannel1layer1lo,x 298 f000 - dex 299 f000 - bpl clearsongmemoryloop1 300 f000 - 301 f000 - ldx #(songchannel4stackdepth-songchannel1layer1loops) 302 f000 -clearsongmemoryloop2 303 f000 - sta songchannel1layer1loops,x 304 f000 - dex 305 f000 - bpl clearsongmemoryloop2 306 f000 - 307 f000 - lda #$ff 308 f000 - ldx #3 309 f000 -clearsongmemoryloop3 310 f000 - sta songchannel1busywait,x 311 f000 - dex 312 f000 - bpl clearsongmemoryloop3 313 f000 - rts 314 f000 - 315 f000 -setsongchannels 316 f000 - jsr clearsongmemory 317 f000 - ldy #7 318 f000 - ldx #3 319 f000 -setsongchannelsloop 320 f000 - lda (songpointerlo),y 321 f000 - sta songchannel1layer1hi,x 322 f000 - dey 323 f000 - lda (songpointerlo),y 324 f000 - sta songchannel1layer1lo,x 325 f000 - dex 326 f000 - dey 327 f000 - bpl setsongchannelsloop 328 f000 - rts 329 f000 - 330 f000 -channel2bits 331 f000 - .byte 1,2,4,8 332 f000 - 333 f000 -tiatrackeroctavenotes 334 f000 - ifconst BUZZBASS 335 f000 -LOWC = 15 336 f000 - else 337 f000 -LOWC = 14 338 f000 - endif 339 f000 - ; ****** ELECTRONIC (0 to 11) 340 f000 - .byte LOWC,20 ; c0 16.1Hz 341 f000 - .byte LOWC,18 ; c#0 342 f000 - .byte LOWC,17 ; d0 343 f000 - .byte LOWC,16 ; d#0 344 f000 - .byte LOWC,15 ; e0 345 f000 - .byte LOWC,14 ; f0 (very off) 346 f000 - .byte LOWC,14 ; f#0 347 f000 - .byte LOWC,13 ; g0 348 f000 - .byte LOWC,12 ; g#0 349 f000 - .byte LOWC,11 ; a0 350 f000 - .byte LOWC,11 ; a#0 (very off) 351 f000 - .byte LOWC,10 ; b0 30.7Hz 352 f000 - 353 f000 - ; ****** SLIGHTLY BUZZY (12 to 23) 354 f000 - .byte 6,30 ; c1 32.7Hz 355 f000 - .byte 6,28 ; c#1 356 f000 - .byte 6,27 ; d1 357 f000 - .byte 6,25 ; d#1 358 f000 - .byte 6,24 ; e1 359 f000 - .byte 6,22 ; f1 360 f000 - .byte 6,21 ; f#1 361 f000 - .byte 6,20 ; g1 362 f000 - .byte 6,18 ; g#1 363 f000 - .byte 6,17 ; a1 364 f000 - .byte 6,16 ; a#1 365 f000 - .byte 6,15 ; b1 63.4Hz 366 f000 - 367 f000 - ; ****** BUZZY (24 to 39) 368 f000 - .byte 1,31 ; c2 65.5 369 f000 - .byte 1,30 ; c#2 67.6 370 f000 - .byte 1,27 ; d2 72.3 371 f000 - .byte 1,26 ; d#2 77.6 372 f000 - .byte 1,24 ; e2 373 f000 - .byte 1,23 ; f2 374 f000 - .byte 1,22 ; f#2 375 f000 - .byte 1,20 ; g2 376 f000 - .byte 1,19 ; g#2 377 f000 - .byte 1,18 ; a2 378 f000 - .byte 1,17 ; a#2 379 f000 - .byte 1,16 ; b2 380 f000 - .byte 1,15 ; c3 126.8Hz 381 f000 - .byte 1,14 ; c#3 382 f000 - .byte 1,13 ; d3 149.7Hz 383 f000 - .byte 1,12 ; d#3 161.2Hz (very off) 384 f000 - ; ****** PURE (40 to 71) - best key is A3 Major 385 f000 - .byte 12,31 ; e3 163.8Hz 386 f000 - .byte 12,29 ; f3 387 f000 - .byte 12,28 ; f#3 388 f000 - .byte 12,26 ; g3 389 f000 - .byte 12,24 ; g#3 390 f000 - .byte 12,23 ; a3 songs in key of A benefit from Perceptual Tuning 391 f000 - .byte 12,22 ; a#3 392 f000 - .byte 12,20 ; b3 393 f000 - .byte 12,19 ; c4 (middle C) 394 f000 - .byte 12,18 ; c#4 395 f000 - .byte 12,17 ; d4 396 f000 - .byte 12,16 ; d#4 397 f000 - .byte 12,15 ; e4 398 f000 - .byte 12,14 ; f4 399 f000 - .byte 12,13 ; f#4 400 f000 - .byte 12,12 ; g4 (very off) 401 f000 - .byte 12,12 ; g#4 402 f000 - .byte 12,11 ; a4 403 f000 - .byte 12,10 ; a#4 404 f000 - .byte 4,31 ; b4 405 f000 - .byte 4,29 ; c5 406 f000 - .byte 4,28 ; c#5 407 f000 - .byte 4,26 ; d5 408 f000 - .byte 4,24 ; d#5 409 f000 - .byte 4,23 ; e5 410 f000 - .byte 4,22 ; f5 411 f000 - .byte 4,20 ; f#5 412 f000 - .byte 4,19 ; g5 413 f000 - .byte 4,18 ; g#5 414 f000 - .byte 4,17 ; a5 415 f000 - .byte 4,16 ; a#5 416 f000 - .byte 4,15 ; b5 417 f000 - 418 f000 - ; ****** TUNED WIND (72 to 83) 419 f000 - .byte 8,30 ; c 420 f000 - .byte 8,28 ; c# 421 f000 - .byte 8,27 ; d 422 f000 - .byte 8,25 ; d# 423 f000 - .byte 8,24 ; e 424 f000 - .byte 8,22 ; f 425 f000 - .byte 8,21 ; f# 426 f000 - .byte 8,20 ; g 427 f000 - .byte 8,18 ; g# 428 f000 - .byte 8,17 ; a 429 f000 - .byte 8,16 ; a# 430 f000 - .byte 8,15 ; b 431 f000 - 432 f000 - include "tiadrumkit.asm" 433 f000 - 434 f000 endif ;MUSICTRACKER ------- FILE c:\Users\Shane\Documents\my7800projects\Heofonfir\shooting_test.78b.asm 1826 f000 endif 1827 f000 ifnconst included.hiscore.asm ------- FILE hiscore.asm LEVEL 2 PASS 3 0 f000 include hiscore.asm 1 f000 ; Provided under the CC0 license. See the included LICENSE.txt for details. 2 f000 3 f000 - ifconst HSSUPPORT 4 f000 -detectatarivoxeeprom 5 f000 -hiscoremodulestart 6 f000 - ; do a test to see if atarivox eeprom can be accessed, and save results 7 f000 - jsr AVoxDetect 8 f000 - eor #$ff ; invert for easy 7800basic if...then logic 9 f000 - sta avoxdetected 10 f000 - lda #$0 11 f000 - sta SWACNT 12 f000 - lda avoxdetected 13 f000 - rts 14 f000 - 15 f000 -detecthsc 16 f000 - ; check for the HSC ROM signature... 17 f000 - lda XCTRL1s 18 f000 - ora #%00001100 19 f000 - sta XCTRL1s 20 f000 - sta XCTRL1 21 f000 - lda $3900 22 f000 - cmp #$C6 23 f000 - bne detecthscfail 24 f000 - lda $3904 25 f000 - cmp #$FE 26 f000 - bne detecthscfail 27 f000 - ; check if it's initialized... 28 f000 - ldy #0 29 f000 - lda #$ff 30 f000 -checkhscinit 31 f000 - and $1000,y 32 f000 - dey 33 f000 - bpl checkhscinit 34 f000 - cmp #$ff 35 f000 - bne hscisalreadyinit 36 f000 - ; if we're here, we need to do a minimal HSC init... 37 f000 - ldy #$28 38 f000 -hscinitloop1 39 f000 - lda hscheader,y 40 f000 - sta $1000,y 41 f000 - dey 42 f000 - bpl hscinitloop1 43 f000 - ldy #$89 44 f000 - lda #$7F 45 f000 -hscinitloop2 46 f000 - sta $10B3,y 47 f000 - dey 48 f000 - cpy #$ff 49 f000 - bne hscinitloop2 50 f000 -hscisalreadyinit 51 f000 - lda #$ff 52 f000 - rts 53 f000 -hscheader 54 f000 - .byte $00,$00,$68,$83,$AA,$55,$9C,$FF,$07,$12,$02,$1F,$00,$00,$00,$00 55 f000 - .byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 56 f000 - .byte $00,$00,$00,$00,$00,$00,$00,$00,$03 57 f000 -detecthscfail 58 f000 - lda XCTRL1s 59 f000 - and #%11110111 60 f000 - sta XCTRL1s 61 f000 - lda #0 62 f000 - rts 63 f000 endif ; HSSUPPORT 64 f000 65 f000 - ifconst HSSUPPORT 66 f000 - ifnconst hiscorefont 67 f000 - echo "" 68 f000 - echo "WARNING: High score support is enabled, but the hiscorefont.png was" 69 f000 - echo " NOT imported with incgraphic. The high score display code" 70 f000 - echo " has been omitted from this build." 71 f000 - echo "" 72 f000 - else 73 f000 -hscdrawscreen 74 f000 - 75 f000 - ; we use 20 lines on a 24 line display 76 f000 - ; HSSCOREY to dynamically centers based on 77 f000 - ;HSSCOREY = 0 78 f000 -HSSCOREY = ((WZONECOUNT*WZONEHEIGHT/8)-22)/2 79 f000 -HSCURSORY = ((HSSCOREY/(WZONEHEIGHT/8))*WZONEHEIGHT) 80 f000 - 81 f000 - ifconst HSSCORESIZE 82 f000 -SCORESIZE = HSSCORESIZE 83 f000 - else 84 f000 -SCORESIZE = 6 85 f000 - endif 86 f000 - 87 f000 - ;save shadow registers for later return... 88 f000 - lda sCTRL 89 f000 - sta ssCTRL 90 f000 - lda sCHARBASE 91 f000 - sta ssCHARBASE 92 f000 - lda #$60 93 f000 - sta charactermode 94 f000 - jsr drawwait 95 f000 - jsr blacken320colors 96 f000 - jsr clearscreen 97 f000 - 98 f000 - ;set the character base to the HSC font 99 f000 - lda #>hiscorefont 100 f000 - sta CHARBASE 101 f000 - sta sCHARBASE 102 f000 - lda #%01000011 ;Enable DMA, mode=320A 103 f000 - sta CTRL 104 f000 - sta sCTRL 105 f000 - 106 f000 - lda #60 107 f000 - sta hsjoydebounce 108 f000 - 109 f000 - lda #0 110 f000 - sta hscursorx 111 f000 - sta framecounter 112 f000 - ifnconst HSCOLORCHASESTART 113 f000 - lda #$8D ; default is blue. why not? 114 f000 - else 115 f000 - lda #HSCOLORCHASESTART 116 f000 - endif 117 f000 - sta hscolorchaseindex 118 f000 - 119 f000 - lda #$0F 120 f000 - sta P0C2 ; base text is white 121 f000 - 122 f000 - jsr hschasecolors 123 f000 - ; ** plot all of the initials 124 f000 - lda #HSRAMInitials 127 f000 - sta temp2 ; charmaphi 128 f000 - lda #32+29 ; palette=0-29 | 32-(width=3) 129 f000 - sta temp3 ; palette/width 130 f000 - lda #104 131 f000 - sta temp4 ; X 132 f000 - lda #((HSSCOREY+6)/(WZONEHEIGHT/8)) 133 f000 - sta temp5 ; Y 134 f000 -plothsinitialsloop 135 f000 - jsr plotcharacters 136 f000 - clc 137 f000 - lda temp3 138 f000 - adc #32 139 f000 - sta temp3 140 f000 - inc temp5 141 f000 - if WZONEHEIGHT = 8 142 f000 - inc temp5 143 f000 - endif 144 f000 - clc 145 f000 - lda #3 146 f000 - adc temp1 147 f000 - sta temp1 148 f000 - cmp #(<(HSRAMInitials+15)) 149 f000 - bcc plothsinitialsloop 150 f000 - 151 f000 - ifconst HSGAMENAMELEN 152 f000 - ;plot the game name... 153 f000 - lda #HSGAMENAMEtable 156 f000 - sta temp2 ; charmaphi 157 f000 - lda #(32-HSGAMENAMELEN) ; palette=0*29 | 32-(width=3) 158 f000 - sta temp3 ; palette/width 159 f000 - lda #(80-(HSGAMENAMELEN*2)) 160 f000 - sta temp4 ; X 161 f000 - lda #((HSSCOREY+0)/(WZONEHEIGHT/8)) 162 f000 - sta temp5 ; Y 163 f000 - jsr plotcharacters 164 f000 - endif ; HSGAMENAMELEN 165 f000 - 166 f000 - ;plot "difficulty"... 167 f000 - ldy gamedifficulty 168 f000 - ifnconst HSNOLEVELNAMES 169 f000 - lda highscoredifficultytextlo,y 170 f000 - sta temp1 171 f000 - lda highscoredifficultytexthi,y 172 f000 - sta temp2 173 f000 - sec 174 f000 - lda #32 175 f000 - sbc highscoredifficultytextlen,y 176 f000 - sta temp3 ; palette/width 177 f000 - sec 178 f000 - lda #40 179 f000 - sbc highscoredifficultytextlen,y 180 f000 - asl 181 f000 - sta temp4 ; X 182 f000 - else 183 f000 - lda #HSHIGHSCOREStext 186 f000 - sta temp2 ; charmaphi 187 f000 - lda #(32-11) ; palette=0*29 | 32-(width=3) 188 f000 - sta temp3 ; palette/width 189 f000 - lda #(80-(11*2)) 190 f000 - sta temp4 ; X 191 f000 - endif ; HSNOLEVELNAMES 192 f000 - 193 f000 - lda #((HSSCOREY+2)/(WZONEHEIGHT/8)) 194 f000 - sta temp5 ; Y 195 f000 - jsr plotcharacters 196 f000 - ldy hsdisplaymode ; 0=attact mode, 1=player eval, 2=player 1 eval, 3=player 2 player eval 197 f000 - bne carronwithscoreevaluation 198 f000 - jmp donoscoreevaluation 199 f000 -carronwithscoreevaluation 200 f000 - dey 201 f000 - lda highscorelabeltextlo,y 202 f000 - sta temp1 203 f000 - lda highscorelabeltexthi,y 204 f000 - sta temp2 205 f000 - sec 206 f000 - lda #(32-15) ; palette=0*29 | 32-(width=3) 207 f000 - sta temp3 ; palette/width 208 f000 - lda highscorelabeladjust1,y 209 f000 - sta temp4 ; X 210 f000 - lda #((HSSCOREY+18)/(WZONEHEIGHT/8)) 211 f000 - sta temp5 ; Y 212 f000 - jsr plotcharacters 213 f000 - 214 f000 - ldy hsdisplaymode ; 0=attact mode, 1=player eval, 2=player 1 eval, 3=player 2 player eval 215 f000 - dey 216 f000 - ;plot the current player score... 217 f000 - lda #(32-SCORESIZE) ; palette=0*32 218 f000 - sta temp3 ; palette/width 219 f000 - lda highscorelabeladjust2,y 220 f000 - sta temp4 ; X 221 f000 - lda #((HSSCOREY+18)/(WZONEHEIGHT/8)) 222 f000 - sta temp5 ; Y 223 f000 - 224 f000 - lda scorevarlo,y 225 f000 - sta temp7 ; score variable lo 226 f000 - lda scorevarhi,y 227 f000 - sta temp8 ; score variable hi 228 f000 - 229 f000 - lda #(hiscorefont_mode | %01100000) ; charactermode 230 f000 - sta temp9 231 f000 - 232 f000 - lda #<(hiscorefont+33) ; +33 to get to '0' character 233 f000 - sta temp1 ; charmaplo 234 f000 - lda #>(hiscorefont+33) 235 f000 - sta temp2 ; charmaphi 236 f000 - lda #SCORESIZE 237 f000 - sta temp6 238 f000 - ifnconst DOUBLEWIDE 239 f000 - jsr plotvalue 240 f000 - else 241 f000 - jsr plotvaluedw 242 f000 - endif 243 f000 - 244 f000 -USED_PLOTVALUE = 1 ; ensure that plotvalue gets compiled in 245 f000 - 246 f000 - ifconst HSGAMERANKS 247 f000 - 248 f000 - ldx #$ff ; start at 0 after the inx... 249 f000 -comparescore2rankloop 250 f000 - inx 251 f000 - ldy #0 252 f000 - lda rankvalue_0,x 253 f000 - cmp (temp7),y 254 f000 - bcc score2rankloopdone 255 f000 - bne comparescore2rankloop 256 f000 - iny 257 f000 - lda rankvalue_1,x 258 f000 - cmp (temp7),y 259 f000 - bcc score2rankloopdone 260 f000 - bne comparescore2rankloop 261 f000 - iny 262 f000 - lda (temp7),y 263 f000 - cmp rankvalue_2,x 264 f000 - bcs score2rankloopdone 265 f000 - jmp comparescore2rankloop 266 f000 -score2rankloopdone 267 f000 - stx hsnewscorerank 268 f000 - 269 f000 - lda ranklabello,x 270 f000 - sta temp1 271 f000 - lda ranklabelhi,x 272 f000 - sta temp2 273 f000 - sec 274 f000 - lda #32 ; palette=0*29 | 32-(width=3) 275 f000 - sbc ranklabellengths,x 276 f000 - sta temp3 ; palette/width 277 f000 - sec 278 f000 - lda #(40+6) 279 f000 - sbc ranklabellengths,x 280 f000 - asl 281 f000 - sta temp4 ; X 282 f000 - lda #((HSSCOREY+20)/(WZONEHEIGHT/8)) 283 f000 - sta temp5 ; Y 284 f000 - jsr plotcharacters 285 f000 - 286 f000 - ldx hsnewscorerank 287 f000 - 288 f000 - lda #highscoreranklabel 291 f000 - sta temp2 292 f000 - 293 f000 - lda #(32-5) ; palette=0*29 | 32-(width=3) 294 f000 - sta temp3 ; palette/width 295 f000 - lda #(40-6) 296 f000 - sec 297 f000 - sbc ranklabellengths,x 298 f000 - asl 299 f000 - sta temp4 ; X 300 f000 - lda #((HSSCOREY+20)/(WZONEHEIGHT/8)) 301 f000 - sta temp5 ; Y 302 f000 - jsr plotcharacters 303 f000 - endif 304 f000 - 305 f000 - 306 f000 - ; ** which line did this player beat? 307 f000 - lda #$ff 308 f000 - sta hsnewscoreline 309 f000 - ldx #$fd 310 f000 -comparescoreadd2x 311 f000 - inx 312 f000 -comparescoreadd1x 313 f000 - inx 314 f000 -comparescore2lineloop 315 f000 - inc hsnewscoreline 316 f000 - inx ; initialrun, x=0 317 f000 - cpx #15 318 f000 - beq nohighscoreforyou 319 f000 - ldy #0 320 f000 - lda HSRAMScores,x 321 f000 - cmp (temp7),y ; first score digit 322 f000 - bcc score2lineloopdonedel1x 323 f000 - bne comparescoreadd2x 324 f000 - iny 325 f000 - inx 326 f000 - lda HSRAMScores,x 327 f000 - cmp (temp7),y 328 f000 - bcc score2lineloopdonedel2x 329 f000 - bne comparescoreadd1x 330 f000 - iny 331 f000 - inx 332 f000 - lda (temp7),y 333 f000 - cmp HSRAMScores,x 334 f000 - bcs score2lineloopdonedel3x 335 f000 - jmp comparescore2lineloop 336 f000 -nohighscoreforyou 337 f000 - lda #$ff 338 f000 - sta hsnewscoreline 339 f000 - sta countdownseconds 340 f000 - jmp donoscoreevaluation 341 f000 -score2lineloopdonedel3x 342 f000 - dex 343 f000 -score2lineloopdonedel2x 344 f000 - dex 345 f000 -score2lineloopdonedel1x 346 f000 - dex 347 f000 - 348 f000 - ; 0 1 2 349 f000 - ; 3 4 5 350 f000 - ; 6 7 8 351 f000 - ; 9 0 1 352 f000 - ; 2 3 4 353 f000 - 354 f000 - stx temp9 355 f000 - cpx #11 356 f000 - beq postsortscoresuploop 357 f000 - ldx #11 358 f000 -sortscoresuploop 359 f000 - lda HSRAMScores,x 360 f000 - sta HSRAMScores+3,x 361 f000 - lda HSRAMInitials,x 362 f000 - sta HSRAMInitials+3,x 363 f000 - dex 364 f000 - cpx temp9 365 f000 - bne sortscoresuploop 366 f000 -postsortscoresuploop 367 f000 - 368 f000 - ;stick the score and cleared initials in the slot... 369 f000 - inx 370 f000 - ldy #0 371 f000 - sty hsinitialhold 372 f000 - lda (temp7),y 373 f000 - sta HSRAMScores,x 374 f000 - iny 375 f000 - lda (temp7),y 376 f000 - sta HSRAMScores+1,x 377 f000 - iny 378 f000 - lda (temp7),y 379 f000 - sta HSRAMScores+2,x 380 f000 - lda #0 381 f000 - sta HSRAMInitials,x 382 f000 - lda #29 383 f000 - sta HSRAMInitials+1,x 384 f000 - sta HSRAMInitials+2,x 385 f000 - 386 f000 - stx hsinitialpos 387 f000 - 388 f000 - ifconst vox_highscore 389 f000 - lda <#vox_highscore 390 f000 - sta speech_addr 391 f000 - lda >#vox_highscore 392 f000 - sta speech_addr+1 393 f000 - endif 394 f000 - ifconst sfx_highscore 395 f000 - lda <#sfx_highscore 396 f000 - sta temp1 397 f000 - lda >#sfx_highscore 398 f000 - sta temp2 399 f000 - lda #0 400 f000 - sta temp3 401 f000 - jsr schedulesfx 402 f000 - endif 403 f000 - ifconst songdatastart_song_highscore 404 f000 - lda #songchanneltable_song_highscore 407 f000 - sta songpointerhi 408 f000 - lda #73 409 f000 - sta songtempo 410 f000 - jsr setsongchannels 411 f000 - endif 412 f000 - 413 f000 - 414 f000 -donoscoreevaluation 415 f000 - 416 f000 - lda #(32+(32-SCORESIZE)) ; palette=0*32 | 32-(width=6) 417 f000 - sta temp3 ; palette/width 418 f000 - lda #(72+(4*(6-SCORESIZE))) 419 f000 - sta temp4 ; X 420 f000 - lda #((HSSCOREY+6)/(WZONEHEIGHT/8)) 421 f000 - sta temp5 ; Y 422 f000 - lda #HSRAMScores 425 f000 - sta temp8 ; score variable hi 426 f000 - lda #(hiscorefont_mode | %01100000) ; charactermode 427 f000 - sta temp9 428 f000 -plothsscoresloop 429 f000 - lda #<(hiscorefont+33) ; +33 to get to '0' character 430 f000 - sta temp1 ; charmaplo 431 f000 - lda #>(hiscorefont+33) 432 f000 - sta temp2 ; charmaphi 433 f000 - lda #6 434 f000 - sta temp6 435 f000 - ifnconst DOUBLEWIDE 436 f000 - jsr plotvalue 437 f000 - else 438 f000 - jsr plotvaluedw 439 f000 - endif 440 f000 - clc 441 f000 - lda temp3 442 f000 - adc #32 443 f000 - sta temp3 444 f000 - inc temp5 445 f000 - if WZONEHEIGHT = 8 446 f000 - inc temp5 447 f000 - endif 448 f000 - clc 449 f000 - lda #3 450 f000 - adc temp7 451 f000 - sta temp7 452 f000 - cmp #(<(HSRAMScores+15)) 453 f000 - bcc plothsscoresloop 454 f000 -plothsindex 455 f000 - lda #32+31 ; palette=0*32 | 32-(width=1) 456 f000 - sta temp3 ; palette/width 457 f000 - lda #44 458 f000 - sta temp4 ; X 459 f000 - lda #((HSSCOREY+6)/(WZONEHEIGHT/8)) 460 f000 - sta temp5 ; Y 461 f000 - lda #hsgameslotnumbers 464 f000 - sta temp8 ; score variable hi 465 f000 - lda #(hiscorefont_mode | %01100000) ; charactermode 466 f000 - sta temp9 467 f000 -plothsindexloop 468 f000 - lda #<(hiscorefont+33) 469 f000 - sta temp1 ; charmaplo 470 f000 - lda #>(hiscorefont+33) 471 f000 - sta temp2 ; charmaphi 472 f000 - lda #1 473 f000 - sta temp6 ; number of characters 474 f000 - ifnconst DOUBLEWIDE 475 f000 - jsr plotvalue 476 f000 - else 477 f000 - jsr plotvaluedw 478 f000 - endif 479 f000 - clc 480 f000 - lda temp3 481 f000 - adc #32 482 f000 - sta temp3 483 f000 - inc temp5 484 f000 - if WZONEHEIGHT = 8 485 f000 - inc temp5 486 f000 - endif 487 f000 - inc temp7 488 f000 - lda temp7 489 f000 - cmp #(<(hsgameslotnumbers+5)) 490 f000 - bcc plothsindexloop 491 f000 - 492 f000 - jsr savescreen 493 f000 - ifnconst HSSECONDS 494 f000 - lda #6 495 f000 - else 496 f000 - lda #HSSECONDS 497 f000 - endif 498 f000 - 499 f000 - sta countdownseconds 500 f000 - 501 f000 -keepdisplayinghs 502 f000 - jsr restorescreen 503 f000 - 504 f000 - jsr setuphsinpt1 505 f000 - 506 f000 - lda hsnewscoreline 507 f000 - bpl carryonkeepdisplayinghs 508 f000 - jmp skipenterscorecontrol 509 f000 -carryonkeepdisplayinghs 510 f000 - 511 f000 - 512 f000 - ifnconst HSSECONDS 513 f000 - lda #6 514 f000 - else 515 f000 - lda #HSSECONDS 516 f000 - endif 517 f000 - 518 f000 - sta countdownseconds 519 f000 - 520 f000 - ;plot the "cursor" initial sprite... 521 f000 - lda hsinitialhold 522 f000 - 523 f000 - sta temp1 524 f000 - lda #>(hiscorefont+32) 525 f000 - sta temp2 526 f000 - lda #31 ; palette=0*32 | 32-(width=1) 527 f000 - sta temp3 ; palette/width 528 f000 - lda hscursorx 529 f000 - asl 530 f000 - asl 531 f000 - clc 532 f000 - adc #104 533 f000 - sta temp4 ; X 534 f000 - lda hsnewscoreline 535 f000 - asl 536 f000 - asl 537 f000 - asl 538 f000 - asl 539 f000 - adc #((3*16)+HSCURSORY) 540 f000 - sta temp5 ; Y 541 f000 - lda #%01000000 542 f000 - sta temp6 543 f000 - jsr plotsprite 544 f000 - 545 f000 - ldx hscursorx 546 f000 - ldy hsdisplaymode 547 f000 - lda SWCHA 548 f000 - cpy #3 549 f000 - bne hsskipadjustjoystick1 550 f000 - asl 551 f000 - asl 552 f000 - asl 553 f000 - asl 554 f000 -hsskipadjustjoystick1 555 f000 - sta hsswcha 556 f000 - lda SWCHB 557 f000 - and #%00000010 558 f000 - bne hsskipselectswitch 559 f000 - lda #%00010000 560 f000 - sta hsswcha 561 f000 - bne hsdodebouncecheck 562 f000 -hsskipselectswitch 563 f000 - lda hsswcha 564 f000 - and #%00110000 565 f000 - cmp #%00110000 566 f000 - beq hsjoystickskipped 567 f000 -hsdodebouncecheck 568 f000 - lda hsjoydebounce 569 f000 - beq hsdontdebounce 570 f000 - jmp hspostjoystick 571 f000 -hsdontdebounce 572 f000 - ldx #1 ; small tick sound 573 f000 - jsr playhssfx 574 f000 - lda hsswcha 575 f000 - and #%00110000 576 f000 - ldx hscursorx 577 f000 - cmp #%00100000 ; check down 578 f000 - bne hsjoycheckup 579 f000 - ldy hsinitialhold 580 f000 - cpx #0 581 f000 - bne skipavoid31_1 582 f000 - cpy #0 ; if we're about to change to the <- char (#31) then double-decrement to skip over it 583 f000 - bne skipavoid31_1 584 f000 - dey 585 f000 -skipavoid31_1 586 f000 - dey 587 f000 - jmp hssetdebounce 588 f000 -hsjoycheckup 589 f000 - cmp #%00010000 ; check up 590 f000 - bne hsjoystickskipped 591 f000 - ldy hsinitialhold 592 f000 - cpx #0 593 f000 - bne skipavoid31_2 594 f000 - cpy #30 ; if we're about to change to the <- char (#31) then double-increment to skip over it 595 f000 - bne skipavoid31_2 596 f000 - iny 597 f000 -skipavoid31_2 598 f000 - iny 599 f000 -hssetdebounce 600 f000 - tya 601 f000 - and #31 602 f000 - sta hsinitialhold 603 f000 - lda #15 604 f000 - sta hsjoydebounce 605 f000 - bne hspostjoystick 606 f000 -hsjoystickskipped 607 f000 - ; check the fire button only when the stick isn't engaged 608 f000 - lda hsinpt1 609 f000 - bpl hsbuttonskipped 610 f000 - lda hsjoydebounce 611 f000 - beq hsfiredontdebounce 612 f000 - bne hspostjoystick 613 f000 -hsfiredontdebounce 614 f000 - lda hsinitialhold 615 f000 - cmp #31 616 f000 - beq hsmovecursorback 617 f000 - inc hscursorx 618 f000 - inc hsinitialpos 619 f000 - lda hscursorx 620 f000 - cmp #3 621 f000 - bne skiphsentryisdone 622 f000 - lda #0 623 f000 - sta framecounter 624 f000 - lda #$ff 625 f000 - sta hsnewscoreline 626 f000 - dec hsinitialpos 627 f000 - bne skiphsentryisdone 628 f000 -hsmovecursorback 629 f000 - lda hscursorx 630 f000 - beq skiphsmovecursorback 631 f000 - lda #29 632 f000 - ldx hsinitialpos 633 f000 - sta HSRAMInitials,x 634 f000 - dec hsinitialpos 635 f000 - dec hscursorx 636 f000 - dex 637 f000 - lda HSRAMInitials,x 638 f000 - sta hsinitialhold 639 f000 -skiphsmovecursorback 640 f000 -skiphsentryisdone 641 f000 - ldx #0 642 f000 - jsr playhssfx 643 f000 - lda #20 644 f000 - sta hsjoydebounce 645 f000 - bne hspostjoystick 646 f000 - 647 f000 -hsbuttonskipped 648 f000 - lda #0 649 f000 - sta hsjoydebounce 650 f000 -hspostjoystick 651 f000 - 652 f000 - ldx hsinitialpos 653 f000 - lda hsinitialhold 654 f000 - sta HSRAMInitials,x 655 f000 - 656 f000 - jmp skiphschasecolors 657 f000 - 658 f000 -skipenterscorecontrol 659 f000 - jsr hschasecolors 660 f000 - jsr setuphsinpt1 661 f000 - lda hsjoydebounce 662 f000 - bne skiphschasecolors 663 f000 - lda hsinpt1 664 f000 - bmi returnfromhs 665 f000 -skiphschasecolors 666 f000 - 667 f000 - jsr drawscreen 668 f000 - 669 f000 - lda countdownseconds 670 f000 - beq returnfromhs 671 f000 - jmp keepdisplayinghs 672 f000 -returnfromhs 673 f000 - 674 f000 - ifconst songdatastart_song_highscore 675 f000 - lda hsdisplaymode 676 f000 - beq skipclearHSCsong 677 f000 - lda #0 678 f000 - sta songtempo 679 f000 -skipclearHSCsong 680 f000 - endif 681 f000 - jsr drawwait 682 f000 - jsr clearscreen 683 f000 - lda #0 684 f000 - ldy #7 685 f000 - jsr blacken320colors 686 f000 - lda ssCTRL 687 f000 - sta sCTRL 688 f000 - lda ssCHARBASE 689 f000 - sta sCHARBASE 690 f000 - rts 691 f000 - 692 f000 -setuphsinpt1 693 f000 - lda #$ff 694 f000 - sta hsinpt1 695 f000 - lda hsjoydebounce 696 f000 - beq skipdebounceadjust 697 f000 - dec hsjoydebounce 698 f000 - bne skipstorefirebuttonstatus 699 f000 -skipdebounceadjust 700 f000 - lda SWCHB 701 f000 - and #%00000001 702 f000 - bne hscheckresetover 703 f000 - lda #$ff 704 f000 - sta hsinpt1 705 f000 - rts 706 f000 -hscheckresetover 707 f000 - ldx hsdisplaymode 708 f000 - cpx #3 709 f000 - bne hsskipadjustjoyfire1 710 f000 - lda sINPT3 711 f000 - jmp hsskipadjustjoyfire1done 712 f000 -hsskipadjustjoyfire1 713 f000 - lda sINPT1 714 f000 -hsskipadjustjoyfire1done 715 f000 - sta hsinpt1 716 f000 -skipstorefirebuttonstatus 717 f000 - rts 718 f000 - 719 f000 -blacken320colors 720 f000 - ldy #7 721 f000 -blacken320colorsloop 722 f000 - sta P0C2,y 723 f000 - dey 724 f000 - bpl blacken320colorsloop 725 f000 - rts 726 f000 - 727 f000 -hschasecolors 728 f000 - lda framecounter 729 f000 - and #3 730 f000 - bne hschasecolorsreturn 731 f000 - inc hscolorchaseindex 732 f000 - lda hscolorchaseindex 733 f000 - 734 f000 - sta P5C2 735 f000 - sbc #$02 736 f000 - sta P4C2 737 f000 - sbc #$02 738 f000 - sta P3C2 739 f000 - sbc #$02 740 f000 - sta P2C2 741 f000 - sbc #$02 742 f000 - sta P1C2 743 f000 -hschasecolorsreturn 744 f000 - rts 745 f000 - 746 f000 -playhssfx 747 f000 - lda hssfx_lo,x 748 f000 - sta temp1 749 f000 - lda hssfx_hi,x 750 f000 - sta temp2 751 f000 - lda #0 752 f000 - sta temp3 753 f000 - jmp schedulesfx 754 f000 - 755 f000 -hssfx_lo 756 f000 - .byte sfx_hsletterpositionchange, >sfx_hslettertick 759 f000 - 760 f000 -sfx_hsletterpositionchange 761 f000 - .byte $10,$18,$00 762 f000 - .byte $02,$06,$08 763 f000 - .byte $02,$06,$04 764 f000 - .byte $00,$00,$00 765 f000 -sfx_hslettertick 766 f000 - .byte $10,$18,$00 767 f000 - .byte $00,$00,$0a 768 f000 - .byte $00,$00,$00 769 f000 - 770 f000 -highscorelabeladjust1 771 f000 - .byte (80-(14*2)-(SCORESIZE*2)),(80-(16*2)-(SCORESIZE*2)),(80-(16*2)-(SCORESIZE*2)) 772 f000 -highscorelabeladjust2 773 f000 - .byte (80+(14*2)-(SCORESIZE*2)),(80+(16*2)-(SCORESIZE*2)),(80+(16*2)-(SCORESIZE*2)) 774 f000 - 775 f000 -scorevarlo 776 f000 - .byte <(score0+((6-SCORESIZE)/2)),<(score0+((6-SCORESIZE)/2)),<(score1+((6-SCORESIZE)/2)) 777 f000 -scorevarhi 778 f000 - .byte >(score0+((6-SCORESIZE)/2)),>(score0+((6-SCORESIZE)/2)),>(score1+((6-SCORESIZE)/2)) 779 f000 - 780 f000 - ifnconst HSNOLEVELNAMES 781 f000 -highscoredifficultytextlo 782 f000 - .byte easylevelname, >mediumlevelname, >hardlevelname, >expertlevelname 785 f000 - ifnconst HSCUSTOMLEVELNAMES 786 f000 -highscoredifficultytextlen 787 f000 - .byte 22, 30, 26, 24 788 f000 - 789 f000 -easylevelname 790 f000 - .byte $04,$00,$12,$18,$1d,$0b,$04,$15,$04,$0b,$1d,$07,$08,$06,$07,$1d,$12,$02,$0e,$11,$04,$12 791 f000 -mediumlevelname 792 f000 - .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 f000 -hardlevelname 794 f000 - .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 f000 -expertlevelname 796 f000 - .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 f000 - else 798 f000 - include "7800hsgamediffnames.asm" 799 f000 - endif ; HSCUSTOMLEVELNAMES 800 f000 - else 801 f000 -HSHIGHSCOREStext 802 f000 - .byte $07,$08,$06,$07,$1d,$12,$02,$0e,$11,$04,$12 803 f000 - endif ; HSNOLEVELNAMES 804 f000 - 805 f000 -highscorelabeltextlo 806 f000 - .byte player0label, >player1label, >player2label 809 f000 - 810 f000 -player0label 811 f000 - .byte $0f,$0b,$00,$18,$04,$11,$1d,$12,$02,$0e,$11,$04,$1a,$1d,$1d 812 f000 - 813 f000 -player1label 814 f000 - .byte $0f,$0b,$00,$18,$04,$11,$1d,$22,$1d,$12,$02,$0e,$11,$04,$1a 815 f000 - 816 f000 -player2label 817 f000 - .byte $0f,$0b,$00,$18,$04,$11,$1d,$23,$1d,$12,$02,$0e,$11,$04,$1a 818 f000 - 819 f000 - 820 f000 - ifconst HSGAMENAMELEN 821 f000 -HSGAMENAMEtable 822 f000 - include "7800hsgamename.asm" 823 f000 - endif 824 f000 - ifconst HSGAMERANKS 825 f000 - include "7800hsgameranks.asm" 826 f000 -highscoreranklabel 827 f000 - .byte $11,$00,$0d,$0a,$1a 828 f000 - endif 829 f000 - 830 f000 - ;ensure our table doesn't wrap a page... 831 f000 - if ((<*)>251) 832 f000 - align 256 833 f000 - endif 834 f000 -hsgameslotnumbers 835 f000 - .byte 33,34,35,36,37 836 f000 - endif 837 f000 - 838 f000 -loaddifficultytable 839 f000 - lda gamedifficulty 840 f000 - and #$03 ; ensure the user hasn't selected an invalid difficulty 841 f000 - sta gamedifficulty 842 f000 - cmp hsdifficulty ; check game difficulty is the same as RAM table 843 f000 - bne loaddifficultytablecontinue1 844 f000 - rts ; this high score difficulty table is already loaded 845 f000 -loaddifficultytablecontinue1 846 f000 - lda gamedifficulty 847 f000 - sta hsdifficulty 848 f000 - ;we need to check the device for the table 849 f000 - lda hsdevice 850 f000 - bne loaddifficultytablecontinue2 851 f000 - ; there's no save device. clear out this table. 852 f000 - jmp cleardifficultytablemem 853 f000 -loaddifficultytablecontinue2 854 f000 - lda hsdevice 855 f000 - and #1 856 f000 - beq memdeviceisntHSC 857 f000 - jmp loaddifficultytableHSC 858 f000 -memdeviceisntHSC 859 f000 - jmp loaddifficultytableAVOX 860 f000 - 861 f000 -savedifficultytable 862 f000 - ;*** we need to check wich device we should use... 863 f000 - lda hsdevice 864 f000 - bne savedifficultytablerealdevice 865 f000 - rts ; its a ram device 866 f000 -savedifficultytablerealdevice 867 f000 - and #1 868 f000 - beq savememdeviceisntHSC 869 f000 - jmp savedifficultytableHSC 870 f000 -savememdeviceisntHSC 871 f000 - jmp savedifficultytableAVOX 872 f000 - 873 f000 -savedifficultytableAVOX 874 f000 - ; the load call already setup the memory structure and atarivox memory location 875 f000 - jsr savealoadedHSCtablecontinue 876 f000 -savedifficultytableAVOXskipconvert 877 f000 - lda #HSIDHI 878 f000 - sta eeprombuffer 879 f000 - lda #HSIDLO 880 f000 - sta eeprombuffer+1 881 f000 - lda hsdifficulty 882 f000 - sta eeprombuffer+2 883 f000 - lda #32 884 f000 - jsr AVoxWriteBytes 885 f000 - rts 886 f000 - 887 f000 -savedifficultytableHSC 888 f000 - ;we always load a table before reaching here, so the 889 f000 - ;memory structures from the load should be intact... 890 f000 - ldy hsgameslot 891 f000 - bpl savealoadedHSCtable 892 f000 - rts 893 f000 -savealoadedHSCtable 894 f000 - lda HSCGameDifficulty,y 895 f000 - cmp #$7F 896 f000 - bne savealoadedHSCtablecontinue 897 f000 - jsr initializeHSCtableentry 898 f000 -savealoadedHSCtablecontinue 899 f000 - ;convert our RAM table to HSC format and write it out... 900 f000 - ldy #0 901 f000 - ldx #0 902 f000 -savedifficultytableScores 903 f000 - 904 f000 - lda HSRAMInitials,x 905 f000 - sta temp3 906 f000 - lda HSRAMInitials+1,x 907 f000 - sta temp4 908 f000 - lda HSRAMInitials+2,x 909 f000 - sta temp5 910 f000 - jsr encodeHSCInitials ; takes 3 byte initials from temp3,4,5 and stores 2 byte initials in temp1,2 911 f000 - 912 f000 - lda temp1 913 f000 - sta (HSGameTableLo),y 914 f000 - iny 915 f000 - lda temp2 916 f000 - sta (HSGameTableLo),y 917 f000 - iny 918 f000 - 919 f000 - lda HSRAMScores,x 920 f000 - sta (HSGameTableLo),y 921 f000 - iny 922 f000 - lda HSRAMScores+1,x 923 f000 - sta (HSGameTableLo),y 924 f000 - iny 925 f000 - lda HSRAMScores+2,x 926 f000 - sta (HSGameTableLo),y 927 f000 - iny 928 f000 - inx 929 f000 - inx 930 f000 - inx ; +3 931 f000 - cpx #15 932 f000 - bne savedifficultytableScores 933 f000 - rts 934 f000 - 935 f000 -loaddifficultytableHSC 936 f000 - ; routine responsible for loading the difficulty table from HSC 937 f000 - jsr findindexHSC 938 f000 - ldy hsgameslot 939 f000 - lda HSCGameDifficulty,y 940 f000 - cmp #$7F 941 f000 - bne loaddifficultytableHSCcontinue 942 f000 - ;there was an error. use a new RAM table instead... 943 f000 - jmp cleardifficultytablemem 944 f000 -loaddifficultytableHSCcontinue 945 f000 - ; parse the data into the HS memory... 946 f000 - ldy #0 947 f000 - ldx #0 948 f000 -loaddifficultytableScores 949 f000 - lda (HSGameTableLo),y 950 f000 - sta temp1 951 f000 - iny 952 f000 - lda (HSGameTableLo),y 953 f000 - sta temp2 954 f000 - jsr decodeHSCInitials ; takes 2 byte initials from temp1,2 and stores 3 byte initials in temp3,4,5 955 f000 - iny 956 f000 - lda (HSGameTableLo),y 957 f000 - sta HSRAMScores,x 958 f000 - lda temp3 959 f000 - sta HSRAMInitials,x 960 f000 - inx 961 f000 - iny 962 f000 - lda (HSGameTableLo),y 963 f000 - sta HSRAMScores,x 964 f000 - lda temp4 965 f000 - sta HSRAMInitials,x 966 f000 - inx 967 f000 - iny 968 f000 - lda (HSGameTableLo),y 969 f000 - sta HSRAMScores,x 970 f000 - lda temp5 971 f000 - sta HSRAMInitials,x 972 f000 - inx 973 f000 - iny 974 f000 - cpx #15 975 f000 - bne loaddifficultytableScores 976 f000 - rts 977 f000 - 978 f000 -decodeHSCInitials 979 f000 - ; takes 2 byte initials from temp1,2 and stores 3 byte initials in temp3,4,5 980 f000 - ; 2 bytes are packed in the form: 22211111 22_33333 981 f000 - lda #0 982 f000 - sta temp4 983 f000 - lda temp1 984 f000 - and #%00011111 985 f000 - sta temp3 986 f000 - 987 f000 - lda temp2 988 f000 - and #%00011111 989 f000 - sta temp5 990 f000 - 991 f000 - lda temp1 992 f000 - asl 993 f000 - rol temp4 994 f000 - asl 995 f000 - rol temp4 996 f000 - asl 997 f000 - rol temp4 998 f000 - lda temp2 999 f000 - asl 1000 f000 - rol temp4 1001 f000 - asl 1002 f000 - rol temp4 1003 f000 - rts 1004 f000 -encodeHSCInitials 1005 f000 - ; takes 3 byte initials from temp3,4,5 and stores 2 byte initials in temp1,2 1006 f000 - ; 2 bytes are packed in the form: 22211111 22_33333 1007 f000 - ; start with packing temp1... 1008 f000 - lda temp4 1009 f000 - and #%00011100 1010 f000 - sta temp1 1011 f000 - asl temp1 1012 f000 - asl temp1 1013 f000 - asl temp1 1014 f000 - lda temp3 1015 f000 - and #%00011111 1016 f000 - ora temp1 1017 f000 - sta temp1 1018 f000 - ; ...temp1 is now packed, on to temp2... 1019 f000 - lda temp5 1020 f000 - asl 1021 f000 - asl 1022 f000 - ror temp4 1023 f000 - ror 1024 f000 - ror temp4 1025 f000 - ror 1026 f000 - sta temp2 1027 f000 - rts 1028 f000 - 1029 f000 -findindexHSCerror 1030 f000 - ;the HSC is stuffed. return the bad slot flag 1031 f000 - ldy #$ff 1032 f000 - sty hsgameslot 1033 f000 - rts 1034 f000 - 1035 f000 -findindexHSC 1036 f000 -HSCGameID1 = $1029 1037 f000 -HSCGameID2 = $106E 1038 f000 -HSCGameDifficulty = $10B3 1039 f000 -HSCGameIndex = $10F8 1040 f000 - ; routine responsible for finding the game index from HSC 1041 f000 - ; call with x=0 to create a new table if none exist, call with x=$ff to avoid creating new tables 1042 f000 - ; the HS loading routine will use x=$ff, the HS saving routine will use x=0 1043 f000 - ldy #69 ; start +1 to account for the dey 1044 f000 -findindexHSCloop 1045 f000 - dey 1046 f000 - bmi findindexHSCerror 1047 f000 - lda HSCGameDifficulty,y 1048 f000 - cmp #$7F 1049 f000 - beq findourindexHSC 1050 f000 - cmp gamedifficulty 1051 f000 - bne findindexHSCloop 1052 f000 - lda HSCGameID1,y 1053 f000 - cmp #HSIDHI 1054 f000 - bne findindexHSCloop 1055 f000 - lda HSCGameID2,y 1056 f000 - cmp #HSIDLO 1057 f000 - bne findindexHSCloop 1058 f000 -findourindexHSC 1059 f000 - ; if we're here we found our index in the table 1060 f000 - ; or we found the first empty one 1061 f000 - sty hsgameslot 1062 f000 - jsr setupHSCGamepointer ; setup the pointer to the HS Table for this game... 1063 f000 - rts 1064 f000 - 1065 f000 - 1066 f000 -initializeHSCtableentry 1067 f000 - ldy hsgameslot 1068 f000 - ; we need to make a new entry... 1069 f000 - lda #HSIDHI 1070 f000 - sta HSCGameID1,y 1071 f000 - lda #HSIDLO 1072 f000 - sta HSCGameID2,y 1073 f000 - lda gamedifficulty 1074 f000 - sta HSCGameDifficulty,y 1075 f000 - ldx #0 1076 f000 -fixHSDGameDifficultylistLoop 1077 f000 - inx 1078 f000 - txa 1079 f000 - sta HSCGameIndex,y 1080 f000 - iny 1081 f000 - cpy #69 1082 f000 - bne fixHSDGameDifficultylistLoop 1083 f000 - rts 1084 f000 - 1085 f000 -setupHSCGamepointer 1086 f000 - ; this routines sets (HSGameTableLo) pointing to the game's HS table 1087 f000 - lda #$17 1088 f000 - sta HSGameTableHi 1089 f000 - lda #$FA 1090 f000 - sta HSGameTableLo 1091 f000 -setupHSCGamepointerLoop 1092 f000 - lda HSGameTableLo 1093 f000 - sec 1094 f000 - sbc #25 1095 f000 - sta HSGameTableLo 1096 f000 - lda HSGameTableHi 1097 f000 - sbc #0 1098 f000 - sta HSGameTableHi 1099 f000 - iny 1100 f000 - cpy #69 1101 f000 - bne setupHSCGamepointerLoop 1102 f000 - rts 1103 f000 - 1104 f000 -loaddifficultytableAVOX 1105 f000 - ; routine responsible for loading the difficulty table from Avox 1106 f000 - ; we reuse HSC routines to format data to/from our Avox RAM buffer... 1107 f000 - lda #>(eeprombuffer+3) 1108 f000 - sta HSGameTableHi 1109 f000 - lda #<(eeprombuffer+3) 1110 f000 - sta HSGameTableLo 1111 f000 - 1112 f000 - ; the start location in EEPROM, subtract 32... 1113 f000 - lda #$5F 1114 f000 - sta HSVoxHi 1115 f000 - lda #$E0 1116 f000 - sta HSVoxLo 1117 f000 - lda #0 1118 f000 - sta temp1 1119 f000 -loaddifficultytableAVOXloop 1120 f000 - inc temp1 1121 f000 - beq loaddifficultytableAVOXfull 1122 f000 - clc 1123 f000 - lda HSVoxLo 1124 f000 - adc #32 1125 f000 - sta HSVoxLo 1126 f000 - lda HSVoxHi 1127 f000 - adc #0 1128 f000 - sta HSVoxHi 1129 f000 - lda #3 1130 f000 - jsr AVoxReadBytes ; read in 3 bytes, ID1,ID2,Difficulty 1131 f000 - lda eeprombuffer 1132 f000 - cmp #$FF 1133 f000 - beq loaddifficultytableAVOXempty 1134 f000 - cmp #HSIDHI 1135 f000 - bne loaddifficultytableAVOXloop 1136 f000 - lda eeprombuffer+1 1137 f000 - cmp #HSIDLO 1138 f000 - bne loaddifficultytableAVOXloop 1139 f000 - lda eeprombuffer+2 1140 f000 - cmp gamedifficulty 1141 f000 - bne loaddifficultytableAVOXloop 1142 f000 -loaddifficultytableAVOXdone 1143 f000 - lda #32 1144 f000 - jsr AVoxReadBytes 1145 f000 - jsr loaddifficultytableHSCcontinue 1146 f000 - rts 1147 f000 -loaddifficultytableAVOXfull 1148 f000 - lda #0 1149 f000 - sta hsdevice ; looks like all 255 entries are taken... disable it. 1150 f000 -loaddifficultytableAVOXempty 1151 f000 - jmp cleardifficultytablemem 1152 f000 - rts 1153 f000 - 1154 f000 -cleardifficultytablemem 1155 f000 - ldy #29 1156 f000 - lda #0 1157 f000 -cleardifficultytablememloop 1158 f000 - sta HSRAMTable,y 1159 f000 - dey 1160 f000 - bpl cleardifficultytablememloop 1161 f000 - rts 1162 f000 -hiscoremoduleend 1163 f000 - 1164 f000 - echo " hiscore assembly: ",[(hiscoremoduleend-hiscoremodulestart)]d," bytes" 1165 f000 - 1166 f000 - ifconst DOUBLEWIDE 1167 f000 -plotvaluedw 1168 f000 -plotdigitcount = temp6 1169 f000 - lda #0 1170 f000 - tay 1171 f000 - ldx valbufend 1172 f000 - 1173 f000 - lda plotdigitcount 1174 f000 - and #1 1175 f000 - beq pvnibble2chardw 1176 f000 - lda #0 1177 f000 - sta VALBUFFER,x ; just in case we skip this digit 1178 f000 - beq pvnibble2char_skipnibbledw 1179 f000 - 1180 f000 -pvnibble2chardw 1181 f000 - ; high nibble... 1182 f000 - lda (temp7),y 1183 f000 - and #$f0 1184 f000 - lsr 1185 f000 - lsr 1186 f000 - lsr 1187 f000 - lsr 1188 f000 - 1189 f000 - clc 1190 f000 - adc temp1 ; add the offset to character graphics to our value 1191 f000 - sta VALBUFFER,x 1192 f000 - inx 1193 f000 - dec plotdigitcount 1194 f000 -pvnibble2char_skipnibbledw 1195 f000 - ; low nibble... 1196 f000 - lda (temp7),y 1197 f000 - and #$0f 1198 f000 - clc 1199 f000 - adc temp1 ; add the offset to character graphics to our value 1200 f000 - sta VALBUFFER,x 1201 f000 - inx 1202 f000 - iny 1203 f000 - 1204 f000 - dec plotdigitcount 1205 f000 - bne pvnibble2chardw 1206 f000 - ;point to the start of our valuebuffer 1207 f000 - clc 1208 f000 - lda #VALBUFFER 1212 f000 - adc #0 1213 f000 - sta temp2 1214 f000 - 1215 f000 - ;advance valbufend to the end of our value buffer 1216 f000 - stx valbufend 1217 f000 - 1218 f000 - ifnconst plotvalueonscreen 1219 f000 - jmp plotcharacters 1220 f000 - else 1221 f000 - jmp plotcharacterslive 1222 f000 - endif 1223 f000 - endif ; DOUBLEWIDE 1224 f000 - 1225 f000 endif ; HSSUPPORT 1226 f000 ------- FILE c:\Users\Shane\Documents\my7800projects\Heofonfir\shooting_test.78b.asm 1829 f000 endif 1830 f000 ; Provided under the CC0 license. See the included LICENSE.txt for details. 1831 f000 1832 f000 ;standard routimes needed for pretty much all games 1833 f000 1834 f000 ; some definitions used with "set debug color" 1835 f000 00 91 DEBUGCALC = $91 1836 f000 00 41 DEBUGWASTE = $41 1837 f000 00 c1 DEBUGDRAW = $C1 1838 f000 1839 f000 ;NMI and IRQ handlers 1840 f000 NMI 1841 f000 ;VISIBLEOVER is 255 while the screen is drawn, and 0 right after the visible screen is done. 1842 f000 48 pha ; save A 1843 f001 a5 4d lda visibleover 1844 f003 49 ff eor #255 1845 f005 85 4d sta visibleover 1846 f007 - ifconst DEBUGINTERRUPT 1847 f007 - and #$93 1848 f007 - sta BACKGRND 1849 f007 endif 1850 f007 ce b2 01 dec interruptindex 1851 f00a d0 03 bne skipreallyoffvisible 1852 f00c 4c 73 f0 jmp reallyoffvisible 1853 f00f skipreallyoffvisible 1854 f00f a5 4d lda visibleover 1855 f011 d0 03 bne carryontopscreenroutine 1856 f013 - ifconst .bottomscreenroutine 1857 f013 - jsr .bottomscreenroutine 1858 f013 endif 1859 f013 1860 f013 4c 65 f0 jmp skiptopscreenroutine 1861 f016 carryontopscreenroutine 1862 f016 8a txa ; save X+Y 1863 f017 48 pha 1864 f018 98 tya 1865 f019 48 pha 1866 f01a d8 cld 1867 f01b - ifconst .topscreenroutine 1868 f01b - jsr .topscreenroutine 1869 f01b endif 1870 f01b ifnconst CANARYOFF 1871 f01b ad c1 01 lda canary 1872 f01e f0 0c beq skipcanarytriggered 1873 f020 a9 45 lda #$45 1874 f022 85 20 sta BACKGRND 1875 f024 a9 60 lda #$60 1876 f026 85 3c sta CTRL 1877 f028 8d 07 21 sta sCTRL 1878 f02b 02 .byte.b $02 ; KIL/JAM 1879 f02c endif 1880 f02c skipcanarytriggered 1881 f02c ee 3e 21 inc frameslost ; this is balanced with a "dec frameslost" when drawscreen is called. 1882 f02f 1883 f02f ; ** Other important routines that need to regularly run, and can run onscreen. 1884 f02f ; ** Atarivox can't go here, because Maria might interrupt it while it's bit-banging. 1885 f02f 1886 f02f - ifconst LONGCONTROLLERREAD 1887 f02f -longcontrollerreads ; ** controllers that take a lot of time to read. We use much of the visible screen here. 1888 f02f - ldy port1control 1889 f02f - lda longreadtype,y 1890 f02f - beq LLRET1 1891 f02f - tay 1892 f02f - lda longreadroutinehiP1,y 1893 f02f - sta inttemp4 1894 f02f - lda longreadroutineloP1,y 1895 f02f - sta inttemp3 1896 f02f - jmp (inttemp3) 1897 f02f -LLRET1 1898 f02f - ldy port0control 1899 f02f - lda longreadtype,y 1900 f02f - beq LLRET0 1901 f02f - tay 1902 f02f - lda longreadroutinehiP0,y 1903 f02f - sta inttemp4 1904 f02f - lda longreadroutineloP0,y 1905 f02f - sta inttemp3 1906 f02f - jmp (inttemp3) 1907 f02f -LLRET0 1908 f02f - 1909 f02f - 1910 f02f - ifconst PADDLERANGE 1911 f02f -TIMEVAL = PADDLERANGE 1912 f02f - else 1913 f02f -TIMEVAL = 160 1914 f02f - endif 1915 f02f -TIMEOFFSET = 10 1916 f02f - 1917 f02f endif ; LONGCONTROLLERREAD 1918 f02f 1919 f02f 1920 f02f 20 e5 f1 jsr servicesfxchannels 1921 f032 - ifconst MUSICTRACKER 1922 f032 - jsr servicesong 1923 f032 endif ; MUSICTRACKER 1924 f032 1925 f032 ee a4 01 inc framecounter 1926 f035 ad a4 01 lda framecounter 1927 f038 29 3f and #63 1928 f03a d0 08 bne skipcountdownseconds 1929 f03c ad a5 01 lda countdownseconds 1930 f03f f0 03 beq skipcountdownseconds 1931 f041 ce a5 01 dec countdownseconds 1932 f044 skipcountdownseconds 1933 f044 1934 f044 a2 01 ldx #1 1935 f046 buttonreadloop 1936 f046 8a txa 1937 f047 48 pha 1938 f048 bc b7 01 ldy port0control,x 1939 f04b b9 c8 f1 lda buttonhandlerlo,y 1940 f04e 85 da sta inttemp3 1941 f050 b9 bd f1 lda buttonhandlerhi,y 1942 f053 85 db sta inttemp4 1943 f055 05 da ora inttemp3 1944 f057 f0 03 beq buttonreadloopreturn 1945 f059 6c da 00 jmp (inttemp3) 1946 f05c buttonreadloopreturn 1947 f05c 68 pla 1948 f05d aa tax 1949 f05e ca dex 1950 f05f 10 e5 bpl buttonreadloop 1951 f061 1952 f061 - ifconst KEYPADSUPPORT 1953 f061 - jsr keypadrowselect 1954 f061 endif ; KEYPADSUPPORT 1955 f061 1956 f061 1957 f061 - ifconst DOUBLEBUFFER 1958 f061 - lda doublebufferminimumframeindex 1959 f061 - beq skipdoublebufferminimumframeindexadjust 1960 f061 - dec doublebufferminimumframeindex 1961 f061 -skipdoublebufferminimumframeindexadjust 1962 f061 endif 1963 f061 1964 f061 68 pla 1965 f062 a8 tay 1966 f063 68 pla 1967 f064 aa tax 1968 f065 skiptopscreenroutine 1969 f065 68 pla 1970 f066 40 RTI 1971 f067 1972 f067 IRQ ; the only source of non-nmi is the BRK opcode. The only 1973 f067 ifnconst BREAKPROTECTOFF 1974 f067 a9 1a lda #$1A 1975 f069 85 20 sta BACKGRND 1976 f06b a9 60 lda #$60 1977 f06d 85 3c sta CTRL 1978 f06f 8d 07 21 sta sCTRL 1979 f072 02 .byte.b $02 ; KIL/JAM 1980 f073 - else 1981 f073 - RTI 1982 f073 endif 1983 f073 1984 f073 - ifconst LONGCONTROLLERREAD 1985 f073 - 1986 f073 -longreadtype 1987 f073 - .byte 0, 0, 0, 1 ; NONE PROLINE LIGHTGUN PADDLE 1988 f073 - .byte 2, 0, 3, 0 ; TRKBALL VCSSTICK DRIVING KEYPAD 1989 f073 - .byte 3, 3, 0 ; STMOUSE AMOUSE ATARIVOX 1990 f073 - 1991 f073 -longreadroutineloP0 1992 f073 - .byte LLRET0 ; 0 = no routine 1999 f073 - .byte >paddleport0update ; 1 = paddle 2000 f073 - .byte >trakball0update ; 2 = trackball 2001 f073 - .byte >mouse0update ; 3 = mouse 2002 f073 - 2003 f073 -longreadroutineloP1 2004 f073 - .byte LLRET1 ; 0 = no routine 2011 f073 - .byte >paddleport1update ; 1 = paddle 2012 f073 - .byte >trakball1update ; 2 = trackball 2013 f073 - .byte >mouse1update ; 3 = mouse 2014 f073 - 2015 f073 - 2016 f073 -SETTIM64T 2017 f073 - bne skipdefaulttime 2018 f073 - ifnconst PADDLESMOOTHINGOFF 2019 f073 - lda #(TIMEVAL+TIMEOFFSET+1) 2020 f073 - else 2021 f073 - lda #(TIMEVAL+TIMEOFFSET) 2022 f073 - endif 2023 f073 -skipdefaulttime 2024 f073 - tay 2025 f073 - dey 2026 f073 -.setTIM64Tloop 2027 f073 - sta TIM64T 2028 f073 - cpy INTIM 2029 f073 - bne .setTIM64Tloop 2030 f073 - rts 2031 f073 endif ; LONGCONTROLLERREAD 2032 f073 2033 f073 reallyoffvisible 2034 f073 85 24 sta WSYNC 2035 f075 2036 f075 a9 00 lda #0 2037 f077 85 4d sta visibleover 2038 f079 - ifconst DEBUGINTERRUPT 2039 f079 - sta BACKGRND 2040 f079 endif 2041 f079 2042 f079 a9 03 lda #3 2043 f07b 8d b2 01 sta interruptindex 2044 f07e 2045 f07e 8a txa 2046 f07f 48 pha 2047 f080 98 tya 2048 f081 48 pha 2049 f082 d8 cld 2050 f083 2051 f083 2052 f083 20 5f f1 jsr uninterruptableroutines 2053 f086 2054 f086 - ifconst .userinterrupt 2055 f086 - jsr .userinterrupt 2056 f086 endif 2057 f086 2058 f086 - ifconst KEYPADSUPPORT 2059 f086 - jsr keypadcolumnread 2060 f086 endif 2061 f086 2062 f086 68 pla 2063 f087 a8 tay 2064 f088 68 pla 2065 f089 aa tax 2066 f08a 68 pla 2067 f08b 40 RTI 2068 f08c 2069 f08c clearscreen 2070 f08c a2 1b ldx #(WZONECOUNT-1) 2071 f08e a9 00 lda #0 2072 f090 clearscreenloop 2073 f090 95 65 sta dlend,x 2074 f092 ca dex 2075 f093 10 fb bpl clearscreenloop 2076 f095 a9 00 lda #0 2077 f097 8d ad 01 sta valbufend ; clear the bcd value buffer 2078 f09a 8d ae 01 sta valbufendsave 2079 f09d 60 rts 2080 f09e 2081 f09e restorescreen 2082 f09e a2 1b ldx #(WZONECOUNT-1) 2083 f0a0 a9 00 lda #0 2084 f0a2 restorescreenloop 2085 f0a2 b5 82 lda dlendsave,x 2086 f0a4 95 65 sta dlend,x 2087 f0a6 ca dex 2088 f0a7 10 f9 bpl restorescreenloop 2089 f0a9 ad ae 01 lda valbufendsave 2090 f0ac 8d ad 01 sta valbufend 2091 f0af 60 rts 2092 f0b0 2093 f0b0 savescreen 2094 f0b0 a2 1b ldx #(WZONECOUNT-1) 2095 f0b2 savescreenloop 2096 f0b2 b5 65 lda dlend,x 2097 f0b4 95 82 sta dlendsave,x 2098 f0b6 ca dex 2099 f0b7 10 f9 bpl savescreenloop 2100 f0b9 ad ad 01 lda valbufend 2101 f0bc 8d ae 01 sta valbufendsave 2102 f0bf - ifconst DOUBLEBUFFER 2103 f0bf - lda doublebufferstate 2104 f0bf - beq savescreenrts 2105 f0bf - lda #1 2106 f0bf - sta doublebufferbufferdirty 2107 f0bf -savescreenrts 2108 f0bf endif ; DOUBLEBUFFER 2109 f0bf 60 rts 2110 f0c0 2111 f0c0 drawscreen 2112 f0c0 2113 f0c0 a9 00 lda #0 2114 f0c2 85 42 sta temp1 ; not B&W if we're here... 2115 f0c4 2116 f0c4 drawscreenwait 2117 f0c4 a5 4d lda visibleover 2118 f0c6 d0 fc bne drawscreenwait ; make sure the visible screen isn't being drawn 2119 f0c8 2120 f0c8 ;restore some registers in case the game changed them mid-screen... 2121 f0c8 ad 07 21 lda sCTRL 2122 f0cb 05 42 ora temp1 2123 f0cd 85 3c sta CTRL 2124 f0cf ad 0b 21 lda sCHARBASE 2125 f0d2 85 34 sta CHARBASE 2126 f0d4 2127 f0d4 ;ensure all of the display list is terminated... 2128 f0d4 20 45 f1 jsr terminatedisplaylist 2129 f0d7 2130 f0d7 ifnconst pauseroutineoff 2131 f0d7 20 e2 f0 jsr pauseroutine 2132 f0da endif ; pauseroutineoff 2133 f0da 2134 f0da ; Make sure the visible screen has *started* before we exit. That way we can rely on drawscreen 2135 f0da ; delaying a full frame, but still allowing time for basic calculations. 2136 f0da visiblescreenstartedwait 2137 f0da a5 4d lda visibleover 2138 f0dc f0 fc beq visiblescreenstartedwait 2139 f0de visiblescreenstartedwaitdone 2140 f0de ce 3e 21 dec frameslost ; ; this gets balanced with an "inc frameslost" by an NMI at the top of the screen 2141 f0e1 60 rts 2142 f0e2 2143 f0e2 ifnconst pauseroutineoff 2144 f0e2 ; check to see if pause was pressed and released 2145 f0e2 pauseroutine 2146 f0e2 ad b3 01 lda pausedisable 2147 f0e5 d0 4e bne leavepauseroutine 2148 f0e7 a9 08 lda #8 2149 f0e9 2c 82 02 bit SWCHB 2150 f0ec f0 29 beq pausepressed 2151 f0ee 2152 f0ee ifnconst SOFTRESETASPAUSEOFF 2153 f0ee ifnconst MOUSESUPPORT 2154 f0ee ifnconst TRAKBALLSUPPORT 2155 f0ee ad 80 02 lda SWCHA ; then check the soft "RESET" joysick code... 2156 f0f1 29 70 and #%01110000 ; _LDU 2157 f0f3 f0 22 beq pausepressed 2158 f0f5 endif 2159 f0f5 endif 2160 f0f5 endif 2161 f0f5 2162 f0f5 ;pause isn't pressed 2163 f0f5 a9 00 lda #0 2164 f0f7 8d ac 01 sta pausebuttonflag ; clear pause hold state in case its set 2165 f0fa 2166 f0fa ;check if we're in an already paused state 2167 f0fa ad 00 21 lda pausestate 2168 f0fd f0 36 beq leavepauseroutine ; nope, leave 2169 f0ff 2170 f0ff c9 01 cmp #1 ; last frame was the start of pausing 2171 f101 f0 2b beq enterpausestate2 ; move from state 1 to 2 2172 f103 2173 f103 c9 02 cmp #2 2174 f105 f0 34 beq carryonpausing 2175 f107 2176 f107 ;pausestate must be >2, which means we're ending an unpause 2177 f107 a9 00 lda #0 2178 f109 8d ac 01 sta pausebuttonflag 2179 f10c 8d 00 21 sta pausestate 2180 f10f ad 07 21 lda sCTRL 2181 f112 85 3c sta CTRL 2182 f114 4c 35 f1 jmp leavepauseroutine 2183 f117 2184 f117 pausepressed 2185 f117 ;pause is pressed 2186 f117 ad ac 01 lda pausebuttonflag 2187 f11a c9 ff cmp #$ff 2188 f11c f0 1d beq carryonpausing 2189 f11e 2190 f11e ;its a new press, increment the state 2191 f11e ee 00 21 inc pausestate 2192 f121 2193 f121 ;silence volume at the start and end of pausing 2194 f121 a9 00 lda #0 2195 f123 85 19 sta AUDV0 2196 f125 85 1a sta AUDV1 2197 f127 2198 f127 - ifconst pokeysupport 2199 f127 - ldy #7 2200 f127 -pausesilencepokeyaudioloop 2201 f127 - sta (pokeybase),y 2202 f127 - dey 2203 f127 - bpl pausesilencepokeyaudioloop 2204 f127 endif ; pokeysupport 2205 f127 2206 f127 a9 ff lda #$ff 2207 f129 8d ac 01 sta pausebuttonflag 2208 f12c d0 0d bne carryonpausing 2209 f12e 2210 f12e enterpausestate2 2211 f12e a9 02 lda #2 2212 f130 8d 00 21 sta pausestate 2213 f133 d0 06 bne carryonpausing 2214 f135 leavepauseroutine 2215 f135 ad 07 21 lda sCTRL 2216 f138 85 3c sta CTRL 2217 f13a 60 rts 2218 f13b carryonpausing 2219 f13b - ifconst .pause 2220 f13b - jsr .pause 2221 f13b endif ; .pause 2222 f13b ad 07 21 lda sCTRL 2223 f13e 09 80 ora #%10000000 ; turn off colorburst during pause... 2224 f140 85 3c sta CTRL 2225 f142 4c e2 f0 jmp pauseroutine 2226 f145 endif ; pauseroutineoff 2227 f145 2228 f145 2229 f145 - ifconst DOUBLEBUFFER 2230 f145 -skipterminatedisplaylistreturn 2231 f145 - rts 2232 f145 endif ; DOUBLEBUFFER 2233 f145 terminatedisplaylist 2234 f145 - ifconst DOUBLEBUFFER 2235 f145 - lda doublebufferstate 2236 f145 - bne skipterminatedisplaylistreturn ; double-buffering runs it's own DL termination code 2237 f145 endif ; DOUBLEBUFFER 2238 f145 terminatedisplaybuffer 2239 f145 ;add DL end entry on each DL 2240 f145 a2 1b ldx #(WZONECOUNT-1) 2241 f147 dlendloop 2242 f147 bd 4c f6 lda DLPOINTL,x 2243 f14a - ifconst DOUBLEBUFFER 2244 f14a - clc 2245 f14a - adc doublebufferdloffset 2246 f14a endif ; DOUBLEBUFFER 2247 f14a 85 63 sta dlpnt 2248 f14c bd 30 f6 lda DLPOINTH,x 2249 f14f - ifconst DOUBLEBUFFER 2250 f14f - adc #0 2251 f14f endif ; DOUBLEBUFFER 2252 f14f 85 64 sta dlpnt+1 2253 f151 b4 65 ldy dlend,x 2254 f153 a9 00 lda #$00 2255 f155 dlendmoreloops 2256 f155 c8 iny 2257 f156 91 63 sta (dlpnt),y 2258 f158 - ifconst FRAMESKIPGLITCHFIXWEAK 2259 f158 - cpy #DLLASTOBJ+1 2260 f158 - beq dlendthiszonedone 2261 f158 - iny 2262 f158 - iny 2263 f158 - iny 2264 f158 - iny 2265 f158 - iny 2266 f158 - sta (dlpnt),y 2267 f158 -dlendthiszonedone 2268 f158 endif FRAMESKIPGLITCHFIXWEAK 2269 f158 - ifconst FRAMESKIPGLITCHFIX 2270 f158 - iny 2271 f158 - iny 2272 f158 - iny 2273 f158 - iny 2274 f158 - cpy #DLLASTOBJ-1 2275 f158 - bcc dlendmoreloops 2276 f158 endif ; FRAMESKIPGLITCHFIX 2277 f158 ca dex 2278 f159 10 ec bpl dlendloop 2279 f15b 2280 f15b ifnconst pauseroutineoff 2281 f15b 20 e2 f0 jsr pauseroutine 2282 f15e endif ; pauseroutineoff 2283 f15e 60 rts 2284 f15f 2285 f15f uninterruptableroutines 2286 f15f ; this is for routines that must happen off the visible screen, each frame. 2287 f15f 2288 f15f - ifconst AVOXVOICE 2289 f15f - jsr serviceatarivoxqueue 2290 f15f endif 2291 f15f 2292 f15f a9 00 lda #0 2293 f161 8d b6 01 sta palfastframe 2294 f164 ad 09 21 lda paldetected 2295 f167 f0 10 beq skippalframeadjusting 2296 f169 ; ** PAL console is detected. we increment palframes to accurately count 5 frames, 2297 f169 ae b5 01 ldx palframes 2298 f16c e8 inx 2299 f16d e0 05 cpx #5 2300 f16f d0 05 bne palframeskipdone 2301 f171 ee b6 01 inc palfastframe 2302 f174 a2 00 ldx #0 2303 f176 palframeskipdone 2304 f176 8e b5 01 stx palframes 2305 f179 skippalframeadjusting 2306 f179 2307 f179 - ifconst MUSICTRACKER 2308 f179 - ; We normally run the servicesong routine from the top-screen interrupt, but if it 2309 f179 - ; happens to interrupt the scheduling of a sound effect in the game code, we skip it. 2310 f179 - ; If that happens, we try again here. Chances are very small we'll run into the same 2311 f179 - ; problem twice, and if we do, we just drop a musical note or two. 2312 f179 - lda sfxschedulemissed 2313 f179 - beq servicesongwasnotmissed 2314 f179 - jsr servicesong 2315 f179 -servicesongwasnotmissed 2316 f179 endif ; MUSICTRACKER 2317 f179 2318 f179 60 rts 2319 f17a 2320 f17a serviceatarivoxqueue 2321 f17a - ifconst AVOXVOICE 2322 f17a - lda voxlock 2323 f17a - bne skipvoxprocessing ; the vox is in the middle of speech address update 2324 f17a -skipvoxqueuesizedec 2325 f17a - jmp processavoxvoice 2326 f17a -skipvoxprocessing 2327 f17a - rts 2328 f17a - 2329 f17a -processavoxvoice 2330 f17a - lda avoxenable 2331 f17a - bne avoxfixport 2332 f17a - SPKOUT tempavox 2333 f17a - rts 2334 f17a -avoxfixport 2335 f17a - lda #0 ; restore the port to all bits as inputs... 2336 f17a - sta CTLSWA 2337 f17a - rts 2338 f17a -silenceavoxvoice 2339 f17a - SPEAK avoxsilentdata 2340 f17a - rts 2341 f17a -avoxsilentdata 2342 f17a - .byte 31,255 2343 f17a else 2344 f17a 60 rts 2345 f17b endif ; AVOXVOICE 2346 f17b 2347 f17b joybuttonhandler 2348 f17b 8a txa 2349 f17c 0a asl 2350 f17d a8 tay 2351 f17e b9 08 00 lda INPT0,y 2352 f181 4a lsr 2353 f182 9d 02 21 sta sINPT1,x 2354 f185 b9 09 00 lda INPT1,y 2355 f188 29 80 and #%10000000 2356 f18a 1d 02 21 ora sINPT1,x 2357 f18d 9d 02 21 sta sINPT1,x 2358 f190 2359 f190 b5 0c lda INPT4,x 2360 f192 30 19 bmi .skip1bjoyfirecheck 2361 f194 ;one button joystick is down 2362 f194 49 80 eor #%10000000 2363 f196 9d 02 21 sta sINPT1,x 2364 f199 2365 f199 ad b1 01 lda joybuttonmode 2366 f19c 3d b0 f1 and twobuttonmask,x 2367 f19f f0 0c beq .skip1bjoyfirecheck 2368 f1a1 ad b1 01 lda joybuttonmode 2369 f1a4 1d b0 f1 ora twobuttonmask,x 2370 f1a7 8d b1 01 sta joybuttonmode 2371 f1aa 8d 82 02 sta SWCHB 2372 f1ad .skip1bjoyfirecheck 2373 f1ad 4c 5c f0 jmp buttonreadloopreturn 2374 f1b0 2375 f1b0 twobuttonmask 2376 f1b0 04 10 .byte.b %00000100,%00010000 2377 f1b2 2378 f1b2 gunbuttonhandler ; outside of the conditional, so our button handler LUT is valid 2379 f1b2 - ifconst LIGHTGUNSUPPORT 2380 f1b2 - cpx #0 2381 f1b2 - bne secondportgunhandler 2382 f1b2 -firstportgunhandler 2383 f1b2 - lda SWCHA 2384 f1b2 - asl 2385 f1b2 - asl 2386 f1b2 - asl ; shift D4 to D7 2387 f1b2 - and #%10000000 2388 f1b2 - eor #%10000000 2389 f1b2 - sta sINPT1 2390 f1b2 - jmp buttonreadloopreturn 2391 f1b2 -secondportgunhandler 2392 f1b2 - lda SWCHA 2393 f1b2 - lsr ; shift D0 into carry 2394 f1b2 - lsr ; shift carry into D7 2395 f1b2 - and #%10000000 2396 f1b2 - eor #%10000000 2397 f1b2 - sta sINPT3 2398 f1b2 - jmp buttonreadloopreturn 2399 f1b2 endif ; LIGHTGUNSUPPORT 2400 f1b2 2401 f1b2 controlsusing2buttoncode 2402 f1b2 00 .byte.b 0 ; 00=no controller plugged in 2403 f1b3 01 .byte.b 1 ; 01=proline joystick 2404 f1b4 00 .byte.b 0 ; 02=lightgun 2405 f1b5 00 .byte.b 0 ; 03=paddle 2406 f1b6 01 .byte.b 1 ; 04=trakball 2407 f1b7 01 .byte.b 1 ; 05=vcs joystick 2408 f1b8 01 .byte.b 1 ; 06=driving control 2409 f1b9 00 .byte.b 0 ; 07=keypad control 2410 f1ba 00 .byte.b 0 ; 08=st mouse/cx80 2411 f1bb 00 .byte.b 0 ; 09=amiga mouse 2412 f1bc 01 .byte.b 1 ; 10=atarivox 2413 f1bd 2414 f1bd buttonhandlerhi 2415 f1bd 00 .byte.b 0 ; 00=no controller plugged in 2416 f1be f1 .byte.b >joybuttonhandler ; 01=proline joystick 2417 f1bf f1 .byte.b >gunbuttonhandler ; 02=lightgun 2418 f1c0 f5 .byte.b >paddlebuttonhandler ; 03=paddle 2419 f1c1 f1 .byte.b >joybuttonhandler ; 04=trakball 2420 f1c2 f1 .byte.b >joybuttonhandler ; 05=vcs joystick 2421 f1c3 f1 .byte.b >joybuttonhandler ; 06=driving control 2422 f1c4 00 .byte.b 0 ; 07=keypad 2423 f1c5 f5 .byte.b >mousebuttonhandler ; 08=st mouse 2424 f1c6 f5 .byte.b >mousebuttonhandler ; 09=amiga mouse 2425 f1c7 f1 .byte.b >joybuttonhandler ; 10=atarivox 2426 f1c8 buttonhandlerlo 2427 f1c8 00 .byte.b 0 ; 00=no controller plugged in 2428 f1c9 7b .byte.b $0F means the sound is looped while priority is active 2529 f226 2530 f226 05 d9 ora inttemp2 2531 f228 05 d8 ora inttemp1 ; check if F|C|V=0 2532 f22a f0 23 beq zerosfx ; if so, we're at the end of the sound. 2533 f22c 2534 f22c advancesfxpointer 2535 f22c ; advance the pointer to the next sound chunk 2536 f22c c8 iny 2537 f22d 84 da sty inttemp3 2538 f22f 18 clc 2539 f230 b5 4e lda sfx1pointlo,x 2540 f232 65 da adc inttemp3 2541 f234 95 4e sta sfx1pointlo,x 2542 f236 b5 50 lda sfx1pointhi,x 2543 f238 69 00 adc #0 2544 f23a 95 50 sta sfx1pointhi,x 2545 f23c 4c e7 f1 jmp servicesfxchannelsloop 2546 f23f 2547 f23f sfxsoundloop 2548 f23f 48 pha 2549 f240 b5 52 lda sfx1priority,x 2550 f242 d0 04 bne sfxsoundloop_carryon 2551 f244 68 pla ; fix the stack before we go 2552 f245 4c 2c f2 jmp advancesfxpointer 2553 f248 sfxsoundloop_carryon 2554 f248 68 pla 2555 f249 29 f0 and #$F0 2556 f24b 4a lsr 2557 f24c 4a lsr 2558 f24d 4a lsr 2559 f24e 4a lsr 2560 f24f 2561 f24f zerosfx 2562 f24f 95 4e sta sfx1pointlo,x 2563 f251 95 50 sta sfx1pointhi,x 2564 f253 95 52 sta sfx1priority,x 2565 f255 4c e7 f1 jmp servicesfxchannelsloop 2566 f258 2567 f258 2568 f258 schedulesfx 2569 f258 ; called with sfxinstrumentlo=data sfxpitchoffset=pitch-offset sfxnoteindex=note index 2570 f258 a0 00 ldy #0 2571 f25a b1 e0 lda (sfxinstrumentlo),y 2572 f25c - ifconst pokeysupport 2573 f25c - cmp #$20 ; POKEY? 2574 f25c - bne scheduletiasfx 2575 f25c - jmp schedulepokeysfx 2576 f25c endif 2577 f25c scheduletiasfx 2578 f25c ;cmp #$10 ; TIA? 2579 f25c ;beq continuescheduletiasfx 2580 f25c ; rts ; unhandled!!! 2581 f25c continuescheduletiasfx 2582 f25c ifnconst TIASFXMONO 2583 f25c a5 4e lda sfx1pointlo 2584 f25e 05 50 ora sfx1pointhi 2585 f260 f0 13 beq schedulesfx1 ;if channel 1 is idle, use it 2586 f262 a5 4f lda sfx2pointlo 2587 f264 05 51 ora sfx2pointhi 2588 f266 f0 11 beq schedulesfx2 ;if channel 2 is idle, use it 2589 f268 ; Both channels are scheduled. 2590 f268 a0 01 ldy #1 2591 f26a b1 e0 lda (sfxinstrumentlo),y 2592 f26c d0 01 bne interruptsfx 2593 f26e 60 rts ; the new sound has 0 priority and both channels are busy. Skip playing it. 2594 f26f interruptsfx 2595 f26f ;Compare which active sound has a lower priority. We'll interrupt the lower one. 2596 f26f a5 52 lda sfx1priority 2597 f271 c5 53 cmp sfx2priority 2598 f273 b0 04 bcs schedulesfx2 2599 f275 endif ; !TIASFXMONO 2600 f275 2601 f275 schedulesfx1 2602 f275 a2 00 ldx #0 ; channel 1 2603 f277 ifnconst TIASFXMONO 2604 f277 f0 02 beq skipschedulesfx2 2605 f279 schedulesfx2 2606 f279 a2 01 ldx #1 ; channel 2 2607 f27b skipschedulesfx2 2608 f27b endif ; !TIASFXMONO 2609 f27b 2610 f27b - ifconst MUSICTRACKER 2611 f27b - lda sfxnoteindex 2612 f27b - bpl skipdrumkitoverride 2613 f27b - and #$7F ; subtract 128 2614 f27b - sec 2615 f27b - sbc #4 ; drums start at 132, i.e. octave 10 2616 f27b - asl 2617 f27b - tay 2618 f27b - lda tiadrumkitdefinition,y 2619 f27b - sta sfxinstrumentlo 2620 f27b - iny 2621 f27b - lda tiadrumkitdefinition,y 2622 f27b - sta sfxinstrumenthi 2623 f27b - lda #0 2624 f27b - sta sfxnoteindex ; and tell the driver it's a non-pitched instrument 2625 f27b -skipdrumkitoverride 2626 f27b endif ; MUSICTRACKER 2627 f27b a0 01 ldy #1 ; get priority and sound-resolution (in frames) 2628 f27d b1 e0 lda (sfxinstrumentlo),y 2629 f27f 95 52 sta sfx1priority,x 2630 f281 c8 iny 2631 f282 b1 e0 lda (sfxinstrumentlo),y 2632 f284 95 56 sta sfx1frames,x 2633 f286 a5 e0 lda sfxinstrumentlo 2634 f288 18 clc 2635 f289 69 03 adc #3 2636 f28b 95 4e sta sfx1pointlo,x 2637 f28d a5 e1 lda sfxinstrumenthi 2638 f28f 69 00 adc #0 2639 f291 95 50 sta sfx1pointhi,x 2640 f293 a5 e2 lda sfxpitchoffset 2641 f295 95 54 sta sfx1poffset,x 2642 f297 a9 00 lda #0 2643 f299 95 58 sta sfx1tick,x 2644 f29b a5 e3 lda sfxnoteindex 2645 f29d 95 cd sta sfx1notedata,x 2646 f29f 60 rts 2647 f2a0 2648 f2a0 plotsprite 2649 f2a0 ifnconst NODRAWWAIT 2650 f2a0 - ifconst DOUBLEBUFFER 2651 f2a0 - lda doublebufferstate 2652 f2a0 - bne skipplotspritewait 2653 f2a0 endif ; DOUBLEBUFFER 2654 f2a0 - ifconst DEBUGWAITCOLOR 2655 f2a0 - lda #$41 2656 f2a0 - sta BACKGRND 2657 f2a0 endif 2658 f2a0 plotspritewait 2659 f2a0 a5 4d lda visibleover 2660 f2a2 d0 fc bne plotspritewait 2661 f2a4 skipplotspritewait 2662 f2a4 - ifconst DEBUGWAITCOLOR 2663 f2a4 - lda #$0 2664 f2a4 - sta BACKGRND 2665 f2a4 endif 2666 f2a4 endif 2667 f2a4 2668 f2a4 ;arguments: 2669 f2a4 ; temp1=lo graphicdata 2670 f2a4 ; temp2=hi graphicdata 2671 f2a4 ; temp3=palette | width byte 2672 f2a4 ; temp4=x 2673 f2a4 ; temp5=y 2674 f2a4 ; temp6=mode 2675 f2a4 a5 46 lda temp5 ;Y position 2676 f2a6 4a lsr ; 2 - Divide by 8 or 16 2677 f2a7 4a lsr ; 2 2678 f2a8 4a lsr ; 2 2679 f2a9 - if WZONEHEIGHT = 16 2680 f2a9 - lsr ; 2 2681 f2a9 endif 2682 f2a9 2683 f2a9 aa tax 2684 f2aa 2685 f2aa ifnconst NOLIMITCHECKING 2686 f2aa 2687 f2aa ; the next block allows for vertical masking, and ensures we don't overwrite non-DL memory 2688 f2aa 2689 f2aa c9 1c cmp #WZONECOUNT 2690 f2ac 2691 f2ac 90 0a bcc continueplotsprite1 ; the sprite is fully on-screen, so carry on... 2692 f2ae ; otherwise, check to see if the bottom half is in zone 0... 2693 f2ae 2694 f2ae - if WZONEHEIGHT = 16 2695 f2ae - cmp #15 2696 f2ae else 2697 f2ae c9 1f cmp #31 2698 f2b0 endif 2699 f2b0 2700 f2b0 d0 05 bne exitplotsprite1 2701 f2b2 a2 00 ldx #0 2702 f2b4 4c f1 f2 jmp continueplotsprite2 2703 f2b7 exitplotsprite1 2704 f2b7 60 rts 2705 f2b8 2706 f2b8 continueplotsprite1 2707 f2b8 endif 2708 f2b8 2709 f2b8 bd 4c f6 lda DLPOINTL,x ;Get pointer to DL that this sprite starts in 2710 f2bb - ifconst DOUBLEBUFFER 2711 f2bb - clc 2712 f2bb - adc doublebufferdloffset 2713 f2bb endif ; DOUBLEBUFFER 2714 f2bb 85 63 sta dlpnt 2715 f2bd bd 30 f6 lda DLPOINTH,x 2716 f2c0 - ifconst DOUBLEBUFFER 2717 f2c0 - adc #0 2718 f2c0 endif ; DOUBLEBUFFER 2719 f2c0 85 64 sta dlpnt+1 2720 f2c2 2721 f2c2 ;Create DL entry for upper part of sprite 2722 f2c2 2723 f2c2 b4 65 ldy dlend,x ;Get the index to the end of this DL 2724 f2c4 2725 f2c4 ifconst CHECKOVERWRITE 2726 f2c4 c0 41 cpy #DLLASTOBJ 2727 f2c6 f0 21 beq checkcontinueplotsprite2 2728 f2c8 continueplotsprite1a 2729 f2c8 endif 2730 f2c8 2731 f2c8 a5 42 lda temp1 ; graphic data, lo byte 2732 f2ca 91 63 sta (dlpnt),y ;Low byte of data address 2733 f2cc 2734 f2cc ifnconst ATOMICSPRITEUPDATE 2735 f2cc c8 iny 2736 f2cd a5 47 lda temp6 2737 f2cf 91 63 sta (dlpnt),y 2738 f2d1 - else 2739 f2d1 - iny 2740 f2d1 - sty temp8 2741 f2d1 endif 2742 f2d1 2743 f2d1 c8 iny 2744 f2d2 2745 f2d2 a5 46 lda temp5 ;Y position 2746 f2d4 29 07 and #(WZONEHEIGHT - 1) 2747 f2d6 c9 01 cmp #1 ; clear carry if our sprite is just in this zone 2748 f2d8 05 43 ora temp2 ; graphic data, hi byte 2749 f2da 91 63 sta (dlpnt),y 2750 f2dc 2751 f2dc 2752 f2dc c8 iny 2753 f2dd a5 44 lda temp3 ;palette|width 2754 f2df 91 63 sta (dlpnt),y 2755 f2e1 2756 f2e1 c8 iny 2757 f2e2 a5 45 lda temp4 ;Horizontal position 2758 f2e4 91 63 sta (dlpnt),y 2759 f2e6 2760 f2e6 c8 iny 2761 f2e7 94 65 sty dlend,x 2762 f2e9 2763 f2e9 - ifconst ALWAYSTERMINATE 2764 f2e9 - iny 2765 f2e9 - lda #0 2766 f2e9 - sta (dlpnt),y 2767 f2e9 endif 2768 f2e9 2769 f2e9 - ifconst ATOMICSPRITEUPDATE 2770 f2e9 - ldy temp8 2771 f2e9 - lda temp6 2772 f2e9 - sta (dlpnt),y 2773 f2e9 endif 2774 f2e9 2775 f2e9 checkcontinueplotsprite2 2776 f2e9 2777 f2e9 90 38 bcc doneSPDL ;branch if the sprite was fully in the last zone 2778 f2eb 2779 f2eb ;Create DL entry for lower part of sprite 2780 f2eb 2781 f2eb e8 inx ;Next region 2782 f2ec 2783 f2ec ifnconst NOLIMITCHECKING 2784 f2ec e0 1c cpx #WZONECOUNT 2785 f2ee 2786 f2ee 90 01 bcc continueplotsprite2 ; the second half of the sprite is fully on-screen, so carry on... 2787 f2f0 60 rts 2788 f2f1 continueplotsprite2 2789 f2f1 endif 2790 f2f1 2791 f2f1 bd 4c f6 lda DLPOINTL,x ;Get pointer to next DL 2792 f2f4 - ifconst DOUBLEBUFFER 2793 f2f4 - clc 2794 f2f4 - adc doublebufferdloffset 2795 f2f4 endif ; DOUBLEBUFFER 2796 f2f4 85 63 sta dlpnt 2797 f2f6 bd 30 f6 lda DLPOINTH,x 2798 f2f9 - ifconst DOUBLEBUFFER 2799 f2f9 - adc #0 2800 f2f9 endif ; DOUBLEBUFFER 2801 f2f9 85 64 sta dlpnt+1 2802 f2fb b4 65 ldy dlend,x ;Get the index to the end of this DL 2803 f2fd 2804 f2fd ifconst CHECKOVERWRITE 2805 f2fd c0 41 cpy #DLLASTOBJ 2806 f2ff d0 01 bne continueplotsprite2a 2807 f301 60 rts 2808 f302 continueplotsprite2a 2809 f302 endif 2810 f302 2811 f302 a5 42 lda temp1 ; graphic data, lo byte 2812 f304 91 63 sta (dlpnt),y 2813 f306 2814 f306 ifnconst ATOMICSPRITEUPDATE 2815 f306 c8 iny 2816 f307 a5 47 lda temp6 2817 f309 91 63 sta (dlpnt),y 2818 f30b - else 2819 f30b - iny 2820 f30b - sty temp8 2821 f30b endif 2822 f30b 2823 f30b c8 iny 2824 f30c 2825 f30c a5 46 lda temp5 ;Y position 2826 f30e 0b 07 anc #(WZONEHEIGHT - 1) ; undocumented. A=A&IMM, then move bit 7 into carry 2827 f310 05 43 ora temp2 ; graphic data, hi byte 2828 f312 e9 07 sbc #(WZONEHEIGHT-1) ; start at the DMA hole. -1 because carry is clear 2829 f314 91 63 sta (dlpnt),y 2830 f316 2831 f316 c8 iny 2832 f317 2833 f317 a5 44 lda temp3 ;palette|width 2834 f319 91 63 sta (dlpnt),y 2835 f31b 2836 f31b c8 iny 2837 f31c 2838 f31c a5 45 lda temp4 ;Horizontal position 2839 f31e 91 63 sta (dlpnt),y 2840 f320 2841 f320 c8 iny 2842 f321 94 65 sty dlend,x 2843 f323 2844 f323 - ifconst ALWAYSTERMINATE 2845 f323 - iny 2846 f323 - lda #0 2847 f323 - sta (dlpnt),y 2848 f323 endif 2849 f323 2850 f323 - ifconst ATOMICSPRITEUPDATE 2851 f323 - ldy temp8 2852 f323 - lda temp6 2853 f323 - sta (dlpnt),y 2854 f323 endif 2855 f323 2856 f323 doneSPDL 2857 f323 60 rts 2858 f324 2859 f324 2860 f324 lockzonex 2861 f324 - ifconst ZONELOCKS 2862 f324 - ldy dlend,x 2863 f324 - cpy #DLLASTOBJ 2864 f324 - beq lockzonexreturn ; the zone is either stuffed or locked. abort! 2865 f324 - lda DLPOINTL,x 2866 f324 - ifconst DOUBLEBUFFER 2867 f324 - clc 2868 f324 - adc doublebufferdloffset 2869 f324 - endif ; DOUBLEBUFFER 2870 f324 - sta dlpnt 2871 f324 - lda DLPOINTH,x 2872 f324 - ifconst DOUBLEBUFFER 2873 f324 - adc #0 2874 f324 - endif ; DOUBLEBUFFER 2875 f324 - sta dlpnt+1 2876 f324 - iny 2877 f324 - lda #0 2878 f324 - sta (dlpnt),y 2879 f324 - dey 2880 f324 - tya 2881 f324 - ldy #(DLLASTOBJ-1) 2882 f324 - sta (dlpnt),y 2883 f324 - iny 2884 f324 - sty dlend,x 2885 f324 -lockzonexreturn 2886 f324 - rts 2887 f324 endif ; ZONELOCKS 2888 f324 unlockzonex 2889 f324 - ifconst ZONELOCKS 2890 f324 - ldy dlend,x 2891 f324 - cpy #DLLASTOBJ 2892 f324 - bne unlockzonexreturn ; if the zone isn't stuffed, it's not locked. abort! 2893 f324 - lda DLPOINTL,x 2894 f324 - ifconst DOUBLEBUFFER 2895 f324 - clc 2896 f324 - adc doublebufferdloffset 2897 f324 - endif ; DOUBLEBUFFER 2898 f324 - sta dlpnt 2899 f324 - lda DLPOINTH,x 2900 f324 - ifconst DOUBLEBUFFER 2901 f324 - adc #0 2902 f324 - endif ; DOUBLEBUFFER 2903 f324 - sta dlpnt+1 2904 f324 - dey 2905 f324 - ;ldy #(DLLASTOBJ-1) 2906 f324 - lda (dlpnt),y 2907 f324 - tay 2908 f324 - sty dlend,x 2909 f324 -unlockzonexreturn 2910 f324 endif ; ZONELOCKS 2911 f324 60 rts 2912 f325 2913 f325 plotcharloop 2914 f325 ; ** read from a data indirectly pointed to from temp8,temp9 2915 f325 ; ** format is: lo_data, hi_data, palette|width, x, y 2916 f325 ; ** format ends with lo_data | hi_data = 0 2917 f325 2918 f325 - ifconst DOUBLEBUFFER 2919 f325 - lda doublebufferstate 2920 f325 - bne skipplotcharloopwait 2921 f325 endif ; DOUBLEBUFFER 2922 f325 - ifconst DEBUGWAITCOLOR 2923 f325 - lda #$61 2924 f325 - sta BACKGRND 2925 f325 endif 2926 f325 plotcharloopwait 2927 f325 a5 4d lda visibleover 2928 f327 d0 fc bne plotcharloopwait 2929 f329 - ifconst DEBUGWAITCOLOR 2930 f329 - lda #0 2931 f329 - sta BACKGRND 2932 f329 endif 2933 f329 skipplotcharloopwait 2934 f329 plotcharlooploop 2935 f329 a0 00 ldy #0 2936 f32b b1 49 lda (temp8),y 2937 f32d 85 42 sta temp1 2938 f32f c8 iny 2939 f330 b1 49 lda (temp8),y 2940 f332 85 43 sta temp2 2941 f334 05 42 ora temp1 2942 f336 d0 01 bne plotcharloopcontinue 2943 f338 ;the pointer=0, so return 2944 f338 60 rts 2945 f339 plotcharloopcontinue 2946 f339 c8 iny 2947 f33a b1 49 lda (temp8),y 2948 f33c 85 44 sta temp3 2949 f33e c8 iny 2950 f33f b1 49 lda (temp8),y 2951 f341 85 45 sta temp4 2952 f343 c8 iny 2953 f344 b1 49 lda (temp8),y 2954 f346 ;sta temp5 ; not needed with our late entry. 2955 f346 20 5f f3 jsr plotcharactersskipentry 2956 f349 a5 49 lda temp8 2957 f34b 18 clc 2958 f34c 69 05 adc #5 2959 f34e 85 49 sta temp8 2960 f350 a5 4a lda temp9 2961 f352 69 00 adc #0 2962 f354 85 4a sta temp9 2963 f356 4c 29 f3 jmp plotcharlooploop 2964 f359 2965 f359 plotcharacters 2966 f359 - ifconst DOUBLEBUFFER 2967 f359 - lda doublebufferstate 2968 f359 - bne skipplotcharacterswait 2969 f359 endif ; DOUBLEBUFFER 2970 f359 - ifconst DEBUGWAITCOLOR 2971 f359 - lda #$41 2972 f359 - sta BACKGRND 2973 f359 endif 2974 f359 plotcharacterswait 2975 f359 a5 4d lda visibleover 2976 f35b d0 fc bne plotcharacterswait 2977 f35d - ifconst DEBUGWAITCOLOR 2978 f35d - sta BACKGRND 2979 f35d endif 2980 f35d skipplotcharacterswait 2981 f35d ;arguments: 2982 f35d ; temp1=lo charactermap 2983 f35d ; temp2=hi charactermap 2984 f35d ; temp3=palette | width byte 2985 f35d ; temp4=x 2986 f35d ; temp5=y 2987 f35d 2988 f35d a5 46 lda temp5 ;Y position 2989 f35f 2990 f35f plotcharactersskipentry 2991 f35f 2992 f35f ;ifconst ZONEHEIGHT 2993 f35f ; if ZONEHEIGHT = 16 2994 f35f ; and #$0F 2995 f35f ; endif 2996 f35f ; if ZONEHEIGHT = 8 2997 f35f ; and #$1F 2998 f35f ; endif 2999 f35f ;else 3000 f35f ; and #$0F 3001 f35f ;endif 3002 f35f 3003 f35f aa tax 3004 f360 bd 4c f6 lda DLPOINTL,x ;Get pointer to DL that the characters are in 3005 f363 - ifconst DOUBLEBUFFER 3006 f363 - clc 3007 f363 - adc doublebufferdloffset 3008 f363 endif ; DOUBLEBUFFER 3009 f363 85 63 sta dlpnt 3010 f365 bd 30 f6 lda DLPOINTH,x 3011 f368 - ifconst DOUBLEBUFFER 3012 f368 - adc #0 3013 f368 endif ; DOUBLEBUFFER 3014 f368 85 64 sta dlpnt+1 3015 f36a 3016 f36a ;Create DL entry for the characters 3017 f36a 3018 f36a b4 65 ldy dlend,x ;Get the index to the end of this DL 3019 f36c 3020 f36c ifconst CHECKOVERWRITE 3021 f36c c0 41 cpy #DLLASTOBJ 3022 f36e d0 01 bne continueplotcharacters 3023 f370 60 rts 3024 f371 continueplotcharacters 3025 f371 endif 3026 f371 3027 f371 a5 42 lda temp1 ; character map data, lo byte 3028 f373 91 63 sta (dlpnt),y ;(1) store low address 3029 f375 3030 f375 c8 iny 3031 f376 ad 06 21 lda charactermode 3032 f379 91 63 sta (dlpnt),y ;(2) store mode 3033 f37b 3034 f37b c8 iny 3035 f37c a5 43 lda temp2 ; character map, hi byte 3036 f37e 91 63 sta (dlpnt),y ;(3) store high address 3037 f380 3038 f380 c8 iny 3039 f381 a5 44 lda temp3 ;palette|width 3040 f383 91 63 sta (dlpnt),y ;(4) store palette|width 3041 f385 3042 f385 c8 iny 3043 f386 a5 45 lda temp4 ;Horizontal position 3044 f388 91 63 sta (dlpnt),y ;(5) store horizontal position 3045 f38a 3046 f38a c8 iny 3047 f38b 94 65 sty dlend,x ; save display list end byte 3048 f38d 60 rts 3049 f38e 3050 f38e 3051 f38e - ifconst plotvalueonscreen 3052 f38e -plotcharacterslive 3053 f38e - ; a version of plotcharacters that draws live and minimally disrupts the screen... 3054 f38e - 3055 f38e - ;arguments: 3056 f38e - ; temp1=lo charactermap 3057 f38e - ; temp2=hi charactermap 3058 f38e - ; temp3=palette | width byte 3059 f38e - ; temp4=x 3060 f38e - ; temp5=y 3061 f38e - 3062 f38e - lda temp5 ;Y position 3063 f38e - 3064 f38e - tax 3065 f38e - lda DLPOINTL,x ;Get pointer to DL that the characters are in 3066 f38e - ifconst DOUBLEBUFFER 3067 f38e - clc 3068 f38e - adc doublebufferdloffset 3069 f38e - endif ; DOUBLEBUFFER 3070 f38e - sta dlpnt 3071 f38e - lda DLPOINTH,x 3072 f38e - ifconst DOUBLEBUFFER 3073 f38e - adc #0 3074 f38e - endif ; DOUBLEBUFFER 3075 f38e - sta dlpnt+1 3076 f38e - 3077 f38e - ;Create DL entry for the characters 3078 f38e - 3079 f38e - ldy dlend,x ;Get the index to the end of this DL 3080 f38e - 3081 f38e - ifconst CHECKOVERWRITE 3082 f38e - cpy #DLLASTOBJ 3083 f38e - bne continueplotcharacterslive 3084 f38e - rts 3085 f38e -continueplotcharacterslive 3086 f38e - endif 3087 f38e - 3088 f38e - lda temp1 ; character map data, lo byte 3089 f38e - sta (dlpnt),y ;(1) store low address 3090 f38e - 3091 f38e - iny 3092 f38e - ; we don't add the second byte yet, since the charmap could briefly 3093 f38e - ; render without a proper character map address, width, or position. 3094 f38e - lda charactermode 3095 f38e - sta (dlpnt),y ;(2) store mode 3096 f38e - 3097 f38e - iny 3098 f38e - lda temp2 ; character map, hi byte 3099 f38e - sta (dlpnt),y ;(3) store high address 3100 f38e - 3101 f38e - iny 3102 f38e - lda temp3 ;palette|width 3103 f38e - sta (dlpnt),y ;(4) store palette|width 3104 f38e - 3105 f38e - iny 3106 f38e - lda temp4 ;Horizontal position 3107 f38e - sta (dlpnt),y ;(5) store horizontal position 3108 f38e - 3109 f38e - iny 3110 f38e - sty dlend,x ; save display list end byte 3111 f38e - 3112 f38e - rts 3113 f38e endif ;plotcharacterslive 3114 f38e 3115 f38e ifconst USED_PLOTVALUE 3116 f38e plotvalue 3117 f38e ; calling 7800basic command: 3118 f38e ; plotvalue digit_gfx palette variable/data number_of_digits screen_x screen_y 3119 f38e ; ...displays the variable as BCD digits 3120 f38e ; 3121 f38e ; asm sub arguments: 3122 f38e ; temp1=lo charactermap 3123 f38e ; temp2=hi charactermap 3124 f38e ; temp3=palette | width byte 3125 f38e ; temp4=x 3126 f38e ; temp5=y 3127 f38e ; temp6=number of digits 3128 f38e ; temp7=lo variable 3129 f38e ; temp8=hi variable 3130 f38e ; temp9=character mode 3131 f38e 3132 f38e 00 47 plotdigitcount = temp6 3133 f38e 3134 f38e - ifconst ZONELOCKS 3135 f38e - ldx temp5 3136 f38e - ldy dlend,x 3137 f38e - cpy #DLLASTOBJ 3138 f38e - bne carryonplotvalue 3139 f38e - rts 3140 f38e -carryonplotvalue 3141 f38e endif 3142 f38e 3143 f38e a9 00 lda #0 3144 f390 a8 tay 3145 f391 ae ad 01 ldx valbufend 3146 f394 3147 f394 a5 47 lda plotdigitcount 3148 f396 29 01 and #1 3149 f398 f0 07 beq pvnibble2char 3150 f39a a9 00 lda #0 3151 f39c 9d 00 20 sta VALBUFFER,x ; just in case we skip this digit 3152 f39f f0 10 beq pvnibble2char_skipnibble 3153 f3a1 3154 f3a1 pvnibble2char 3155 f3a1 ; high nibble... 3156 f3a1 b1 48 lda (temp7),y 3157 f3a3 29 f0 and #$f0 3158 f3a5 4a lsr 3159 f3a6 4a lsr 3160 f3a7 4a lsr 3161 f3a8 - ifnconst DOUBLEWIDE ; multiply value by 2 for double-width 3162 f3a8 - lsr 3163 f3a8 endif 3164 f3a8 3165 f3a8 18 clc 3166 f3a9 65 42 adc temp1 ; add the offset to character graphics to our value 3167 f3ab 9d 00 20 sta VALBUFFER,x 3168 f3ae e8 inx 3169 f3af c6 47 dec plotdigitcount 3170 f3b1 3171 f3b1 pvnibble2char_skipnibble 3172 f3b1 ; low nibble... 3173 f3b1 b1 48 lda (temp7),y 3174 f3b3 29 0f and #$0f 3175 f3b5 ifconst DOUBLEWIDE ; multiply value by 2 for double-width 3176 f3b5 0a asl 3177 f3b6 endif 3178 f3b6 18 clc 3179 f3b7 65 42 adc temp1 ; add the offset to character graphics to our value 3180 f3b9 9d 00 20 sta VALBUFFER,x 3181 f3bc e8 inx 3182 f3bd c8 iny 3183 f3be 3184 f3be c6 47 dec plotdigitcount 3185 f3c0 d0 df bne pvnibble2char 3186 f3c2 3187 f3c2 ;point to the start of our valuebuffer 3188 f3c2 18 clc 3189 f3c3 a9 00 lda #VALBUFFER 3193 f3cc 69 00 adc #0 3194 f3ce 85 43 sta temp2 3195 f3d0 3196 f3d0 ;advance valbufend to the end of our value buffer 3197 f3d0 8e ad 01 stx valbufend 3198 f3d3 3199 f3d3 ifnconst plotvalueonscreen 3200 f3d3 4c 59 f3 jmp plotcharacters 3201 f3d6 - else 3202 f3d6 - jmp plotcharacterslive 3203 f3d6 endif 3204 f3d6 3205 f3d6 endif ; USED_PLOTVALUE 3206 f3d6 3207 f3d6 3208 f3d6 - ifconst USED_PLOTVALUEEXTRA 3209 f3d6 -plotdigitcount = temp6 3210 f3d6 -plotvalueextra 3211 f3d6 - ; calling 7800basic command: 3212 f3d6 - ; plotvalue digit_gfx palette variable/data number_of_digits screen_x screen_y 3213 f3d6 - ; ...displays the variable as BCD digits 3214 f3d6 - ; 3215 f3d6 - ; asm sub arguments: 3216 f3d6 - ; temp1=lo charactermap 3217 f3d6 - ; temp2=hi charactermap 3218 f3d6 - ; temp3=palette | width byte 3219 f3d6 - ; temp4=x 3220 f3d6 - ; temp5=y 3221 f3d6 - ; temp6=number of digits 3222 f3d6 - ; temp7=lo variable 3223 f3d6 - ; temp8=hi variable 3224 f3d6 - 3225 f3d6 - lda #0 3226 f3d6 - tay 3227 f3d6 - ldx valbufend 3228 f3d6 - ifnconst plotvalueonscreen 3229 f3d6 - sta VALBUFFER,x 3230 f3d6 - endif 3231 f3d6 - 3232 f3d6 - lda plotdigitcount 3233 f3d6 - and #1 3234 f3d6 - 3235 f3d6 - bne pvnibble2char_skipnibbleextra 3236 f3d6 - 3237 f3d6 -pvnibble2charextra 3238 f3d6 - ; high nibble... 3239 f3d6 - lda (temp7),y 3240 f3d6 - and #$f0 3241 f3d6 - lsr 3242 f3d6 - lsr 3243 f3d6 - ifnconst DOUBLEWIDE ; multiply value by 2 for double-width 3244 f3d6 - lsr 3245 f3d6 - endif 3246 f3d6 - clc 3247 f3d6 - adc temp1 ; add the offset to character graphics to our value 3248 f3d6 - sta VALBUFFER,x 3249 f3d6 - inx 3250 f3d6 - 3251 f3d6 - ; second half of the digit 3252 f3d6 - clc 3253 f3d6 - adc #1 3254 f3d6 - sta VALBUFFER,x 3255 f3d6 - inx 3256 f3d6 - 3257 f3d6 -pvnibble2char_skipnibbleextra 3258 f3d6 - ; low nibble... 3259 f3d6 - lda (temp7),y 3260 f3d6 - and #$0f 3261 f3d6 - ifconst DOUBLEWIDE ; multiply value by 2 for double-width 3262 f3d6 - asl 3263 f3d6 - endif 3264 f3d6 - asl 3265 f3d6 - 3266 f3d6 - clc 3267 f3d6 - adc temp1 ; add the offset to character graphics to our value 3268 f3d6 - sta VALBUFFER,x 3269 f3d6 - inx 3270 f3d6 - 3271 f3d6 - clc 3272 f3d6 - adc #1 3273 f3d6 - sta VALBUFFER,x 3274 f3d6 - inx 3275 f3d6 - iny 3276 f3d6 - 3277 f3d6 - dec plotdigitcount 3278 f3d6 - bne pvnibble2charextra 3279 f3d6 - 3280 f3d6 - ;point to the start of our valuebuffer 3281 f3d6 - clc 3282 f3d6 - lda #VALBUFFER 3286 f3d6 - adc #0 3287 f3d6 - sta temp2 3288 f3d6 - 3289 f3d6 - ;advance valbufend to the end of our value buffer 3290 f3d6 - stx valbufend 3291 f3d6 - 3292 f3d6 - ifnconst plotvalueonscreen 3293 f3d6 - jmp plotcharacters 3294 f3d6 - else 3295 f3d6 - jmp plotcharacterslive 3296 f3d6 - endif 3297 f3d6 endif ; USED_PLOTVALUEEXTRA 3298 f3d6 3299 f3d6 boxcollision 3300 f3d6 ; the worst case cycle-time for the code below is 43 cycles. 3301 f3d6 ; unfortunately, prior to getting here we've burned 44 cycles in argument setup. eep! 3302 f3d6 3303 f3d6 ;__boxx1 = accumulator 3304 f3d6 ;__boxy1 = y 3305 f3d6 00 44 __boxw1 = temp3 3306 f3d6 00 45 __boxh1 = temp4 3307 f3d6 3308 f3d6 00 46 __boxx2 = temp5 3309 f3d6 00 47 __boxy2 = temp6 3310 f3d6 00 48 __boxw2 = temp7 3311 f3d6 00 49 __boxh2 = temp8 3312 f3d6 3313 f3d6 DoXCollisionCheck 3314 f3d6 ;lda __boxx1 ; skipped. already in the accumulator 3315 f3d6 c5 46 cmp __boxx2 ;3 3316 f3d8 b0 07 bcs X1isbiggerthanX2 ;2/3 3317 f3da X2isbiggerthanX1 3318 f3da ; carry is clear 3319 f3da 65 44 adc __boxw1 ;3 3320 f3dc c5 46 cmp __boxx2 ;3 3321 f3de b0 08 bcs DoYCollisionCheck ;3/2 3322 f3e0 60 rts ;6 - carry clear, no collision 3323 f3e1 X1isbiggerthanX2 3324 f3e1 18 clc ;2 3325 f3e2 e5 48 sbc __boxw2 ;3 3326 f3e4 c5 46 cmp __boxx2 ;3 3327 f3e6 b0 13 bcs noboxcollision ;3/2 3328 f3e8 DoYCollisionCheck 3329 f3e8 98 tya ; 2 ; use to be "lda __boxy1" 3330 f3e9 c5 47 cmp __boxy2 ;3 3331 f3eb b0 05 bcs Y1isbiggerthanY2 ;3/2 3332 f3ed Y2isbiggerthanY1 3333 f3ed ; carry is clear 3334 f3ed 65 45 adc __boxh1 ;3 3335 f3ef c5 47 cmp __boxy2 ;3 3336 f3f1 60 rts ;6 3337 f3f2 Y1isbiggerthanY2 3338 f3f2 18 clc ;2 3339 f3f3 e5 49 sbc __boxh2 ;3 3340 f3f5 c5 47 cmp __boxy2 ;3 3341 f3f7 b0 02 bcs noboxcollision ;3/2 3342 f3f9 yesboxcollision 3343 f3f9 38 sec ;2 3344 f3fa 60 rts ;6 3345 f3fb noboxcollision 3346 f3fb 18 clc ;2 3347 f3fc 60 rts ;6 3348 f3fd 3349 f3fd randomize 3350 f3fd a5 40 lda rand 3351 f3ff 4a lsr 3352 f400 26 41 rol rand16 3353 f402 90 02 bcc noeor 3354 f404 49 b4 eor #$B4 3355 f406 noeor 3356 f406 85 40 sta rand 3357 f408 45 41 eor rand16 3358 f40a 60 rts 3359 f40b 3360 f40b ; *** bcd conversion routine courtesy Omegamatrix 3361 f40b ; *** http://atariage.com/forums/blog/563/entry-10832-hex-to-bcd-conversion-0-99/ 3362 f40b converttobcd 3363 f40b ;value to convert is in the accumulator 3364 f40b 85 42 sta temp1 3365 f40d 4a lsr 3366 f40e 65 42 adc temp1 3367 f410 6a ror 3368 f411 4a lsr 3369 f412 4a lsr 3370 f413 65 42 adc temp1 3371 f415 6a ror 3372 f416 65 42 adc temp1 3373 f418 6a ror 3374 f419 4a lsr 3375 f41a 29 3c and #$3C 3376 f41c 85 43 sta temp2 3377 f41e 4a lsr 3378 f41f 65 43 adc temp2 3379 f421 65 42 adc temp1 3380 f423 60 rts ; return the result in the accumulator 3381 f424 3382 f424 ; Y and A contain multiplicands, result in A 3383 f424 mul8 3384 f424 84 42 sty temp1 3385 f426 85 43 sta temp2 3386 f428 a9 00 lda #0 3387 f42a reptmul8 3388 f42a 46 43 lsr temp2 3389 f42c 90 03 bcc skipmul8 3390 f42e 18 clc 3391 f42f 65 42 adc temp1 3392 f431 ;bcs donemul8 might save cycles? 3393 f431 skipmul8 3394 f431 ;beq donemul8 might save cycles? 3395 f431 06 42 asl temp1 3396 f433 d0 f5 bne reptmul8 3397 f435 donemul8 3398 f435 60 rts 3399 f436 3400 f436 div8 3401 f436 ; A=numerator Y=denominator, result in A 3402 f436 c0 02 cpy #2 3403 f438 90 0a bcc div8end+1 ;div by 0 = bad, div by 1=no calc needed, so bail out 3404 f43a 84 42 sty temp1 3405 f43c a0 ff ldy #$ff 3406 f43e div8loop 3407 f43e e5 42 sbc temp1 3408 f440 c8 iny 3409 f441 b0 fb bcs div8loop 3410 f443 div8end 3411 f443 98 tya 3412 f444 ; result in A 3413 f444 60 rts 3414 f445 3415 f445 ; Y and A contain multiplicands, result in temp2,A=low, temp1=high 3416 f445 mul16 3417 f445 84 42 sty temp1 3418 f447 85 43 sta temp2 3419 f449 3420 f449 a9 00 lda #0 3421 f44b a2 08 ldx #8 3422 f44d 46 42 lsr temp1 3423 f44f mul16_1 3424 f44f 90 03 bcc mul16_2 3425 f451 18 clc 3426 f452 65 43 adc temp2 3427 f454 mul16_2 3428 f454 6a ror 3429 f455 66 42 ror temp1 3430 f457 ca dex 3431 f458 d0 f5 bne mul16_1 3432 f45a 85 43 sta temp2 3433 f45c 60 rts 3434 f45d 3435 f45d ; div int/int 3436 f45d ; numerator in A, denom in temp1 3437 f45d ; returns with quotient in A, remainder in temp1 3438 f45d div16 3439 f45d 85 43 sta temp2 3440 f45f 84 42 sty temp1 3441 f461 a9 00 lda #0 3442 f463 a2 08 ldx #8 3443 f465 06 43 asl temp2 3444 f467 div16_1 3445 f467 2a rol 3446 f468 c5 42 cmp temp1 3447 f46a 90 02 bcc div16_2 3448 f46c e5 42 sbc temp1 3449 f46e div16_2 3450 f46e 26 43 rol temp2 3451 f470 ca dex 3452 f471 d0 f4 bne div16_1 3453 f473 85 42 sta temp1 3454 f475 a5 43 lda temp2 3455 f477 60 rts 3456 f478 3457 f478 - ifconst bankswitchmode 3458 f478 -BS_jsr 3459 f478 - ifconst MCPDEVCART 3460 f478 - ora #$18 3461 f478 - sta $3000 3462 f478 - else 3463 f478 - sta $8000 3464 f478 - endif 3465 f478 - pla 3466 f478 - tax 3467 f478 - pla 3468 f478 - rts 3469 f478 - 3470 f478 -BS_return 3471 f478 - pla ; bankswitch bank 3472 f478 - ifconst BANKRAM 3473 f478 - sta currentbank 3474 f478 - ora currentrambank 3475 f478 - endif 3476 f478 - ifconst MCPDEVCART 3477 f478 - ora #$18 3478 f478 - sta $3000 3479 f478 - else 3480 f478 - sta $8000 3481 f478 - endif 3482 f478 - pla ; bankswitch $0 flag 3483 f478 - rts 3484 f478 endif 3485 f478 3486 f478 checkselectswitch 3487 f478 ad 82 02 lda SWCHB ; first check the real select switch... 3488 f47b 29 02 and #%00000010 3489 f47d ifnconst MOUSESUPPORT 3490 f47d f0 05 beq checkselectswitchreturn ; switch is pressed 3491 f47f ad 80 02 lda SWCHA ; then check the soft "select" joysick code... 3492 f482 29 b0 and #%10110000 ; R_DU 3493 f484 endif ; MOUSESUPPORT 3494 f484 checkselectswitchreturn 3495 f484 60 rts 3496 f485 3497 f485 checkresetswitch 3498 f485 ad 82 02 lda SWCHB ; first check the real reset switch... 3499 f488 29 01 and #%00000001 3500 f48a ifnconst MOUSESUPPORT 3501 f48a f0 05 beq checkresetswitchreturn ; switch is pressed 3502 f48c ad 80 02 lda SWCHA ; then check the soft "reset" joysick code... 3503 f48f 29 70 and #%01110000 ; _LDU 3504 f491 endif ; MOUSESUPPORT 3505 f491 checkresetswitchreturn 3506 f491 60 rts 3507 f492 3508 f492 - ifconst FINESCROLLENABLED 3509 f492 -finescrolldlls 3510 f492 - ldx temp1 ; first DLL index x3 3511 f492 - lda DLLMEM,x 3512 f492 - and #%11110000 3513 f492 - ora finescrolly 3514 f492 - sta DLLMEM,x 3515 f492 - 3516 f492 - ldx temp2 ; last DLL index x3 3517 f492 - lda DLLMEM,x 3518 f492 - and #%11110000 3519 f492 - ora finescrolly 3520 f492 - eor #(WZONEHEIGHT-1) 3521 f492 - sta DLLMEM,x 3522 f492 - rts 3523 f492 endif ; FINESCROLLENABLED 3524 f492 3525 f492 - ifconst USED_ADJUSTVISIBLE 3526 f492 -adjustvisible 3527 f492 - ; called with temp1=first visible zone *3, temp2=last visible zone *3 3528 f492 - jsr waitforvblankstart ; ensure vblank just started 3529 f492 - ldx visibleDLLstart 3530 f492 -findfirstinterrupt 3531 f492 - lda DLLMEM,x 3532 f492 - bmi foundfirstinterrupt 3533 f492 - inx 3534 f492 - inx 3535 f492 - inx 3536 f492 - bne findfirstinterrupt 3537 f492 -foundfirstinterrupt 3538 f492 - and #%01111111 ; clear the interrupt bit 3539 f492 - sta DLLMEM,x 3540 f492 - ifconst DOUBLEBUFFER 3541 f492 - sta DLLMEM+DBOFFSET,x 3542 f492 - endif ; DOUBLEBUFFER 3543 f492 - ldx overscanDLLstart 3544 f492 -findlastinterrupt 3545 f492 - lda DLLMEM,x 3546 f492 - bmi foundlastinterrupt 3547 f492 - dex 3548 f492 - dex 3549 f492 - dex 3550 f492 - bne findlastinterrupt 3551 f492 -foundlastinterrupt 3552 f492 - and #%01111111 ; clear the interrupt bit 3553 f492 - sta DLLMEM,x 3554 f492 - ifconst DOUBLEBUFFER 3555 f492 - sta DLLMEM+DBOFFSET,x 3556 f492 - endif ; DOUBLEBUFFER 3557 f492 - ;now we need to set the new interrupts 3558 f492 - clc 3559 f492 - lda temp1 3560 f492 - adc visibleDLLstart 3561 f492 - tax 3562 f492 - lda DLLMEM,x 3563 f492 - ora #%10000000 3564 f492 - sta DLLMEM,x 3565 f492 - ifconst DOUBLEBUFFER 3566 f492 - sta DLLMEM+DBOFFSET,x 3567 f492 - endif ; DOUBLEBUFFER 3568 f492 - clc 3569 f492 - lda temp2 3570 f492 - adc visibleDLLstart 3571 f492 - tax 3572 f492 - lda DLLMEM,x 3573 f492 - ora #%10000000 3574 f492 - sta DLLMEM,x 3575 f492 - ifconst DOUBLEBUFFER 3576 f492 - sta DLLMEM+DBOFFSET,x 3577 f492 - endif ; DOUBLEBUFFER 3578 f492 - jsr vblankresync 3579 f492 - rts 3580 f492 endif ; USED_ADJUSTVISIBLE 3581 f492 3582 f492 vblankresync 3583 f492 20 30 f5 jsr waitforvblankstart ; ensure vblank just started 3584 f495 a9 00 lda #0 3585 f497 85 4d sta visibleover 3586 f499 a9 03 lda #3 3587 f49b 8d b2 01 sta interruptindex 3588 f49e 60 rts 3589 f49f 3590 f49f createallgamedlls 3591 f49f a2 00 ldx #0 3592 f4a1 a9 09 lda #NVLINES 3593 f4a3 ac 09 21 ldy paldetected 3594 f4a6 f0 03 beq skipcreatePALpadding 3595 f4a8 18 clc 3596 f4a9 69 15 adc #21 3597 f4ab skipcreatePALpadding 3598 f4ab 20 e0 f4 jsr createnonvisibledlls 3599 f4ae 8e 3c 21 stx visibleDLLstart 3600 f4b1 20 11 f5 jsr createvisiblezones 3601 f4b4 8e 3d 21 stx overscanDLLstart 3602 f4b7 createallgamedllscontinue 3603 f4b7 a9 40 lda #(NVLINES+55) ; extras for PAL 3604 f4b9 20 e0 f4 jsr createnonvisibledlls 3605 f4bc 3606 f4bc ae 3c 21 ldx visibleDLLstart 3607 f4bf bd 00 18 lda DLLMEM,x 3608 f4c2 09 80 ora #%10000000 ; NMI 1 - start of visible screen 3609 f4c4 9d 00 18 sta DLLMEM,x 3610 f4c7 - ifconst DOUBLEBUFFER 3611 f4c7 - sta DLLMEM+DBOFFSET,x 3612 f4c7 endif ; DOUBLEBUFFER 3613 f4c7 3614 f4c7 ae 3d 21 ldx overscanDLLstart 3615 f4ca bd 00 18 lda DLLMEM,x 3616 f4cd 09 83 ora #%10000011 ; NMI 2 - end of visible screen 3617 f4cf 29 f3 and #%11110011 ; change this to a 1-line DLL, so there's time enough for the "deeper overscan" DLL 3618 f4d1 9d 00 18 sta DLLMEM,x 3619 f4d4 - ifconst DOUBLEBUFFER 3620 f4d4 - sta DLLMEM+DBOFFSET,x 3621 f4d4 endif ; DOUBLEBUFFER 3622 f4d4 3623 f4d4 e8 inx 3624 f4d5 e8 inx 3625 f4d6 e8 inx 3626 f4d7 3627 f4d7 bd 00 18 lda DLLMEM,x 3628 f4da 09 80 ora #%10000000 ; NMI 3 - deeper overscan 3629 f4dc 9d 00 18 sta DLLMEM,x 3630 f4df - ifconst DOUBLEBUFFER 3631 f4df - sta DLLMEM+DBOFFSET,x 3632 f4df endif ; DOUBLEBUFFER 3633 f4df 3634 f4df 60 rts 3635 f4e0 3636 f4e0 createnonvisibledlls 3637 f4e0 85 42 sta temp1 3638 f4e2 4a lsr 3639 f4e3 4a lsr 3640 f4e4 4a lsr 3641 f4e5 4a lsr ; /16 3642 f4e6 f0 09 beq skipcreatenonvisibledlls1loop 3643 f4e8 a8 tay 3644 f4e9 createnonvisibledlls1loop 3645 f4e9 a9 4f lda #%01001111 ;low nibble=16 lines, high nibble=Holey DMA 3646 f4eb 20 00 f5 jsr createblankdllentry 3647 f4ee 88 dey 3648 f4ef d0 f8 bne createnonvisibledlls1loop 3649 f4f1 skipcreatenonvisibledlls1loop 3650 f4f1 a5 42 lda temp1 3651 f4f3 29 0f and #%00001111 3652 f4f5 f0 08 beq createnonvisibledllsreturn 3653 f4f7 38 sec 3654 f4f8 e9 01 sbc #1 3655 f4fa 09 40 ora #%01000000 3656 f4fc 20 00 f5 jsr createblankdllentry 3657 f4ff createnonvisibledllsreturn 3658 f4ff 60 rts 3659 f500 3660 f500 createblankdllentry 3661 f500 9d 00 18 sta DLLMEM,x 3662 f503 - ifconst DOUBLEBUFFER 3663 f503 - sta DLLMEM+DBOFFSET,x 3664 f503 endif ; DOUBLEBUFFER 3665 f503 e8 inx 3666 f504 a9 21 lda #$21 ; blank 3667 f506 9d 00 18 sta DLLMEM,x 3668 f509 - ifconst DOUBLEBUFFER 3669 f509 - sta DLLMEM+DBOFFSET,x 3670 f509 endif ; DOUBLEBUFFER 3671 f509 e8 inx 3672 f50a a9 00 lda #$00 3673 f50c 9d 00 18 sta DLLMEM,x 3674 f50f - ifconst DOUBLEBUFFER 3675 f50f - sta DLLMEM+DBOFFSET,x 3676 f50f endif ; DOUBLEBUFFER 3677 f50f e8 inx 3678 f510 60 rts 3679 f511 3680 f511 createvisiblezones 3681 f511 a0 00 ldy #0 3682 f513 createvisiblezonesloop 3683 f513 b9 68 f6 lda.w DLHEIGHT,y 3684 f516 09 20 ora #(WZONEHEIGHT * 4) ; set Holey DMA for 8 or 16 tall zones 3685 f518 9d 00 18 sta DLLMEM,x 3686 f51b - ifconst DOUBLEBUFFER 3687 f51b - sta DLLMEM+DBOFFSET,x 3688 f51b endif ; DOUBLEBUFFER 3689 f51b e8 inx 3690 f51c b9 30 f6 lda DLPOINTH,y 3691 f51f 9d 00 18 sta DLLMEM,x 3692 f522 - ifconst DOUBLEBUFFER 3693 f522 - sta DLLMEM+DBOFFSET,x 3694 f522 endif ; DOUBLEBUFFER 3695 f522 e8 inx 3696 f523 b9 4c f6 lda DLPOINTL,y 3697 f526 9d 00 18 sta DLLMEM,x 3698 f529 - ifconst DOUBLEBUFFER 3699 f529 - clc 3700 f529 - adc #DOUBLEBUFFEROFFSET 3701 f529 - sta DLLMEM+DBOFFSET,x 3702 f529 - bcc skiphidoublebufferadjust ; dlls are big endian, so we need to fix the hi byte after-the-fact... 3703 f529 - inc DLLMEM+DBOFFSET-1,x 3704 f529 -skiphidoublebufferadjust 3705 f529 endif ; DOUBLEBUFFER 3706 f529 e8 inx 3707 f52a c8 iny 3708 f52b c0 1c cpy #WZONECOUNT 3709 f52d d0 e4 bne createvisiblezonesloop 3710 f52f 60 rts 3711 f530 3712 f530 waitforvblankstart 3713 f530 visibleoverwait 3714 f530 24 28 BIT MSTAT 3715 f532 10 fc bpl visibleoverwait 3716 f534 vblankstartwait 3717 f534 24 28 BIT MSTAT 3718 f536 30 fc bmi vblankstartwait 3719 f538 60 rts 3720 f539 3721 f539 - ifconst DOUBLEBUFFER 3722 f539 -flipdisplaybufferreturn 3723 f539 - rts 3724 f539 -flipdisplaybuffer 3725 f539 - lda doublebufferstate 3726 f539 - beq flipdisplaybufferreturn ; exit if we're not in double-buffer 3727 f539 - 3728 f539 - jsr terminatedisplaybuffer ; terminate the working buffer before we flip 3729 f539 - 3730 f539 - lda doublebufferstate 3731 f539 - lsr ; /2, so we'll see 0 or 1, rather than 1 or 3 3732 f539 - tax 3733 f539 - 3734 f539 - ; ensure we don't flip mid-display. otherwise the displayed DL will be the one the game is working on. 3735 f539 - 3736 f539 -flipdisplaybufferwait1 3737 f539 - lda visibleover 3738 f539 - beq flipdisplaybufferwait1 3739 f539 - 3740 f539 -flipdisplaybufferwait 3741 f539 - lda visibleover 3742 f539 - bne flipdisplaybufferwait 3743 f539 - 3744 f539 - lda doublebufferminimumframetarget 3745 f539 - beq skipminimumframecode 3746 f539 - lda doublebufferminimumframeindex 3747 f539 - bne flipdisplaybufferwait1 3748 f539 - lda doublebufferminimumframetarget 3749 f539 - sta doublebufferminimumframeindex 3750 f539 -skipminimumframecode 3751 f539 - 3752 f539 - lda DLLMEMLutHi,x 3753 f539 - sta DPPH 3754 f539 - lda DLLMEMLutLo,x 3755 f539 - sta DPPL 3756 f539 - 3757 f539 - lda NewPageflipstate,x 3758 f539 - sta doublebufferstate 3759 f539 - lda NewPageflipoffset,x 3760 f539 - sta doublebufferdloffset 3761 f539 - 3762 f539 - lda doublebufferbufferdirty 3763 f539 - beq flipdisplaybufferreturn 3764 f539 - 3765 f539 - ; The doublebuffer buffer is dirty, so the game code must have issued a savescreen recently. 3766 f539 - ; To make savescreen work with the new working buffer, we need to copy over the saved objects 3767 f539 - ; from the displayed buffer to the working buffer... 3768 f539 - 3769 f539 - lda doublebufferdloffset 3770 f539 - eor #DOUBLEBUFFEROFFSET 3771 f539 - sta temp6 ; make temp6 the anti-doublebufferdloffset variable 3772 f539 - 3773 f539 - ldx #(WZONECOUNT-1) 3774 f539 -copybufferzoneloop 3775 f539 - 3776 f539 - lda DLPOINTL,x 3777 f539 - clc 3778 f539 - adc doublebufferdloffset 3779 f539 - sta temp1 3780 f539 - lda DLPOINTH,x 3781 f539 - adc #0 3782 f539 - sta temp2 3783 f539 - 3784 f539 - lda DLPOINTL,x 3785 f539 - clc 3786 f539 - adc temp6 3787 f539 - sta temp3 3788 f539 - lda DLPOINTH,x 3789 f539 - adc #0 3790 f539 - sta temp4 3791 f539 - 3792 f539 - lda dlendsave,x 3793 f539 - tay 3794 f539 -copybuffercharsloop 3795 f539 - lda (temp3),y 3796 f539 - sta (temp1),y 3797 f539 - dey 3798 f539 - bpl copybuffercharsloop 3799 f539 - dex 3800 f539 - bpl copybufferzoneloop 3801 f539 - lda #0 3802 f539 - sta doublebufferbufferdirty 3803 f539 - rts 3804 f539 - 3805 f539 -doublebufferoff 3806 f539 - lda #1 3807 f539 - sta doublebufferstate 3808 f539 - jsr flipdisplaybuffer 3809 f539 - lda #0 3810 f539 - sta doublebufferstate 3811 f539 - sta doublebufferdloffset 3812 f539 - rts 3813 f539 - 3814 f539 -DLLMEMLutLo 3815 f539 - .byte DLLMEM,>(DLLMEM+DBOFFSET) 3818 f539 -NewPageflipstate 3819 f539 - .byte 3,1 3820 f539 -NewPageflipoffset 3821 f539 - .byte DOUBLEBUFFEROFFSET,0 3822 f539 - 3823 f539 endif ; DOUBLEBUFFER 3824 f539 3825 f539 - ifconst MOUSESUPPORT 3826 f539 - 3827 f539 -rotationalcompare 3828 f539 - ; old = 00 01 10 11 3829 f539 - .byte $00, $01, $ff, $00 ; new=00 3830 f539 - .byte $ff, $00, $00, $01 ; new=01 3831 f539 - .byte $01, $00, $00, $ff ; new=10 3832 f539 - .byte $00, $ff, $01, $00 ; new=11 3833 f539 - 3834 f539 - ; 0000YyXx st mouse 3835 f539 - 3836 f539 - ; 0000xyXY amiga mouse 3837 f539 - 3838 f539 - ifconst MOUSEXONLY 3839 f539 -amigatoataribits ; swap bits 1 and 4... 3840 f539 - .byte %0000, %0000, %0010, %0010 3841 f539 - .byte %0000, %0000, %0010, %0010 3842 f539 - .byte %0001, %0001, %0011, %0011 3843 f539 - .byte %0001, %0001, %0011, %0011 3844 f539 - 3845 f539 - ; null change bits 3846 f539 - .byte %0000, %0001, %0010, %0011 3847 f539 - .byte %0000, %0001, %0010, %0011 3848 f539 - .byte %0000, %0001, %0010, %0011 3849 f539 - .byte %0000, %0001, %0010, %0011 3850 f539 - 3851 f539 - else ; !MOUSEXONLY 3852 f539 - 3853 f539 -amigatoataribits ; swap bits 1 and 4... 3854 f539 - .byte %0000, %1000, %0010, %1010 3855 f539 - .byte %0100, %1100, %0110, %1110 3856 f539 - .byte %0001, %1001, %0011, %1011 3857 f539 - .byte %0101, %1101, %0111, %1111 3858 f539 - ; null change bits 3859 f539 - .byte %0000, %0001, %0010, %0011 3860 f539 - .byte %0100, %0101, %0110, %0111 3861 f539 - .byte %1000, %1001, %1010, %1011 3862 f539 - .byte %1100, %1101, %1110, %1111 3863 f539 - endif ; !MOUSEXONLY 3864 f539 - 3865 f539 endif ; MOUSESUPPORT 3866 f539 3867 f539 mouse0update 3868 f539 - ifconst MOUSE0SUPPORT 3869 f539 - 3870 f539 -mousetableselect = inttemp2 3871 f539 -mousexdelta = inttemp3 3872 f539 -mouseydelta = inttemp4 3873 f539 -lastSWCHA = inttemp6 3874 f539 - 3875 f539 - ; 0000YyXx st mouse 3876 f539 - ; 0000xyXY amiga mouse 3877 f539 - 3878 f539 - lda #$ff 3879 f539 - sta lastSWCHA 3880 f539 - 3881 f539 - ldy port0control 3882 f539 - 3883 f539 - lda #%00010000 3884 f539 - cpy #9 ; AMIGA? 3885 f539 - bne skipamigabitsfix0 3886 f539 - lda #0 3887 f539 -skipamigabitsfix0 3888 f539 - sta mousetableselect 3889 f539 - ifconst DRIVINGBOOST 3890 f539 - cpy #6 ; DRIVING? 3891 f539 - bne skipdriving0setup 3892 f539 - ; swap mousex0 and mousey0. mousex seen by the 7800basic program 3893 f539 - ; trails the actual mousex0, so we can smoothly interpolate toward 3894 f539 - ; the actual position. This actual position is stored in mousey0 3895 f539 - ; after the driver has run. 3896 f539 - ldx mousex0 3897 f539 - lda mousey0 3898 f539 - stx mousey0 3899 f539 - sta mousex0 3900 f539 -skipdriving0setup 3901 f539 - endif ; DRIVINGBOOST 3902 f539 - 3903 f539 - lda #0 3904 f539 - sta mousexdelta 3905 f539 - sta mouseydelta 3906 f539 - 3907 f539 - ifnconst MOUSETIME 3908 f539 - ifnconst MOUSEXONLY 3909 f539 - lda #180 ; minimum for x+y 3910 f539 - else 3911 f539 - lda #100 ; minimum for just x 3912 f539 - endif 3913 f539 - else 3914 f539 - lda #MOUSETIME 3915 f539 - endif 3916 f539 - jsr SETTIM64T ; INTIM is in Y 3917 f539 - 3918 f539 -mouse0updateloop 3919 f539 - lda SWCHA 3920 f539 - asr #%11110000 ; Undocumented. A = A & #IMM, then LSR A. 3921 f539 - cmp lastSWCHA 3922 f539 - beq mouse0loopcondition 3923 f539 - sta lastSWCHA 3924 f539 - lsr 3925 f539 - lsr 3926 f539 - lsr 3927 f539 - 3928 f539 - ora mousetableselect ; atari/amiga decoding table selection 3929 f539 - 3930 f539 - ; st mice encode on different bits/joystick-lines than amiga mice... 3931 f539 - ; 0000YyXx st mouse 3932 f539 - ; 0000xyXY amiga mouse 3933 f539 - ; ...so can shuffle the amiga bits to reuse the st driver. 3934 f539 - tay 3935 f539 - lax amigatoataribits,y 3936 f539 - 3937 f539 - ifnconst MOUSEXONLY 3938 f539 - ; first the Y... 3939 f539 - and #%00001100 3940 f539 - ora mousecodey0 3941 f539 - tay 3942 f539 - lda rotationalcompare,y 3943 f539 - clc 3944 f539 - adc mouseydelta 3945 f539 - sta mouseydelta 3946 f539 - tya 3947 f539 - lsr 3948 f539 - lsr 3949 f539 - sta mousecodey0 3950 f539 - txa 3951 f539 - ; ...then the X... 3952 f539 - and #%00000011 3953 f539 - tax 3954 f539 - endif ; !MOUSEXONLY 3955 f539 - 3956 f539 - asl 3957 f539 - asl 3958 f539 - ora mousecodex0 3959 f539 - tay 3960 f539 - lda rotationalcompare,y 3961 f539 - adc mousexdelta ; carry was clear by previous ASL 3962 f539 - sta mousexdelta 3963 f539 - stx mousecodex0 3964 f539 -mouse0loopcondition 3965 f539 - lda TIMINT 3966 f539 - bpl mouse0updateloop 3967 f539 - 3968 f539 - ; *** adapt to selected device resolution. 3969 f539 - ldx port0control 3970 f539 - 3971 f539 - ifconst PRECISIONMOUSING 3972 f539 - ldy port0resolution 3973 f539 - bne mouse0halveddone 3974 f539 - cpx #6 ; half-resolution is no good for driving wheels 3975 f539 - beq mouse0halveddone 3976 f539 - ; resolution=0 is half mouse resolution, necessary for precision 3977 f539 - ; mousing on a 160x240 screen with a 1000 dpi mouse. 3978 f539 - 3979 f539 - lda mousexdelta 3980 f539 - cmp #$80 3981 f539 - ror ; do a signed divide by 2. 3982 f539 - clc 3983 f539 - adc mousex0 3984 f539 - sta mousex0 3985 f539 - ifnconst MOUSEXONLY 3986 f539 - lda mouseydelta 3987 f539 - clc 3988 f539 - adc mousey0 3989 f539 - sta mousey0 3990 f539 - endif 3991 f539 - ; at half resolution we just exit after updating x and y 3992 f539 - jmp LLRET0 3993 f539 -mouse0halveddone 3994 f539 - endif ; PRECISIONMOUSING 3995 f539 - 3996 f539 - ifnconst MOUSEXONLY 3997 f539 - asl mouseydelta ; *2 because Y resolution is finer 3998 f539 - ldy port0resolution 3999 f539 - dey 4000 f539 - lda #0 4001 f539 -mousey0resolutionfix 4002 f539 - clc 4003 f539 - adc mouseydelta 4004 f539 - dey 4005 f539 - bpl mousey0resolutionfix 4006 f539 - clc 4007 f539 - adc mousey0 4008 f539 - sta mousey0 4009 f539 - endif ; MOUSEXONLY 4010 f539 - 4011 f539 - ldy port0resolution 4012 f539 - dey 4013 f539 - lda #0 4014 f539 -mousex0resolutionfix 4015 f539 - clc 4016 f539 - adc mousexdelta 4017 f539 - dey 4018 f539 - bpl mousex0resolutionfix 4019 f539 - ifnconst DRIVINGBOOST 4020 f539 - clc 4021 f539 - adc mousex0 4022 f539 - sta mousex0 4023 f539 - else 4024 f539 - cpx #6 4025 f539 - beq carryonmouse0boost 4026 f539 - clc 4027 f539 - adc mousex0 4028 f539 - sta mousex0 4029 f539 - jmp LLRET0 4030 f539 -carryonmouse0boost 4031 f539 - sta mousexdelta 4032 f539 - clc 4033 f539 - adc mousecodey0 4034 f539 - sta mousecodey0 4035 f539 - clc 4036 f539 - adc mousex0 4037 f539 - tay ; save the target X 4038 f539 - adc mousey0 ; average in the smoothly-trailing X 4039 f539 - ror 4040 f539 - sta mousex0 ; mousex0 now has the smoothly trailing X 4041 f539 - sty mousey0 ; and mousey0 has the the target X 4042 f539 - 4043 f539 - ; check to see if the coordinate wrapped. If so, undo the averaging code. 4044 f539 - ; A has mousex0, the smoothly trailing X 4045 f539 - sbc mousey0 ; less the target X 4046 f539 - bpl skipabsolutedrive0 4047 f539 - eor #$ff 4048 f539 -skipabsolutedrive0 4049 f539 - cmp #64 ; just an unreasonably large change 4050 f539 - bcc skipdrivewrapfix0 4051 f539 - sty mousex0 ; if X wrapped, we catch the trailing X up to the target X 4052 f539 -skipdrivewrapfix0 4053 f539 - 4054 f539 - ; get rid of the tweening if the distance travelled was very small 4055 f539 - lda mousexdelta 4056 f539 - cmp port0resolution 4057 f539 - bcs skipbetweenfix0 4058 f539 - lda mousex0 4059 f539 - sta mousey0 4060 f539 -skipbetweenfix0 4061 f539 - 4062 f539 -drivingboostreductioncheck0 4063 f539 - ; The below code amounts to mousecodey0=mousecodey0-(mousecodey0/8) 4064 f539 - ; +ve mousecodey0 is converted to -ve to do the calculation, and then 4065 f539 - ; negated again because truncation during BCD math results in 4066 f539 - ; differing magnitudes, depending if the value is +ve or -ve. 4067 f539 -driving0fix 4068 f539 - lax mousecodey0 4069 f539 - cmp #$80 4070 f539 - bcs driving0skipnegate1 4071 f539 - eor #$FF 4072 f539 - adc #1 4073 f539 - sta mousecodey0 4074 f539 -driving0skipnegate1 4075 f539 - cmp #$80 4076 f539 - ror 4077 f539 - cmp #$80 4078 f539 - ror 4079 f539 - cmp #$80 4080 f539 - ror 4081 f539 - sta inttemp1 4082 f539 - lda mousecodey0 4083 f539 - sec 4084 f539 - sbc inttemp1 4085 f539 - cpx #$80 4086 f539 - bcs driving0skipnegate2 4087 f539 - eor #$FF 4088 f539 - adc #1 4089 f539 -driving0skipnegate2 4090 f539 - sta mousecodey0 4091 f539 -drivingboostdone0 4092 f539 - endif ; DRIVINGBOOST 4093 f539 - 4094 f539 - jmp LLRET0 4095 f539 - 4096 f539 endif ; MOUSE0SUPPORT 4097 f539 4098 f539 mouse1update 4099 f539 - ifconst MOUSE1SUPPORT 4100 f539 - 4101 f539 -mousetableselect = inttemp2 4102 f539 -mousexdelta = inttemp3 4103 f539 -mouseydelta = inttemp4 4104 f539 -lastSWCHA = inttemp6 4105 f539 - 4106 f539 - ; 0000YyXx st mouse 4107 f539 - ; 0000xyXY amiga mouse 4108 f539 - 4109 f539 - lda #$ff 4110 f539 - sta lastSWCHA 4111 f539 - 4112 f539 - ldy port1control 4113 f539 - 4114 f539 - lda #%00010000 4115 f539 - cpy #9 ; AMIGA? 4116 f539 - bne skipamigabitsfix1 4117 f539 - lda #0 4118 f539 -skipamigabitsfix1 4119 f539 - sta mousetableselect 4120 f539 - ifconst DRIVINGBOOST 4121 f539 - cpy #6 ; DRIVING? 4122 f539 - bne skipdriving1setup 4123 f539 - ; swap mousex1 and mousey1. mousex seen by the 7800basic program 4124 f539 - ; trails the actual mousex1, so we can smoothly interpolate toward 4125 f539 - ; the actual position. This actual position is stored in mousey1 4126 f539 - ; after the driver has run. 4127 f539 - ldx mousex1 4128 f539 - lda mousey1 4129 f539 - stx mousey1 4130 f539 - sta mousex1 4131 f539 -skipdriving1setup 4132 f539 - endif ; DRIVINGBOOST 4133 f539 - 4134 f539 - lda #0 4135 f539 - sta mousexdelta 4136 f539 - sta mouseydelta 4137 f539 - 4138 f539 - ifnconst MOUSETIME 4139 f539 - ifnconst MOUSEXONLY 4140 f539 - lda #180 ; minimum for x+y 4141 f539 - else 4142 f539 - lda #100 ; minimum for just x 4143 f539 - endif 4144 f539 - else 4145 f539 - lda #MOUSETIME 4146 f539 - endif 4147 f539 - jsr SETTIM64T ; INTIM is in Y 4148 f539 - 4149 f539 -mouse1updateloop 4150 f539 - lda SWCHA 4151 f539 - and #%00001111 4152 f539 - cmp lastSWCHA 4153 f539 - beq mouse1loopcondition 4154 f539 - sta lastSWCHA 4155 f539 - 4156 f539 - ora mousetableselect ; atari/amiga decoding table selection 4157 f539 - 4158 f539 - ; st mice encode on different bits/joystick-lines than amiga mice... 4159 f539 - ; 0000YyXx st mouse 4160 f539 - ; 0000xyXY amiga mouse 4161 f539 - ; ...so can shuffle the amiga bits to reuse the st driver. 4162 f539 - tay 4163 f539 - lax amigatoataribits,y 4164 f539 - 4165 f539 - ifnconst MOUSEXONLY 4166 f539 - ; first the Y... 4167 f539 - and #%00001100 4168 f539 - ora mousecodey1 4169 f539 - tay 4170 f539 - lda rotationalcompare,y 4171 f539 - clc 4172 f539 - adc mouseydelta 4173 f539 - sta mouseydelta 4174 f539 - tya 4175 f539 - lsr 4176 f539 - lsr 4177 f539 - sta mousecodey1 4178 f539 - txa 4179 f539 - ; ...then the X... 4180 f539 - and #%00000011 4181 f539 - tax 4182 f539 - endif ; !MOUSEXONLY 4183 f539 - 4184 f539 - asl 4185 f539 - asl 4186 f539 - ora mousecodex1 4187 f539 - tay 4188 f539 - lda rotationalcompare,y 4189 f539 - adc mousexdelta ; carry was clear by previous ASL 4190 f539 - sta mousexdelta 4191 f539 - stx mousecodex1 4192 f539 -mouse1loopcondition 4193 f539 - lda TIMINT 4194 f539 - bpl mouse1updateloop 4195 f539 - 4196 f539 - ; *** adapt to selected device resolution. 4197 f539 - ldx port1control 4198 f539 - 4199 f539 - ifconst PRECISIONMOUSING 4200 f539 - ldy port1resolution 4201 f539 - bne mouse1halveddone 4202 f539 - cpx #6 ; half-resolution is no good for driving wheels 4203 f539 - beq mouse1halveddone 4204 f539 - ; resolution=0 is half mouse resolution, necessary for precision 4205 f539 - ; mousing on a 160x240 screen with a 1000 dpi mouse. 4206 f539 - 4207 f539 - lda mousexdelta 4208 f539 - cmp #$80 4209 f539 - ror ; do a signed divide by 2. 4210 f539 - clc 4211 f539 - adc mousex1 4212 f539 - sta mousex1 4213 f539 - ifnconst MOUSEXONLY 4214 f539 - lda mouseydelta 4215 f539 - clc 4216 f539 - adc mousey1 4217 f539 - sta mousey1 4218 f539 - endif 4219 f539 - ; at half resolution we just exit after updating x and y 4220 f539 - jmp LLRET1 4221 f539 -mouse1halveddone 4222 f539 - endif ; PRECISIONMOUSING 4223 f539 - 4224 f539 - ifnconst MOUSEXONLY 4225 f539 - asl mouseydelta ; *2 because Y resolution is finer 4226 f539 - ldy port1resolution 4227 f539 - dey 4228 f539 - lda #0 4229 f539 -mousey1resolutionfix 4230 f539 - clc 4231 f539 - adc mouseydelta 4232 f539 - dey 4233 f539 - bpl mousey1resolutionfix 4234 f539 - clc 4235 f539 - adc mousey1 4236 f539 - sta mousey1 4237 f539 - endif ; MOUSEXONLY 4238 f539 - 4239 f539 - ldy port1resolution 4240 f539 - dey 4241 f539 - lda #0 4242 f539 -mousex1resolutionfix 4243 f539 - clc 4244 f539 - adc mousexdelta 4245 f539 - dey 4246 f539 - bpl mousex1resolutionfix 4247 f539 - ifnconst DRIVINGBOOST 4248 f539 - clc 4249 f539 - adc mousex1 4250 f539 - sta mousex1 4251 f539 - else 4252 f539 - cpx #6 4253 f539 - beq carryonmouse1boost 4254 f539 - clc 4255 f539 - adc mousex1 4256 f539 - sta mousex1 4257 f539 - jmp LLRET1 4258 f539 -carryonmouse1boost 4259 f539 - sta mousexdelta 4260 f539 - clc 4261 f539 - adc mousecodey1 4262 f539 - sta mousecodey1 4263 f539 - clc 4264 f539 - adc mousex1 4265 f539 - tay ; save the target X 4266 f539 - adc mousey1 ; average in the smoothly-trailing X 4267 f539 - ror 4268 f539 - sta mousex1 ; mousex0 now has the smoothly trailing X 4269 f539 - sty mousey1 ; and mousey0 has the the target X 4270 f539 - 4271 f539 - ; check to see if the coordinate wrapped. If so, undo the averaging code. 4272 f539 - ; A has mousex1, the smoothly trailing X 4273 f539 - sbc mousey1 ; less the target X 4274 f539 - bpl skipabsolutedrive1 4275 f539 - eor #$ff 4276 f539 -skipabsolutedrive1 4277 f539 - cmp #64 ; just an unreasonably large change 4278 f539 - bcc skipdrivewrapfix1 4279 f539 - sty mousex1 ; if X wrapped, we catch the trailing X up to the target X 4280 f539 -skipdrivewrapfix1 4281 f539 - 4282 f539 - ; get rid of the tweening if the distance travelled was very small 4283 f539 - lda mousexdelta 4284 f539 - cmp port1resolution 4285 f539 - bcs skipbetweenfix1 4286 f539 - lda mousex1 4287 f539 - sta mousey1 4288 f539 -skipbetweenfix1 4289 f539 - 4290 f539 -drivingboostreductioncheck1 4291 f539 - ; The below code amounts to mousecodey0=mousecodey0-(mousecodey0/8) 4292 f539 - ; +ve mousecodey0 is converted to -ve to do the calculation, and then 4293 f539 - ; negated again because truncation during BCD math results in 4294 f539 - ; differing magnitudes, depending if the value is +ve or -ve. 4295 f539 -driving1fix 4296 f539 - lax mousecodey1 4297 f539 - cmp #$80 4298 f539 - bcs driving0skipnegate1 4299 f539 - eor #$FF 4300 f539 - adc #1 4301 f539 - sta mousecodey1 4302 f539 -driving0skipnegate1 4303 f539 - cmp #$80 4304 f539 - ror 4305 f539 - cmp #$80 4306 f539 - ror 4307 f539 - cmp #$80 4308 f539 - ror 4309 f539 - sta inttemp1 4310 f539 - lda mousecodey1 4311 f539 - sec 4312 f539 - sbc inttemp1 4313 f539 - cpx #$80 4314 f539 - bcs driving1skipnegate2 4315 f539 - eor #$FF 4316 f539 - adc #1 4317 f539 -driving1skipnegate2 4318 f539 - sta mousecodey1 4319 f539 -drivingboostdone1 4320 f539 - endif ; DRIVINGBOOST 4321 f539 - 4322 f539 - jmp LLRET1 4323 f539 - 4324 f539 endif ; MOUSE1SUPPORT 4325 f539 4326 f539 4327 f539 trakball0update 4328 f539 - ifconst TRAKBALL0SUPPORT 4329 f539 - ifnconst TRAKTIME 4330 f539 - ifnconst TRAKXONLY 4331 f539 - lda #180 ; minimum for x+y 4332 f539 - else ; !TRAKXONLY 4333 f539 - lda #100 ; minimum for just x 4334 f539 - endif ; !TRAKXONLY 4335 f539 - else ; !TRAKTIME 4336 f539 - lda #TRAKTIME 4337 f539 - endif ; !TRAKTIME 4338 f539 - jsr SETTIM64T ; INTIM is in Y 4339 f539 - ldx #0 4340 f539 - ifnconst TRAKXONLY 4341 f539 - ldy #0 4342 f539 - endif ; TRAKXONLY 4343 f539 -trakball0updateloop 4344 f539 - lda SWCHA 4345 f539 - and #%00110000 4346 f539 - cmp trakballcodex0 4347 f539 - sta trakballcodex0 4348 f539 - beq trakball0movementXdone 4349 f539 - and #%00010000 4350 f539 - beq trakball0negativeX 4351 f539 -trakball0positiveX 4352 f539 - ;(2 from beq) 4353 f539 - inx ; 2 4354 f539 - jmp trakball0movementXdone ; 3 4355 f539 -trakball0negativeX 4356 f539 - ;(3 from beq) 4357 f539 - dex ; 2 4358 f539 - nop ; 2 4359 f539 -trakball0movementXdone 4360 f539 - 4361 f539 - ifnconst TRAKXONLY 4362 f539 - lda SWCHA 4363 f539 - and #%11000000 4364 f539 - cmp trakballcodey0 4365 f539 - sta trakballcodey0 4366 f539 - beq trakball0movementYdone 4367 f539 - and #%01000000 4368 f539 - beq trakball0negativeY 4369 f539 -trakball0positiveY 4370 f539 - ;(2 from beq) 4371 f539 - iny ; 2 4372 f539 - jmp trakball0movementYdone ; 3 4373 f539 -trakball0negativeY 4374 f539 - ;(3 from beq) 4375 f539 - dey ; 2 4376 f539 - nop ; 2 4377 f539 -trakball0movementYdone 4378 f539 - endif ; !TRAKXONLY 4379 f539 - 4380 f539 - lda TIMINT 4381 f539 - bpl trakball0updateloop 4382 f539 - lda #0 4383 f539 - cpx #0 4384 f539 - beq trakball0skipXadjust 4385 f539 - clc 4386 f539 -trakball0Xloop 4387 f539 - adc port0resolution 4388 f539 - dex 4389 f539 - bne trakball0Xloop 4390 f539 - clc 4391 f539 - adc trakballx0 4392 f539 - sta trakballx0 4393 f539 -trakball0skipXadjust 4394 f539 - ifnconst TRAKXONLY 4395 f539 - lda #0 4396 f539 - cpy #0 4397 f539 - beq trakball0skipYadjust 4398 f539 - clc 4399 f539 -trakball0yloop 4400 f539 - adc port0resolution 4401 f539 - dey 4402 f539 - bne trakball0yloop 4403 f539 - clc 4404 f539 - adc trakbally0 4405 f539 - sta trakbally0 4406 f539 -trakball0skipYadjust 4407 f539 - endif ; !TRAKXONLY 4408 f539 - 4409 f539 - jmp LLRET0 4410 f539 endif 4411 f539 4412 f539 4413 f539 4414 f539 trakball1update 4415 f539 - ifconst TRAKBALL1SUPPORT 4416 f539 - ifnconst TRAKTIME 4417 f539 - ifnconst TRAKXONLY 4418 f539 - lda #180 ; minimum for x+y 4419 f539 - else ; !TRAKXONLY 4420 f539 - lda #100 ; minimum for just x 4421 f539 - endif ; !TRAKXONLY 4422 f539 - else ; !TRAKTIME 4423 f539 - lda #TRAKTIME 4424 f539 - endif ; !TRAKTIME 4425 f539 - jsr SETTIM64T ; INTIM is in Y 4426 f539 - ldx #0 4427 f539 - ifnconst TRAKXONLY 4428 f539 - ldy #0 4429 f539 - endif ; TRAKXONLY 4430 f539 -trakball1updateloop 4431 f539 - lda SWCHA 4432 f539 - and #%00000011 4433 f539 - cmp trakballcodex1 4434 f539 - sta trakballcodex1 4435 f539 - beq trakball1movementXdone 4436 f539 - and #%00000001 4437 f539 - beq trakball1negativeX 4438 f539 -trakball1positiveX 4439 f539 - ;(2 from beq) 4440 f539 - inx ; 2 4441 f539 - jmp trakball1movementXdone ; 3 4442 f539 -trakball1negativeX 4443 f539 - ;(3 from beq) 4444 f539 - dex ; 2 4445 f539 - nop ; 2 4446 f539 -trakball1movementXdone 4447 f539 - 4448 f539 - ifnconst TRAKXONLY 4449 f539 - lda SWCHA 4450 f539 - and #%00001100 4451 f539 - cmp trakballcodey1 4452 f539 - sta trakballcodey1 4453 f539 - beq trakball1movementYdone 4454 f539 - and #%00000100 4455 f539 - beq trakball1negativeY 4456 f539 -trakball1positiveY 4457 f539 - ;(2 from beq) 4458 f539 - iny ; 2 4459 f539 - jmp trakball1movementYdone ; 3 4460 f539 -trakball1negativeY 4461 f539 - ;(3 from beq) 4462 f539 - dey ; 2 4463 f539 - nop ; 2 4464 f539 -trakball1movementYdone 4465 f539 - endif ; !TRAKXONLY 4466 f539 - 4467 f539 - lda TIMINT 4468 f539 - bpl trakball1updateloop 4469 f539 - lda #0 4470 f539 - cpx #0 4471 f539 - beq trakball1skipXadjust 4472 f539 - clc 4473 f539 -trakball1Xloop 4474 f539 - adc port1resolution 4475 f539 - dex 4476 f539 - bne trakball1Xloop 4477 f539 - clc 4478 f539 - adc trakballx1 4479 f539 - sta trakballx1 4480 f539 -trakball1skipXadjust 4481 f539 - ifnconst TRAKXONLY 4482 f539 - lda #0 4483 f539 - cpy #0 4484 f539 - beq trakball1skipYadjust 4485 f539 - clc 4486 f539 -trakball1yloop 4487 f539 - adc port1resolution 4488 f539 - dey 4489 f539 - bne trakball1yloop 4490 f539 - clc 4491 f539 - adc trakbally1 4492 f539 - sta trakbally1 4493 f539 -trakball1skipYadjust 4494 f539 - endif ; !TRAKXONLY 4495 f539 - 4496 f539 - jmp LLRET1 4497 f539 endif 4498 f539 4499 f539 4500 f539 paddleport0update 4501 f539 - ifconst PADDLE0SUPPORT 4502 f539 - lda #6 4503 f539 - sta VBLANK ; start charging the paddle caps 4504 f539 - lda #0 ; use PADDLE timing 4505 f539 - jsr SETTIM64T ; INTIM is in Y 4506 f539 - 4507 f539 -paddleport0updateloop 4508 f539 - lda INPT0 4509 f539 - bmi skippaddle0setposition 4510 f539 - sty paddleposition0 4511 f539 -skippaddle0setposition 4512 f539 - ifconst TWOPADDLESUPPORT 4513 f539 - lda INPT1 4514 f539 - bmi skippaddle1setposition 4515 f539 - sty paddleposition1 4516 f539 -skippaddle1setposition 4517 f539 - endif 4518 f539 - ldy INTIM 4519 f539 - cpy #TIMEOFFSET 4520 f539 - bcs paddleport0updateloop 4521 f539 - 4522 f539 - lda #%10000110 4523 f539 - sta VBLANK ; dump paddles to ground... this may not be great for genesis controllers 4524 f539 - sec 4525 f539 - lda paddleposition0 4526 f539 - sbc #TIMEOFFSET 4527 f539 - ifconst PADDLESCALEX2 4528 f539 - asl 4529 f539 - endif 4530 f539 - 4531 f539 - ifnconst PADDLESMOOTHINGOFF 4532 f539 - clc 4533 f539 - adc paddleprevious0 4534 f539 - ror 4535 f539 - sta paddleprevious0 4536 f539 - endif 4537 f539 - 4538 f539 - sta paddleposition0 4539 f539 - 4540 f539 - ifconst TWOPADDLESUPPORT 4541 f539 - sec 4542 f539 - lda paddleposition1 4543 f539 - sbc #TIMEOFFSET 4544 f539 - ifconst PADDLESCALEX2 4545 f539 - asl 4546 f539 - endif 4547 f539 - 4548 f539 - ifnconst PADDLESMOOTHINGOFF 4549 f539 - clc 4550 f539 - adc paddleprevious1 4551 f539 - ror 4552 f539 - sta paddleprevious1 4553 f539 - endif 4554 f539 - sta paddleposition1 4555 f539 - endif ; TWOPADDLESUPPORT 4556 f539 - 4557 f539 - jmp LLRET0 4558 f539 endif 4559 f539 4560 f539 paddleport1update 4561 f539 - ifconst PADDLE1SUPPORT 4562 f539 - lda #6 4563 f539 - sta VBLANK ; start charging the paddle caps 4564 f539 - 4565 f539 - lda #0 ; use PADDLE timing 4566 f539 - jsr SETTIM64T ; INTIM is in Y 4567 f539 - 4568 f539 -paddleport1updateloop 4569 f539 - lda INPT2 4570 f539 - bmi skippaddle2setposition 4571 f539 - sty paddleposition2 4572 f539 -skippaddle2setposition 4573 f539 - ifconst TWOPADDLESUPPORT 4574 f539 - lda INPT3 4575 f539 - bmi skippaddle3setposition 4576 f539 - sty paddleposition3 4577 f539 -skippaddle3setposition 4578 f539 - endif 4579 f539 - ldy INTIM 4580 f539 - cpy #TIMEOFFSET 4581 f539 - bcs paddleport1updateloop 4582 f539 - 4583 f539 - lda #%10000110 4584 f539 - sta VBLANK ; dump paddles to ground... this may not be great for genesis controllers 4585 f539 - sec 4586 f539 - lda paddleposition2 4587 f539 - sbc #TIMEOFFSET 4588 f539 - ifconst PADDLESCALEX2 4589 f539 - asl 4590 f539 - endif 4591 f539 - 4592 f539 - ifnconst PADDLESMOOTHINGOFF 4593 f539 - clc 4594 f539 - adc paddleprevious2 4595 f539 - ror 4596 f539 - sta paddleprevious2 4597 f539 - endif 4598 f539 - 4599 f539 - sta paddleposition2 4600 f539 - 4601 f539 - ifconst TWOPADDLESUPPORT 4602 f539 - sec 4603 f539 - lda paddleposition3 4604 f539 - sbc #TIMEOFFSET 4605 f539 - ifconst PADDLESCALEX2 4606 f539 - asl 4607 f539 - endif 4608 f539 - 4609 f539 - ifnconst PADDLESMOOTHINGOFF 4610 f539 - clc 4611 f539 - adc paddleprevious3 4612 f539 - ror 4613 f539 - sta paddleprevious3 4614 f539 - endif 4615 f539 - sta paddleposition3 4616 f539 - endif ; TWOPADDLESUPPORT 4617 f539 - 4618 f539 - jmp LLRET1 4619 f539 endif 4620 f539 4621 f539 4622 f539 paddlebuttonhandler ; outside of conditional, for button-handler LUT 4623 f539 - ifconst PADDLESUPPORT 4624 f539 - ; x=0|1 for port, rather than paddle #. 4625 f539 - ; Only the first paddle button will integrate into "joy0fire" testing. If the 4626 f539 - ; game wants to support 2 paddles, up to the game to instead test the 4627 f539 - ; joystick right+left directions instead. 4628 f539 - lda SWCHA ; top of nibble is first paddle button 4629 f539 - cpx #0 ; port 0? 4630 f539 - beq skippaddleport2shift 4631 f539 - asl ; shift second port to upper nibble 4632 f539 - asl 4633 f539 - asl 4634 f539 - asl 4635 f539 -skippaddleport2shift 4636 f539 - and #%10000000 4637 f539 - eor #%10000000 ; invert 4638 f539 - sta sINPT1,x 4639 f539 - jmp buttonreadloopreturn 4640 f539 endif ; PADDLESUPPORT 4641 f539 4642 f539 mousebuttonhandler ; outside of conditional, for button-handler LUT 4643 f539 - ifconst MOUSESUPPORT 4644 f539 - ; stick the mouse buttons in the correct shadow register... 4645 f539 - txa 4646 f539 - asl 4647 f539 - tay ; y=x*2 4648 f539 - lda INPT4,x 4649 f539 - eor #%10000000 4650 f539 - lsr 4651 f539 - sta sINPT1,x 4652 f539 - 4653 f539 - lda INPT1,y 4654 f539 - and #%10000000 4655 f539 - eor #%10000000 4656 f539 - ora sINPT1,x 4657 f539 - sta sINPT1,x 4658 f539 - jmp buttonreadloopreturn 4659 f539 endif ; MOUSESUPPORT 4660 f539 4661 f539 - ifconst KEYPADSUPPORT 4662 f539 - ; ** select keypad rows 0 to 3 over 4 frames... 4663 f539 -keypadrowselect 4664 f539 - ldy #0 4665 f539 - lda port0control 4666 f539 - cmp #7 4667 f539 - bne skipport0val 4668 f539 - iny ; y=y+1 4669 f539 -skipport0val 4670 f539 - lda port1control 4671 f539 - cmp #7 4672 f539 - bne skipport1val 4673 f539 - iny 4674 f539 - iny ; y=y+2 4675 f539 -skipport1val 4676 f539 - lda keyrowdirectionmask,y 4677 f539 - sta CTLSWA 4678 f539 - tya 4679 f539 - asl 4680 f539 - asl 4681 f539 - sta inttemp1 4682 f539 - lda framecounter 4683 f539 - and #3 4684 f539 - ora inttemp1 4685 f539 - tax 4686 f539 - lda keyrowselectvalue,x 4687 f539 - sta SWCHA 4688 f539 - rts 4689 f539 - 4690 f539 -keyrowdirectionmask 4691 f539 - .byte #%00000000 ; 0 : port0=input port1=input 4692 f539 - .byte #%11110000 ; 1 : port0=output port1=input 4693 f539 - .byte #%00001111 ; 2 : port0=input port1=output 4694 f539 - .byte #%11111111 ; 3 : port0=output port1=output 4695 f539 - 4696 f539 -keyrowselectvalue 4697 f539 - .byte #%00000000, #%00000000, #%00000000, #%00000000 ; no row selected, all pins high, always 4698 f539 - .byte #%11100000, #%11010000, #%10110000, #%01110000 ; p0 keypad in 4699 f539 - .byte #%00001110, #%00001101, #%00001011, #%00000111 ; p1 keypad in 4700 f539 - .byte #%11101110, #%11011101, #%10111011, #%01110111 ; p0+p1 keypads in 4701 f539 endif ; KEYPADSUPPORT 4702 f539 4703 f539 - ifconst KEYPADSUPPORT 4704 f539 - ; TODO - split into compile-time KEYPAD0SUPPORT and KEYPAD1SUPPORT 4705 f539 -keypadcolumnread 4706 f539 - lda port0control 4707 f539 - cmp #7 4708 f539 - bne skipkeypadcolumnread0 4709 f539 - lda framecounter 4710 f539 - and #3 4711 f539 - asl ; x2 because keypad variables are interleaved 4712 f539 - tax 4713 f539 - lda #0 4714 f539 - sta keypadmatrix0a,x 4715 f539 - lda INPT0 4716 f539 - cmp #$80 4717 f539 - rol keypadmatrix0a,x 4718 f539 - lda INPT1 4719 f539 - cmp #$80 4720 f539 - rol keypadmatrix0a,x 4721 f539 - lda INPT4 4722 f539 - cmp #$80 4723 f539 - rol keypadmatrix0a,x 4724 f539 - lda keypadmatrix0a,x 4725 f539 - eor #%00000111 4726 f539 - sta keypadmatrix0a,x 4727 f539 -skipkeypadcolumnread0 4728 f539 - 4729 f539 - lda port1control 4730 f539 - cmp #7 4731 f539 - bne skipkeypadcolumnread1 4732 f539 - lda framecounter 4733 f539 - and #3 4734 f539 - asl ; x2 because keypad variables are interleaved 4735 f539 - tax 4736 f539 - lda #0 4737 f539 - sta keypadmatrix1a,x 4738 f539 - rol keypadmatrix1a,x 4739 f539 - lda INPT2 4740 f539 - cmp #$80 4741 f539 - rol keypadmatrix1a,x 4742 f539 - lda INPT3 4743 f539 - cmp #$80 4744 f539 - rol keypadmatrix1a,x 4745 f539 - lda INPT5 4746 f539 - cmp #$80 4747 f539 - rol keypadmatrix1a,x 4748 f539 - lda keypadmatrix1a,x 4749 f539 - eor #%00000111 4750 f539 - sta keypadmatrix1a,x 4751 f539 -skipkeypadcolumnread1 4752 f539 - rts 4753 f539 endif ; KEYPADSUPPORT 4754 f539 4755 f539 setportforinput 4756 f539 a5 e4 lda CTLSWAs 4757 f53b 3d 44 f5 and allpinsinputlut,x 4758 f53e 85 e4 sta CTLSWAs 4759 f540 8d 81 02 sta CTLSWA 4760 f543 60 rts 4761 f544 4762 f544 allpinsinputlut 4763 f544 0f f0 .byte.b $0F, $F0 4764 f546 4765 f546 setonebuttonmode 4766 f546 a9 06 lda #6 ; in case we're in unlocked-bios mode 4767 f548 85 01 sta VBLANK ; if we were on paddles, the line is grounded out. 4768 f54a a9 14 lda #$14 4769 f54c 8d 83 02 sta CTLSWB ; set both 2-button disable bits to writable 4770 f54f a5 e5 lda CTLSWBs 4771 f551 1d 5a f5 ora thisjoy2buttonbit,x 4772 f554 85 e5 sta CTLSWBs 4773 f556 8d 82 02 sta SWCHB ; turn off the 2-button disable bits 4774 f559 60 rts 4775 f55a 4776 f55a thisjoy2buttonbit 4777 f55a 04 10 .byte.b $04, $10 4778 f55c 4779 f55c settwobuttonmode 4780 f55c a9 06 lda #6 ; in case we're in unlocked-bios mode 4781 f55e 85 01 sta VBLANK ; if we were on paddles, the line is grounded out. 4782 f560 a9 14 lda #$14 4783 f562 8d 83 02 sta CTLSWB ; set both 2-button disable bits to writable 4784 f565 a5 e5 lda CTLSWBs 4785 f567 3d 70 f5 and thisjoy2buttonmask,x 4786 f56a 85 e5 sta CTLSWBs 4787 f56c 8d 82 02 sta SWCHB 4788 f56f 60 rts 4789 f570 4790 f570 thisjoy2buttonmask 4791 f570 fb ef .byte.b $fb, $ef 4792 f572 4793 f572 ; Provided under the CC0 license. See the included LICENSE.txt for details. 4794 f572 4795 f572 START 4796 f572 start 4797 f572 4798 f572 ;******** more or less the Atari recommended startup procedure 4799 f572 4800 f572 78 sei 4801 f573 d8 cld 4802 f574 4803 f574 ifnconst NOTIALOCK 4804 f574 a9 07 lda #$07 4805 f576 - else 4806 f576 - lda #$06 4807 f576 endif 4808 f576 85 01 sta INPTCTRL ;lock 7800 into 7800 mode 4809 f578 a9 7f lda #$7F 4810 f57a 85 3c sta CTRL ;disable DMA 4811 f57c a9 00 lda #$00 4812 f57e 85 38 sta OFFSET 4813 f580 ifnconst NOTIALOCK 4814 f580 85 01 sta INPTCTRL 4815 f582 endif 4816 f582 a2 ff ldx #$FF 4817 f584 9a txs 4818 f585 4819 f585 ;************** Clear Memory 4820 f585 4821 f585 a2 40 ldx #$40 4822 f587 a9 00 lda #$00 4823 f589 crloop1 4824 f589 95 00 sta $00,x ;Clear zero page 4825 f58b 9d 00 01 sta $100,x ;Clear page 1 4826 f58e e8 inx 4827 f58f d0 f8 bne crloop1 4828 f591 4829 f591 4830 f591 a0 00 ldy #$00 ;Clear Ram 4831 f593 a9 18 lda #$18 ;Start at $1800 4832 f595 85 81 sta $81 4833 f597 a9 00 lda #$00 4834 f599 85 80 sta $80 4835 f59b crloop3 4836 f59b a9 00 lda #$00 4837 f59d 91 80 sta ($80),y ;Store data 4838 f59f c8 iny ;Next byte 4839 f5a0 d0 f9 bne crloop3 ;Branch if not done page 4840 f5a2 e6 81 inc $81 ;Next page 4841 f5a4 a5 81 lda $81 4842 f5a6 c9 20 cmp #$20 ;End at $1FFF 4843 f5a8 d0 f1 bne crloop3 ;Branch if not 4844 f5aa 4845 f5aa a0 00 ldy #$00 ;Clear Ram 4846 f5ac a9 22 lda #$22 ;Start at $2200 4847 f5ae 85 81 sta $81 4848 f5b0 a9 00 lda #$00 4849 f5b2 85 80 sta $80 4850 f5b4 crloop4 4851 f5b4 a9 00 lda #$00 4852 f5b6 91 80 sta ($80),y ;Store data 4853 f5b8 c8 iny ;Next byte 4854 f5b9 d0 f9 bne crloop4 ;Branch if not done page 4855 f5bb e6 81 inc $81 ;Next page 4856 f5bd a5 81 lda $81 4857 f5bf c9 27 cmp #$27 ;End at $27FF 4858 f5c1 d0 f1 bne crloop4 ;Branch if not 4859 f5c3 4860 f5c3 a2 00 ldx #$00 4861 f5c5 a9 00 lda #$00 4862 f5c7 crloop5 ;Clear 2100-213F, 2000-203F 4863 f5c7 9d 00 20 sta $2000,x 4864 f5ca 9d 00 21 sta $2100,x 4865 f5cd e8 inx 4866 f5ce e0 40 cpx #$40 4867 f5d0 d0 f5 bne crloop5 4868 f5d2 4869 f5d2 85 80 sta $80 4870 f5d4 85 81 sta $81 4871 f5d6 85 82 sta $82 4872 f5d8 85 83 sta $83 4873 f5da 4874 f5da ;seed random number with hopefully-random timer value 4875 f5da a9 01 lda #1 4876 f5dc 0d 84 02 ora INTIM 4877 f5df 85 40 sta rand 4878 f5e1 4879 f5e1 ; detect the console type... 4880 f5e1 pndetectvblankstart 4881 f5e1 a5 28 lda MSTAT 4882 f5e3 10 fc bpl pndetectvblankstart ; if we're not in VBLANK, wait for it to start 4883 f5e5 pndetectvblankover 4884 f5e5 a5 28 lda MSTAT 4885 f5e7 30 fc bmi pndetectvblankover ; then wait for it to be over 4886 f5e9 a0 00 ldy #$00 4887 f5eb a2 00 ldx #$00 4888 f5ed pndetectvblankhappening 4889 f5ed a5 28 lda MSTAT 4890 f5ef 30 07 bmi pndetectinvblank ; if VBLANK starts, exit our counting loop 4891 f5f1 85 24 sta WSYNC 4892 f5f3 85 24 sta WSYNC 4893 f5f5 e8 inx 4894 f5f6 d0 f5 bne pndetectvblankhappening 4895 f5f8 pndetectinvblank 4896 f5f8 e0 7d cpx #125 4897 f5fa 90 02 bcc pndetecispal 4898 f5fc a0 01 ldy #$01 4899 f5fe pndetecispal 4900 f5fe 8c 09 21 sty paldetected 4901 f601 4902 f601 20 9f f4 jsr createallgamedlls 4903 f604 4904 f604 a9 18 lda #>DLLMEM 4905 f606 85 2c sta DPPH 4906 f608 a9 00 lda # 255 5075 f630 -DOUBLEBUFFEROFFSET = 255 5076 f630 else 5077 f630 00 43 DOUBLEBUFFEROFFSET = (DLLASTOBJ+2) 5078 f630 endif 5079 f630 5080 f630 - ifconst EXTRADLMEMORY 5081 f630 -SECONDDLHALFSTART SET $2300 5082 f630 endif 5083 f630 5084 f630 DLPOINTH 5085 f630 DLINDEX SET 0 5086 f630 REPEAT WZONECOUNT 5087 f630 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5088 f630 - ifconst EXTRADLMEMORY 5089 f630 - if TMPMEMADDRESS > $1FFF 5090 f630 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5091 f630 - else 5092 f630 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5093 f630 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5094 f630 -SECONDDLHALFSTART SET TMPMEMADDRESS 5095 f630 - endif 5096 f630 - endif ; TMPMEMADDRESS > $1FFF 5097 f630 endif ; EXTRADLMEMORY 5098 f630 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 5099 f630 18 .byte.b >TMPMEMADDRESS 5100 f630 DLINDEX SET DLINDEX + 1 5086 f630 REPEND 5087 f630 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5088 f631 - ifconst EXTRADLMEMORY 5089 f631 - if TMPMEMADDRESS > $1FFF 5090 f631 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5091 f631 - else 5092 f631 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5093 f631 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5094 f631 -SECONDDLHALFSTART SET TMPMEMADDRESS 5095 f631 - endif 5096 f631 - endif ; TMPMEMADDRESS > $1FFF 5097 f631 endif ; EXTRADLMEMORY 5098 f631 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 5099 f631 18 .byte.b >TMPMEMADDRESS 5100 f631 DLINDEX SET DLINDEX + 1 5086 f631 REPEND 5087 f631 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5088 f632 - ifconst EXTRADLMEMORY 5089 f632 - if TMPMEMADDRESS > $1FFF 5090 f632 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5091 f632 - else 5092 f632 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5093 f632 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5094 f632 -SECONDDLHALFSTART SET TMPMEMADDRESS 5095 f632 - endif 5096 f632 - endif ; TMPMEMADDRESS > $1FFF 5097 f632 endif ; EXTRADLMEMORY 5098 f632 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 5099 f632 19 .byte.b >TMPMEMADDRESS 5100 f632 DLINDEX SET DLINDEX + 1 5086 f632 REPEND 5087 f632 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5088 f633 - ifconst EXTRADLMEMORY 5089 f633 - if TMPMEMADDRESS > $1FFF 5090 f633 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5091 f633 - else 5092 f633 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5093 f633 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5094 f633 -SECONDDLHALFSTART SET TMPMEMADDRESS 5095 f633 - endif 5096 f633 - endif ; TMPMEMADDRESS > $1FFF 5097 f633 endif ; EXTRADLMEMORY 5098 f633 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 5099 f633 19 .byte.b >TMPMEMADDRESS 5100 f633 DLINDEX SET DLINDEX + 1 5086 f633 REPEND 5087 f633 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5088 f634 - ifconst EXTRADLMEMORY 5089 f634 - if TMPMEMADDRESS > $1FFF 5090 f634 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5091 f634 - else 5092 f634 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5093 f634 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5094 f634 -SECONDDLHALFSTART SET TMPMEMADDRESS 5095 f634 - endif 5096 f634 - endif ; TMPMEMADDRESS > $1FFF 5097 f634 endif ; EXTRADLMEMORY 5098 f634 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 5099 f634 19 .byte.b >TMPMEMADDRESS 5100 f634 DLINDEX SET DLINDEX + 1 5086 f634 REPEND 5087 f634 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5088 f635 - ifconst EXTRADLMEMORY 5089 f635 - if TMPMEMADDRESS > $1FFF 5090 f635 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5091 f635 - else 5092 f635 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5093 f635 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5094 f635 -SECONDDLHALFSTART SET TMPMEMADDRESS 5095 f635 - endif 5096 f635 - endif ; TMPMEMADDRESS > $1FFF 5097 f635 endif ; EXTRADLMEMORY 5098 f635 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 5099 f635 19 .byte.b >TMPMEMADDRESS 5100 f635 DLINDEX SET DLINDEX + 1 5086 f635 REPEND 5087 f635 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5088 f636 - ifconst EXTRADLMEMORY 5089 f636 - if TMPMEMADDRESS > $1FFF 5090 f636 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5091 f636 - else 5092 f636 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5093 f636 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5094 f636 -SECONDDLHALFSTART SET TMPMEMADDRESS 5095 f636 - endif 5096 f636 - endif ; TMPMEMADDRESS > $1FFF 5097 f636 endif ; EXTRADLMEMORY 5098 f636 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 5099 f636 1a .byte.b >TMPMEMADDRESS 5100 f636 DLINDEX SET DLINDEX + 1 5086 f636 REPEND 5087 f636 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5088 f637 - ifconst EXTRADLMEMORY 5089 f637 - if TMPMEMADDRESS > $1FFF 5090 f637 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5091 f637 - else 5092 f637 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5093 f637 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5094 f637 -SECONDDLHALFSTART SET TMPMEMADDRESS 5095 f637 - endif 5096 f637 - endif ; TMPMEMADDRESS > $1FFF 5097 f637 endif ; EXTRADLMEMORY 5098 f637 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 5099 f637 1a .byte.b >TMPMEMADDRESS 5100 f637 DLINDEX SET DLINDEX + 1 5086 f637 REPEND 5087 f637 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5088 f638 - ifconst EXTRADLMEMORY 5089 f638 - if TMPMEMADDRESS > $1FFF 5090 f638 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5091 f638 - else 5092 f638 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5093 f638 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5094 f638 -SECONDDLHALFSTART SET TMPMEMADDRESS 5095 f638 - endif 5096 f638 - endif ; TMPMEMADDRESS > $1FFF 5097 f638 endif ; EXTRADLMEMORY 5098 f638 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 5099 f638 1a .byte.b >TMPMEMADDRESS 5100 f638 DLINDEX SET DLINDEX + 1 5086 f638 REPEND 5087 f638 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5088 f639 - ifconst EXTRADLMEMORY 5089 f639 - if TMPMEMADDRESS > $1FFF 5090 f639 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5091 f639 - else 5092 f639 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5093 f639 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5094 f639 -SECONDDLHALFSTART SET TMPMEMADDRESS 5095 f639 - endif 5096 f639 - endif ; TMPMEMADDRESS > $1FFF 5097 f639 endif ; EXTRADLMEMORY 5098 f639 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 5099 f639 1a .byte.b >TMPMEMADDRESS 5100 f639 DLINDEX SET DLINDEX + 1 5086 f639 REPEND 5087 f639 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5088 f63a - ifconst EXTRADLMEMORY 5089 f63a - if TMPMEMADDRESS > $1FFF 5090 f63a -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5091 f63a - else 5092 f63a - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5093 f63a -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5094 f63a -SECONDDLHALFSTART SET TMPMEMADDRESS 5095 f63a - endif 5096 f63a - endif ; TMPMEMADDRESS > $1FFF 5097 f63a endif ; EXTRADLMEMORY 5098 f63a ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 5099 f63a 1b .byte.b >TMPMEMADDRESS 5100 f63a DLINDEX SET DLINDEX + 1 5086 f63a REPEND 5087 f63a TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5088 f63b - ifconst EXTRADLMEMORY 5089 f63b - if TMPMEMADDRESS > $1FFF 5090 f63b -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5091 f63b - else 5092 f63b - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5093 f63b -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5094 f63b -SECONDDLHALFSTART SET TMPMEMADDRESS 5095 f63b - endif 5096 f63b - endif ; TMPMEMADDRESS > $1FFF 5097 f63b endif ; EXTRADLMEMORY 5098 f63b ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 5099 f63b 1b .byte.b >TMPMEMADDRESS 5100 f63b DLINDEX SET DLINDEX + 1 5086 f63b REPEND 5087 f63b TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5088 f63c - ifconst EXTRADLMEMORY 5089 f63c - if TMPMEMADDRESS > $1FFF 5090 f63c -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5091 f63c - else 5092 f63c - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5093 f63c -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5094 f63c -SECONDDLHALFSTART SET TMPMEMADDRESS 5095 f63c - endif 5096 f63c - endif ; TMPMEMADDRESS > $1FFF 5097 f63c endif ; EXTRADLMEMORY 5098 f63c ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 5099 f63c 1b .byte.b >TMPMEMADDRESS 5100 f63c DLINDEX SET DLINDEX + 1 5086 f63c REPEND 5087 f63c TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5088 f63d - ifconst EXTRADLMEMORY 5089 f63d - if TMPMEMADDRESS > $1FFF 5090 f63d -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5091 f63d - else 5092 f63d - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5093 f63d -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5094 f63d -SECONDDLHALFSTART SET TMPMEMADDRESS 5095 f63d - endif 5096 f63d - endif ; TMPMEMADDRESS > $1FFF 5097 f63d endif ; EXTRADLMEMORY 5098 f63d ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 5099 f63d 1b .byte.b >TMPMEMADDRESS 5100 f63d DLINDEX SET DLINDEX + 1 5086 f63d REPEND 5087 f63d TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5088 f63e - ifconst EXTRADLMEMORY 5089 f63e - if TMPMEMADDRESS > $1FFF 5090 f63e -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5091 f63e - else 5092 f63e - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5093 f63e -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5094 f63e -SECONDDLHALFSTART SET TMPMEMADDRESS 5095 f63e - endif 5096 f63e - endif ; TMPMEMADDRESS > $1FFF 5097 f63e endif ; EXTRADLMEMORY 5098 f63e ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 5099 f63e 1c .byte.b >TMPMEMADDRESS 5100 f63e DLINDEX SET DLINDEX + 1 5086 f63e REPEND 5087 f63e TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5088 f63f - ifconst EXTRADLMEMORY 5089 f63f - if TMPMEMADDRESS > $1FFF 5090 f63f -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5091 f63f - else 5092 f63f - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5093 f63f -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5094 f63f -SECONDDLHALFSTART SET TMPMEMADDRESS 5095 f63f - endif 5096 f63f - endif ; TMPMEMADDRESS > $1FFF 5097 f63f endif ; EXTRADLMEMORY 5098 f63f ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 5099 f63f 1c .byte.b >TMPMEMADDRESS 5100 f63f DLINDEX SET DLINDEX + 1 5086 f63f REPEND 5087 f63f TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5088 f640 - ifconst EXTRADLMEMORY 5089 f640 - if TMPMEMADDRESS > $1FFF 5090 f640 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5091 f640 - else 5092 f640 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5093 f640 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5094 f640 -SECONDDLHALFSTART SET TMPMEMADDRESS 5095 f640 - endif 5096 f640 - endif ; TMPMEMADDRESS > $1FFF 5097 f640 endif ; EXTRADLMEMORY 5098 f640 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 5099 f640 1c .byte.b >TMPMEMADDRESS 5100 f640 DLINDEX SET DLINDEX + 1 5086 f640 REPEND 5087 f640 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5088 f641 - ifconst EXTRADLMEMORY 5089 f641 - if TMPMEMADDRESS > $1FFF 5090 f641 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5091 f641 - else 5092 f641 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5093 f641 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5094 f641 -SECONDDLHALFSTART SET TMPMEMADDRESS 5095 f641 - endif 5096 f641 - endif ; TMPMEMADDRESS > $1FFF 5097 f641 endif ; EXTRADLMEMORY 5098 f641 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 5099 f641 1d .byte.b >TMPMEMADDRESS 5100 f641 DLINDEX SET DLINDEX + 1 5086 f641 REPEND 5087 f641 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5088 f642 - ifconst EXTRADLMEMORY 5089 f642 - if TMPMEMADDRESS > $1FFF 5090 f642 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5091 f642 - else 5092 f642 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5093 f642 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5094 f642 -SECONDDLHALFSTART SET TMPMEMADDRESS 5095 f642 - endif 5096 f642 - endif ; TMPMEMADDRESS > $1FFF 5097 f642 endif ; EXTRADLMEMORY 5098 f642 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 5099 f642 1d .byte.b >TMPMEMADDRESS 5100 f642 DLINDEX SET DLINDEX + 1 5086 f642 REPEND 5087 f642 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5088 f643 - ifconst EXTRADLMEMORY 5089 f643 - if TMPMEMADDRESS > $1FFF 5090 f643 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5091 f643 - else 5092 f643 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5093 f643 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5094 f643 -SECONDDLHALFSTART SET TMPMEMADDRESS 5095 f643 - endif 5096 f643 - endif ; TMPMEMADDRESS > $1FFF 5097 f643 endif ; EXTRADLMEMORY 5098 f643 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 5099 f643 1d .byte.b >TMPMEMADDRESS 5100 f643 DLINDEX SET DLINDEX + 1 5086 f643 REPEND 5087 f643 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5088 f644 - ifconst EXTRADLMEMORY 5089 f644 - if TMPMEMADDRESS > $1FFF 5090 f644 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5091 f644 - else 5092 f644 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5093 f644 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5094 f644 -SECONDDLHALFSTART SET TMPMEMADDRESS 5095 f644 - endif 5096 f644 - endif ; TMPMEMADDRESS > $1FFF 5097 f644 endif ; EXTRADLMEMORY 5098 f644 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 5099 f644 1d .byte.b >TMPMEMADDRESS 5100 f644 DLINDEX SET DLINDEX + 1 5086 f644 REPEND 5087 f644 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5088 f645 - ifconst EXTRADLMEMORY 5089 f645 - if TMPMEMADDRESS > $1FFF 5090 f645 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5091 f645 - else 5092 f645 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5093 f645 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5094 f645 -SECONDDLHALFSTART SET TMPMEMADDRESS 5095 f645 - endif 5096 f645 - endif ; TMPMEMADDRESS > $1FFF 5097 f645 endif ; EXTRADLMEMORY 5098 f645 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 5099 f645 1e .byte.b >TMPMEMADDRESS 5100 f645 DLINDEX SET DLINDEX + 1 5086 f645 REPEND 5087 f645 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5088 f646 - ifconst EXTRADLMEMORY 5089 f646 - if TMPMEMADDRESS > $1FFF 5090 f646 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5091 f646 - else 5092 f646 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5093 f646 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5094 f646 -SECONDDLHALFSTART SET TMPMEMADDRESS 5095 f646 - endif 5096 f646 - endif ; TMPMEMADDRESS > $1FFF 5097 f646 endif ; EXTRADLMEMORY 5098 f646 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 5099 f646 1e .byte.b >TMPMEMADDRESS 5100 f646 DLINDEX SET DLINDEX + 1 5086 f646 REPEND 5087 f646 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5088 f647 - ifconst EXTRADLMEMORY 5089 f647 - if TMPMEMADDRESS > $1FFF 5090 f647 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5091 f647 - else 5092 f647 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5093 f647 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5094 f647 -SECONDDLHALFSTART SET TMPMEMADDRESS 5095 f647 - endif 5096 f647 - endif ; TMPMEMADDRESS > $1FFF 5097 f647 endif ; EXTRADLMEMORY 5098 f647 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 5099 f647 1e .byte.b >TMPMEMADDRESS 5100 f647 DLINDEX SET DLINDEX + 1 5086 f647 REPEND 5087 f647 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5088 f648 - ifconst EXTRADLMEMORY 5089 f648 - if TMPMEMADDRESS > $1FFF 5090 f648 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5091 f648 - else 5092 f648 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5093 f648 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5094 f648 -SECONDDLHALFSTART SET TMPMEMADDRESS 5095 f648 - endif 5096 f648 - endif ; TMPMEMADDRESS > $1FFF 5097 f648 endif ; EXTRADLMEMORY 5098 f648 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 5099 f648 1e .byte.b >TMPMEMADDRESS 5100 f648 DLINDEX SET DLINDEX + 1 5086 f648 REPEND 5087 f648 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5088 f649 - ifconst EXTRADLMEMORY 5089 f649 - if TMPMEMADDRESS > $1FFF 5090 f649 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5091 f649 - else 5092 f649 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5093 f649 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5094 f649 -SECONDDLHALFSTART SET TMPMEMADDRESS 5095 f649 - endif 5096 f649 - endif ; TMPMEMADDRESS > $1FFF 5097 f649 endif ; EXTRADLMEMORY 5098 f649 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 5099 f649 1f .byte.b >TMPMEMADDRESS 5100 f649 DLINDEX SET DLINDEX + 1 5086 f649 REPEND 5087 f649 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5088 f64a - ifconst EXTRADLMEMORY 5089 f64a - if TMPMEMADDRESS > $1FFF 5090 f64a -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5091 f64a - else 5092 f64a - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5093 f64a -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5094 f64a -SECONDDLHALFSTART SET TMPMEMADDRESS 5095 f64a - endif 5096 f64a - endif ; TMPMEMADDRESS > $1FFF 5097 f64a endif ; EXTRADLMEMORY 5098 f64a ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 5099 f64a 1f .byte.b >TMPMEMADDRESS 5100 f64a DLINDEX SET DLINDEX + 1 5086 f64a REPEND 5087 f64a TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5088 f64b - ifconst EXTRADLMEMORY 5089 f64b - if TMPMEMADDRESS > $1FFF 5090 f64b -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5091 f64b - else 5092 f64b - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5093 f64b -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5094 f64b -SECONDDLHALFSTART SET TMPMEMADDRESS 5095 f64b - endif 5096 f64b - endif ; TMPMEMADDRESS > $1FFF 5097 f64b endif ; EXTRADLMEMORY 5098 f64b ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 5099 f64b 1f .byte.b >TMPMEMADDRESS 5100 f64b DLINDEX SET DLINDEX + 1 5101 f64c REPEND 5102 f64c 5103 f64c - ifconst EXTRADLMEMORY 5104 f64c - echo " ",[SECONDDLHALFSTART],"to",[$27FF],"was claimed as extra DL memory." 5105 f64c endif 5106 f64c 5107 f64c 5108 f64c DLPOINTL 5109 f64c DLINDEX SET 0 5110 f64c REPEAT WZONECOUNT 5111 f64c TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5112 f64c - ifconst EXTRADLMEMORY 5113 f64c - if TMPMEMADDRESS > $1FFF 5114 f64c -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5115 f64c - else 5116 f64c - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5117 f64c -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5118 f64c - endif 5119 f64c - endif ; TMPMEMADDRESS > $1FFF 5120 f64c endif ; EXTRADLMEMORY 5121 f64c 80 .byte.b $1FFF 5114 f64d -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5115 f64d - else 5116 f64d - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5117 f64d -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5118 f64d - endif 5119 f64d - endif ; TMPMEMADDRESS > $1FFF 5120 f64d endif ; EXTRADLMEMORY 5121 f64d c4 .byte.b $1FFF 5114 f64e -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5115 f64e - else 5116 f64e - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5117 f64e -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5118 f64e - endif 5119 f64e - endif ; TMPMEMADDRESS > $1FFF 5120 f64e endif ; EXTRADLMEMORY 5121 f64e 09 .byte.b $1FFF 5114 f64f -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5115 f64f - else 5116 f64f - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5117 f64f -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5118 f64f - endif 5119 f64f - endif ; TMPMEMADDRESS > $1FFF 5120 f64f endif ; EXTRADLMEMORY 5121 f64f 4d .byte.b $1FFF 5114 f650 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5115 f650 - else 5116 f650 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5117 f650 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5118 f650 - endif 5119 f650 - endif ; TMPMEMADDRESS > $1FFF 5120 f650 endif ; EXTRADLMEMORY 5121 f650 92 .byte.b $1FFF 5114 f651 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5115 f651 - else 5116 f651 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5117 f651 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5118 f651 - endif 5119 f651 - endif ; TMPMEMADDRESS > $1FFF 5120 f651 endif ; EXTRADLMEMORY 5121 f651 d6 .byte.b $1FFF 5114 f652 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5115 f652 - else 5116 f652 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5117 f652 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5118 f652 - endif 5119 f652 - endif ; TMPMEMADDRESS > $1FFF 5120 f652 endif ; EXTRADLMEMORY 5121 f652 1b .byte.b $1FFF 5114 f653 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5115 f653 - else 5116 f653 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5117 f653 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5118 f653 - endif 5119 f653 - endif ; TMPMEMADDRESS > $1FFF 5120 f653 endif ; EXTRADLMEMORY 5121 f653 60 .byte.b $1FFF 5114 f654 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5115 f654 - else 5116 f654 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5117 f654 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5118 f654 - endif 5119 f654 - endif ; TMPMEMADDRESS > $1FFF 5120 f654 endif ; EXTRADLMEMORY 5121 f654 a4 .byte.b $1FFF 5114 f655 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5115 f655 - else 5116 f655 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5117 f655 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5118 f655 - endif 5119 f655 - endif ; TMPMEMADDRESS > $1FFF 5120 f655 endif ; EXTRADLMEMORY 5121 f655 e9 .byte.b $1FFF 5114 f656 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5115 f656 - else 5116 f656 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5117 f656 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5118 f656 - endif 5119 f656 - endif ; TMPMEMADDRESS > $1FFF 5120 f656 endif ; EXTRADLMEMORY 5121 f656 2d .byte.b $1FFF 5114 f657 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5115 f657 - else 5116 f657 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5117 f657 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5118 f657 - endif 5119 f657 - endif ; TMPMEMADDRESS > $1FFF 5120 f657 endif ; EXTRADLMEMORY 5121 f657 72 .byte.b $1FFF 5114 f658 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5115 f658 - else 5116 f658 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5117 f658 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5118 f658 - endif 5119 f658 - endif ; TMPMEMADDRESS > $1FFF 5120 f658 endif ; EXTRADLMEMORY 5121 f658 b6 .byte.b $1FFF 5114 f659 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5115 f659 - else 5116 f659 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5117 f659 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5118 f659 - endif 5119 f659 - endif ; TMPMEMADDRESS > $1FFF 5120 f659 endif ; EXTRADLMEMORY 5121 f659 fb .byte.b $1FFF 5114 f65a -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5115 f65a - else 5116 f65a - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5117 f65a -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5118 f65a - endif 5119 f65a - endif ; TMPMEMADDRESS > $1FFF 5120 f65a endif ; EXTRADLMEMORY 5121 f65a 40 .byte.b $1FFF 5114 f65b -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5115 f65b - else 5116 f65b - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5117 f65b -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5118 f65b - endif 5119 f65b - endif ; TMPMEMADDRESS > $1FFF 5120 f65b endif ; EXTRADLMEMORY 5121 f65b 84 .byte.b $1FFF 5114 f65c -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5115 f65c - else 5116 f65c - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5117 f65c -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5118 f65c - endif 5119 f65c - endif ; TMPMEMADDRESS > $1FFF 5120 f65c endif ; EXTRADLMEMORY 5121 f65c c9 .byte.b $1FFF 5114 f65d -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5115 f65d - else 5116 f65d - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5117 f65d -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5118 f65d - endif 5119 f65d - endif ; TMPMEMADDRESS > $1FFF 5120 f65d endif ; EXTRADLMEMORY 5121 f65d 0d .byte.b $1FFF 5114 f65e -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5115 f65e - else 5116 f65e - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5117 f65e -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5118 f65e - endif 5119 f65e - endif ; TMPMEMADDRESS > $1FFF 5120 f65e endif ; EXTRADLMEMORY 5121 f65e 52 .byte.b $1FFF 5114 f65f -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5115 f65f - else 5116 f65f - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5117 f65f -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5118 f65f - endif 5119 f65f - endif ; TMPMEMADDRESS > $1FFF 5120 f65f endif ; EXTRADLMEMORY 5121 f65f 96 .byte.b $1FFF 5114 f660 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5115 f660 - else 5116 f660 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5117 f660 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5118 f660 - endif 5119 f660 - endif ; TMPMEMADDRESS > $1FFF 5120 f660 endif ; EXTRADLMEMORY 5121 f660 db .byte.b $1FFF 5114 f661 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5115 f661 - else 5116 f661 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5117 f661 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5118 f661 - endif 5119 f661 - endif ; TMPMEMADDRESS > $1FFF 5120 f661 endif ; EXTRADLMEMORY 5121 f661 20 .byte.b $1FFF 5114 f662 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5115 f662 - else 5116 f662 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5117 f662 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5118 f662 - endif 5119 f662 - endif ; TMPMEMADDRESS > $1FFF 5120 f662 endif ; EXTRADLMEMORY 5121 f662 64 .byte.b $1FFF 5114 f663 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5115 f663 - else 5116 f663 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5117 f663 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5118 f663 - endif 5119 f663 - endif ; TMPMEMADDRESS > $1FFF 5120 f663 endif ; EXTRADLMEMORY 5121 f663 a9 .byte.b $1FFF 5114 f664 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5115 f664 - else 5116 f664 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5117 f664 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5118 f664 - endif 5119 f664 - endif ; TMPMEMADDRESS > $1FFF 5120 f664 endif ; EXTRADLMEMORY 5121 f664 ed .byte.b $1FFF 5114 f665 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5115 f665 - else 5116 f665 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5117 f665 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5118 f665 - endif 5119 f665 - endif ; TMPMEMADDRESS > $1FFF 5120 f665 endif ; EXTRADLMEMORY 5121 f665 32 .byte.b $1FFF 5114 f666 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5115 f666 - else 5116 f666 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5117 f666 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5118 f666 - endif 5119 f666 - endif ; TMPMEMADDRESS > $1FFF 5120 f666 endif ; EXTRADLMEMORY 5121 f666 76 .byte.b $1FFF 5114 f667 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5115 f667 - else 5116 f667 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5117 f667 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5118 f667 - endif 5119 f667 - endif ; TMPMEMADDRESS > $1FFF 5120 f667 endif ; EXTRADLMEMORY 5121 f667 bb .byte.b $1FFF 5131 f668 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5132 f668 - else 5133 f668 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5134 f668 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5135 f668 - endif 5136 f668 - endif ; TMPMEMADDRESS > $1FFF 5137 f668 endif ; EXTRADLMEMORY 5138 f668 5139 f668 18 80 ZONE0ADDRESS = TMPMEMADDRESS 5140 f668 5141 f668 DLINDEX SET DLINDEX + 1 5127 f668 REPEND 5128 f668 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5129 f668 - ifconst EXTRADLMEMORY 5130 f668 - if TMPMEMADDRESS > $1FFF 5131 f668 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5132 f668 - else 5133 f668 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5134 f668 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5135 f668 - endif 5136 f668 - endif ; TMPMEMADDRESS > $1FFF 5137 f668 endif ; EXTRADLMEMORY 5138 f668 5139 f668 18 c4 ZONE1ADDRESS = TMPMEMADDRESS 5140 f668 5141 f668 DLINDEX SET DLINDEX + 1 5127 f668 REPEND 5128 f668 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5129 f668 - ifconst EXTRADLMEMORY 5130 f668 - if TMPMEMADDRESS > $1FFF 5131 f668 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5132 f668 - else 5133 f668 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5134 f668 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5135 f668 - endif 5136 f668 - endif ; TMPMEMADDRESS > $1FFF 5137 f668 endif ; EXTRADLMEMORY 5138 f668 5139 f668 19 09 ZONE2ADDRESS = TMPMEMADDRESS 5140 f668 5141 f668 DLINDEX SET DLINDEX + 1 5127 f668 REPEND 5128 f668 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5129 f668 - ifconst EXTRADLMEMORY 5130 f668 - if TMPMEMADDRESS > $1FFF 5131 f668 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5132 f668 - else 5133 f668 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5134 f668 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5135 f668 - endif 5136 f668 - endif ; TMPMEMADDRESS > $1FFF 5137 f668 endif ; EXTRADLMEMORY 5138 f668 5139 f668 19 4d ZONE3ADDRESS = TMPMEMADDRESS 5140 f668 5141 f668 DLINDEX SET DLINDEX + 1 5127 f668 REPEND 5128 f668 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5129 f668 - ifconst EXTRADLMEMORY 5130 f668 - if TMPMEMADDRESS > $1FFF 5131 f668 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5132 f668 - else 5133 f668 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5134 f668 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5135 f668 - endif 5136 f668 - endif ; TMPMEMADDRESS > $1FFF 5137 f668 endif ; EXTRADLMEMORY 5138 f668 5139 f668 19 92 ZONE4ADDRESS = TMPMEMADDRESS 5140 f668 5141 f668 DLINDEX SET DLINDEX + 1 5127 f668 REPEND 5128 f668 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5129 f668 - ifconst EXTRADLMEMORY 5130 f668 - if TMPMEMADDRESS > $1FFF 5131 f668 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5132 f668 - else 5133 f668 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5134 f668 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5135 f668 - endif 5136 f668 - endif ; TMPMEMADDRESS > $1FFF 5137 f668 endif ; EXTRADLMEMORY 5138 f668 5139 f668 19 d6 ZONE5ADDRESS = TMPMEMADDRESS 5140 f668 5141 f668 DLINDEX SET DLINDEX + 1 5127 f668 REPEND 5128 f668 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5129 f668 - ifconst EXTRADLMEMORY 5130 f668 - if TMPMEMADDRESS > $1FFF 5131 f668 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5132 f668 - else 5133 f668 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5134 f668 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5135 f668 - endif 5136 f668 - endif ; TMPMEMADDRESS > $1FFF 5137 f668 endif ; EXTRADLMEMORY 5138 f668 5139 f668 1a 1b ZONE6ADDRESS = TMPMEMADDRESS 5140 f668 5141 f668 DLINDEX SET DLINDEX + 1 5127 f668 REPEND 5128 f668 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5129 f668 - ifconst EXTRADLMEMORY 5130 f668 - if TMPMEMADDRESS > $1FFF 5131 f668 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5132 f668 - else 5133 f668 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5134 f668 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5135 f668 - endif 5136 f668 - endif ; TMPMEMADDRESS > $1FFF 5137 f668 endif ; EXTRADLMEMORY 5138 f668 5139 f668 1a 60 ZONE7ADDRESS = TMPMEMADDRESS 5140 f668 5141 f668 DLINDEX SET DLINDEX + 1 5127 f668 REPEND 5128 f668 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5129 f668 - ifconst EXTRADLMEMORY 5130 f668 - if TMPMEMADDRESS > $1FFF 5131 f668 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5132 f668 - else 5133 f668 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5134 f668 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5135 f668 - endif 5136 f668 - endif ; TMPMEMADDRESS > $1FFF 5137 f668 endif ; EXTRADLMEMORY 5138 f668 5139 f668 1a a4 ZONE8ADDRESS = TMPMEMADDRESS 5140 f668 5141 f668 DLINDEX SET DLINDEX + 1 5127 f668 REPEND 5128 f668 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5129 f668 - ifconst EXTRADLMEMORY 5130 f668 - if TMPMEMADDRESS > $1FFF 5131 f668 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5132 f668 - else 5133 f668 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5134 f668 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5135 f668 - endif 5136 f668 - endif ; TMPMEMADDRESS > $1FFF 5137 f668 endif ; EXTRADLMEMORY 5138 f668 5139 f668 1a e9 ZONE9ADDRESS = TMPMEMADDRESS 5140 f668 5141 f668 DLINDEX SET DLINDEX + 1 5127 f668 REPEND 5128 f668 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5129 f668 - ifconst EXTRADLMEMORY 5130 f668 - if TMPMEMADDRESS > $1FFF 5131 f668 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5132 f668 - else 5133 f668 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5134 f668 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5135 f668 - endif 5136 f668 - endif ; TMPMEMADDRESS > $1FFF 5137 f668 endif ; EXTRADLMEMORY 5138 f668 5139 f668 1b 2d ZONE10ADDRESS = TMPMEMADDRESS 5140 f668 5141 f668 DLINDEX SET DLINDEX + 1 5127 f668 REPEND 5128 f668 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5129 f668 - ifconst EXTRADLMEMORY 5130 f668 - if TMPMEMADDRESS > $1FFF 5131 f668 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5132 f668 - else 5133 f668 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5134 f668 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5135 f668 - endif 5136 f668 - endif ; TMPMEMADDRESS > $1FFF 5137 f668 endif ; EXTRADLMEMORY 5138 f668 5139 f668 1b 72 ZONE11ADDRESS = TMPMEMADDRESS 5140 f668 5141 f668 DLINDEX SET DLINDEX + 1 5127 f668 REPEND 5128 f668 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5129 f668 - ifconst EXTRADLMEMORY 5130 f668 - if TMPMEMADDRESS > $1FFF 5131 f668 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5132 f668 - else 5133 f668 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5134 f668 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5135 f668 - endif 5136 f668 - endif ; TMPMEMADDRESS > $1FFF 5137 f668 endif ; EXTRADLMEMORY 5138 f668 5139 f668 1b b6 ZONE12ADDRESS = TMPMEMADDRESS 5140 f668 5141 f668 DLINDEX SET DLINDEX + 1 5127 f668 REPEND 5128 f668 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5129 f668 - ifconst EXTRADLMEMORY 5130 f668 - if TMPMEMADDRESS > $1FFF 5131 f668 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5132 f668 - else 5133 f668 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5134 f668 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5135 f668 - endif 5136 f668 - endif ; TMPMEMADDRESS > $1FFF 5137 f668 endif ; EXTRADLMEMORY 5138 f668 5139 f668 1b fb ZONE13ADDRESS = TMPMEMADDRESS 5140 f668 5141 f668 DLINDEX SET DLINDEX + 1 5127 f668 REPEND 5128 f668 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5129 f668 - ifconst EXTRADLMEMORY 5130 f668 - if TMPMEMADDRESS > $1FFF 5131 f668 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5132 f668 - else 5133 f668 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5134 f668 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5135 f668 - endif 5136 f668 - endif ; TMPMEMADDRESS > $1FFF 5137 f668 endif ; EXTRADLMEMORY 5138 f668 5139 f668 1c 40 ZONE14ADDRESS = TMPMEMADDRESS 5140 f668 5141 f668 DLINDEX SET DLINDEX + 1 5127 f668 REPEND 5128 f668 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5129 f668 - ifconst EXTRADLMEMORY 5130 f668 - if TMPMEMADDRESS > $1FFF 5131 f668 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5132 f668 - else 5133 f668 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5134 f668 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5135 f668 - endif 5136 f668 - endif ; TMPMEMADDRESS > $1FFF 5137 f668 endif ; EXTRADLMEMORY 5138 f668 5139 f668 1c 84 ZONE15ADDRESS = TMPMEMADDRESS 5140 f668 5141 f668 DLINDEX SET DLINDEX + 1 5127 f668 REPEND 5128 f668 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5129 f668 - ifconst EXTRADLMEMORY 5130 f668 - if TMPMEMADDRESS > $1FFF 5131 f668 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5132 f668 - else 5133 f668 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5134 f668 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5135 f668 - endif 5136 f668 - endif ; TMPMEMADDRESS > $1FFF 5137 f668 endif ; EXTRADLMEMORY 5138 f668 5139 f668 1c c9 ZONE16ADDRESS = TMPMEMADDRESS 5140 f668 5141 f668 DLINDEX SET DLINDEX + 1 5127 f668 REPEND 5128 f668 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5129 f668 - ifconst EXTRADLMEMORY 5130 f668 - if TMPMEMADDRESS > $1FFF 5131 f668 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5132 f668 - else 5133 f668 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5134 f668 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5135 f668 - endif 5136 f668 - endif ; TMPMEMADDRESS > $1FFF 5137 f668 endif ; EXTRADLMEMORY 5138 f668 5139 f668 1d 0d ZONE17ADDRESS = TMPMEMADDRESS 5140 f668 5141 f668 DLINDEX SET DLINDEX + 1 5127 f668 REPEND 5128 f668 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5129 f668 - ifconst EXTRADLMEMORY 5130 f668 - if TMPMEMADDRESS > $1FFF 5131 f668 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5132 f668 - else 5133 f668 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5134 f668 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5135 f668 - endif 5136 f668 - endif ; TMPMEMADDRESS > $1FFF 5137 f668 endif ; EXTRADLMEMORY 5138 f668 5139 f668 1d 52 ZONE18ADDRESS = TMPMEMADDRESS 5140 f668 5141 f668 DLINDEX SET DLINDEX + 1 5127 f668 REPEND 5128 f668 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5129 f668 - ifconst EXTRADLMEMORY 5130 f668 - if TMPMEMADDRESS > $1FFF 5131 f668 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5132 f668 - else 5133 f668 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5134 f668 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5135 f668 - endif 5136 f668 - endif ; TMPMEMADDRESS > $1FFF 5137 f668 endif ; EXTRADLMEMORY 5138 f668 5139 f668 1d 96 ZONE19ADDRESS = TMPMEMADDRESS 5140 f668 5141 f668 DLINDEX SET DLINDEX + 1 5127 f668 REPEND 5128 f668 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5129 f668 - ifconst EXTRADLMEMORY 5130 f668 - if TMPMEMADDRESS > $1FFF 5131 f668 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5132 f668 - else 5133 f668 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5134 f668 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5135 f668 - endif 5136 f668 - endif ; TMPMEMADDRESS > $1FFF 5137 f668 endif ; EXTRADLMEMORY 5138 f668 5139 f668 1d db ZONE20ADDRESS = TMPMEMADDRESS 5140 f668 5141 f668 DLINDEX SET DLINDEX + 1 5127 f668 REPEND 5128 f668 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5129 f668 - ifconst EXTRADLMEMORY 5130 f668 - if TMPMEMADDRESS > $1FFF 5131 f668 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5132 f668 - else 5133 f668 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5134 f668 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5135 f668 - endif 5136 f668 - endif ; TMPMEMADDRESS > $1FFF 5137 f668 endif ; EXTRADLMEMORY 5138 f668 5139 f668 1e 20 ZONE21ADDRESS = TMPMEMADDRESS 5140 f668 5141 f668 DLINDEX SET DLINDEX + 1 5127 f668 REPEND 5128 f668 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5129 f668 - ifconst EXTRADLMEMORY 5130 f668 - if TMPMEMADDRESS > $1FFF 5131 f668 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5132 f668 - else 5133 f668 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5134 f668 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5135 f668 - endif 5136 f668 - endif ; TMPMEMADDRESS > $1FFF 5137 f668 endif ; EXTRADLMEMORY 5138 f668 5139 f668 1e 64 ZONE22ADDRESS = TMPMEMADDRESS 5140 f668 5141 f668 DLINDEX SET DLINDEX + 1 5127 f668 REPEND 5128 f668 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5129 f668 - ifconst EXTRADLMEMORY 5130 f668 - if TMPMEMADDRESS > $1FFF 5131 f668 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5132 f668 - else 5133 f668 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5134 f668 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5135 f668 - endif 5136 f668 - endif ; TMPMEMADDRESS > $1FFF 5137 f668 endif ; EXTRADLMEMORY 5138 f668 5139 f668 1e a9 ZONE23ADDRESS = TMPMEMADDRESS 5140 f668 5141 f668 DLINDEX SET DLINDEX + 1 5127 f668 REPEND 5128 f668 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5129 f668 - ifconst EXTRADLMEMORY 5130 f668 - if TMPMEMADDRESS > $1FFF 5131 f668 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5132 f668 - else 5133 f668 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5134 f668 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5135 f668 - endif 5136 f668 - endif ; TMPMEMADDRESS > $1FFF 5137 f668 endif ; EXTRADLMEMORY 5138 f668 5139 f668 1e ed ZONE24ADDRESS = TMPMEMADDRESS 5140 f668 5141 f668 DLINDEX SET DLINDEX + 1 5127 f668 REPEND 5128 f668 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5129 f668 - ifconst EXTRADLMEMORY 5130 f668 - if TMPMEMADDRESS > $1FFF 5131 f668 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5132 f668 - else 5133 f668 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5134 f668 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5135 f668 - endif 5136 f668 - endif ; TMPMEMADDRESS > $1FFF 5137 f668 endif ; EXTRADLMEMORY 5138 f668 5139 f668 1f 32 ZONE25ADDRESS = TMPMEMADDRESS 5140 f668 5141 f668 DLINDEX SET DLINDEX + 1 5127 f668 REPEND 5128 f668 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5129 f668 - ifconst EXTRADLMEMORY 5130 f668 - if TMPMEMADDRESS > $1FFF 5131 f668 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5132 f668 - else 5133 f668 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5134 f668 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5135 f668 - endif 5136 f668 - endif ; TMPMEMADDRESS > $1FFF 5137 f668 endif ; EXTRADLMEMORY 5138 f668 5139 f668 1f 76 ZONE26ADDRESS = TMPMEMADDRESS 5140 f668 5141 f668 DLINDEX SET DLINDEX + 1 5127 f668 REPEND 5128 f668 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5129 f668 - ifconst EXTRADLMEMORY 5130 f668 - if TMPMEMADDRESS > $1FFF 5131 f668 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5132 f668 - else 5133 f668 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5134 f668 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5135 f668 - endif 5136 f668 - endif ; TMPMEMADDRESS > $1FFF 5137 f668 endif ; EXTRADLMEMORY 5138 f668 5139 f668 1f bb ZONE27ADDRESS = TMPMEMADDRESS 5140 f668 5141 f668 DLINDEX SET DLINDEX + 1 5142 f668 REPEND 5143 f668 5144 f668 $1880 to $1fff used as zone memory, allowing 13 display objects per zone. 5145 f668 echo " ",[WDLMEMSTART],"to",[WDLMEMEND],"used as zone memory, allowing",[(DLLASTOBJ/5)]d,"display objects per zone." 5146 f668 5147 f668 DLHEIGHT 5148 f668 REPEAT WZONECOUNT 5149 f668 07 .byte.b (WZONEHEIGHT-1) 5148 f668 REPEND 5149 f669 07 .byte.b (WZONEHEIGHT-1) 5148 f669 REPEND 5149 f66a 07 .byte.b (WZONEHEIGHT-1) 5148 f66a REPEND 5149 f66b 07 .byte.b (WZONEHEIGHT-1) 5148 f66b REPEND 5149 f66c 07 .byte.b (WZONEHEIGHT-1) 5148 f66c REPEND 5149 f66d 07 .byte.b (WZONEHEIGHT-1) 5148 f66d REPEND 5149 f66e 07 .byte.b (WZONEHEIGHT-1) 5148 f66e REPEND 5149 f66f 07 .byte.b (WZONEHEIGHT-1) 5148 f66f REPEND 5149 f670 07 .byte.b (WZONEHEIGHT-1) 5148 f670 REPEND 5149 f671 07 .byte.b (WZONEHEIGHT-1) 5148 f671 REPEND 5149 f672 07 .byte.b (WZONEHEIGHT-1) 5148 f672 REPEND 5149 f673 07 .byte.b (WZONEHEIGHT-1) 5148 f673 REPEND 5149 f674 07 .byte.b (WZONEHEIGHT-1) 5148 f674 REPEND 5149 f675 07 .byte.b (WZONEHEIGHT-1) 5148 f675 REPEND 5149 f676 07 .byte.b (WZONEHEIGHT-1) 5148 f676 REPEND 5149 f677 07 .byte.b (WZONEHEIGHT-1) 5148 f677 REPEND 5149 f678 07 .byte.b (WZONEHEIGHT-1) 5148 f678 REPEND 5149 f679 07 .byte.b (WZONEHEIGHT-1) 5148 f679 REPEND 5149 f67a 07 .byte.b (WZONEHEIGHT-1) 5148 f67a REPEND 5149 f67b 07 .byte.b (WZONEHEIGHT-1) 5148 f67b REPEND 5149 f67c 07 .byte.b (WZONEHEIGHT-1) 5148 f67c REPEND 5149 f67d 07 .byte.b (WZONEHEIGHT-1) 5148 f67d REPEND 5149 f67e 07 .byte.b (WZONEHEIGHT-1) 5148 f67e REPEND 5149 f67f 07 .byte.b (WZONEHEIGHT-1) 5148 f67f REPEND 5149 f680 07 .byte.b (WZONEHEIGHT-1) 5148 f680 REPEND 5149 f681 07 .byte.b (WZONEHEIGHT-1) 5148 f681 REPEND 5149 f682 07 .byte.b (WZONEHEIGHT-1) 5148 f682 REPEND 5149 f683 07 .byte.b (WZONEHEIGHT-1) 5150 f684 REPEND 5151 f684 5152 f684 ; Provided under the CC0 license. See the included LICENSE.txt for details. 5153 f684 5154 f684 ; a simple guard, than ensures the 7800basic code hasn't 5155 f684 ; spilled into the encryption area... 2298 bytes left in the 7800basic reserved area. 5156 f684 echo " ",($FF7E-*)d,"bytes left in the 7800basic reserved area." 5157 f684 - if (*>$FF7D) 5158 f684 - ERR ; abort the assembly 5159 f684 endif 5160 f684 ; Provided under the CC0 license. See the included LICENSE.txt for details. 5161 f684 5162 f684 - ifconst DEV 5163 f684 - ifnconst ZONEHEIGHT 5164 f684 - echo "* the 4k 7800basic area has",[($FF7E - *)]d,"bytes free." 5165 f684 - else 5166 f684 - if ZONEHEIGHT = 8 5167 f684 - echo "* the 4k 7800basic area has",[($FF7E - *)]d,"bytes free." 5168 f684 - else 5169 f684 - echo "* the 4k 7800basic area has",[($FF7E - *)]d,"bytes free." 5170 f684 - endif 5171 f684 - endif 5172 f684 endif 5173 f684 5174 f684 ; FF7E/FF7F contains the 7800basic crc checksum word 5175 f684 5176 f684 ; FF80 - FFF7 contains the 7800 encryption key 5177 f684 5178 f684 ifnconst bankswitchmode 5179 fff8 ORG $FFF8 5180 fff8 - else 5181 fff8 - ifconst ROM128K 5182 fff8 - ORG $27FF8 5183 fff8 - RORG $FFF8 5184 fff8 - endif 5185 fff8 - ifconst ROM144K 5186 fff8 - ORG $27FF8 5187 fff8 - RORG $FFF8 5188 fff8 - endif 5189 fff8 - ifconst ROM256K 5190 fff8 - ORG $47FF8 5191 fff8 - RORG $FFF8 5192 fff8 - endif 5193 fff8 - ifconst ROM272K 5194 fff8 - ORG $47FF8 5195 fff8 - RORG $FFF8 5196 fff8 - endif 5197 fff8 - ifconst ROM512K 5198 fff8 - ORG $87FF8 5199 fff8 - RORG $FFF8 5200 fff8 - endif 5201 fff8 - ifconst ROM528K 5202 fff8 - ORG $87FF8 5203 fff8 - RORG $FFF8 5204 fff8 - endif 5205 fff8 endif 5206 fff8 5207 fff8 5208 fff8 ff .byte.b $FF ; region verification. $FF=all regions 5209 fff9 f7 .byte.b $F7 ; high nibble: encryption check from $N000 to $FF7F. we only hash the last 4k for faster boot. 5210 fffa ; low nibble : N=7 atari rainbow start, N=3 no atari rainbow 5211 fffa 5212 fffa ;Vectors 5213 fffa 00 f0 .word.w NMI 5214 fffc 72 f5 .word.w START 5215 fffe 67 f0 .word.w IRQ 5216 10000