------- FILE c:\Users\Shane\Documents\my7800projects\shooting_demos\horizontal\Horizontal_Shooting_demo.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 ???? MAC sizeof 449 10000 ???? 450 10000 ???? ; echo's the size difference between the current address and the 451 10000 ???? ; a label that was passed as an argument. This is a quick way to 452 10000 ???? ; determine the size of a structure. 453 10000 ???? 454 10000 ???? .NAME SETSTR {1} 455 10000 ???? echo " The Size of",.NAME,"is:",[* - {1}]d,[* - {2}]d,"bytes." 456 10000 ???? ENDM 457 10000 ???? 458 10000 ???? ; 459 10000 ???? ; speakjet.inc 460 10000 ???? ; 461 10000 ???? ; 462 10000 ???? ; AtariVox Speech Synth Driver 463 10000 ???? ; 464 10000 ???? ; By Alex Herbert, 2004 465 10000 ???? ; 466 10000 ???? 467 10000 ???? 468 10000 ???? 469 10000 ???? 470 10000 ???? ; Constants 471 10000 ???? 472 10000 ???? 473 10000 ???? 00 01 SERIAL_OUTMASK equ $01 474 10000 ???? 00 02 SERIAL_RDYMASK equ $02 475 10000 ???? 476 10000 ???? 477 10000 ???? 478 10000 ???? ; Macros 479 10000 ???? 480 10000 ???? mac spkout 481 10000 ???? 482 10000 ???? ; check buffer-full status 483 10000 ???? lda SWCHA 484 10000 ???? and #SERIAL_RDYMASK 485 10000 ???? beq .speech_done 486 10000 ???? 487 10000 ???? ; get next speech byte 488 10000 ???? ldy #$00 489 10000 ???? lda (speech_addr),y 490 10000 ???? 491 10000 ???? ; invert data and check for end of string 492 10000 ???? eor #$ff 493 10000 ???? ;sta BACKGRND ; debug - uncomment to flash the background color with vox data 494 10000 ???? beq .speech_done 495 10000 ???? sta {1} 496 10000 ???? 497 10000 ???? ; increment speech pointer 498 10000 ???? inc speech_addr 499 10000 ???? bne .incaddr_skip 500 10000 ???? inc speech_addr+1 501 10000 ???? .incaddr_skip 502 10000 ???? 503 10000 ???? ; output byte as serial data 504 10000 ???? 505 10000 ???? sec ; start bit 506 10000 ???? .byteout_loop 507 10000 ???? ; put carry flag into bit 0 of SWACNT, perserving other bits 508 10000 ???? lda SWACNT ; 4 509 10000 ???? and #$fe ; 2 6 510 10000 ???? adc #$00 ; 2 8 511 10000 ???? sta SWACNT ; 4 12 512 10000 ???? 513 10000 ???? ; 10 bits sent? (1 start bit, 8 data bits, 1 stop bit) 514 10000 ???? cpy #$09 ; 2 14 515 10000 ???? beq .speech_done ; 2 16 516 10000 ???? iny ; 2 18 517 10000 ???? 518 10000 ???? ; the 7800 is 1.5x faster than the 2600. Waste more cycles here 519 10000 ???? ; to match the original baud rate... 520 10000 ???? ;ldx #$07 ; 2600 521 10000 ???? ldx #$0D 522 10000 ???? 523 10000 ???? .delay_loop 524 10000 ???? dex ; 525 10000 ???? bne .delay_loop ; 36 54 526 10000 ???? 527 10000 ???? ; shift next data bit into carry 528 10000 ???? lsr {1} ; 5 59 529 10000 ???? 530 10000 ???? ; and loop (branch always taken) 531 10000 ???? bpl .byteout_loop ; 3 62 cycles for loop 532 10000 ???? 533 10000 ???? .speech_done 534 10000 ???? 535 10000 ???? endm 536 10000 ???? 537 10000 ???? 538 10000 ???? mac speak 539 10000 ???? 540 10000 ???? lda #<{1} 541 10000 ???? sta speech_addr 542 10000 ???? lda #>{1} 543 10000 ???? sta speech_addr+1 544 10000 ???? 545 10000 ???? endm 546 10000 ???? 547 10000 ???? 548 10000 ???? 549 10000 ???? ; Provided under the CC0 license. See the included LICENSE.txt for details. 550 10000 ???? 551 10000 ???? processor 6502 552 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 demoObstacle_tallsprite_01_mode = $00 4 10000 ???? 00 00 demoObstacle_tallsprite_01_width_twoscompliment = $00 5 10000 ???? 00 00 demoObstacle_tallsprite_01_width = $00 6 10000 ???? 00 00 demoObstacle_tallsprite_00_mode = $00 7 10000 ???? 00 1e demoObstacle_tallsprite_00_width_twoscompliment = $1e 8 10000 ???? 00 02 demoObstacle_tallsprite_00_width = $02 9 10000 ???? 00 00 demoObstacle_mode = $00 10 10000 ???? 00 1e demoObstacle_width_twoscompliment = $1e 11 10000 ???? 00 02 demoObstacle_width = $02 12 10000 ???? 00 00 playershot_mode = $00 13 10000 ???? 00 1e playershot_width_twoscompliment = $1e 14 10000 ???? 00 02 playershot_width = $02 15 10000 ???? 00 00 demoascii_redoiii_mode = $00 16 10000 ???? 00 07 demoascii_redoiii_width_twoscompliment = $07 17 10000 ???? 00 59 demoascii_redoiii_width = $59 18 10000 ???? 00 00 playership_mode = $00 19 10000 ???? 00 1e playership_width_twoscompliment = $1e 20 10000 ???? 00 02 playership_width = $02 21 10000 ???? 00 54 sfx_pulsecannon_length = .skipL0185-sfx_pulsecannon 22 10000 ???? 23 10000 ???? 00 30 sfx_plainlaser_length = .skipL0184-sfx_plainlaser 24 10000 ???? 25 10000 ???? 00 01 BOXCOLLISION = 1 26 10000 ???? 00 1c demoObstacle_tallsprite_00_color3 = $1c 27 10000 ???? 00 33 demoObstacle_tallsprite_00_color2 = $33 28 10000 ???? 00 27 demoObstacle_tallsprite_00_color1 = $27 29 10000 ???? 00 00 demoObstacle_tallsprite_00_color0 = $00 30 10000 ???? 00 1c demoObstacle_color3 = $1c 31 10000 ???? 00 33 demoObstacle_color2 = $33 32 10000 ???? 00 27 demoObstacle_color1 = $27 33 10000 ???? 00 00 demoObstacle_color0 = $00 34 10000 ???? 00 00 playershot_color3 = 0 35 10000 ???? 00 bb playershot_color2 = $bb 36 10000 ???? 00 0d playershot_color1 = $0d 37 10000 ???? 00 00 playershot_color0 = $00 38 10000 ???? 00 0d demoascii_redoiii_color1 = $0d 39 10000 ???? 00 00 demoascii_redoiii_color0 = $00 40 10000 ???? 00 bb playership_color3 = $bb 41 10000 ???? 00 04 playership_color2 = $04 42 10000 ???? 00 0d playership_color1 = $0d 43 10000 ???? 00 00 playership_color0 = $00 44 10000 ???? 01 6f bullet3_time = var47 45 10000 ???? 46 10000 ???? 01 6e bullet2_time = var46 47 10000 ???? 48 10000 ???? 01 6d bullet1_time = var45 49 10000 ???? 50 10000 ???? 01 6c temp_y = var44 51 10000 ???? 52 10000 ???? 01 6b temp_x = var43 53 10000 ???? 54 10000 ???? 01 6a temp_loop = var42 55 10000 ???? 56 10000 ???? 01 69 lives = var41 57 10000 ???? 58 10000 ???? 01 68 player_Flag = var40 59 10000 ???? 60 10000 ???? 01 67 obstacle_flag = var39 61 10000 ???? 62 10000 ???? 01 66 obstacle_ypos = var38 63 10000 ???? 64 10000 ???? 01 65 obstacle_xpos = var37 65 10000 ???? 66 10000 ???? 01 64 isDead_flag = var36 67 10000 ???? 68 10000 ???? 01 63 gameover_flag = var35 69 10000 ???? 70 10000 ???? 01 62 customTemp4 = var34 71 10000 ???? 72 10000 ???? 01 61 customTemp3 = var33 73 10000 ???? 74 10000 ???? 01 60 customTemp2 = var32 75 10000 ???? 76 10000 ???? 01 5f customTemp1 = var31 77 10000 ???? 78 10000 ???? 01 5e enemy01_speed = var30 79 10000 ???? 80 10000 ???? 01 5d enemy01_ypos = var29 81 10000 ???? 82 10000 ???? 01 5c enemy01_xpos = var28 83 10000 ???? 84 10000 ???? 01 5b RDirection = var27 85 10000 ???? 86 10000 ???? 01 5a RMovement6 = var26 87 10000 ???? 88 10000 ???? 01 59 RMovement5 = var25 89 10000 ???? 90 10000 ???? 01 58 RMovement4 = var24 91 10000 ???? 92 10000 ???? 01 57 RMovement3 = var23 93 10000 ???? 94 10000 ???? 01 56 RMovement2 = var22 95 10000 ???? 96 10000 ???? 01 55 RMovement1 = var21 97 10000 ???? 98 10000 ???? 01 4e bullet3_ypos = var14 99 10000 ???? 01 4d bullet2_ypos = var13 100 10000 ???? 01 4c bullet1_ypos = var12 101 10000 ???? 01 4b bullet3_xpos = var11 102 10000 ???? 01 4a bullet2_xpos = var10 103 10000 ???? 01 49 bullet1_xpos = var9 104 10000 ???? 01 48 joyposright = var8 105 10000 ???? 106 10000 ???? 01 47 joyposleft = var7 107 10000 ???? 108 10000 ???? 01 46 joyposdown = var6 109 10000 ???? 110 10000 ???? 01 45 joyposup = var5 111 10000 ???? 112 10000 ???? 01 44 fire_debounce = var4 113 10000 ???? 114 10000 ???? 01 43 player_ypos = var3 115 10000 ???? 116 10000 ???? 01 42 player_xpos = var2 117 10000 ???? 118 10000 ???? 01 41 frameCounter = var1 119 10000 ???? 120 10000 ???? 00 01 plotvalueonscreen = 1 121 10000 ???? 00 01 collisionwrap = 1 122 10000 ???? 00 01 NTSC = 1 123 10000 ???? 00 d0 SCREENHEIGHT = 208 124 10000 ???? 00 01 CHECKOVERWRITE = 1 125 10000 ???? 00 08 ZONEHEIGHT = 8 126 10000 ???? 00 01 ROM48K = 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 ; see if we need an interrupthold byte... 538 U01c1 INTERRUPTNEEDED SET 0 539 U01c1 - ifconst .topscreenroutine 540 U01c1 -INTERRUPTNEEDED SET 1 541 U01c1 endif 542 U01c1 - ifconst .bottomscreenroutine 543 U01c1 -INTERRUPTNEEDED SET 1 544 U01c1 endif 545 U01c1 - ifconst .userinterrupt 546 U01c1 -INTERRUPTNEEDED SET 1 547 U01c1 endif 548 U01c1 - if INTERRUPTNEEDED = 1 549 U01c1 -interrupthold DS 1 ; $1ED 550 U01c1 endif 551 U01c1 552 U01c1 ifnconst CANARYOFF 553 U01c1 00 canary DS 1 ; $1EF 554 U01c2 endif 555 U01c2 556 U01c2 557 U01c2 ifnconst bankswitchmode stack allowance: 30 nested subroutines. 558 U01c2 echo " stack allowance:",[($1FF - .)/2]d,"nested subroutines." 559 U01c2 - else 560 U01c2 - echo " stack allowance:",[($1FF - .)/3]d,"nested subroutines." 561 U01c2 endif 562 U01c2 ifnconst CANARYOFF the canary is situated at: $1c1 563 U01c2 echo " the canary is situated at:",[canary] 564 U01c2 - else 565 U01c2 - echo " the canary is disabled." 566 U01c2 endif 567 U01c2 568 U01c2 ; $1EE - $1FF reserved for stack 569 U01c2 570 10000 ???? SEG "GAME" 571 10000 ???? ------- FILE c:\Users\Shane\Documents\my7800projects\shooting_demos\horizontal\Horizontal_Shooting_demo.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 demoObstacle_tallsprite_01_mode = $00 4 10000 ???? 00 00 demoObstacle_tallsprite_01_width_twoscompliment = $00 5 10000 ???? 00 00 demoObstacle_tallsprite_01_width = $00 6 10000 ???? 00 00 demoObstacle_tallsprite_00_mode = $00 7 10000 ???? 00 1e demoObstacle_tallsprite_00_width_twoscompliment = $1e 8 10000 ???? 00 02 demoObstacle_tallsprite_00_width = $02 9 10000 ???? 00 00 demoObstacle_mode = $00 10 10000 ???? 00 1e demoObstacle_width_twoscompliment = $1e 11 10000 ???? 00 02 demoObstacle_width = $02 12 10000 ???? 00 00 playershot_mode = $00 13 10000 ???? 00 1e playershot_width_twoscompliment = $1e 14 10000 ???? 00 02 playershot_width = $02 15 10000 ???? 00 00 demoascii_redoiii_mode = $00 16 10000 ???? 00 07 demoascii_redoiii_width_twoscompliment = $07 17 10000 ???? 00 59 demoascii_redoiii_width = $59 18 10000 ???? 00 00 playership_mode = $00 19 10000 ???? 00 1e playership_width_twoscompliment = $1e 20 10000 ???? 00 02 playership_width = $02 21 10000 ???? 00 54 sfx_pulsecannon_length = .skipL0185-sfx_pulsecannon 22 10000 ???? 23 10000 ???? 00 30 sfx_plainlaser_length = .skipL0184-sfx_plainlaser 24 10000 ???? 25 10000 ???? 00 01 BOXCOLLISION = 1 26 10000 ???? 00 1c demoObstacle_tallsprite_00_color3 = $1c 27 10000 ???? 00 33 demoObstacle_tallsprite_00_color2 = $33 28 10000 ???? 00 27 demoObstacle_tallsprite_00_color1 = $27 29 10000 ???? 00 00 demoObstacle_tallsprite_00_color0 = $00 30 10000 ???? 00 1c demoObstacle_color3 = $1c 31 10000 ???? 00 33 demoObstacle_color2 = $33 32 10000 ???? 00 27 demoObstacle_color1 = $27 33 10000 ???? 00 00 demoObstacle_color0 = $00 34 10000 ???? 00 00 playershot_color3 = 0 35 10000 ???? 00 bb playershot_color2 = $bb 36 10000 ???? 00 0d playershot_color1 = $0d 37 10000 ???? 00 00 playershot_color0 = $00 38 10000 ???? 00 0d demoascii_redoiii_color1 = $0d 39 10000 ???? 00 00 demoascii_redoiii_color0 = $00 40 10000 ???? 00 bb playership_color3 = $bb 41 10000 ???? 00 04 playership_color2 = $04 42 10000 ???? 00 0d playership_color1 = $0d 43 10000 ???? 00 00 playership_color0 = $00 44 10000 ???? 01 6f bullet3_time = var47 45 10000 ???? 46 10000 ???? 01 6e bullet2_time = var46 47 10000 ???? 48 10000 ???? 01 6d bullet1_time = var45 49 10000 ???? 50 10000 ???? 01 6c temp_y = var44 51 10000 ???? 52 10000 ???? 01 6b temp_x = var43 53 10000 ???? 54 10000 ???? 01 6a temp_loop = var42 55 10000 ???? 56 10000 ???? 01 69 lives = var41 57 10000 ???? 58 10000 ???? 01 68 player_Flag = var40 59 10000 ???? 60 10000 ???? 01 67 obstacle_flag = var39 61 10000 ???? 62 10000 ???? 01 66 obstacle_ypos = var38 63 10000 ???? 64 10000 ???? 01 65 obstacle_xpos = var37 65 10000 ???? 66 10000 ???? 01 64 isDead_flag = var36 67 10000 ???? 68 10000 ???? 01 63 gameover_flag = var35 69 10000 ???? 70 10000 ???? 01 62 customTemp4 = var34 71 10000 ???? 72 10000 ???? 01 61 customTemp3 = var33 73 10000 ???? 74 10000 ???? 01 60 customTemp2 = var32 75 10000 ???? 76 10000 ???? 01 5f customTemp1 = var31 77 10000 ???? 78 10000 ???? 01 5e enemy01_speed = var30 79 10000 ???? 80 10000 ???? 01 5d enemy01_ypos = var29 81 10000 ???? 82 10000 ???? 01 5c enemy01_xpos = var28 83 10000 ???? 84 10000 ???? 01 5b RDirection = var27 85 10000 ???? 86 10000 ???? 01 5a RMovement6 = var26 87 10000 ???? 88 10000 ???? 01 59 RMovement5 = var25 89 10000 ???? 90 10000 ???? 01 58 RMovement4 = var24 91 10000 ???? 92 10000 ???? 01 57 RMovement3 = var23 93 10000 ???? 94 10000 ???? 01 56 RMovement2 = var22 95 10000 ???? 96 10000 ???? 01 55 RMovement1 = var21 97 10000 ???? 98 10000 ???? 01 4e bullet3_ypos = var14 99 10000 ???? 01 4d bullet2_ypos = var13 100 10000 ???? 01 4c bullet1_ypos = var12 101 10000 ???? 01 4b bullet3_xpos = var11 102 10000 ???? 01 4a bullet2_xpos = var10 103 10000 ???? 01 49 bullet1_xpos = var9 104 10000 ???? 01 48 joyposright = var8 105 10000 ???? 106 10000 ???? 01 47 joyposleft = var7 107 10000 ???? 108 10000 ???? 01 46 joyposdown = var6 109 10000 ???? 110 10000 ???? 01 45 joyposup = var5 111 10000 ???? 112 10000 ???? 01 44 fire_debounce = var4 113 10000 ???? 114 10000 ???? 01 43 player_ypos = var3 115 10000 ???? 116 10000 ???? 01 42 player_xpos = var2 117 10000 ???? 118 10000 ???? 01 41 frameCounter = var1 119 10000 ???? 120 10000 ???? 00 01 plotvalueonscreen = 1 121 10000 ???? 00 01 collisionwrap = 1 122 10000 ???? 00 01 NTSC = 1 123 10000 ???? 00 d0 SCREENHEIGHT = 208 124 10000 ???? 00 01 CHECKOVERWRITE = 1 125 10000 ???? 00 08 ZONEHEIGHT = 8 126 10000 ???? 00 01 ROM48K = 1 ------- FILE c:\Users\Shane\Documents\my7800projects\shooting_demos\horizontal\Horizontal_Shooting_demo.78b.asm 555 10000 ???? 556 10000 ???? ; A BEAD header gets automatically incorportated into the ROM header. 557 10000 ???? ; For more BEAD executable info, check out the spec... 558 10000 ???? ; http://7800.8bitdev.org/index.php/The_Atari_7800_BEAD_Execuable_Specification 559 10000 ???? 560 10000 ???? 00 01 GAMEDESCRIPTIONSET = 1 561 10000 ???? 4e 61 6d 65 GAMEDESCRIPTION = "Test Name" 562 10000 ???? 563 10000 ???? 00 40 BDHSC = %01000000 564 10000 ???? 00 20 BDYM = %00100000 565 10000 ???? 00 10 BDPOKEY = %00010000 566 10000 ???? 00 08 BDROF = %00001000 567 10000 ???? 00 00 BD16K = %00000000 568 10000 ???? 00 01 BD32K = %00000001 569 10000 ???? 00 02 BD48K = %00000010 570 10000 ???? 00 05 BD1800 = %00000101 571 10000 ???? 00 06 BD4000 = %00000110 572 10000 ???? 573 10000 ???? - ifconst ROM32K 574 10000 ???? -BEADHEADER = 1 575 10000 ???? endif 576 10000 ???? ifconst ROM48K 577 10000 ???? 00 01 BEADHEADER = 1 578 10000 ???? endif 579 10000 ???? 580 10000 ???? ifconst BEADHEADER 581 10000 ???? BEADHARDWARE SET 0 582 10000 ???? - ifconst ROM16K 583 10000 ???? -BEADHARDWARE SET (BEADHARDWARE|BD16K) 584 10000 ???? endif 585 10000 ???? - ifconst ROM32K 586 10000 ???? -BEADHARDWARE SET (BEADHARDWARE|BD32K) 587 10000 ???? endif 588 10000 ???? ifconst ROM48K 589 10000 ???? BEADHARDWARE SET (BEADHARDWARE|BD48K) 590 10000 ???? endif 591 10000 ???? - ifconst pokeysupport 592 10000 ???? -BEADHARDWARE SET (BEADHARDWARE|BDPOKEY) 593 10000 ???? endif 594 10000 ???? - ifconst HSSUPPORT 595 10000 ???? -BEADHARDWARE SET (BEADHARDWARE|BDHSC) 596 10000 ???? endif 597 10000 ???? endif 598 10000 ???? 599 10000 ???? ;start address of cart... 600 10000 ???? ifconst ROM48K 601 4000 ORG $4000,0 602 4000 ifconst BEADHEADER 603 4000 be ad 02 .byte.b $BE,$AD,BEADHARDWARE 604 4003 ifconst GAMEDESCRIPTIONSET 605 4003 18 CLC 606 4004 90 0a BCC _SKIPDESCRIPTION 607 4006 54 65 73 74* .byte.b GAMEDESCRIPTION,0 608 4010 _SKIPDESCRIPTION 609 4010 endif 610 4010 6c fc ff jmp ($FFFC) 611 4013 endif 612 4013 - else 613 4013 - ifconst bankswitchmode 614 4013 - ifconst ROMAT4K 615 4013 - ORG $4000,0 616 4013 - RORG $4000 617 4013 - else 618 4013 - ORG $8000,0 619 4013 - RORG $8000 620 4013 - endif 621 4013 - else ; not bankswitchmode 622 4013 - ifconst ROM16K 623 4013 - ORG $C000,0 624 4013 - ifconst BEADHEADER 625 4013 - .byte $BE,$AD,BEADHARDWARE 626 4013 - ifconst GAMEDESCRIPTION 627 4013 - CLC 628 4013 - BCC _SKIPDESCRIPTION 629 4013 - .byte GAMEDESCRIPTION,0 630 4013 -_SKIPDESCRIPTION 631 4013 - endif 632 4013 - jmp ($FFFC) 633 4013 - endif 634 4013 - else 635 4013 - ifconst ROM8K 636 4013 - ORG $E000,0 637 4013 - else 638 4013 - ORG $8000,0 639 4013 - ifconst BEADHEADER 640 4013 - .byte $BE,$AD,BEADHARDWARE 641 4013 - ifconst GAMEDESCRIPTION 642 4013 - CLC 643 4013 - BCC _SKIPDESCRIPTION 644 4013 - .byte GAMEDESCRIPTION,0 645 4013 -_SKIPDESCRIPTION 646 4013 - endif 647 4013 - jmp ($FFFC) 648 4013 - endif 649 4013 - endif 650 4013 - endif 651 4013 - endif 652 4013 endif 653 4013 654 4013 ;7800basic v0.18 Mar 14 2021 14:27:24 655 4013 SPACEOVERFLOW SET 0 656 4013 game 657 4013 .L00 ;; set romsize 48k 658 4013 659 4013 .L01 ;; set zoneheight 8 660 4013 661 4013 .L02 ;; set zoneprotection on 662 4013 663 4013 .L03 ;; set tallsprite on 664 4013 665 4013 .L04 ;; set screenheight 208 666 4013 667 4013 .L05 ;; set basepath gfx 668 4013 669 4013 .L06 ;; set tv ntsc 670 4013 671 4013 .L07 ;; set collisionwrap on 672 4013 673 4013 .L08 ;; set plotvalueonscreen on 674 4013 675 4013 .L09 ;; displaymode 160B 676 4013 677 4013 a9 40 lda #%01000000 ;Enable DMA, mode=160x2/160x4 678 4015 85 3c sta CTRL 679 4017 680 4017 8d 07 21 sta sCTRL 681 401a 682 401a . 683 401a ;; 684 401a 685 401a .L010 ;; dim frameCounter = var1 686 401a 687 401a .L011 ;; dim player_xpos = var2 688 401a 689 401a .L012 ;; dim player_ypos = var3 690 401a 691 401a .L013 ;; dim fire_debounce = var4 692 401a 693 401a .L014 ;; dim joyposup = var5 694 401a 695 401a .L015 ;; dim joyposdown = var6 696 401a 697 401a .L016 ;; dim joyposleft = var7 698 401a 699 401a .L017 ;; dim joyposright = var8 700 401a 701 401a .L018 ;; dim bullet1_xpos = var9.var15 702 401a 703 401a .L019 ;; dim bullet2_xpos = var10.var16 704 401a 705 401a .L020 ;; dim bullet3_xpos = var11.var17 706 401a 707 401a .L021 ;; dim bullet1_ypos = var12.var18 708 401a 709 401a .L022 ;; dim bullet2_ypos = var13.var19 710 401a 711 401a .L023 ;; dim bullet3_ypos = var14.var20 712 401a 713 401a .L024 ;; dim RMovement1 = var21 714 401a 715 401a .L025 ;; dim RMovement2 = var22 716 401a 717 401a .L026 ;; dim RMovement3 = var23 718 401a 719 401a .L027 ;; dim RMovement4 = var24 720 401a 721 401a .L028 ;; dim RMovement5 = var25 722 401a 723 401a .L029 ;; dim RMovement6 = var26 724 401a 725 401a .L030 ;; dim RDirection = var27 726 401a 727 401a .L031 ;; dim enemy01_xpos = var28 728 401a 729 401a .L032 ;; dim enemy01_ypos = var29 730 401a 731 401a .L033 ;; dim enemy01_speed = var30 732 401a 733 401a .L034 ;; dim customTemp1 = var31 734 401a 735 401a .L035 ;; dim customTemp2 = var32 736 401a 737 401a .L036 ;; dim customTemp3 = var33 738 401a 739 401a .L037 ;; dim customTemp4 = var34 740 401a 741 401a .L038 ;; dim gameover_flag = var35 742 401a 743 401a .L039 ;; dim isDead_flag = var36 744 401a 745 401a .L040 ;; dim obstacle_xpos = var37 746 401a 747 401a .L041 ;; dim obstacle_ypos = var38 748 401a 749 401a .L042 ;; dim obstacle_flag = var39 750 401a 751 401a .L043 ;; dim player_Flag = var40 752 401a 753 401a .L044 ;; dim lives = var41 754 401a 755 401a .L045 ;; dim temp_loop = var42 756 401a 757 401a .L046 ;; dim temp_x = var43 758 401a 759 401a .L047 ;; dim temp_y = var44 760 401a 761 401a .L048 ;; dim bullet1_time = var45 762 401a 763 401a .L049 ;; dim bullet2_time = var46 764 401a 765 401a .L050 ;; dim bullet3_time = var47 766 401a 767 401a . 768 401a ;; 769 401a 770 401a .palettes 771 401a ;; palettes 772 401a 773 401a .L051 ;; BACKGRND = $00 774 401a 775 401a a9 00 LDA #$00 776 401c 85 20 STA BACKGRND 777 401e .L052 ;; P0C1 = $0D : P0C2 = $05 : P0C3 = $AB 778 401e 779 401e a9 0d LDA #$0D 780 4020 85 21 STA P0C1 781 4022 a9 05 LDA #$05 782 4024 85 22 STA P0C2 783 4026 a9 ab LDA #$AB 784 4028 85 23 STA P0C3 785 402a .L053 ;; P1C1 = $F6 : P1C2 = $12 : P1C3 = $1D 786 402a 787 402a a9 f6 LDA #$F6 788 402c 85 25 STA P1C1 789 402e a9 12 LDA #$12 790 4030 85 26 STA P1C2 791 4032 a9 1d LDA #$1D 792 4034 85 27 STA P1C3 793 4036 .L054 ;; P2C1 = $70 : P2C2 = $72 : P2C3 = $85 794 4036 795 4036 a9 70 LDA #$70 796 4038 85 29 STA P2C1 797 403a a9 72 LDA #$72 798 403c 85 2a STA P2C2 799 403e a9 85 LDA #$85 800 4040 85 2b STA P2C3 801 4042 .L055 ;; P3C1 = $81 : P3C2 = $9A : P3C3 = $87 802 4042 803 4042 a9 81 LDA #$81 804 4044 85 2d STA P3C1 805 4046 a9 9a LDA #$9A 806 4048 85 2e STA P3C2 807 404a a9 87 LDA #$87 808 404c 85 2f STA P3C3 809 404e .L056 ;; P4C1 = $ : P4C2 = $ : P4C3 = $ 810 404e 811 404e a9 00 LDA #$ 812 4050 85 31 STA P4C1 813 4052 85 32 STA P4C2 814 4054 85 33 STA P4C3 815 4056 .L057 ;; P5C1 = $ : P5C2 = $ : P5C3 = $ 816 4056 817 4056 a9 00 LDA #$ 818 4058 85 35 STA P5C1 819 405a 85 36 STA P5C2 820 405c 85 37 STA P5C3 821 405e .L058 ;; P6C1 = $ : P6C2 = $ : P6C3 = $ 822 405e 823 405e a9 00 LDA #$ 824 4060 85 39 STA P6C1 825 4062 85 3a STA P6C2 826 4064 85 3b STA P6C3 827 4066 .L059 ;; P7C1 = $ : P7C2 = $ : P7C3 = $ 828 4066 829 4066 a9 00 LDA #$ 830 4068 85 3d STA P7C1 831 406a 85 3e STA P7C2 832 406c 85 3f STA P7C3 833 406e .L060 ;; characterset demoascii_redoiii 834 406e 835 406e a9 e0 lda #>demoascii_redoiii 836 4070 8d 0b 21 sta sCHARBASE 837 4073 838 4073 85 34 sta CHARBASE 839 4075 a9 60 lda #(demoascii_redoiii_mode | %01100000) 840 4077 8d 06 21 sta charactermode 841 407a 842 407a .L061 ;; alphachars ' !"#$%&`()*+,-0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_.abcdefghijklmnopqrstuvwxyz' 843 407a 844 407a . 845 407a ;; 846 407a 847 407a .import 848 407a ;; import 849 407a 850 407a .L062 ;; incgraphic playership.png 160A 851 407a 852 407a .L063 ;; incgraphic demoascii_redoiii.png 160A 853 407a 854 407a .L064 ;; incgraphic playershot.png 160A 855 407a 856 407a .L065 ;; incgraphic demoObstacle.png 160A 857 407a 858 407a . 859 407a ;; 860 407a 861 407a .init 862 407a ;; init 863 407a 864 407a .L066 ;; frameCounter = 0 865 407a 866 407a a9 00 LDA #0 867 407c 8d 41 01 STA frameCounter 868 407f .L067 ;; player_xpos = 20 : player_ypos = 104 869 407f 870 407f a9 14 LDA #20 871 4081 8d 42 01 STA player_xpos 872 4084 a9 68 LDA #104 873 4086 8d 43 01 STA player_ypos 874 4089 .L068 ;; fire_debounce = 0 875 4089 876 4089 a9 00 LDA #0 877 408b 8d 44 01 STA fire_debounce 878 408e .L069 ;; joyposup = 0 : joyposdown = 0 : joyposleft = 0 : joyposright = 0 879 408e 880 408e a9 00 LDA #0 881 4090 8d 45 01 STA joyposup 882 4093 8d 46 01 STA joyposdown 883 4096 8d 47 01 STA joyposleft 884 4099 8d 48 01 STA joyposright 885 409c .L070 ;; bullet1_xpos = 200 : bullet2_xpos = 200 : bullet3_xpos = 200 : bullet1_ypos = 0 : bullet2_ypos = 0 : bullet3_ypos = 0 886 409c 887 409c a9 00 LDA #0 888 409e 8d 4f 01 STA var15 889 40a1 a9 c8 LDA #200 890 40a3 8d 49 01 STA bullet1_xpos 891 40a6 a9 00 LDA #0 892 40a8 8d 50 01 STA var16 893 40ab a9 c8 LDA #200 894 40ad 8d 4a 01 STA bullet2_xpos 895 40b0 a9 00 LDA #0 896 40b2 8d 51 01 STA var17 897 40b5 a9 c8 LDA #200 898 40b7 8d 4b 01 STA bullet3_xpos 899 40ba a9 00 LDA #0 900 40bc 8d 52 01 STA var18 901 40bf a9 00 LDA #0 902 40c1 8d 4c 01 STA bullet1_ypos 903 40c4 a9 00 LDA #0 904 40c6 8d 53 01 STA var19 905 40c9 a9 00 LDA #0 906 40cb 8d 4d 01 STA bullet2_ypos 907 40ce a9 00 LDA #0 908 40d0 8d 54 01 STA var20 909 40d3 a9 00 LDA #0 910 40d5 8d 4e 01 STA bullet3_ypos 911 40d8 .L071 ;; RMovement1 = 1 : RMovement2 = 1 : RMovement3 = 1 : RMovement4 = 1 : RMovement5 = 1 : RMovement6 = 1 : RDirection = 1 912 40d8 913 40d8 a9 01 LDA #1 914 40da 8d 55 01 STA RMovement1 915 40dd 8d 56 01 STA RMovement2 916 40e0 8d 57 01 STA RMovement3 917 40e3 8d 58 01 STA RMovement4 918 40e6 8d 59 01 STA RMovement5 919 40e9 8d 5a 01 STA RMovement6 920 40ec 8d 5b 01 STA RDirection 921 40ef .L072 ;; enemy01_xpos = 0 : enemy01_ypos = 0 : enemy01_speed = 0 922 40ef 923 40ef a9 00 LDA #0 924 40f1 8d 5c 01 STA enemy01_xpos 925 40f4 8d 5d 01 STA enemy01_ypos 926 40f7 8d 5e 01 STA enemy01_speed 927 40fa .L073 ;; customTemp1 = 0 : customTemp2 = 0 : customTemp3 = 0 : customTemp4 = 0 928 40fa 929 40fa a9 00 LDA #0 930 40fc 8d 5f 01 STA customTemp1 931 40ff 8d 60 01 STA customTemp2 932 4102 8d 61 01 STA customTemp3 933 4105 8d 62 01 STA customTemp4 934 4108 .L074 ;; obstacle_flag = 0 : obstacle_xpos = 104 : obstacle_ypos = 20 935 4108 936 4108 a9 00 LDA #0 937 410a 8d 67 01 STA obstacle_flag 938 410d a9 68 LDA #104 939 410f 8d 65 01 STA obstacle_xpos 940 4112 a9 14 LDA #20 941 4114 8d 66 01 STA obstacle_ypos 942 4117 .L075 ;; lives = 4 943 4117 944 4117 a9 04 LDA #4 945 4119 8d 69 01 STA lives 946 411c . 947 411c ;; 948 411c 949 411c .plot 950 411c ;; plot 951 411c 952 411c .L076 ;; clearscreen 953 411c 954 411c 20 7f f0 jsr clearscreen 955 411f .L077 ;; plotchars 'Horizontal^Shooting^Demo' 0 16 2 956 411f 957 411f 4c 3a 41 JMP skipalphadata0 958 4122 alphadata0 959 4122 28 .byte.b (alphadata0 988 4140 85 43 sta temp2 989 4142 990 4142 a9 08 lda #8 ; width in two's complement 991 4144 09 00 ora #0 ; palette left shifted 5 bits 992 4146 85 44 sta temp3 993 4148 a9 10 lda #16 994 414a 85 45 sta temp4 995 414c 996 414c a9 02 lda #2 997 414e 998 414e 85 46 sta temp5 999 4150 1000 4150 20 4c f3 jsr plotcharacters 1001 4153 .L078 ;; plotchars 'by^Shane^Skekel.' 0 16 4 1002 4153 1003 4153 4c 66 41 JMP skipalphadata1 1004 4156 alphadata1 1005 4156 42 .byte.b (alphadata1 1026 416c 85 43 sta temp2 1027 416e 1028 416e a9 10 lda #16 ; width in two's complement 1029 4170 09 00 ora #0 ; palette left shifted 5 bits 1030 4172 85 44 sta temp3 1031 4174 a9 10 lda #16 1032 4176 85 45 sta temp4 1033 4178 1034 4178 a9 04 lda #4 1035 417a 1036 417a 85 46 sta temp5 1037 417c 1038 417c 20 4c f3 jsr plotcharacters 1039 417f .L079 ;; plotchars 'Push^Fire^Button' 0 16 10 1040 417f 1041 417f 4c 92 41 JMP skipalphadata2 1042 4182 alphadata2 1043 4182 30 .byte.b (alphadata2 1064 4198 85 43 sta temp2 1065 419a 1066 419a a9 10 lda #16 ; width in two's complement 1067 419c 09 00 ora #0 ; palette left shifted 5 bits 1068 419e 85 44 sta temp3 1069 41a0 a9 10 lda #16 1070 41a2 85 45 sta temp4 1071 41a4 1072 41a4 a9 0a lda #10 1073 41a6 1074 41a6 85 46 sta temp5 1075 41a8 1076 41a8 20 4c f3 jsr plotcharacters 1077 41ab .L080 ;; savescreen 1078 41ab 1079 41ab 20 a3 f0 jsr savescreen 1080 41ae .L081 ;; drawscreen 1081 41ae 1082 41ae 20 b3 f0 jsr drawscreen 1083 41b1 . 1084 41b1 ;; 1085 41b1 1086 41b1 .titlescreen_loop 1087 41b1 ;; titlescreen_loop 1088 41b1 1089 41b1 .L082 ;; restorescreen 1090 41b1 1091 41b1 20 91 f0 jsr restorescreen 1092 41b4 .L083 ;; if joy0fire then clearscreen : savescreen : playsfx sfx_plainlaser : goto main 1093 41b4 1094 41b4 2c 02 21 bit sINPT1 1095 41b7 10 22 BPL .skipL083 1096 41b9 .condpart0 1097 41b9 20 7f f0 jsr clearscreen 1098 41bc 20 a3 f0 jsr savescreen 1099 41bf ifnconst NOTIALOCKMUTE 1100 41bf a9 01 lda #1 1101 41c1 85 de sta sfxschedulelock 1102 41c3 a9 ba lda #sfx_plainlaser 1105 41c9 85 e1 sta sfxinstrumenthi 1106 41cb a9 00 lda #0 1107 41cd 85 e2 sta sfxpitchoffset ; no pitch modification 1108 41cf 85 e3 sta sfxnoteindex ; not a musical note 1109 41d1 20 4b f2 jsr schedulesfx 1110 41d4 a9 00 lda #0 1111 41d6 85 de sta sfxschedulelock 1112 41d8 endif ; NOTIALOCKMUTE 1113 41d8 4c e9 41 jmp .main 1114 41db 1115 41db .skipL083 1116 41db .L084 ;; if switchreset then reboot 1117 41db 1118 41db 20 a9 f4 jsr checkresetswitch 1119 41de d0 03 BNE .skipL084 1120 41e0 .condpart1 1121 41e0 4c 96 f5 JMP START 1122 41e3 .skipL084 1123 41e3 .L085 ;; drawscreen 1124 41e3 1125 41e3 20 b3 f0 jsr drawscreen 1126 41e6 .L086 ;; goto titlescreen_loop 1127 41e6 1128 41e6 4c b1 41 jmp .titlescreen_loop 1129 41e9 1130 41e9 . 1131 41e9 ;; 1132 41e9 1133 41e9 . 1134 41e9 ;; 1135 41e9 1136 41e9 .main 1137 41e9 ;; main 1138 41e9 1139 41e9 .L087 ;; frameCounter = frameCounter + 1 1140 41e9 1141 41e9 ad 41 01 LDA frameCounter 1142 41ec 18 CLC 1143 41ed 69 01 ADC #1 1144 41ef 8d 41 01 STA frameCounter 1145 41f2 .L088 ;; if frameCounter > 10 then frameCounter = 0 1146 41f2 1147 41f2 a9 0a LDA #10 1148 41f4 cd 41 01 CMP frameCounter 1149 41f7 b0 05 BCS .skipL088 1150 41f9 .condpart2 1151 41f9 a9 00 LDA #0 1152 41fb 8d 41 01 STA frameCounter 1153 41fe .skipL088 1154 41fe .mainloop 1155 41fe ;; mainloop 1156 41fe 1157 41fe .L089 ;; BACKGRND = $00 1158 41fe 1159 41fe a9 00 LDA #$00 1160 4200 85 20 STA BACKGRND 1161 4202 .L090 ;; if switchreset then reboot 1162 4202 1163 4202 20 a9 f4 jsr checkresetswitch 1164 4205 d0 03 BNE .skipL090 1165 4207 .condpart3 1166 4207 4c 96 f5 JMP START 1167 420a .skipL090 1168 420a . 1169 420a ;; 1170 420a 1171 420a . 1172 420a ;; 1173 420a 1174 420a .L091 ;; if joy0up && joyposup = - 2 then gosub Set_Bullet_home 1175 420a 1176 420a a9 10 lda #$10 1177 420c 2c 80 02 bit SWCHA 1178 420f d0 10 BNE .skipL091 1179 4211 .condpart4 1180 4211 ; complex condition detected 1181 4211 a9 fe LDA #254 1182 4213 48 PHA 1183 4214 ba TSX 1184 4215 68 PLA 1185 4216 ad 45 01 LDA joyposup 1186 4219 dd 01 01 CMP $101,x 1187 421c d0 03 BNE .skip4then 1188 421e .condpart5 1189 421e 20 32 44 jsr .Set_Bullet_home 1190 4221 1191 4221 .skip4then 1192 4221 .skipL091 1193 4221 .L092 ;; if joy0down && joyposdown = - 2 then gosub Set_Bullet_home 1194 4221 1195 4221 a9 20 lda #$20 1196 4223 2c 80 02 bit SWCHA 1197 4226 d0 10 BNE .skipL092 1198 4228 .condpart6 1199 4228 ; complex condition detected 1200 4228 a9 fe LDA #254 1201 422a 48 PHA 1202 422b ba TSX 1203 422c 68 PLA 1204 422d ad 46 01 LDA joyposdown 1205 4230 dd 01 01 CMP $101,x 1206 4233 d0 03 BNE .skip6then 1207 4235 .condpart7 1208 4235 20 32 44 jsr .Set_Bullet_home 1209 4238 1210 4238 .skip6then 1211 4238 .skipL092 1212 4238 .L093 ;; if joy0left && joyposleft = - 2 then gosub Set_Bullet_home 1213 4238 1214 4238 2c 80 02 bit SWCHA 1215 423b 70 10 BVS .skipL093 1216 423d .condpart8 1217 423d ; complex condition detected 1218 423d a9 fe LDA #254 1219 423f 48 PHA 1220 4240 ba TSX 1221 4241 68 PLA 1222 4242 ad 47 01 LDA joyposleft 1223 4245 dd 01 01 CMP $101,x 1224 4248 d0 03 BNE .skip8then 1225 424a .condpart9 1226 424a 20 32 44 jsr .Set_Bullet_home 1227 424d 1228 424d .skip8then 1229 424d .skipL093 1230 424d .L094 ;; if joy0right && joyposright = - 2 then gosub Set_Bullet_home 1231 424d 1232 424d 2c 80 02 bit SWCHA 1233 4250 30 10 BMI .skipL094 1234 4252 .condpart10 1235 4252 ; complex condition detected 1236 4252 a9 fe LDA #254 1237 4254 48 PHA 1238 4255 ba TSX 1239 4256 68 PLA 1240 4257 ad 48 01 LDA joyposright 1241 425a dd 01 01 CMP $101,x 1242 425d d0 03 BNE .skip10then 1243 425f .condpart11 1244 425f 20 32 44 jsr .Set_Bullet_home 1245 4262 1246 4262 .skip10then 1247 4262 .skipL094 1248 4262 . 1249 4262 ;; 1250 4262 1251 4262 . 1252 4262 ;; 1253 4262 1254 4262 .L095 ;; if joy0up then player_ypos = player_ypos - 1 : joyposup = 1 : joyposdown = 0 : joyposleft = 0 : joyposright = 0 1255 4262 1256 4262 a9 10 lda #$10 1257 4264 2c 80 02 bit SWCHA 1258 4267 d0 19 BNE .skipL095 1259 4269 .condpart12 1260 4269 ad 43 01 LDA player_ypos 1261 426c 38 SEC 1262 426d e9 01 SBC #1 1263 426f 8d 43 01 STA player_ypos 1264 4272 a9 01 LDA #1 1265 4274 8d 45 01 STA joyposup 1266 4277 a9 00 LDA #0 1267 4279 8d 46 01 STA joyposdown 1268 427c 8d 47 01 STA joyposleft 1269 427f 8d 48 01 STA joyposright 1270 4282 .skipL095 1271 4282 .L096 ;; if joy0down then player_ypos = player_ypos + 1 : joyposup = 0 : joyposdown = 1 : joyposleft = 0 : joyposright = 0 1272 4282 1273 4282 a9 20 lda #$20 1274 4284 2c 80 02 bit SWCHA 1275 4287 d0 1b BNE .skipL096 1276 4289 .condpart13 1277 4289 ad 43 01 LDA player_ypos 1278 428c 18 CLC 1279 428d 69 01 ADC #1 1280 428f 8d 43 01 STA player_ypos 1281 4292 a9 00 LDA #0 1282 4294 8d 45 01 STA joyposup 1283 4297 a9 01 LDA #1 1284 4299 8d 46 01 STA joyposdown 1285 429c a9 00 LDA #0 1286 429e 8d 47 01 STA joyposleft 1287 42a1 8d 48 01 STA joyposright 1288 42a4 .skipL096 1289 42a4 .L097 ;; if joy0left then player_xpos = player_xpos - 1 : joyposup = 0 : joyposdown = 0 : joyposleft = 1 : joyposright = 0 1290 42a4 1291 42a4 2c 80 02 bit SWCHA 1292 42a7 70 1b BVS .skipL097 1293 42a9 .condpart14 1294 42a9 ad 42 01 LDA player_xpos 1295 42ac 38 SEC 1296 42ad e9 01 SBC #1 1297 42af 8d 42 01 STA player_xpos 1298 42b2 a9 00 LDA #0 1299 42b4 8d 45 01 STA joyposup 1300 42b7 8d 46 01 STA joyposdown 1301 42ba a9 01 LDA #1 1302 42bc 8d 47 01 STA joyposleft 1303 42bf a9 00 LDA #0 1304 42c1 8d 48 01 STA joyposright 1305 42c4 .skipL097 1306 42c4 .L098 ;; if joy0right then player_xpos = player_xpos + 1 : joyposup = 0 : joyposdown = 0 : joyposleft = 0 : joyposright = 1 1307 42c4 1308 42c4 2c 80 02 bit SWCHA 1309 42c7 30 19 BMI .skipL098 1310 42c9 .condpart15 1311 42c9 ad 42 01 LDA player_xpos 1312 42cc 18 CLC 1313 42cd 69 01 ADC #1 1314 42cf 8d 42 01 STA player_xpos 1315 42d2 a9 00 LDA #0 1316 42d4 8d 45 01 STA joyposup 1317 42d7 8d 46 01 STA joyposdown 1318 42da 8d 47 01 STA joyposleft 1319 42dd a9 01 LDA #1 1320 42df 8d 48 01 STA joyposright 1321 42e2 .skipL098 1322 42e2 . 1323 42e2 ;; 1324 42e2 1325 42e2 . 1326 42e2 ;; 1327 42e2 1328 42e2 . 1329 42e2 ;; 1330 42e2 1331 42e2 . 1332 42e2 ;; 1333 42e2 1334 42e2 . 1335 42e2 ;; 1336 42e2 1337 42e2 . 1338 42e2 ;; 1339 42e2 1340 42e2 . 1341 42e2 ;; 1342 42e2 1343 42e2 . 1344 42e2 ;; 1345 42e2 1346 42e2 . 1347 42e2 ;; 1348 42e2 1349 42e2 . 1350 42e2 ;; 1351 42e2 1352 42e2 . 1353 42e2 ;; 1354 42e2 1355 42e2 . 1356 42e2 ;; 1357 42e2 1358 42e2 . 1359 42e2 ;; 1360 42e2 1361 42e2 . 1362 42e2 ;; 1363 42e2 1364 42e2 . 1365 42e2 ;; 1366 42e2 1367 42e2 . 1368 42e2 ;; 1369 42e2 1370 42e2 . 1371 42e2 ;; 1372 42e2 1373 42e2 .L099 ;; if joy0fire && joyposup = 1 && joyposdown = 1 && joyposleft = 1 && joyposright = 1 then bullet1_xpos = bullet1_xpos + 1 : bullet2_xpos = bullet2_xpos + 1 : bullet3_xpos = bullet3_xpos + 1 1374 42e2 1375 42e2 2c 02 21 bit sINPT1 1376 42e5 10 2e BPL .skipL099 1377 42e7 .condpart16 1378 42e7 ad 45 01 LDA joyposup 1379 42ea c9 01 CMP #1 1380 42ec d0 27 BNE .skip16then 1381 42ee .condpart17 1382 42ee ad 46 01 LDA joyposdown 1383 42f1 c9 01 CMP #1 1384 42f3 d0 20 BNE .skip17then 1385 42f5 .condpart18 1386 42f5 ad 47 01 LDA joyposleft 1387 42f8 c9 01 CMP #1 1388 42fa d0 19 BNE .skip18then 1389 42fc .condpart19 1390 42fc ad 48 01 LDA joyposright 1391 42ff c9 01 CMP #1 1392 4301 d0 12 BNE .skip19then 1393 4303 .condpart20 1394 4303 18 CLC 1395 4304 69 01 ADC #1 1396 4306 8d 49 01 STA bullet1_xpos 1397 4309 18 CLC 1398 430a 69 01 ADC #1 1399 430c 8d 4a 01 STA bullet2_xpos 1400 430f 18 CLC 1401 4310 69 01 ADC #1 1402 4312 8d 4b 01 STA bullet3_xpos 1403 4315 .skip19then 1404 4315 .skip18then 1405 4315 .skip17then 1406 4315 .skip16then 1407 4315 .skipL099 1408 4315 . 1409 4315 ;; 1410 4315 1411 4315 . 1412 4315 ;; 1413 4315 1414 4315 . 1415 4315 ;; 1416 4315 1417 4315 .L0100 ;; gosub check_collisions 1418 4315 1419 4315 20 48 45 jsr .check_collisions 1420 4318 1421 4318 .L0101 ;; if isDead_flag then goto lose_a_life 1422 4318 1423 4318 ad 64 01 LDA isDead_flag 1424 431b f0 03 BEQ .skipL0101 1425 431d .condpart21 1426 431d 4c 57 44 jmp .lose_a_life 1427 4320 1428 4320 .skipL0101 1429 4320 .L0102 ;; if player_xpos > 152 then player_xpos = player_xpos - 1 1430 4320 1431 4320 a9 98 LDA #152 1432 4322 cd 42 01 CMP player_xpos 1433 4325 b0 09 BCS .skipL0102 1434 4327 .condpart22 1435 4327 ad 42 01 LDA player_xpos 1436 432a 38 SEC 1437 432b e9 01 SBC #1 1438 432d 8d 42 01 STA player_xpos 1439 4330 .skipL0102 1440 4330 .L0103 ;; if player_xpos < 1 then player_xpos = player_xpos + 1 1441 4330 1442 4330 ad 42 01 LDA player_xpos 1443 4333 c9 01 CMP #1 1444 4335 b0 09 BCS .skipL0103 1445 4337 .condpart23 1446 4337 ad 42 01 LDA player_xpos 1447 433a 18 CLC 1448 433b 69 01 ADC #1 1449 433d 8d 42 01 STA player_xpos 1450 4340 .skipL0103 1451 4340 .L0104 ;; if player_ypos > 207 then player_ypos = player_ypos - 1 1452 4340 1453 4340 a9 cf LDA #207 1454 4342 cd 43 01 CMP player_ypos 1455 4345 b0 09 BCS .skipL0104 1456 4347 .condpart24 1457 4347 ad 43 01 LDA player_ypos 1458 434a 38 SEC 1459 434b e9 01 SBC #1 1460 434d 8d 43 01 STA player_ypos 1461 4350 .skipL0104 1462 4350 .L0105 ;; if player_ypos < 1 then player_ypos = player_ypos + 1 1463 4350 1464 4350 ad 43 01 LDA player_ypos 1465 4353 c9 01 CMP #1 1466 4355 b0 09 BCS .skipL0105 1467 4357 .condpart25 1468 4357 ad 43 01 LDA player_ypos 1469 435a 18 CLC 1470 435b 69 01 ADC #1 1471 435d 8d 43 01 STA player_ypos 1472 4360 .skipL0105 1473 4360 . 1474 4360 ;; 1475 4360 1476 4360 . 1477 4360 ;; 1478 4360 1479 4360 . 1480 4360 ;; 1481 4360 1482 4360 . 1483 4360 ;; 1484 4360 1485 4360 . 1486 4360 ;; 1487 4360 1488 4360 . 1489 4360 ;; 1490 4360 1491 4360 . 1492 4360 ;; 1493 4360 1494 4360 . 1495 4360 ;; 1496 4360 1497 4360 . 1498 4360 ;; 1499 4360 1500 4360 . 1501 4360 ;; 1502 4360 1503 4360 . 1504 4360 ;; 1505 4360 1506 4360 . 1507 4360 ;; 1508 4360 1509 4360 . 1510 4360 ;; 1511 4360 1512 4360 . 1513 4360 ;; 1514 4360 1515 4360 .L0106 ;; restorescreen 1516 4360 1517 4360 20 91 f0 jsr restorescreen 1518 4363 .L0107 ;; gosub display_bullets 1519 4363 1520 4363 20 71 47 jsr .display_bullets 1521 4366 1522 4366 .L0108 ;; gosub _draw_sprites 1523 4366 1524 4366 20 7e 43 jsr ._draw_sprites 1525 4369 1526 4369 .L0109 ;; gosub _draw_score 1527 4369 1528 4369 20 c9 43 jsr ._draw_score 1529 436c 1530 436c .L0110 ;; gosub check_firebutton 1531 436c 1532 436c 20 50 46 jsr .check_firebutton 1533 436f 1534 436f .L0111 ;; gosub move_bullets 1535 436f 1536 436f 20 cf 46 jsr .move_bullets 1537 4372 1538 4372 .L0112 ;; gosub check_bullet_time 1539 4372 1540 4372 20 f7 46 jsr .check_bullet_time 1541 4375 1542 4375 .L0113 ;; gosub check_bullet_boundary 1543 4375 1544 4375 20 24 47 jsr .check_bullet_boundary 1545 4378 1546 4378 . 1547 4378 ;; 1548 4378 1549 4378 .L0114 ;; drawscreen 1550 4378 1551 4378 20 b3 f0 jsr drawscreen 1552 437b .L0115 ;; goto mainloop 1553 437b 1554 437b 4c fe 41 jmp .mainloop 1555 437e 1556 437e . 1557 437e ;; 1558 437e 1559 437e . 1560 437e ;; 1561 437e 1562 437e . 1563 437e ;; 1564 437e 1565 437e ._draw_sprites 1566 437e ;; _draw_sprites 1567 437e 1568 437e .L0116 ;; plotsprite playership 0 player_xpos player_ypos 1569 437e 1570 437e a9 00 lda #playership 1574 4384 85 43 sta temp2 1575 4386 1576 4386 a9 1e lda #(0|playership_width_twoscompliment) 1577 4388 85 44 sta temp3 1578 438a 1579 438a ad 42 01 lda player_xpos 1580 438d 85 45 sta temp4 1581 438f 1582 438f ad 43 01 lda player_ypos 1583 4392 1584 4392 85 46 sta temp5 1585 4394 1586 4394 a9 40 lda #(playership_mode|%01000000) 1587 4396 85 47 sta temp6 1588 4398 1589 4398 20 93 f2 jsr plotsprite 1590 439b .L0117 ;; plotsprite demoObstacle 1 obstacle_xpos obstacle_ypos 1591 439b 1592 439b a9 5d lda #demoObstacle 1596 43a1 85 43 sta temp2 1597 43a3 1598 43a3 a9 3e lda #(32|demoObstacle_width_twoscompliment) 1599 43a5 85 44 sta temp3 1600 43a7 1601 43a7 ad 65 01 lda obstacle_xpos 1602 43aa 85 45 sta temp4 1603 43ac 1604 43ac ad 66 01 lda obstacle_ypos 1605 43af 1606 43af 85 46 sta temp5 1607 43b1 1608 43b1 a9 40 lda #(demoObstacle_mode|%01000000) 1609 43b3 85 47 sta temp6 1610 43b5 1611 43b5 20 93 f2 jsr plotsprite 1612 43b8 ; +tall sprite replot 1613 43b8 18 clc 1614 43b9 a5 42 lda temp1 1615 43bb 69 02 adc #demoObstacle_width 1616 43bd 85 42 sta temp1 1617 43bf a5 46 lda temp5 1618 43c1 69 08 adc #WZONEHEIGHT 1619 43c3 85 46 sta temp5 1620 43c5 20 93 f2 jsr plotsprite 1621 43c8 .L0118 ;; return 1622 43c8 1623 43c8 60 RTS 1624 43c9 . 1625 43c9 ;; 1626 43c9 1627 43c9 ._draw_score 1628 43c9 ;; _draw_score 1629 43c9 1630 43c9 .L0119 ;; plotvalue demoascii_redoiii 1 score0 6 10 2 1631 43c9 1632 43c9 a9 02 lda #demoascii_redoiii 1636 43cf 85 43 sta temp2 1637 43d1 1638 43d1 ad 06 21 lda charactermode 1639 43d4 85 4a sta temp9 1640 43d6 a9 60 lda #(demoascii_redoiii_mode | %01100000) 1641 43d8 8d 06 21 sta charactermode 1642 43db a9 1a lda #26 ; width in two's complement 1643 43dd 09 20 ora #32 ; palette left shifted 5 bits 1644 43df 85 44 sta temp3 1645 43e1 a9 0a lda #10 1646 43e3 85 45 sta temp4 1647 43e5 1648 43e5 a9 02 lda #2 1649 43e7 85 46 sta temp5 1650 43e9 1651 43e9 a9 06 lda #6 1652 43eb 85 47 sta temp6 1653 43ed 1654 43ed a9 a6 lda #score0 1658 43f3 85 49 sta temp8 1659 43f5 1660 43f5 20 b2 f3 jsr plotvalue 1661 43f5 00 01 USED_PLOTVALUE = 1 1662 43f8 a5 4a lda temp9 1663 43fa 8d 06 21 sta charactermode 1664 43fd .L0120 ;; plotvalue demoascii_redoiii 1 lives 2 144 2 1665 43fd 1666 43fd a9 02 lda #demoascii_redoiii 1670 4403 85 43 sta temp2 1671 4405 1672 4405 ad 06 21 lda charactermode 1673 4408 85 4a sta temp9 1674 440a a9 60 lda #(demoascii_redoiii_mode | %01100000) 1675 440c 8d 06 21 sta charactermode 1676 440f a9 1e lda #30 ; width in two's complement 1677 4411 09 20 ora #32 ; palette left shifted 5 bits 1678 4413 85 44 sta temp3 1679 4415 a9 90 lda #144 1680 4417 85 45 sta temp4 1681 4419 1682 4419 a9 02 lda #2 1683 441b 85 46 sta temp5 1684 441d 1685 441d a9 02 lda #2 1686 441f 85 47 sta temp6 1687 4421 1688 4421 a9 69 lda #lives 1692 4427 85 49 sta temp8 1693 4429 1694 4429 20 b2 f3 jsr plotvalue 1695 4429 00 01 USED_PLOTVALUE = 1 1696 442c a5 4a lda temp9 1697 442e 8d 06 21 sta charactermode 1698 4431 .L0121 ;; return 1699 4431 1700 4431 60 RTS 1701 4432 . 1702 4432 ;; 1703 4432 1704 4432 . 1705 4432 ;; 1706 4432 1707 4432 . 1708 4432 ;; 1709 4432 1710 4432 . 1711 4432 ;; 1712 4432 1713 4432 . 1714 4432 ;; 1715 4432 1716 4432 . 1717 4432 ;; 1718 4432 1719 4432 . 1720 4432 ;; 1721 4432 1722 4432 . 1723 4432 ;; 1724 4432 1725 4432 . 1726 4432 ;; 1727 4432 1728 4432 . 1729 4432 ;; 1730 4432 1731 4432 . 1732 4432 ;; 1733 4432 1734 4432 . 1735 4432 ;; 1736 4432 1737 4432 . 1738 4432 ;; 1739 4432 1740 4432 . 1741 4432 ;; 1742 4432 1743 4432 . 1744 4432 ;; 1745 4432 1746 4432 . 1747 4432 ;; 1748 4432 1749 4432 . 1750 4432 ;; 1751 4432 1752 4432 .Set_Bullet_home 1753 4432 ;; Set_Bullet_home 1754 4432 1755 4432 .L0122 ;; bullet1_xpos = player_xpos + 4 : bullet1_ypos = player_ypos + 4 1756 4432 1757 4432 18 CLC 1758 4433 69 04 ADC #4 1759 4435 8d 49 01 STA bullet1_xpos 1760 4438 18 CLC 1761 4439 69 04 ADC #4 1762 443b 8d 4c 01 STA bullet1_ypos 1763 443e .L0123 ;; bullet2_xpos = player_xpos + 4 : bullet2_ypos = player_ypos + 4 1764 443e 1765 443e 18 CLC 1766 443f 69 04 ADC #4 1767 4441 8d 4a 01 STA bullet2_xpos 1768 4444 18 CLC 1769 4445 69 04 ADC #4 1770 4447 8d 4d 01 STA bullet2_ypos 1771 444a .L0124 ;; bullet3_xpos = player_xpos + 4 : bullet3_ypos = player_ypos + 4 1772 444a 1773 444a 18 CLC 1774 444b 69 04 ADC #4 1775 444d 8d 4b 01 STA bullet3_xpos 1776 4450 18 CLC 1777 4451 69 04 ADC #4 1778 4453 8d 4e 01 STA bullet3_ypos 1779 4456 .L0125 ;; return 1780 4456 1781 4456 60 RTS 1782 4457 . 1783 4457 ;; 1784 4457 1785 4457 .lose_a_life 1786 4457 ;; lose_a_life 1787 4457 1788 4457 .L0126 ;; lives = lives - 1 : isDead_flag = 0 1789 4457 1790 4457 ad 69 01 LDA lives 1791 445a 38 SEC 1792 445b e9 01 SBC #1 1793 445d 8d 69 01 STA lives 1794 4460 a9 00 LDA #0 1795 4462 8d 64 01 STA isDead_flag 1796 4465 .L0127 ;; if obstacle_flag <> 1 then obstacle_xpos = 104 : obstacle_ypos = 20 1797 4465 1798 4465 ad 67 01 LDA obstacle_flag 1799 4468 c9 01 CMP #1 1800 446a f0 0a BEQ .skipL0127 1801 446c .condpart26 1802 446c a9 68 LDA #104 1803 446e 8d 65 01 STA obstacle_xpos 1804 4471 a9 14 LDA #20 1805 4473 8d 66 01 STA obstacle_ypos 1806 4476 .skipL0127 1807 4476 .L0128 ;; if player_Flag = 1 && lives > 0 then player_xpos = 20 : player_ypos = 104 : player_Flag = 0 : goto main 1808 4476 1809 4476 ad 68 01 LDA player_Flag 1810 4479 c9 01 CMP #1 1811 447b d0 19 BNE .skipL0128 1812 447d .condpart27 1813 447d a9 00 LDA #0 1814 447f cd 69 01 CMP lives 1815 4482 b0 12 BCS .skip27then 1816 4484 .condpart28 1817 4484 a9 14 LDA #20 1818 4486 8d 42 01 STA player_xpos 1819 4489 a9 68 LDA #104 1820 448b 8d 43 01 STA player_ypos 1821 448e a9 00 LDA #0 1822 4490 8d 68 01 STA player_Flag 1823 4493 4c e9 41 jmp .main 1824 4496 1825 4496 .skip27then 1826 4496 .skipL0128 1827 4496 .L0129 ;; joyposup = 0 : joyposdown = 0 : joyposleft = 0 : joyposright = 0 1828 4496 1829 4496 a9 00 LDA #0 1830 4498 8d 45 01 STA joyposup 1831 449b 8d 46 01 STA joyposdown 1832 449e 8d 47 01 STA joyposleft 1833 44a1 8d 48 01 STA joyposright 1834 44a4 . 1835 44a4 ;; 1836 44a4 1837 44a4 .lose_a_lifeloop 1838 44a4 ;; lose_a_lifeloop 1839 44a4 1840 44a4 .L0130 ;; restorescreen 1841 44a4 1842 44a4 20 91 f0 jsr restorescreen 1843 44a7 .L0131 ;; gosub _draw_score 1844 44a7 1845 44a7 20 c9 43 jsr ._draw_score 1846 44aa 1847 44aa .L0132 ;; drawscreen 1848 44aa 1849 44aa 20 b3 f0 jsr drawscreen 1850 44ad .L0133 ;; if joy0fire then fire_debounce = 2 1851 44ad 1852 44ad 2c 02 21 bit sINPT1 1853 44b0 10 05 BPL .skipL0133 1854 44b2 .condpart29 1855 44b2 a9 02 LDA #2 1856 44b4 8d 44 01 STA fire_debounce 1857 44b7 .skipL0133 1858 44b7 .L0134 ;; if !joy0fire then fire_debounce = 1 1859 44b7 1860 44b7 2c 02 21 bit sINPT1 1861 44ba 30 05 BMI .skipL0134 1862 44bc .condpart30 1863 44bc a9 01 LDA #1 1864 44be 8d 44 01 STA fire_debounce 1865 44c1 .skipL0134 1866 44c1 .L0135 ;; if fire_debounce = 1 && lives > 0 then clearscreen : goto main 1867 44c1 1868 44c1 ad 44 01 LDA fire_debounce 1869 44c4 c9 01 CMP #1 1870 44c6 d0 0d BNE .skipL0135 1871 44c8 .condpart31 1872 44c8 a9 00 LDA #0 1873 44ca cd 69 01 CMP lives 1874 44cd b0 06 BCS .skip31then 1875 44cf .condpart32 1876 44cf 20 7f f0 jsr clearscreen 1877 44d2 4c e9 41 jmp .main 1878 44d5 1879 44d5 .skip31then 1880 44d5 .skipL0135 1881 44d5 .L0136 ;; if fire_debounce = 1 && lives < 1 then clearscreen : goto gameover 1882 44d5 1883 44d5 ad 44 01 LDA fire_debounce 1884 44d8 c9 01 CMP #1 1885 44da d0 0d BNE .skipL0136 1886 44dc .condpart33 1887 44dc ad 69 01 LDA lives 1888 44df c9 01 CMP #1 1889 44e1 b0 06 BCS .skip33then 1890 44e3 .condpart34 1891 44e3 20 7f f0 jsr clearscreen 1892 44e6 4c ec 44 jmp .gameover 1893 44e9 1894 44e9 .skip33then 1895 44e9 .skipL0136 1896 44e9 .L0137 ;; goto lose_a_lifeloop 1897 44e9 1898 44e9 4c a4 44 jmp .lose_a_lifeloop 1899 44ec 1900 44ec . 1901 44ec ;; 1902 44ec 1903 44ec .gameover 1904 44ec ;; gameover 1905 44ec 1906 44ec .L0138 ;; gameover_flag = 0 1907 44ec 1908 44ec a9 00 LDA #0 1909 44ee 8d 63 01 STA gameover_flag 1910 44f1 .L0139 ;; fire_debounce = 1 1911 44f1 1912 44f1 a9 01 LDA #1 1913 44f3 8d 44 01 STA fire_debounce 1914 44f6 . 1915 44f6 ;; 1916 44f6 1917 44f6 .gameover_loop 1918 44f6 ;; gameover_loop 1919 44f6 1920 44f6 .L0140 ;; if lives = 0 then gameover_flag = 1 : clearscreen 1921 44f6 1922 44f6 ad 69 01 LDA lives 1923 44f9 c9 00 CMP #0 1924 44fb d0 08 BNE .skipL0140 1925 44fd .condpart35 1926 44fd a9 01 LDA #1 1927 44ff 8d 63 01 STA gameover_flag 1928 4502 20 7f f0 jsr clearscreen 1929 4505 .skipL0140 1930 4505 .L0141 ;; plotchars 'Game^Over!' 0 40 16 1931 4505 1932 4505 4c 12 45 JMP skipalphadata3 1933 4508 alphadata3 1934 4508 27 .byte.b (alphadata3 1949 4518 85 43 sta temp2 1950 451a 1951 451a a9 16 lda #22 ; width in two's complement 1952 451c 09 00 ora #0 ; palette left shifted 5 bits 1953 451e 85 44 sta temp3 1954 4520 a9 28 lda #40 1955 4522 85 45 sta temp4 1956 4524 1957 4524 a9 10 lda #16 1958 4526 1959 4526 85 46 sta temp5 1960 4528 1961 4528 20 4c f3 jsr plotcharacters 1962 452b .L0142 ;; if joy0fire && !fire_debounce then clearscreen : goto plot 1963 452b 1964 452b 2c 02 21 bit sINPT1 1965 452e 10 0b BPL .skipL0142 1966 4530 .condpart36 1967 4530 ad 44 01 LDA fire_debounce 1968 4533 d0 06 BNE .skip36then 1969 4535 .condpart37 1970 4535 20 7f f0 jsr clearscreen 1971 4538 4c 1c 41 jmp .plot 1972 453b 1973 453b .skip36then 1974 453b .skipL0142 1975 453b .L0143 ;; if !joy0fire then fire_debounce = 0 1976 453b 1977 453b 2c 02 21 bit sINPT1 1978 453e 30 05 BMI .skipL0143 1979 4540 .condpart38 1980 4540 a9 00 LDA #0 1981 4542 8d 44 01 STA fire_debounce 1982 4545 .skipL0143 1983 4545 .L0144 ;; goto gameover_loop 1984 4545 1985 4545 4c f6 44 jmp .gameover_loop 1986 4548 1987 4548 . 1988 4548 ;; 1989 4548 1990 4548 . 1991 4548 ;; 1992 4548 1993 4548 .check_collisions 1994 4548 ;; check_collisions 1995 4548 1996 4548 .L0145 ;; if boxcollision ( player_xpos , player_ypos , 8 , 8 , obstacle_xpos , obstacle_ypos , 8 , 16 ) then obstacle_xpos = 200 : obstacle_ypos = 224 : player_Flag = 1 : isDead_flag = 1 : goto _checkCollisionsExit 1997 4548 1998 4548 1999 4548 18 clc ; one clc only. If we overflow we're screwed anyway. 2000 4549 a0 07 ldy #(8-1) 2001 454b 84 44 sty temp3 2002 454d a0 07 ldy #(8-1) 2003 454f 84 45 sty temp4 2004 4551 ad 65 01 lda obstacle_xpos 2005 4554 69 30 adc #48 2006 4556 85 46 sta temp5 2007 4558 ad 66 01 lda obstacle_ypos 2008 455b 69 18 adc #((256-WSCREENHEIGHT)/2) 2009 455d 85 47 sta temp6 2010 455f a0 07 ldy #(8-1) 2011 4561 84 48 sty temp7 2012 4563 a0 0f ldy #(16-1) 2013 4565 84 49 sty temp8 2014 4567 ad 43 01 lda player_ypos 2015 456a 69 18 adc #((256-WSCREENHEIGHT)/2) 2016 456c a8 tay 2017 456d ad 42 01 lda player_xpos 2018 4570 69 30 adc #48 2019 4572 20 fa f3 jsr boxcollision 2020 4575 2021 4575 90 15 BCC .skipL0145 2022 4577 .condpart39 2023 4577 a9 c8 LDA #200 2024 4579 8d 65 01 STA obstacle_xpos 2025 457c a9 e0 LDA #224 2026 457e 8d 66 01 STA obstacle_ypos 2027 4581 a9 01 LDA #1 2028 4583 8d 68 01 STA player_Flag 2029 4586 8d 64 01 STA isDead_flag 2030 4589 4c 4f 46 jmp ._checkCollisionsExit 2031 458c 2032 458c .skipL0145 2033 458c .L0146 ;; if boxcollision ( bullet1_xpos , bullet1_ypos , 8 , 8 , obstacle_xpos , obstacle_ypos , 8 , 16 ) then obstacle_xpos = 200 : obstacle_ypos = 224 : obstacle_flag = 1 : goto _checkCollisionsExit 2034 458c 2035 458c 2036 458c 18 clc ; one clc only. If we overflow we're screwed anyway. 2037 458d a0 07 ldy #(8-1) 2038 458f 84 44 sty temp3 2039 4591 a0 07 ldy #(8-1) 2040 4593 84 45 sty temp4 2041 4595 ad 65 01 lda obstacle_xpos 2042 4598 69 30 adc #48 2043 459a 85 46 sta temp5 2044 459c ad 66 01 lda obstacle_ypos 2045 459f 69 18 adc #((256-WSCREENHEIGHT)/2) 2046 45a1 85 47 sta temp6 2047 45a3 a0 07 ldy #(8-1) 2048 45a5 84 48 sty temp7 2049 45a7 a0 0f ldy #(16-1) 2050 45a9 84 49 sty temp8 2051 45ab ad 4c 01 lda bullet1_ypos 2052 45ae 69 18 adc #((256-WSCREENHEIGHT)/2) 2053 45b0 a8 tay 2054 45b1 ad 49 01 lda bullet1_xpos 2055 45b4 69 30 adc #48 2056 45b6 20 fa f3 jsr boxcollision 2057 45b9 2058 45b9 90 12 BCC .skipL0146 2059 45bb .condpart40 2060 45bb a9 c8 LDA #200 2061 45bd 8d 65 01 STA obstacle_xpos 2062 45c0 a9 e0 LDA #224 2063 45c2 8d 66 01 STA obstacle_ypos 2064 45c5 a9 01 LDA #1 2065 45c7 8d 67 01 STA obstacle_flag 2066 45ca 4c 4f 46 jmp ._checkCollisionsExit 2067 45cd 2068 45cd .skipL0146 2069 45cd .L0147 ;; if boxcollision ( bullet2_xpos , bullet2_ypos , 8 , 8 , obstacle_xpos , obstacle_ypos , 8 , 16 ) then obstacle_xpos = 200 : obstacle_ypos = 224 : obstacle_flag = 1 : goto _checkCollisionsExit 2070 45cd 2071 45cd 2072 45cd 18 clc ; one clc only. If we overflow we're screwed anyway. 2073 45ce a0 07 ldy #(8-1) 2074 45d0 84 44 sty temp3 2075 45d2 a0 07 ldy #(8-1) 2076 45d4 84 45 sty temp4 2077 45d6 ad 65 01 lda obstacle_xpos 2078 45d9 69 30 adc #48 2079 45db 85 46 sta temp5 2080 45dd ad 66 01 lda obstacle_ypos 2081 45e0 69 18 adc #((256-WSCREENHEIGHT)/2) 2082 45e2 85 47 sta temp6 2083 45e4 a0 07 ldy #(8-1) 2084 45e6 84 48 sty temp7 2085 45e8 a0 0f ldy #(16-1) 2086 45ea 84 49 sty temp8 2087 45ec ad 4d 01 lda bullet2_ypos 2088 45ef 69 18 adc #((256-WSCREENHEIGHT)/2) 2089 45f1 a8 tay 2090 45f2 ad 4a 01 lda bullet2_xpos 2091 45f5 69 30 adc #48 2092 45f7 20 fa f3 jsr boxcollision 2093 45fa 2094 45fa 90 12 BCC .skipL0147 2095 45fc .condpart41 2096 45fc a9 c8 LDA #200 2097 45fe 8d 65 01 STA obstacle_xpos 2098 4601 a9 e0 LDA #224 2099 4603 8d 66 01 STA obstacle_ypos 2100 4606 a9 01 LDA #1 2101 4608 8d 67 01 STA obstacle_flag 2102 460b 4c 4f 46 jmp ._checkCollisionsExit 2103 460e 2104 460e .skipL0147 2105 460e .L0148 ;; if boxcollision ( bullet3_xpos , bullet3_ypos , 8 , 8 , obstacle_xpos , obstacle_ypos , 8 , 16 ) then obstacle_xpos = 200 : obstacle_ypos = 224 : obstacle_flag = 1 : goto _checkCollisionsExit 2106 460e 2107 460e 2108 460e 18 clc ; one clc only. If we overflow we're screwed anyway. 2109 460f a0 07 ldy #(8-1) 2110 4611 84 44 sty temp3 2111 4613 a0 07 ldy #(8-1) 2112 4615 84 45 sty temp4 2113 4617 ad 65 01 lda obstacle_xpos 2114 461a 69 30 adc #48 2115 461c 85 46 sta temp5 2116 461e ad 66 01 lda obstacle_ypos 2117 4621 69 18 adc #((256-WSCREENHEIGHT)/2) 2118 4623 85 47 sta temp6 2119 4625 a0 07 ldy #(8-1) 2120 4627 84 48 sty temp7 2121 4629 a0 0f ldy #(16-1) 2122 462b 84 49 sty temp8 2123 462d ad 4e 01 lda bullet3_ypos 2124 4630 69 18 adc #((256-WSCREENHEIGHT)/2) 2125 4632 a8 tay 2126 4633 ad 4b 01 lda bullet3_xpos 2127 4636 69 30 adc #48 2128 4638 20 fa f3 jsr boxcollision 2129 463b 2130 463b 90 12 BCC .skipL0148 2131 463d .condpart42 2132 463d a9 c8 LDA #200 2133 463f 8d 65 01 STA obstacle_xpos 2134 4642 a9 e0 LDA #224 2135 4644 8d 66 01 STA obstacle_ypos 2136 4647 a9 01 LDA #1 2137 4649 8d 67 01 STA obstacle_flag 2138 464c 4c 4f 46 jmp ._checkCollisionsExit 2139 464f 2140 464f .skipL0148 2141 464f . 2142 464f ;; 2143 464f 2144 464f ._checkCollisionsExit 2145 464f ;; _checkCollisionsExit 2146 464f 2147 464f .L0149 ;; return 2148 464f 2149 464f 60 RTS 2150 4650 . 2151 4650 ;; 2152 4650 2153 4650 .check_firebutton 2154 4650 ;; check_firebutton 2155 4650 2156 4650 .L0150 ;; if fire_debounce > 0 && joy0fire then return 2157 4650 2158 4650 a9 00 LDA #0 2159 4652 cd 44 01 CMP fire_debounce 2160 4655 b0 06 BCS .skipL0150 2161 4657 .condpart43 2162 4657 2c 02 21 bit sINPT1 2163 465a 10 01 BPL .skip43then 2164 465c .condpart44 2165 465c 60 RTS 2166 465d .skip43then 2167 465d .skipL0150 2168 465d .L0151 ;; if !joy0fire then fire_debounce = 0 : return 2169 465d 2170 465d 2c 02 21 bit sINPT1 2171 4660 30 06 BMI .skipL0151 2172 4662 .condpart45 2173 4662 a9 00 LDA #0 2174 4664 8d 44 01 STA fire_debounce 2175 4667 60 RTS 2176 4668 .skipL0151 2177 4668 .L0152 ;; temp5 = 255 2178 4668 2179 4668 a9 ff LDA #255 2180 466a 85 46 STA temp5 2181 466c .L0153 ;; for temp1 = 0 to 2 2182 466c 2183 466c a9 00 LDA #0 2184 466e 85 42 STA temp1 2185 4670 .L0153fortemp1 2186 4670 .L0154 ;; if bullet1_xpos[temp1]! = 200 then temp5 = temp1 2187 4670 2188 4670 a6 42 LDX temp1 2189 4672 bd 49 01 LDA bullet1_xpos,x 2190 4675 c9 c8 CMP #200 2191 4677 d0 04 BNE .skipL0154 2192 4679 .condpart46 2193 4679 a5 42 LDA temp1 2194 467b 85 46 STA temp5 2195 467d .skipL0154 2196 467d .L0155 ;; next 2197 467d 2198 467d a5 42 LDA temp1 2199 467f c9 02 CMP #2 2200 4681 e6 42 INC temp1 2201 4683 if ((* - .L0153fortemp1) < 127) && ((* - .L0153fortemp1) > -128) 2202 4683 90 eb bcc .L0153fortemp1 2203 4685 - else 2204 4685 - bcs .0skipL0153fortemp1 2205 4685 - jmp .L0153fortemp1 2206 4685 -.0skipL0153fortemp1 2207 4685 endif 2208 4685 .L0156 ;; if temp5 = 255 then return : playsfx sfx_pulsecannon 2209 4685 2210 4685 a5 46 LDA temp5 2211 4687 c9 ff CMP #255 2212 4689 d0 1a BNE .skipL0156 2213 468b .condpart47 2214 468b 60 RTS 2215 468c ifnconst NOTIALOCKMUTE 2216 468c a9 01 lda #1 2217 468e 85 de sta sfxschedulelock 2218 4690 a9 ed lda #sfx_pulsecannon 2221 4696 85 e1 sta sfxinstrumenthi 2222 4698 a9 00 lda #0 2223 469a 85 e2 sta sfxpitchoffset ; no pitch modification 2224 469c 85 e3 sta sfxnoteindex ; not a musical note 2225 469e 20 4b f2 jsr schedulesfx 2226 46a1 a9 00 lda #0 2227 46a3 85 de sta sfxschedulelock 2228 46a5 endif ; NOTIALOCKMUTE 2229 46a5 .skipL0156 2230 46a5 .L0157 ;; fire_debounce = 255 2231 46a5 2232 46a5 a9 ff LDA #255 2233 46a7 8d 44 01 STA fire_debounce 2234 46aa .L0158 ;; bullet1_time[temp5] = 200 2235 46aa 2236 46aa a9 c8 LDA #200 2237 46ac a6 46 LDX temp5 2238 46ae 9d 6d 01 STA bullet1_time,x 2239 46b1 .L0159 ;; bullet1_xpos[temp5] = player_xpos + 8 2240 46b1 2241 46b1 ad 42 01 LDA player_xpos 2242 46b4 18 CLC 2243 46b5 69 08 ADC #8 2244 46b7 a6 46 LDX temp5 2245 46b9 9d 49 01 STA bullet1_xpos,x 2246 46bc .L0160 ;; bullet1_ypos[temp5] = player_ypos + 0 2247 46bc 2248 46bc ad 43 01 LDA player_ypos 2249 46bf 18 CLC 2250 46c0 69 00 ADC #0 2251 46c2 a6 46 LDX temp5 2252 46c4 9d 4c 01 STA bullet1_ypos,x 2253 46c7 . 2254 46c7 ;; 2255 46c7 2256 46c7 .L0161 ;; temp5 = temp5 - 6 2257 46c7 2258 46c7 a5 46 LDA temp5 2259 46c9 38 SEC 2260 46ca e9 06 SBC #6 2261 46cc 85 46 STA temp5 2262 46ce .L0162 ;; return 2263 46ce 2264 46ce 60 RTS 2265 46cf . 2266 46cf ;; 2267 46cf 2268 46cf .move_bullets 2269 46cf ;; move_bullets 2270 46cf 2271 46cf .L0163 ;; if bullet1_xpos <> 200 then bullet1_xpos = bullet1_xpos + 1 2272 46cf 2273 46cf ad 49 01 LDA bullet1_xpos 2274 46d2 c9 c8 CMP #200 2275 46d4 f0 06 BEQ .skipL0163 2276 46d6 .condpart48 2277 46d6 18 CLC 2278 46d7 69 01 ADC #1 2279 46d9 8d 49 01 STA bullet1_xpos 2280 46dc .skipL0163 2281 46dc .L0164 ;; if bullet2_xpos <> 200 then bullet2_xpos = bullet2_xpos + 1 2282 46dc 2283 46dc ad 4a 01 LDA bullet2_xpos 2284 46df c9 c8 CMP #200 2285 46e1 f0 06 BEQ .skipL0164 2286 46e3 .condpart49 2287 46e3 18 CLC 2288 46e4 69 01 ADC #1 2289 46e6 8d 4a 01 STA bullet2_xpos 2290 46e9 .skipL0164 2291 46e9 .L0165 ;; if bullet3_xpos <> 200 then bullet3_xpos = bullet3_xpos + 1 2292 46e9 2293 46e9 ad 4b 01 LDA bullet3_xpos 2294 46ec c9 c8 CMP #200 2295 46ee f0 06 BEQ .skipL0165 2296 46f0 .condpart50 2297 46f0 18 CLC 2298 46f1 69 01 ADC #1 2299 46f3 8d 4b 01 STA bullet3_xpos 2300 46f6 .skipL0165 2301 46f6 .L0166 ;; return 2302 46f6 2303 46f6 60 RTS 2304 46f7 . 2305 46f7 ;; 2306 46f7 2307 46f7 .check_bullet_time 2308 46f7 ;; check_bullet_time 2309 46f7 2310 46f7 .L0167 ;; for temp1 = 0 to 2 2311 46f7 2312 46f7 a9 00 LDA #0 2313 46f9 85 42 STA temp1 2314 46fb .L0167fortemp1 2315 46fb .L0168 ;; if bullet1_time[temp1] > 0 then bullet1_time[temp1] = bullet1_time[temp1] - 1 else bullet1_xpos[temp1] = 200 2316 46fb 2317 46fb a9 00 LDA #0 2318 46fd a6 42 LDX temp1 2319 46ff dd 6d 01 CMP bullet1_time,x 2320 4702 b0 10 BCS .skipL0168 2321 4704 .condpart51 2322 4704 a6 42 LDX temp1 2323 4706 bd 6d 01 LDA bullet1_time,x 2324 4709 38 SEC 2325 470a e9 01 SBC #1 2326 470c a6 42 LDX temp1 2327 470e 9d 6d 01 STA bullet1_time,x 2328 4711 4c 1b 47 jmp .skipelse0 2329 4714 .skipL0168 2330 4714 a9 c8 LDA #200 2331 4716 a6 42 LDX temp1 2332 4718 9d 49 01 STA bullet1_xpos,x 2333 471b .skipelse0 2334 471b .L0169 ;; next 2335 471b 2336 471b a5 42 LDA temp1 2337 471d c9 02 CMP #2 2338 471f e6 42 INC temp1 2339 4721 if ((* - .L0167fortemp1) < 127) && ((* - .L0167fortemp1) > -128) 2340 4721 90 d8 bcc .L0167fortemp1 2341 4723 - else 2342 4723 - bcs .1skipL0167fortemp1 2343 4723 - jmp .L0167fortemp1 2344 4723 -.1skipL0167fortemp1 2345 4723 endif 2346 4723 .L0170 ;; return 2347 4723 2348 4723 60 RTS 2349 4724 . 2350 4724 ;; 2351 4724 2352 4724 .check_bullet_boundary 2353 4724 ;; check_bullet_boundary 2354 4724 2355 4724 .L0171 ;; for temp1 = 0 to 2 2356 4724 2357 4724 a9 00 LDA #0 2358 4726 85 42 STA temp1 2359 4728 .L0171fortemp1 2360 4728 .L0172 ;; temp_x = bullet1_xpos[temp1] 2361 4728 2362 4728 a6 42 LDX temp1 2363 472a bd 49 01 LDA bullet1_xpos,x 2364 472d 8d 6b 01 STA temp_x 2365 4730 .L0173 ;; temp_y = bullet1_ypos[temp2] 2366 4730 2367 4730 a6 43 LDX temp2 2368 4732 bd 4c 01 LDA bullet1_ypos,x 2369 4735 8d 6c 01 STA temp_y 2370 4738 .L0174 ;; if temp_x < 1 || temp_x > 167 then bullet1_xpos[temp1] = 200 2371 4738 2372 4738 ad 6b 01 LDA temp_x 2373 473b c9 01 CMP #1 2374 473d b0 03 BCS .skipL0174 2375 473f .condpart52 2376 473f 4c 49 47 jmp .condpart53 2377 4742 .skipL0174 2378 4742 a9 a7 LDA #167 2379 4744 cd 6b 01 CMP temp_x 2380 4747 b0 07 BCS .skip13OR 2381 4749 .condpart53 2382 4749 a9 c8 LDA #200 2383 474b a6 42 LDX temp1 2384 474d 9d 49 01 STA bullet1_xpos,x 2385 4750 .skip13OR 2386 4750 .L0175 ;; if temp_y < 1 || temp_y > 207 then bullet1_xpos[temp1] = 200 2387 4750 2388 4750 ad 6c 01 LDA temp_y 2389 4753 c9 01 CMP #1 2390 4755 b0 03 BCS .skipL0175 2391 4757 .condpart54 2392 4757 4c 61 47 jmp .condpart55 2393 475a .skipL0175 2394 475a a9 cf LDA #207 2395 475c cd 6c 01 CMP temp_y 2396 475f b0 07 BCS .skip14OR 2397 4761 .condpart55 2398 4761 a9 c8 LDA #200 2399 4763 a6 42 LDX temp1 2400 4765 9d 49 01 STA bullet1_xpos,x 2401 4768 .skip14OR 2402 4768 .L0176 ;; next 2403 4768 2404 4768 a5 42 LDA temp1 2405 476a c9 02 CMP #2 2406 476c e6 42 INC temp1 2407 476e if ((* - .L0171fortemp1) < 127) && ((* - .L0171fortemp1) > -128) 2408 476e 90 b8 bcc .L0171fortemp1 2409 4770 - else 2410 4770 - bcs .2skipL0171fortemp1 2411 4770 - jmp .L0171fortemp1 2412 4770 -.2skipL0171fortemp1 2413 4770 endif 2414 4770 .L0177 ;; return 2415 4770 2416 4770 60 RTS 2417 4771 . 2418 4771 ;; 2419 4771 2420 4771 .display_bullets 2421 4771 ;; display_bullets 2422 4771 2423 4771 .L0178 ;; for temp_loop = 0 to 2 2424 4771 2425 4771 a9 00 LDA #0 2426 4773 8d 6a 01 STA temp_loop 2427 4776 .L0178fortemp_loop 2428 4776 .L0179 ;; temp_x = bullet1_xpos[temp_loop] 2429 4776 2430 4776 ae 6a 01 LDX temp_loop 2431 4779 bd 49 01 LDA bullet1_xpos,x 2432 477c 8d 6b 01 STA temp_x 2433 477f .L0180 ;; temp_y = bullet1_ypos[temp_loop] 2434 477f 2435 477f ae 6a 01 LDX temp_loop 2436 4782 bd 4c 01 LDA bullet1_ypos,x 2437 4785 8d 6c 01 STA temp_y 2438 4788 .L0181 ;; if temp_x <> 200 then plotsprite playershot 0 temp_x temp_y 2439 4788 2440 4788 ad 6b 01 LDA temp_x 2441 478b c9 c8 CMP #200 2442 478d f0 1d BEQ .skipL0181 2443 478f .condpart56 2444 478f a9 5b lda #playershot 2448 4795 85 43 sta temp2 2449 4797 2450 4797 a9 1e lda #(0|playershot_width_twoscompliment) 2451 4799 85 44 sta temp3 2452 479b 2453 479b ad 6b 01 lda temp_x 2454 479e 85 45 sta temp4 2455 47a0 2456 47a0 ad 6c 01 lda temp_y 2457 47a3 2458 47a3 85 46 sta temp5 2459 47a5 2460 47a5 a9 40 lda #(playershot_mode|%01000000) 2461 47a7 85 47 sta temp6 2462 47a9 2463 47a9 20 93 f2 jsr plotsprite 2464 47ac .skipL0181 2465 47ac .L0182 ;; next 2466 47ac 2467 47ac ad 6a 01 LDA temp_loop 2468 47af c9 02 CMP #2 2469 47b1 ee 6a 01 INC temp_loop 2470 47b4 if ((* - .L0178fortemp_loop) < 127) && ((* - .L0178fortemp_loop) > -128) 2471 47b4 90 c0 bcc .L0178fortemp_loop 2472 47b6 - else 2473 47b6 - bcs .3skipL0178fortemp_loop 2474 47b6 - jmp .L0178fortemp_loop 2475 47b6 -.3skipL0178fortemp_loop 2476 47b6 endif 2477 47b6 .L0183 ;; return 2478 47b6 2479 47b6 60 RTS 2480 47b7 . 2481 47b7 ;; 2482 47b7 2483 47b7 . 2484 47b7 ;; 2485 47b7 2486 47b7 . 2487 47b7 ;; 2488 47b7 2489 47b7 .L0184 ;; data sfx_plainlaser 2490 47b7 2491 47b7 4c ea 47 JMP .skipL0184 2492 47ba sfx_plainlaser 2493 47ba 10 10 00 .byte.b $10,$10,$00 ; version, priority, frames per chunk 2494 47bd 2495 47bd 10 04 06 .byte.b $10,$04,$06 ; first chunk of freq,channel,volume 2496 47c0 2497 47c0 13 04 08 .byte.b $13,$04,$08 2498 47c3 2499 47c3 16 04 08 .byte.b $16,$04,$08 2500 47c6 2501 47c6 16 04 07 .byte.b $16,$04,$07 2502 47c9 2503 47c9 1c 04 09 .byte.b $1c,$04,$09 2504 47cc 2505 47cc 0b 0c 0f .byte.b $0b,$0c,$0f 2506 47cf 2507 47cf 0d 0c 0f .byte.b $0d,$0c,$0f 2508 47d2 2509 47d2 0e 0c 0f .byte.b $0e,$0c,$0f 2510 47d5 2511 47d5 0e 0c 0f .byte.b $0e,$0c,$0f 2512 47d8 2513 47d8 12 0c 0f .byte.b $12,$0c,$0f 2514 47db 2515 47db 03 06 0d .byte.b $03,$06,$0d 2516 47de 2517 47de 1e 0c 0a .byte.b $1e,$0c,$0a 2518 47e1 2519 47e1 1e 0c 0c .byte.b $1e,$0c,$0c 2520 47e4 2521 47e4 0a 06 04 .byte.b $0a,$06,$04 2522 47e7 2523 47e7 00 00 00 .byte.b $00,$00,$00 2524 47ea 2525 47ea .skipL0184 2526 47ea sfx_plainlaser_lo SET #sfx_plainlaser 2528 47ea . 2529 47ea ;; 2530 47ea 2531 47ea .L0185 ;; data sfx_pulsecannon 2532 47ea 2533 47ea 4c 41 48 JMP .skipL0185 2534 47ed sfx_pulsecannon 2535 47ed 10 10 00 .byte.b $10,$10,$00 ; version, priority, frames per chunk 2536 47f0 2537 47f0 1e 0c 0a .byte.b $1e,$0c,$0a ; first chunk of freq,channel,volume 2538 47f3 2539 47f3 07 06 0f .byte.b $07,$06,$0f 2540 47f6 2541 47f6 07 06 0f .byte.b $07,$06,$0f 2542 47f9 2543 47f9 1e 06 0f .byte.b $1e,$06,$0f 2544 47fc 2545 47fc 17 0c 0b .byte.b $17,$0c,$0b 2546 47ff 2547 47ff 1b 0c 0b .byte.b $1b,$0c,$0b 2548 4802 2549 4802 1e 0c 0f .byte.b $1e,$0c,$0f 2550 4805 2551 4805 07 06 0f .byte.b $07,$06,$0f 2552 4808 2553 4808 07 06 0f .byte.b $07,$06,$0f 2554 480b 2555 480b 1e 06 08 .byte.b $1e,$06,$08 2556 480e 2557 480e 17 0c 06 .byte.b $17,$0c,$06 2558 4811 2559 4811 1b 0c 0f .byte.b $1b,$0c,$0f 2560 4814 2561 4814 1e 0c 0f .byte.b $1e,$0c,$0f 2562 4817 2563 4817 07 06 0f .byte.b $07,$06,$0f 2564 481a 2565 481a 07 06 0f .byte.b $07,$06,$0f 2566 481d 2567 481d 0a 06 0a .byte.b $0a,$06,$0a 2568 4820 2569 4820 17 0c 0a .byte.b $17,$0c,$0a 2570 4823 2571 4823 1e 0c 04 .byte.b $1e,$0c,$04 2572 4826 2573 4826 1e 06 09 .byte.b $1e,$06,$09 2574 4829 2575 4829 1b 04 05 .byte.b $1b,$04,$05 2576 482c 2577 482c 07 06 0f .byte.b $07,$06,$0f 2578 482f 2579 482f 0a 06 09 .byte.b $0a,$06,$09 2580 4832 2581 4832 17 0c 0d .byte.b $17,$0c,$0d 2582 4835 2583 4835 1b 0c 09 .byte.b $1b,$0c,$09 2584 4838 2585 4838 0a 06 05 .byte.b $0a,$06,$05 2586 483b 2587 483b 17 0c 03 .byte.b $17,$0c,$03 2588 483e 2589 483e 00 00 00 .byte.b $00,$00,$00 2590 4841 2591 4841 .skipL0185 2592 4841 sfx_pulsecannon_lo SET #sfx_pulsecannon 2594 4841 DMAHOLEEND0 SET . 2595 4841 gameend 2596 4841 DMAHOLEEND0 SET . 38847 bytes of ROM space left in the main area. 2597 4841 echo " ",[($E000 - gameend)]d , "bytes of ROM space left in the main area." 2598 4841 - if ($E000 - gameend) < 0 2599 4841 -SPACEOVERFLOW SET (SPACEOVERFLOW+1) 2600 4841 endif 2601 4841 2602 e000 ORG $E000,0 ; ************* 2603 e000 2604 e000 playership 2605 e000 00 00 HEX 0000 2606 e002 demoascii_redoiii 2607 e002 00 00 00 00* HEX 0000000000000000000000000000000000000000000000000000000000000000 2608 e022 00 00 00 00* HEX 0000000000000000000000000000000000000000000000000000000000000000 2609 e042 00 00 00 00* HEX 00000000000000000000000000000000000000000000000000 2610 e05b playershot 2611 e05b 00 00 HEX 0000 2612 e05d demoObstacle 2613 e05d ff 55 HEX ff55 2614 e05f demoObstacle_tallsprite_00 2615 e05f 01 80 HEX 0180 2616 e061 2617 e100 ORG $E100,0 ; ************* 2618 e100 2619 e100 ;playership 2620 e100 20 00 HEX 2000 2621 e102 ;demoascii_redoiii 2622 e102 00 10 00 10* HEX 0010001010441400044044004000545454100410100410044040000000101444 2623 e122 50 10 50 54* HEX 5010505440144454104454444410401444501010104444105454045400541014 2624 e142 50 14 10 14* HEX 50141014101044541044544444104004405004141044445054 2625 e15b ;playershot 2626 e15b 00 00 HEX 0000 2627 e15d ;demoObstacle 2628 e15d ff 55 HEX ff55 2629 e15f ;demoObstacle_tallsprite_00 2630 e15f 01 80 HEX 0180 2631 e161 2632 e200 ORG $E200,0 ; ************* 2633 e200 2634 e200 ;playership 2635 e200 a4 00 HEX a400 2636 e202 ;demoascii_redoiii 2637 e202 00 10 00 54* HEX 0010005454404400101054101000441040440444440444044010040040004044 2638 e222 44 44 44 40* HEX 4444444040444410444440444444404444041044105444104040040400000044 2639 e242 44 40 44 40* HEX 44404440104444104450105444444004400410445454100440 2640 e25b ;playershot 2641 e25b 00 00 HEX 0000 2642 e25d ;demoObstacle 2643 e25d 3f 54 HEX 3f54 2644 e25f ;demoObstacle_tallsprite_00 2645 e25f 05 a0 HEX 05a0 2646 e261 2647 e300 ORG $E300,0 ; ************* 2648 e300 2649 e300 ;playership 2650 e300 12 f5 HEX 12f5 2651 e302 ;demoascii_redoiii 2652 e302 00 00 00 10* HEX 0000001014104400400410101000441010040404440444040010105410105444 2653 e322 44 40 44 40* HEX 4440444040444410044440444444404444041044445410101040100400000044 2654 e342 44 40 14 54* HEX 44401454100450500444105450445014401010444454441404 2655 e35b ;playershot 2656 e35b a9 55 HEX a955 2657 e35d ;demoObstacle 2658 e35d 3f 54 HEX 3f54 2659 e35f ;demoObstacle_tallsprite_00 2660 e35f 05 a0 HEX 05a0 2661 e361 2662 e400 ORG $E400,0 ; ************* 2663 e400 2664 e400 ;playership 2665 e400 02 50 HEX 0250 2666 e402 ;demoascii_redoiii 2667 e402 00 10 00 10* HEX 0010001054101000400454540054441010105450500410140000400004105454 2668 e422 50 40 44 54* HEX 5040445450445410045040444444504450101044444410441040100444000014 2669 e442 50 14 04 44* HEX 50140444541440100440104400104444544010004444004454 2670 e45b ;playershot 2671 e45b 00 00 HEX 0000 2672 e45d ;demoObstacle 2673 e45d 0f 50 HEX 0f50 2674 e45f ;demoObstacle_tallsprite_00 2675 e45f 15 a8 HEX 15a8 2676 e461 2677 e500 ORG $E500,0 ; ************* 2678 e500 2679 e500 ;playership 2680 e500 25 00 HEX 2500 2681 e502 ;demoascii_redoiii 2682 e502 00 10 00 10* HEX 0010001050104400400410100000441004044440400444440000105410044444 2683 e522 44 40 44 40* HEX 4440444040404410044440544444444444401044444410441040100444000004 2684 e542 40 00 04 10* HEX 40000410104440000040100000005010001454000000000000 2685 e55b ;playershot 2686 e55b 00 00 HEX 0000 2687 e55d ;demoObstacle 2688 e55d 0f 50 HEX 0f50 2689 e55f ;demoObstacle_tallsprite_00 2690 e55f 15 a8 HEX 15a8 2691 e561 2692 e600 ORG $E600,0 ; ************* 2693 e600 2694 e600 ;playership 2695 e600 50 00 HEX 5000 2696 e602 ;demoascii_redoiii 2697 e602 00 10 44 54* HEX 0010445454041410101054100000445044444440440444444040040040044444 2698 e622 44 44 44 40* HEX 4444444040404410044440544444444444401044444444440440400410000050 2699 e642 40 00 04 00* HEX 40000400101040100440100000000000000010000000000000 2700 e65b ;playershot 2701 e65b 00 00 HEX 0000 2702 e65d ;demoObstacle 2703 e65d 03 40 HEX 0340 2704 e65f ;demoObstacle_tallsprite_00 2705 e65f 55 aa HEX 55aa 2706 e661 2707 e700 ORG $E700,0 ; ************* 2708 e700 2709 e700 ;playership 2710 e700 00 00 HEX 0000 2711 e702 ;demoascii_redoiii 2712 e702 00 10 44 10* HEX 0010441010440010044044000000541010104454105410104040000000501454 2713 e722 50 10 50 54* HEX 5010505454144454044440445010501050145444444444445454405410000000 2714 e742 40 00 04 00* HEX 40000400040040000040500000000000000010000000000000 2715 e75b ;playershot 2716 e75b 00 00 HEX 0000 2717 e75d ;demoObstacle 2718 e75d 03 40 HEX 0340 2719 e75f ;demoObstacle_tallsprite_00 2720 e75f 55 aa HEX 55aa 2721 e761 - if SPACEOVERFLOW > 0 2722 e761 - echo "" 2723 e761 - echo "######## ERROR: space overflow detected in",[SPACEOVERFLOW]d,"areas." 2724 e761 - echo "######## look above for areas with negative ROM space left." 2725 e761 - echo "######## Aborting assembly." 2726 e761 - ERR 2727 e761 endif 2728 e761 2729 e761 2730 e761 ; Provided under the CC0 license. See the included LICENSE.txt for details. 2731 e761 2732 e761 ifnconst bankswitchmode 2733 e761 if ( * < $f000 ) 2734 f000 ORG $F000 2735 f000 endif 2736 f000 - else 2737 f000 - ifconst ROM128K 2738 f000 - if ( * < $f000 ) 2739 f000 - ORG $27000 2740 f000 - RORG $F000 2741 f000 - endif 2742 f000 - endif 2743 f000 - ifconst ROM144K 2744 f000 - if ( * < $f000 ) 2745 f000 - ORG $27000 2746 f000 - RORG $F000 2747 f000 - endif 2748 f000 - endif 2749 f000 - ifconst ROM256K 2750 f000 - if ( * < $f000 ) 2751 f000 - ORG $47000 2752 f000 - RORG $F000 2753 f000 - endif 2754 f000 - endif 2755 f000 - ifconst ROM272K 2756 f000 - if ( * < $f000 ) 2757 f000 - ORG $47000 2758 f000 - RORG $F000 2759 f000 - endif 2760 f000 - endif 2761 f000 - ifconst ROM512K 2762 f000 - if ( * < $f000 ) 2763 f000 - ORG $87000 2764 f000 - RORG $F000 2765 f000 - endif 2766 f000 - endif 2767 f000 - ifconst ROM528K 2768 f000 - if ( * < $f000 ) 2769 f000 - ORG $87000 2770 f000 - RORG $F000 2771 f000 - endif 2772 f000 - endif 2773 f000 endif 2774 f000 2775 f000 ; all of these "modules" have conditional clauses in them, so even though 2776 f000 ; they're always included here, they don't take up rom unless the user 2777 f000 ; explicitly enables support for the feature. 2778 f000 2779 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\shooting_demos\horizontal\Horizontal_Shooting_demo.78b.asm 2781 f000 endif 2782 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 inttemp1 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 inttemp1 ; 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 (sfxinstrumentlo),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 (sfxinstrumentlo),y 139 f000 - sta pokey1priority,x 140 f000 - iny 141 f000 - lda (sfxinstrumentlo),y 142 f000 - sta pokey1frames,x 143 f000 - 144 f000 - lda sfxinstrumentlo 145 f000 - clc 146 f000 - adc #3 147 f000 - sta pokey1pointlo,x 148 f000 - lda sfxinstrumenthi 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\shooting_demos\horizontal\Horizontal_Shooting_demo.78b.asm 2784 f000 endif 2785 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\shooting_demos\horizontal\Horizontal_Shooting_demo.78b.asm 2787 f000 endif 2788 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 - eor #$C6 23 f000 - bne detecthscfail 24 f000 - lda $3904 25 f000 - eor #$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, 4=player 2 player evel (joy1) 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, 4=player 2 player evel (joy1) 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)),(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)),(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)),<(score1+((6-SCORESIZE)/2)) 777 f000 -scorevarhi 778 f000 - .byte >(score0+((6-SCORESIZE)/2)),>(score0+((6-SCORESIZE)/2)),>(score1+((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, >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 - jsr initializeHSCtableentry 944 f000 - jmp cleardifficultytablemem 945 f000 -loaddifficultytableHSCcontinue 946 f000 - ; parse the data into the HS memory... 947 f000 - ldy #0 948 f000 - ldx #0 949 f000 -loaddifficultytableScores 950 f000 - lda (HSGameTableLo),y 951 f000 - sta temp1 952 f000 - iny 953 f000 - lda (HSGameTableLo),y 954 f000 - sta temp2 955 f000 - jsr decodeHSCInitials ; takes 2 byte initials from temp1,2 and stores 3 byte initials in temp3,4,5 956 f000 - iny 957 f000 - lda (HSGameTableLo),y 958 f000 - sta HSRAMScores,x 959 f000 - lda temp3 960 f000 - sta HSRAMInitials,x 961 f000 - inx 962 f000 - iny 963 f000 - lda (HSGameTableLo),y 964 f000 - sta HSRAMScores,x 965 f000 - lda temp4 966 f000 - sta HSRAMInitials,x 967 f000 - inx 968 f000 - iny 969 f000 - lda (HSGameTableLo),y 970 f000 - sta HSRAMScores,x 971 f000 - lda temp5 972 f000 - sta HSRAMInitials,x 973 f000 - inx 974 f000 - iny 975 f000 - cpx #15 976 f000 - bne loaddifficultytableScores 977 f000 - rts 978 f000 - 979 f000 -decodeHSCInitials 980 f000 - ; takes 2 byte initials from temp1,2 and stores 3 byte initials in temp3,4,5 981 f000 - ; 2 bytes are packed in the form: 22211111 22_33333 982 f000 - lda #0 983 f000 - sta temp4 984 f000 - lda temp1 985 f000 - and #%00011111 986 f000 - sta temp3 987 f000 - 988 f000 - lda temp2 989 f000 - and #%00011111 990 f000 - sta temp5 991 f000 - 992 f000 - lda temp1 993 f000 - asl 994 f000 - rol temp4 995 f000 - asl 996 f000 - rol temp4 997 f000 - asl 998 f000 - rol temp4 999 f000 - lda temp2 1000 f000 - asl 1001 f000 - rol temp4 1002 f000 - asl 1003 f000 - rol temp4 1004 f000 - rts 1005 f000 -encodeHSCInitials 1006 f000 - ; takes 3 byte initials from temp3,4,5 and stores 2 byte initials in temp1,2 1007 f000 - ; 2 bytes are packed in the form: 22211111 22_33333 1008 f000 - ; start with packing temp1... 1009 f000 - lda temp4 1010 f000 - and #%00011100 1011 f000 - sta temp1 1012 f000 - asl temp1 1013 f000 - asl temp1 1014 f000 - asl temp1 1015 f000 - lda temp3 1016 f000 - and #%00011111 1017 f000 - ora temp1 1018 f000 - sta temp1 1019 f000 - ; ...temp1 is now packed, on to temp2... 1020 f000 - lda temp5 1021 f000 - asl 1022 f000 - asl 1023 f000 - ror temp4 1024 f000 - ror 1025 f000 - ror temp4 1026 f000 - ror 1027 f000 - sta temp2 1028 f000 - rts 1029 f000 - 1030 f000 -findindexHSCerror 1031 f000 - ;the HSC is stuffed. return the bad slot flag 1032 f000 - ldy #$ff 1033 f000 - sty hsgameslot 1034 f000 - rts 1035 f000 - 1036 f000 -findindexHSC 1037 f000 -HSCGameID1 = $1029 1038 f000 -HSCGameID2 = $106E 1039 f000 -HSCGameDifficulty = $10B3 1040 f000 -HSCGameIndex = $10F8 1041 f000 - ; routine responsible for finding the game index from HSC 1042 f000 - ; call with x=0 to create a new table if none exist, call with x=$ff to avoid creating new tables 1043 f000 - ; the HS loading routine will use x=$ff, the HS saving routine will use x=0 1044 f000 - ldy #69 ; start +1 to account for the dey 1045 f000 -findindexHSCloop 1046 f000 - dey 1047 f000 - bmi findindexHSCerror 1048 f000 - lda HSCGameDifficulty,y 1049 f000 - cmp #$7F 1050 f000 - beq findourindexHSC 1051 f000 - cmp gamedifficulty 1052 f000 - bne findindexHSCloop 1053 f000 - lda HSCGameID1,y 1054 f000 - cmp #HSIDHI 1055 f000 - bne findindexHSCloop 1056 f000 - lda HSCGameID2,y 1057 f000 - cmp #HSIDLO 1058 f000 - bne findindexHSCloop 1059 f000 -findourindexHSC 1060 f000 - ; if we're here we found our index in the table 1061 f000 - ; or we found the first empty one 1062 f000 - sty hsgameslot 1063 f000 - jsr setupHSCGamepointer ; setup the pointer to the HS Table for this game... 1064 f000 - rts 1065 f000 - 1066 f000 - 1067 f000 -initializeHSCtableentry 1068 f000 - ldy hsgameslot 1069 f000 - ; we need to make a new entry... 1070 f000 - lda #HSIDHI 1071 f000 - sta HSCGameID1,y 1072 f000 - lda #HSIDLO 1073 f000 - sta HSCGameID2,y 1074 f000 - lda gamedifficulty 1075 f000 - sta HSCGameDifficulty,y 1076 f000 - ldx #0 1077 f000 -fixHSDGameDifficultylistLoop 1078 f000 - inx 1079 f000 - txa 1080 f000 - sta HSCGameIndex,y 1081 f000 - iny 1082 f000 - cpy #69 1083 f000 - bne fixHSDGameDifficultylistLoop 1084 f000 - rts 1085 f000 - 1086 f000 -setupHSCGamepointer 1087 f000 - ; this routines sets (HSGameTableLo) pointing to the game's HS table 1088 f000 - lda #$17 1089 f000 - sta HSGameTableHi 1090 f000 - lda #$FA 1091 f000 - sta HSGameTableLo 1092 f000 -setupHSCGamepointerLoop 1093 f000 - lda HSGameTableLo 1094 f000 - sec 1095 f000 - sbc #25 1096 f000 - sta HSGameTableLo 1097 f000 - lda HSGameTableHi 1098 f000 - sbc #0 1099 f000 - sta HSGameTableHi 1100 f000 - iny 1101 f000 - cpy #69 1102 f000 - bne setupHSCGamepointerLoop 1103 f000 - rts 1104 f000 - 1105 f000 -loaddifficultytableAVOX 1106 f000 - ; routine responsible for loading the difficulty table from Avox 1107 f000 - ; we reuse HSC routines to format data to/from our Avox RAM buffer... 1108 f000 - lda #>(eeprombuffer+3) 1109 f000 - sta HSGameTableHi 1110 f000 - lda #<(eeprombuffer+3) 1111 f000 - sta HSGameTableLo 1112 f000 - 1113 f000 - ; the start location in EEPROM, subtract 32... 1114 f000 - lda #$5F 1115 f000 - sta HSVoxHi 1116 f000 - lda #$E0 1117 f000 - sta HSVoxLo 1118 f000 - lda #0 1119 f000 - sta temp1 1120 f000 -loaddifficultytableAVOXloop 1121 f000 - inc temp1 1122 f000 - beq loaddifficultytableAVOXfull 1123 f000 - clc 1124 f000 - lda HSVoxLo 1125 f000 - adc #32 1126 f000 - sta HSVoxLo 1127 f000 - lda HSVoxHi 1128 f000 - adc #0 1129 f000 - sta HSVoxHi 1130 f000 - lda #3 1131 f000 - jsr AVoxReadBytes ; read in 3 bytes, ID1,ID2,Difficulty 1132 f000 - lda eeprombuffer 1133 f000 - cmp #$FF 1134 f000 - beq loaddifficultytableAVOXempty 1135 f000 - cmp #HSIDHI 1136 f000 - bne loaddifficultytableAVOXloop 1137 f000 - lda eeprombuffer+1 1138 f000 - cmp #HSIDLO 1139 f000 - bne loaddifficultytableAVOXloop 1140 f000 - lda eeprombuffer+2 1141 f000 - cmp gamedifficulty 1142 f000 - bne loaddifficultytableAVOXloop 1143 f000 -loaddifficultytableAVOXdone 1144 f000 - lda #32 1145 f000 - jsr AVoxReadBytes 1146 f000 - jsr loaddifficultytableHSCcontinue 1147 f000 - rts 1148 f000 -loaddifficultytableAVOXfull 1149 f000 - lda #0 1150 f000 - sta hsdevice ; looks like all 255 entries are taken... disable it. 1151 f000 -loaddifficultytableAVOXempty 1152 f000 - jmp cleardifficultytablemem 1153 f000 - rts 1154 f000 - 1155 f000 -cleardifficultytablemem 1156 f000 - ldy #29 1157 f000 - lda #0 1158 f000 -cleardifficultytablememloop 1159 f000 - sta HSRAMTable,y 1160 f000 - dey 1161 f000 - bpl cleardifficultytablememloop 1162 f000 - rts 1163 f000 -hiscoremoduleend 1164 f000 - 1165 f000 - echo " hiscore assembly: ",[(hiscoremoduleend-hiscoremodulestart)]d," bytes" 1166 f000 - 1167 f000 - ifconst DOUBLEWIDE 1168 f000 -plotvaluedw 1169 f000 -plotdigitcount = temp6 1170 f000 - lda #0 1171 f000 - tay 1172 f000 - ldx valbufend 1173 f000 - 1174 f000 - lda plotdigitcount 1175 f000 - and #1 1176 f000 - beq pvnibble2chardw 1177 f000 - lda #0 1178 f000 - sta VALBUFFER,x ; just in case we skip this digit 1179 f000 - beq pvnibble2char_skipnibbledw 1180 f000 - 1181 f000 -pvnibble2chardw 1182 f000 - ; high nibble... 1183 f000 - lda (temp7),y 1184 f000 - and #$f0 1185 f000 - lsr 1186 f000 - lsr 1187 f000 - lsr 1188 f000 - lsr 1189 f000 - 1190 f000 - clc 1191 f000 - adc temp1 ; add the offset to character graphics to our value 1192 f000 - sta VALBUFFER,x 1193 f000 - inx 1194 f000 - dec plotdigitcount 1195 f000 -pvnibble2char_skipnibbledw 1196 f000 - ; low nibble... 1197 f000 - lda (temp7),y 1198 f000 - and #$0f 1199 f000 - clc 1200 f000 - adc temp1 ; add the offset to character graphics to our value 1201 f000 - sta VALBUFFER,x 1202 f000 - inx 1203 f000 - iny 1204 f000 - 1205 f000 - dec plotdigitcount 1206 f000 - bne pvnibble2chardw 1207 f000 - ;point to the start of our valuebuffer 1208 f000 - clc 1209 f000 - lda #VALBUFFER 1213 f000 - adc #0 1214 f000 - sta temp2 1215 f000 - 1216 f000 - ;advance valbufend to the end of our value buffer 1217 f000 - stx valbufend 1218 f000 - 1219 f000 - ifnconst plotvalueonscreen 1220 f000 - jmp plotcharacters 1221 f000 - else 1222 f000 - jmp plotcharacterslive 1223 f000 - endif 1224 f000 - endif ; DOUBLEWIDE 1225 f000 - 1226 f000 endif ; HSSUPPORT 1227 f000 ------- FILE c:\Users\Shane\Documents\my7800projects\shooting_demos\horizontal\Horizontal_Shooting_demo.78b.asm 2790 f000 endif 2791 f000 ; Provided under the CC0 license. See the included LICENSE.txt for details. 2792 f000 2793 f000 ;standard routimes needed for pretty much all games 2794 f000 2795 f000 ; some definitions used with "set debug color" 2796 f000 00 91 DEBUGCALC = $91 2797 f000 00 41 DEBUGWASTE = $41 2798 f000 00 c1 DEBUGDRAW = $C1 2799 f000 2800 f000 ;NMI and IRQ handlers 2801 f000 NMI 2802 f000 ;VISIBLEOVER is 255 while the screen is drawn, and 0 right after the visible screen is done. 2803 f000 48 pha ; save A 2804 f001 d8 cld 2805 f002 a5 4d lda visibleover 2806 f004 49 ff eor #255 2807 f006 85 4d sta visibleover 2808 f008 - ifconst DEBUGINTERRUPT 2809 f008 - and #$93 2810 f008 - sta BACKGRND 2811 f008 endif 2812 f008 8a txa ; save X 2813 f009 48 pha 2814 f00a 98 tya ; save Y 2815 f00b 48 pha 2816 f00c ce b2 01 dec interruptindex 2817 f00f d0 03 bne skipreallyoffvisible 2818 f011 4c 6b f0 jmp reallyoffvisible 2819 f014 skipreallyoffvisible 2820 f014 a5 4d lda visibleover 2821 f016 d0 03 bne carryontopscreenroutine 2822 f018 - ifconst .bottomscreenroutine 2823 f018 - lda interrupthold 2824 f018 - beq skipbottomroutine 2825 f018 - jsr .bottomscreenroutine 2826 f018 -skipbottomroutine 2827 f018 endif 2828 f018 4c 79 f0 jmp NMIexit 2829 f01b carryontopscreenroutine 2830 f01b - ifconst .topscreenroutine 2831 f01b - lda interrupthold 2832 f01b - beq skiptoproutine 2833 f01b - jsr .topscreenroutine 2834 f01b -skiptoproutine 2835 f01b endif 2836 f01b ifnconst CANARYOFF 2837 f01b ad c1 01 lda canary 2838 f01e f0 07 beq skipcanarytriggered 2839 f020 a9 45 lda #$45 2840 f022 85 20 sta BACKGRND 2841 f024 4c 63 f0 jmp skipbrkolorset ; common crash dump routine, if available 2842 f027 skipcanarytriggered 2843 f027 endif 2844 f027 2845 f027 ee 3e 21 inc frameslost ; this is balanced with a "dec frameslost" when drawscreen is called. 2846 f02a 2847 f02a ; ** Other important routines that need to regularly run, and can run onscreen. 2848 f02a ; ** Atarivox can't go here, because Maria might interrupt it while it's bit-banging. 2849 f02a 2850 f02a - ifconst LONGCONTROLLERREAD 2851 f02a -longcontrollerreads ; ** controllers that take a lot of time to read. We use much of the visible screen here. 2852 f02a - ldy port1control 2853 f02a - lda longreadtype,y 2854 f02a - beq LLRET1 2855 f02a - tay 2856 f02a - lda longreadroutinehiP1,y 2857 f02a - sta inttemp4 2858 f02a - lda longreadroutineloP1,y 2859 f02a - sta inttemp3 2860 f02a - jmp (inttemp3) 2861 f02a -LLRET1 2862 f02a - ldy port0control 2863 f02a - lda longreadtype,y 2864 f02a - beq LLRET0 2865 f02a - tay 2866 f02a - lda longreadroutinehiP0,y 2867 f02a - sta inttemp4 2868 f02a - lda longreadroutineloP0,y 2869 f02a - sta inttemp3 2870 f02a - jmp (inttemp3) 2871 f02a -LLRET0 2872 f02a - 2873 f02a - 2874 f02a - ifconst PADDLERANGE 2875 f02a -TIMEVAL = PADDLERANGE 2876 f02a - else 2877 f02a -TIMEVAL = 160 2878 f02a - endif 2879 f02a -TIMEOFFSET = 10 2880 f02a - 2881 f02a endif ; LONGCONTROLLERREAD 2882 f02a 2883 f02a 2884 f02a 20 d8 f1 jsr servicesfxchannels 2885 f02d - ifconst MUSICTRACKER 2886 f02d - jsr servicesong 2887 f02d endif ; MUSICTRACKER 2888 f02d 2889 f02d ee a4 01 inc framecounter 2890 f030 ad a4 01 lda framecounter 2891 f033 29 3f and #63 2892 f035 d0 08 bne skipcountdownseconds 2893 f037 ad a5 01 lda countdownseconds 2894 f03a f0 03 beq skipcountdownseconds 2895 f03c ce a5 01 dec countdownseconds 2896 f03f skipcountdownseconds 2897 f03f 2898 f03f a2 01 ldx #1 2899 f041 buttonreadloop 2900 f041 8a txa 2901 f042 48 pha 2902 f043 bc b7 01 ldy port0control,x 2903 f046 b9 bb f1 lda buttonhandlerlo,y 2904 f049 85 da sta inttemp3 2905 f04b b9 b0 f1 lda buttonhandlerhi,y 2906 f04e 85 db sta inttemp4 2907 f050 05 da ora inttemp3 2908 f052 f0 03 beq buttonreadloopreturn 2909 f054 6c da 00 jmp (inttemp3) 2910 f057 buttonreadloopreturn 2911 f057 68 pla 2912 f058 aa tax 2913 f059 ca dex 2914 f05a 10 e5 bpl buttonreadloop 2915 f05c 2916 f05c - ifconst KEYPADSUPPORT 2917 f05c - jsr keypadrowselect 2918 f05c endif ; KEYPADSUPPORT 2919 f05c 2920 f05c 2921 f05c - ifconst DOUBLEBUFFER 2922 f05c - lda doublebufferminimumframeindex 2923 f05c - beq skipdoublebufferminimumframeindexadjust 2924 f05c - dec doublebufferminimumframeindex 2925 f05c -skipdoublebufferminimumframeindexadjust 2926 f05c endif 2927 f05c 2928 f05c 4c 79 f0 jmp NMIexit 2929 f05f 2930 f05f IRQ ; the only source of non-nmi interrupt should be the BRK opcode. 2931 f05f ifnconst BREAKPROTECTOFF 2932 f05f a9 1a lda #$1A 2933 f061 85 20 sta BACKGRND 2934 f063 skipbrkolorset 2935 f063 skipbrkdetected 2936 f063 a9 60 lda #$60 2937 f065 8d 07 21 sta sCTRL 2938 f068 85 3c sta CTRL 2939 f06a ifnconst hiscorefont 2940 f06a 02 .byte.b $02 ; KIL/JAM 2941 f06b - else ; hiscorefont is present 2942 f06b - ifconst CRASHDUMP 2943 f06b - bit MSTAT 2944 f06b - bpl skipbrkdetected ; wait for vblank to ensure we're clear of NMI 2945 f06b - 2946 f06b - ifconst dumpbankswitch 2947 f06b - lda dumpbankswitch 2948 f06b - pha 2949 f06b - endif 2950 f06b - 2951 f06b - ; bankswitch if needed, to get to the hiscore font 2952 f06b - ifconst bankswitchmode 2953 f06b - ifconst included.hiscore.asm.bank 2954 f06b - ifconst MCPDEVCART 2955 f06b - lda #($18 | included.hiscore.asm.bank) 2956 f06b - sta $3000 2957 f06b - else 2958 f06b - lda #(included.hiscore.asm.bank) 2959 f06b - sta $8000 2960 f06b - endif 2961 f06b - endif ; included.hiscore.asm.bank 2962 f06b - endif ; bankswitchmode 2963 f06b - 2964 f06b - ifconst DOUBLEBUFFER 2965 f06b - ;turn off double-buffering, if on... 2966 f06b - lda #>DLLMEM 2967 f06b - sta DPPH 2968 f06b - lda #hiscorefont 3012 f06b - sta CHARBASE 3013 f06b - sta sCHARBASE 3014 f06b - lda #%01000011 ;Enable DMA, mode=320A 3015 f06b - sta CTRL 3016 f06b - sta sCTRL 3017 f06b - .byte $02 ; KIL/JAM 3018 f06b -hiscorehexlut 3019 f06b - ; 0 1 2 3 4 5 6 7 8 9 A B C D E F 3020 f06b - .byte 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 0, 1, 2, 3, 4, 5 3021 f06b -show2700 3022 f06b - ; lo mode hi width=29 x EODL 3023 f06b - .byte $00, %01100000, $27, 3, 20, 0,0,0 3024 f06b - else ; CRASHDUMP 3025 f06b - .byte $02 ; KIL/JAM 3026 f06b - endif ; crashdump 3027 f06b endif ; hiscorefont 3028 f06b - else 3029 f06b - RTI 3030 f06b endif 3031 f06b 3032 f06b - ifconst LONGCONTROLLERREAD 3033 f06b - 3034 f06b -longreadtype 3035 f06b - .byte 0, 0, 0, 1 ; NONE PROLINE LIGHTGUN PADDLE 3036 f06b - .byte 2, 0, 3, 0 ; TRKBALL VCSSTICK DRIVING KEYPAD 3037 f06b - .byte 3, 3, 0 ; STMOUSE AMOUSE ATARIVOX 3038 f06b - 3039 f06b -longreadroutineloP0 3040 f06b - .byte LLRET0 ; 0 = no routine 3047 f06b - .byte >paddleport0update ; 1 = paddle 3048 f06b - .byte >trakball0update ; 2 = trackball 3049 f06b - .byte >mouse0update ; 3 = mouse 3050 f06b - 3051 f06b -longreadroutineloP1 3052 f06b - .byte LLRET1 ; 0 = no routine 3059 f06b - .byte >paddleport1update ; 1 = paddle 3060 f06b - .byte >trakball1update ; 2 = trackball 3061 f06b - .byte >mouse1update ; 3 = mouse 3062 f06b - 3063 f06b - 3064 f06b -SETTIM64T 3065 f06b - bne skipdefaulttime 3066 f06b - ifnconst PADDLESMOOTHINGOFF 3067 f06b - lda #(TIMEVAL+TIMEOFFSET+1) 3068 f06b - else 3069 f06b - lda #(TIMEVAL+TIMEOFFSET) 3070 f06b - endif 3071 f06b -skipdefaulttime 3072 f06b - tay 3073 f06b - dey 3074 f06b -.setTIM64Tloop 3075 f06b - sta TIM64T 3076 f06b - cpy INTIM 3077 f06b - bne .setTIM64Tloop 3078 f06b - rts 3079 f06b endif ; LONGCONTROLLERREAD 3080 f06b 3081 f06b reallyoffvisible 3082 f06b 85 24 sta WSYNC 3083 f06d 3084 f06d a9 00 lda #0 3085 f06f 85 4d sta visibleover 3086 f071 - ifconst DEBUGINTERRUPT 3087 f071 - sta BACKGRND 3088 f071 endif 3089 f071 3090 f071 a9 03 lda #3 3091 f073 8d b2 01 sta interruptindex 3092 f076 3093 f076 20 52 f1 jsr uninterruptableroutines 3094 f079 3095 f079 - ifconst .userinterrupt 3096 f079 - lda interrupthold 3097 f079 - beq skipuserintroutine 3098 f079 - jsr .userinterrupt 3099 f079 -skipuserintroutine 3100 f079 endif 3101 f079 3102 f079 - ifconst KEYPADSUPPORT 3103 f079 - jsr keypadcolumnread 3104 f079 endif 3105 f079 3106 f079 NMIexit 3107 f079 68 pla 3108 f07a a8 tay 3109 f07b 68 pla 3110 f07c aa tax 3111 f07d 68 pla 3112 f07e 40 RTI 3113 f07f 3114 f07f clearscreen 3115 f07f a2 19 ldx #(WZONECOUNT-1) 3116 f081 a9 00 lda #0 3117 f083 clearscreenloop 3118 f083 95 65 sta dlend,x 3119 f085 ca dex 3120 f086 10 fb bpl clearscreenloop 3121 f088 a9 00 lda #0 3122 f08a 8d ad 01 sta valbufend ; clear the bcd value buffer 3123 f08d 8d ae 01 sta valbufendsave 3124 f090 60 rts 3125 f091 3126 f091 restorescreen 3127 f091 a2 19 ldx #(WZONECOUNT-1) 3128 f093 a9 00 lda #0 3129 f095 restorescreenloop 3130 f095 b5 82 lda dlendsave,x 3131 f097 95 65 sta dlend,x 3132 f099 ca dex 3133 f09a 10 f9 bpl restorescreenloop 3134 f09c ad ae 01 lda valbufendsave 3135 f09f 8d ad 01 sta valbufend 3136 f0a2 60 rts 3137 f0a3 3138 f0a3 savescreen 3139 f0a3 a2 19 ldx #(WZONECOUNT-1) 3140 f0a5 savescreenloop 3141 f0a5 b5 65 lda dlend,x 3142 f0a7 95 82 sta dlendsave,x 3143 f0a9 ca dex 3144 f0aa 10 f9 bpl savescreenloop 3145 f0ac ad ad 01 lda valbufend 3146 f0af 8d ae 01 sta valbufendsave 3147 f0b2 - ifconst DOUBLEBUFFER 3148 f0b2 - lda doublebufferstate 3149 f0b2 - beq savescreenrts 3150 f0b2 - lda #1 3151 f0b2 - sta doublebufferbufferdirty 3152 f0b2 -savescreenrts 3153 f0b2 endif ; DOUBLEBUFFER 3154 f0b2 60 rts 3155 f0b3 3156 f0b3 drawscreen 3157 f0b3 3158 f0b3 - ifconst interrupthold 3159 f0b3 - lda #$FF 3160 f0b3 - sta interrupthold ; if the user called drawscreen, we're ready for interrupts 3161 f0b3 endif 3162 f0b3 3163 f0b3 a9 00 lda #0 3164 f0b5 85 42 sta temp1 ; not B&W if we're here... 3165 f0b7 3166 f0b7 drawscreenwait 3167 f0b7 a5 4d lda visibleover 3168 f0b9 d0 fc bne drawscreenwait ; make sure the visible screen isn't being drawn 3169 f0bb 3170 f0bb ;restore some registers in case the game changed them mid-screen... 3171 f0bb ad 07 21 lda sCTRL 3172 f0be 05 42 ora temp1 3173 f0c0 85 3c sta CTRL 3174 f0c2 ad 0b 21 lda sCHARBASE 3175 f0c5 85 34 sta CHARBASE 3176 f0c7 3177 f0c7 ;ensure all of the display list is terminated... 3178 f0c7 20 38 f1 jsr terminatedisplaylist 3179 f0ca 3180 f0ca ifnconst pauseroutineoff 3181 f0ca 20 d5 f0 jsr pauseroutine 3182 f0cd endif ; pauseroutineoff 3183 f0cd 3184 f0cd ; Make sure the visible screen has *started* before we exit. That way we can rely on drawscreen 3185 f0cd ; delaying a full frame, but still allowing time for basic calculations. 3186 f0cd visiblescreenstartedwait 3187 f0cd a5 4d lda visibleover 3188 f0cf f0 fc beq visiblescreenstartedwait 3189 f0d1 visiblescreenstartedwaitdone 3190 f0d1 ce 3e 21 dec frameslost ; ; this gets balanced with an "inc frameslost" by an NMI at the top of the screen 3191 f0d4 60 rts 3192 f0d5 3193 f0d5 ifnconst pauseroutineoff 3194 f0d5 ; check to see if pause was pressed and released 3195 f0d5 pauseroutine 3196 f0d5 ad b3 01 lda pausedisable 3197 f0d8 d0 4e bne leavepauseroutine 3198 f0da a9 08 lda #8 3199 f0dc 2c 82 02 bit SWCHB 3200 f0df f0 29 beq pausepressed 3201 f0e1 3202 f0e1 ifnconst SOFTRESETASPAUSEOFF 3203 f0e1 ifnconst MOUSESUPPORT 3204 f0e1 ifnconst TRAKBALLSUPPORT 3205 f0e1 ad 80 02 lda SWCHA ; then check the soft "RESET" joysick code... 3206 f0e4 29 70 and #%01110000 ; _LDU 3207 f0e6 f0 22 beq pausepressed 3208 f0e8 endif 3209 f0e8 endif 3210 f0e8 endif 3211 f0e8 3212 f0e8 ;pause isn't pressed 3213 f0e8 a9 00 lda #0 3214 f0ea 8d ac 01 sta pausebuttonflag ; clear pause hold state in case its set 3215 f0ed 3216 f0ed ;check if we're in an already paused state 3217 f0ed ad 00 21 lda pausestate 3218 f0f0 f0 36 beq leavepauseroutine ; nope, leave 3219 f0f2 3220 f0f2 c9 01 cmp #1 ; last frame was the start of pausing 3221 f0f4 f0 2b beq enterpausestate2 ; move from state 1 to 2 3222 f0f6 3223 f0f6 c9 02 cmp #2 3224 f0f8 f0 34 beq carryonpausing 3225 f0fa 3226 f0fa ;pausestate must be >2, which means we're ending an unpause 3227 f0fa a9 00 lda #0 3228 f0fc 8d ac 01 sta pausebuttonflag 3229 f0ff 8d 00 21 sta pausestate 3230 f102 ad 07 21 lda sCTRL 3231 f105 85 3c sta CTRL 3232 f107 4c 28 f1 jmp leavepauseroutine 3233 f10a 3234 f10a pausepressed 3235 f10a ;pause is pressed 3236 f10a ad ac 01 lda pausebuttonflag 3237 f10d c9 ff cmp #$ff 3238 f10f f0 1d beq carryonpausing 3239 f111 3240 f111 ;its a new press, increment the state 3241 f111 ee 00 21 inc pausestate 3242 f114 3243 f114 ;silence volume at the start and end of pausing 3244 f114 a9 00 lda #0 3245 f116 85 19 sta AUDV0 3246 f118 85 1a sta AUDV1 3247 f11a 3248 f11a - ifconst pokeysupport 3249 f11a - ldy #7 3250 f11a -pausesilencepokeyaudioloop 3251 f11a - sta (pokeybase),y 3252 f11a - dey 3253 f11a - bpl pausesilencepokeyaudioloop 3254 f11a endif ; pokeysupport 3255 f11a 3256 f11a a9 ff lda #$ff 3257 f11c 8d ac 01 sta pausebuttonflag 3258 f11f d0 0d bne carryonpausing 3259 f121 3260 f121 enterpausestate2 3261 f121 a9 02 lda #2 3262 f123 8d 00 21 sta pausestate 3263 f126 d0 06 bne carryonpausing 3264 f128 leavepauseroutine 3265 f128 ad 07 21 lda sCTRL 3266 f12b 85 3c sta CTRL 3267 f12d 60 rts 3268 f12e carryonpausing 3269 f12e - ifconst .pause 3270 f12e - jsr .pause 3271 f12e endif ; .pause 3272 f12e ad 07 21 lda sCTRL 3273 f131 09 80 ora #%10000000 ; turn off colorburst during pause... 3274 f133 85 3c sta CTRL 3275 f135 4c d5 f0 jmp pauseroutine 3276 f138 endif ; pauseroutineoff 3277 f138 3278 f138 3279 f138 - ifconst DOUBLEBUFFER 3280 f138 -skipterminatedisplaylistreturn 3281 f138 - rts 3282 f138 endif ; DOUBLEBUFFER 3283 f138 terminatedisplaylist 3284 f138 - ifconst DOUBLEBUFFER 3285 f138 - lda doublebufferstate 3286 f138 - bne skipterminatedisplaylistreturn ; double-buffering runs it's own DL termination code 3287 f138 endif ; DOUBLEBUFFER 3288 f138 terminatedisplaybuffer 3289 f138 ;add DL end entry on each DL 3290 f138 a2 19 ldx #(WZONECOUNT-1) 3291 f13a dlendloop 3292 f13a bd 73 f6 lda DLPOINTL,x 3293 f13d - ifconst DOUBLEBUFFER 3294 f13d - clc 3295 f13d - adc doublebufferdloffset 3296 f13d endif ; DOUBLEBUFFER 3297 f13d 85 63 sta dlpnt 3298 f13f bd 59 f6 lda DLPOINTH,x 3299 f142 - ifconst DOUBLEBUFFER 3300 f142 - adc #0 3301 f142 endif ; DOUBLEBUFFER 3302 f142 85 64 sta dlpnt+1 3303 f144 b4 65 ldy dlend,x 3304 f146 a9 00 lda #$00 3305 f148 dlendmoreloops 3306 f148 c8 iny 3307 f149 91 63 sta (dlpnt),y 3308 f14b - ifconst FRAMESKIPGLITCHFIXWEAK 3309 f14b - cpy #DLLASTOBJ+1 3310 f14b - beq dlendthiszonedone 3311 f14b - iny 3312 f14b - iny 3313 f14b - iny 3314 f14b - iny 3315 f14b - iny 3316 f14b - sta (dlpnt),y 3317 f14b -dlendthiszonedone 3318 f14b endif FRAMESKIPGLITCHFIXWEAK 3319 f14b - ifconst FRAMESKIPGLITCHFIX 3320 f14b - iny 3321 f14b - iny 3322 f14b - iny 3323 f14b - iny 3324 f14b - cpy #DLLASTOBJ-1 3325 f14b - bcc dlendmoreloops 3326 f14b endif ; FRAMESKIPGLITCHFIX 3327 f14b ca dex 3328 f14c 10 ec bpl dlendloop 3329 f14e 3330 f14e ifnconst pauseroutineoff 3331 f14e 20 d5 f0 jsr pauseroutine 3332 f151 endif ; pauseroutineoff 3333 f151 60 rts 3334 f152 3335 f152 uninterruptableroutines 3336 f152 ; this is for routines that must happen off the visible screen, each frame. 3337 f152 3338 f152 - ifconst AVOXVOICE 3339 f152 - jsr serviceatarivoxqueue 3340 f152 endif 3341 f152 3342 f152 a9 00 lda #0 3343 f154 8d b6 01 sta palfastframe 3344 f157 ad 09 21 lda paldetected 3345 f15a f0 10 beq skippalframeadjusting 3346 f15c ; ** PAL console is detected. we increment palframes to accurately count 5 frames, 3347 f15c ae b5 01 ldx palframes 3348 f15f e8 inx 3349 f160 e0 05 cpx #5 3350 f162 d0 05 bne palframeskipdone 3351 f164 ee b6 01 inc palfastframe 3352 f167 a2 00 ldx #0 3353 f169 palframeskipdone 3354 f169 8e b5 01 stx palframes 3355 f16c skippalframeadjusting 3356 f16c 3357 f16c - ifconst MUSICTRACKER 3358 f16c - ; We normally run the servicesong routine from the top-screen interrupt, but if it 3359 f16c - ; happens to interrupt the scheduling of a sound effect in the game code, we skip it. 3360 f16c - ; If that happens, we try again here. Chances are very small we'll run into the same 3361 f16c - ; problem twice, and if we do, we just drop a musical note or two. 3362 f16c - lda sfxschedulemissed 3363 f16c - beq servicesongwasnotmissed 3364 f16c - jsr servicesong 3365 f16c -servicesongwasnotmissed 3366 f16c endif ; MUSICTRACKER 3367 f16c 3368 f16c 60 rts 3369 f16d 3370 f16d serviceatarivoxqueue 3371 f16d - ifconst AVOXVOICE 3372 f16d - lda voxlock 3373 f16d - bne skipvoxprocessing ; the vox is in the middle of speech address update 3374 f16d -skipvoxqueuesizedec 3375 f16d - jmp processavoxvoice 3376 f16d -skipvoxprocessing 3377 f16d - rts 3378 f16d - 3379 f16d -processavoxvoice 3380 f16d - lda avoxenable 3381 f16d - bne avoxfixport 3382 f16d - SPKOUT tempavox 3383 f16d - rts 3384 f16d -avoxfixport 3385 f16d - lda #0 ; restore the port to all bits as inputs... 3386 f16d - sta CTLSWA 3387 f16d - rts 3388 f16d -silenceavoxvoice 3389 f16d - SPEAK avoxsilentdata 3390 f16d - rts 3391 f16d -avoxsilentdata 3392 f16d - .byte 31,255 3393 f16d else 3394 f16d 60 rts 3395 f16e endif ; AVOXVOICE 3396 f16e 3397 f16e joybuttonhandler 3398 f16e 8a txa 3399 f16f 0a asl 3400 f170 a8 tay 3401 f171 b9 08 00 lda INPT0,y 3402 f174 4a lsr 3403 f175 9d 02 21 sta sINPT1,x 3404 f178 b9 09 00 lda INPT1,y 3405 f17b 29 80 and #%10000000 3406 f17d 1d 02 21 ora sINPT1,x 3407 f180 9d 02 21 sta sINPT1,x 3408 f183 3409 f183 b5 0c lda INPT4,x 3410 f185 30 19 bmi .skip1bjoyfirecheck 3411 f187 ;one button joystick is down 3412 f187 49 80 eor #%10000000 3413 f189 9d 02 21 sta sINPT1,x 3414 f18c 3415 f18c ad b1 01 lda joybuttonmode 3416 f18f 3d a3 f1 and twobuttonmask,x 3417 f192 f0 0c beq .skip1bjoyfirecheck 3418 f194 ad b1 01 lda joybuttonmode 3419 f197 1d a3 f1 ora twobuttonmask,x 3420 f19a 8d b1 01 sta joybuttonmode 3421 f19d 8d 82 02 sta SWCHB 3422 f1a0 .skip1bjoyfirecheck 3423 f1a0 4c 57 f0 jmp buttonreadloopreturn 3424 f1a3 3425 f1a3 twobuttonmask 3426 f1a3 04 10 .byte.b %00000100,%00010000 3427 f1a5 3428 f1a5 gunbuttonhandler ; outside of the conditional, so our button handler LUT is valid 3429 f1a5 - ifconst LIGHTGUNSUPPORT 3430 f1a5 - cpx #0 3431 f1a5 - bne secondportgunhandler 3432 f1a5 -firstportgunhandler 3433 f1a5 - lda SWCHA 3434 f1a5 - asl 3435 f1a5 - asl 3436 f1a5 - asl ; shift D4 to D7 3437 f1a5 - and #%10000000 3438 f1a5 - eor #%10000000 3439 f1a5 - sta sINPT1 3440 f1a5 - jmp buttonreadloopreturn 3441 f1a5 -secondportgunhandler 3442 f1a5 - lda SWCHA 3443 f1a5 - lsr ; shift D0 into carry 3444 f1a5 - lsr ; shift carry into D7 3445 f1a5 - and #%10000000 3446 f1a5 - eor #%10000000 3447 f1a5 - sta sINPT3 3448 f1a5 - jmp buttonreadloopreturn 3449 f1a5 endif ; LIGHTGUNSUPPORT 3450 f1a5 3451 f1a5 controlsusing2buttoncode 3452 f1a5 00 .byte.b 0 ; 00=no controller plugged in 3453 f1a6 01 .byte.b 1 ; 01=proline joystick 3454 f1a7 00 .byte.b 0 ; 02=lightgun 3455 f1a8 00 .byte.b 0 ; 03=paddle 3456 f1a9 01 .byte.b 1 ; 04=trakball 3457 f1aa 01 .byte.b 1 ; 05=vcs joystick 3458 f1ab 01 .byte.b 1 ; 06=driving control 3459 f1ac 00 .byte.b 0 ; 07=keypad control 3460 f1ad 00 .byte.b 0 ; 08=st mouse/cx80 3461 f1ae 00 .byte.b 0 ; 09=amiga mouse 3462 f1af 01 .byte.b 1 ; 10=atarivox 3463 f1b0 3464 f1b0 buttonhandlerhi 3465 f1b0 00 .byte.b 0 ; 00=no controller plugged in 3466 f1b1 f1 .byte.b >joybuttonhandler ; 01=proline joystick 3467 f1b2 f1 .byte.b >gunbuttonhandler ; 02=lightgun 3468 f1b3 f5 .byte.b >paddlebuttonhandler ; 03=paddle 3469 f1b4 f1 .byte.b >joybuttonhandler ; 04=trakball 3470 f1b5 f1 .byte.b >joybuttonhandler ; 05=vcs joystick 3471 f1b6 f1 .byte.b >joybuttonhandler ; 06=driving control 3472 f1b7 00 .byte.b 0 ; 07=keypad 3473 f1b8 f5 .byte.b >mousebuttonhandler ; 08=st mouse 3474 f1b9 f5 .byte.b >mousebuttonhandler ; 09=amiga mouse 3475 f1ba f1 .byte.b >joybuttonhandler ; 10=atarivox 3476 f1bb buttonhandlerlo 3477 f1bb 00 .byte.b 0 ; 00=no controller plugged in 3478 f1bc 6e .byte.b $0F means the sound is looped while priority is active 3579 f219 3580 f219 05 d9 ora inttemp2 3581 f21b 05 d8 ora inttemp1 ; check if F|C|V=0 3582 f21d f0 23 beq zerosfx ; if so, we're at the end of the sound. 3583 f21f 3584 f21f advancesfxpointer 3585 f21f ; advance the pointer to the next sound chunk 3586 f21f c8 iny 3587 f220 84 da sty inttemp3 3588 f222 18 clc 3589 f223 b5 4e lda sfx1pointlo,x 3590 f225 65 da adc inttemp3 3591 f227 95 4e sta sfx1pointlo,x 3592 f229 b5 50 lda sfx1pointhi,x 3593 f22b 69 00 adc #0 3594 f22d 95 50 sta sfx1pointhi,x 3595 f22f 4c da f1 jmp servicesfxchannelsloop 3596 f232 3597 f232 sfxsoundloop 3598 f232 48 pha 3599 f233 b5 52 lda sfx1priority,x 3600 f235 d0 04 bne sfxsoundloop_carryon 3601 f237 68 pla ; fix the stack before we go 3602 f238 4c 1f f2 jmp advancesfxpointer 3603 f23b sfxsoundloop_carryon 3604 f23b 68 pla 3605 f23c 29 f0 and #$F0 3606 f23e 4a lsr 3607 f23f 4a lsr 3608 f240 4a lsr 3609 f241 4a lsr 3610 f242 3611 f242 zerosfx 3612 f242 95 4e sta sfx1pointlo,x 3613 f244 95 50 sta sfx1pointhi,x 3614 f246 95 52 sta sfx1priority,x 3615 f248 4c da f1 jmp servicesfxchannelsloop 3616 f24b 3617 f24b 3618 f24b schedulesfx 3619 f24b ; called with sfxinstrumentlo=data sfxpitchoffset=pitch-offset sfxnoteindex=note index 3620 f24b a0 00 ldy #0 3621 f24d b1 e0 lda (sfxinstrumentlo),y 3622 f24f - ifconst pokeysupport 3623 f24f - cmp #$20 ; POKEY? 3624 f24f - bne scheduletiasfx 3625 f24f - jmp schedulepokeysfx 3626 f24f endif 3627 f24f scheduletiasfx 3628 f24f ;cmp #$10 ; TIA? 3629 f24f ;beq continuescheduletiasfx 3630 f24f ; rts ; unhandled!!! 3631 f24f continuescheduletiasfx 3632 f24f ifnconst TIASFXMONO 3633 f24f a5 4e lda sfx1pointlo 3634 f251 05 50 ora sfx1pointhi 3635 f253 f0 13 beq schedulesfx1 ;if channel 1 is idle, use it 3636 f255 a5 4f lda sfx2pointlo 3637 f257 05 51 ora sfx2pointhi 3638 f259 f0 11 beq schedulesfx2 ;if channel 2 is idle, use it 3639 f25b ; Both channels are scheduled. 3640 f25b a0 01 ldy #1 3641 f25d b1 e0 lda (sfxinstrumentlo),y 3642 f25f d0 01 bne interruptsfx 3643 f261 60 rts ; the new sound has 0 priority and both channels are busy. Skip playing it. 3644 f262 interruptsfx 3645 f262 ;Compare which active sound has a lower priority. We'll interrupt the lower one. 3646 f262 a5 52 lda sfx1priority 3647 f264 c5 53 cmp sfx2priority 3648 f266 b0 04 bcs schedulesfx2 3649 f268 endif ; !TIASFXMONO 3650 f268 3651 f268 schedulesfx1 3652 f268 a2 00 ldx #0 ; channel 1 3653 f26a ifnconst TIASFXMONO 3654 f26a f0 02 beq skipschedulesfx2 3655 f26c schedulesfx2 3656 f26c a2 01 ldx #1 ; channel 2 3657 f26e skipschedulesfx2 3658 f26e endif ; !TIASFXMONO 3659 f26e 3660 f26e - ifconst MUSICTRACKER 3661 f26e - lda sfxnoteindex 3662 f26e - bpl skipdrumkitoverride 3663 f26e - and #$7F ; subtract 128 3664 f26e - sec 3665 f26e - sbc #4 ; drums start at 132, i.e. octave 10 3666 f26e - asl 3667 f26e - tay 3668 f26e - lda tiadrumkitdefinition,y 3669 f26e - sta sfxinstrumentlo 3670 f26e - iny 3671 f26e - lda tiadrumkitdefinition,y 3672 f26e - sta sfxinstrumenthi 3673 f26e - lda #0 3674 f26e - sta sfxnoteindex ; and tell the driver it's a non-pitched instrument 3675 f26e -skipdrumkitoverride 3676 f26e endif ; MUSICTRACKER 3677 f26e a0 01 ldy #1 ; get priority and sound-resolution (in frames) 3678 f270 b1 e0 lda (sfxinstrumentlo),y 3679 f272 95 52 sta sfx1priority,x 3680 f274 c8 iny 3681 f275 b1 e0 lda (sfxinstrumentlo),y 3682 f277 95 56 sta sfx1frames,x 3683 f279 a5 e0 lda sfxinstrumentlo 3684 f27b 18 clc 3685 f27c 69 03 adc #3 3686 f27e 95 4e sta sfx1pointlo,x 3687 f280 a5 e1 lda sfxinstrumenthi 3688 f282 69 00 adc #0 3689 f284 95 50 sta sfx1pointhi,x 3690 f286 a5 e2 lda sfxpitchoffset 3691 f288 95 54 sta sfx1poffset,x 3692 f28a a9 00 lda #0 3693 f28c 95 58 sta sfx1tick,x 3694 f28e a5 e3 lda sfxnoteindex 3695 f290 95 cd sta sfx1notedata,x 3696 f292 60 rts 3697 f293 3698 f293 plotsprite 3699 f293 ifnconst NODRAWWAIT 3700 f293 - ifconst DOUBLEBUFFER 3701 f293 - lda doublebufferstate 3702 f293 - bne skipplotspritewait 3703 f293 endif ; DOUBLEBUFFER 3704 f293 - ifconst DEBUGWAITCOLOR 3705 f293 - lda #$41 3706 f293 - sta BACKGRND 3707 f293 endif 3708 f293 plotspritewait 3709 f293 a5 4d lda visibleover 3710 f295 d0 fc bne plotspritewait 3711 f297 skipplotspritewait 3712 f297 - ifconst DEBUGWAITCOLOR 3713 f297 - lda #$0 3714 f297 - sta BACKGRND 3715 f297 endif 3716 f297 endif 3717 f297 3718 f297 ;arguments: 3719 f297 ; temp1=lo graphicdata 3720 f297 ; temp2=hi graphicdata 3721 f297 ; temp3=palette | width byte 3722 f297 ; temp4=x 3723 f297 ; temp5=y 3724 f297 ; temp6=mode 3725 f297 a5 46 lda temp5 ;Y position 3726 f299 4a lsr ; 2 - Divide by 8 or 16 3727 f29a 4a lsr ; 2 3728 f29b 4a lsr ; 2 3729 f29c - if WZONEHEIGHT = 16 3730 f29c - lsr ; 2 3731 f29c endif 3732 f29c 3733 f29c aa tax 3734 f29d 3735 f29d ifnconst NOLIMITCHECKING 3736 f29d 3737 f29d ; the next block allows for vertical masking, and ensures we don't overwrite non-DL memory 3738 f29d 3739 f29d c9 1a cmp #WZONECOUNT 3740 f29f 3741 f29f 90 0a bcc continueplotsprite1 ; the sprite is fully on-screen, so carry on... 3742 f2a1 ; otherwise, check to see if the bottom half is in zone 0... 3743 f2a1 3744 f2a1 - if WZONEHEIGHT = 16 3745 f2a1 - cmp #15 3746 f2a1 else 3747 f2a1 c9 1f cmp #31 3748 f2a3 endif 3749 f2a3 3750 f2a3 d0 05 bne exitplotsprite1 3751 f2a5 a2 00 ldx #0 3752 f2a7 4c e4 f2 jmp continueplotsprite2 3753 f2aa exitplotsprite1 3754 f2aa 60 rts 3755 f2ab 3756 f2ab continueplotsprite1 3757 f2ab endif 3758 f2ab 3759 f2ab bd 73 f6 lda DLPOINTL,x ;Get pointer to DL that this sprite starts in 3760 f2ae - ifconst DOUBLEBUFFER 3761 f2ae - clc 3762 f2ae - adc doublebufferdloffset 3763 f2ae endif ; DOUBLEBUFFER 3764 f2ae 85 63 sta dlpnt 3765 f2b0 bd 59 f6 lda DLPOINTH,x 3766 f2b3 - ifconst DOUBLEBUFFER 3767 f2b3 - adc #0 3768 f2b3 endif ; DOUBLEBUFFER 3769 f2b3 85 64 sta dlpnt+1 3770 f2b5 3771 f2b5 ;Create DL entry for upper part of sprite 3772 f2b5 3773 f2b5 b4 65 ldy dlend,x ;Get the index to the end of this DL 3774 f2b7 3775 f2b7 ifconst CHECKOVERWRITE 3776 f2b7 c0 46 cpy #DLLASTOBJ 3777 f2b9 f0 21 beq checkcontinueplotsprite2 3778 f2bb continueplotsprite1a 3779 f2bb endif 3780 f2bb 3781 f2bb a5 42 lda temp1 ; graphic data, lo byte 3782 f2bd 91 63 sta (dlpnt),y ;Low byte of data address 3783 f2bf 3784 f2bf ifnconst ATOMICSPRITEUPDATE 3785 f2bf c8 iny 3786 f2c0 a5 47 lda temp6 3787 f2c2 91 63 sta (dlpnt),y 3788 f2c4 - else 3789 f2c4 - iny 3790 f2c4 - sty temp8 3791 f2c4 endif 3792 f2c4 3793 f2c4 c8 iny 3794 f2c5 3795 f2c5 a5 46 lda temp5 ;Y position 3796 f2c7 29 07 and #(WZONEHEIGHT - 1) 3797 f2c9 c9 01 cmp #1 ; clear carry if our sprite is just in this zone 3798 f2cb 05 43 ora temp2 ; graphic data, hi byte 3799 f2cd 91 63 sta (dlpnt),y 3800 f2cf 3801 f2cf 3802 f2cf c8 iny 3803 f2d0 a5 44 lda temp3 ;palette|width 3804 f2d2 91 63 sta (dlpnt),y 3805 f2d4 3806 f2d4 c8 iny 3807 f2d5 a5 45 lda temp4 ;Horizontal position 3808 f2d7 91 63 sta (dlpnt),y 3809 f2d9 3810 f2d9 c8 iny 3811 f2da 94 65 sty dlend,x 3812 f2dc 3813 f2dc - ifconst ALWAYSTERMINATE 3814 f2dc - iny 3815 f2dc - lda #0 3816 f2dc - sta (dlpnt),y 3817 f2dc endif 3818 f2dc 3819 f2dc - ifconst ATOMICSPRITEUPDATE 3820 f2dc - ldy temp8 3821 f2dc - lda temp6 3822 f2dc - sta (dlpnt),y 3823 f2dc endif 3824 f2dc 3825 f2dc checkcontinueplotsprite2 3826 f2dc 3827 f2dc 90 38 bcc doneSPDL ;branch if the sprite was fully in the last zone 3828 f2de 3829 f2de ;Create DL entry for lower part of sprite 3830 f2de 3831 f2de e8 inx ;Next region 3832 f2df 3833 f2df ifnconst NOLIMITCHECKING 3834 f2df e0 1a cpx #WZONECOUNT 3835 f2e1 3836 f2e1 90 01 bcc continueplotsprite2 ; the second half of the sprite is fully on-screen, so carry on... 3837 f2e3 60 rts 3838 f2e4 continueplotsprite2 3839 f2e4 endif 3840 f2e4 3841 f2e4 bd 73 f6 lda DLPOINTL,x ;Get pointer to next DL 3842 f2e7 - ifconst DOUBLEBUFFER 3843 f2e7 - clc 3844 f2e7 - adc doublebufferdloffset 3845 f2e7 endif ; DOUBLEBUFFER 3846 f2e7 85 63 sta dlpnt 3847 f2e9 bd 59 f6 lda DLPOINTH,x 3848 f2ec - ifconst DOUBLEBUFFER 3849 f2ec - adc #0 3850 f2ec endif ; DOUBLEBUFFER 3851 f2ec 85 64 sta dlpnt+1 3852 f2ee b4 65 ldy dlend,x ;Get the index to the end of this DL 3853 f2f0 3854 f2f0 ifconst CHECKOVERWRITE 3855 f2f0 c0 46 cpy #DLLASTOBJ 3856 f2f2 d0 01 bne continueplotsprite2a 3857 f2f4 60 rts 3858 f2f5 continueplotsprite2a 3859 f2f5 endif 3860 f2f5 3861 f2f5 a5 42 lda temp1 ; graphic data, lo byte 3862 f2f7 91 63 sta (dlpnt),y 3863 f2f9 3864 f2f9 ifnconst ATOMICSPRITEUPDATE 3865 f2f9 c8 iny 3866 f2fa a5 47 lda temp6 3867 f2fc 91 63 sta (dlpnt),y 3868 f2fe - else 3869 f2fe - iny 3870 f2fe - sty temp8 3871 f2fe endif 3872 f2fe 3873 f2fe c8 iny 3874 f2ff 3875 f2ff a5 46 lda temp5 ;Y position 3876 f301 0b 07 anc #(WZONEHEIGHT - 1) ; undocumented. A=A&IMM, then move bit 7 into carry 3877 f303 05 43 ora temp2 ; graphic data, hi byte 3878 f305 e9 07 sbc #(WZONEHEIGHT-1) ; start at the DMA hole. -1 because carry is clear 3879 f307 91 63 sta (dlpnt),y 3880 f309 3881 f309 c8 iny 3882 f30a 3883 f30a a5 44 lda temp3 ;palette|width 3884 f30c 91 63 sta (dlpnt),y 3885 f30e 3886 f30e c8 iny 3887 f30f 3888 f30f a5 45 lda temp4 ;Horizontal position 3889 f311 91 63 sta (dlpnt),y 3890 f313 3891 f313 c8 iny 3892 f314 94 65 sty dlend,x 3893 f316 3894 f316 - ifconst ALWAYSTERMINATE 3895 f316 - iny 3896 f316 - lda #0 3897 f316 - sta (dlpnt),y 3898 f316 endif 3899 f316 3900 f316 - ifconst ATOMICSPRITEUPDATE 3901 f316 - ldy temp8 3902 f316 - lda temp6 3903 f316 - sta (dlpnt),y 3904 f316 endif 3905 f316 3906 f316 doneSPDL 3907 f316 60 rts 3908 f317 3909 f317 3910 f317 lockzonex 3911 f317 - ifconst ZONELOCKS 3912 f317 - ldy dlend,x 3913 f317 - cpy #DLLASTOBJ 3914 f317 - beq lockzonexreturn ; the zone is either stuffed or locked. abort! 3915 f317 - lda DLPOINTL,x 3916 f317 - ifconst DOUBLEBUFFER 3917 f317 - clc 3918 f317 - adc doublebufferdloffset 3919 f317 - endif ; DOUBLEBUFFER 3920 f317 - sta dlpnt 3921 f317 - lda DLPOINTH,x 3922 f317 - ifconst DOUBLEBUFFER 3923 f317 - adc #0 3924 f317 - endif ; DOUBLEBUFFER 3925 f317 - sta dlpnt+1 3926 f317 - iny 3927 f317 - lda #0 3928 f317 - sta (dlpnt),y 3929 f317 - dey 3930 f317 - tya 3931 f317 - ldy #(DLLASTOBJ-1) 3932 f317 - sta (dlpnt),y 3933 f317 - iny 3934 f317 - sty dlend,x 3935 f317 -lockzonexreturn 3936 f317 - rts 3937 f317 endif ; ZONELOCKS 3938 f317 unlockzonex 3939 f317 - ifconst ZONELOCKS 3940 f317 - ldy dlend,x 3941 f317 - cpy #DLLASTOBJ 3942 f317 - bne unlockzonexreturn ; if the zone isn't stuffed, it's not locked. abort! 3943 f317 - lda DLPOINTL,x 3944 f317 - ifconst DOUBLEBUFFER 3945 f317 - clc 3946 f317 - adc doublebufferdloffset 3947 f317 - endif ; DOUBLEBUFFER 3948 f317 - sta dlpnt 3949 f317 - lda DLPOINTH,x 3950 f317 - ifconst DOUBLEBUFFER 3951 f317 - adc #0 3952 f317 - endif ; DOUBLEBUFFER 3953 f317 - sta dlpnt+1 3954 f317 - dey 3955 f317 - ;ldy #(DLLASTOBJ-1) 3956 f317 - lda (dlpnt),y 3957 f317 - tay 3958 f317 - sty dlend,x 3959 f317 -unlockzonexreturn 3960 f317 endif ; ZONELOCKS 3961 f317 60 rts 3962 f318 3963 f318 plotcharloop 3964 f318 ; ** read from a data indirectly pointed to from temp8,temp9 3965 f318 ; ** format is: lo_data, hi_data, palette|width, x, y 3966 f318 ; ** format ends with lo_data | hi_data = 0 3967 f318 3968 f318 - ifconst DOUBLEBUFFER 3969 f318 - lda doublebufferstate 3970 f318 - bne skipplotcharloopwait 3971 f318 endif ; DOUBLEBUFFER 3972 f318 - ifconst DEBUGWAITCOLOR 3973 f318 - lda #$61 3974 f318 - sta BACKGRND 3975 f318 endif 3976 f318 plotcharloopwait 3977 f318 a5 4d lda visibleover 3978 f31a d0 fc bne plotcharloopwait 3979 f31c - ifconst DEBUGWAITCOLOR 3980 f31c - lda #0 3981 f31c - sta BACKGRND 3982 f31c endif 3983 f31c skipplotcharloopwait 3984 f31c plotcharlooploop 3985 f31c a0 00 ldy #0 3986 f31e b1 49 lda (temp8),y 3987 f320 85 42 sta temp1 3988 f322 c8 iny 3989 f323 b1 49 lda (temp8),y 3990 f325 85 43 sta temp2 3991 f327 05 42 ora temp1 3992 f329 d0 01 bne plotcharloopcontinue 3993 f32b ;the pointer=0, so return 3994 f32b 60 rts 3995 f32c plotcharloopcontinue 3996 f32c c8 iny 3997 f32d b1 49 lda (temp8),y 3998 f32f 85 44 sta temp3 3999 f331 c8 iny 4000 f332 b1 49 lda (temp8),y 4001 f334 85 45 sta temp4 4002 f336 c8 iny 4003 f337 b1 49 lda (temp8),y 4004 f339 ;sta temp5 ; not needed with our late entry. 4005 f339 20 52 f3 jsr plotcharactersskipentry 4006 f33c a5 49 lda temp8 4007 f33e 18 clc 4008 f33f 69 05 adc #5 4009 f341 85 49 sta temp8 4010 f343 a5 4a lda temp9 4011 f345 69 00 adc #0 4012 f347 85 4a sta temp9 4013 f349 4c 1c f3 jmp plotcharlooploop 4014 f34c 4015 f34c plotcharacters 4016 f34c - ifconst DOUBLEBUFFER 4017 f34c - lda doublebufferstate 4018 f34c - bne skipplotcharacterswait 4019 f34c endif ; DOUBLEBUFFER 4020 f34c - ifconst DEBUGWAITCOLOR 4021 f34c - lda #$41 4022 f34c - sta BACKGRND 4023 f34c endif 4024 f34c plotcharacterswait 4025 f34c a5 4d lda visibleover 4026 f34e d0 fc bne plotcharacterswait 4027 f350 - ifconst DEBUGWAITCOLOR 4028 f350 - sta BACKGRND 4029 f350 endif 4030 f350 skipplotcharacterswait 4031 f350 ;arguments: 4032 f350 ; temp1=lo charactermap 4033 f350 ; temp2=hi charactermap 4034 f350 ; temp3=palette | width byte 4035 f350 ; temp4=x 4036 f350 ; temp5=y 4037 f350 4038 f350 a5 46 lda temp5 ;Y position 4039 f352 4040 f352 plotcharactersskipentry 4041 f352 4042 f352 ;ifconst ZONEHEIGHT 4043 f352 ; if ZONEHEIGHT = 16 4044 f352 ; and #$0F 4045 f352 ; endif 4046 f352 ; if ZONEHEIGHT = 8 4047 f352 ; and #$1F 4048 f352 ; endif 4049 f352 ;else 4050 f352 ; and #$0F 4051 f352 ;endif 4052 f352 4053 f352 aa tax 4054 f353 bd 73 f6 lda DLPOINTL,x ;Get pointer to DL that the characters are in 4055 f356 - ifconst DOUBLEBUFFER 4056 f356 - clc 4057 f356 - adc doublebufferdloffset 4058 f356 endif ; DOUBLEBUFFER 4059 f356 85 63 sta dlpnt 4060 f358 bd 59 f6 lda DLPOINTH,x 4061 f35b - ifconst DOUBLEBUFFER 4062 f35b - adc #0 4063 f35b endif ; DOUBLEBUFFER 4064 f35b 85 64 sta dlpnt+1 4065 f35d 4066 f35d ;Create DL entry for the characters 4067 f35d 4068 f35d b4 65 ldy dlend,x ;Get the index to the end of this DL 4069 f35f 4070 f35f ifconst CHECKOVERWRITE 4071 f35f c0 46 cpy #DLLASTOBJ 4072 f361 d0 01 bne continueplotcharacters 4073 f363 60 rts 4074 f364 continueplotcharacters 4075 f364 endif 4076 f364 4077 f364 a5 42 lda temp1 ; character map data, lo byte 4078 f366 91 63 sta (dlpnt),y ;(1) store low address 4079 f368 4080 f368 c8 iny 4081 f369 ad 06 21 lda charactermode 4082 f36c 91 63 sta (dlpnt),y ;(2) store mode 4083 f36e 4084 f36e c8 iny 4085 f36f a5 43 lda temp2 ; character map, hi byte 4086 f371 91 63 sta (dlpnt),y ;(3) store high address 4087 f373 4088 f373 c8 iny 4089 f374 a5 44 lda temp3 ;palette|width 4090 f376 91 63 sta (dlpnt),y ;(4) store palette|width 4091 f378 4092 f378 c8 iny 4093 f379 a5 45 lda temp4 ;Horizontal position 4094 f37b 91 63 sta (dlpnt),y ;(5) store horizontal position 4095 f37d 4096 f37d c8 iny 4097 f37e 94 65 sty dlend,x ; save display list end byte 4098 f380 60 rts 4099 f381 4100 f381 4101 f381 ifconst plotvalueonscreen 4102 f381 plotcharacterslive 4103 f381 ; a version of plotcharacters that draws live and minimally disrupts the screen... 4104 f381 4105 f381 ;arguments: 4106 f381 ; temp1=lo charactermap 4107 f381 ; temp2=hi charactermap 4108 f381 ; temp3=palette | width byte 4109 f381 ; temp4=x 4110 f381 ; temp5=y 4111 f381 4112 f381 a5 46 lda temp5 ;Y position 4113 f383 4114 f383 aa tax 4115 f384 bd 73 f6 lda DLPOINTL,x ;Get pointer to DL that the characters are in 4116 f387 - ifconst DOUBLEBUFFER 4117 f387 - clc 4118 f387 - adc doublebufferdloffset 4119 f387 endif ; DOUBLEBUFFER 4120 f387 85 63 sta dlpnt 4121 f389 bd 59 f6 lda DLPOINTH,x 4122 f38c - ifconst DOUBLEBUFFER 4123 f38c - adc #0 4124 f38c endif ; DOUBLEBUFFER 4125 f38c 85 64 sta dlpnt+1 4126 f38e 4127 f38e ;Create DL entry for the characters 4128 f38e 4129 f38e b4 65 ldy dlend,x ;Get the index to the end of this DL 4130 f390 4131 f390 ifconst CHECKOVERWRITE 4132 f390 c0 46 cpy #DLLASTOBJ 4133 f392 d0 01 bne continueplotcharacterslive 4134 f394 60 rts 4135 f395 continueplotcharacterslive 4136 f395 endif 4137 f395 4138 f395 a5 42 lda temp1 ; character map data, lo byte 4139 f397 91 63 sta (dlpnt),y ;(1) store low address 4140 f399 4141 f399 c8 iny 4142 f39a ; we don't add the second byte yet, since the charmap could briefly 4143 f39a ; render without a proper character map address, width, or position. 4144 f39a ad 06 21 lda charactermode 4145 f39d 91 63 sta (dlpnt),y ;(2) store mode 4146 f39f 4147 f39f c8 iny 4148 f3a0 a5 43 lda temp2 ; character map, hi byte 4149 f3a2 91 63 sta (dlpnt),y ;(3) store high address 4150 f3a4 4151 f3a4 c8 iny 4152 f3a5 a5 44 lda temp3 ;palette|width 4153 f3a7 91 63 sta (dlpnt),y ;(4) store palette|width 4154 f3a9 4155 f3a9 c8 iny 4156 f3aa a5 45 lda temp4 ;Horizontal position 4157 f3ac 91 63 sta (dlpnt),y ;(5) store horizontal position 4158 f3ae 4159 f3ae c8 iny 4160 f3af 94 65 sty dlend,x ; save display list end byte 4161 f3b1 4162 f3b1 60 rts 4163 f3b2 endif ;plotcharacterslive 4164 f3b2 4165 f3b2 ifconst USED_PLOTVALUE 4166 f3b2 plotvalue 4167 f3b2 ; calling 7800basic command: 4168 f3b2 ; plotvalue digit_gfx palette variable/data number_of_digits screen_x screen_y 4169 f3b2 ; ...displays the variable as BCD digits 4170 f3b2 ; 4171 f3b2 ; asm sub arguments: 4172 f3b2 ; temp1=lo charactermap 4173 f3b2 ; temp2=hi charactermap 4174 f3b2 ; temp3=palette | width byte 4175 f3b2 ; temp4=x 4176 f3b2 ; temp5=y 4177 f3b2 ; temp6=number of digits 4178 f3b2 ; temp7=lo variable 4179 f3b2 ; temp8=hi variable 4180 f3b2 ; temp9=character mode 4181 f3b2 4182 f3b2 00 47 plotdigitcount = temp6 4183 f3b2 4184 f3b2 - ifconst ZONELOCKS 4185 f3b2 - ldx temp5 4186 f3b2 - ldy dlend,x 4187 f3b2 - cpy #DLLASTOBJ 4188 f3b2 - bne carryonplotvalue 4189 f3b2 - rts 4190 f3b2 -carryonplotvalue 4191 f3b2 endif 4192 f3b2 4193 f3b2 a9 00 lda #0 4194 f3b4 a8 tay 4195 f3b5 ae ad 01 ldx valbufend 4196 f3b8 4197 f3b8 a5 47 lda plotdigitcount 4198 f3ba 29 01 and #1 4199 f3bc f0 07 beq pvnibble2char 4200 f3be a9 00 lda #0 4201 f3c0 9d 00 20 sta VALBUFFER,x ; just in case we skip this digit 4202 f3c3 f0 11 beq pvnibble2char_skipnibble 4203 f3c5 4204 f3c5 pvnibble2char 4205 f3c5 ; high nibble... 4206 f3c5 b1 48 lda (temp7),y 4207 f3c7 29 f0 and #$f0 4208 f3c9 4a lsr 4209 f3ca 4a lsr 4210 f3cb 4a lsr 4211 f3cc ifnconst DOUBLEWIDE ; multiply value by 2 for double-width 4212 f3cc 4a lsr 4213 f3cd endif 4214 f3cd 4215 f3cd 18 clc 4216 f3ce 65 42 adc temp1 ; add the offset to character graphics to our value 4217 f3d0 9d 00 20 sta VALBUFFER,x 4218 f3d3 e8 inx 4219 f3d4 c6 47 dec plotdigitcount 4220 f3d6 4221 f3d6 pvnibble2char_skipnibble 4222 f3d6 ; low nibble... 4223 f3d6 b1 48 lda (temp7),y 4224 f3d8 29 0f and #$0f 4225 f3da - ifconst DOUBLEWIDE ; multiply value by 2 for double-width 4226 f3da - asl 4227 f3da endif 4228 f3da 18 clc 4229 f3db 65 42 adc temp1 ; add the offset to character graphics to our value 4230 f3dd 9d 00 20 sta VALBUFFER,x 4231 f3e0 e8 inx 4232 f3e1 c8 iny 4233 f3e2 4234 f3e2 c6 47 dec plotdigitcount 4235 f3e4 d0 df bne pvnibble2char 4236 f3e6 4237 f3e6 ;point to the start of our valuebuffer 4238 f3e6 18 clc 4239 f3e7 a9 00 lda #VALBUFFER 4243 f3f0 69 00 adc #0 4244 f3f2 85 43 sta temp2 4245 f3f4 4246 f3f4 ;advance valbufend to the end of our value buffer 4247 f3f4 8e ad 01 stx valbufend 4248 f3f7 4249 f3f7 - ifnconst plotvalueonscreen 4250 f3f7 - jmp plotcharacters 4251 f3f7 else 4252 f3f7 4c 81 f3 jmp plotcharacterslive 4253 f3fa endif 4254 f3fa 4255 f3fa endif ; USED_PLOTVALUE 4256 f3fa 4257 f3fa 4258 f3fa - ifconst USED_PLOTVALUEEXTRA 4259 f3fa -plotdigitcount = temp6 4260 f3fa -plotvalueextra 4261 f3fa - ; calling 7800basic command: 4262 f3fa - ; plotvalue digit_gfx palette variable/data number_of_digits screen_x screen_y 4263 f3fa - ; ...displays the variable as BCD digits 4264 f3fa - ; 4265 f3fa - ; asm sub arguments: 4266 f3fa - ; temp1=lo charactermap 4267 f3fa - ; temp2=hi charactermap 4268 f3fa - ; temp3=palette | width byte 4269 f3fa - ; temp4=x 4270 f3fa - ; temp5=y 4271 f3fa - ; temp6=number of digits 4272 f3fa - ; temp7=lo variable 4273 f3fa - ; temp8=hi variable 4274 f3fa - 4275 f3fa - lda #0 4276 f3fa - tay 4277 f3fa - ldx valbufend 4278 f3fa - ifnconst plotvalueonscreen 4279 f3fa - sta VALBUFFER,x 4280 f3fa - endif 4281 f3fa - 4282 f3fa - lda plotdigitcount 4283 f3fa - and #1 4284 f3fa - 4285 f3fa - bne pvnibble2char_skipnibbleextra 4286 f3fa - 4287 f3fa -pvnibble2charextra 4288 f3fa - ; high nibble... 4289 f3fa - lda (temp7),y 4290 f3fa - and #$f0 4291 f3fa - lsr 4292 f3fa - lsr 4293 f3fa - ifnconst DOUBLEWIDE ; multiply value by 2 for double-width 4294 f3fa - lsr 4295 f3fa - endif 4296 f3fa - clc 4297 f3fa - adc temp1 ; add the offset to character graphics to our value 4298 f3fa - sta VALBUFFER,x 4299 f3fa - inx 4300 f3fa - 4301 f3fa - ; second half of the digit 4302 f3fa - clc 4303 f3fa - adc #1 4304 f3fa - sta VALBUFFER,x 4305 f3fa - inx 4306 f3fa - 4307 f3fa -pvnibble2char_skipnibbleextra 4308 f3fa - ; low nibble... 4309 f3fa - lda (temp7),y 4310 f3fa - and #$0f 4311 f3fa - ifconst DOUBLEWIDE ; multiply value by 2 for double-width 4312 f3fa - asl 4313 f3fa - endif 4314 f3fa - asl 4315 f3fa - 4316 f3fa - clc 4317 f3fa - adc temp1 ; add the offset to character graphics to our value 4318 f3fa - sta VALBUFFER,x 4319 f3fa - inx 4320 f3fa - 4321 f3fa - clc 4322 f3fa - adc #1 4323 f3fa - sta VALBUFFER,x 4324 f3fa - inx 4325 f3fa - iny 4326 f3fa - 4327 f3fa - dec plotdigitcount 4328 f3fa - bne pvnibble2charextra 4329 f3fa - 4330 f3fa - ;point to the start of our valuebuffer 4331 f3fa - clc 4332 f3fa - lda #VALBUFFER 4336 f3fa - adc #0 4337 f3fa - sta temp2 4338 f3fa - 4339 f3fa - ;advance valbufend to the end of our value buffer 4340 f3fa - stx valbufend 4341 f3fa - 4342 f3fa - ifnconst plotvalueonscreen 4343 f3fa - jmp plotcharacters 4344 f3fa - else 4345 f3fa - jmp plotcharacterslive 4346 f3fa - endif 4347 f3fa endif ; USED_PLOTVALUEEXTRA 4348 f3fa 4349 f3fa boxcollision 4350 f3fa ifconst BOXCOLLISION 4351 f3fa ; the worst case cycle-time for the code below is 43 cycles. 4352 f3fa ; unfortunately, prior to getting here we've burned 44 cycles in argument setup. eep! 4353 f3fa 4354 f3fa ;__boxx1 = accumulator 4355 f3fa ;__boxy1 = y 4356 f3fa 00 44 __boxw1 = temp3 4357 f3fa 00 45 __boxh1 = temp4 4358 f3fa 4359 f3fa 00 46 __boxx2 = temp5 4360 f3fa 00 47 __boxy2 = temp6 4361 f3fa 00 48 __boxw2 = temp7 4362 f3fa 00 49 __boxh2 = temp8 4363 f3fa 4364 f3fa DoXCollisionCheck 4365 f3fa ;lda __boxx1 ; skipped. already in the accumulator 4366 f3fa c5 46 cmp __boxx2 ;3 4367 f3fc b0 07 bcs X1isbiggerthanX2 ;2/3 4368 f3fe X2isbiggerthanX1 4369 f3fe ; carry is clear 4370 f3fe 65 44 adc __boxw1 ;3 4371 f400 c5 46 cmp __boxx2 ;3 4372 f402 b0 08 bcs DoYCollisionCheck ;3/2 4373 f404 60 rts ;6 - carry clear, no collision 4374 f405 X1isbiggerthanX2 4375 f405 18 clc ;2 4376 f406 e5 48 sbc __boxw2 ;3 4377 f408 c5 46 cmp __boxx2 ;3 4378 f40a b0 13 bcs noboxcollision ;3/2 4379 f40c DoYCollisionCheck 4380 f40c 98 tya ; 2 ; use to be "lda __boxy1" 4381 f40d c5 47 cmp __boxy2 ;3 4382 f40f b0 05 bcs Y1isbiggerthanY2 ;3/2 4383 f411 Y2isbiggerthanY1 4384 f411 ; carry is clear 4385 f411 65 45 adc __boxh1 ;3 4386 f413 c5 47 cmp __boxy2 ;3 4387 f415 60 rts ;6 4388 f416 Y1isbiggerthanY2 4389 f416 18 clc ;2 4390 f417 e5 49 sbc __boxh2 ;3 4391 f419 c5 47 cmp __boxy2 ;3 4392 f41b b0 02 bcs noboxcollision ;3/2 4393 f41d yesboxcollision 4394 f41d 38 sec ;2 4395 f41e 60 rts ;6 4396 f41f noboxcollision 4397 f41f 18 clc ;2 4398 f420 60 rts ;6 4399 f421 endif ; BOXCOLLISION 4400 f421 4401 f421 randomize 4402 f421 a5 40 lda rand 4403 f423 4a lsr 4404 f424 26 41 rol rand16 4405 f426 90 02 bcc noeor 4406 f428 49 b4 eor #$B4 4407 f42a noeor 4408 f42a 85 40 sta rand 4409 f42c 45 41 eor rand16 4410 f42e 60 rts 4411 f42f 4412 f42f ; *** bcd conversion routine courtesy Omegamatrix 4413 f42f ; *** http://atariage.com/forums/blog/563/entry-10832-hex-to-bcd-conversion-0-99/ 4414 f42f converttobcd 4415 f42f ;value to convert is in the accumulator 4416 f42f 85 42 sta temp1 4417 f431 4a lsr 4418 f432 65 42 adc temp1 4419 f434 6a ror 4420 f435 4a lsr 4421 f436 4a lsr 4422 f437 65 42 adc temp1 4423 f439 6a ror 4424 f43a 65 42 adc temp1 4425 f43c 6a ror 4426 f43d 4a lsr 4427 f43e 29 3c and #$3C 4428 f440 85 43 sta temp2 4429 f442 4a lsr 4430 f443 65 43 adc temp2 4431 f445 65 42 adc temp1 4432 f447 60 rts ; return the result in the accumulator 4433 f448 4434 f448 ; Y and A contain multiplicands, result in A 4435 f448 mul8 4436 f448 84 42 sty temp1 4437 f44a 85 43 sta temp2 4438 f44c a9 00 lda #0 4439 f44e reptmul8 4440 f44e 46 43 lsr temp2 4441 f450 90 03 bcc skipmul8 4442 f452 18 clc 4443 f453 65 42 adc temp1 4444 f455 ;bcs donemul8 might save cycles? 4445 f455 skipmul8 4446 f455 ;beq donemul8 might save cycles? 4447 f455 06 42 asl temp1 4448 f457 d0 f5 bne reptmul8 4449 f459 donemul8 4450 f459 60 rts 4451 f45a 4452 f45a div8 4453 f45a ; A=numerator Y=denominator, result in A 4454 f45a c0 02 cpy #2 4455 f45c 90 0a bcc div8end+1 ;div by 0 = bad, div by 1=no calc needed, so bail out 4456 f45e 84 42 sty temp1 4457 f460 a0 ff ldy #$ff 4458 f462 div8loop 4459 f462 e5 42 sbc temp1 4460 f464 c8 iny 4461 f465 b0 fb bcs div8loop 4462 f467 div8end 4463 f467 98 tya 4464 f468 ; result in A 4465 f468 60 rts 4466 f469 4467 f469 ; Y and A contain multiplicands, result in temp2,A=low, temp1=high 4468 f469 mul16 4469 f469 84 42 sty temp1 4470 f46b 85 43 sta temp2 4471 f46d 4472 f46d a9 00 lda #0 4473 f46f a2 08 ldx #8 4474 f471 46 42 lsr temp1 4475 f473 mul16_1 4476 f473 90 03 bcc mul16_2 4477 f475 18 clc 4478 f476 65 43 adc temp2 4479 f478 mul16_2 4480 f478 6a ror 4481 f479 66 42 ror temp1 4482 f47b ca dex 4483 f47c d0 f5 bne mul16_1 4484 f47e 85 43 sta temp2 4485 f480 60 rts 4486 f481 4487 f481 ; div int/int 4488 f481 ; numerator in A, denom in temp1 4489 f481 ; returns with quotient in A, remainder in temp1 4490 f481 div16 4491 f481 85 43 sta temp2 4492 f483 84 42 sty temp1 4493 f485 a9 00 lda #0 4494 f487 a2 08 ldx #8 4495 f489 06 43 asl temp2 4496 f48b div16_1 4497 f48b 2a rol 4498 f48c c5 42 cmp temp1 4499 f48e 90 02 bcc div16_2 4500 f490 e5 42 sbc temp1 4501 f492 div16_2 4502 f492 26 43 rol temp2 4503 f494 ca dex 4504 f495 d0 f4 bne div16_1 4505 f497 85 42 sta temp1 4506 f499 a5 43 lda temp2 4507 f49b 60 rts 4508 f49c 4509 f49c - ifconst bankswitchmode 4510 f49c -BS_jsr 4511 f49c - ifconst dumpbankswitch 4512 f49c - sta dumpbankswitch 4513 f49c - endif 4514 f49c - ifconst MCPDEVCART 4515 f49c - ora #$18 4516 f49c - sta $3000 4517 f49c - else 4518 f49c - sta $8000 4519 f49c - endif 4520 f49c - pla 4521 f49c - tax 4522 f49c - pla 4523 f49c - rts 4524 f49c - 4525 f49c -BS_return 4526 f49c - pla ; bankswitch bank 4527 f49c - ifconst dumpbankswitch 4528 f49c - sta dumpbankswitch 4529 f49c - endif 4530 f49c - ifconst BANKRAM 4531 f49c - sta currentbank 4532 f49c - ora currentrambank 4533 f49c - endif 4534 f49c - ifconst MCPDEVCART 4535 f49c - ora #$18 4536 f49c - sta $3000 4537 f49c - else 4538 f49c - sta $8000 4539 f49c - endif 4540 f49c - pla ; bankswitch $0 flag 4541 f49c - rts 4542 f49c endif 4543 f49c 4544 f49c checkselectswitch 4545 f49c ad 82 02 lda SWCHB ; first check the real select switch... 4546 f49f 29 02 and #%00000010 4547 f4a1 ifnconst MOUSESUPPORT 4548 f4a1 f0 05 beq checkselectswitchreturn ; switch is pressed 4549 f4a3 ad 80 02 lda SWCHA ; then check the soft "select" joysick code... 4550 f4a6 29 b0 and #%10110000 ; R_DU 4551 f4a8 endif ; MOUSESUPPORT 4552 f4a8 checkselectswitchreturn 4553 f4a8 60 rts 4554 f4a9 4555 f4a9 checkresetswitch 4556 f4a9 ad 82 02 lda SWCHB ; first check the real reset switch... 4557 f4ac 29 01 and #%00000001 4558 f4ae ifnconst MOUSESUPPORT 4559 f4ae f0 05 beq checkresetswitchreturn ; switch is pressed 4560 f4b0 ad 80 02 lda SWCHA ; then check the soft "reset" joysick code... 4561 f4b3 29 70 and #%01110000 ; _LDU 4562 f4b5 endif ; MOUSESUPPORT 4563 f4b5 checkresetswitchreturn 4564 f4b5 60 rts 4565 f4b6 4566 f4b6 - ifconst FINESCROLLENABLED 4567 f4b6 -finescrolldlls 4568 f4b6 - ldx temp1 ; first DLL index x3 4569 f4b6 - lda DLLMEM,x 4570 f4b6 - and #%11110000 4571 f4b6 - ora finescrolly 4572 f4b6 - sta DLLMEM,x 4573 f4b6 - 4574 f4b6 - ldx temp2 ; last DLL index x3 4575 f4b6 - lda DLLMEM,x 4576 f4b6 - and #%11110000 4577 f4b6 - ora finescrolly 4578 f4b6 - eor #(WZONEHEIGHT-1) 4579 f4b6 - sta DLLMEM,x 4580 f4b6 - rts 4581 f4b6 endif ; FINESCROLLENABLED 4582 f4b6 4583 f4b6 - ifconst USED_ADJUSTVISIBLE 4584 f4b6 -adjustvisible 4585 f4b6 - ; called with temp1=first visible zone *3, temp2=last visible zone *3 4586 f4b6 - jsr waitforvblankstart ; ensure vblank just started 4587 f4b6 - ldx visibleDLLstart 4588 f4b6 -findfirstinterrupt 4589 f4b6 - lda DLLMEM,x 4590 f4b6 - bmi foundfirstinterrupt 4591 f4b6 - inx 4592 f4b6 - inx 4593 f4b6 - inx 4594 f4b6 - bne findfirstinterrupt 4595 f4b6 -foundfirstinterrupt 4596 f4b6 - and #%01111111 ; clear the interrupt bit 4597 f4b6 - sta DLLMEM,x 4598 f4b6 - ifconst DOUBLEBUFFER 4599 f4b6 - sta DLLMEM+DBOFFSET,x 4600 f4b6 - endif ; DOUBLEBUFFER 4601 f4b6 - ldx overscanDLLstart 4602 f4b6 -findlastinterrupt 4603 f4b6 - lda DLLMEM,x 4604 f4b6 - bmi foundlastinterrupt 4605 f4b6 - dex 4606 f4b6 - dex 4607 f4b6 - dex 4608 f4b6 - bne findlastinterrupt 4609 f4b6 -foundlastinterrupt 4610 f4b6 - and #%01111111 ; clear the interrupt bit 4611 f4b6 - sta DLLMEM,x 4612 f4b6 - ifconst DOUBLEBUFFER 4613 f4b6 - sta DLLMEM+DBOFFSET,x 4614 f4b6 - endif ; DOUBLEBUFFER 4615 f4b6 - ;now we need to set the new interrupts 4616 f4b6 - clc 4617 f4b6 - lda temp1 4618 f4b6 - adc visibleDLLstart 4619 f4b6 - tax 4620 f4b6 - lda DLLMEM,x 4621 f4b6 - ora #%10000000 4622 f4b6 - sta DLLMEM,x 4623 f4b6 - ifconst DOUBLEBUFFER 4624 f4b6 - sta DLLMEM+DBOFFSET,x 4625 f4b6 - endif ; DOUBLEBUFFER 4626 f4b6 - clc 4627 f4b6 - lda temp2 4628 f4b6 - adc visibleDLLstart 4629 f4b6 - tax 4630 f4b6 - lda DLLMEM,x 4631 f4b6 - ora #%10000000 4632 f4b6 - sta DLLMEM,x 4633 f4b6 - ifconst DOUBLEBUFFER 4634 f4b6 - sta DLLMEM+DBOFFSET,x 4635 f4b6 - endif ; DOUBLEBUFFER 4636 f4b6 - jsr vblankresync 4637 f4b6 - rts 4638 f4b6 endif ; USED_ADJUSTVISIBLE 4639 f4b6 4640 f4b6 vblankresync 4641 f4b6 20 54 f5 jsr waitforvblankstart ; ensure vblank just started 4642 f4b9 a9 00 lda #0 4643 f4bb 85 4d sta visibleover 4644 f4bd a9 03 lda #3 4645 f4bf 8d b2 01 sta interruptindex 4646 f4c2 60 rts 4647 f4c3 4648 f4c3 createallgamedlls 4649 f4c3 a2 00 ldx #0 4650 f4c5 a9 11 lda #NVLINES 4651 f4c7 ac 09 21 ldy paldetected 4652 f4ca f0 03 beq skipcreatePALpadding 4653 f4cc 18 clc 4654 f4cd 69 15 adc #21 4655 f4cf skipcreatePALpadding 4656 f4cf 20 04 f5 jsr createnonvisibledlls 4657 f4d2 8e 3c 21 stx visibleDLLstart 4658 f4d5 20 35 f5 jsr createvisiblezones 4659 f4d8 8e 3d 21 stx overscanDLLstart 4660 f4db createallgamedllscontinue 4661 f4db a9 48 lda #(NVLINES+55) ; extras for PAL 4662 f4dd 20 04 f5 jsr createnonvisibledlls 4663 f4e0 4664 f4e0 ae 3c 21 ldx visibleDLLstart 4665 f4e3 bd 00 18 lda DLLMEM,x 4666 f4e6 09 80 ora #%10000000 ; NMI 1 - start of visible screen 4667 f4e8 9d 00 18 sta DLLMEM,x 4668 f4eb - ifconst DOUBLEBUFFER 4669 f4eb - sta DLLMEM+DBOFFSET,x 4670 f4eb endif ; DOUBLEBUFFER 4671 f4eb 4672 f4eb ae 3d 21 ldx overscanDLLstart 4673 f4ee bd 00 18 lda DLLMEM,x 4674 f4f1 09 83 ora #%10000011 ; NMI 2 - end of visible screen 4675 f4f3 29 f3 and #%11110011 ; change this to a 1-line DLL, so there's time enough for the "deeper overscan" DLL 4676 f4f5 9d 00 18 sta DLLMEM,x 4677 f4f8 - ifconst DOUBLEBUFFER 4678 f4f8 - sta DLLMEM+DBOFFSET,x 4679 f4f8 endif ; DOUBLEBUFFER 4680 f4f8 4681 f4f8 e8 inx 4682 f4f9 e8 inx 4683 f4fa e8 inx 4684 f4fb 4685 f4fb bd 00 18 lda DLLMEM,x 4686 f4fe 09 80 ora #%10000000 ; NMI 3 - deeper overscan 4687 f500 9d 00 18 sta DLLMEM,x 4688 f503 - ifconst DOUBLEBUFFER 4689 f503 - sta DLLMEM+DBOFFSET,x 4690 f503 endif ; DOUBLEBUFFER 4691 f503 4692 f503 60 rts 4693 f504 4694 f504 createnonvisibledlls 4695 f504 85 42 sta temp1 4696 f506 4a lsr 4697 f507 4a lsr 4698 f508 4a lsr 4699 f509 4a lsr ; /16 4700 f50a f0 09 beq skipcreatenonvisibledlls1loop 4701 f50c a8 tay 4702 f50d createnonvisibledlls1loop 4703 f50d a9 4f lda #%01001111 ;low nibble=16 lines, high nibble=Holey DMA 4704 f50f 20 24 f5 jsr createblankdllentry 4705 f512 88 dey 4706 f513 d0 f8 bne createnonvisibledlls1loop 4707 f515 skipcreatenonvisibledlls1loop 4708 f515 a5 42 lda temp1 4709 f517 29 0f and #%00001111 4710 f519 f0 08 beq createnonvisibledllsreturn 4711 f51b 38 sec 4712 f51c e9 01 sbc #1 4713 f51e 09 40 ora #%01000000 4714 f520 20 24 f5 jsr createblankdllentry 4715 f523 createnonvisibledllsreturn 4716 f523 60 rts 4717 f524 4718 f524 createblankdllentry 4719 f524 9d 00 18 sta DLLMEM,x 4720 f527 - ifconst DOUBLEBUFFER 4721 f527 - sta DLLMEM+DBOFFSET,x 4722 f527 endif ; DOUBLEBUFFER 4723 f527 e8 inx 4724 f528 a9 21 lda #$21 ; blank 4725 f52a 9d 00 18 sta DLLMEM,x 4726 f52d - ifconst DOUBLEBUFFER 4727 f52d - sta DLLMEM+DBOFFSET,x 4728 f52d endif ; DOUBLEBUFFER 4729 f52d e8 inx 4730 f52e a9 00 lda #$00 4731 f530 9d 00 18 sta DLLMEM,x 4732 f533 - ifconst DOUBLEBUFFER 4733 f533 - sta DLLMEM+DBOFFSET,x 4734 f533 endif ; DOUBLEBUFFER 4735 f533 e8 inx 4736 f534 60 rts 4737 f535 4738 f535 createvisiblezones 4739 f535 a0 00 ldy #0 4740 f537 createvisiblezonesloop 4741 f537 b9 8d f6 lda.w DLHEIGHT,y 4742 f53a 09 20 ora #(WZONEHEIGHT * 4) ; set Holey DMA for 8 or 16 tall zones 4743 f53c 9d 00 18 sta DLLMEM,x 4744 f53f - ifconst DOUBLEBUFFER 4745 f53f - sta DLLMEM+DBOFFSET,x 4746 f53f endif ; DOUBLEBUFFER 4747 f53f e8 inx 4748 f540 b9 59 f6 lda DLPOINTH,y 4749 f543 9d 00 18 sta DLLMEM,x 4750 f546 - ifconst DOUBLEBUFFER 4751 f546 - sta DLLMEM+DBOFFSET,x 4752 f546 endif ; DOUBLEBUFFER 4753 f546 e8 inx 4754 f547 b9 73 f6 lda DLPOINTL,y 4755 f54a 9d 00 18 sta DLLMEM,x 4756 f54d - ifconst DOUBLEBUFFER 4757 f54d - clc 4758 f54d - adc #DOUBLEBUFFEROFFSET 4759 f54d - sta DLLMEM+DBOFFSET,x 4760 f54d - bcc skiphidoublebufferadjust ; dlls are big endian, so we need to fix the hi byte after-the-fact... 4761 f54d - inc DLLMEM+DBOFFSET-1,x 4762 f54d -skiphidoublebufferadjust 4763 f54d endif ; DOUBLEBUFFER 4764 f54d e8 inx 4765 f54e c8 iny 4766 f54f c0 1a cpy #WZONECOUNT 4767 f551 d0 e4 bne createvisiblezonesloop 4768 f553 60 rts 4769 f554 4770 f554 waitforvblankstart 4771 f554 vblankendwait 4772 f554 24 28 BIT MSTAT 4773 f556 30 fc bmi vblankendwait 4774 f558 vblankstartwait 4775 f558 24 28 BIT MSTAT 4776 f55a 10 fc bpl vblankstartwait 4777 f55c 60 rts 4778 f55d 4779 f55d - ifconst DOUBLEBUFFER 4780 f55d -flipdisplaybufferreturn 4781 f55d - rts 4782 f55d -flipdisplaybuffer 4783 f55d - ifconst interrupthold 4784 f55d - lda #$FF 4785 f55d - sta interrupthold 4786 f55d - endif 4787 f55d - lda doublebufferstate 4788 f55d - beq flipdisplaybufferreturn ; exit if we're not in double-buffer 4789 f55d - 4790 f55d - jsr terminatedisplaybuffer ; terminate the working buffer before we flip 4791 f55d - 4792 f55d - lda doublebufferstate 4793 f55d - lsr ; /2, so we'll see 0 or 1, rather than 1 or 3 4794 f55d - tax 4795 f55d - 4796 f55d - ; ensure we don't flip mid-display. otherwise the displayed DL will be the one the game is working on. 4797 f55d - 4798 f55d -flipdisplaybufferwait1 4799 f55d - lda visibleover 4800 f55d - beq flipdisplaybufferwait1 4801 f55d - 4802 f55d -flipdisplaybufferwait 4803 f55d - lda visibleover 4804 f55d - bne flipdisplaybufferwait 4805 f55d - 4806 f55d - lda doublebufferminimumframetarget 4807 f55d - beq skipminimumframecode 4808 f55d - lda doublebufferminimumframeindex 4809 f55d - bne flipdisplaybufferwait1 4810 f55d - lda doublebufferminimumframetarget 4811 f55d - sta doublebufferminimumframeindex 4812 f55d -skipminimumframecode 4813 f55d - 4814 f55d - lda DLLMEMLutHi,x 4815 f55d - sta DPPH 4816 f55d - lda DLLMEMLutLo,x 4817 f55d - sta DPPL 4818 f55d - 4819 f55d - lda NewPageflipstate,x 4820 f55d - sta doublebufferstate 4821 f55d - lda NewPageflipoffset,x 4822 f55d - sta doublebufferdloffset 4823 f55d - 4824 f55d - lda doublebufferbufferdirty 4825 f55d - beq flipdisplaybufferreturn 4826 f55d - 4827 f55d - ; The doublebuffer buffer is dirty, so the game code must have issued a savescreen recently. 4828 f55d - ; To make savescreen work with the new working buffer, we need to copy over the saved objects 4829 f55d - ; from the displayed buffer to the working buffer... 4830 f55d - 4831 f55d - lda doublebufferdloffset 4832 f55d - eor #DOUBLEBUFFEROFFSET 4833 f55d - sta temp6 ; make temp6 the anti-doublebufferdloffset variable 4834 f55d - 4835 f55d - ldx #(WZONECOUNT-1) 4836 f55d -copybufferzoneloop 4837 f55d - 4838 f55d - lda DLPOINTL,x 4839 f55d - clc 4840 f55d - adc doublebufferdloffset 4841 f55d - sta temp1 4842 f55d - lda DLPOINTH,x 4843 f55d - adc #0 4844 f55d - sta temp2 4845 f55d - 4846 f55d - lda DLPOINTL,x 4847 f55d - clc 4848 f55d - adc temp6 4849 f55d - sta temp3 4850 f55d - lda DLPOINTH,x 4851 f55d - adc #0 4852 f55d - sta temp4 4853 f55d - 4854 f55d - lda dlendsave,x 4855 f55d - tay 4856 f55d -copybuffercharsloop 4857 f55d - lda (temp3),y 4858 f55d - sta (temp1),y 4859 f55d - dey 4860 f55d - bpl copybuffercharsloop 4861 f55d - dex 4862 f55d - bpl copybufferzoneloop 4863 f55d - lda #0 4864 f55d - sta doublebufferbufferdirty 4865 f55d - rts 4866 f55d - 4867 f55d -doublebufferoff 4868 f55d - lda #1 4869 f55d - sta doublebufferstate 4870 f55d - jsr flipdisplaybuffer 4871 f55d - lda #0 4872 f55d - sta doublebufferstate 4873 f55d - sta doublebufferdloffset 4874 f55d - rts 4875 f55d - 4876 f55d -DLLMEMLutLo 4877 f55d - .byte DLLMEM,>(DLLMEM+DBOFFSET) 4880 f55d -NewPageflipstate 4881 f55d - .byte 3,1 4882 f55d -NewPageflipoffset 4883 f55d - .byte DOUBLEBUFFEROFFSET,0 4884 f55d - 4885 f55d endif ; DOUBLEBUFFER 4886 f55d 4887 f55d - ifconst MOUSESUPPORT 4888 f55d - 4889 f55d -rotationalcompare 4890 f55d - ; old = 00 01 10 11 4891 f55d - .byte $00, $01, $ff, $00 ; new=00 4892 f55d - .byte $ff, $00, $00, $01 ; new=01 4893 f55d - .byte $01, $00, $00, $ff ; new=10 4894 f55d - .byte $00, $ff, $01, $00 ; new=11 4895 f55d - 4896 f55d - ; 0000YyXx st mouse 4897 f55d - 4898 f55d - ; 0000xyXY amiga mouse 4899 f55d - 4900 f55d - ifconst MOUSEXONLY 4901 f55d -amigatoataribits ; swap bits 1 and 4... 4902 f55d - .byte %0000, %0000, %0010, %0010 4903 f55d - .byte %0000, %0000, %0010, %0010 4904 f55d - .byte %0001, %0001, %0011, %0011 4905 f55d - .byte %0001, %0001, %0011, %0011 4906 f55d - 4907 f55d - ; null change bits 4908 f55d - .byte %0000, %0001, %0010, %0011 4909 f55d - .byte %0000, %0001, %0010, %0011 4910 f55d - .byte %0000, %0001, %0010, %0011 4911 f55d - .byte %0000, %0001, %0010, %0011 4912 f55d - 4913 f55d - else ; !MOUSEXONLY 4914 f55d - 4915 f55d -amigatoataribits ; swap bits 1 and 4... 4916 f55d - .byte %0000, %1000, %0010, %1010 4917 f55d - .byte %0100, %1100, %0110, %1110 4918 f55d - .byte %0001, %1001, %0011, %1011 4919 f55d - .byte %0101, %1101, %0111, %1111 4920 f55d - ; null change bits 4921 f55d - .byte %0000, %0001, %0010, %0011 4922 f55d - .byte %0100, %0101, %0110, %0111 4923 f55d - .byte %1000, %1001, %1010, %1011 4924 f55d - .byte %1100, %1101, %1110, %1111 4925 f55d - endif ; !MOUSEXONLY 4926 f55d - 4927 f55d endif ; MOUSESUPPORT 4928 f55d 4929 f55d mouse0update 4930 f55d - ifconst MOUSE0SUPPORT 4931 f55d - 4932 f55d -mousetableselect = inttemp2 4933 f55d -mousexdelta = inttemp3 4934 f55d -mouseydelta = inttemp4 4935 f55d -lastSWCHA = inttemp6 4936 f55d - 4937 f55d - ; 0000YyXx st mouse 4938 f55d - ; 0000xyXY amiga mouse 4939 f55d - 4940 f55d - lda #$ff 4941 f55d - sta lastSWCHA 4942 f55d - 4943 f55d - ldy port0control 4944 f55d - 4945 f55d - lda #%00010000 4946 f55d - cpy #9 ; AMIGA? 4947 f55d - bne skipamigabitsfix0 4948 f55d - lda #0 4949 f55d -skipamigabitsfix0 4950 f55d - sta mousetableselect 4951 f55d - ifconst DRIVINGBOOST 4952 f55d - cpy #6 ; DRIVING? 4953 f55d - bne skipdriving0setup 4954 f55d - ; swap mousex0 and mousey0. mousex seen by the 7800basic program 4955 f55d - ; trails the actual mousex0, so we can smoothly interpolate toward 4956 f55d - ; the actual position. This actual position is stored in mousey0 4957 f55d - ; after the driver has run. 4958 f55d - ldx mousex0 4959 f55d - lda mousey0 4960 f55d - stx mousey0 4961 f55d - sta mousex0 4962 f55d -skipdriving0setup 4963 f55d - endif ; DRIVINGBOOST 4964 f55d - 4965 f55d - lda #0 4966 f55d - sta mousexdelta 4967 f55d - sta mouseydelta 4968 f55d - 4969 f55d - ifnconst MOUSETIME 4970 f55d - ifnconst MOUSEXONLY 4971 f55d - lda #180 ; minimum for x+y 4972 f55d - else 4973 f55d - lda #100 ; minimum for just x 4974 f55d - endif 4975 f55d - else 4976 f55d - lda #MOUSETIME 4977 f55d - endif 4978 f55d - jsr SETTIM64T ; INTIM is in Y 4979 f55d - 4980 f55d -mouse0updateloop 4981 f55d - lda SWCHA 4982 f55d - asr #%11110000 ; Undocumented. A = A & #IMM, then LSR A. 4983 f55d - cmp lastSWCHA 4984 f55d - beq mouse0loopcondition 4985 f55d - sta lastSWCHA 4986 f55d - lsr 4987 f55d - lsr 4988 f55d - lsr 4989 f55d - 4990 f55d - ora mousetableselect ; atari/amiga decoding table selection 4991 f55d - 4992 f55d - ; st mice encode on different bits/joystick-lines than amiga mice... 4993 f55d - ; 0000YyXx st mouse 4994 f55d - ; 0000xyXY amiga mouse 4995 f55d - ; ...so can shuffle the amiga bits to reuse the st driver. 4996 f55d - tay 4997 f55d - lax amigatoataribits,y 4998 f55d - 4999 f55d - ifnconst MOUSEXONLY 5000 f55d - ; first the Y... 5001 f55d - and #%00001100 5002 f55d - ora mousecodey0 5003 f55d - tay 5004 f55d - lda rotationalcompare,y 5005 f55d - clc 5006 f55d - adc mouseydelta 5007 f55d - sta mouseydelta 5008 f55d - tya 5009 f55d - lsr 5010 f55d - lsr 5011 f55d - sta mousecodey0 5012 f55d - txa 5013 f55d - ; ...then the X... 5014 f55d - and #%00000011 5015 f55d - tax 5016 f55d - endif ; !MOUSEXONLY 5017 f55d - 5018 f55d - asl 5019 f55d - asl 5020 f55d - ora mousecodex0 5021 f55d - tay 5022 f55d - lda rotationalcompare,y 5023 f55d - adc mousexdelta ; carry was clear by previous ASL 5024 f55d - sta mousexdelta 5025 f55d - stx mousecodex0 5026 f55d -mouse0loopcondition 5027 f55d - lda TIMINT 5028 f55d - bpl mouse0updateloop 5029 f55d - 5030 f55d - ; *** adapt to selected device resolution. 5031 f55d - ldx port0control 5032 f55d - 5033 f55d - ifconst PRECISIONMOUSING 5034 f55d - ldy port0resolution 5035 f55d - bne mouse0halveddone 5036 f55d - cpx #6 ; half-resolution is no good for driving wheels 5037 f55d - beq mouse0halveddone 5038 f55d - ; resolution=0 is half mouse resolution, necessary for precision 5039 f55d - ; mousing on a 160x240 screen with a 1000 dpi mouse. 5040 f55d - 5041 f55d - lda mousexdelta 5042 f55d - cmp #$80 5043 f55d - ror ; do a signed divide by 2. 5044 f55d - clc 5045 f55d - adc mousex0 5046 f55d - sta mousex0 5047 f55d - ifnconst MOUSEXONLY 5048 f55d - lda mouseydelta 5049 f55d - clc 5050 f55d - adc mousey0 5051 f55d - sta mousey0 5052 f55d - endif 5053 f55d - ; at half resolution we just exit after updating x and y 5054 f55d - jmp LLRET0 5055 f55d -mouse0halveddone 5056 f55d - endif ; PRECISIONMOUSING 5057 f55d - 5058 f55d - ifnconst MOUSEXONLY 5059 f55d - asl mouseydelta ; *2 because Y resolution is finer 5060 f55d - ldy port0resolution 5061 f55d - dey 5062 f55d - lda #0 5063 f55d -mousey0resolutionfix 5064 f55d - clc 5065 f55d - adc mouseydelta 5066 f55d - dey 5067 f55d - bpl mousey0resolutionfix 5068 f55d - clc 5069 f55d - adc mousey0 5070 f55d - sta mousey0 5071 f55d - endif ; MOUSEXONLY 5072 f55d - 5073 f55d - ldy port0resolution 5074 f55d - dey 5075 f55d - lda #0 5076 f55d -mousex0resolutionfix 5077 f55d - clc 5078 f55d - adc mousexdelta 5079 f55d - dey 5080 f55d - bpl mousex0resolutionfix 5081 f55d - ifnconst DRIVINGBOOST 5082 f55d - clc 5083 f55d - adc mousex0 5084 f55d - sta mousex0 5085 f55d - else 5086 f55d - cpx #6 5087 f55d - beq carryonmouse0boost 5088 f55d - clc 5089 f55d - adc mousex0 5090 f55d - sta mousex0 5091 f55d - jmp LLRET0 5092 f55d -carryonmouse0boost 5093 f55d - sta mousexdelta 5094 f55d - clc 5095 f55d - adc mousecodey0 5096 f55d - sta mousecodey0 5097 f55d - clc 5098 f55d - adc mousex0 5099 f55d - tay ; save the target X 5100 f55d - adc mousey0 ; average in the smoothly-trailing X 5101 f55d - ror 5102 f55d - sta mousex0 ; mousex0 now has the smoothly trailing X 5103 f55d - sty mousey0 ; and mousey0 has the the target X 5104 f55d - 5105 f55d - ; check to see if the coordinate wrapped. If so, undo the averaging code. 5106 f55d - ; A has mousex0, the smoothly trailing X 5107 f55d - sbc mousey0 ; less the target X 5108 f55d - bpl skipabsolutedrive0 5109 f55d - eor #$ff 5110 f55d -skipabsolutedrive0 5111 f55d - cmp #64 ; just an unreasonably large change 5112 f55d - bcc skipdrivewrapfix0 5113 f55d - sty mousex0 ; if X wrapped, we catch the trailing X up to the target X 5114 f55d -skipdrivewrapfix0 5115 f55d - 5116 f55d - ; get rid of the tweening if the distance travelled was very small 5117 f55d - lda mousexdelta 5118 f55d - cmp port0resolution 5119 f55d - bcs skipbetweenfix0 5120 f55d - lda mousex0 5121 f55d - sta mousey0 5122 f55d -skipbetweenfix0 5123 f55d - 5124 f55d -drivingboostreductioncheck0 5125 f55d - ; The below code amounts to mousecodey0=mousecodey0-(mousecodey0/8) 5126 f55d - ; +ve mousecodey0 is converted to -ve to do the calculation, and then 5127 f55d - ; negated again because truncation during BCD math results in 5128 f55d - ; differing magnitudes, depending if the value is +ve or -ve. 5129 f55d -driving0fix 5130 f55d - lax mousecodey0 5131 f55d - cmp #$80 5132 f55d - bcs driving0skipnegate1 5133 f55d - eor #$FF 5134 f55d - adc #1 5135 f55d - sta mousecodey0 5136 f55d -driving0skipnegate1 5137 f55d - cmp #$80 5138 f55d - ror 5139 f55d - cmp #$80 5140 f55d - ror 5141 f55d - cmp #$80 5142 f55d - ror 5143 f55d - sta inttemp1 5144 f55d - lda mousecodey0 5145 f55d - sec 5146 f55d - sbc inttemp1 5147 f55d - cpx #$80 5148 f55d - bcs driving0skipnegate2 5149 f55d - eor #$FF 5150 f55d - adc #1 5151 f55d -driving0skipnegate2 5152 f55d - sta mousecodey0 5153 f55d -drivingboostdone0 5154 f55d - endif ; DRIVINGBOOST 5155 f55d - 5156 f55d - jmp LLRET0 5157 f55d - 5158 f55d endif ; MOUSE0SUPPORT 5159 f55d 5160 f55d mouse1update 5161 f55d - ifconst MOUSE1SUPPORT 5162 f55d - 5163 f55d -mousetableselect = inttemp2 5164 f55d -mousexdelta = inttemp3 5165 f55d -mouseydelta = inttemp4 5166 f55d -lastSWCHA = inttemp6 5167 f55d - 5168 f55d - ; 0000YyXx st mouse 5169 f55d - ; 0000xyXY amiga mouse 5170 f55d - 5171 f55d - lda #$ff 5172 f55d - sta lastSWCHA 5173 f55d - 5174 f55d - ldy port1control 5175 f55d - 5176 f55d - lda #%00010000 5177 f55d - cpy #9 ; AMIGA? 5178 f55d - bne skipamigabitsfix1 5179 f55d - lda #0 5180 f55d -skipamigabitsfix1 5181 f55d - sta mousetableselect 5182 f55d - ifconst DRIVINGBOOST 5183 f55d - cpy #6 ; DRIVING? 5184 f55d - bne skipdriving1setup 5185 f55d - ; swap mousex1 and mousey1. mousex seen by the 7800basic program 5186 f55d - ; trails the actual mousex1, so we can smoothly interpolate toward 5187 f55d - ; the actual position. This actual position is stored in mousey1 5188 f55d - ; after the driver has run. 5189 f55d - ldx mousex1 5190 f55d - lda mousey1 5191 f55d - stx mousey1 5192 f55d - sta mousex1 5193 f55d -skipdriving1setup 5194 f55d - endif ; DRIVINGBOOST 5195 f55d - 5196 f55d - lda #0 5197 f55d - sta mousexdelta 5198 f55d - sta mouseydelta 5199 f55d - 5200 f55d - ifnconst MOUSETIME 5201 f55d - ifnconst MOUSEXONLY 5202 f55d - lda #180 ; minimum for x+y 5203 f55d - else 5204 f55d - lda #100 ; minimum for just x 5205 f55d - endif 5206 f55d - else 5207 f55d - lda #MOUSETIME 5208 f55d - endif 5209 f55d - jsr SETTIM64T ; INTIM is in Y 5210 f55d - 5211 f55d -mouse1updateloop 5212 f55d - lda SWCHA 5213 f55d - and #%00001111 5214 f55d - cmp lastSWCHA 5215 f55d - beq mouse1loopcondition 5216 f55d - sta lastSWCHA 5217 f55d - 5218 f55d - ora mousetableselect ; atari/amiga decoding table selection 5219 f55d - 5220 f55d - ; st mice encode on different bits/joystick-lines than amiga mice... 5221 f55d - ; 0000YyXx st mouse 5222 f55d - ; 0000xyXY amiga mouse 5223 f55d - ; ...so can shuffle the amiga bits to reuse the st driver. 5224 f55d - tay 5225 f55d - lax amigatoataribits,y 5226 f55d - 5227 f55d - ifnconst MOUSEXONLY 5228 f55d - ; first the Y... 5229 f55d - and #%00001100 5230 f55d - ora mousecodey1 5231 f55d - tay 5232 f55d - lda rotationalcompare,y 5233 f55d - clc 5234 f55d - adc mouseydelta 5235 f55d - sta mouseydelta 5236 f55d - tya 5237 f55d - lsr 5238 f55d - lsr 5239 f55d - sta mousecodey1 5240 f55d - txa 5241 f55d - ; ...then the X... 5242 f55d - and #%00000011 5243 f55d - tax 5244 f55d - endif ; !MOUSEXONLY 5245 f55d - 5246 f55d - asl 5247 f55d - asl 5248 f55d - ora mousecodex1 5249 f55d - tay 5250 f55d - lda rotationalcompare,y 5251 f55d - adc mousexdelta ; carry was clear by previous ASL 5252 f55d - sta mousexdelta 5253 f55d - stx mousecodex1 5254 f55d -mouse1loopcondition 5255 f55d - lda TIMINT 5256 f55d - bpl mouse1updateloop 5257 f55d - 5258 f55d - ; *** adapt to selected device resolution. 5259 f55d - ldx port1control 5260 f55d - 5261 f55d - ifconst PRECISIONMOUSING 5262 f55d - ldy port1resolution 5263 f55d - bne mouse1halveddone 5264 f55d - cpx #6 ; half-resolution is no good for driving wheels 5265 f55d - beq mouse1halveddone 5266 f55d - ; resolution=0 is half mouse resolution, necessary for precision 5267 f55d - ; mousing on a 160x240 screen with a 1000 dpi mouse. 5268 f55d - 5269 f55d - lda mousexdelta 5270 f55d - cmp #$80 5271 f55d - ror ; do a signed divide by 2. 5272 f55d - clc 5273 f55d - adc mousex1 5274 f55d - sta mousex1 5275 f55d - ifnconst MOUSEXONLY 5276 f55d - lda mouseydelta 5277 f55d - clc 5278 f55d - adc mousey1 5279 f55d - sta mousey1 5280 f55d - endif 5281 f55d - ; at half resolution we just exit after updating x and y 5282 f55d - jmp LLRET1 5283 f55d -mouse1halveddone 5284 f55d - endif ; PRECISIONMOUSING 5285 f55d - 5286 f55d - ifnconst MOUSEXONLY 5287 f55d - asl mouseydelta ; *2 because Y resolution is finer 5288 f55d - ldy port1resolution 5289 f55d - dey 5290 f55d - lda #0 5291 f55d -mousey1resolutionfix 5292 f55d - clc 5293 f55d - adc mouseydelta 5294 f55d - dey 5295 f55d - bpl mousey1resolutionfix 5296 f55d - clc 5297 f55d - adc mousey1 5298 f55d - sta mousey1 5299 f55d - endif ; MOUSEXONLY 5300 f55d - 5301 f55d - ldy port1resolution 5302 f55d - dey 5303 f55d - lda #0 5304 f55d -mousex1resolutionfix 5305 f55d - clc 5306 f55d - adc mousexdelta 5307 f55d - dey 5308 f55d - bpl mousex1resolutionfix 5309 f55d - ifnconst DRIVINGBOOST 5310 f55d - clc 5311 f55d - adc mousex1 5312 f55d - sta mousex1 5313 f55d - else 5314 f55d - cpx #6 5315 f55d - beq carryonmouse1boost 5316 f55d - clc 5317 f55d - adc mousex1 5318 f55d - sta mousex1 5319 f55d - jmp LLRET1 5320 f55d -carryonmouse1boost 5321 f55d - sta mousexdelta 5322 f55d - clc 5323 f55d - adc mousecodey1 5324 f55d - sta mousecodey1 5325 f55d - clc 5326 f55d - adc mousex1 5327 f55d - tay ; save the target X 5328 f55d - adc mousey1 ; average in the smoothly-trailing X 5329 f55d - ror 5330 f55d - sta mousex1 ; mousex0 now has the smoothly trailing X 5331 f55d - sty mousey1 ; and mousey0 has the the target X 5332 f55d - 5333 f55d - ; check to see if the coordinate wrapped. If so, undo the averaging code. 5334 f55d - ; A has mousex1, the smoothly trailing X 5335 f55d - sbc mousey1 ; less the target X 5336 f55d - bpl skipabsolutedrive1 5337 f55d - eor #$ff 5338 f55d -skipabsolutedrive1 5339 f55d - cmp #64 ; just an unreasonably large change 5340 f55d - bcc skipdrivewrapfix1 5341 f55d - sty mousex1 ; if X wrapped, we catch the trailing X up to the target X 5342 f55d -skipdrivewrapfix1 5343 f55d - 5344 f55d - ; get rid of the tweening if the distance travelled was very small 5345 f55d - lda mousexdelta 5346 f55d - cmp port1resolution 5347 f55d - bcs skipbetweenfix1 5348 f55d - lda mousex1 5349 f55d - sta mousey1 5350 f55d -skipbetweenfix1 5351 f55d - 5352 f55d -drivingboostreductioncheck1 5353 f55d - ; The below code amounts to mousecodey0=mousecodey0-(mousecodey0/8) 5354 f55d - ; +ve mousecodey0 is converted to -ve to do the calculation, and then 5355 f55d - ; negated again because truncation during BCD math results in 5356 f55d - ; differing magnitudes, depending if the value is +ve or -ve. 5357 f55d -driving1fix 5358 f55d - lax mousecodey1 5359 f55d - cmp #$80 5360 f55d - bcs driving0skipnegate1 5361 f55d - eor #$FF 5362 f55d - adc #1 5363 f55d - sta mousecodey1 5364 f55d -driving0skipnegate1 5365 f55d - cmp #$80 5366 f55d - ror 5367 f55d - cmp #$80 5368 f55d - ror 5369 f55d - cmp #$80 5370 f55d - ror 5371 f55d - sta inttemp1 5372 f55d - lda mousecodey1 5373 f55d - sec 5374 f55d - sbc inttemp1 5375 f55d - cpx #$80 5376 f55d - bcs driving1skipnegate2 5377 f55d - eor #$FF 5378 f55d - adc #1 5379 f55d -driving1skipnegate2 5380 f55d - sta mousecodey1 5381 f55d -drivingboostdone1 5382 f55d - endif ; DRIVINGBOOST 5383 f55d - 5384 f55d - jmp LLRET1 5385 f55d - 5386 f55d endif ; MOUSE1SUPPORT 5387 f55d 5388 f55d 5389 f55d trakball0update 5390 f55d - ifconst TRAKBALL0SUPPORT 5391 f55d - ifnconst TRAKTIME 5392 f55d - ifnconst TRAKXONLY 5393 f55d - lda #180 ; minimum for x+y 5394 f55d - else ; !TRAKXONLY 5395 f55d - lda #100 ; minimum for just x 5396 f55d - endif ; !TRAKXONLY 5397 f55d - else ; !TRAKTIME 5398 f55d - lda #TRAKTIME 5399 f55d - endif ; !TRAKTIME 5400 f55d - jsr SETTIM64T ; INTIM is in Y 5401 f55d - ldx #0 5402 f55d - ifnconst TRAKXONLY 5403 f55d - ldy #0 5404 f55d - endif ; TRAKXONLY 5405 f55d -trakball0updateloop 5406 f55d - lda SWCHA 5407 f55d - and #%00110000 5408 f55d - cmp trakballcodex0 5409 f55d - sta trakballcodex0 5410 f55d - beq trakball0movementXdone 5411 f55d - and #%00010000 5412 f55d - beq trakball0negativeX 5413 f55d -trakball0positiveX 5414 f55d - ;(2 from beq) 5415 f55d - inx ; 2 5416 f55d - jmp trakball0movementXdone ; 3 5417 f55d -trakball0negativeX 5418 f55d - ;(3 from beq) 5419 f55d - dex ; 2 5420 f55d - nop ; 2 5421 f55d -trakball0movementXdone 5422 f55d - 5423 f55d - ifnconst TRAKXONLY 5424 f55d - lda SWCHA 5425 f55d - and #%11000000 5426 f55d - cmp trakballcodey0 5427 f55d - sta trakballcodey0 5428 f55d - beq trakball0movementYdone 5429 f55d - and #%01000000 5430 f55d - beq trakball0negativeY 5431 f55d -trakball0positiveY 5432 f55d - ;(2 from beq) 5433 f55d - iny ; 2 5434 f55d - jmp trakball0movementYdone ; 3 5435 f55d -trakball0negativeY 5436 f55d - ;(3 from beq) 5437 f55d - dey ; 2 5438 f55d - nop ; 2 5439 f55d -trakball0movementYdone 5440 f55d - endif ; !TRAKXONLY 5441 f55d - 5442 f55d - lda TIMINT 5443 f55d - bpl trakball0updateloop 5444 f55d - lda #0 5445 f55d - cpx #0 5446 f55d - beq trakball0skipXadjust 5447 f55d - clc 5448 f55d -trakball0Xloop 5449 f55d - adc port0resolution 5450 f55d - dex 5451 f55d - bne trakball0Xloop 5452 f55d - clc 5453 f55d - adc trakballx0 5454 f55d - sta trakballx0 5455 f55d -trakball0skipXadjust 5456 f55d - ifnconst TRAKXONLY 5457 f55d - lda #0 5458 f55d - cpy #0 5459 f55d - beq trakball0skipYadjust 5460 f55d - clc 5461 f55d -trakball0yloop 5462 f55d - adc port0resolution 5463 f55d - dey 5464 f55d - bne trakball0yloop 5465 f55d - clc 5466 f55d - adc trakbally0 5467 f55d - sta trakbally0 5468 f55d -trakball0skipYadjust 5469 f55d - endif ; !TRAKXONLY 5470 f55d - 5471 f55d - jmp LLRET0 5472 f55d endif 5473 f55d 5474 f55d 5475 f55d 5476 f55d trakball1update 5477 f55d - ifconst TRAKBALL1SUPPORT 5478 f55d - ifnconst TRAKTIME 5479 f55d - ifnconst TRAKXONLY 5480 f55d - lda #180 ; minimum for x+y 5481 f55d - else ; !TRAKXONLY 5482 f55d - lda #100 ; minimum for just x 5483 f55d - endif ; !TRAKXONLY 5484 f55d - else ; !TRAKTIME 5485 f55d - lda #TRAKTIME 5486 f55d - endif ; !TRAKTIME 5487 f55d - jsr SETTIM64T ; INTIM is in Y 5488 f55d - ldx #0 5489 f55d - ifnconst TRAKXONLY 5490 f55d - ldy #0 5491 f55d - endif ; TRAKXONLY 5492 f55d -trakball1updateloop 5493 f55d - lda SWCHA 5494 f55d - and #%00000011 5495 f55d - cmp trakballcodex1 5496 f55d - sta trakballcodex1 5497 f55d - beq trakball1movementXdone 5498 f55d - and #%00000001 5499 f55d - beq trakball1negativeX 5500 f55d -trakball1positiveX 5501 f55d - ;(2 from beq) 5502 f55d - inx ; 2 5503 f55d - jmp trakball1movementXdone ; 3 5504 f55d -trakball1negativeX 5505 f55d - ;(3 from beq) 5506 f55d - dex ; 2 5507 f55d - nop ; 2 5508 f55d -trakball1movementXdone 5509 f55d - 5510 f55d - ifnconst TRAKXONLY 5511 f55d - lda SWCHA 5512 f55d - and #%00001100 5513 f55d - cmp trakballcodey1 5514 f55d - sta trakballcodey1 5515 f55d - beq trakball1movementYdone 5516 f55d - and #%00000100 5517 f55d - beq trakball1negativeY 5518 f55d -trakball1positiveY 5519 f55d - ;(2 from beq) 5520 f55d - iny ; 2 5521 f55d - jmp trakball1movementYdone ; 3 5522 f55d -trakball1negativeY 5523 f55d - ;(3 from beq) 5524 f55d - dey ; 2 5525 f55d - nop ; 2 5526 f55d -trakball1movementYdone 5527 f55d - endif ; !TRAKXONLY 5528 f55d - 5529 f55d - lda TIMINT 5530 f55d - bpl trakball1updateloop 5531 f55d - lda #0 5532 f55d - cpx #0 5533 f55d - beq trakball1skipXadjust 5534 f55d - clc 5535 f55d -trakball1Xloop 5536 f55d - adc port1resolution 5537 f55d - dex 5538 f55d - bne trakball1Xloop 5539 f55d - clc 5540 f55d - adc trakballx1 5541 f55d - sta trakballx1 5542 f55d -trakball1skipXadjust 5543 f55d - ifnconst TRAKXONLY 5544 f55d - lda #0 5545 f55d - cpy #0 5546 f55d - beq trakball1skipYadjust 5547 f55d - clc 5548 f55d -trakball1yloop 5549 f55d - adc port1resolution 5550 f55d - dey 5551 f55d - bne trakball1yloop 5552 f55d - clc 5553 f55d - adc trakbally1 5554 f55d - sta trakbally1 5555 f55d -trakball1skipYadjust 5556 f55d - endif ; !TRAKXONLY 5557 f55d - 5558 f55d - jmp LLRET1 5559 f55d endif 5560 f55d 5561 f55d 5562 f55d paddleport0update 5563 f55d - ifconst PADDLE0SUPPORT 5564 f55d - lda #6 5565 f55d - sta VBLANK ; start charging the paddle caps 5566 f55d - lda #0 ; use PADDLE timing 5567 f55d - jsr SETTIM64T ; INTIM is in Y 5568 f55d - 5569 f55d -paddleport0updateloop 5570 f55d - lda INPT0 5571 f55d - bmi skippaddle0setposition 5572 f55d - sty paddleposition0 5573 f55d -skippaddle0setposition 5574 f55d - ifconst TWOPADDLESUPPORT 5575 f55d - lda INPT1 5576 f55d - bmi skippaddle1setposition 5577 f55d - sty paddleposition1 5578 f55d -skippaddle1setposition 5579 f55d - endif 5580 f55d - ldy INTIM 5581 f55d - cpy #TIMEOFFSET 5582 f55d - bcs paddleport0updateloop 5583 f55d - 5584 f55d - lda #%10000110 5585 f55d - sta VBLANK ; dump paddles to ground... this may not be great for genesis controllers 5586 f55d - sec 5587 f55d - lda paddleposition0 5588 f55d - sbc #TIMEOFFSET 5589 f55d - ifconst PADDLESCALEX2 5590 f55d - asl 5591 f55d - endif 5592 f55d - 5593 f55d - ifnconst PADDLESMOOTHINGOFF 5594 f55d - clc 5595 f55d - adc paddleprevious0 5596 f55d - ror 5597 f55d - sta paddleprevious0 5598 f55d - endif 5599 f55d - 5600 f55d - sta paddleposition0 5601 f55d - 5602 f55d - ifconst TWOPADDLESUPPORT 5603 f55d - sec 5604 f55d - lda paddleposition1 5605 f55d - sbc #TIMEOFFSET 5606 f55d - ifconst PADDLESCALEX2 5607 f55d - asl 5608 f55d - endif 5609 f55d - 5610 f55d - ifnconst PADDLESMOOTHINGOFF 5611 f55d - clc 5612 f55d - adc paddleprevious1 5613 f55d - ror 5614 f55d - sta paddleprevious1 5615 f55d - endif 5616 f55d - sta paddleposition1 5617 f55d - endif ; TWOPADDLESUPPORT 5618 f55d - 5619 f55d - jmp LLRET0 5620 f55d endif 5621 f55d 5622 f55d paddleport1update 5623 f55d - ifconst PADDLE1SUPPORT 5624 f55d - lda #6 5625 f55d - sta VBLANK ; start charging the paddle caps 5626 f55d - 5627 f55d - lda #0 ; use PADDLE timing 5628 f55d - jsr SETTIM64T ; INTIM is in Y 5629 f55d - 5630 f55d -paddleport1updateloop 5631 f55d - lda INPT2 5632 f55d - bmi skippaddle2setposition 5633 f55d - sty paddleposition2 5634 f55d -skippaddle2setposition 5635 f55d - ifconst TWOPADDLESUPPORT 5636 f55d - lda INPT3 5637 f55d - bmi skippaddle3setposition 5638 f55d - sty paddleposition3 5639 f55d -skippaddle3setposition 5640 f55d - endif 5641 f55d - ldy INTIM 5642 f55d - cpy #TIMEOFFSET 5643 f55d - bcs paddleport1updateloop 5644 f55d - 5645 f55d - lda #%10000110 5646 f55d - sta VBLANK ; dump paddles to ground... this may not be great for genesis controllers 5647 f55d - sec 5648 f55d - lda paddleposition2 5649 f55d - sbc #TIMEOFFSET 5650 f55d - ifconst PADDLESCALEX2 5651 f55d - asl 5652 f55d - endif 5653 f55d - 5654 f55d - ifnconst PADDLESMOOTHINGOFF 5655 f55d - clc 5656 f55d - adc paddleprevious2 5657 f55d - ror 5658 f55d - sta paddleprevious2 5659 f55d - endif 5660 f55d - 5661 f55d - sta paddleposition2 5662 f55d - 5663 f55d - ifconst TWOPADDLESUPPORT 5664 f55d - sec 5665 f55d - lda paddleposition3 5666 f55d - sbc #TIMEOFFSET 5667 f55d - ifconst PADDLESCALEX2 5668 f55d - asl 5669 f55d - endif 5670 f55d - 5671 f55d - ifnconst PADDLESMOOTHINGOFF 5672 f55d - clc 5673 f55d - adc paddleprevious3 5674 f55d - ror 5675 f55d - sta paddleprevious3 5676 f55d - endif 5677 f55d - sta paddleposition3 5678 f55d - endif ; TWOPADDLESUPPORT 5679 f55d - 5680 f55d - jmp LLRET1 5681 f55d endif 5682 f55d 5683 f55d 5684 f55d paddlebuttonhandler ; outside of conditional, for button-handler LUT 5685 f55d - ifconst PADDLESUPPORT 5686 f55d - ; x=0|1 for port, rather than paddle #. 5687 f55d - ; Only the first paddle button will integrate into "joy0fire" testing. If the 5688 f55d - ; game wants to support 2 paddles, up to the game to instead test the 5689 f55d - ; joystick right+left directions instead. 5690 f55d - lda SWCHA ; top of nibble is first paddle button 5691 f55d - cpx #0 ; port 0? 5692 f55d - beq skippaddleport2shift 5693 f55d - asl ; shift second port to upper nibble 5694 f55d - asl 5695 f55d - asl 5696 f55d - asl 5697 f55d -skippaddleport2shift 5698 f55d - and #%10000000 5699 f55d - eor #%10000000 ; invert 5700 f55d - sta sINPT1,x 5701 f55d - jmp buttonreadloopreturn 5702 f55d endif ; PADDLESUPPORT 5703 f55d 5704 f55d mousebuttonhandler ; outside of conditional, for button-handler LUT 5705 f55d - ifconst MOUSESUPPORT 5706 f55d - ; stick the mouse buttons in the correct shadow register... 5707 f55d - txa 5708 f55d - asl 5709 f55d - tay ; y=x*2 5710 f55d - lda INPT4,x 5711 f55d - eor #%10000000 5712 f55d - lsr 5713 f55d - sta sINPT1,x 5714 f55d - 5715 f55d - lda INPT1,y 5716 f55d - and #%10000000 5717 f55d - eor #%10000000 5718 f55d - ora sINPT1,x 5719 f55d - sta sINPT1,x 5720 f55d - jmp buttonreadloopreturn 5721 f55d endif ; MOUSESUPPORT 5722 f55d 5723 f55d - ifconst KEYPADSUPPORT 5724 f55d - ; ** select keypad rows 0 to 3 over 4 frames... 5725 f55d -keypadrowselect 5726 f55d - ldy #0 5727 f55d - lda port0control 5728 f55d - cmp #7 5729 f55d - bne skipport0val 5730 f55d - iny ; y=y+1 5731 f55d -skipport0val 5732 f55d - lda port1control 5733 f55d - cmp #7 5734 f55d - bne skipport1val 5735 f55d - iny 5736 f55d - iny ; y=y+2 5737 f55d -skipport1val 5738 f55d - lda keyrowdirectionmask,y 5739 f55d - sta CTLSWA 5740 f55d - tya 5741 f55d - asl 5742 f55d - asl 5743 f55d - sta inttemp1 5744 f55d - lda framecounter 5745 f55d - and #3 5746 f55d - ora inttemp1 5747 f55d - tax 5748 f55d - lda keyrowselectvalue,x 5749 f55d - sta SWCHA 5750 f55d - rts 5751 f55d - 5752 f55d -keyrowdirectionmask 5753 f55d - .byte #%00000000 ; 0 : port0=input port1=input 5754 f55d - .byte #%11110000 ; 1 : port0=output port1=input 5755 f55d - .byte #%00001111 ; 2 : port0=input port1=output 5756 f55d - .byte #%11111111 ; 3 : port0=output port1=output 5757 f55d - 5758 f55d -keyrowselectvalue 5759 f55d - .byte #%00000000, #%00000000, #%00000000, #%00000000 ; no row selected, all pins high, always 5760 f55d - .byte #%11100000, #%11010000, #%10110000, #%01110000 ; p0 keypad in 5761 f55d - .byte #%00001110, #%00001101, #%00001011, #%00000111 ; p1 keypad in 5762 f55d - .byte #%11101110, #%11011101, #%10111011, #%01110111 ; p0+p1 keypads in 5763 f55d endif ; KEYPADSUPPORT 5764 f55d 5765 f55d - ifconst KEYPADSUPPORT 5766 f55d - ; TODO - split into compile-time KEYPAD0SUPPORT and KEYPAD1SUPPORT 5767 f55d -keypadcolumnread 5768 f55d - lda port0control 5769 f55d - cmp #7 5770 f55d - bne skipkeypadcolumnread0 5771 f55d - lda framecounter 5772 f55d - and #3 5773 f55d - asl ; x2 because keypad variables are interleaved 5774 f55d - tax 5775 f55d - lda #0 5776 f55d - sta keypadmatrix0a,x 5777 f55d - lda INPT0 5778 f55d - cmp #$80 5779 f55d - rol keypadmatrix0a,x 5780 f55d - lda INPT1 5781 f55d - cmp #$80 5782 f55d - rol keypadmatrix0a,x 5783 f55d - lda INPT4 5784 f55d - cmp #$80 5785 f55d - rol keypadmatrix0a,x 5786 f55d - lda keypadmatrix0a,x 5787 f55d - eor #%00000111 5788 f55d - sta keypadmatrix0a,x 5789 f55d -skipkeypadcolumnread0 5790 f55d - 5791 f55d - lda port1control 5792 f55d - cmp #7 5793 f55d - bne skipkeypadcolumnread1 5794 f55d - lda framecounter 5795 f55d - and #3 5796 f55d - asl ; x2 because keypad variables are interleaved 5797 f55d - tax 5798 f55d - lda #0 5799 f55d - sta keypadmatrix1a,x 5800 f55d - rol keypadmatrix1a,x 5801 f55d - lda INPT2 5802 f55d - cmp #$80 5803 f55d - rol keypadmatrix1a,x 5804 f55d - lda INPT3 5805 f55d - cmp #$80 5806 f55d - rol keypadmatrix1a,x 5807 f55d - lda INPT5 5808 f55d - cmp #$80 5809 f55d - rol keypadmatrix1a,x 5810 f55d - lda keypadmatrix1a,x 5811 f55d - eor #%00000111 5812 f55d - sta keypadmatrix1a,x 5813 f55d -skipkeypadcolumnread1 5814 f55d - rts 5815 f55d endif ; KEYPADSUPPORT 5816 f55d 5817 f55d setportforinput 5818 f55d a5 e4 lda CTLSWAs 5819 f55f 3d 68 f5 and allpinsinputlut,x 5820 f562 85 e4 sta CTLSWAs 5821 f564 8d 81 02 sta CTLSWA 5822 f567 60 rts 5823 f568 5824 f568 allpinsinputlut 5825 f568 0f f0 .byte.b $0F, $F0 5826 f56a 5827 f56a setonebuttonmode 5828 f56a a9 06 lda #6 ; in case we're in unlocked-bios mode 5829 f56c 85 01 sta VBLANK ; if we were on paddles, the line is grounded out. 5830 f56e a9 14 lda #$14 5831 f570 8d 83 02 sta CTLSWB ; set both 2-button disable bits to writable 5832 f573 a5 e5 lda CTLSWBs 5833 f575 1d 7e f5 ora thisjoy2buttonbit,x 5834 f578 85 e5 sta CTLSWBs 5835 f57a 8d 82 02 sta SWCHB ; turn off the 2-button disable bits 5836 f57d 60 rts 5837 f57e 5838 f57e thisjoy2buttonbit 5839 f57e 04 10 .byte.b $04, $10 5840 f580 5841 f580 settwobuttonmode 5842 f580 a9 06 lda #6 ; in case we're in unlocked-bios mode 5843 f582 85 01 sta VBLANK ; if we were on paddles, the line is grounded out. 5844 f584 a9 14 lda #$14 5845 f586 8d 83 02 sta CTLSWB ; set both 2-button disable bits to writable 5846 f589 a5 e5 lda CTLSWBs 5847 f58b 3d 94 f5 and thisjoy2buttonmask,x 5848 f58e 85 e5 sta CTLSWBs 5849 f590 8d 82 02 sta SWCHB 5850 f593 60 rts 5851 f594 5852 f594 thisjoy2buttonmask 5853 f594 fb ef .byte.b $fb, $ef 5854 f596 5855 f596 ; Provided under the CC0 license. See the included LICENSE.txt for details. 5856 f596 5857 f596 START 5858 f596 start 5859 f596 5860 f596 ;******** more or less the Atari recommended startup procedure 5861 f596 5862 f596 78 sei 5863 f597 d8 cld 5864 f598 5865 f598 ifnconst NOTIALOCK 5866 f598 a9 07 lda #$07 5867 f59a - else 5868 f59a - lda #$06 5869 f59a endif 5870 f59a 85 01 sta INPTCTRL ;lock 7800 into 7800 mode 5871 f59c a9 7f lda #$7F 5872 f59e 85 3c sta CTRL ;disable DMA 5873 f5a0 a9 00 lda #$00 5874 f5a2 85 38 sta OFFSET 5875 f5a4 ifnconst NOTIALOCK 5876 f5a4 85 01 sta INPTCTRL 5877 f5a6 85 20 sta BACKGRND ; black default, in case a flash cart is using something else 5878 f5a8 endif 5879 f5a8 a2 ff ldx #$FF 5880 f5aa 9a txs 5881 f5ab 5882 f5ab ;************** Clear Memory 5883 f5ab 5884 f5ab a2 40 ldx #$40 5885 f5ad a9 00 lda #$00 5886 f5af crloop1 5887 f5af 95 00 sta $00,x ;Clear zero page 5888 f5b1 9d 00 01 sta $100,x ;Clear page 1 5889 f5b4 e8 inx 5890 f5b5 d0 f8 bne crloop1 5891 f5b7 5892 f5b7 5893 f5b7 a0 00 ldy #$00 ;Clear Ram 5894 f5b9 a9 18 lda #$18 ;Start at $1800 5895 f5bb 85 81 sta $81 5896 f5bd a9 00 lda #$00 5897 f5bf 85 80 sta $80 5898 f5c1 crloop3 5899 f5c1 a9 00 lda #$00 5900 f5c3 91 80 sta ($80),y ;Store data 5901 f5c5 c8 iny ;Next byte 5902 f5c6 d0 f9 bne crloop3 ;Branch if not done page 5903 f5c8 e6 81 inc $81 ;Next page 5904 f5ca a5 81 lda $81 5905 f5cc c9 20 cmp #$20 ;End at $1FFF 5906 f5ce d0 f1 bne crloop3 ;Branch if not 5907 f5d0 5908 f5d0 a0 00 ldy #$00 ;Clear Ram 5909 f5d2 a9 22 lda #$22 ;Start at $2200 5910 f5d4 85 81 sta $81 5911 f5d6 a9 00 lda #$00 5912 f5d8 85 80 sta $80 5913 f5da crloop4 5914 f5da a9 00 lda #$00 5915 f5dc 91 80 sta ($80),y ;Store data 5916 f5de c8 iny ;Next byte 5917 f5df d0 f9 bne crloop4 ;Branch if not done page 5918 f5e1 e6 81 inc $81 ;Next page 5919 f5e3 a5 81 lda $81 5920 f5e5 c9 27 cmp #$27 ;End at $27FF 5921 f5e7 d0 f1 bne crloop4 ;Branch if not 5922 f5e9 5923 f5e9 a2 00 ldx #$00 5924 f5eb a9 00 lda #$00 5925 f5ed crloop5 ;Clear 2100-213F, 2000-203F 5926 f5ed 9d 00 20 sta $2000,x 5927 f5f0 9d 00 21 sta $2100,x 5928 f5f3 e8 inx 5929 f5f4 e0 40 cpx #$40 5930 f5f6 d0 f5 bne crloop5 5931 f5f8 5932 f5f8 85 80 sta $80 5933 f5fa 85 81 sta $81 5934 f5fc 85 82 sta $82 5935 f5fe 85 83 sta $83 5936 f600 5937 f600 ;seed random number with hopefully-random timer value 5938 f600 a9 01 lda #1 5939 f602 0d 84 02 ora INTIM 5940 f605 85 40 sta rand 5941 f607 5942 f607 ; detect the console type... 5943 f607 pndetectvblankstart 5944 f607 a5 28 lda MSTAT 5945 f609 10 fc bpl pndetectvblankstart ; if we're not in VBLANK, wait for it to start 5946 f60b pndetectvblankover 5947 f60b a5 28 lda MSTAT 5948 f60d 30 fc bmi pndetectvblankover ; then wait for it to be over 5949 f60f a0 00 ldy #$00 5950 f611 a2 00 ldx #$00 5951 f613 pndetectvblankhappening 5952 f613 a5 28 lda MSTAT 5953 f615 30 07 bmi pndetectinvblank ; if VBLANK starts, exit our counting loop 5954 f617 85 24 sta WSYNC 5955 f619 85 24 sta WSYNC 5956 f61b e8 inx 5957 f61c d0 f5 bne pndetectvblankhappening 5958 f61e pndetectinvblank 5959 f61e e0 7d cpx #125 5960 f620 90 02 bcc pndetecispal 5961 f622 a0 01 ldy #$01 5962 f624 pndetecispal 5963 f624 8c 09 21 sty paldetected 5964 f627 5965 f627 20 c3 f4 jsr createallgamedlls 5966 f62a 5967 f62a a9 18 lda #>DLLMEM 5968 f62c 85 2c sta DPPH 5969 f62e a9 00 lda # 255 6164 f659 -DOUBLEBUFFEROFFSET = 255 6165 f659 else 6166 f659 00 48 DOUBLEBUFFEROFFSET = (DLLASTOBJ+2) 6167 f659 endif 6168 f659 6169 f659 - ifconst EXTRADLMEMORY 6170 f659 -SECONDDLHALFSTART SET $2300 6171 f659 endif 6172 f659 6173 f659 DLPOINTH 6174 f659 DLINDEX SET 0 6175 f659 REPEAT WZONECOUNT 6176 f659 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 6177 f659 - ifconst EXTRADLMEMORY 6178 f659 - if TMPMEMADDRESS > $1FFF 6179 f659 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6180 f659 - else 6181 f659 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6182 f659 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6183 f659 -SECONDDLHALFSTART SET TMPMEMADDRESS 6184 f659 - endif 6185 f659 - endif ; TMPMEMADDRESS > $1FFF 6186 f659 endif ; EXTRADLMEMORY 6187 f659 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 6188 f659 18 .byte.b >TMPMEMADDRESS 6189 f659 DLINDEX SET DLINDEX + 1 6175 f659 REPEND 6176 f659 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 6177 f65a - ifconst EXTRADLMEMORY 6178 f65a - if TMPMEMADDRESS > $1FFF 6179 f65a -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6180 f65a - else 6181 f65a - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6182 f65a -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6183 f65a -SECONDDLHALFSTART SET TMPMEMADDRESS 6184 f65a - endif 6185 f65a - endif ; TMPMEMADDRESS > $1FFF 6186 f65a endif ; EXTRADLMEMORY 6187 f65a ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 6188 f65a 18 .byte.b >TMPMEMADDRESS 6189 f65a DLINDEX SET DLINDEX + 1 6175 f65a REPEND 6176 f65a TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 6177 f65b - ifconst EXTRADLMEMORY 6178 f65b - if TMPMEMADDRESS > $1FFF 6179 f65b -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6180 f65b - else 6181 f65b - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6182 f65b -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6183 f65b -SECONDDLHALFSTART SET TMPMEMADDRESS 6184 f65b - endif 6185 f65b - endif ; TMPMEMADDRESS > $1FFF 6186 f65b endif ; EXTRADLMEMORY 6187 f65b ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 6188 f65b 19 .byte.b >TMPMEMADDRESS 6189 f65b DLINDEX SET DLINDEX + 1 6175 f65b REPEND 6176 f65b TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 6177 f65c - ifconst EXTRADLMEMORY 6178 f65c - if TMPMEMADDRESS > $1FFF 6179 f65c -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6180 f65c - else 6181 f65c - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6182 f65c -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6183 f65c -SECONDDLHALFSTART SET TMPMEMADDRESS 6184 f65c - endif 6185 f65c - endif ; TMPMEMADDRESS > $1FFF 6186 f65c endif ; EXTRADLMEMORY 6187 f65c ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 6188 f65c 19 .byte.b >TMPMEMADDRESS 6189 f65c DLINDEX SET DLINDEX + 1 6175 f65c REPEND 6176 f65c TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 6177 f65d - ifconst EXTRADLMEMORY 6178 f65d - if TMPMEMADDRESS > $1FFF 6179 f65d -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6180 f65d - else 6181 f65d - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6182 f65d -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6183 f65d -SECONDDLHALFSTART SET TMPMEMADDRESS 6184 f65d - endif 6185 f65d - endif ; TMPMEMADDRESS > $1FFF 6186 f65d endif ; EXTRADLMEMORY 6187 f65d ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 6188 f65d 19 .byte.b >TMPMEMADDRESS 6189 f65d DLINDEX SET DLINDEX + 1 6175 f65d REPEND 6176 f65d TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 6177 f65e - ifconst EXTRADLMEMORY 6178 f65e - if TMPMEMADDRESS > $1FFF 6179 f65e -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6180 f65e - else 6181 f65e - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6182 f65e -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6183 f65e -SECONDDLHALFSTART SET TMPMEMADDRESS 6184 f65e - endif 6185 f65e - endif ; TMPMEMADDRESS > $1FFF 6186 f65e endif ; EXTRADLMEMORY 6187 f65e ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 6188 f65e 19 .byte.b >TMPMEMADDRESS 6189 f65e DLINDEX SET DLINDEX + 1 6175 f65e REPEND 6176 f65e TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 6177 f65f - ifconst EXTRADLMEMORY 6178 f65f - if TMPMEMADDRESS > $1FFF 6179 f65f -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6180 f65f - else 6181 f65f - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6182 f65f -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6183 f65f -SECONDDLHALFSTART SET TMPMEMADDRESS 6184 f65f - endif 6185 f65f - endif ; TMPMEMADDRESS > $1FFF 6186 f65f endif ; EXTRADLMEMORY 6187 f65f ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 6188 f65f 1a .byte.b >TMPMEMADDRESS 6189 f65f DLINDEX SET DLINDEX + 1 6175 f65f REPEND 6176 f65f TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 6177 f660 - ifconst EXTRADLMEMORY 6178 f660 - if TMPMEMADDRESS > $1FFF 6179 f660 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6180 f660 - else 6181 f660 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6182 f660 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6183 f660 -SECONDDLHALFSTART SET TMPMEMADDRESS 6184 f660 - endif 6185 f660 - endif ; TMPMEMADDRESS > $1FFF 6186 f660 endif ; EXTRADLMEMORY 6187 f660 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 6188 f660 1a .byte.b >TMPMEMADDRESS 6189 f660 DLINDEX SET DLINDEX + 1 6175 f660 REPEND 6176 f660 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 6177 f661 - ifconst EXTRADLMEMORY 6178 f661 - if TMPMEMADDRESS > $1FFF 6179 f661 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6180 f661 - else 6181 f661 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6182 f661 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6183 f661 -SECONDDLHALFSTART SET TMPMEMADDRESS 6184 f661 - endif 6185 f661 - endif ; TMPMEMADDRESS > $1FFF 6186 f661 endif ; EXTRADLMEMORY 6187 f661 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 6188 f661 1a .byte.b >TMPMEMADDRESS 6189 f661 DLINDEX SET DLINDEX + 1 6175 f661 REPEND 6176 f661 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 6177 f662 - ifconst EXTRADLMEMORY 6178 f662 - if TMPMEMADDRESS > $1FFF 6179 f662 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6180 f662 - else 6181 f662 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6182 f662 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6183 f662 -SECONDDLHALFSTART SET TMPMEMADDRESS 6184 f662 - endif 6185 f662 - endif ; TMPMEMADDRESS > $1FFF 6186 f662 endif ; EXTRADLMEMORY 6187 f662 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 6188 f662 1b .byte.b >TMPMEMADDRESS 6189 f662 DLINDEX SET DLINDEX + 1 6175 f662 REPEND 6176 f662 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 6177 f663 - ifconst EXTRADLMEMORY 6178 f663 - if TMPMEMADDRESS > $1FFF 6179 f663 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6180 f663 - else 6181 f663 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6182 f663 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6183 f663 -SECONDDLHALFSTART SET TMPMEMADDRESS 6184 f663 - endif 6185 f663 - endif ; TMPMEMADDRESS > $1FFF 6186 f663 endif ; EXTRADLMEMORY 6187 f663 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 6188 f663 1b .byte.b >TMPMEMADDRESS 6189 f663 DLINDEX SET DLINDEX + 1 6175 f663 REPEND 6176 f663 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 6177 f664 - ifconst EXTRADLMEMORY 6178 f664 - if TMPMEMADDRESS > $1FFF 6179 f664 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6180 f664 - else 6181 f664 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6182 f664 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6183 f664 -SECONDDLHALFSTART SET TMPMEMADDRESS 6184 f664 - endif 6185 f664 - endif ; TMPMEMADDRESS > $1FFF 6186 f664 endif ; EXTRADLMEMORY 6187 f664 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 6188 f664 1b .byte.b >TMPMEMADDRESS 6189 f664 DLINDEX SET DLINDEX + 1 6175 f664 REPEND 6176 f664 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 6177 f665 - ifconst EXTRADLMEMORY 6178 f665 - if TMPMEMADDRESS > $1FFF 6179 f665 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6180 f665 - else 6181 f665 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6182 f665 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6183 f665 -SECONDDLHALFSTART SET TMPMEMADDRESS 6184 f665 - endif 6185 f665 - endif ; TMPMEMADDRESS > $1FFF 6186 f665 endif ; EXTRADLMEMORY 6187 f665 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 6188 f665 1b .byte.b >TMPMEMADDRESS 6189 f665 DLINDEX SET DLINDEX + 1 6175 f665 REPEND 6176 f665 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 6177 f666 - ifconst EXTRADLMEMORY 6178 f666 - if TMPMEMADDRESS > $1FFF 6179 f666 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6180 f666 - else 6181 f666 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6182 f666 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6183 f666 -SECONDDLHALFSTART SET TMPMEMADDRESS 6184 f666 - endif 6185 f666 - endif ; TMPMEMADDRESS > $1FFF 6186 f666 endif ; EXTRADLMEMORY 6187 f666 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 6188 f666 1c .byte.b >TMPMEMADDRESS 6189 f666 DLINDEX SET DLINDEX + 1 6175 f666 REPEND 6176 f666 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 6177 f667 - ifconst EXTRADLMEMORY 6178 f667 - if TMPMEMADDRESS > $1FFF 6179 f667 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6180 f667 - else 6181 f667 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6182 f667 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6183 f667 -SECONDDLHALFSTART SET TMPMEMADDRESS 6184 f667 - endif 6185 f667 - endif ; TMPMEMADDRESS > $1FFF 6186 f667 endif ; EXTRADLMEMORY 6187 f667 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 6188 f667 1c .byte.b >TMPMEMADDRESS 6189 f667 DLINDEX SET DLINDEX + 1 6175 f667 REPEND 6176 f667 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 6177 f668 - ifconst EXTRADLMEMORY 6178 f668 - if TMPMEMADDRESS > $1FFF 6179 f668 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6180 f668 - else 6181 f668 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6182 f668 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6183 f668 -SECONDDLHALFSTART SET TMPMEMADDRESS 6184 f668 - endif 6185 f668 - endif ; TMPMEMADDRESS > $1FFF 6186 f668 endif ; EXTRADLMEMORY 6187 f668 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 6188 f668 1c .byte.b >TMPMEMADDRESS 6189 f668 DLINDEX SET DLINDEX + 1 6175 f668 REPEND 6176 f668 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 6177 f669 - ifconst EXTRADLMEMORY 6178 f669 - if TMPMEMADDRESS > $1FFF 6179 f669 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6180 f669 - else 6181 f669 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6182 f669 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6183 f669 -SECONDDLHALFSTART SET TMPMEMADDRESS 6184 f669 - endif 6185 f669 - endif ; TMPMEMADDRESS > $1FFF 6186 f669 endif ; EXTRADLMEMORY 6187 f669 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 6188 f669 1d .byte.b >TMPMEMADDRESS 6189 f669 DLINDEX SET DLINDEX + 1 6175 f669 REPEND 6176 f669 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 6177 f66a - ifconst EXTRADLMEMORY 6178 f66a - if TMPMEMADDRESS > $1FFF 6179 f66a -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6180 f66a - else 6181 f66a - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6182 f66a -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6183 f66a -SECONDDLHALFSTART SET TMPMEMADDRESS 6184 f66a - endif 6185 f66a - endif ; TMPMEMADDRESS > $1FFF 6186 f66a endif ; EXTRADLMEMORY 6187 f66a ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 6188 f66a 1d .byte.b >TMPMEMADDRESS 6189 f66a DLINDEX SET DLINDEX + 1 6175 f66a REPEND 6176 f66a TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 6177 f66b - ifconst EXTRADLMEMORY 6178 f66b - if TMPMEMADDRESS > $1FFF 6179 f66b -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6180 f66b - else 6181 f66b - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6182 f66b -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6183 f66b -SECONDDLHALFSTART SET TMPMEMADDRESS 6184 f66b - endif 6185 f66b - endif ; TMPMEMADDRESS > $1FFF 6186 f66b endif ; EXTRADLMEMORY 6187 f66b ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 6188 f66b 1d .byte.b >TMPMEMADDRESS 6189 f66b DLINDEX SET DLINDEX + 1 6175 f66b REPEND 6176 f66b TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 6177 f66c - ifconst EXTRADLMEMORY 6178 f66c - if TMPMEMADDRESS > $1FFF 6179 f66c -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6180 f66c - else 6181 f66c - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6182 f66c -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6183 f66c -SECONDDLHALFSTART SET TMPMEMADDRESS 6184 f66c - endif 6185 f66c - endif ; TMPMEMADDRESS > $1FFF 6186 f66c endif ; EXTRADLMEMORY 6187 f66c ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 6188 f66c 1d .byte.b >TMPMEMADDRESS 6189 f66c DLINDEX SET DLINDEX + 1 6175 f66c REPEND 6176 f66c TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 6177 f66d - ifconst EXTRADLMEMORY 6178 f66d - if TMPMEMADDRESS > $1FFF 6179 f66d -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6180 f66d - else 6181 f66d - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6182 f66d -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6183 f66d -SECONDDLHALFSTART SET TMPMEMADDRESS 6184 f66d - endif 6185 f66d - endif ; TMPMEMADDRESS > $1FFF 6186 f66d endif ; EXTRADLMEMORY 6187 f66d ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 6188 f66d 1e .byte.b >TMPMEMADDRESS 6189 f66d DLINDEX SET DLINDEX + 1 6175 f66d REPEND 6176 f66d TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 6177 f66e - ifconst EXTRADLMEMORY 6178 f66e - if TMPMEMADDRESS > $1FFF 6179 f66e -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6180 f66e - else 6181 f66e - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6182 f66e -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6183 f66e -SECONDDLHALFSTART SET TMPMEMADDRESS 6184 f66e - endif 6185 f66e - endif ; TMPMEMADDRESS > $1FFF 6186 f66e endif ; EXTRADLMEMORY 6187 f66e ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 6188 f66e 1e .byte.b >TMPMEMADDRESS 6189 f66e DLINDEX SET DLINDEX + 1 6175 f66e REPEND 6176 f66e TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 6177 f66f - ifconst EXTRADLMEMORY 6178 f66f - if TMPMEMADDRESS > $1FFF 6179 f66f -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6180 f66f - else 6181 f66f - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6182 f66f -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6183 f66f -SECONDDLHALFSTART SET TMPMEMADDRESS 6184 f66f - endif 6185 f66f - endif ; TMPMEMADDRESS > $1FFF 6186 f66f endif ; EXTRADLMEMORY 6187 f66f ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 6188 f66f 1e .byte.b >TMPMEMADDRESS 6189 f66f DLINDEX SET DLINDEX + 1 6175 f66f REPEND 6176 f66f TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 6177 f670 - ifconst EXTRADLMEMORY 6178 f670 - if TMPMEMADDRESS > $1FFF 6179 f670 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6180 f670 - else 6181 f670 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6182 f670 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6183 f670 -SECONDDLHALFSTART SET TMPMEMADDRESS 6184 f670 - endif 6185 f670 - endif ; TMPMEMADDRESS > $1FFF 6186 f670 endif ; EXTRADLMEMORY 6187 f670 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 6188 f670 1f .byte.b >TMPMEMADDRESS 6189 f670 DLINDEX SET DLINDEX + 1 6175 f670 REPEND 6176 f670 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 6177 f671 - ifconst EXTRADLMEMORY 6178 f671 - if TMPMEMADDRESS > $1FFF 6179 f671 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6180 f671 - else 6181 f671 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6182 f671 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6183 f671 -SECONDDLHALFSTART SET TMPMEMADDRESS 6184 f671 - endif 6185 f671 - endif ; TMPMEMADDRESS > $1FFF 6186 f671 endif ; EXTRADLMEMORY 6187 f671 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 6188 f671 1f .byte.b >TMPMEMADDRESS 6189 f671 DLINDEX SET DLINDEX + 1 6175 f671 REPEND 6176 f671 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 6177 f672 - ifconst EXTRADLMEMORY 6178 f672 - if TMPMEMADDRESS > $1FFF 6179 f672 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6180 f672 - else 6181 f672 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6182 f672 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6183 f672 -SECONDDLHALFSTART SET TMPMEMADDRESS 6184 f672 - endif 6185 f672 - endif ; TMPMEMADDRESS > $1FFF 6186 f672 endif ; EXTRADLMEMORY 6187 f672 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 6188 f672 1f .byte.b >TMPMEMADDRESS 6189 f672 DLINDEX SET DLINDEX + 1 6190 f673 REPEND 6191 f673 6192 f673 - ifconst EXTRADLMEMORY 6193 f673 - echo " ",[SECONDDLHALFSTART],"to",[$27FF],"was claimed as extra DL memory." 6194 f673 endif 6195 f673 6196 f673 6197 f673 DLPOINTL 6198 f673 DLINDEX SET 0 6199 f673 REPEAT WZONECOUNT 6200 f673 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 6201 f673 - ifconst EXTRADLMEMORY 6202 f673 - if TMPMEMADDRESS > $1FFF 6203 f673 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6204 f673 - else 6205 f673 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6206 f673 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6207 f673 - endif 6208 f673 - endif ; TMPMEMADDRESS > $1FFF 6209 f673 endif ; EXTRADLMEMORY 6210 f673 80 .byte.b $1FFF 6203 f674 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6204 f674 - else 6205 f674 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6206 f674 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6207 f674 - endif 6208 f674 - endif ; TMPMEMADDRESS > $1FFF 6209 f674 endif ; EXTRADLMEMORY 6210 f674 c9 .byte.b $1FFF 6203 f675 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6204 f675 - else 6205 f675 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6206 f675 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6207 f675 - endif 6208 f675 - endif ; TMPMEMADDRESS > $1FFF 6209 f675 endif ; EXTRADLMEMORY 6210 f675 13 .byte.b $1FFF 6203 f676 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6204 f676 - else 6205 f676 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6206 f676 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6207 f676 - endif 6208 f676 - endif ; TMPMEMADDRESS > $1FFF 6209 f676 endif ; EXTRADLMEMORY 6210 f676 5d .byte.b $1FFF 6203 f677 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6204 f677 - else 6205 f677 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6206 f677 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6207 f677 - endif 6208 f677 - endif ; TMPMEMADDRESS > $1FFF 6209 f677 endif ; EXTRADLMEMORY 6210 f677 a7 .byte.b $1FFF 6203 f678 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6204 f678 - else 6205 f678 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6206 f678 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6207 f678 - endif 6208 f678 - endif ; TMPMEMADDRESS > $1FFF 6209 f678 endif ; EXTRADLMEMORY 6210 f678 f1 .byte.b $1FFF 6203 f679 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6204 f679 - else 6205 f679 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6206 f679 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6207 f679 - endif 6208 f679 - endif ; TMPMEMADDRESS > $1FFF 6209 f679 endif ; EXTRADLMEMORY 6210 f679 3b .byte.b $1FFF 6203 f67a -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6204 f67a - else 6205 f67a - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6206 f67a -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6207 f67a - endif 6208 f67a - endif ; TMPMEMADDRESS > $1FFF 6209 f67a endif ; EXTRADLMEMORY 6210 f67a 84 .byte.b $1FFF 6203 f67b -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6204 f67b - else 6205 f67b - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6206 f67b -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6207 f67b - endif 6208 f67b - endif ; TMPMEMADDRESS > $1FFF 6209 f67b endif ; EXTRADLMEMORY 6210 f67b ce .byte.b $1FFF 6203 f67c -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6204 f67c - else 6205 f67c - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6206 f67c -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6207 f67c - endif 6208 f67c - endif ; TMPMEMADDRESS > $1FFF 6209 f67c endif ; EXTRADLMEMORY 6210 f67c 18 .byte.b $1FFF 6203 f67d -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6204 f67d - else 6205 f67d - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6206 f67d -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6207 f67d - endif 6208 f67d - endif ; TMPMEMADDRESS > $1FFF 6209 f67d endif ; EXTRADLMEMORY 6210 f67d 62 .byte.b $1FFF 6203 f67e -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6204 f67e - else 6205 f67e - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6206 f67e -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6207 f67e - endif 6208 f67e - endif ; TMPMEMADDRESS > $1FFF 6209 f67e endif ; EXTRADLMEMORY 6210 f67e ac .byte.b $1FFF 6203 f67f -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6204 f67f - else 6205 f67f - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6206 f67f -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6207 f67f - endif 6208 f67f - endif ; TMPMEMADDRESS > $1FFF 6209 f67f endif ; EXTRADLMEMORY 6210 f67f f6 .byte.b $1FFF 6203 f680 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6204 f680 - else 6205 f680 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6206 f680 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6207 f680 - endif 6208 f680 - endif ; TMPMEMADDRESS > $1FFF 6209 f680 endif ; EXTRADLMEMORY 6210 f680 40 .byte.b $1FFF 6203 f681 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6204 f681 - else 6205 f681 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6206 f681 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6207 f681 - endif 6208 f681 - endif ; TMPMEMADDRESS > $1FFF 6209 f681 endif ; EXTRADLMEMORY 6210 f681 89 .byte.b $1FFF 6203 f682 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6204 f682 - else 6205 f682 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6206 f682 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6207 f682 - endif 6208 f682 - endif ; TMPMEMADDRESS > $1FFF 6209 f682 endif ; EXTRADLMEMORY 6210 f682 d3 .byte.b $1FFF 6203 f683 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6204 f683 - else 6205 f683 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6206 f683 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6207 f683 - endif 6208 f683 - endif ; TMPMEMADDRESS > $1FFF 6209 f683 endif ; EXTRADLMEMORY 6210 f683 1d .byte.b $1FFF 6203 f684 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6204 f684 - else 6205 f684 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6206 f684 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6207 f684 - endif 6208 f684 - endif ; TMPMEMADDRESS > $1FFF 6209 f684 endif ; EXTRADLMEMORY 6210 f684 67 .byte.b $1FFF 6203 f685 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6204 f685 - else 6205 f685 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6206 f685 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6207 f685 - endif 6208 f685 - endif ; TMPMEMADDRESS > $1FFF 6209 f685 endif ; EXTRADLMEMORY 6210 f685 b1 .byte.b $1FFF 6203 f686 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6204 f686 - else 6205 f686 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6206 f686 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6207 f686 - endif 6208 f686 - endif ; TMPMEMADDRESS > $1FFF 6209 f686 endif ; EXTRADLMEMORY 6210 f686 fb .byte.b $1FFF 6203 f687 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6204 f687 - else 6205 f687 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6206 f687 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6207 f687 - endif 6208 f687 - endif ; TMPMEMADDRESS > $1FFF 6209 f687 endif ; EXTRADLMEMORY 6210 f687 44 .byte.b $1FFF 6203 f688 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6204 f688 - else 6205 f688 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6206 f688 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6207 f688 - endif 6208 f688 - endif ; TMPMEMADDRESS > $1FFF 6209 f688 endif ; EXTRADLMEMORY 6210 f688 8e .byte.b $1FFF 6203 f689 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6204 f689 - else 6205 f689 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6206 f689 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6207 f689 - endif 6208 f689 - endif ; TMPMEMADDRESS > $1FFF 6209 f689 endif ; EXTRADLMEMORY 6210 f689 d8 .byte.b $1FFF 6203 f68a -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6204 f68a - else 6205 f68a - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6206 f68a -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6207 f68a - endif 6208 f68a - endif ; TMPMEMADDRESS > $1FFF 6209 f68a endif ; EXTRADLMEMORY 6210 f68a 22 .byte.b $1FFF 6203 f68b -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6204 f68b - else 6205 f68b - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6206 f68b -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6207 f68b - endif 6208 f68b - endif ; TMPMEMADDRESS > $1FFF 6209 f68b endif ; EXTRADLMEMORY 6210 f68b 6c .byte.b $1FFF 6203 f68c -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6204 f68c - else 6205 f68c - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6206 f68c -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6207 f68c - endif 6208 f68c - endif ; TMPMEMADDRESS > $1FFF 6209 f68c endif ; EXTRADLMEMORY 6210 f68c b6 .byte.b $1FFF 6220 f68d -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6221 f68d - else 6222 f68d - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6223 f68d -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6224 f68d - endif 6225 f68d - endif ; TMPMEMADDRESS > $1FFF 6226 f68d endif ; EXTRADLMEMORY 6227 f68d 6228 f68d 18 80 ZONE0ADDRESS = TMPMEMADDRESS 6229 f68d 6230 f68d DLINDEX SET DLINDEX + 1 6216 f68d REPEND 6217 f68d TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 6218 f68d - ifconst EXTRADLMEMORY 6219 f68d - if TMPMEMADDRESS > $1FFF 6220 f68d -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6221 f68d - else 6222 f68d - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6223 f68d -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6224 f68d - endif 6225 f68d - endif ; TMPMEMADDRESS > $1FFF 6226 f68d endif ; EXTRADLMEMORY 6227 f68d 6228 f68d 18 c9 ZONE1ADDRESS = TMPMEMADDRESS 6229 f68d 6230 f68d DLINDEX SET DLINDEX + 1 6216 f68d REPEND 6217 f68d TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 6218 f68d - ifconst EXTRADLMEMORY 6219 f68d - if TMPMEMADDRESS > $1FFF 6220 f68d -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6221 f68d - else 6222 f68d - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6223 f68d -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6224 f68d - endif 6225 f68d - endif ; TMPMEMADDRESS > $1FFF 6226 f68d endif ; EXTRADLMEMORY 6227 f68d 6228 f68d 19 13 ZONE2ADDRESS = TMPMEMADDRESS 6229 f68d 6230 f68d DLINDEX SET DLINDEX + 1 6216 f68d REPEND 6217 f68d TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 6218 f68d - ifconst EXTRADLMEMORY 6219 f68d - if TMPMEMADDRESS > $1FFF 6220 f68d -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6221 f68d - else 6222 f68d - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6223 f68d -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6224 f68d - endif 6225 f68d - endif ; TMPMEMADDRESS > $1FFF 6226 f68d endif ; EXTRADLMEMORY 6227 f68d 6228 f68d 19 5d ZONE3ADDRESS = TMPMEMADDRESS 6229 f68d 6230 f68d DLINDEX SET DLINDEX + 1 6216 f68d REPEND 6217 f68d TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 6218 f68d - ifconst EXTRADLMEMORY 6219 f68d - if TMPMEMADDRESS > $1FFF 6220 f68d -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6221 f68d - else 6222 f68d - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6223 f68d -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6224 f68d - endif 6225 f68d - endif ; TMPMEMADDRESS > $1FFF 6226 f68d endif ; EXTRADLMEMORY 6227 f68d 6228 f68d 19 a7 ZONE4ADDRESS = TMPMEMADDRESS 6229 f68d 6230 f68d DLINDEX SET DLINDEX + 1 6216 f68d REPEND 6217 f68d TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 6218 f68d - ifconst EXTRADLMEMORY 6219 f68d - if TMPMEMADDRESS > $1FFF 6220 f68d -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6221 f68d - else 6222 f68d - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6223 f68d -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6224 f68d - endif 6225 f68d - endif ; TMPMEMADDRESS > $1FFF 6226 f68d endif ; EXTRADLMEMORY 6227 f68d 6228 f68d 19 f1 ZONE5ADDRESS = TMPMEMADDRESS 6229 f68d 6230 f68d DLINDEX SET DLINDEX + 1 6216 f68d REPEND 6217 f68d TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 6218 f68d - ifconst EXTRADLMEMORY 6219 f68d - if TMPMEMADDRESS > $1FFF 6220 f68d -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6221 f68d - else 6222 f68d - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6223 f68d -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6224 f68d - endif 6225 f68d - endif ; TMPMEMADDRESS > $1FFF 6226 f68d endif ; EXTRADLMEMORY 6227 f68d 6228 f68d 1a 3b ZONE6ADDRESS = TMPMEMADDRESS 6229 f68d 6230 f68d DLINDEX SET DLINDEX + 1 6216 f68d REPEND 6217 f68d TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 6218 f68d - ifconst EXTRADLMEMORY 6219 f68d - if TMPMEMADDRESS > $1FFF 6220 f68d -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6221 f68d - else 6222 f68d - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6223 f68d -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6224 f68d - endif 6225 f68d - endif ; TMPMEMADDRESS > $1FFF 6226 f68d endif ; EXTRADLMEMORY 6227 f68d 6228 f68d 1a 84 ZONE7ADDRESS = TMPMEMADDRESS 6229 f68d 6230 f68d DLINDEX SET DLINDEX + 1 6216 f68d REPEND 6217 f68d TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 6218 f68d - ifconst EXTRADLMEMORY 6219 f68d - if TMPMEMADDRESS > $1FFF 6220 f68d -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6221 f68d - else 6222 f68d - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6223 f68d -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6224 f68d - endif 6225 f68d - endif ; TMPMEMADDRESS > $1FFF 6226 f68d endif ; EXTRADLMEMORY 6227 f68d 6228 f68d 1a ce ZONE8ADDRESS = TMPMEMADDRESS 6229 f68d 6230 f68d DLINDEX SET DLINDEX + 1 6216 f68d REPEND 6217 f68d TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 6218 f68d - ifconst EXTRADLMEMORY 6219 f68d - if TMPMEMADDRESS > $1FFF 6220 f68d -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6221 f68d - else 6222 f68d - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6223 f68d -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6224 f68d - endif 6225 f68d - endif ; TMPMEMADDRESS > $1FFF 6226 f68d endif ; EXTRADLMEMORY 6227 f68d 6228 f68d 1b 18 ZONE9ADDRESS = TMPMEMADDRESS 6229 f68d 6230 f68d DLINDEX SET DLINDEX + 1 6216 f68d REPEND 6217 f68d TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 6218 f68d - ifconst EXTRADLMEMORY 6219 f68d - if TMPMEMADDRESS > $1FFF 6220 f68d -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6221 f68d - else 6222 f68d - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6223 f68d -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6224 f68d - endif 6225 f68d - endif ; TMPMEMADDRESS > $1FFF 6226 f68d endif ; EXTRADLMEMORY 6227 f68d 6228 f68d 1b 62 ZONE10ADDRESS = TMPMEMADDRESS 6229 f68d 6230 f68d DLINDEX SET DLINDEX + 1 6216 f68d REPEND 6217 f68d TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 6218 f68d - ifconst EXTRADLMEMORY 6219 f68d - if TMPMEMADDRESS > $1FFF 6220 f68d -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6221 f68d - else 6222 f68d - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6223 f68d -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6224 f68d - endif 6225 f68d - endif ; TMPMEMADDRESS > $1FFF 6226 f68d endif ; EXTRADLMEMORY 6227 f68d 6228 f68d 1b ac ZONE11ADDRESS = TMPMEMADDRESS 6229 f68d 6230 f68d DLINDEX SET DLINDEX + 1 6216 f68d REPEND 6217 f68d TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 6218 f68d - ifconst EXTRADLMEMORY 6219 f68d - if TMPMEMADDRESS > $1FFF 6220 f68d -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6221 f68d - else 6222 f68d - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6223 f68d -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6224 f68d - endif 6225 f68d - endif ; TMPMEMADDRESS > $1FFF 6226 f68d endif ; EXTRADLMEMORY 6227 f68d 6228 f68d 1b f6 ZONE12ADDRESS = TMPMEMADDRESS 6229 f68d 6230 f68d DLINDEX SET DLINDEX + 1 6216 f68d REPEND 6217 f68d TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 6218 f68d - ifconst EXTRADLMEMORY 6219 f68d - if TMPMEMADDRESS > $1FFF 6220 f68d -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6221 f68d - else 6222 f68d - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6223 f68d -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6224 f68d - endif 6225 f68d - endif ; TMPMEMADDRESS > $1FFF 6226 f68d endif ; EXTRADLMEMORY 6227 f68d 6228 f68d 1c 40 ZONE13ADDRESS = TMPMEMADDRESS 6229 f68d 6230 f68d DLINDEX SET DLINDEX + 1 6216 f68d REPEND 6217 f68d TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 6218 f68d - ifconst EXTRADLMEMORY 6219 f68d - if TMPMEMADDRESS > $1FFF 6220 f68d -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6221 f68d - else 6222 f68d - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6223 f68d -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6224 f68d - endif 6225 f68d - endif ; TMPMEMADDRESS > $1FFF 6226 f68d endif ; EXTRADLMEMORY 6227 f68d 6228 f68d 1c 89 ZONE14ADDRESS = TMPMEMADDRESS 6229 f68d 6230 f68d DLINDEX SET DLINDEX + 1 6216 f68d REPEND 6217 f68d TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 6218 f68d - ifconst EXTRADLMEMORY 6219 f68d - if TMPMEMADDRESS > $1FFF 6220 f68d -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6221 f68d - else 6222 f68d - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6223 f68d -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6224 f68d - endif 6225 f68d - endif ; TMPMEMADDRESS > $1FFF 6226 f68d endif ; EXTRADLMEMORY 6227 f68d 6228 f68d 1c d3 ZONE15ADDRESS = TMPMEMADDRESS 6229 f68d 6230 f68d DLINDEX SET DLINDEX + 1 6216 f68d REPEND 6217 f68d TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 6218 f68d - ifconst EXTRADLMEMORY 6219 f68d - if TMPMEMADDRESS > $1FFF 6220 f68d -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6221 f68d - else 6222 f68d - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6223 f68d -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6224 f68d - endif 6225 f68d - endif ; TMPMEMADDRESS > $1FFF 6226 f68d endif ; EXTRADLMEMORY 6227 f68d 6228 f68d 1d 1d ZONE16ADDRESS = TMPMEMADDRESS 6229 f68d 6230 f68d DLINDEX SET DLINDEX + 1 6216 f68d REPEND 6217 f68d TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 6218 f68d - ifconst EXTRADLMEMORY 6219 f68d - if TMPMEMADDRESS > $1FFF 6220 f68d -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6221 f68d - else 6222 f68d - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6223 f68d -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6224 f68d - endif 6225 f68d - endif ; TMPMEMADDRESS > $1FFF 6226 f68d endif ; EXTRADLMEMORY 6227 f68d 6228 f68d 1d 67 ZONE17ADDRESS = TMPMEMADDRESS 6229 f68d 6230 f68d DLINDEX SET DLINDEX + 1 6216 f68d REPEND 6217 f68d TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 6218 f68d - ifconst EXTRADLMEMORY 6219 f68d - if TMPMEMADDRESS > $1FFF 6220 f68d -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6221 f68d - else 6222 f68d - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6223 f68d -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6224 f68d - endif 6225 f68d - endif ; TMPMEMADDRESS > $1FFF 6226 f68d endif ; EXTRADLMEMORY 6227 f68d 6228 f68d 1d b1 ZONE18ADDRESS = TMPMEMADDRESS 6229 f68d 6230 f68d DLINDEX SET DLINDEX + 1 6216 f68d REPEND 6217 f68d TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 6218 f68d - ifconst EXTRADLMEMORY 6219 f68d - if TMPMEMADDRESS > $1FFF 6220 f68d -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6221 f68d - else 6222 f68d - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6223 f68d -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6224 f68d - endif 6225 f68d - endif ; TMPMEMADDRESS > $1FFF 6226 f68d endif ; EXTRADLMEMORY 6227 f68d 6228 f68d 1d fb ZONE19ADDRESS = TMPMEMADDRESS 6229 f68d 6230 f68d DLINDEX SET DLINDEX + 1 6216 f68d REPEND 6217 f68d TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 6218 f68d - ifconst EXTRADLMEMORY 6219 f68d - if TMPMEMADDRESS > $1FFF 6220 f68d -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6221 f68d - else 6222 f68d - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6223 f68d -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6224 f68d - endif 6225 f68d - endif ; TMPMEMADDRESS > $1FFF 6226 f68d endif ; EXTRADLMEMORY 6227 f68d 6228 f68d 1e 44 ZONE20ADDRESS = TMPMEMADDRESS 6229 f68d 6230 f68d DLINDEX SET DLINDEX + 1 6216 f68d REPEND 6217 f68d TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 6218 f68d - ifconst EXTRADLMEMORY 6219 f68d - if TMPMEMADDRESS > $1FFF 6220 f68d -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6221 f68d - else 6222 f68d - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6223 f68d -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6224 f68d - endif 6225 f68d - endif ; TMPMEMADDRESS > $1FFF 6226 f68d endif ; EXTRADLMEMORY 6227 f68d 6228 f68d 1e 8e ZONE21ADDRESS = TMPMEMADDRESS 6229 f68d 6230 f68d DLINDEX SET DLINDEX + 1 6216 f68d REPEND 6217 f68d TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 6218 f68d - ifconst EXTRADLMEMORY 6219 f68d - if TMPMEMADDRESS > $1FFF 6220 f68d -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6221 f68d - else 6222 f68d - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6223 f68d -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6224 f68d - endif 6225 f68d - endif ; TMPMEMADDRESS > $1FFF 6226 f68d endif ; EXTRADLMEMORY 6227 f68d 6228 f68d 1e d8 ZONE22ADDRESS = TMPMEMADDRESS 6229 f68d 6230 f68d DLINDEX SET DLINDEX + 1 6216 f68d REPEND 6217 f68d TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 6218 f68d - ifconst EXTRADLMEMORY 6219 f68d - if TMPMEMADDRESS > $1FFF 6220 f68d -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6221 f68d - else 6222 f68d - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6223 f68d -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6224 f68d - endif 6225 f68d - endif ; TMPMEMADDRESS > $1FFF 6226 f68d endif ; EXTRADLMEMORY 6227 f68d 6228 f68d 1f 22 ZONE23ADDRESS = TMPMEMADDRESS 6229 f68d 6230 f68d DLINDEX SET DLINDEX + 1 6216 f68d REPEND 6217 f68d TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 6218 f68d - ifconst EXTRADLMEMORY 6219 f68d - if TMPMEMADDRESS > $1FFF 6220 f68d -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6221 f68d - else 6222 f68d - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6223 f68d -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6224 f68d - endif 6225 f68d - endif ; TMPMEMADDRESS > $1FFF 6226 f68d endif ; EXTRADLMEMORY 6227 f68d 6228 f68d 1f 6c ZONE24ADDRESS = TMPMEMADDRESS 6229 f68d 6230 f68d DLINDEX SET DLINDEX + 1 6216 f68d REPEND 6217 f68d TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 6218 f68d - ifconst EXTRADLMEMORY 6219 f68d - if TMPMEMADDRESS > $1FFF 6220 f68d -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6221 f68d - else 6222 f68d - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 6223 f68d -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 6224 f68d - endif 6225 f68d - endif ; TMPMEMADDRESS > $1FFF 6226 f68d endif ; EXTRADLMEMORY 6227 f68d 6228 f68d 1f b6 ZONE25ADDRESS = TMPMEMADDRESS 6229 f68d 6230 f68d DLINDEX SET DLINDEX + 1 6231 f68d REPEND 6232 f68d 6233 f68d $1880 to $1fff used as zone memory, allowing 14 display objects per zone. 6234 f68d echo " ",[WDLMEMSTART],"to",[WDLMEMEND],"used as zone memory, allowing",[(DLLASTOBJ/5)]d,"display objects per zone." 6235 f68d 6236 f68d DLHEIGHT 6237 f68d REPEAT WZONECOUNT 6238 f68d 07 .byte.b (WZONEHEIGHT-1) 6237 f68d REPEND 6238 f68e 07 .byte.b (WZONEHEIGHT-1) 6237 f68e REPEND 6238 f68f 07 .byte.b (WZONEHEIGHT-1) 6237 f68f REPEND 6238 f690 07 .byte.b (WZONEHEIGHT-1) 6237 f690 REPEND 6238 f691 07 .byte.b (WZONEHEIGHT-1) 6237 f691 REPEND 6238 f692 07 .byte.b (WZONEHEIGHT-1) 6237 f692 REPEND 6238 f693 07 .byte.b (WZONEHEIGHT-1) 6237 f693 REPEND 6238 f694 07 .byte.b (WZONEHEIGHT-1) 6237 f694 REPEND 6238 f695 07 .byte.b (WZONEHEIGHT-1) 6237 f695 REPEND 6238 f696 07 .byte.b (WZONEHEIGHT-1) 6237 f696 REPEND 6238 f697 07 .byte.b (WZONEHEIGHT-1) 6237 f697 REPEND 6238 f698 07 .byte.b (WZONEHEIGHT-1) 6237 f698 REPEND 6238 f699 07 .byte.b (WZONEHEIGHT-1) 6237 f699 REPEND 6238 f69a 07 .byte.b (WZONEHEIGHT-1) 6237 f69a REPEND 6238 f69b 07 .byte.b (WZONEHEIGHT-1) 6237 f69b REPEND 6238 f69c 07 .byte.b (WZONEHEIGHT-1) 6237 f69c REPEND 6238 f69d 07 .byte.b (WZONEHEIGHT-1) 6237 f69d REPEND 6238 f69e 07 .byte.b (WZONEHEIGHT-1) 6237 f69e REPEND 6238 f69f 07 .byte.b (WZONEHEIGHT-1) 6237 f69f REPEND 6238 f6a0 07 .byte.b (WZONEHEIGHT-1) 6237 f6a0 REPEND 6238 f6a1 07 .byte.b (WZONEHEIGHT-1) 6237 f6a1 REPEND 6238 f6a2 07 .byte.b (WZONEHEIGHT-1) 6237 f6a2 REPEND 6238 f6a3 07 .byte.b (WZONEHEIGHT-1) 6237 f6a3 REPEND 6238 f6a4 07 .byte.b (WZONEHEIGHT-1) 6237 f6a4 REPEND 6238 f6a5 07 .byte.b (WZONEHEIGHT-1) 6237 f6a5 REPEND 6238 f6a6 07 .byte.b (WZONEHEIGHT-1) 6239 f6a7 REPEND 6240 f6a7 6241 f6a7 ; Provided under the CC0 license. See the included LICENSE.txt for details. 6242 f6a7 6243 f6a7 ; a simple guard, than ensures the 7800basic code hasn't 6244 f6a7 ; spilled into the encryption area... 2263 bytes left in the 7800basic reserved area. 6245 f6a7 echo " ",($FF7E-*)d,"bytes left in the 7800basic reserved area." 6246 f6a7 - if (*>$FF7D) 6247 f6a7 - ERR ; abort the assembly 6248 f6a7 endif 6249 f6a7 ; Provided under the CC0 license. See the included LICENSE.txt for details. 6250 f6a7 6251 f6a7 - ifconst DEV 6252 f6a7 - ifnconst ZONEHEIGHT 6253 f6a7 - echo "* the 4k 7800basic area has",[($FF7E - *)]d,"bytes free." 6254 f6a7 - else 6255 f6a7 - if ZONEHEIGHT = 8 6256 f6a7 - echo "* the 4k 7800basic area has",[($FF7E - *)]d,"bytes free." 6257 f6a7 - else 6258 f6a7 - echo "* the 4k 7800basic area has",[($FF7E - *)]d,"bytes free." 6259 f6a7 - endif 6260 f6a7 - endif 6261 f6a7 endif 6262 f6a7 6263 f6a7 ; FF7E/FF7F contains the 7800basic crc checksum word 6264 f6a7 6265 f6a7 ; FF80 - FFF7 contains the 7800 encryption key 6266 f6a7 6267 f6a7 ifnconst bankswitchmode 6268 fff8 ORG $FFF8 6269 fff8 - else 6270 fff8 - ifconst ROM128K 6271 fff8 - ORG $27FF8 6272 fff8 - RORG $FFF8 6273 fff8 - endif 6274 fff8 - ifconst ROM144K 6275 fff8 - ORG $27FF8 6276 fff8 - RORG $FFF8 6277 fff8 - endif 6278 fff8 - ifconst ROM256K 6279 fff8 - ORG $47FF8 6280 fff8 - RORG $FFF8 6281 fff8 - endif 6282 fff8 - ifconst ROM272K 6283 fff8 - ORG $47FF8 6284 fff8 - RORG $FFF8 6285 fff8 - endif 6286 fff8 - ifconst ROM512K 6287 fff8 - ORG $87FF8 6288 fff8 - RORG $FFF8 6289 fff8 - endif 6290 fff8 - ifconst ROM528K 6291 fff8 - ORG $87FF8 6292 fff8 - RORG $FFF8 6293 fff8 - endif 6294 fff8 endif 6295 fff8 6296 fff8 6297 fff8 ff .byte.b $FF ; region verification. $FF=all regions 6298 fff9 f7 .byte.b $F7 ; high nibble: encryption check from $N000 to $FF7F. we only hash the last 4k for faster boot. 6299 fffa ; low nibble : N=7 atari rainbow start, N=3 no atari rainbow 6300 fffa 6301 fffa ;Vectors 6302 fffa 00 f0 .word.w NMI 6303 fffc 96 f5 .word.w START 6304 fffe 5f f0 .word.w IRQ 6305 10000