------- 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 30 sfx_plainlaser_length = .skipL0168-sfx_plainlaser 22 10000 ???? 23 10000 ???? 00 01 BOXCOLLISION = 1 24 10000 ???? 00 1c demoObstacle_tallsprite_00_color3 = $1c 25 10000 ???? 00 33 demoObstacle_tallsprite_00_color2 = $33 26 10000 ???? 00 27 demoObstacle_tallsprite_00_color1 = $27 27 10000 ???? 00 00 demoObstacle_tallsprite_00_color0 = $00 28 10000 ???? 00 1c demoObstacle_color3 = $1c 29 10000 ???? 00 33 demoObstacle_color2 = $33 30 10000 ???? 00 27 demoObstacle_color1 = $27 31 10000 ???? 00 00 demoObstacle_color0 = $00 32 10000 ???? 00 00 playershot_color3 = 0 33 10000 ???? 00 bb playershot_color2 = $bb 34 10000 ???? 00 0d playershot_color1 = $0d 35 10000 ???? 00 00 playershot_color0 = $00 36 10000 ???? 00 0d demoascii_redoiii_color1 = $0d 37 10000 ???? 00 00 demoascii_redoiii_color0 = $00 38 10000 ???? 00 bb playership_color3 = $bb 39 10000 ???? 00 04 playership_color2 = $04 40 10000 ???? 00 0d playership_color1 = $0d 41 10000 ???? 00 00 playership_color0 = $00 42 10000 ???? 01 5f lives = var31 43 10000 ???? 44 10000 ???? 01 5e player_Flag = var30 45 10000 ???? 46 10000 ???? 01 5d obstacle_flag = var29 47 10000 ???? 48 10000 ???? 01 5c obstacle_ypos = var28 49 10000 ???? 50 10000 ???? 01 5b obstacle_xpos = var27 51 10000 ???? 52 10000 ???? 01 5a isDead_flag = var26 53 10000 ???? 54 10000 ???? 01 59 gameover_flag = var25 55 10000 ???? 56 10000 ???? 01 58 customTemp4 = var24 57 10000 ???? 58 10000 ???? 01 57 customTemp3 = var23 59 10000 ???? 60 10000 ???? 01 56 customTemp2 = var22 61 10000 ???? 62 10000 ???? 01 55 customTemp1 = var21 63 10000 ???? 64 10000 ???? 01 54 enemy01_speed = var20 65 10000 ???? 66 10000 ???? 01 53 enemy01_ypos = var19 67 10000 ???? 68 10000 ???? 01 52 enemy01_xpos = var18 69 10000 ???? 70 10000 ???? 01 51 RDirection = var17 71 10000 ???? 72 10000 ???? 01 50 RMovement6 = var16 73 10000 ???? 74 10000 ???? 01 4f RMovement5 = var15 75 10000 ???? 76 10000 ???? 01 4e RMovement4 = var14 77 10000 ???? 78 10000 ???? 01 4d RMovement3 = var13 79 10000 ???? 80 10000 ???? 01 4c RMovement2 = var12 81 10000 ???? 82 10000 ???? 01 4b RMovement1 = var11 83 10000 ???? 84 10000 ???? 01 4a bullet_ypos = var10 85 10000 ???? 86 10000 ???? 01 49 bullet_xpos = var9 87 10000 ???? 88 10000 ???? 01 48 joyposright = var8 89 10000 ???? 90 10000 ???? 01 47 joyposleft = var7 91 10000 ???? 92 10000 ???? 01 46 joyposdown = var6 93 10000 ???? 94 10000 ???? 01 45 joyposup = var5 95 10000 ???? 96 10000 ???? 01 44 fire_debounce = var4 97 10000 ???? 98 10000 ???? 01 43 player_ypos = var3 99 10000 ???? 100 10000 ???? 01 42 player_xpos = var2 101 10000 ???? 102 10000 ???? 01 41 frameCounter = var1 103 10000 ???? 104 10000 ???? 00 01 collisionwrap = 1 105 10000 ???? 00 01 NTSC = 1 106 10000 ???? 00 d0 SCREENHEIGHT = 208 107 10000 ???? 00 01 CHECKOVERWRITE = 1 108 10000 ???? 00 08 ZONEHEIGHT = 8 109 10000 ???? 00 01 ROM16K = 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 30 sfx_plainlaser_length = .skipL0168-sfx_plainlaser 22 10000 ???? 23 10000 ???? 00 01 BOXCOLLISION = 1 24 10000 ???? 00 1c demoObstacle_tallsprite_00_color3 = $1c 25 10000 ???? 00 33 demoObstacle_tallsprite_00_color2 = $33 26 10000 ???? 00 27 demoObstacle_tallsprite_00_color1 = $27 27 10000 ???? 00 00 demoObstacle_tallsprite_00_color0 = $00 28 10000 ???? 00 1c demoObstacle_color3 = $1c 29 10000 ???? 00 33 demoObstacle_color2 = $33 30 10000 ???? 00 27 demoObstacle_color1 = $27 31 10000 ???? 00 00 demoObstacle_color0 = $00 32 10000 ???? 00 00 playershot_color3 = 0 33 10000 ???? 00 bb playershot_color2 = $bb 34 10000 ???? 00 0d playershot_color1 = $0d 35 10000 ???? 00 00 playershot_color0 = $00 36 10000 ???? 00 0d demoascii_redoiii_color1 = $0d 37 10000 ???? 00 00 demoascii_redoiii_color0 = $00 38 10000 ???? 00 bb playership_color3 = $bb 39 10000 ???? 00 04 playership_color2 = $04 40 10000 ???? 00 0d playership_color1 = $0d 41 10000 ???? 00 00 playership_color0 = $00 42 10000 ???? 01 5f lives = var31 43 10000 ???? 44 10000 ???? 01 5e player_Flag = var30 45 10000 ???? 46 10000 ???? 01 5d obstacle_flag = var29 47 10000 ???? 48 10000 ???? 01 5c obstacle_ypos = var28 49 10000 ???? 50 10000 ???? 01 5b obstacle_xpos = var27 51 10000 ???? 52 10000 ???? 01 5a isDead_flag = var26 53 10000 ???? 54 10000 ???? 01 59 gameover_flag = var25 55 10000 ???? 56 10000 ???? 01 58 customTemp4 = var24 57 10000 ???? 58 10000 ???? 01 57 customTemp3 = var23 59 10000 ???? 60 10000 ???? 01 56 customTemp2 = var22 61 10000 ???? 62 10000 ???? 01 55 customTemp1 = var21 63 10000 ???? 64 10000 ???? 01 54 enemy01_speed = var20 65 10000 ???? 66 10000 ???? 01 53 enemy01_ypos = var19 67 10000 ???? 68 10000 ???? 01 52 enemy01_xpos = var18 69 10000 ???? 70 10000 ???? 01 51 RDirection = var17 71 10000 ???? 72 10000 ???? 01 50 RMovement6 = var16 73 10000 ???? 74 10000 ???? 01 4f RMovement5 = var15 75 10000 ???? 76 10000 ???? 01 4e RMovement4 = var14 77 10000 ???? 78 10000 ???? 01 4d RMovement3 = var13 79 10000 ???? 80 10000 ???? 01 4c RMovement2 = var12 81 10000 ???? 82 10000 ???? 01 4b RMovement1 = var11 83 10000 ???? 84 10000 ???? 01 4a bullet_ypos = var10 85 10000 ???? 86 10000 ???? 01 49 bullet_xpos = var9 87 10000 ???? 88 10000 ???? 01 48 joyposright = var8 89 10000 ???? 90 10000 ???? 01 47 joyposleft = var7 91 10000 ???? 92 10000 ???? 01 46 joyposdown = var6 93 10000 ???? 94 10000 ???? 01 45 joyposup = var5 95 10000 ???? 96 10000 ???? 01 44 fire_debounce = var4 97 10000 ???? 98 10000 ???? 01 43 player_ypos = var3 99 10000 ???? 100 10000 ???? 01 42 player_xpos = var2 101 10000 ???? 102 10000 ???? 01 41 frameCounter = var1 103 10000 ???? 104 10000 ???? 00 01 collisionwrap = 1 105 10000 ???? 00 01 NTSC = 1 106 10000 ???? 00 d0 SCREENHEIGHT = 208 107 10000 ???? 00 01 CHECKOVERWRITE = 1 108 10000 ???? 00 08 ZONEHEIGHT = 8 109 10000 ???? 00 01 ROM16K = 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 ???? -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 10000 ???? - ORG $4000,0 602 10000 ???? - ifconst BEADHEADER 603 10000 ???? - .byte $BE,$AD,BEADHARDWARE 604 10000 ???? - ifconst GAMEDESCRIPTIONSET 605 10000 ???? - CLC 606 10000 ???? - BCC _SKIPDESCRIPTION 607 10000 ???? - .byte GAMEDESCRIPTION,0 608 10000 ???? -_SKIPDESCRIPTION 609 10000 ???? - endif 610 10000 ???? - jmp ($FFFC) 611 10000 ???? - endif 612 10000 ???? else 613 10000 ???? - ifconst bankswitchmode 614 10000 ???? - ifconst ROMAT4K 615 10000 ???? - ORG $4000,0 616 10000 ???? - RORG $4000 617 10000 ???? - else 618 10000 ???? - ORG $8000,0 619 10000 ???? - RORG $8000 620 10000 ???? - endif 621 10000 ???? else ; not bankswitchmode 622 10000 ???? ifconst ROM16K 623 c000 ORG $C000,0 624 c000 - ifconst BEADHEADER 625 c000 - .byte $BE,$AD,BEADHARDWARE 626 c000 - ifconst GAMEDESCRIPTION 627 c000 - CLC 628 c000 - BCC _SKIPDESCRIPTION 629 c000 - .byte GAMEDESCRIPTION,0 630 c000 -_SKIPDESCRIPTION 631 c000 - endif 632 c000 - jmp ($FFFC) 633 c000 endif 634 c000 - else 635 c000 - ifconst ROM8K 636 c000 - ORG $E000,0 637 c000 - else 638 c000 - ORG $8000,0 639 c000 - ifconst BEADHEADER 640 c000 - .byte $BE,$AD,BEADHARDWARE 641 c000 - ifconst GAMEDESCRIPTION 642 c000 - CLC 643 c000 - BCC _SKIPDESCRIPTION 644 c000 - .byte GAMEDESCRIPTION,0 645 c000 -_SKIPDESCRIPTION 646 c000 - endif 647 c000 - jmp ($FFFC) 648 c000 - endif 649 c000 - endif 650 c000 endif 651 c000 endif 652 c000 endif 653 c000 654 c000 ;7800basic v0.18 Mar 14 2021 14:27:24 655 c000 SPACEOVERFLOW SET 0 656 c000 game 657 c000 .L00 ;; set romsize 16k 658 c000 659 c000 .L01 ;; set zoneheight 8 660 c000 661 c000 .L02 ;; set zoneprotection on 662 c000 663 c000 .L03 ;; set tallsprite on 664 c000 665 c000 .L04 ;; set screenheight 208 666 c000 667 c000 .L05 ;; set basepath gfx 668 c000 669 c000 .L06 ;; set tv ntsc 670 c000 671 c000 .L07 ;; set collisionwrap on 672 c000 673 c000 .L08 ;; displaymode 160B 674 c000 675 c000 a9 40 lda #%01000000 ;Enable DMA, mode=160x2/160x4 676 c002 85 3c sta CTRL 677 c004 678 c004 8d 07 21 sta sCTRL 679 c007 680 c007 . 681 c007 ;; 682 c007 683 c007 .L09 ;; dim frameCounter = var1 684 c007 685 c007 .L010 ;; dim player_xpos = var2 686 c007 687 c007 .L011 ;; dim player_ypos = var3 688 c007 689 c007 .L012 ;; dim fire_debounce = var4 690 c007 691 c007 .L013 ;; dim joyposup = var5 692 c007 693 c007 .L014 ;; dim joyposdown = var6 694 c007 695 c007 .L015 ;; dim joyposleft = var7 696 c007 697 c007 .L016 ;; dim joyposright = var8 698 c007 699 c007 .L017 ;; dim bullet_xpos = var9 700 c007 701 c007 .L018 ;; dim bullet_ypos = var10 702 c007 703 c007 .L019 ;; dim RMovement1 = var11 704 c007 705 c007 .L020 ;; dim RMovement2 = var12 706 c007 707 c007 .L021 ;; dim RMovement3 = var13 708 c007 709 c007 .L022 ;; dim RMovement4 = var14 710 c007 711 c007 .L023 ;; dim RMovement5 = var15 712 c007 713 c007 .L024 ;; dim RMovement6 = var16 714 c007 715 c007 .L025 ;; dim RDirection = var17 716 c007 717 c007 .L026 ;; dim enemy01_xpos = var18 718 c007 719 c007 .L027 ;; dim enemy01_ypos = var19 720 c007 721 c007 .L028 ;; dim enemy01_speed = var20 722 c007 723 c007 .L029 ;; dim customTemp1 = var21 724 c007 725 c007 .L030 ;; dim customTemp2 = var22 726 c007 727 c007 .L031 ;; dim customTemp3 = var23 728 c007 729 c007 .L032 ;; dim customTemp4 = var24 730 c007 731 c007 .L033 ;; dim gameover_flag = var25 732 c007 733 c007 .L034 ;; dim isDead_flag = var26 734 c007 735 c007 .L035 ;; dim obstacle_xpos = var27 736 c007 737 c007 .L036 ;; dim obstacle_ypos = var28 738 c007 739 c007 .L037 ;; dim obstacle_flag = var29 740 c007 741 c007 .L038 ;; dim player_Flag = var30 742 c007 743 c007 .L039 ;; dim lives = var31 744 c007 745 c007 . 746 c007 ;; 747 c007 748 c007 .palettes 749 c007 ;; palettes 750 c007 751 c007 .L040 ;; BACKGRND = $00 752 c007 753 c007 a9 00 LDA #$00 754 c009 85 20 STA BACKGRND 755 c00b .L041 ;; P0C1 = $05 : P0C2 = $0D : P0C3 = $AB 756 c00b 757 c00b a9 05 LDA #$05 758 c00d 85 21 STA P0C1 759 c00f a9 0d LDA #$0D 760 c011 85 22 STA P0C2 761 c013 a9 ab LDA #$AB 762 c015 85 23 STA P0C3 763 c017 .L042 ;; P1C1 = $12 : P1C2 = $1D : P1C3 = $F6 764 c017 765 c017 a9 12 LDA #$12 766 c019 85 25 STA P1C1 767 c01b a9 1d LDA #$1D 768 c01d 85 26 STA P1C2 769 c01f a9 f6 LDA #$F6 770 c021 85 27 STA P1C3 771 c023 .L043 ;; P2C1 = $70 : P2C2 = $72 : P2C3 = $85 772 c023 773 c023 a9 70 LDA #$70 774 c025 85 29 STA P2C1 775 c027 a9 72 LDA #$72 776 c029 85 2a STA P2C2 777 c02b a9 85 LDA #$85 778 c02d 85 2b STA P2C3 779 c02f .L044 ;; P3C1 = $81 : P3C2 = $9A : P3C3 = $87 780 c02f 781 c02f a9 81 LDA #$81 782 c031 85 2d STA P3C1 783 c033 a9 9a LDA #$9A 784 c035 85 2e STA P3C2 785 c037 a9 87 LDA #$87 786 c039 85 2f STA P3C3 787 c03b .L045 ;; P4C1 = $ : P4C2 = $ : P4C3 = $ 788 c03b 789 c03b a9 00 LDA #$ 790 c03d 85 31 STA P4C1 791 c03f 85 32 STA P4C2 792 c041 85 33 STA P4C3 793 c043 .L046 ;; P5C1 = $ : P5C2 = $ : P5C3 = $ 794 c043 795 c043 a9 00 LDA #$ 796 c045 85 35 STA P5C1 797 c047 85 36 STA P5C2 798 c049 85 37 STA P5C3 799 c04b .L047 ;; P6C1 = $ : P6C2 = $ : P6C3 = $ 800 c04b 801 c04b a9 00 LDA #$ 802 c04d 85 39 STA P6C1 803 c04f 85 3a STA P6C2 804 c051 85 3b STA P6C3 805 c053 .L048 ;; P7C1 = $ : P7C2 = $ : P7C3 = $ 806 c053 807 c053 a9 00 LDA #$ 808 c055 85 3d STA P7C1 809 c057 85 3e STA P7C2 810 c059 85 3f STA P7C3 811 c05b .L049 ;; characterset demoascii_redoiii 812 c05b 813 c05b a9 e0 lda #>demoascii_redoiii 814 c05d 8d 0b 21 sta sCHARBASE 815 c060 816 c060 85 34 sta CHARBASE 817 c062 a9 60 lda #(demoascii_redoiii_mode | %01100000) 818 c064 8d 06 21 sta charactermode 819 c067 820 c067 .L050 ;; alphachars ' !"#$%&`()*+,-0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_.abcdefghijklmnopqrstuvwxyz' 821 c067 822 c067 . 823 c067 ;; 824 c067 825 c067 .import 826 c067 ;; import 827 c067 828 c067 .L051 ;; incgraphic playership.png 160A 829 c067 830 c067 .L052 ;; incgraphic demoascii_redoiii.png 160A 831 c067 832 c067 .L053 ;; incgraphic playershot.png 160A 833 c067 834 c067 .L054 ;; incgraphic demoObstacle.png 160A 835 c067 836 c067 . 837 c067 ;; 838 c067 839 c067 .init 840 c067 ;; init 841 c067 842 c067 .L055 ;; frameCounter = 0 843 c067 844 c067 a9 00 LDA #0 845 c069 8d 41 01 STA frameCounter 846 c06c .L056 ;; player_xpos = 20 : player_ypos = 104 847 c06c 848 c06c a9 14 LDA #20 849 c06e 8d 42 01 STA player_xpos 850 c071 a9 68 LDA #104 851 c073 8d 43 01 STA player_ypos 852 c076 .L057 ;; fire_debounce = 0 853 c076 854 c076 a9 00 LDA #0 855 c078 8d 44 01 STA fire_debounce 856 c07b .L058 ;; joyposup = 0 : joyposdown = 0 : joyposleft = 0 : joyposright = 0 857 c07b 858 c07b a9 00 LDA #0 859 c07d 8d 45 01 STA joyposup 860 c080 8d 46 01 STA joyposdown 861 c083 8d 47 01 STA joyposleft 862 c086 8d 48 01 STA joyposright 863 c089 .L059 ;; bullet_xpos = 0 : bullet_ypos = 0 864 c089 865 c089 a9 00 LDA #0 866 c08b 8d 49 01 STA bullet_xpos 867 c08e 8d 4a 01 STA bullet_ypos 868 c091 .L060 ;; RMovement1 = 1 : RMovement2 = 1 : RMovement3 = 1 : RMovement4 = 1 : RMovement5 = 1 : RMovement6 = 1 : RDirection = 1 869 c091 870 c091 a9 01 LDA #1 871 c093 8d 4b 01 STA RMovement1 872 c096 8d 4c 01 STA RMovement2 873 c099 8d 4d 01 STA RMovement3 874 c09c 8d 4e 01 STA RMovement4 875 c09f 8d 4f 01 STA RMovement5 876 c0a2 8d 50 01 STA RMovement6 877 c0a5 8d 51 01 STA RDirection 878 c0a8 .L061 ;; enemy01_xpos = 0 : enemy01_ypos = 0 : enemy01_speed = 0 879 c0a8 880 c0a8 a9 00 LDA #0 881 c0aa 8d 52 01 STA enemy01_xpos 882 c0ad 8d 53 01 STA enemy01_ypos 883 c0b0 8d 54 01 STA enemy01_speed 884 c0b3 .L062 ;; customTemp1 = 0 : customTemp2 = 0 : customTemp3 = 0 : customTemp4 = 0 885 c0b3 886 c0b3 a9 00 LDA #0 887 c0b5 8d 55 01 STA customTemp1 888 c0b8 8d 56 01 STA customTemp2 889 c0bb 8d 57 01 STA customTemp3 890 c0be 8d 58 01 STA customTemp4 891 c0c1 .L063 ;; obstacle_flag = 0 : obstacle_xpos = 104 : obstacle_ypos = 20 892 c0c1 893 c0c1 a9 00 LDA #0 894 c0c3 8d 5d 01 STA obstacle_flag 895 c0c6 a9 68 LDA #104 896 c0c8 8d 5b 01 STA obstacle_xpos 897 c0cb a9 14 LDA #20 898 c0cd 8d 5c 01 STA obstacle_ypos 899 c0d0 .L064 ;; lives = 4 900 c0d0 901 c0d0 a9 04 LDA #4 902 c0d2 8d 5f 01 STA lives 903 c0d5 . 904 c0d5 ;; 905 c0d5 906 c0d5 .plot 907 c0d5 ;; plot 908 c0d5 909 c0d5 .L065 ;; clearscreen 910 c0d5 911 c0d5 20 7f f0 jsr clearscreen 912 c0d8 .L066 ;; plotchars 'Horizontal^Shooting^Demo' 0 16 2 913 c0d8 914 c0d8 4c f3 c0 JMP skipalphadata0 915 c0db alphadata0 916 c0db 28 .byte.b (alphadata0 945 c0f9 85 43 sta temp2 946 c0fb 947 c0fb a9 08 lda #8 ; width in two's complement 948 c0fd 09 00 ora #0 ; palette left shifted 5 bits 949 c0ff 85 44 sta temp3 950 c101 a9 10 lda #16 951 c103 85 45 sta temp4 952 c105 953 c105 a9 02 lda #2 954 c107 955 c107 85 46 sta temp5 956 c109 957 c109 20 4c f3 jsr plotcharacters 958 c10c .L067 ;; plotchars 'by^Shane^Skekel.' 0 16 4 959 c10c 960 c10c 4c 1f c1 JMP skipalphadata1 961 c10f alphadata1 962 c10f 42 .byte.b (alphadata1 983 c125 85 43 sta temp2 984 c127 985 c127 a9 10 lda #16 ; width in two's complement 986 c129 09 00 ora #0 ; palette left shifted 5 bits 987 c12b 85 44 sta temp3 988 c12d a9 10 lda #16 989 c12f 85 45 sta temp4 990 c131 991 c131 a9 04 lda #4 992 c133 993 c133 85 46 sta temp5 994 c135 995 c135 20 4c f3 jsr plotcharacters 996 c138 .L068 ;; plotchars 'Push^Fire^Button' 0 16 10 997 c138 998 c138 4c 4b c1 JMP skipalphadata2 999 c13b alphadata2 1000 c13b 30 .byte.b (alphadata2 1021 c151 85 43 sta temp2 1022 c153 1023 c153 a9 10 lda #16 ; width in two's complement 1024 c155 09 00 ora #0 ; palette left shifted 5 bits 1025 c157 85 44 sta temp3 1026 c159 a9 10 lda #16 1027 c15b 85 45 sta temp4 1028 c15d 1029 c15d a9 0a lda #10 1030 c15f 1031 c15f 85 46 sta temp5 1032 c161 1033 c161 20 4c f3 jsr plotcharacters 1034 c164 .L069 ;; savescreen 1035 c164 1036 c164 20 a3 f0 jsr savescreen 1037 c167 .L070 ;; drawscreen 1038 c167 1039 c167 20 b3 f0 jsr drawscreen 1040 c16a . 1041 c16a ;; 1042 c16a 1043 c16a .titlescreen_loop 1044 c16a ;; titlescreen_loop 1045 c16a 1046 c16a .L071 ;; restorescreen 1047 c16a 1048 c16a 20 91 f0 jsr restorescreen 1049 c16d .L072 ;; if joy0fire then clearscreen : savescreen : goto main 1050 c16d 1051 c16d 2c 02 21 bit sINPT1 1052 c170 10 09 BPL .skipL072 1053 c172 .condpart0 1054 c172 20 7f f0 jsr clearscreen 1055 c175 20 a3 f0 jsr savescreen 1056 c178 4c 89 c1 jmp .main 1057 c17b 1058 c17b .skipL072 1059 c17b .L073 ;; if switchreset then reboot 1060 c17b 1061 c17b 20 30 f4 jsr checkresetswitch 1062 c17e d0 03 BNE .skipL073 1063 c180 .condpart1 1064 c180 4c 1d f5 JMP START 1065 c183 .skipL073 1066 c183 .L074 ;; drawscreen 1067 c183 1068 c183 20 b3 f0 jsr drawscreen 1069 c186 .L075 ;; goto titlescreen_loop 1070 c186 1071 c186 4c 6a c1 jmp .titlescreen_loop 1072 c189 1073 c189 . 1074 c189 ;; 1075 c189 1076 c189 . 1077 c189 ;; 1078 c189 1079 c189 .main 1080 c189 ;; main 1081 c189 1082 c189 .L076 ;; frameCounter = frameCounter + 1 1083 c189 1084 c189 ad 41 01 LDA frameCounter 1085 c18c 18 CLC 1086 c18d 69 01 ADC #1 1087 c18f 8d 41 01 STA frameCounter 1088 c192 .L077 ;; if frameCounter > 10 then frameCounter = 0 1089 c192 1090 c192 a9 0a LDA #10 1091 c194 cd 41 01 CMP frameCounter 1092 c197 b0 05 BCS .skipL077 1093 c199 .condpart2 1094 c199 a9 00 LDA #0 1095 c19b 8d 41 01 STA frameCounter 1096 c19e .skipL077 1097 c19e .mainloop 1098 c19e ;; mainloop 1099 c19e 1100 c19e .L078 ;; BACKGRND = $00 1101 c19e 1102 c19e a9 00 LDA #$00 1103 c1a0 85 20 STA BACKGRND 1104 c1a2 .L079 ;; restorescreen 1105 c1a2 1106 c1a2 20 91 f0 jsr restorescreen 1107 c1a5 .L080 ;; if switchreset then reboot 1108 c1a5 1109 c1a5 20 30 f4 jsr checkresetswitch 1110 c1a8 d0 03 BNE .skipL080 1111 c1aa .condpart3 1112 c1aa 4c 1d f5 JMP START 1113 c1ad .skipL080 1114 c1ad .L081 ;; plotsprite playership 0 player_xpos player_ypos 1115 c1ad 1116 c1ad a9 00 lda #playership 1120 c1b3 85 43 sta temp2 1121 c1b5 1122 c1b5 a9 1e lda #(0|playership_width_twoscompliment) 1123 c1b7 85 44 sta temp3 1124 c1b9 1125 c1b9 ad 42 01 lda player_xpos 1126 c1bc 85 45 sta temp4 1127 c1be 1128 c1be ad 43 01 lda player_ypos 1129 c1c1 1130 c1c1 85 46 sta temp5 1131 c1c3 1132 c1c3 a9 40 lda #(playership_mode|%01000000) 1133 c1c5 85 47 sta temp6 1134 c1c7 1135 c1c7 20 93 f2 jsr plotsprite 1136 c1ca . 1137 c1ca ;; 1138 c1ca 1139 c1ca .L082 ;; plotsprite demoObstacle 1 obstacle_xpos obstacle_ypos 1140 c1ca 1141 c1ca a9 5d lda #demoObstacle 1145 c1d0 85 43 sta temp2 1146 c1d2 1147 c1d2 a9 3e lda #(32|demoObstacle_width_twoscompliment) 1148 c1d4 85 44 sta temp3 1149 c1d6 1150 c1d6 ad 5b 01 lda obstacle_xpos 1151 c1d9 85 45 sta temp4 1152 c1db 1153 c1db ad 5c 01 lda obstacle_ypos 1154 c1de 1155 c1de 85 46 sta temp5 1156 c1e0 1157 c1e0 a9 40 lda #(demoObstacle_mode|%01000000) 1158 c1e2 85 47 sta temp6 1159 c1e4 1160 c1e4 20 93 f2 jsr plotsprite 1161 c1e7 ; +tall sprite replot 1162 c1e7 18 clc 1163 c1e8 a5 42 lda temp1 1164 c1ea 69 02 adc #demoObstacle_width 1165 c1ec 85 42 sta temp1 1166 c1ee a5 46 lda temp5 1167 c1f0 69 08 adc #WZONEHEIGHT 1168 c1f2 85 46 sta temp5 1169 c1f4 20 93 f2 jsr plotsprite 1170 c1f7 . 1171 c1f7 ;; 1172 c1f7 1173 c1f7 .L083 ;; drawscreen 1174 c1f7 1175 c1f7 20 b3 f0 jsr drawscreen 1176 c1fa . 1177 c1fa ;; 1178 c1fa 1179 c1fa .L084 ;; if joy0up && joyposup = - 2 then gosub Set_Bullet_home 1180 c1fa 1181 c1fa a9 10 lda #$10 1182 c1fc 2c 80 02 bit SWCHA 1183 c1ff d0 10 BNE .skipL084 1184 c201 .condpart4 1185 c201 ; complex condition detected 1186 c201 a9 fe LDA #254 1187 c203 48 PHA 1188 c204 ba TSX 1189 c205 68 PLA 1190 c206 ad 45 01 LDA joyposup 1191 c209 dd 01 01 CMP $101,x 1192 c20c d0 03 BNE .skip4then 1193 c20e .condpart5 1194 c20e 20 de c3 jsr .Set_Bullet_home 1195 c211 1196 c211 .skip4then 1197 c211 .skipL084 1198 c211 .L085 ;; if joy0down && joyposdown = - 2 then gosub Set_Bullet_home 1199 c211 1200 c211 a9 20 lda #$20 1201 c213 2c 80 02 bit SWCHA 1202 c216 d0 10 BNE .skipL085 1203 c218 .condpart6 1204 c218 ; complex condition detected 1205 c218 a9 fe LDA #254 1206 c21a 48 PHA 1207 c21b ba TSX 1208 c21c 68 PLA 1209 c21d ad 46 01 LDA joyposdown 1210 c220 dd 01 01 CMP $101,x 1211 c223 d0 03 BNE .skip6then 1212 c225 .condpart7 1213 c225 20 de c3 jsr .Set_Bullet_home 1214 c228 1215 c228 .skip6then 1216 c228 .skipL085 1217 c228 .L086 ;; if joy0up && joyposleft = - 2 then gosub Set_Bullet_home 1218 c228 1219 c228 a9 10 lda #$10 1220 c22a 2c 80 02 bit SWCHA 1221 c22d d0 10 BNE .skipL086 1222 c22f .condpart8 1223 c22f ; complex condition detected 1224 c22f a9 fe LDA #254 1225 c231 48 PHA 1226 c232 ba TSX 1227 c233 68 PLA 1228 c234 ad 47 01 LDA joyposleft 1229 c237 dd 01 01 CMP $101,x 1230 c23a d0 03 BNE .skip8then 1231 c23c .condpart9 1232 c23c 20 de c3 jsr .Set_Bullet_home 1233 c23f 1234 c23f .skip8then 1235 c23f .skipL086 1236 c23f .L087 ;; if joy0down && joyposright = - 2 then gosub Set_Bullet_home 1237 c23f 1238 c23f a9 20 lda #$20 1239 c241 2c 80 02 bit SWCHA 1240 c244 d0 10 BNE .skipL087 1241 c246 .condpart10 1242 c246 ; complex condition detected 1243 c246 a9 fe LDA #254 1244 c248 48 PHA 1245 c249 ba TSX 1246 c24a 68 PLA 1247 c24b ad 48 01 LDA joyposright 1248 c24e dd 01 01 CMP $101,x 1249 c251 d0 03 BNE .skip10then 1250 c253 .condpart11 1251 c253 20 de c3 jsr .Set_Bullet_home 1252 c256 1253 c256 .skip10then 1254 c256 .skipL087 1255 c256 .L088 ;; if joy0up then player_ypos = player_ypos - 1 : joyposup = 1 : joyposdown = 0 : joyposleft = 0 : joyposright = 0 1256 c256 1257 c256 a9 10 lda #$10 1258 c258 2c 80 02 bit SWCHA 1259 c25b d0 19 BNE .skipL088 1260 c25d .condpart12 1261 c25d ad 43 01 LDA player_ypos 1262 c260 38 SEC 1263 c261 e9 01 SBC #1 1264 c263 8d 43 01 STA player_ypos 1265 c266 a9 01 LDA #1 1266 c268 8d 45 01 STA joyposup 1267 c26b a9 00 LDA #0 1268 c26d 8d 46 01 STA joyposdown 1269 c270 8d 47 01 STA joyposleft 1270 c273 8d 48 01 STA joyposright 1271 c276 .skipL088 1272 c276 .L089 ;; if joy0down then player_ypos = player_ypos + 1 : joyposup = 0 : joyposdown = 1 : joyposleft = 0 : joyposright = 0 1273 c276 1274 c276 a9 20 lda #$20 1275 c278 2c 80 02 bit SWCHA 1276 c27b d0 1b BNE .skipL089 1277 c27d .condpart13 1278 c27d ad 43 01 LDA player_ypos 1279 c280 18 CLC 1280 c281 69 01 ADC #1 1281 c283 8d 43 01 STA player_ypos 1282 c286 a9 00 LDA #0 1283 c288 8d 45 01 STA joyposup 1284 c28b a9 01 LDA #1 1285 c28d 8d 46 01 STA joyposdown 1286 c290 a9 00 LDA #0 1287 c292 8d 47 01 STA joyposleft 1288 c295 8d 48 01 STA joyposright 1289 c298 .skipL089 1290 c298 .L090 ;; if joy0left then player_xpos = player_xpos - 1 : joyposup = 0 : joyposdown = 0 : joyposleft = 1 : joyposright = 0 1291 c298 1292 c298 2c 80 02 bit SWCHA 1293 c29b 70 1b BVS .skipL090 1294 c29d .condpart14 1295 c29d ad 42 01 LDA player_xpos 1296 c2a0 38 SEC 1297 c2a1 e9 01 SBC #1 1298 c2a3 8d 42 01 STA player_xpos 1299 c2a6 a9 00 LDA #0 1300 c2a8 8d 45 01 STA joyposup 1301 c2ab 8d 46 01 STA joyposdown 1302 c2ae a9 01 LDA #1 1303 c2b0 8d 47 01 STA joyposleft 1304 c2b3 a9 00 LDA #0 1305 c2b5 8d 48 01 STA joyposright 1306 c2b8 .skipL090 1307 c2b8 .L091 ;; if joy0right then player_xpos = player_xpos + 1 : joyposup = 0 : joyposdown = 0 : joyposleft = 0 : joyposright = 1 1308 c2b8 1309 c2b8 2c 80 02 bit SWCHA 1310 c2bb 30 19 BMI .skipL091 1311 c2bd .condpart15 1312 c2bd ad 42 01 LDA player_xpos 1313 c2c0 18 CLC 1314 c2c1 69 01 ADC #1 1315 c2c3 8d 42 01 STA player_xpos 1316 c2c6 a9 00 LDA #0 1317 c2c8 8d 45 01 STA joyposup 1318 c2cb 8d 46 01 STA joyposdown 1319 c2ce 8d 47 01 STA joyposleft 1320 c2d1 a9 01 LDA #1 1321 c2d3 8d 48 01 STA joyposright 1322 c2d6 .skipL091 1323 c2d6 .L092 ;; gosub check_firebutton 1324 c2d6 1325 c2d6 20 62 c5 jsr .check_firebutton 1326 c2d9 1327 c2d9 .L093 ;; gosub check_bullet_time 1328 c2d9 1329 c2d9 20 f5 c5 jsr .check_bullet_time 1330 c2dc 1331 c2dc .L094 ;; gosub move_bullets 1332 c2dc 1333 c2dc 20 e4 c5 jsr .move_bullets 1334 c2df 1335 c2df .L095 ;; gosub check_bullet_boundary 1336 c2df 1337 c2df 20 22 c6 jsr .check_bullet_boundary 1338 c2e2 1339 c2e2 . 1340 c2e2 ;; 1341 c2e2 1342 c2e2 .L096 ;; if joy0fire && joyposup = 1 then bullet_xpos = bullet_xpos + 8 1343 c2e2 1344 c2e2 2c 02 21 bit sINPT1 1345 c2e5 10 10 BPL .skipL096 1346 c2e7 .condpart16 1347 c2e7 ad 45 01 LDA joyposup 1348 c2ea c9 01 CMP #1 1349 c2ec d0 09 BNE .skip16then 1350 c2ee .condpart17 1351 c2ee ad 49 01 LDA bullet_xpos 1352 c2f1 18 CLC 1353 c2f2 69 08 ADC #8 1354 c2f4 8d 49 01 STA bullet_xpos 1355 c2f7 .skip16then 1356 c2f7 .skipL096 1357 c2f7 .L097 ;; if joy0fire && joyposdown = 1 then bullet_xpos = bullet_xpos + 8 1358 c2f7 1359 c2f7 2c 02 21 bit sINPT1 1360 c2fa 10 10 BPL .skipL097 1361 c2fc .condpart18 1362 c2fc ad 46 01 LDA joyposdown 1363 c2ff c9 01 CMP #1 1364 c301 d0 09 BNE .skip18then 1365 c303 .condpart19 1366 c303 ad 49 01 LDA bullet_xpos 1367 c306 18 CLC 1368 c307 69 08 ADC #8 1369 c309 8d 49 01 STA bullet_xpos 1370 c30c .skip18then 1371 c30c .skipL097 1372 c30c .L098 ;; if joy0fire && joyposleft = 1 then bullet_xpos = bullet_xpos + 8 1373 c30c 1374 c30c 2c 02 21 bit sINPT1 1375 c30f 10 10 BPL .skipL098 1376 c311 .condpart20 1377 c311 ad 47 01 LDA joyposleft 1378 c314 c9 01 CMP #1 1379 c316 d0 09 BNE .skip20then 1380 c318 .condpart21 1381 c318 ad 49 01 LDA bullet_xpos 1382 c31b 18 CLC 1383 c31c 69 08 ADC #8 1384 c31e 8d 49 01 STA bullet_xpos 1385 c321 .skip20then 1386 c321 .skipL098 1387 c321 .L099 ;; if joy0fire && joyposright = 1 then bullet_xpos = bullet_xpos + 8 1388 c321 1389 c321 2c 02 21 bit sINPT1 1390 c324 10 10 BPL .skipL099 1391 c326 .condpart22 1392 c326 ad 48 01 LDA joyposright 1393 c329 c9 01 CMP #1 1394 c32b d0 09 BNE .skip22then 1395 c32d .condpart23 1396 c32d ad 49 01 LDA bullet_xpos 1397 c330 18 CLC 1398 c331 69 08 ADC #8 1399 c333 8d 49 01 STA bullet_xpos 1400 c336 .skip22then 1401 c336 .skipL099 1402 c336 .L0100 ;; if !joy0fire then bullet_xpos = bullet_xpos + 0 : bullet_ypos = bullet_ypos + 0 1403 c336 1404 c336 2c 02 21 bit sINPT1 1405 c339 30 12 BMI .skipL0100 1406 c33b .condpart24 1407 c33b ad 49 01 LDA bullet_xpos 1408 c33e 18 CLC 1409 c33f 69 00 ADC #0 1410 c341 8d 49 01 STA bullet_xpos 1411 c344 ad 4a 01 LDA bullet_ypos 1412 c347 18 CLC 1413 c348 69 00 ADC #0 1414 c34a 8d 4a 01 STA bullet_ypos 1415 c34d .skipL0100 1416 c34d . 1417 c34d ;; 1418 c34d 1419 c34d . 1420 c34d ;; 1421 c34d 1422 c34d .L0101 ;; if player_xpos > 152 then player_xpos = player_xpos - 1 1423 c34d 1424 c34d a9 98 LDA #152 1425 c34f cd 42 01 CMP player_xpos 1426 c352 b0 09 BCS .skipL0101 1427 c354 .condpart25 1428 c354 ad 42 01 LDA player_xpos 1429 c357 38 SEC 1430 c358 e9 01 SBC #1 1431 c35a 8d 42 01 STA player_xpos 1432 c35d .skipL0101 1433 c35d .L0102 ;; if player_xpos < 1 then player_xpos = player_xpos + 1 1434 c35d 1435 c35d ad 42 01 LDA player_xpos 1436 c360 c9 01 CMP #1 1437 c362 b0 09 BCS .skipL0102 1438 c364 .condpart26 1439 c364 ad 42 01 LDA player_xpos 1440 c367 18 CLC 1441 c368 69 01 ADC #1 1442 c36a 8d 42 01 STA player_xpos 1443 c36d .skipL0102 1444 c36d .L0103 ;; if player_ypos > 207 then player_ypos = player_ypos - 1 1445 c36d 1446 c36d a9 cf LDA #207 1447 c36f cd 43 01 CMP player_ypos 1448 c372 b0 09 BCS .skipL0103 1449 c374 .condpart27 1450 c374 ad 43 01 LDA player_ypos 1451 c377 38 SEC 1452 c378 e9 01 SBC #1 1453 c37a 8d 43 01 STA player_ypos 1454 c37d .skipL0103 1455 c37d .L0104 ;; if player_ypos < 1 then player_ypos = player_ypos + 1 1456 c37d 1457 c37d ad 43 01 LDA player_ypos 1458 c380 c9 01 CMP #1 1459 c382 b0 09 BCS .skipL0104 1460 c384 .condpart28 1461 c384 ad 43 01 LDA player_ypos 1462 c387 18 CLC 1463 c388 69 01 ADC #1 1464 c38a 8d 43 01 STA player_ypos 1465 c38d .skipL0104 1466 c38d .L0105 ;; if bullet_xpos > 168 then bullet_xpos = bullet_xpos - 1 1467 c38d 1468 c38d a9 a8 LDA #168 1469 c38f cd 49 01 CMP bullet_xpos 1470 c392 b0 09 BCS .skipL0105 1471 c394 .condpart29 1472 c394 ad 49 01 LDA bullet_xpos 1473 c397 38 SEC 1474 c398 e9 01 SBC #1 1475 c39a 8d 49 01 STA bullet_xpos 1476 c39d .skipL0105 1477 c39d .L0106 ;; if bullet_xpos < 1 then bullet_xpos = bullet_xpos + 1 1478 c39d 1479 c39d ad 49 01 LDA bullet_xpos 1480 c3a0 c9 01 CMP #1 1481 c3a2 b0 09 BCS .skipL0106 1482 c3a4 .condpart30 1483 c3a4 ad 49 01 LDA bullet_xpos 1484 c3a7 18 CLC 1485 c3a8 69 01 ADC #1 1486 c3aa 8d 49 01 STA bullet_xpos 1487 c3ad .skipL0106 1488 c3ad .L0107 ;; if bullet_ypos > 207 then bullet_ypos = bullet_ypos - 1 1489 c3ad 1490 c3ad a9 cf LDA #207 1491 c3af cd 4a 01 CMP bullet_ypos 1492 c3b2 b0 09 BCS .skipL0107 1493 c3b4 .condpart31 1494 c3b4 ad 4a 01 LDA bullet_ypos 1495 c3b7 38 SEC 1496 c3b8 e9 01 SBC #1 1497 c3ba 8d 4a 01 STA bullet_ypos 1498 c3bd .skipL0107 1499 c3bd .L0108 ;; if bullet_ypos < 1 then bullet_ypos = bullet_ypos + 1 1500 c3bd 1501 c3bd ad 4a 01 LDA bullet_ypos 1502 c3c0 c9 01 CMP #1 1503 c3c2 b0 09 BCS .skipL0108 1504 c3c4 .condpart32 1505 c3c4 ad 4a 01 LDA bullet_ypos 1506 c3c7 18 CLC 1507 c3c8 69 01 ADC #1 1508 c3ca 8d 4a 01 STA bullet_ypos 1509 c3cd .skipL0108 1510 c3cd . 1511 c3cd ;; 1512 c3cd 1513 c3cd .L0109 ;; gosub check_collisions 1514 c3cd 1515 c3cd 20 df c4 jsr .check_collisions 1516 c3d0 1517 c3d0 .L0110 ;; if isDead_flag then goto lose_a_life 1518 c3d0 1519 c3d0 ad 5a 01 LDA isDead_flag 1520 c3d3 f0 03 BEQ .skipL0110 1521 c3d5 .condpart33 1522 c3d5 4c f1 c3 jmp .lose_a_life 1523 c3d8 1524 c3d8 .skipL0110 1525 c3d8 . 1526 c3d8 ;; 1527 c3d8 1528 c3d8 .L0111 ;; gosub display_bullets 1529 c3d8 1530 c3d8 20 6f c6 jsr .display_bullets 1531 c3db 1532 c3db . 1533 c3db ;; 1534 c3db 1535 c3db .L0112 ;; goto mainloop 1536 c3db 1537 c3db 4c 9e c1 jmp .mainloop 1538 c3de 1539 c3de . 1540 c3de ;; 1541 c3de 1542 c3de . 1543 c3de ;; 1544 c3de 1545 c3de .Set_Bullet_home 1546 c3de ;; Set_Bullet_home 1547 c3de 1548 c3de .L0113 ;; bullet_xpos = player_xpos + 8 : bullet_ypos = player_ypos + 4 1549 c3de 1550 c3de ad 42 01 LDA player_xpos 1551 c3e1 18 CLC 1552 c3e2 69 08 ADC #8 1553 c3e4 8d 49 01 STA bullet_xpos 1554 c3e7 ad 43 01 LDA player_ypos 1555 c3ea 18 CLC 1556 c3eb 69 04 ADC #4 1557 c3ed 8d 4a 01 STA bullet_ypos 1558 c3f0 .L0114 ;; return 1559 c3f0 1560 c3f0 60 RTS 1561 c3f1 . 1562 c3f1 ;; 1563 c3f1 1564 c3f1 .lose_a_life 1565 c3f1 ;; lose_a_life 1566 c3f1 1567 c3f1 .L0115 ;; lives = lives - 1 : isDead_flag = 0 1568 c3f1 1569 c3f1 ad 5f 01 LDA lives 1570 c3f4 38 SEC 1571 c3f5 e9 01 SBC #1 1572 c3f7 8d 5f 01 STA lives 1573 c3fa a9 00 LDA #0 1574 c3fc 8d 5a 01 STA isDead_flag 1575 c3ff .L0116 ;; if obstacle_flag <> 1 then obstacle_xpos = 104 : obstacle_ypos = 20 1576 c3ff 1577 c3ff ad 5d 01 LDA obstacle_flag 1578 c402 c9 01 CMP #1 1579 c404 f0 0a BEQ .skipL0116 1580 c406 .condpart34 1581 c406 a9 68 LDA #104 1582 c408 8d 5b 01 STA obstacle_xpos 1583 c40b a9 14 LDA #20 1584 c40d 8d 5c 01 STA obstacle_ypos 1585 c410 .skipL0116 1586 c410 .L0117 ;; if player_Flag = 1 && lives > 0 then player_xpos = 20 : player_ypos = 104 : player_Flag = 0 : goto main 1587 c410 1588 c410 ad 5e 01 LDA player_Flag 1589 c413 c9 01 CMP #1 1590 c415 d0 19 BNE .skipL0117 1591 c417 .condpart35 1592 c417 a9 00 LDA #0 1593 c419 cd 5f 01 CMP lives 1594 c41c b0 12 BCS .skip35then 1595 c41e .condpart36 1596 c41e a9 14 LDA #20 1597 c420 8d 42 01 STA player_xpos 1598 c423 a9 68 LDA #104 1599 c425 8d 43 01 STA player_ypos 1600 c428 a9 00 LDA #0 1601 c42a 8d 5e 01 STA player_Flag 1602 c42d 4c 89 c1 jmp .main 1603 c430 1604 c430 .skip35then 1605 c430 .skipL0117 1606 c430 .L0118 ;; joyposup = 0 : joyposdown = 0 : joyposleft = 0 : joyposright = 0 1607 c430 1608 c430 a9 00 LDA #0 1609 c432 8d 45 01 STA joyposup 1610 c435 8d 46 01 STA joyposdown 1611 c438 8d 47 01 STA joyposleft 1612 c43b 8d 48 01 STA joyposright 1613 c43e . 1614 c43e ;; 1615 c43e 1616 c43e .lose_a_lifeloop 1617 c43e ;; lose_a_lifeloop 1618 c43e 1619 c43e .L0119 ;; restorescreen 1620 c43e 1621 c43e 20 91 f0 jsr restorescreen 1622 c441 . 1623 c441 ;; 1624 c441 1625 c441 .L0120 ;; drawscreen 1626 c441 1627 c441 20 b3 f0 jsr drawscreen 1628 c444 .L0121 ;; if joy0fire then fire_debounce = 2 1629 c444 1630 c444 2c 02 21 bit sINPT1 1631 c447 10 05 BPL .skipL0121 1632 c449 .condpart37 1633 c449 a9 02 LDA #2 1634 c44b 8d 44 01 STA fire_debounce 1635 c44e .skipL0121 1636 c44e .L0122 ;; if !joy0fire then fire_debounce = 1 1637 c44e 1638 c44e 2c 02 21 bit sINPT1 1639 c451 30 05 BMI .skipL0122 1640 c453 .condpart38 1641 c453 a9 01 LDA #1 1642 c455 8d 44 01 STA fire_debounce 1643 c458 .skipL0122 1644 c458 .L0123 ;; if fire_debounce = 1 && lives > 0 then clearscreen : goto main 1645 c458 1646 c458 ad 44 01 LDA fire_debounce 1647 c45b c9 01 CMP #1 1648 c45d d0 0d BNE .skipL0123 1649 c45f .condpart39 1650 c45f a9 00 LDA #0 1651 c461 cd 5f 01 CMP lives 1652 c464 b0 06 BCS .skip39then 1653 c466 .condpart40 1654 c466 20 7f f0 jsr clearscreen 1655 c469 4c 89 c1 jmp .main 1656 c46c 1657 c46c .skip39then 1658 c46c .skipL0123 1659 c46c .L0124 ;; if fire_debounce = 1 && lives < 1 then clearscreen : goto gameover 1660 c46c 1661 c46c ad 44 01 LDA fire_debounce 1662 c46f c9 01 CMP #1 1663 c471 d0 0d BNE .skipL0124 1664 c473 .condpart41 1665 c473 ad 5f 01 LDA lives 1666 c476 c9 01 CMP #1 1667 c478 b0 06 BCS .skip41then 1668 c47a .condpart42 1669 c47a 20 7f f0 jsr clearscreen 1670 c47d 4c 83 c4 jmp .gameover 1671 c480 1672 c480 .skip41then 1673 c480 .skipL0124 1674 c480 .L0125 ;; goto lose_a_lifeloop 1675 c480 1676 c480 4c 3e c4 jmp .lose_a_lifeloop 1677 c483 1678 c483 . 1679 c483 ;; 1680 c483 1681 c483 .gameover 1682 c483 ;; gameover 1683 c483 1684 c483 .L0126 ;; gameover_flag = 0 1685 c483 1686 c483 a9 00 LDA #0 1687 c485 8d 59 01 STA gameover_flag 1688 c488 .L0127 ;; fire_debounce = 1 1689 c488 1690 c488 a9 01 LDA #1 1691 c48a 8d 44 01 STA fire_debounce 1692 c48d . 1693 c48d ;; 1694 c48d 1695 c48d .gameover_loop 1696 c48d ;; gameover_loop 1697 c48d 1698 c48d .L0128 ;; if lives = 0 then gameover_flag = 1 : clearscreen 1699 c48d 1700 c48d ad 5f 01 LDA lives 1701 c490 c9 00 CMP #0 1702 c492 d0 08 BNE .skipL0128 1703 c494 .condpart43 1704 c494 a9 01 LDA #1 1705 c496 8d 59 01 STA gameover_flag 1706 c499 20 7f f0 jsr clearscreen 1707 c49c .skipL0128 1708 c49c .L0129 ;; plotchars 'Game^Over!' 0 40 16 1709 c49c 1710 c49c 4c a9 c4 JMP skipalphadata3 1711 c49f alphadata3 1712 c49f 27 .byte.b (alphadata3 1727 c4af 85 43 sta temp2 1728 c4b1 1729 c4b1 a9 16 lda #22 ; width in two's complement 1730 c4b3 09 00 ora #0 ; palette left shifted 5 bits 1731 c4b5 85 44 sta temp3 1732 c4b7 a9 28 lda #40 1733 c4b9 85 45 sta temp4 1734 c4bb 1735 c4bb a9 10 lda #16 1736 c4bd 1737 c4bd 85 46 sta temp5 1738 c4bf 1739 c4bf 20 4c f3 jsr plotcharacters 1740 c4c2 .L0130 ;; if joy0fire && !fire_debounce then clearscreen : goto plot 1741 c4c2 1742 c4c2 2c 02 21 bit sINPT1 1743 c4c5 10 0b BPL .skipL0130 1744 c4c7 .condpart44 1745 c4c7 ad 44 01 LDA fire_debounce 1746 c4ca d0 06 BNE .skip44then 1747 c4cc .condpart45 1748 c4cc 20 7f f0 jsr clearscreen 1749 c4cf 4c d5 c0 jmp .plot 1750 c4d2 1751 c4d2 .skip44then 1752 c4d2 .skipL0130 1753 c4d2 .L0131 ;; if !joy0fire then fire_debounce = 0 1754 c4d2 1755 c4d2 2c 02 21 bit sINPT1 1756 c4d5 30 05 BMI .skipL0131 1757 c4d7 .condpart46 1758 c4d7 a9 00 LDA #0 1759 c4d9 8d 44 01 STA fire_debounce 1760 c4dc .skipL0131 1761 c4dc .L0132 ;; goto gameover_loop 1762 c4dc 1763 c4dc 4c 8d c4 jmp .gameover_loop 1764 c4df 1765 c4df . 1766 c4df ;; 1767 c4df 1768 c4df . 1769 c4df ;; 1770 c4df 1771 c4df .check_collisions 1772 c4df ;; check_collisions 1773 c4df 1774 c4df .L0133 ;; 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 1775 c4df 1776 c4df 1777 c4df 18 clc ; one clc only. If we overflow we're screwed anyway. 1778 c4e0 a0 07 ldy #(8-1) 1779 c4e2 84 44 sty temp3 1780 c4e4 a0 07 ldy #(8-1) 1781 c4e6 84 45 sty temp4 1782 c4e8 ad 5b 01 lda obstacle_xpos 1783 c4eb 69 30 adc #48 1784 c4ed 85 46 sta temp5 1785 c4ef ad 5c 01 lda obstacle_ypos 1786 c4f2 69 18 adc #((256-WSCREENHEIGHT)/2) 1787 c4f4 85 47 sta temp6 1788 c4f6 a0 07 ldy #(8-1) 1789 c4f8 84 48 sty temp7 1790 c4fa a0 0f ldy #(16-1) 1791 c4fc 84 49 sty temp8 1792 c4fe ad 43 01 lda player_ypos 1793 c501 69 18 adc #((256-WSCREENHEIGHT)/2) 1794 c503 a8 tay 1795 c504 ad 42 01 lda player_xpos 1796 c507 69 30 adc #48 1797 c509 20 81 f3 jsr boxcollision 1798 c50c 1799 c50c 90 15 BCC .skipL0133 1800 c50e .condpart47 1801 c50e a9 c8 LDA #200 1802 c510 8d 5b 01 STA obstacle_xpos 1803 c513 a9 e0 LDA #224 1804 c515 8d 5c 01 STA obstacle_ypos 1805 c518 a9 01 LDA #1 1806 c51a 8d 5e 01 STA player_Flag 1807 c51d 8d 5a 01 STA isDead_flag 1808 c520 4c 61 c5 jmp ._checkCollisionsExit 1809 c523 1810 c523 .skipL0133 1811 c523 .L0134 ;; if boxcollision ( bullet_xpos , bullet_ypos , 8 , 8 , obstacle_xpos , obstacle_ypos , 8 , 16 ) then obstacle_xpos = 200 : obstacle_ypos = 224 : obstacle_flag = 1 1812 c523 1813 c523 1814 c523 18 clc ; one clc only. If we overflow we're screwed anyway. 1815 c524 a0 07 ldy #(8-1) 1816 c526 84 44 sty temp3 1817 c528 a0 07 ldy #(8-1) 1818 c52a 84 45 sty temp4 1819 c52c ad 5b 01 lda obstacle_xpos 1820 c52f 69 30 adc #48 1821 c531 85 46 sta temp5 1822 c533 ad 5c 01 lda obstacle_ypos 1823 c536 69 18 adc #((256-WSCREENHEIGHT)/2) 1824 c538 85 47 sta temp6 1825 c53a a0 07 ldy #(8-1) 1826 c53c 84 48 sty temp7 1827 c53e a0 0f ldy #(16-1) 1828 c540 84 49 sty temp8 1829 c542 ad 4a 01 lda bullet_ypos 1830 c545 69 18 adc #((256-WSCREENHEIGHT)/2) 1831 c547 a8 tay 1832 c548 ad 49 01 lda bullet_xpos 1833 c54b 69 30 adc #48 1834 c54d 20 81 f3 jsr boxcollision 1835 c550 1836 c550 90 0f BCC .skipL0134 1837 c552 .condpart48 1838 c552 a9 c8 LDA #200 1839 c554 8d 5b 01 STA obstacle_xpos 1840 c557 a9 e0 LDA #224 1841 c559 8d 5c 01 STA obstacle_ypos 1842 c55c a9 01 LDA #1 1843 c55e 8d 5d 01 STA obstacle_flag 1844 c561 .skipL0134 1845 c561 . 1846 c561 ;; 1847 c561 1848 c561 . 1849 c561 ;; 1850 c561 1851 c561 ._checkCollisionsExit 1852 c561 ;; _checkCollisionsExit 1853 c561 1854 c561 .L0135 ;; return 1855 c561 1856 c561 60 RTS 1857 c562 . 1858 c562 ;; 1859 c562 1860 c562 .check_firebutton 1861 c562 ;; check_firebutton 1862 c562 1863 c562 .L0136 ;; if fire_debounce > 0 && joy0fire then return else if !joy0fire then fire_debounce = 0 : return 1864 c562 1865 c562 a9 00 LDA #0 1866 c564 cd 44 01 CMP fire_debounce 1867 c567 b0 09 BCS .skipL0136 1868 c569 .condpart49 1869 c569 2c 02 21 bit sINPT1 1870 c56c 10 04 BPL .skip49then 1871 c56e .condpart50 1872 c56e 60 RTS 1873 c56f 4c 7d c5 jmp .skipelse0 1874 c572 .skip49then 1875 c572 .skipL0136 1876 c572 2c 02 21 bit sINPT1 1877 c575 30 06 BMI .skipelse 1878 c577 .condpart51 1879 c577 a9 00 LDA #0 1880 c579 8d 44 01 STA fire_debounce 1881 c57c 60 RTS 1882 c57d .skipelse 1883 c57d .skipelse0 1884 c57d .L0137 ;; temp5 = 255 1885 c57d 1886 c57d a9 ff LDA #255 1887 c57f 85 46 STA temp5 1888 c581 .L0138 ;; for temp1 = 0 to 2 1889 c581 1890 c581 a9 00 LDA #0 1891 c583 85 42 STA temp1 1892 c585 .L0138fortemp1 1893 c585 .L0139 ;; if bullet_xpos[temp1]! = 200 then temp5 = temp1 1894 c585 1895 c585 a6 42 LDX temp1 1896 c587 bd 49 01 LDA bullet_xpos,x 1897 c58a c9 c8 CMP #200 1898 c58c d0 04 BNE .skipL0139 1899 c58e .condpart52 1900 c58e a5 42 LDA temp1 1901 c590 85 46 STA temp5 1902 c592 .skipL0139 1903 c592 .L0140 ;; next 1904 c592 1905 c592 a5 42 LDA temp1 1906 c594 c9 02 CMP #2 1907 c596 e6 42 INC temp1 1908 c598 if ((* - .L0138fortemp1) < 127) && ((* - .L0138fortemp1) > -128) 1909 c598 90 eb bcc .L0138fortemp1 1910 c59a - else 1911 c59a - bcs .0skipL0138fortemp1 1912 c59a - jmp .L0138fortemp1 1913 c59a -.0skipL0138fortemp1 1914 c59a endif 1915 c59a .L0141 ;; if temp5 = 255 then return 1916 c59a 1917 c59a a5 46 LDA temp5 1918 c59c c9 ff CMP #255 1919 c59e d0 01 BNE .skipL0141 1920 c5a0 .condpart53 1921 c5a0 60 RTS 1922 c5a1 .skipL0141 1923 c5a1 .L0142 ;; playsfx sfx_plainlaser 1924 c5a1 1925 c5a1 ifnconst NOTIALOCKMUTE 1926 c5a1 a9 01 lda #1 1927 c5a3 85 de sta sfxschedulelock 1928 c5a5 a9 b8 lda #sfx_plainlaser 1931 c5ab 85 e1 sta sfxinstrumenthi 1932 c5ad a9 00 lda #0 1933 c5af 85 e2 sta sfxpitchoffset ; no pitch modification 1934 c5b1 85 e3 sta sfxnoteindex ; not a musical note 1935 c5b3 20 4b f2 jsr schedulesfx 1936 c5b6 a9 00 lda #0 1937 c5b8 85 de sta sfxschedulelock 1938 c5ba endif ; NOTIALOCKMUTE 1939 c5ba .L0143 ;; fire_debounce = 255 1940 c5ba 1941 c5ba a9 ff LDA #255 1942 c5bc 8d 44 01 STA fire_debounce 1943 c5bf .L0144 ;; frameCounter[temp5] = 200 1944 c5bf 1945 c5bf a9 c8 LDA #200 1946 c5c1 a6 46 LDX temp5 1947 c5c3 9d 41 01 STA frameCounter,x 1948 c5c6 .L0145 ;; bullet_xpos[temp5] = player_xpos + 1 1949 c5c6 1950 c5c6 ad 42 01 LDA player_xpos 1951 c5c9 18 CLC 1952 c5ca 69 01 ADC #1 1953 c5cc a6 46 LDX temp5 1954 c5ce 9d 49 01 STA bullet_xpos,x 1955 c5d1 .L0146 ;; bullet_ypos[temp5] = player_ypos + 4 1956 c5d1 1957 c5d1 ad 43 01 LDA player_ypos 1958 c5d4 18 CLC 1959 c5d5 69 04 ADC #4 1960 c5d7 a6 46 LDX temp5 1961 c5d9 9d 4a 01 STA bullet_ypos,x 1962 c5dc . 1963 c5dc ;; 1964 c5dc 1965 c5dc .L0147 ;; temp5 = temp5 - 6 1966 c5dc 1967 c5dc a5 46 LDA temp5 1968 c5de 38 SEC 1969 c5df e9 06 SBC #6 1970 c5e1 85 46 STA temp5 1971 c5e3 .L0148 ;; return 1972 c5e3 1973 c5e3 60 RTS 1974 c5e4 . 1975 c5e4 ;; 1976 c5e4 1977 c5e4 .move_bullets 1978 c5e4 ;; move_bullets 1979 c5e4 1980 c5e4 .L0149 ;; if bullet_xpos <> 200 then bullet_xpos = bullet_xpos + 1981 c5e4 1982 c5e4 ad 49 01 LDA bullet_xpos 1983 c5e7 c9 c8 CMP #200 1984 c5e9 f0 09 BEQ .skipL0149 1985 c5eb .condpart54 1986 c5eb ad 49 01 LDA bullet_xpos 1987 c5ee 18 CLC 1988 c5ef 69 00 ADC # 1989 c5f1 8d 49 01 STA bullet_xpos 1990 c5f4 .skipL0149 1991 c5f4 .L0150 ;; return 1992 c5f4 1993 c5f4 60 RTS 1994 c5f5 . 1995 c5f5 ;; 1996 c5f5 1997 c5f5 .check_bullet_time 1998 c5f5 ;; check_bullet_time 1999 c5f5 2000 c5f5 .L0151 ;; for temp1 = 0 to 2 2001 c5f5 2002 c5f5 a9 00 LDA #0 2003 c5f7 85 42 STA temp1 2004 c5f9 .L0151fortemp1 2005 c5f9 .L0152 ;; if frameCounter[temp1] > 0 then frameCounter[temp1] = frameCounter[temp1] - 1 else bullet_xpos[temp1] = 200 2006 c5f9 2007 c5f9 a9 00 LDA #0 2008 c5fb a6 42 LDX temp1 2009 c5fd dd 41 01 CMP frameCounter,x 2010 c600 b0 10 BCS .skipL0152 2011 c602 .condpart55 2012 c602 a6 42 LDX temp1 2013 c604 bd 41 01 LDA frameCounter,x 2014 c607 38 SEC 2015 c608 e9 01 SBC #1 2016 c60a a6 42 LDX temp1 2017 c60c 9d 41 01 STA frameCounter,x 2018 c60f 4c 19 c6 jmp .skipelse1 2019 c612 .skipL0152 2020 c612 a9 c8 LDA #200 2021 c614 a6 42 LDX temp1 2022 c616 9d 49 01 STA bullet_xpos,x 2023 c619 .skipelse1 2024 c619 .L0153 ;; next 2025 c619 2026 c619 a5 42 LDA temp1 2027 c61b c9 02 CMP #2 2028 c61d e6 42 INC temp1 2029 c61f if ((* - .L0151fortemp1) < 127) && ((* - .L0151fortemp1) > -128) 2030 c61f 90 d8 bcc .L0151fortemp1 2031 c621 - else 2032 c621 - bcs .1skipL0151fortemp1 2033 c621 - jmp .L0151fortemp1 2034 c621 -.1skipL0151fortemp1 2035 c621 endif 2036 c621 .L0154 ;; return 2037 c621 2038 c621 60 RTS 2039 c622 . 2040 c622 ;; 2041 c622 2042 c622 .check_bullet_boundary 2043 c622 ;; check_bullet_boundary 2044 c622 2045 c622 .L0155 ;; for temp1 = 0 to 2 2046 c622 2047 c622 a9 00 LDA #0 2048 c624 85 42 STA temp1 2049 c626 .L0155fortemp1 2050 c626 .L0156 ;; customTemp1 = bullet_xpos[temp1] 2051 c626 2052 c626 a6 42 LDX temp1 2053 c628 bd 49 01 LDA bullet_xpos,x 2054 c62b 8d 55 01 STA customTemp1 2055 c62e .L0157 ;; customTemp2 = bullet_ypos[temp2] 2056 c62e 2057 c62e a6 43 LDX temp2 2058 c630 bd 4a 01 LDA bullet_ypos,x 2059 c633 8d 56 01 STA customTemp2 2060 c636 .L0158 ;; if customTemp1 < 5 || customTemp1 > 145 then bullet_xpos[temp1] = 200 2061 c636 2062 c636 ad 55 01 LDA customTemp1 2063 c639 c9 05 CMP #5 2064 c63b b0 03 BCS .skipL0158 2065 c63d .condpart56 2066 c63d 4c 47 c6 jmp .condpart57 2067 c640 .skipL0158 2068 c640 a9 91 LDA #145 2069 c642 cd 55 01 CMP customTemp1 2070 c645 b0 07 BCS .skip13OR 2071 c647 .condpart57 2072 c647 a9 c8 LDA #200 2073 c649 a6 42 LDX temp1 2074 c64b 9d 49 01 STA bullet_xpos,x 2075 c64e .skip13OR 2076 c64e .L0159 ;; if customTemp2 < 5 || customTemp2 > 145 then bullet_ypos[temp1] = 200 2077 c64e 2078 c64e ad 56 01 LDA customTemp2 2079 c651 c9 05 CMP #5 2080 c653 b0 03 BCS .skipL0159 2081 c655 .condpart58 2082 c655 4c 5f c6 jmp .condpart59 2083 c658 .skipL0159 2084 c658 a9 91 LDA #145 2085 c65a cd 56 01 CMP customTemp2 2086 c65d b0 07 BCS .skip14OR 2087 c65f .condpart59 2088 c65f a9 c8 LDA #200 2089 c661 a6 42 LDX temp1 2090 c663 9d 4a 01 STA bullet_ypos,x 2091 c666 .skip14OR 2092 c666 .L0160 ;; next 2093 c666 2094 c666 a5 42 LDA temp1 2095 c668 c9 02 CMP #2 2096 c66a e6 42 INC temp1 2097 c66c if ((* - .L0155fortemp1) < 127) && ((* - .L0155fortemp1) > -128) 2098 c66c 90 b8 bcc .L0155fortemp1 2099 c66e - else 2100 c66e - bcs .2skipL0155fortemp1 2101 c66e - jmp .L0155fortemp1 2102 c66e -.2skipL0155fortemp1 2103 c66e endif 2104 c66e .L0161 ;; return 2105 c66e 2106 c66e 60 RTS 2107 c66f . 2108 c66f ;; 2109 c66f 2110 c66f .display_bullets 2111 c66f ;; display_bullets 2112 c66f 2113 c66f .L0162 ;; for customTemp3 = 0 to 2 2114 c66f 2115 c66f a9 00 LDA #0 2116 c671 8d 57 01 STA customTemp3 2117 c674 .L0162forcustomTemp3 2118 c674 .L0163 ;; customTemp1 = bullet_xpos[customTemp3] 2119 c674 2120 c674 ae 57 01 LDX customTemp3 2121 c677 bd 49 01 LDA bullet_xpos,x 2122 c67a 8d 55 01 STA customTemp1 2123 c67d .L0164 ;; customTemp2 = bullet_ypos[customTemp3] 2124 c67d 2125 c67d ae 57 01 LDX customTemp3 2126 c680 bd 4a 01 LDA bullet_ypos,x 2127 c683 8d 56 01 STA customTemp2 2128 c686 .L0165 ;; if customTemp1 <> 200 then plotsprite playershot 0 bullet_xpos bullet_ypos 2129 c686 2130 c686 ad 55 01 LDA customTemp1 2131 c689 c9 c8 CMP #200 2132 c68b f0 1d BEQ .skipL0165 2133 c68d .condpart60 2134 c68d a9 5b lda #playershot 2138 c693 85 43 sta temp2 2139 c695 2140 c695 a9 1e lda #(0|playershot_width_twoscompliment) 2141 c697 85 44 sta temp3 2142 c699 2143 c699 ad 49 01 lda bullet_xpos 2144 c69c 85 45 sta temp4 2145 c69e 2146 c69e ad 4a 01 lda bullet_ypos 2147 c6a1 2148 c6a1 85 46 sta temp5 2149 c6a3 2150 c6a3 a9 40 lda #(playershot_mode|%01000000) 2151 c6a5 85 47 sta temp6 2152 c6a7 2153 c6a7 20 93 f2 jsr plotsprite 2154 c6aa .skipL0165 2155 c6aa .L0166 ;; next 2156 c6aa 2157 c6aa ad 57 01 LDA customTemp3 2158 c6ad c9 02 CMP #2 2159 c6af ee 57 01 INC customTemp3 2160 c6b2 if ((* - .L0162forcustomTemp3) < 127) && ((* - .L0162forcustomTemp3) > -128) 2161 c6b2 90 c0 bcc .L0162forcustomTemp3 2162 c6b4 - else 2163 c6b4 - bcs .3skipL0162forcustomTemp3 2164 c6b4 - jmp .L0162forcustomTemp3 2165 c6b4 -.3skipL0162forcustomTemp3 2166 c6b4 endif 2167 c6b4 .L0167 ;; return 2168 c6b4 2169 c6b4 60 RTS 2170 c6b5 . 2171 c6b5 ;; 2172 c6b5 2173 c6b5 .L0168 ;; data sfx_plainlaser 2174 c6b5 2175 c6b5 4c e8 c6 JMP .skipL0168 2176 c6b8 sfx_plainlaser 2177 c6b8 10 10 00 .byte.b $10,$10,$00 ; version, priority, frames per chunk 2178 c6bb 2179 c6bb 10 04 06 .byte.b $10,$04,$06 ; first chunk of freq,channel,volume 2180 c6be 2181 c6be 13 04 08 .byte.b $13,$04,$08 2182 c6c1 2183 c6c1 16 04 08 .byte.b $16,$04,$08 2184 c6c4 2185 c6c4 16 04 07 .byte.b $16,$04,$07 2186 c6c7 2187 c6c7 1c 04 09 .byte.b $1c,$04,$09 2188 c6ca 2189 c6ca 0b 0c 0f .byte.b $0b,$0c,$0f 2190 c6cd 2191 c6cd 0d 0c 0f .byte.b $0d,$0c,$0f 2192 c6d0 2193 c6d0 0e 0c 0f .byte.b $0e,$0c,$0f 2194 c6d3 2195 c6d3 0e 0c 0f .byte.b $0e,$0c,$0f 2196 c6d6 2197 c6d6 12 0c 0f .byte.b $12,$0c,$0f 2198 c6d9 2199 c6d9 03 06 0d .byte.b $03,$06,$0d 2200 c6dc 2201 c6dc 1e 0c 0a .byte.b $1e,$0c,$0a 2202 c6df 2203 c6df 1e 0c 0c .byte.b $1e,$0c,$0c 2204 c6e2 2205 c6e2 0a 06 04 .byte.b $0a,$06,$04 2206 c6e5 2207 c6e5 00 00 00 .byte.b $00,$00,$00 2208 c6e8 2209 c6e8 .skipL0168 2210 c6e8 sfx_plainlaser_lo SET #sfx_plainlaser 2212 c6e8 DMAHOLEEND0 SET . 2213 c6e8 gameend 2214 c6e8 DMAHOLEEND0 SET . 6424 bytes of ROM space left in the main area. 2215 c6e8 echo " ",[($E000 - gameend)]d , "bytes of ROM space left in the main area." 2216 c6e8 - if ($E000 - gameend) < 0 2217 c6e8 -SPACEOVERFLOW SET (SPACEOVERFLOW+1) 2218 c6e8 endif 2219 c6e8 2220 e000 ORG $E000,0 ; ************* 2221 e000 2222 e000 playership 2223 e000 00 00 HEX 0000 2224 e002 demoascii_redoiii 2225 e002 00 00 00 00* HEX 0000000000000000000000000000000000000000000000000000000000000000 2226 e022 00 00 00 00* HEX 0000000000000000000000000000000000000000000000000000000000000000 2227 e042 00 00 00 00* HEX 00000000000000000000000000000000000000000000000000 2228 e05b playershot 2229 e05b 00 00 HEX 0000 2230 e05d demoObstacle 2231 e05d ff 55 HEX ff55 2232 e05f demoObstacle_tallsprite_00 2233 e05f 01 80 HEX 0180 2234 e061 2235 e100 ORG $E100,0 ; ************* 2236 e100 2237 e100 ;playership 2238 e100 20 00 HEX 2000 2239 e102 ;demoascii_redoiii 2240 e102 00 10 00 10* HEX 0010001010441400044044004000545454100410100410044040000000101444 2241 e122 50 10 50 54* HEX 5010505440144454104454444410401444501010104444105454045400541014 2242 e142 50 14 10 14* HEX 50141014101044541044544444104004405004141044445054 2243 e15b ;playershot 2244 e15b 00 00 HEX 0000 2245 e15d ;demoObstacle 2246 e15d ff 55 HEX ff55 2247 e15f ;demoObstacle_tallsprite_00 2248 e15f 01 80 HEX 0180 2249 e161 2250 e200 ORG $E200,0 ; ************* 2251 e200 2252 e200 ;playership 2253 e200 a4 00 HEX a400 2254 e202 ;demoascii_redoiii 2255 e202 00 10 00 54* HEX 0010005454404400101054101000441040440444440444044010040040004044 2256 e222 44 44 44 40* HEX 4444444040444410444440444444404444041044105444104040040400000044 2257 e242 44 40 44 40* HEX 44404440104444104450105444444004400410445454100440 2258 e25b ;playershot 2259 e25b 00 00 HEX 0000 2260 e25d ;demoObstacle 2261 e25d 3f 54 HEX 3f54 2262 e25f ;demoObstacle_tallsprite_00 2263 e25f 05 a0 HEX 05a0 2264 e261 2265 e300 ORG $E300,0 ; ************* 2266 e300 2267 e300 ;playership 2268 e300 12 f5 HEX 12f5 2269 e302 ;demoascii_redoiii 2270 e302 00 00 00 10* HEX 0000001014104400400410101000441010040404440444040010105410105444 2271 e322 44 40 44 40* HEX 4440444040444410044440444444404444041044445410101040100400000044 2272 e342 44 40 14 54* HEX 44401454100450500444105450445014401010444454441404 2273 e35b ;playershot 2274 e35b a9 55 HEX a955 2275 e35d ;demoObstacle 2276 e35d 3f 54 HEX 3f54 2277 e35f ;demoObstacle_tallsprite_00 2278 e35f 05 a0 HEX 05a0 2279 e361 2280 e400 ORG $E400,0 ; ************* 2281 e400 2282 e400 ;playership 2283 e400 02 50 HEX 0250 2284 e402 ;demoascii_redoiii 2285 e402 00 10 00 10* HEX 0010001054101000400454540054441010105450500410140000400004105454 2286 e422 50 40 44 54* HEX 5040445450445410045040444444504450101044444410441040100444000014 2287 e442 50 14 04 44* HEX 50140444541440100440104400104444544010004444004454 2288 e45b ;playershot 2289 e45b 00 00 HEX 0000 2290 e45d ;demoObstacle 2291 e45d 0f 50 HEX 0f50 2292 e45f ;demoObstacle_tallsprite_00 2293 e45f 15 a8 HEX 15a8 2294 e461 2295 e500 ORG $E500,0 ; ************* 2296 e500 2297 e500 ;playership 2298 e500 25 00 HEX 2500 2299 e502 ;demoascii_redoiii 2300 e502 00 10 00 10* HEX 0010001050104400400410100000441004044440400444440000105410044444 2301 e522 44 40 44 40* HEX 4440444040404410044440544444444444401044444410441040100444000004 2302 e542 40 00 04 10* HEX 40000410104440000040100000005010001454000000000000 2303 e55b ;playershot 2304 e55b 00 00 HEX 0000 2305 e55d ;demoObstacle 2306 e55d 0f 50 HEX 0f50 2307 e55f ;demoObstacle_tallsprite_00 2308 e55f 15 a8 HEX 15a8 2309 e561 2310 e600 ORG $E600,0 ; ************* 2311 e600 2312 e600 ;playership 2313 e600 50 00 HEX 5000 2314 e602 ;demoascii_redoiii 2315 e602 00 10 44 54* HEX 0010445454041410101054100000445044444440440444444040040040044444 2316 e622 44 44 44 40* HEX 4444444040404410044440544444444444401044444444440440400410000050 2317 e642 40 00 04 00* HEX 40000400101040100440100000000000000010000000000000 2318 e65b ;playershot 2319 e65b 00 00 HEX 0000 2320 e65d ;demoObstacle 2321 e65d 03 40 HEX 0340 2322 e65f ;demoObstacle_tallsprite_00 2323 e65f 55 aa HEX 55aa 2324 e661 2325 e700 ORG $E700,0 ; ************* 2326 e700 2327 e700 ;playership 2328 e700 00 00 HEX 0000 2329 e702 ;demoascii_redoiii 2330 e702 00 10 44 10* HEX 0010441010440010044044000000541010104454105410104040000000501454 2331 e722 50 10 50 54* HEX 5010505454144454044440445010501050145444444444445454405410000000 2332 e742 40 00 04 00* HEX 40000400040040000040500000000000000010000000000000 2333 e75b ;playershot 2334 e75b 00 00 HEX 0000 2335 e75d ;demoObstacle 2336 e75d 03 40 HEX 0340 2337 e75f ;demoObstacle_tallsprite_00 2338 e75f 55 aa HEX 55aa 2339 e761 - if SPACEOVERFLOW > 0 2340 e761 - echo "" 2341 e761 - echo "######## ERROR: space overflow detected in",[SPACEOVERFLOW]d,"areas." 2342 e761 - echo "######## look above for areas with negative ROM space left." 2343 e761 - echo "######## Aborting assembly." 2344 e761 - ERR 2345 e761 endif 2346 e761 2347 e761 2348 e761 ; Provided under the CC0 license. See the included LICENSE.txt for details. 2349 e761 2350 e761 ifnconst bankswitchmode 2351 e761 if ( * < $f000 ) 2352 f000 ORG $F000 2353 f000 endif 2354 f000 - else 2355 f000 - ifconst ROM128K 2356 f000 - if ( * < $f000 ) 2357 f000 - ORG $27000 2358 f000 - RORG $F000 2359 f000 - endif 2360 f000 - endif 2361 f000 - ifconst ROM144K 2362 f000 - if ( * < $f000 ) 2363 f000 - ORG $27000 2364 f000 - RORG $F000 2365 f000 - endif 2366 f000 - endif 2367 f000 - ifconst ROM256K 2368 f000 - if ( * < $f000 ) 2369 f000 - ORG $47000 2370 f000 - RORG $F000 2371 f000 - endif 2372 f000 - endif 2373 f000 - ifconst ROM272K 2374 f000 - if ( * < $f000 ) 2375 f000 - ORG $47000 2376 f000 - RORG $F000 2377 f000 - endif 2378 f000 - endif 2379 f000 - ifconst ROM512K 2380 f000 - if ( * < $f000 ) 2381 f000 - ORG $87000 2382 f000 - RORG $F000 2383 f000 - endif 2384 f000 - endif 2385 f000 - ifconst ROM528K 2386 f000 - if ( * < $f000 ) 2387 f000 - ORG $87000 2388 f000 - RORG $F000 2389 f000 - endif 2390 f000 - endif 2391 f000 endif 2392 f000 2393 f000 ; all of these "modules" have conditional clauses in them, so even though 2394 f000 ; they're always included here, they don't take up rom unless the user 2395 f000 ; explicitly enables support for the feature. 2396 f000 2397 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 2399 f000 endif 2400 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 2402 f000 endif 2403 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 2405 f000 endif 2406 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 2408 f000 endif 2409 f000 ; Provided under the CC0 license. See the included LICENSE.txt for details. 2410 f000 2411 f000 ;standard routimes needed for pretty much all games 2412 f000 2413 f000 ; some definitions used with "set debug color" 2414 f000 00 91 DEBUGCALC = $91 2415 f000 00 41 DEBUGWASTE = $41 2416 f000 00 c1 DEBUGDRAW = $C1 2417 f000 2418 f000 ;NMI and IRQ handlers 2419 f000 NMI 2420 f000 ;VISIBLEOVER is 255 while the screen is drawn, and 0 right after the visible screen is done. 2421 f000 48 pha ; save A 2422 f001 d8 cld 2423 f002 a5 4d lda visibleover 2424 f004 49 ff eor #255 2425 f006 85 4d sta visibleover 2426 f008 - ifconst DEBUGINTERRUPT 2427 f008 - and #$93 2428 f008 - sta BACKGRND 2429 f008 endif 2430 f008 8a txa ; save X 2431 f009 48 pha 2432 f00a 98 tya ; save Y 2433 f00b 48 pha 2434 f00c ce b2 01 dec interruptindex 2435 f00f d0 03 bne skipreallyoffvisible 2436 f011 4c 6b f0 jmp reallyoffvisible 2437 f014 skipreallyoffvisible 2438 f014 a5 4d lda visibleover 2439 f016 d0 03 bne carryontopscreenroutine 2440 f018 - ifconst .bottomscreenroutine 2441 f018 - lda interrupthold 2442 f018 - beq skipbottomroutine 2443 f018 - jsr .bottomscreenroutine 2444 f018 -skipbottomroutine 2445 f018 endif 2446 f018 4c 79 f0 jmp NMIexit 2447 f01b carryontopscreenroutine 2448 f01b - ifconst .topscreenroutine 2449 f01b - lda interrupthold 2450 f01b - beq skiptoproutine 2451 f01b - jsr .topscreenroutine 2452 f01b -skiptoproutine 2453 f01b endif 2454 f01b ifnconst CANARYOFF 2455 f01b ad c1 01 lda canary 2456 f01e f0 07 beq skipcanarytriggered 2457 f020 a9 45 lda #$45 2458 f022 85 20 sta BACKGRND 2459 f024 4c 63 f0 jmp skipbrkolorset ; common crash dump routine, if available 2460 f027 skipcanarytriggered 2461 f027 endif 2462 f027 2463 f027 ee 3e 21 inc frameslost ; this is balanced with a "dec frameslost" when drawscreen is called. 2464 f02a 2465 f02a ; ** Other important routines that need to regularly run, and can run onscreen. 2466 f02a ; ** Atarivox can't go here, because Maria might interrupt it while it's bit-banging. 2467 f02a 2468 f02a - ifconst LONGCONTROLLERREAD 2469 f02a -longcontrollerreads ; ** controllers that take a lot of time to read. We use much of the visible screen here. 2470 f02a - ldy port1control 2471 f02a - lda longreadtype,y 2472 f02a - beq LLRET1 2473 f02a - tay 2474 f02a - lda longreadroutinehiP1,y 2475 f02a - sta inttemp4 2476 f02a - lda longreadroutineloP1,y 2477 f02a - sta inttemp3 2478 f02a - jmp (inttemp3) 2479 f02a -LLRET1 2480 f02a - ldy port0control 2481 f02a - lda longreadtype,y 2482 f02a - beq LLRET0 2483 f02a - tay 2484 f02a - lda longreadroutinehiP0,y 2485 f02a - sta inttemp4 2486 f02a - lda longreadroutineloP0,y 2487 f02a - sta inttemp3 2488 f02a - jmp (inttemp3) 2489 f02a -LLRET0 2490 f02a - 2491 f02a - 2492 f02a - ifconst PADDLERANGE 2493 f02a -TIMEVAL = PADDLERANGE 2494 f02a - else 2495 f02a -TIMEVAL = 160 2496 f02a - endif 2497 f02a -TIMEOFFSET = 10 2498 f02a - 2499 f02a endif ; LONGCONTROLLERREAD 2500 f02a 2501 f02a 2502 f02a 20 d8 f1 jsr servicesfxchannels 2503 f02d - ifconst MUSICTRACKER 2504 f02d - jsr servicesong 2505 f02d endif ; MUSICTRACKER 2506 f02d 2507 f02d ee a4 01 inc framecounter 2508 f030 ad a4 01 lda framecounter 2509 f033 29 3f and #63 2510 f035 d0 08 bne skipcountdownseconds 2511 f037 ad a5 01 lda countdownseconds 2512 f03a f0 03 beq skipcountdownseconds 2513 f03c ce a5 01 dec countdownseconds 2514 f03f skipcountdownseconds 2515 f03f 2516 f03f a2 01 ldx #1 2517 f041 buttonreadloop 2518 f041 8a txa 2519 f042 48 pha 2520 f043 bc b7 01 ldy port0control,x 2521 f046 b9 bb f1 lda buttonhandlerlo,y 2522 f049 85 da sta inttemp3 2523 f04b b9 b0 f1 lda buttonhandlerhi,y 2524 f04e 85 db sta inttemp4 2525 f050 05 da ora inttemp3 2526 f052 f0 03 beq buttonreadloopreturn 2527 f054 6c da 00 jmp (inttemp3) 2528 f057 buttonreadloopreturn 2529 f057 68 pla 2530 f058 aa tax 2531 f059 ca dex 2532 f05a 10 e5 bpl buttonreadloop 2533 f05c 2534 f05c - ifconst KEYPADSUPPORT 2535 f05c - jsr keypadrowselect 2536 f05c endif ; KEYPADSUPPORT 2537 f05c 2538 f05c 2539 f05c - ifconst DOUBLEBUFFER 2540 f05c - lda doublebufferminimumframeindex 2541 f05c - beq skipdoublebufferminimumframeindexadjust 2542 f05c - dec doublebufferminimumframeindex 2543 f05c -skipdoublebufferminimumframeindexadjust 2544 f05c endif 2545 f05c 2546 f05c 4c 79 f0 jmp NMIexit 2547 f05f 2548 f05f IRQ ; the only source of non-nmi interrupt should be the BRK opcode. 2549 f05f ifnconst BREAKPROTECTOFF 2550 f05f a9 1a lda #$1A 2551 f061 85 20 sta BACKGRND 2552 f063 skipbrkolorset 2553 f063 skipbrkdetected 2554 f063 a9 60 lda #$60 2555 f065 8d 07 21 sta sCTRL 2556 f068 85 3c sta CTRL 2557 f06a ifnconst hiscorefont 2558 f06a 02 .byte.b $02 ; KIL/JAM 2559 f06b - else ; hiscorefont is present 2560 f06b - ifconst CRASHDUMP 2561 f06b - bit MSTAT 2562 f06b - bpl skipbrkdetected ; wait for vblank to ensure we're clear of NMI 2563 f06b - 2564 f06b - ifconst dumpbankswitch 2565 f06b - lda dumpbankswitch 2566 f06b - pha 2567 f06b - endif 2568 f06b - 2569 f06b - ; bankswitch if needed, to get to the hiscore font 2570 f06b - ifconst bankswitchmode 2571 f06b - ifconst included.hiscore.asm.bank 2572 f06b - ifconst MCPDEVCART 2573 f06b - lda #($18 | included.hiscore.asm.bank) 2574 f06b - sta $3000 2575 f06b - else 2576 f06b - lda #(included.hiscore.asm.bank) 2577 f06b - sta $8000 2578 f06b - endif 2579 f06b - endif ; included.hiscore.asm.bank 2580 f06b - endif ; bankswitchmode 2581 f06b - 2582 f06b - ifconst DOUBLEBUFFER 2583 f06b - ;turn off double-buffering, if on... 2584 f06b - lda #>DLLMEM 2585 f06b - sta DPPH 2586 f06b - lda #hiscorefont 2630 f06b - sta CHARBASE 2631 f06b - sta sCHARBASE 2632 f06b - lda #%01000011 ;Enable DMA, mode=320A 2633 f06b - sta CTRL 2634 f06b - sta sCTRL 2635 f06b - .byte $02 ; KIL/JAM 2636 f06b -hiscorehexlut 2637 f06b - ; 0 1 2 3 4 5 6 7 8 9 A B C D E F 2638 f06b - .byte 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 0, 1, 2, 3, 4, 5 2639 f06b -show2700 2640 f06b - ; lo mode hi width=29 x EODL 2641 f06b - .byte $00, %01100000, $27, 3, 20, 0,0,0 2642 f06b - else ; CRASHDUMP 2643 f06b - .byte $02 ; KIL/JAM 2644 f06b - endif ; crashdump 2645 f06b endif ; hiscorefont 2646 f06b - else 2647 f06b - RTI 2648 f06b endif 2649 f06b 2650 f06b - ifconst LONGCONTROLLERREAD 2651 f06b - 2652 f06b -longreadtype 2653 f06b - .byte 0, 0, 0, 1 ; NONE PROLINE LIGHTGUN PADDLE 2654 f06b - .byte 2, 0, 3, 0 ; TRKBALL VCSSTICK DRIVING KEYPAD 2655 f06b - .byte 3, 3, 0 ; STMOUSE AMOUSE ATARIVOX 2656 f06b - 2657 f06b -longreadroutineloP0 2658 f06b - .byte LLRET0 ; 0 = no routine 2665 f06b - .byte >paddleport0update ; 1 = paddle 2666 f06b - .byte >trakball0update ; 2 = trackball 2667 f06b - .byte >mouse0update ; 3 = mouse 2668 f06b - 2669 f06b -longreadroutineloP1 2670 f06b - .byte LLRET1 ; 0 = no routine 2677 f06b - .byte >paddleport1update ; 1 = paddle 2678 f06b - .byte >trakball1update ; 2 = trackball 2679 f06b - .byte >mouse1update ; 3 = mouse 2680 f06b - 2681 f06b - 2682 f06b -SETTIM64T 2683 f06b - bne skipdefaulttime 2684 f06b - ifnconst PADDLESMOOTHINGOFF 2685 f06b - lda #(TIMEVAL+TIMEOFFSET+1) 2686 f06b - else 2687 f06b - lda #(TIMEVAL+TIMEOFFSET) 2688 f06b - endif 2689 f06b -skipdefaulttime 2690 f06b - tay 2691 f06b - dey 2692 f06b -.setTIM64Tloop 2693 f06b - sta TIM64T 2694 f06b - cpy INTIM 2695 f06b - bne .setTIM64Tloop 2696 f06b - rts 2697 f06b endif ; LONGCONTROLLERREAD 2698 f06b 2699 f06b reallyoffvisible 2700 f06b 85 24 sta WSYNC 2701 f06d 2702 f06d a9 00 lda #0 2703 f06f 85 4d sta visibleover 2704 f071 - ifconst DEBUGINTERRUPT 2705 f071 - sta BACKGRND 2706 f071 endif 2707 f071 2708 f071 a9 03 lda #3 2709 f073 8d b2 01 sta interruptindex 2710 f076 2711 f076 20 52 f1 jsr uninterruptableroutines 2712 f079 2713 f079 - ifconst .userinterrupt 2714 f079 - lda interrupthold 2715 f079 - beq skipuserintroutine 2716 f079 - jsr .userinterrupt 2717 f079 -skipuserintroutine 2718 f079 endif 2719 f079 2720 f079 - ifconst KEYPADSUPPORT 2721 f079 - jsr keypadcolumnread 2722 f079 endif 2723 f079 2724 f079 NMIexit 2725 f079 68 pla 2726 f07a a8 tay 2727 f07b 68 pla 2728 f07c aa tax 2729 f07d 68 pla 2730 f07e 40 RTI 2731 f07f 2732 f07f clearscreen 2733 f07f a2 19 ldx #(WZONECOUNT-1) 2734 f081 a9 00 lda #0 2735 f083 clearscreenloop 2736 f083 95 65 sta dlend,x 2737 f085 ca dex 2738 f086 10 fb bpl clearscreenloop 2739 f088 a9 00 lda #0 2740 f08a 8d ad 01 sta valbufend ; clear the bcd value buffer 2741 f08d 8d ae 01 sta valbufendsave 2742 f090 60 rts 2743 f091 2744 f091 restorescreen 2745 f091 a2 19 ldx #(WZONECOUNT-1) 2746 f093 a9 00 lda #0 2747 f095 restorescreenloop 2748 f095 b5 82 lda dlendsave,x 2749 f097 95 65 sta dlend,x 2750 f099 ca dex 2751 f09a 10 f9 bpl restorescreenloop 2752 f09c ad ae 01 lda valbufendsave 2753 f09f 8d ad 01 sta valbufend 2754 f0a2 60 rts 2755 f0a3 2756 f0a3 savescreen 2757 f0a3 a2 19 ldx #(WZONECOUNT-1) 2758 f0a5 savescreenloop 2759 f0a5 b5 65 lda dlend,x 2760 f0a7 95 82 sta dlendsave,x 2761 f0a9 ca dex 2762 f0aa 10 f9 bpl savescreenloop 2763 f0ac ad ad 01 lda valbufend 2764 f0af 8d ae 01 sta valbufendsave 2765 f0b2 - ifconst DOUBLEBUFFER 2766 f0b2 - lda doublebufferstate 2767 f0b2 - beq savescreenrts 2768 f0b2 - lda #1 2769 f0b2 - sta doublebufferbufferdirty 2770 f0b2 -savescreenrts 2771 f0b2 endif ; DOUBLEBUFFER 2772 f0b2 60 rts 2773 f0b3 2774 f0b3 drawscreen 2775 f0b3 2776 f0b3 - ifconst interrupthold 2777 f0b3 - lda #$FF 2778 f0b3 - sta interrupthold ; if the user called drawscreen, we're ready for interrupts 2779 f0b3 endif 2780 f0b3 2781 f0b3 a9 00 lda #0 2782 f0b5 85 42 sta temp1 ; not B&W if we're here... 2783 f0b7 2784 f0b7 drawscreenwait 2785 f0b7 a5 4d lda visibleover 2786 f0b9 d0 fc bne drawscreenwait ; make sure the visible screen isn't being drawn 2787 f0bb 2788 f0bb ;restore some registers in case the game changed them mid-screen... 2789 f0bb ad 07 21 lda sCTRL 2790 f0be 05 42 ora temp1 2791 f0c0 85 3c sta CTRL 2792 f0c2 ad 0b 21 lda sCHARBASE 2793 f0c5 85 34 sta CHARBASE 2794 f0c7 2795 f0c7 ;ensure all of the display list is terminated... 2796 f0c7 20 38 f1 jsr terminatedisplaylist 2797 f0ca 2798 f0ca ifnconst pauseroutineoff 2799 f0ca 20 d5 f0 jsr pauseroutine 2800 f0cd endif ; pauseroutineoff 2801 f0cd 2802 f0cd ; Make sure the visible screen has *started* before we exit. That way we can rely on drawscreen 2803 f0cd ; delaying a full frame, but still allowing time for basic calculations. 2804 f0cd visiblescreenstartedwait 2805 f0cd a5 4d lda visibleover 2806 f0cf f0 fc beq visiblescreenstartedwait 2807 f0d1 visiblescreenstartedwaitdone 2808 f0d1 ce 3e 21 dec frameslost ; ; this gets balanced with an "inc frameslost" by an NMI at the top of the screen 2809 f0d4 60 rts 2810 f0d5 2811 f0d5 ifnconst pauseroutineoff 2812 f0d5 ; check to see if pause was pressed and released 2813 f0d5 pauseroutine 2814 f0d5 ad b3 01 lda pausedisable 2815 f0d8 d0 4e bne leavepauseroutine 2816 f0da a9 08 lda #8 2817 f0dc 2c 82 02 bit SWCHB 2818 f0df f0 29 beq pausepressed 2819 f0e1 2820 f0e1 ifnconst SOFTRESETASPAUSEOFF 2821 f0e1 ifnconst MOUSESUPPORT 2822 f0e1 ifnconst TRAKBALLSUPPORT 2823 f0e1 ad 80 02 lda SWCHA ; then check the soft "RESET" joysick code... 2824 f0e4 29 70 and #%01110000 ; _LDU 2825 f0e6 f0 22 beq pausepressed 2826 f0e8 endif 2827 f0e8 endif 2828 f0e8 endif 2829 f0e8 2830 f0e8 ;pause isn't pressed 2831 f0e8 a9 00 lda #0 2832 f0ea 8d ac 01 sta pausebuttonflag ; clear pause hold state in case its set 2833 f0ed 2834 f0ed ;check if we're in an already paused state 2835 f0ed ad 00 21 lda pausestate 2836 f0f0 f0 36 beq leavepauseroutine ; nope, leave 2837 f0f2 2838 f0f2 c9 01 cmp #1 ; last frame was the start of pausing 2839 f0f4 f0 2b beq enterpausestate2 ; move from state 1 to 2 2840 f0f6 2841 f0f6 c9 02 cmp #2 2842 f0f8 f0 34 beq carryonpausing 2843 f0fa 2844 f0fa ;pausestate must be >2, which means we're ending an unpause 2845 f0fa a9 00 lda #0 2846 f0fc 8d ac 01 sta pausebuttonflag 2847 f0ff 8d 00 21 sta pausestate 2848 f102 ad 07 21 lda sCTRL 2849 f105 85 3c sta CTRL 2850 f107 4c 28 f1 jmp leavepauseroutine 2851 f10a 2852 f10a pausepressed 2853 f10a ;pause is pressed 2854 f10a ad ac 01 lda pausebuttonflag 2855 f10d c9 ff cmp #$ff 2856 f10f f0 1d beq carryonpausing 2857 f111 2858 f111 ;its a new press, increment the state 2859 f111 ee 00 21 inc pausestate 2860 f114 2861 f114 ;silence volume at the start and end of pausing 2862 f114 a9 00 lda #0 2863 f116 85 19 sta AUDV0 2864 f118 85 1a sta AUDV1 2865 f11a 2866 f11a - ifconst pokeysupport 2867 f11a - ldy #7 2868 f11a -pausesilencepokeyaudioloop 2869 f11a - sta (pokeybase),y 2870 f11a - dey 2871 f11a - bpl pausesilencepokeyaudioloop 2872 f11a endif ; pokeysupport 2873 f11a 2874 f11a a9 ff lda #$ff 2875 f11c 8d ac 01 sta pausebuttonflag 2876 f11f d0 0d bne carryonpausing 2877 f121 2878 f121 enterpausestate2 2879 f121 a9 02 lda #2 2880 f123 8d 00 21 sta pausestate 2881 f126 d0 06 bne carryonpausing 2882 f128 leavepauseroutine 2883 f128 ad 07 21 lda sCTRL 2884 f12b 85 3c sta CTRL 2885 f12d 60 rts 2886 f12e carryonpausing 2887 f12e - ifconst .pause 2888 f12e - jsr .pause 2889 f12e endif ; .pause 2890 f12e ad 07 21 lda sCTRL 2891 f131 09 80 ora #%10000000 ; turn off colorburst during pause... 2892 f133 85 3c sta CTRL 2893 f135 4c d5 f0 jmp pauseroutine 2894 f138 endif ; pauseroutineoff 2895 f138 2896 f138 2897 f138 - ifconst DOUBLEBUFFER 2898 f138 -skipterminatedisplaylistreturn 2899 f138 - rts 2900 f138 endif ; DOUBLEBUFFER 2901 f138 terminatedisplaylist 2902 f138 - ifconst DOUBLEBUFFER 2903 f138 - lda doublebufferstate 2904 f138 - bne skipterminatedisplaylistreturn ; double-buffering runs it's own DL termination code 2905 f138 endif ; DOUBLEBUFFER 2906 f138 terminatedisplaybuffer 2907 f138 ;add DL end entry on each DL 2908 f138 a2 19 ldx #(WZONECOUNT-1) 2909 f13a dlendloop 2910 f13a bd fa f5 lda DLPOINTL,x 2911 f13d - ifconst DOUBLEBUFFER 2912 f13d - clc 2913 f13d - adc doublebufferdloffset 2914 f13d endif ; DOUBLEBUFFER 2915 f13d 85 63 sta dlpnt 2916 f13f bd e0 f5 lda DLPOINTH,x 2917 f142 - ifconst DOUBLEBUFFER 2918 f142 - adc #0 2919 f142 endif ; DOUBLEBUFFER 2920 f142 85 64 sta dlpnt+1 2921 f144 b4 65 ldy dlend,x 2922 f146 a9 00 lda #$00 2923 f148 dlendmoreloops 2924 f148 c8 iny 2925 f149 91 63 sta (dlpnt),y 2926 f14b - ifconst FRAMESKIPGLITCHFIXWEAK 2927 f14b - cpy #DLLASTOBJ+1 2928 f14b - beq dlendthiszonedone 2929 f14b - iny 2930 f14b - iny 2931 f14b - iny 2932 f14b - iny 2933 f14b - iny 2934 f14b - sta (dlpnt),y 2935 f14b -dlendthiszonedone 2936 f14b endif FRAMESKIPGLITCHFIXWEAK 2937 f14b - ifconst FRAMESKIPGLITCHFIX 2938 f14b - iny 2939 f14b - iny 2940 f14b - iny 2941 f14b - iny 2942 f14b - cpy #DLLASTOBJ-1 2943 f14b - bcc dlendmoreloops 2944 f14b endif ; FRAMESKIPGLITCHFIX 2945 f14b ca dex 2946 f14c 10 ec bpl dlendloop 2947 f14e 2948 f14e ifnconst pauseroutineoff 2949 f14e 20 d5 f0 jsr pauseroutine 2950 f151 endif ; pauseroutineoff 2951 f151 60 rts 2952 f152 2953 f152 uninterruptableroutines 2954 f152 ; this is for routines that must happen off the visible screen, each frame. 2955 f152 2956 f152 - ifconst AVOXVOICE 2957 f152 - jsr serviceatarivoxqueue 2958 f152 endif 2959 f152 2960 f152 a9 00 lda #0 2961 f154 8d b6 01 sta palfastframe 2962 f157 ad 09 21 lda paldetected 2963 f15a f0 10 beq skippalframeadjusting 2964 f15c ; ** PAL console is detected. we increment palframes to accurately count 5 frames, 2965 f15c ae b5 01 ldx palframes 2966 f15f e8 inx 2967 f160 e0 05 cpx #5 2968 f162 d0 05 bne palframeskipdone 2969 f164 ee b6 01 inc palfastframe 2970 f167 a2 00 ldx #0 2971 f169 palframeskipdone 2972 f169 8e b5 01 stx palframes 2973 f16c skippalframeadjusting 2974 f16c 2975 f16c - ifconst MUSICTRACKER 2976 f16c - ; We normally run the servicesong routine from the top-screen interrupt, but if it 2977 f16c - ; happens to interrupt the scheduling of a sound effect in the game code, we skip it. 2978 f16c - ; If that happens, we try again here. Chances are very small we'll run into the same 2979 f16c - ; problem twice, and if we do, we just drop a musical note or two. 2980 f16c - lda sfxschedulemissed 2981 f16c - beq servicesongwasnotmissed 2982 f16c - jsr servicesong 2983 f16c -servicesongwasnotmissed 2984 f16c endif ; MUSICTRACKER 2985 f16c 2986 f16c 60 rts 2987 f16d 2988 f16d serviceatarivoxqueue 2989 f16d - ifconst AVOXVOICE 2990 f16d - lda voxlock 2991 f16d - bne skipvoxprocessing ; the vox is in the middle of speech address update 2992 f16d -skipvoxqueuesizedec 2993 f16d - jmp processavoxvoice 2994 f16d -skipvoxprocessing 2995 f16d - rts 2996 f16d - 2997 f16d -processavoxvoice 2998 f16d - lda avoxenable 2999 f16d - bne avoxfixport 3000 f16d - SPKOUT tempavox 3001 f16d - rts 3002 f16d -avoxfixport 3003 f16d - lda #0 ; restore the port to all bits as inputs... 3004 f16d - sta CTLSWA 3005 f16d - rts 3006 f16d -silenceavoxvoice 3007 f16d - SPEAK avoxsilentdata 3008 f16d - rts 3009 f16d -avoxsilentdata 3010 f16d - .byte 31,255 3011 f16d else 3012 f16d 60 rts 3013 f16e endif ; AVOXVOICE 3014 f16e 3015 f16e joybuttonhandler 3016 f16e 8a txa 3017 f16f 0a asl 3018 f170 a8 tay 3019 f171 b9 08 00 lda INPT0,y 3020 f174 4a lsr 3021 f175 9d 02 21 sta sINPT1,x 3022 f178 b9 09 00 lda INPT1,y 3023 f17b 29 80 and #%10000000 3024 f17d 1d 02 21 ora sINPT1,x 3025 f180 9d 02 21 sta sINPT1,x 3026 f183 3027 f183 b5 0c lda INPT4,x 3028 f185 30 19 bmi .skip1bjoyfirecheck 3029 f187 ;one button joystick is down 3030 f187 49 80 eor #%10000000 3031 f189 9d 02 21 sta sINPT1,x 3032 f18c 3033 f18c ad b1 01 lda joybuttonmode 3034 f18f 3d a3 f1 and twobuttonmask,x 3035 f192 f0 0c beq .skip1bjoyfirecheck 3036 f194 ad b1 01 lda joybuttonmode 3037 f197 1d a3 f1 ora twobuttonmask,x 3038 f19a 8d b1 01 sta joybuttonmode 3039 f19d 8d 82 02 sta SWCHB 3040 f1a0 .skip1bjoyfirecheck 3041 f1a0 4c 57 f0 jmp buttonreadloopreturn 3042 f1a3 3043 f1a3 twobuttonmask 3044 f1a3 04 10 .byte.b %00000100,%00010000 3045 f1a5 3046 f1a5 gunbuttonhandler ; outside of the conditional, so our button handler LUT is valid 3047 f1a5 - ifconst LIGHTGUNSUPPORT 3048 f1a5 - cpx #0 3049 f1a5 - bne secondportgunhandler 3050 f1a5 -firstportgunhandler 3051 f1a5 - lda SWCHA 3052 f1a5 - asl 3053 f1a5 - asl 3054 f1a5 - asl ; shift D4 to D7 3055 f1a5 - and #%10000000 3056 f1a5 - eor #%10000000 3057 f1a5 - sta sINPT1 3058 f1a5 - jmp buttonreadloopreturn 3059 f1a5 -secondportgunhandler 3060 f1a5 - lda SWCHA 3061 f1a5 - lsr ; shift D0 into carry 3062 f1a5 - lsr ; shift carry into D7 3063 f1a5 - and #%10000000 3064 f1a5 - eor #%10000000 3065 f1a5 - sta sINPT3 3066 f1a5 - jmp buttonreadloopreturn 3067 f1a5 endif ; LIGHTGUNSUPPORT 3068 f1a5 3069 f1a5 controlsusing2buttoncode 3070 f1a5 00 .byte.b 0 ; 00=no controller plugged in 3071 f1a6 01 .byte.b 1 ; 01=proline joystick 3072 f1a7 00 .byte.b 0 ; 02=lightgun 3073 f1a8 00 .byte.b 0 ; 03=paddle 3074 f1a9 01 .byte.b 1 ; 04=trakball 3075 f1aa 01 .byte.b 1 ; 05=vcs joystick 3076 f1ab 01 .byte.b 1 ; 06=driving control 3077 f1ac 00 .byte.b 0 ; 07=keypad control 3078 f1ad 00 .byte.b 0 ; 08=st mouse/cx80 3079 f1ae 00 .byte.b 0 ; 09=amiga mouse 3080 f1af 01 .byte.b 1 ; 10=atarivox 3081 f1b0 3082 f1b0 buttonhandlerhi 3083 f1b0 00 .byte.b 0 ; 00=no controller plugged in 3084 f1b1 f1 .byte.b >joybuttonhandler ; 01=proline joystick 3085 f1b2 f1 .byte.b >gunbuttonhandler ; 02=lightgun 3086 f1b3 f4 .byte.b >paddlebuttonhandler ; 03=paddle 3087 f1b4 f1 .byte.b >joybuttonhandler ; 04=trakball 3088 f1b5 f1 .byte.b >joybuttonhandler ; 05=vcs joystick 3089 f1b6 f1 .byte.b >joybuttonhandler ; 06=driving control 3090 f1b7 00 .byte.b 0 ; 07=keypad 3091 f1b8 f4 .byte.b >mousebuttonhandler ; 08=st mouse 3092 f1b9 f4 .byte.b >mousebuttonhandler ; 09=amiga mouse 3093 f1ba f1 .byte.b >joybuttonhandler ; 10=atarivox 3094 f1bb buttonhandlerlo 3095 f1bb 00 .byte.b 0 ; 00=no controller plugged in 3096 f1bc 6e .byte.b $0F means the sound is looped while priority is active 3197 f219 3198 f219 05 d9 ora inttemp2 3199 f21b 05 d8 ora inttemp1 ; check if F|C|V=0 3200 f21d f0 23 beq zerosfx ; if so, we're at the end of the sound. 3201 f21f 3202 f21f advancesfxpointer 3203 f21f ; advance the pointer to the next sound chunk 3204 f21f c8 iny 3205 f220 84 da sty inttemp3 3206 f222 18 clc 3207 f223 b5 4e lda sfx1pointlo,x 3208 f225 65 da adc inttemp3 3209 f227 95 4e sta sfx1pointlo,x 3210 f229 b5 50 lda sfx1pointhi,x 3211 f22b 69 00 adc #0 3212 f22d 95 50 sta sfx1pointhi,x 3213 f22f 4c da f1 jmp servicesfxchannelsloop 3214 f232 3215 f232 sfxsoundloop 3216 f232 48 pha 3217 f233 b5 52 lda sfx1priority,x 3218 f235 d0 04 bne sfxsoundloop_carryon 3219 f237 68 pla ; fix the stack before we go 3220 f238 4c 1f f2 jmp advancesfxpointer 3221 f23b sfxsoundloop_carryon 3222 f23b 68 pla 3223 f23c 29 f0 and #$F0 3224 f23e 4a lsr 3225 f23f 4a lsr 3226 f240 4a lsr 3227 f241 4a lsr 3228 f242 3229 f242 zerosfx 3230 f242 95 4e sta sfx1pointlo,x 3231 f244 95 50 sta sfx1pointhi,x 3232 f246 95 52 sta sfx1priority,x 3233 f248 4c da f1 jmp servicesfxchannelsloop 3234 f24b 3235 f24b 3236 f24b schedulesfx 3237 f24b ; called with sfxinstrumentlo=data sfxpitchoffset=pitch-offset sfxnoteindex=note index 3238 f24b a0 00 ldy #0 3239 f24d b1 e0 lda (sfxinstrumentlo),y 3240 f24f - ifconst pokeysupport 3241 f24f - cmp #$20 ; POKEY? 3242 f24f - bne scheduletiasfx 3243 f24f - jmp schedulepokeysfx 3244 f24f endif 3245 f24f scheduletiasfx 3246 f24f ;cmp #$10 ; TIA? 3247 f24f ;beq continuescheduletiasfx 3248 f24f ; rts ; unhandled!!! 3249 f24f continuescheduletiasfx 3250 f24f ifnconst TIASFXMONO 3251 f24f a5 4e lda sfx1pointlo 3252 f251 05 50 ora sfx1pointhi 3253 f253 f0 13 beq schedulesfx1 ;if channel 1 is idle, use it 3254 f255 a5 4f lda sfx2pointlo 3255 f257 05 51 ora sfx2pointhi 3256 f259 f0 11 beq schedulesfx2 ;if channel 2 is idle, use it 3257 f25b ; Both channels are scheduled. 3258 f25b a0 01 ldy #1 3259 f25d b1 e0 lda (sfxinstrumentlo),y 3260 f25f d0 01 bne interruptsfx 3261 f261 60 rts ; the new sound has 0 priority and both channels are busy. Skip playing it. 3262 f262 interruptsfx 3263 f262 ;Compare which active sound has a lower priority. We'll interrupt the lower one. 3264 f262 a5 52 lda sfx1priority 3265 f264 c5 53 cmp sfx2priority 3266 f266 b0 04 bcs schedulesfx2 3267 f268 endif ; !TIASFXMONO 3268 f268 3269 f268 schedulesfx1 3270 f268 a2 00 ldx #0 ; channel 1 3271 f26a ifnconst TIASFXMONO 3272 f26a f0 02 beq skipschedulesfx2 3273 f26c schedulesfx2 3274 f26c a2 01 ldx #1 ; channel 2 3275 f26e skipschedulesfx2 3276 f26e endif ; !TIASFXMONO 3277 f26e 3278 f26e - ifconst MUSICTRACKER 3279 f26e - lda sfxnoteindex 3280 f26e - bpl skipdrumkitoverride 3281 f26e - and #$7F ; subtract 128 3282 f26e - sec 3283 f26e - sbc #4 ; drums start at 132, i.e. octave 10 3284 f26e - asl 3285 f26e - tay 3286 f26e - lda tiadrumkitdefinition,y 3287 f26e - sta sfxinstrumentlo 3288 f26e - iny 3289 f26e - lda tiadrumkitdefinition,y 3290 f26e - sta sfxinstrumenthi 3291 f26e - lda #0 3292 f26e - sta sfxnoteindex ; and tell the driver it's a non-pitched instrument 3293 f26e -skipdrumkitoverride 3294 f26e endif ; MUSICTRACKER 3295 f26e a0 01 ldy #1 ; get priority and sound-resolution (in frames) 3296 f270 b1 e0 lda (sfxinstrumentlo),y 3297 f272 95 52 sta sfx1priority,x 3298 f274 c8 iny 3299 f275 b1 e0 lda (sfxinstrumentlo),y 3300 f277 95 56 sta sfx1frames,x 3301 f279 a5 e0 lda sfxinstrumentlo 3302 f27b 18 clc 3303 f27c 69 03 adc #3 3304 f27e 95 4e sta sfx1pointlo,x 3305 f280 a5 e1 lda sfxinstrumenthi 3306 f282 69 00 adc #0 3307 f284 95 50 sta sfx1pointhi,x 3308 f286 a5 e2 lda sfxpitchoffset 3309 f288 95 54 sta sfx1poffset,x 3310 f28a a9 00 lda #0 3311 f28c 95 58 sta sfx1tick,x 3312 f28e a5 e3 lda sfxnoteindex 3313 f290 95 cd sta sfx1notedata,x 3314 f292 60 rts 3315 f293 3316 f293 plotsprite 3317 f293 ifnconst NODRAWWAIT 3318 f293 - ifconst DOUBLEBUFFER 3319 f293 - lda doublebufferstate 3320 f293 - bne skipplotspritewait 3321 f293 endif ; DOUBLEBUFFER 3322 f293 - ifconst DEBUGWAITCOLOR 3323 f293 - lda #$41 3324 f293 - sta BACKGRND 3325 f293 endif 3326 f293 plotspritewait 3327 f293 a5 4d lda visibleover 3328 f295 d0 fc bne plotspritewait 3329 f297 skipplotspritewait 3330 f297 - ifconst DEBUGWAITCOLOR 3331 f297 - lda #$0 3332 f297 - sta BACKGRND 3333 f297 endif 3334 f297 endif 3335 f297 3336 f297 ;arguments: 3337 f297 ; temp1=lo graphicdata 3338 f297 ; temp2=hi graphicdata 3339 f297 ; temp3=palette | width byte 3340 f297 ; temp4=x 3341 f297 ; temp5=y 3342 f297 ; temp6=mode 3343 f297 a5 46 lda temp5 ;Y position 3344 f299 4a lsr ; 2 - Divide by 8 or 16 3345 f29a 4a lsr ; 2 3346 f29b 4a lsr ; 2 3347 f29c - if WZONEHEIGHT = 16 3348 f29c - lsr ; 2 3349 f29c endif 3350 f29c 3351 f29c aa tax 3352 f29d 3353 f29d ifnconst NOLIMITCHECKING 3354 f29d 3355 f29d ; the next block allows for vertical masking, and ensures we don't overwrite non-DL memory 3356 f29d 3357 f29d c9 1a cmp #WZONECOUNT 3358 f29f 3359 f29f 90 0a bcc continueplotsprite1 ; the sprite is fully on-screen, so carry on... 3360 f2a1 ; otherwise, check to see if the bottom half is in zone 0... 3361 f2a1 3362 f2a1 - if WZONEHEIGHT = 16 3363 f2a1 - cmp #15 3364 f2a1 else 3365 f2a1 c9 1f cmp #31 3366 f2a3 endif 3367 f2a3 3368 f2a3 d0 05 bne exitplotsprite1 3369 f2a5 a2 00 ldx #0 3370 f2a7 4c e4 f2 jmp continueplotsprite2 3371 f2aa exitplotsprite1 3372 f2aa 60 rts 3373 f2ab 3374 f2ab continueplotsprite1 3375 f2ab endif 3376 f2ab 3377 f2ab bd fa f5 lda DLPOINTL,x ;Get pointer to DL that this sprite starts in 3378 f2ae - ifconst DOUBLEBUFFER 3379 f2ae - clc 3380 f2ae - adc doublebufferdloffset 3381 f2ae endif ; DOUBLEBUFFER 3382 f2ae 85 63 sta dlpnt 3383 f2b0 bd e0 f5 lda DLPOINTH,x 3384 f2b3 - ifconst DOUBLEBUFFER 3385 f2b3 - adc #0 3386 f2b3 endif ; DOUBLEBUFFER 3387 f2b3 85 64 sta dlpnt+1 3388 f2b5 3389 f2b5 ;Create DL entry for upper part of sprite 3390 f2b5 3391 f2b5 b4 65 ldy dlend,x ;Get the index to the end of this DL 3392 f2b7 3393 f2b7 ifconst CHECKOVERWRITE 3394 f2b7 c0 46 cpy #DLLASTOBJ 3395 f2b9 f0 21 beq checkcontinueplotsprite2 3396 f2bb continueplotsprite1a 3397 f2bb endif 3398 f2bb 3399 f2bb a5 42 lda temp1 ; graphic data, lo byte 3400 f2bd 91 63 sta (dlpnt),y ;Low byte of data address 3401 f2bf 3402 f2bf ifnconst ATOMICSPRITEUPDATE 3403 f2bf c8 iny 3404 f2c0 a5 47 lda temp6 3405 f2c2 91 63 sta (dlpnt),y 3406 f2c4 - else 3407 f2c4 - iny 3408 f2c4 - sty temp8 3409 f2c4 endif 3410 f2c4 3411 f2c4 c8 iny 3412 f2c5 3413 f2c5 a5 46 lda temp5 ;Y position 3414 f2c7 29 07 and #(WZONEHEIGHT - 1) 3415 f2c9 c9 01 cmp #1 ; clear carry if our sprite is just in this zone 3416 f2cb 05 43 ora temp2 ; graphic data, hi byte 3417 f2cd 91 63 sta (dlpnt),y 3418 f2cf 3419 f2cf 3420 f2cf c8 iny 3421 f2d0 a5 44 lda temp3 ;palette|width 3422 f2d2 91 63 sta (dlpnt),y 3423 f2d4 3424 f2d4 c8 iny 3425 f2d5 a5 45 lda temp4 ;Horizontal position 3426 f2d7 91 63 sta (dlpnt),y 3427 f2d9 3428 f2d9 c8 iny 3429 f2da 94 65 sty dlend,x 3430 f2dc 3431 f2dc - ifconst ALWAYSTERMINATE 3432 f2dc - iny 3433 f2dc - lda #0 3434 f2dc - sta (dlpnt),y 3435 f2dc endif 3436 f2dc 3437 f2dc - ifconst ATOMICSPRITEUPDATE 3438 f2dc - ldy temp8 3439 f2dc - lda temp6 3440 f2dc - sta (dlpnt),y 3441 f2dc endif 3442 f2dc 3443 f2dc checkcontinueplotsprite2 3444 f2dc 3445 f2dc 90 38 bcc doneSPDL ;branch if the sprite was fully in the last zone 3446 f2de 3447 f2de ;Create DL entry for lower part of sprite 3448 f2de 3449 f2de e8 inx ;Next region 3450 f2df 3451 f2df ifnconst NOLIMITCHECKING 3452 f2df e0 1a cpx #WZONECOUNT 3453 f2e1 3454 f2e1 90 01 bcc continueplotsprite2 ; the second half of the sprite is fully on-screen, so carry on... 3455 f2e3 60 rts 3456 f2e4 continueplotsprite2 3457 f2e4 endif 3458 f2e4 3459 f2e4 bd fa f5 lda DLPOINTL,x ;Get pointer to next DL 3460 f2e7 - ifconst DOUBLEBUFFER 3461 f2e7 - clc 3462 f2e7 - adc doublebufferdloffset 3463 f2e7 endif ; DOUBLEBUFFER 3464 f2e7 85 63 sta dlpnt 3465 f2e9 bd e0 f5 lda DLPOINTH,x 3466 f2ec - ifconst DOUBLEBUFFER 3467 f2ec - adc #0 3468 f2ec endif ; DOUBLEBUFFER 3469 f2ec 85 64 sta dlpnt+1 3470 f2ee b4 65 ldy dlend,x ;Get the index to the end of this DL 3471 f2f0 3472 f2f0 ifconst CHECKOVERWRITE 3473 f2f0 c0 46 cpy #DLLASTOBJ 3474 f2f2 d0 01 bne continueplotsprite2a 3475 f2f4 60 rts 3476 f2f5 continueplotsprite2a 3477 f2f5 endif 3478 f2f5 3479 f2f5 a5 42 lda temp1 ; graphic data, lo byte 3480 f2f7 91 63 sta (dlpnt),y 3481 f2f9 3482 f2f9 ifnconst ATOMICSPRITEUPDATE 3483 f2f9 c8 iny 3484 f2fa a5 47 lda temp6 3485 f2fc 91 63 sta (dlpnt),y 3486 f2fe - else 3487 f2fe - iny 3488 f2fe - sty temp8 3489 f2fe endif 3490 f2fe 3491 f2fe c8 iny 3492 f2ff 3493 f2ff a5 46 lda temp5 ;Y position 3494 f301 0b 07 anc #(WZONEHEIGHT - 1) ; undocumented. A=A&IMM, then move bit 7 into carry 3495 f303 05 43 ora temp2 ; graphic data, hi byte 3496 f305 e9 07 sbc #(WZONEHEIGHT-1) ; start at the DMA hole. -1 because carry is clear 3497 f307 91 63 sta (dlpnt),y 3498 f309 3499 f309 c8 iny 3500 f30a 3501 f30a a5 44 lda temp3 ;palette|width 3502 f30c 91 63 sta (dlpnt),y 3503 f30e 3504 f30e c8 iny 3505 f30f 3506 f30f a5 45 lda temp4 ;Horizontal position 3507 f311 91 63 sta (dlpnt),y 3508 f313 3509 f313 c8 iny 3510 f314 94 65 sty dlend,x 3511 f316 3512 f316 - ifconst ALWAYSTERMINATE 3513 f316 - iny 3514 f316 - lda #0 3515 f316 - sta (dlpnt),y 3516 f316 endif 3517 f316 3518 f316 - ifconst ATOMICSPRITEUPDATE 3519 f316 - ldy temp8 3520 f316 - lda temp6 3521 f316 - sta (dlpnt),y 3522 f316 endif 3523 f316 3524 f316 doneSPDL 3525 f316 60 rts 3526 f317 3527 f317 3528 f317 lockzonex 3529 f317 - ifconst ZONELOCKS 3530 f317 - ldy dlend,x 3531 f317 - cpy #DLLASTOBJ 3532 f317 - beq lockzonexreturn ; the zone is either stuffed or locked. abort! 3533 f317 - lda DLPOINTL,x 3534 f317 - ifconst DOUBLEBUFFER 3535 f317 - clc 3536 f317 - adc doublebufferdloffset 3537 f317 - endif ; DOUBLEBUFFER 3538 f317 - sta dlpnt 3539 f317 - lda DLPOINTH,x 3540 f317 - ifconst DOUBLEBUFFER 3541 f317 - adc #0 3542 f317 - endif ; DOUBLEBUFFER 3543 f317 - sta dlpnt+1 3544 f317 - iny 3545 f317 - lda #0 3546 f317 - sta (dlpnt),y 3547 f317 - dey 3548 f317 - tya 3549 f317 - ldy #(DLLASTOBJ-1) 3550 f317 - sta (dlpnt),y 3551 f317 - iny 3552 f317 - sty dlend,x 3553 f317 -lockzonexreturn 3554 f317 - rts 3555 f317 endif ; ZONELOCKS 3556 f317 unlockzonex 3557 f317 - ifconst ZONELOCKS 3558 f317 - ldy dlend,x 3559 f317 - cpy #DLLASTOBJ 3560 f317 - bne unlockzonexreturn ; if the zone isn't stuffed, it's not locked. abort! 3561 f317 - lda DLPOINTL,x 3562 f317 - ifconst DOUBLEBUFFER 3563 f317 - clc 3564 f317 - adc doublebufferdloffset 3565 f317 - endif ; DOUBLEBUFFER 3566 f317 - sta dlpnt 3567 f317 - lda DLPOINTH,x 3568 f317 - ifconst DOUBLEBUFFER 3569 f317 - adc #0 3570 f317 - endif ; DOUBLEBUFFER 3571 f317 - sta dlpnt+1 3572 f317 - dey 3573 f317 - ;ldy #(DLLASTOBJ-1) 3574 f317 - lda (dlpnt),y 3575 f317 - tay 3576 f317 - sty dlend,x 3577 f317 -unlockzonexreturn 3578 f317 endif ; ZONELOCKS 3579 f317 60 rts 3580 f318 3581 f318 plotcharloop 3582 f318 ; ** read from a data indirectly pointed to from temp8,temp9 3583 f318 ; ** format is: lo_data, hi_data, palette|width, x, y 3584 f318 ; ** format ends with lo_data | hi_data = 0 3585 f318 3586 f318 - ifconst DOUBLEBUFFER 3587 f318 - lda doublebufferstate 3588 f318 - bne skipplotcharloopwait 3589 f318 endif ; DOUBLEBUFFER 3590 f318 - ifconst DEBUGWAITCOLOR 3591 f318 - lda #$61 3592 f318 - sta BACKGRND 3593 f318 endif 3594 f318 plotcharloopwait 3595 f318 a5 4d lda visibleover 3596 f31a d0 fc bne plotcharloopwait 3597 f31c - ifconst DEBUGWAITCOLOR 3598 f31c - lda #0 3599 f31c - sta BACKGRND 3600 f31c endif 3601 f31c skipplotcharloopwait 3602 f31c plotcharlooploop 3603 f31c a0 00 ldy #0 3604 f31e b1 49 lda (temp8),y 3605 f320 85 42 sta temp1 3606 f322 c8 iny 3607 f323 b1 49 lda (temp8),y 3608 f325 85 43 sta temp2 3609 f327 05 42 ora temp1 3610 f329 d0 01 bne plotcharloopcontinue 3611 f32b ;the pointer=0, so return 3612 f32b 60 rts 3613 f32c plotcharloopcontinue 3614 f32c c8 iny 3615 f32d b1 49 lda (temp8),y 3616 f32f 85 44 sta temp3 3617 f331 c8 iny 3618 f332 b1 49 lda (temp8),y 3619 f334 85 45 sta temp4 3620 f336 c8 iny 3621 f337 b1 49 lda (temp8),y 3622 f339 ;sta temp5 ; not needed with our late entry. 3623 f339 20 52 f3 jsr plotcharactersskipentry 3624 f33c a5 49 lda temp8 3625 f33e 18 clc 3626 f33f 69 05 adc #5 3627 f341 85 49 sta temp8 3628 f343 a5 4a lda temp9 3629 f345 69 00 adc #0 3630 f347 85 4a sta temp9 3631 f349 4c 1c f3 jmp plotcharlooploop 3632 f34c 3633 f34c plotcharacters 3634 f34c - ifconst DOUBLEBUFFER 3635 f34c - lda doublebufferstate 3636 f34c - bne skipplotcharacterswait 3637 f34c endif ; DOUBLEBUFFER 3638 f34c - ifconst DEBUGWAITCOLOR 3639 f34c - lda #$41 3640 f34c - sta BACKGRND 3641 f34c endif 3642 f34c plotcharacterswait 3643 f34c a5 4d lda visibleover 3644 f34e d0 fc bne plotcharacterswait 3645 f350 - ifconst DEBUGWAITCOLOR 3646 f350 - sta BACKGRND 3647 f350 endif 3648 f350 skipplotcharacterswait 3649 f350 ;arguments: 3650 f350 ; temp1=lo charactermap 3651 f350 ; temp2=hi charactermap 3652 f350 ; temp3=palette | width byte 3653 f350 ; temp4=x 3654 f350 ; temp5=y 3655 f350 3656 f350 a5 46 lda temp5 ;Y position 3657 f352 3658 f352 plotcharactersskipentry 3659 f352 3660 f352 ;ifconst ZONEHEIGHT 3661 f352 ; if ZONEHEIGHT = 16 3662 f352 ; and #$0F 3663 f352 ; endif 3664 f352 ; if ZONEHEIGHT = 8 3665 f352 ; and #$1F 3666 f352 ; endif 3667 f352 ;else 3668 f352 ; and #$0F 3669 f352 ;endif 3670 f352 3671 f352 aa tax 3672 f353 bd fa f5 lda DLPOINTL,x ;Get pointer to DL that the characters are in 3673 f356 - ifconst DOUBLEBUFFER 3674 f356 - clc 3675 f356 - adc doublebufferdloffset 3676 f356 endif ; DOUBLEBUFFER 3677 f356 85 63 sta dlpnt 3678 f358 bd e0 f5 lda DLPOINTH,x 3679 f35b - ifconst DOUBLEBUFFER 3680 f35b - adc #0 3681 f35b endif ; DOUBLEBUFFER 3682 f35b 85 64 sta dlpnt+1 3683 f35d 3684 f35d ;Create DL entry for the characters 3685 f35d 3686 f35d b4 65 ldy dlend,x ;Get the index to the end of this DL 3687 f35f 3688 f35f ifconst CHECKOVERWRITE 3689 f35f c0 46 cpy #DLLASTOBJ 3690 f361 d0 01 bne continueplotcharacters 3691 f363 60 rts 3692 f364 continueplotcharacters 3693 f364 endif 3694 f364 3695 f364 a5 42 lda temp1 ; character map data, lo byte 3696 f366 91 63 sta (dlpnt),y ;(1) store low address 3697 f368 3698 f368 c8 iny 3699 f369 ad 06 21 lda charactermode 3700 f36c 91 63 sta (dlpnt),y ;(2) store mode 3701 f36e 3702 f36e c8 iny 3703 f36f a5 43 lda temp2 ; character map, hi byte 3704 f371 91 63 sta (dlpnt),y ;(3) store high address 3705 f373 3706 f373 c8 iny 3707 f374 a5 44 lda temp3 ;palette|width 3708 f376 91 63 sta (dlpnt),y ;(4) store palette|width 3709 f378 3710 f378 c8 iny 3711 f379 a5 45 lda temp4 ;Horizontal position 3712 f37b 91 63 sta (dlpnt),y ;(5) store horizontal position 3713 f37d 3714 f37d c8 iny 3715 f37e 94 65 sty dlend,x ; save display list end byte 3716 f380 60 rts 3717 f381 3718 f381 3719 f381 - ifconst plotvalueonscreen 3720 f381 -plotcharacterslive 3721 f381 - ; a version of plotcharacters that draws live and minimally disrupts the screen... 3722 f381 - 3723 f381 - ;arguments: 3724 f381 - ; temp1=lo charactermap 3725 f381 - ; temp2=hi charactermap 3726 f381 - ; temp3=palette | width byte 3727 f381 - ; temp4=x 3728 f381 - ; temp5=y 3729 f381 - 3730 f381 - lda temp5 ;Y position 3731 f381 - 3732 f381 - tax 3733 f381 - lda DLPOINTL,x ;Get pointer to DL that the characters are in 3734 f381 - ifconst DOUBLEBUFFER 3735 f381 - clc 3736 f381 - adc doublebufferdloffset 3737 f381 - endif ; DOUBLEBUFFER 3738 f381 - sta dlpnt 3739 f381 - lda DLPOINTH,x 3740 f381 - ifconst DOUBLEBUFFER 3741 f381 - adc #0 3742 f381 - endif ; DOUBLEBUFFER 3743 f381 - sta dlpnt+1 3744 f381 - 3745 f381 - ;Create DL entry for the characters 3746 f381 - 3747 f381 - ldy dlend,x ;Get the index to the end of this DL 3748 f381 - 3749 f381 - ifconst CHECKOVERWRITE 3750 f381 - cpy #DLLASTOBJ 3751 f381 - bne continueplotcharacterslive 3752 f381 - rts 3753 f381 -continueplotcharacterslive 3754 f381 - endif 3755 f381 - 3756 f381 - lda temp1 ; character map data, lo byte 3757 f381 - sta (dlpnt),y ;(1) store low address 3758 f381 - 3759 f381 - iny 3760 f381 - ; we don't add the second byte yet, since the charmap could briefly 3761 f381 - ; render without a proper character map address, width, or position. 3762 f381 - lda charactermode 3763 f381 - sta (dlpnt),y ;(2) store mode 3764 f381 - 3765 f381 - iny 3766 f381 - lda temp2 ; character map, hi byte 3767 f381 - sta (dlpnt),y ;(3) store high address 3768 f381 - 3769 f381 - iny 3770 f381 - lda temp3 ;palette|width 3771 f381 - sta (dlpnt),y ;(4) store palette|width 3772 f381 - 3773 f381 - iny 3774 f381 - lda temp4 ;Horizontal position 3775 f381 - sta (dlpnt),y ;(5) store horizontal position 3776 f381 - 3777 f381 - iny 3778 f381 - sty dlend,x ; save display list end byte 3779 f381 - 3780 f381 - rts 3781 f381 endif ;plotcharacterslive 3782 f381 3783 f381 - ifconst USED_PLOTVALUE 3784 f381 -plotvalue 3785 f381 - ; calling 7800basic command: 3786 f381 - ; plotvalue digit_gfx palette variable/data number_of_digits screen_x screen_y 3787 f381 - ; ...displays the variable as BCD digits 3788 f381 - ; 3789 f381 - ; asm sub arguments: 3790 f381 - ; temp1=lo charactermap 3791 f381 - ; temp2=hi charactermap 3792 f381 - ; temp3=palette | width byte 3793 f381 - ; temp4=x 3794 f381 - ; temp5=y 3795 f381 - ; temp6=number of digits 3796 f381 - ; temp7=lo variable 3797 f381 - ; temp8=hi variable 3798 f381 - ; temp9=character mode 3799 f381 - 3800 f381 -plotdigitcount = temp6 3801 f381 - 3802 f381 - ifconst ZONELOCKS 3803 f381 - ldx temp5 3804 f381 - ldy dlend,x 3805 f381 - cpy #DLLASTOBJ 3806 f381 - bne carryonplotvalue 3807 f381 - rts 3808 f381 -carryonplotvalue 3809 f381 - endif 3810 f381 - 3811 f381 - lda #0 3812 f381 - tay 3813 f381 - ldx valbufend 3814 f381 - 3815 f381 - lda plotdigitcount 3816 f381 - and #1 3817 f381 - beq pvnibble2char 3818 f381 - lda #0 3819 f381 - sta VALBUFFER,x ; just in case we skip this digit 3820 f381 - beq pvnibble2char_skipnibble 3821 f381 - 3822 f381 -pvnibble2char 3823 f381 - ; high nibble... 3824 f381 - lda (temp7),y 3825 f381 - and #$f0 3826 f381 - lsr 3827 f381 - lsr 3828 f381 - lsr 3829 f381 - ifnconst DOUBLEWIDE ; multiply value by 2 for double-width 3830 f381 - lsr 3831 f381 - endif 3832 f381 - 3833 f381 - clc 3834 f381 - adc temp1 ; add the offset to character graphics to our value 3835 f381 - sta VALBUFFER,x 3836 f381 - inx 3837 f381 - dec plotdigitcount 3838 f381 - 3839 f381 -pvnibble2char_skipnibble 3840 f381 - ; low nibble... 3841 f381 - lda (temp7),y 3842 f381 - and #$0f 3843 f381 - ifconst DOUBLEWIDE ; multiply value by 2 for double-width 3844 f381 - asl 3845 f381 - endif 3846 f381 - clc 3847 f381 - adc temp1 ; add the offset to character graphics to our value 3848 f381 - sta VALBUFFER,x 3849 f381 - inx 3850 f381 - iny 3851 f381 - 3852 f381 - dec plotdigitcount 3853 f381 - bne pvnibble2char 3854 f381 - 3855 f381 - ;point to the start of our valuebuffer 3856 f381 - clc 3857 f381 - lda #VALBUFFER 3861 f381 - adc #0 3862 f381 - sta temp2 3863 f381 - 3864 f381 - ;advance valbufend to the end of our value buffer 3865 f381 - stx valbufend 3866 f381 - 3867 f381 - ifnconst plotvalueonscreen 3868 f381 - jmp plotcharacters 3869 f381 - else 3870 f381 - jmp plotcharacterslive 3871 f381 - endif 3872 f381 - 3873 f381 endif ; USED_PLOTVALUE 3874 f381 3875 f381 3876 f381 - ifconst USED_PLOTVALUEEXTRA 3877 f381 -plotdigitcount = temp6 3878 f381 -plotvalueextra 3879 f381 - ; calling 7800basic command: 3880 f381 - ; plotvalue digit_gfx palette variable/data number_of_digits screen_x screen_y 3881 f381 - ; ...displays the variable as BCD digits 3882 f381 - ; 3883 f381 - ; asm sub arguments: 3884 f381 - ; temp1=lo charactermap 3885 f381 - ; temp2=hi charactermap 3886 f381 - ; temp3=palette | width byte 3887 f381 - ; temp4=x 3888 f381 - ; temp5=y 3889 f381 - ; temp6=number of digits 3890 f381 - ; temp7=lo variable 3891 f381 - ; temp8=hi variable 3892 f381 - 3893 f381 - lda #0 3894 f381 - tay 3895 f381 - ldx valbufend 3896 f381 - ifnconst plotvalueonscreen 3897 f381 - sta VALBUFFER,x 3898 f381 - endif 3899 f381 - 3900 f381 - lda plotdigitcount 3901 f381 - and #1 3902 f381 - 3903 f381 - bne pvnibble2char_skipnibbleextra 3904 f381 - 3905 f381 -pvnibble2charextra 3906 f381 - ; high nibble... 3907 f381 - lda (temp7),y 3908 f381 - and #$f0 3909 f381 - lsr 3910 f381 - lsr 3911 f381 - ifnconst DOUBLEWIDE ; multiply value by 2 for double-width 3912 f381 - lsr 3913 f381 - endif 3914 f381 - clc 3915 f381 - adc temp1 ; add the offset to character graphics to our value 3916 f381 - sta VALBUFFER,x 3917 f381 - inx 3918 f381 - 3919 f381 - ; second half of the digit 3920 f381 - clc 3921 f381 - adc #1 3922 f381 - sta VALBUFFER,x 3923 f381 - inx 3924 f381 - 3925 f381 -pvnibble2char_skipnibbleextra 3926 f381 - ; low nibble... 3927 f381 - lda (temp7),y 3928 f381 - and #$0f 3929 f381 - ifconst DOUBLEWIDE ; multiply value by 2 for double-width 3930 f381 - asl 3931 f381 - endif 3932 f381 - asl 3933 f381 - 3934 f381 - clc 3935 f381 - adc temp1 ; add the offset to character graphics to our value 3936 f381 - sta VALBUFFER,x 3937 f381 - inx 3938 f381 - 3939 f381 - clc 3940 f381 - adc #1 3941 f381 - sta VALBUFFER,x 3942 f381 - inx 3943 f381 - iny 3944 f381 - 3945 f381 - dec plotdigitcount 3946 f381 - bne pvnibble2charextra 3947 f381 - 3948 f381 - ;point to the start of our valuebuffer 3949 f381 - clc 3950 f381 - lda #VALBUFFER 3954 f381 - adc #0 3955 f381 - sta temp2 3956 f381 - 3957 f381 - ;advance valbufend to the end of our value buffer 3958 f381 - stx valbufend 3959 f381 - 3960 f381 - ifnconst plotvalueonscreen 3961 f381 - jmp plotcharacters 3962 f381 - else 3963 f381 - jmp plotcharacterslive 3964 f381 - endif 3965 f381 endif ; USED_PLOTVALUEEXTRA 3966 f381 3967 f381 boxcollision 3968 f381 ifconst BOXCOLLISION 3969 f381 ; the worst case cycle-time for the code below is 43 cycles. 3970 f381 ; unfortunately, prior to getting here we've burned 44 cycles in argument setup. eep! 3971 f381 3972 f381 ;__boxx1 = accumulator 3973 f381 ;__boxy1 = y 3974 f381 00 44 __boxw1 = temp3 3975 f381 00 45 __boxh1 = temp4 3976 f381 3977 f381 00 46 __boxx2 = temp5 3978 f381 00 47 __boxy2 = temp6 3979 f381 00 48 __boxw2 = temp7 3980 f381 00 49 __boxh2 = temp8 3981 f381 3982 f381 DoXCollisionCheck 3983 f381 ;lda __boxx1 ; skipped. already in the accumulator 3984 f381 c5 46 cmp __boxx2 ;3 3985 f383 b0 07 bcs X1isbiggerthanX2 ;2/3 3986 f385 X2isbiggerthanX1 3987 f385 ; carry is clear 3988 f385 65 44 adc __boxw1 ;3 3989 f387 c5 46 cmp __boxx2 ;3 3990 f389 b0 08 bcs DoYCollisionCheck ;3/2 3991 f38b 60 rts ;6 - carry clear, no collision 3992 f38c X1isbiggerthanX2 3993 f38c 18 clc ;2 3994 f38d e5 48 sbc __boxw2 ;3 3995 f38f c5 46 cmp __boxx2 ;3 3996 f391 b0 13 bcs noboxcollision ;3/2 3997 f393 DoYCollisionCheck 3998 f393 98 tya ; 2 ; use to be "lda __boxy1" 3999 f394 c5 47 cmp __boxy2 ;3 4000 f396 b0 05 bcs Y1isbiggerthanY2 ;3/2 4001 f398 Y2isbiggerthanY1 4002 f398 ; carry is clear 4003 f398 65 45 adc __boxh1 ;3 4004 f39a c5 47 cmp __boxy2 ;3 4005 f39c 60 rts ;6 4006 f39d Y1isbiggerthanY2 4007 f39d 18 clc ;2 4008 f39e e5 49 sbc __boxh2 ;3 4009 f3a0 c5 47 cmp __boxy2 ;3 4010 f3a2 b0 02 bcs noboxcollision ;3/2 4011 f3a4 yesboxcollision 4012 f3a4 38 sec ;2 4013 f3a5 60 rts ;6 4014 f3a6 noboxcollision 4015 f3a6 18 clc ;2 4016 f3a7 60 rts ;6 4017 f3a8 endif ; BOXCOLLISION 4018 f3a8 4019 f3a8 randomize 4020 f3a8 a5 40 lda rand 4021 f3aa 4a lsr 4022 f3ab 26 41 rol rand16 4023 f3ad 90 02 bcc noeor 4024 f3af 49 b4 eor #$B4 4025 f3b1 noeor 4026 f3b1 85 40 sta rand 4027 f3b3 45 41 eor rand16 4028 f3b5 60 rts 4029 f3b6 4030 f3b6 ; *** bcd conversion routine courtesy Omegamatrix 4031 f3b6 ; *** http://atariage.com/forums/blog/563/entry-10832-hex-to-bcd-conversion-0-99/ 4032 f3b6 converttobcd 4033 f3b6 ;value to convert is in the accumulator 4034 f3b6 85 42 sta temp1 4035 f3b8 4a lsr 4036 f3b9 65 42 adc temp1 4037 f3bb 6a ror 4038 f3bc 4a lsr 4039 f3bd 4a lsr 4040 f3be 65 42 adc temp1 4041 f3c0 6a ror 4042 f3c1 65 42 adc temp1 4043 f3c3 6a ror 4044 f3c4 4a lsr 4045 f3c5 29 3c and #$3C 4046 f3c7 85 43 sta temp2 4047 f3c9 4a lsr 4048 f3ca 65 43 adc temp2 4049 f3cc 65 42 adc temp1 4050 f3ce 60 rts ; return the result in the accumulator 4051 f3cf 4052 f3cf ; Y and A contain multiplicands, result in A 4053 f3cf mul8 4054 f3cf 84 42 sty temp1 4055 f3d1 85 43 sta temp2 4056 f3d3 a9 00 lda #0 4057 f3d5 reptmul8 4058 f3d5 46 43 lsr temp2 4059 f3d7 90 03 bcc skipmul8 4060 f3d9 18 clc 4061 f3da 65 42 adc temp1 4062 f3dc ;bcs donemul8 might save cycles? 4063 f3dc skipmul8 4064 f3dc ;beq donemul8 might save cycles? 4065 f3dc 06 42 asl temp1 4066 f3de d0 f5 bne reptmul8 4067 f3e0 donemul8 4068 f3e0 60 rts 4069 f3e1 4070 f3e1 div8 4071 f3e1 ; A=numerator Y=denominator, result in A 4072 f3e1 c0 02 cpy #2 4073 f3e3 90 0a bcc div8end+1 ;div by 0 = bad, div by 1=no calc needed, so bail out 4074 f3e5 84 42 sty temp1 4075 f3e7 a0 ff ldy #$ff 4076 f3e9 div8loop 4077 f3e9 e5 42 sbc temp1 4078 f3eb c8 iny 4079 f3ec b0 fb bcs div8loop 4080 f3ee div8end 4081 f3ee 98 tya 4082 f3ef ; result in A 4083 f3ef 60 rts 4084 f3f0 4085 f3f0 ; Y and A contain multiplicands, result in temp2,A=low, temp1=high 4086 f3f0 mul16 4087 f3f0 84 42 sty temp1 4088 f3f2 85 43 sta temp2 4089 f3f4 4090 f3f4 a9 00 lda #0 4091 f3f6 a2 08 ldx #8 4092 f3f8 46 42 lsr temp1 4093 f3fa mul16_1 4094 f3fa 90 03 bcc mul16_2 4095 f3fc 18 clc 4096 f3fd 65 43 adc temp2 4097 f3ff mul16_2 4098 f3ff 6a ror 4099 f400 66 42 ror temp1 4100 f402 ca dex 4101 f403 d0 f5 bne mul16_1 4102 f405 85 43 sta temp2 4103 f407 60 rts 4104 f408 4105 f408 ; div int/int 4106 f408 ; numerator in A, denom in temp1 4107 f408 ; returns with quotient in A, remainder in temp1 4108 f408 div16 4109 f408 85 43 sta temp2 4110 f40a 84 42 sty temp1 4111 f40c a9 00 lda #0 4112 f40e a2 08 ldx #8 4113 f410 06 43 asl temp2 4114 f412 div16_1 4115 f412 2a rol 4116 f413 c5 42 cmp temp1 4117 f415 90 02 bcc div16_2 4118 f417 e5 42 sbc temp1 4119 f419 div16_2 4120 f419 26 43 rol temp2 4121 f41b ca dex 4122 f41c d0 f4 bne div16_1 4123 f41e 85 42 sta temp1 4124 f420 a5 43 lda temp2 4125 f422 60 rts 4126 f423 4127 f423 - ifconst bankswitchmode 4128 f423 -BS_jsr 4129 f423 - ifconst dumpbankswitch 4130 f423 - sta dumpbankswitch 4131 f423 - endif 4132 f423 - ifconst MCPDEVCART 4133 f423 - ora #$18 4134 f423 - sta $3000 4135 f423 - else 4136 f423 - sta $8000 4137 f423 - endif 4138 f423 - pla 4139 f423 - tax 4140 f423 - pla 4141 f423 - rts 4142 f423 - 4143 f423 -BS_return 4144 f423 - pla ; bankswitch bank 4145 f423 - ifconst dumpbankswitch 4146 f423 - sta dumpbankswitch 4147 f423 - endif 4148 f423 - ifconst BANKRAM 4149 f423 - sta currentbank 4150 f423 - ora currentrambank 4151 f423 - endif 4152 f423 - ifconst MCPDEVCART 4153 f423 - ora #$18 4154 f423 - sta $3000 4155 f423 - else 4156 f423 - sta $8000 4157 f423 - endif 4158 f423 - pla ; bankswitch $0 flag 4159 f423 - rts 4160 f423 endif 4161 f423 4162 f423 checkselectswitch 4163 f423 ad 82 02 lda SWCHB ; first check the real select switch... 4164 f426 29 02 and #%00000010 4165 f428 ifnconst MOUSESUPPORT 4166 f428 f0 05 beq checkselectswitchreturn ; switch is pressed 4167 f42a ad 80 02 lda SWCHA ; then check the soft "select" joysick code... 4168 f42d 29 b0 and #%10110000 ; R_DU 4169 f42f endif ; MOUSESUPPORT 4170 f42f checkselectswitchreturn 4171 f42f 60 rts 4172 f430 4173 f430 checkresetswitch 4174 f430 ad 82 02 lda SWCHB ; first check the real reset switch... 4175 f433 29 01 and #%00000001 4176 f435 ifnconst MOUSESUPPORT 4177 f435 f0 05 beq checkresetswitchreturn ; switch is pressed 4178 f437 ad 80 02 lda SWCHA ; then check the soft "reset" joysick code... 4179 f43a 29 70 and #%01110000 ; _LDU 4180 f43c endif ; MOUSESUPPORT 4181 f43c checkresetswitchreturn 4182 f43c 60 rts 4183 f43d 4184 f43d - ifconst FINESCROLLENABLED 4185 f43d -finescrolldlls 4186 f43d - ldx temp1 ; first DLL index x3 4187 f43d - lda DLLMEM,x 4188 f43d - and #%11110000 4189 f43d - ora finescrolly 4190 f43d - sta DLLMEM,x 4191 f43d - 4192 f43d - ldx temp2 ; last DLL index x3 4193 f43d - lda DLLMEM,x 4194 f43d - and #%11110000 4195 f43d - ora finescrolly 4196 f43d - eor #(WZONEHEIGHT-1) 4197 f43d - sta DLLMEM,x 4198 f43d - rts 4199 f43d endif ; FINESCROLLENABLED 4200 f43d 4201 f43d - ifconst USED_ADJUSTVISIBLE 4202 f43d -adjustvisible 4203 f43d - ; called with temp1=first visible zone *3, temp2=last visible zone *3 4204 f43d - jsr waitforvblankstart ; ensure vblank just started 4205 f43d - ldx visibleDLLstart 4206 f43d -findfirstinterrupt 4207 f43d - lda DLLMEM,x 4208 f43d - bmi foundfirstinterrupt 4209 f43d - inx 4210 f43d - inx 4211 f43d - inx 4212 f43d - bne findfirstinterrupt 4213 f43d -foundfirstinterrupt 4214 f43d - and #%01111111 ; clear the interrupt bit 4215 f43d - sta DLLMEM,x 4216 f43d - ifconst DOUBLEBUFFER 4217 f43d - sta DLLMEM+DBOFFSET,x 4218 f43d - endif ; DOUBLEBUFFER 4219 f43d - ldx overscanDLLstart 4220 f43d -findlastinterrupt 4221 f43d - lda DLLMEM,x 4222 f43d - bmi foundlastinterrupt 4223 f43d - dex 4224 f43d - dex 4225 f43d - dex 4226 f43d - bne findlastinterrupt 4227 f43d -foundlastinterrupt 4228 f43d - and #%01111111 ; clear the interrupt bit 4229 f43d - sta DLLMEM,x 4230 f43d - ifconst DOUBLEBUFFER 4231 f43d - sta DLLMEM+DBOFFSET,x 4232 f43d - endif ; DOUBLEBUFFER 4233 f43d - ;now we need to set the new interrupts 4234 f43d - clc 4235 f43d - lda temp1 4236 f43d - adc visibleDLLstart 4237 f43d - tax 4238 f43d - lda DLLMEM,x 4239 f43d - ora #%10000000 4240 f43d - sta DLLMEM,x 4241 f43d - ifconst DOUBLEBUFFER 4242 f43d - sta DLLMEM+DBOFFSET,x 4243 f43d - endif ; DOUBLEBUFFER 4244 f43d - clc 4245 f43d - lda temp2 4246 f43d - adc visibleDLLstart 4247 f43d - tax 4248 f43d - lda DLLMEM,x 4249 f43d - ora #%10000000 4250 f43d - sta DLLMEM,x 4251 f43d - ifconst DOUBLEBUFFER 4252 f43d - sta DLLMEM+DBOFFSET,x 4253 f43d - endif ; DOUBLEBUFFER 4254 f43d - jsr vblankresync 4255 f43d - rts 4256 f43d endif ; USED_ADJUSTVISIBLE 4257 f43d 4258 f43d vblankresync 4259 f43d 20 db f4 jsr waitforvblankstart ; ensure vblank just started 4260 f440 a9 00 lda #0 4261 f442 85 4d sta visibleover 4262 f444 a9 03 lda #3 4263 f446 8d b2 01 sta interruptindex 4264 f449 60 rts 4265 f44a 4266 f44a createallgamedlls 4267 f44a a2 00 ldx #0 4268 f44c a9 11 lda #NVLINES 4269 f44e ac 09 21 ldy paldetected 4270 f451 f0 03 beq skipcreatePALpadding 4271 f453 18 clc 4272 f454 69 15 adc #21 4273 f456 skipcreatePALpadding 4274 f456 20 8b f4 jsr createnonvisibledlls 4275 f459 8e 3c 21 stx visibleDLLstart 4276 f45c 20 bc f4 jsr createvisiblezones 4277 f45f 8e 3d 21 stx overscanDLLstart 4278 f462 createallgamedllscontinue 4279 f462 a9 48 lda #(NVLINES+55) ; extras for PAL 4280 f464 20 8b f4 jsr createnonvisibledlls 4281 f467 4282 f467 ae 3c 21 ldx visibleDLLstart 4283 f46a bd 00 18 lda DLLMEM,x 4284 f46d 09 80 ora #%10000000 ; NMI 1 - start of visible screen 4285 f46f 9d 00 18 sta DLLMEM,x 4286 f472 - ifconst DOUBLEBUFFER 4287 f472 - sta DLLMEM+DBOFFSET,x 4288 f472 endif ; DOUBLEBUFFER 4289 f472 4290 f472 ae 3d 21 ldx overscanDLLstart 4291 f475 bd 00 18 lda DLLMEM,x 4292 f478 09 83 ora #%10000011 ; NMI 2 - end of visible screen 4293 f47a 29 f3 and #%11110011 ; change this to a 1-line DLL, so there's time enough for the "deeper overscan" DLL 4294 f47c 9d 00 18 sta DLLMEM,x 4295 f47f - ifconst DOUBLEBUFFER 4296 f47f - sta DLLMEM+DBOFFSET,x 4297 f47f endif ; DOUBLEBUFFER 4298 f47f 4299 f47f e8 inx 4300 f480 e8 inx 4301 f481 e8 inx 4302 f482 4303 f482 bd 00 18 lda DLLMEM,x 4304 f485 09 80 ora #%10000000 ; NMI 3 - deeper overscan 4305 f487 9d 00 18 sta DLLMEM,x 4306 f48a - ifconst DOUBLEBUFFER 4307 f48a - sta DLLMEM+DBOFFSET,x 4308 f48a endif ; DOUBLEBUFFER 4309 f48a 4310 f48a 60 rts 4311 f48b 4312 f48b createnonvisibledlls 4313 f48b 85 42 sta temp1 4314 f48d 4a lsr 4315 f48e 4a lsr 4316 f48f 4a lsr 4317 f490 4a lsr ; /16 4318 f491 f0 09 beq skipcreatenonvisibledlls1loop 4319 f493 a8 tay 4320 f494 createnonvisibledlls1loop 4321 f494 a9 4f lda #%01001111 ;low nibble=16 lines, high nibble=Holey DMA 4322 f496 20 ab f4 jsr createblankdllentry 4323 f499 88 dey 4324 f49a d0 f8 bne createnonvisibledlls1loop 4325 f49c skipcreatenonvisibledlls1loop 4326 f49c a5 42 lda temp1 4327 f49e 29 0f and #%00001111 4328 f4a0 f0 08 beq createnonvisibledllsreturn 4329 f4a2 38 sec 4330 f4a3 e9 01 sbc #1 4331 f4a5 09 40 ora #%01000000 4332 f4a7 20 ab f4 jsr createblankdllentry 4333 f4aa createnonvisibledllsreturn 4334 f4aa 60 rts 4335 f4ab 4336 f4ab createblankdllentry 4337 f4ab 9d 00 18 sta DLLMEM,x 4338 f4ae - ifconst DOUBLEBUFFER 4339 f4ae - sta DLLMEM+DBOFFSET,x 4340 f4ae endif ; DOUBLEBUFFER 4341 f4ae e8 inx 4342 f4af a9 21 lda #$21 ; blank 4343 f4b1 9d 00 18 sta DLLMEM,x 4344 f4b4 - ifconst DOUBLEBUFFER 4345 f4b4 - sta DLLMEM+DBOFFSET,x 4346 f4b4 endif ; DOUBLEBUFFER 4347 f4b4 e8 inx 4348 f4b5 a9 00 lda #$00 4349 f4b7 9d 00 18 sta DLLMEM,x 4350 f4ba - ifconst DOUBLEBUFFER 4351 f4ba - sta DLLMEM+DBOFFSET,x 4352 f4ba endif ; DOUBLEBUFFER 4353 f4ba e8 inx 4354 f4bb 60 rts 4355 f4bc 4356 f4bc createvisiblezones 4357 f4bc a0 00 ldy #0 4358 f4be createvisiblezonesloop 4359 f4be b9 14 f6 lda.w DLHEIGHT,y 4360 f4c1 09 20 ora #(WZONEHEIGHT * 4) ; set Holey DMA for 8 or 16 tall zones 4361 f4c3 9d 00 18 sta DLLMEM,x 4362 f4c6 - ifconst DOUBLEBUFFER 4363 f4c6 - sta DLLMEM+DBOFFSET,x 4364 f4c6 endif ; DOUBLEBUFFER 4365 f4c6 e8 inx 4366 f4c7 b9 e0 f5 lda DLPOINTH,y 4367 f4ca 9d 00 18 sta DLLMEM,x 4368 f4cd - ifconst DOUBLEBUFFER 4369 f4cd - sta DLLMEM+DBOFFSET,x 4370 f4cd endif ; DOUBLEBUFFER 4371 f4cd e8 inx 4372 f4ce b9 fa f5 lda DLPOINTL,y 4373 f4d1 9d 00 18 sta DLLMEM,x 4374 f4d4 - ifconst DOUBLEBUFFER 4375 f4d4 - clc 4376 f4d4 - adc #DOUBLEBUFFEROFFSET 4377 f4d4 - sta DLLMEM+DBOFFSET,x 4378 f4d4 - bcc skiphidoublebufferadjust ; dlls are big endian, so we need to fix the hi byte after-the-fact... 4379 f4d4 - inc DLLMEM+DBOFFSET-1,x 4380 f4d4 -skiphidoublebufferadjust 4381 f4d4 endif ; DOUBLEBUFFER 4382 f4d4 e8 inx 4383 f4d5 c8 iny 4384 f4d6 c0 1a cpy #WZONECOUNT 4385 f4d8 d0 e4 bne createvisiblezonesloop 4386 f4da 60 rts 4387 f4db 4388 f4db waitforvblankstart 4389 f4db vblankendwait 4390 f4db 24 28 BIT MSTAT 4391 f4dd 30 fc bmi vblankendwait 4392 f4df vblankstartwait 4393 f4df 24 28 BIT MSTAT 4394 f4e1 10 fc bpl vblankstartwait 4395 f4e3 60 rts 4396 f4e4 4397 f4e4 - ifconst DOUBLEBUFFER 4398 f4e4 -flipdisplaybufferreturn 4399 f4e4 - rts 4400 f4e4 -flipdisplaybuffer 4401 f4e4 - ifconst interrupthold 4402 f4e4 - lda #$FF 4403 f4e4 - sta interrupthold 4404 f4e4 - endif 4405 f4e4 - lda doublebufferstate 4406 f4e4 - beq flipdisplaybufferreturn ; exit if we're not in double-buffer 4407 f4e4 - 4408 f4e4 - jsr terminatedisplaybuffer ; terminate the working buffer before we flip 4409 f4e4 - 4410 f4e4 - lda doublebufferstate 4411 f4e4 - lsr ; /2, so we'll see 0 or 1, rather than 1 or 3 4412 f4e4 - tax 4413 f4e4 - 4414 f4e4 - ; ensure we don't flip mid-display. otherwise the displayed DL will be the one the game is working on. 4415 f4e4 - 4416 f4e4 -flipdisplaybufferwait1 4417 f4e4 - lda visibleover 4418 f4e4 - beq flipdisplaybufferwait1 4419 f4e4 - 4420 f4e4 -flipdisplaybufferwait 4421 f4e4 - lda visibleover 4422 f4e4 - bne flipdisplaybufferwait 4423 f4e4 - 4424 f4e4 - lda doublebufferminimumframetarget 4425 f4e4 - beq skipminimumframecode 4426 f4e4 - lda doublebufferminimumframeindex 4427 f4e4 - bne flipdisplaybufferwait1 4428 f4e4 - lda doublebufferminimumframetarget 4429 f4e4 - sta doublebufferminimumframeindex 4430 f4e4 -skipminimumframecode 4431 f4e4 - 4432 f4e4 - lda DLLMEMLutHi,x 4433 f4e4 - sta DPPH 4434 f4e4 - lda DLLMEMLutLo,x 4435 f4e4 - sta DPPL 4436 f4e4 - 4437 f4e4 - lda NewPageflipstate,x 4438 f4e4 - sta doublebufferstate 4439 f4e4 - lda NewPageflipoffset,x 4440 f4e4 - sta doublebufferdloffset 4441 f4e4 - 4442 f4e4 - lda doublebufferbufferdirty 4443 f4e4 - beq flipdisplaybufferreturn 4444 f4e4 - 4445 f4e4 - ; The doublebuffer buffer is dirty, so the game code must have issued a savescreen recently. 4446 f4e4 - ; To make savescreen work with the new working buffer, we need to copy over the saved objects 4447 f4e4 - ; from the displayed buffer to the working buffer... 4448 f4e4 - 4449 f4e4 - lda doublebufferdloffset 4450 f4e4 - eor #DOUBLEBUFFEROFFSET 4451 f4e4 - sta temp6 ; make temp6 the anti-doublebufferdloffset variable 4452 f4e4 - 4453 f4e4 - ldx #(WZONECOUNT-1) 4454 f4e4 -copybufferzoneloop 4455 f4e4 - 4456 f4e4 - lda DLPOINTL,x 4457 f4e4 - clc 4458 f4e4 - adc doublebufferdloffset 4459 f4e4 - sta temp1 4460 f4e4 - lda DLPOINTH,x 4461 f4e4 - adc #0 4462 f4e4 - sta temp2 4463 f4e4 - 4464 f4e4 - lda DLPOINTL,x 4465 f4e4 - clc 4466 f4e4 - adc temp6 4467 f4e4 - sta temp3 4468 f4e4 - lda DLPOINTH,x 4469 f4e4 - adc #0 4470 f4e4 - sta temp4 4471 f4e4 - 4472 f4e4 - lda dlendsave,x 4473 f4e4 - tay 4474 f4e4 -copybuffercharsloop 4475 f4e4 - lda (temp3),y 4476 f4e4 - sta (temp1),y 4477 f4e4 - dey 4478 f4e4 - bpl copybuffercharsloop 4479 f4e4 - dex 4480 f4e4 - bpl copybufferzoneloop 4481 f4e4 - lda #0 4482 f4e4 - sta doublebufferbufferdirty 4483 f4e4 - rts 4484 f4e4 - 4485 f4e4 -doublebufferoff 4486 f4e4 - lda #1 4487 f4e4 - sta doublebufferstate 4488 f4e4 - jsr flipdisplaybuffer 4489 f4e4 - lda #0 4490 f4e4 - sta doublebufferstate 4491 f4e4 - sta doublebufferdloffset 4492 f4e4 - rts 4493 f4e4 - 4494 f4e4 -DLLMEMLutLo 4495 f4e4 - .byte DLLMEM,>(DLLMEM+DBOFFSET) 4498 f4e4 -NewPageflipstate 4499 f4e4 - .byte 3,1 4500 f4e4 -NewPageflipoffset 4501 f4e4 - .byte DOUBLEBUFFEROFFSET,0 4502 f4e4 - 4503 f4e4 endif ; DOUBLEBUFFER 4504 f4e4 4505 f4e4 - ifconst MOUSESUPPORT 4506 f4e4 - 4507 f4e4 -rotationalcompare 4508 f4e4 - ; old = 00 01 10 11 4509 f4e4 - .byte $00, $01, $ff, $00 ; new=00 4510 f4e4 - .byte $ff, $00, $00, $01 ; new=01 4511 f4e4 - .byte $01, $00, $00, $ff ; new=10 4512 f4e4 - .byte $00, $ff, $01, $00 ; new=11 4513 f4e4 - 4514 f4e4 - ; 0000YyXx st mouse 4515 f4e4 - 4516 f4e4 - ; 0000xyXY amiga mouse 4517 f4e4 - 4518 f4e4 - ifconst MOUSEXONLY 4519 f4e4 -amigatoataribits ; swap bits 1 and 4... 4520 f4e4 - .byte %0000, %0000, %0010, %0010 4521 f4e4 - .byte %0000, %0000, %0010, %0010 4522 f4e4 - .byte %0001, %0001, %0011, %0011 4523 f4e4 - .byte %0001, %0001, %0011, %0011 4524 f4e4 - 4525 f4e4 - ; null change bits 4526 f4e4 - .byte %0000, %0001, %0010, %0011 4527 f4e4 - .byte %0000, %0001, %0010, %0011 4528 f4e4 - .byte %0000, %0001, %0010, %0011 4529 f4e4 - .byte %0000, %0001, %0010, %0011 4530 f4e4 - 4531 f4e4 - else ; !MOUSEXONLY 4532 f4e4 - 4533 f4e4 -amigatoataribits ; swap bits 1 and 4... 4534 f4e4 - .byte %0000, %1000, %0010, %1010 4535 f4e4 - .byte %0100, %1100, %0110, %1110 4536 f4e4 - .byte %0001, %1001, %0011, %1011 4537 f4e4 - .byte %0101, %1101, %0111, %1111 4538 f4e4 - ; null change bits 4539 f4e4 - .byte %0000, %0001, %0010, %0011 4540 f4e4 - .byte %0100, %0101, %0110, %0111 4541 f4e4 - .byte %1000, %1001, %1010, %1011 4542 f4e4 - .byte %1100, %1101, %1110, %1111 4543 f4e4 - endif ; !MOUSEXONLY 4544 f4e4 - 4545 f4e4 endif ; MOUSESUPPORT 4546 f4e4 4547 f4e4 mouse0update 4548 f4e4 - ifconst MOUSE0SUPPORT 4549 f4e4 - 4550 f4e4 -mousetableselect = inttemp2 4551 f4e4 -mousexdelta = inttemp3 4552 f4e4 -mouseydelta = inttemp4 4553 f4e4 -lastSWCHA = inttemp6 4554 f4e4 - 4555 f4e4 - ; 0000YyXx st mouse 4556 f4e4 - ; 0000xyXY amiga mouse 4557 f4e4 - 4558 f4e4 - lda #$ff 4559 f4e4 - sta lastSWCHA 4560 f4e4 - 4561 f4e4 - ldy port0control 4562 f4e4 - 4563 f4e4 - lda #%00010000 4564 f4e4 - cpy #9 ; AMIGA? 4565 f4e4 - bne skipamigabitsfix0 4566 f4e4 - lda #0 4567 f4e4 -skipamigabitsfix0 4568 f4e4 - sta mousetableselect 4569 f4e4 - ifconst DRIVINGBOOST 4570 f4e4 - cpy #6 ; DRIVING? 4571 f4e4 - bne skipdriving0setup 4572 f4e4 - ; swap mousex0 and mousey0. mousex seen by the 7800basic program 4573 f4e4 - ; trails the actual mousex0, so we can smoothly interpolate toward 4574 f4e4 - ; the actual position. This actual position is stored in mousey0 4575 f4e4 - ; after the driver has run. 4576 f4e4 - ldx mousex0 4577 f4e4 - lda mousey0 4578 f4e4 - stx mousey0 4579 f4e4 - sta mousex0 4580 f4e4 -skipdriving0setup 4581 f4e4 - endif ; DRIVINGBOOST 4582 f4e4 - 4583 f4e4 - lda #0 4584 f4e4 - sta mousexdelta 4585 f4e4 - sta mouseydelta 4586 f4e4 - 4587 f4e4 - ifnconst MOUSETIME 4588 f4e4 - ifnconst MOUSEXONLY 4589 f4e4 - lda #180 ; minimum for x+y 4590 f4e4 - else 4591 f4e4 - lda #100 ; minimum for just x 4592 f4e4 - endif 4593 f4e4 - else 4594 f4e4 - lda #MOUSETIME 4595 f4e4 - endif 4596 f4e4 - jsr SETTIM64T ; INTIM is in Y 4597 f4e4 - 4598 f4e4 -mouse0updateloop 4599 f4e4 - lda SWCHA 4600 f4e4 - asr #%11110000 ; Undocumented. A = A & #IMM, then LSR A. 4601 f4e4 - cmp lastSWCHA 4602 f4e4 - beq mouse0loopcondition 4603 f4e4 - sta lastSWCHA 4604 f4e4 - lsr 4605 f4e4 - lsr 4606 f4e4 - lsr 4607 f4e4 - 4608 f4e4 - ora mousetableselect ; atari/amiga decoding table selection 4609 f4e4 - 4610 f4e4 - ; st mice encode on different bits/joystick-lines than amiga mice... 4611 f4e4 - ; 0000YyXx st mouse 4612 f4e4 - ; 0000xyXY amiga mouse 4613 f4e4 - ; ...so can shuffle the amiga bits to reuse the st driver. 4614 f4e4 - tay 4615 f4e4 - lax amigatoataribits,y 4616 f4e4 - 4617 f4e4 - ifnconst MOUSEXONLY 4618 f4e4 - ; first the Y... 4619 f4e4 - and #%00001100 4620 f4e4 - ora mousecodey0 4621 f4e4 - tay 4622 f4e4 - lda rotationalcompare,y 4623 f4e4 - clc 4624 f4e4 - adc mouseydelta 4625 f4e4 - sta mouseydelta 4626 f4e4 - tya 4627 f4e4 - lsr 4628 f4e4 - lsr 4629 f4e4 - sta mousecodey0 4630 f4e4 - txa 4631 f4e4 - ; ...then the X... 4632 f4e4 - and #%00000011 4633 f4e4 - tax 4634 f4e4 - endif ; !MOUSEXONLY 4635 f4e4 - 4636 f4e4 - asl 4637 f4e4 - asl 4638 f4e4 - ora mousecodex0 4639 f4e4 - tay 4640 f4e4 - lda rotationalcompare,y 4641 f4e4 - adc mousexdelta ; carry was clear by previous ASL 4642 f4e4 - sta mousexdelta 4643 f4e4 - stx mousecodex0 4644 f4e4 -mouse0loopcondition 4645 f4e4 - lda TIMINT 4646 f4e4 - bpl mouse0updateloop 4647 f4e4 - 4648 f4e4 - ; *** adapt to selected device resolution. 4649 f4e4 - ldx port0control 4650 f4e4 - 4651 f4e4 - ifconst PRECISIONMOUSING 4652 f4e4 - ldy port0resolution 4653 f4e4 - bne mouse0halveddone 4654 f4e4 - cpx #6 ; half-resolution is no good for driving wheels 4655 f4e4 - beq mouse0halveddone 4656 f4e4 - ; resolution=0 is half mouse resolution, necessary for precision 4657 f4e4 - ; mousing on a 160x240 screen with a 1000 dpi mouse. 4658 f4e4 - 4659 f4e4 - lda mousexdelta 4660 f4e4 - cmp #$80 4661 f4e4 - ror ; do a signed divide by 2. 4662 f4e4 - clc 4663 f4e4 - adc mousex0 4664 f4e4 - sta mousex0 4665 f4e4 - ifnconst MOUSEXONLY 4666 f4e4 - lda mouseydelta 4667 f4e4 - clc 4668 f4e4 - adc mousey0 4669 f4e4 - sta mousey0 4670 f4e4 - endif 4671 f4e4 - ; at half resolution we just exit after updating x and y 4672 f4e4 - jmp LLRET0 4673 f4e4 -mouse0halveddone 4674 f4e4 - endif ; PRECISIONMOUSING 4675 f4e4 - 4676 f4e4 - ifnconst MOUSEXONLY 4677 f4e4 - asl mouseydelta ; *2 because Y resolution is finer 4678 f4e4 - ldy port0resolution 4679 f4e4 - dey 4680 f4e4 - lda #0 4681 f4e4 -mousey0resolutionfix 4682 f4e4 - clc 4683 f4e4 - adc mouseydelta 4684 f4e4 - dey 4685 f4e4 - bpl mousey0resolutionfix 4686 f4e4 - clc 4687 f4e4 - adc mousey0 4688 f4e4 - sta mousey0 4689 f4e4 - endif ; MOUSEXONLY 4690 f4e4 - 4691 f4e4 - ldy port0resolution 4692 f4e4 - dey 4693 f4e4 - lda #0 4694 f4e4 -mousex0resolutionfix 4695 f4e4 - clc 4696 f4e4 - adc mousexdelta 4697 f4e4 - dey 4698 f4e4 - bpl mousex0resolutionfix 4699 f4e4 - ifnconst DRIVINGBOOST 4700 f4e4 - clc 4701 f4e4 - adc mousex0 4702 f4e4 - sta mousex0 4703 f4e4 - else 4704 f4e4 - cpx #6 4705 f4e4 - beq carryonmouse0boost 4706 f4e4 - clc 4707 f4e4 - adc mousex0 4708 f4e4 - sta mousex0 4709 f4e4 - jmp LLRET0 4710 f4e4 -carryonmouse0boost 4711 f4e4 - sta mousexdelta 4712 f4e4 - clc 4713 f4e4 - adc mousecodey0 4714 f4e4 - sta mousecodey0 4715 f4e4 - clc 4716 f4e4 - adc mousex0 4717 f4e4 - tay ; save the target X 4718 f4e4 - adc mousey0 ; average in the smoothly-trailing X 4719 f4e4 - ror 4720 f4e4 - sta mousex0 ; mousex0 now has the smoothly trailing X 4721 f4e4 - sty mousey0 ; and mousey0 has the the target X 4722 f4e4 - 4723 f4e4 - ; check to see if the coordinate wrapped. If so, undo the averaging code. 4724 f4e4 - ; A has mousex0, the smoothly trailing X 4725 f4e4 - sbc mousey0 ; less the target X 4726 f4e4 - bpl skipabsolutedrive0 4727 f4e4 - eor #$ff 4728 f4e4 -skipabsolutedrive0 4729 f4e4 - cmp #64 ; just an unreasonably large change 4730 f4e4 - bcc skipdrivewrapfix0 4731 f4e4 - sty mousex0 ; if X wrapped, we catch the trailing X up to the target X 4732 f4e4 -skipdrivewrapfix0 4733 f4e4 - 4734 f4e4 - ; get rid of the tweening if the distance travelled was very small 4735 f4e4 - lda mousexdelta 4736 f4e4 - cmp port0resolution 4737 f4e4 - bcs skipbetweenfix0 4738 f4e4 - lda mousex0 4739 f4e4 - sta mousey0 4740 f4e4 -skipbetweenfix0 4741 f4e4 - 4742 f4e4 -drivingboostreductioncheck0 4743 f4e4 - ; The below code amounts to mousecodey0=mousecodey0-(mousecodey0/8) 4744 f4e4 - ; +ve mousecodey0 is converted to -ve to do the calculation, and then 4745 f4e4 - ; negated again because truncation during BCD math results in 4746 f4e4 - ; differing magnitudes, depending if the value is +ve or -ve. 4747 f4e4 -driving0fix 4748 f4e4 - lax mousecodey0 4749 f4e4 - cmp #$80 4750 f4e4 - bcs driving0skipnegate1 4751 f4e4 - eor #$FF 4752 f4e4 - adc #1 4753 f4e4 - sta mousecodey0 4754 f4e4 -driving0skipnegate1 4755 f4e4 - cmp #$80 4756 f4e4 - ror 4757 f4e4 - cmp #$80 4758 f4e4 - ror 4759 f4e4 - cmp #$80 4760 f4e4 - ror 4761 f4e4 - sta inttemp1 4762 f4e4 - lda mousecodey0 4763 f4e4 - sec 4764 f4e4 - sbc inttemp1 4765 f4e4 - cpx #$80 4766 f4e4 - bcs driving0skipnegate2 4767 f4e4 - eor #$FF 4768 f4e4 - adc #1 4769 f4e4 -driving0skipnegate2 4770 f4e4 - sta mousecodey0 4771 f4e4 -drivingboostdone0 4772 f4e4 - endif ; DRIVINGBOOST 4773 f4e4 - 4774 f4e4 - jmp LLRET0 4775 f4e4 - 4776 f4e4 endif ; MOUSE0SUPPORT 4777 f4e4 4778 f4e4 mouse1update 4779 f4e4 - ifconst MOUSE1SUPPORT 4780 f4e4 - 4781 f4e4 -mousetableselect = inttemp2 4782 f4e4 -mousexdelta = inttemp3 4783 f4e4 -mouseydelta = inttemp4 4784 f4e4 -lastSWCHA = inttemp6 4785 f4e4 - 4786 f4e4 - ; 0000YyXx st mouse 4787 f4e4 - ; 0000xyXY amiga mouse 4788 f4e4 - 4789 f4e4 - lda #$ff 4790 f4e4 - sta lastSWCHA 4791 f4e4 - 4792 f4e4 - ldy port1control 4793 f4e4 - 4794 f4e4 - lda #%00010000 4795 f4e4 - cpy #9 ; AMIGA? 4796 f4e4 - bne skipamigabitsfix1 4797 f4e4 - lda #0 4798 f4e4 -skipamigabitsfix1 4799 f4e4 - sta mousetableselect 4800 f4e4 - ifconst DRIVINGBOOST 4801 f4e4 - cpy #6 ; DRIVING? 4802 f4e4 - bne skipdriving1setup 4803 f4e4 - ; swap mousex1 and mousey1. mousex seen by the 7800basic program 4804 f4e4 - ; trails the actual mousex1, so we can smoothly interpolate toward 4805 f4e4 - ; the actual position. This actual position is stored in mousey1 4806 f4e4 - ; after the driver has run. 4807 f4e4 - ldx mousex1 4808 f4e4 - lda mousey1 4809 f4e4 - stx mousey1 4810 f4e4 - sta mousex1 4811 f4e4 -skipdriving1setup 4812 f4e4 - endif ; DRIVINGBOOST 4813 f4e4 - 4814 f4e4 - lda #0 4815 f4e4 - sta mousexdelta 4816 f4e4 - sta mouseydelta 4817 f4e4 - 4818 f4e4 - ifnconst MOUSETIME 4819 f4e4 - ifnconst MOUSEXONLY 4820 f4e4 - lda #180 ; minimum for x+y 4821 f4e4 - else 4822 f4e4 - lda #100 ; minimum for just x 4823 f4e4 - endif 4824 f4e4 - else 4825 f4e4 - lda #MOUSETIME 4826 f4e4 - endif 4827 f4e4 - jsr SETTIM64T ; INTIM is in Y 4828 f4e4 - 4829 f4e4 -mouse1updateloop 4830 f4e4 - lda SWCHA 4831 f4e4 - and #%00001111 4832 f4e4 - cmp lastSWCHA 4833 f4e4 - beq mouse1loopcondition 4834 f4e4 - sta lastSWCHA 4835 f4e4 - 4836 f4e4 - ora mousetableselect ; atari/amiga decoding table selection 4837 f4e4 - 4838 f4e4 - ; st mice encode on different bits/joystick-lines than amiga mice... 4839 f4e4 - ; 0000YyXx st mouse 4840 f4e4 - ; 0000xyXY amiga mouse 4841 f4e4 - ; ...so can shuffle the amiga bits to reuse the st driver. 4842 f4e4 - tay 4843 f4e4 - lax amigatoataribits,y 4844 f4e4 - 4845 f4e4 - ifnconst MOUSEXONLY 4846 f4e4 - ; first the Y... 4847 f4e4 - and #%00001100 4848 f4e4 - ora mousecodey1 4849 f4e4 - tay 4850 f4e4 - lda rotationalcompare,y 4851 f4e4 - clc 4852 f4e4 - adc mouseydelta 4853 f4e4 - sta mouseydelta 4854 f4e4 - tya 4855 f4e4 - lsr 4856 f4e4 - lsr 4857 f4e4 - sta mousecodey1 4858 f4e4 - txa 4859 f4e4 - ; ...then the X... 4860 f4e4 - and #%00000011 4861 f4e4 - tax 4862 f4e4 - endif ; !MOUSEXONLY 4863 f4e4 - 4864 f4e4 - asl 4865 f4e4 - asl 4866 f4e4 - ora mousecodex1 4867 f4e4 - tay 4868 f4e4 - lda rotationalcompare,y 4869 f4e4 - adc mousexdelta ; carry was clear by previous ASL 4870 f4e4 - sta mousexdelta 4871 f4e4 - stx mousecodex1 4872 f4e4 -mouse1loopcondition 4873 f4e4 - lda TIMINT 4874 f4e4 - bpl mouse1updateloop 4875 f4e4 - 4876 f4e4 - ; *** adapt to selected device resolution. 4877 f4e4 - ldx port1control 4878 f4e4 - 4879 f4e4 - ifconst PRECISIONMOUSING 4880 f4e4 - ldy port1resolution 4881 f4e4 - bne mouse1halveddone 4882 f4e4 - cpx #6 ; half-resolution is no good for driving wheels 4883 f4e4 - beq mouse1halveddone 4884 f4e4 - ; resolution=0 is half mouse resolution, necessary for precision 4885 f4e4 - ; mousing on a 160x240 screen with a 1000 dpi mouse. 4886 f4e4 - 4887 f4e4 - lda mousexdelta 4888 f4e4 - cmp #$80 4889 f4e4 - ror ; do a signed divide by 2. 4890 f4e4 - clc 4891 f4e4 - adc mousex1 4892 f4e4 - sta mousex1 4893 f4e4 - ifnconst MOUSEXONLY 4894 f4e4 - lda mouseydelta 4895 f4e4 - clc 4896 f4e4 - adc mousey1 4897 f4e4 - sta mousey1 4898 f4e4 - endif 4899 f4e4 - ; at half resolution we just exit after updating x and y 4900 f4e4 - jmp LLRET1 4901 f4e4 -mouse1halveddone 4902 f4e4 - endif ; PRECISIONMOUSING 4903 f4e4 - 4904 f4e4 - ifnconst MOUSEXONLY 4905 f4e4 - asl mouseydelta ; *2 because Y resolution is finer 4906 f4e4 - ldy port1resolution 4907 f4e4 - dey 4908 f4e4 - lda #0 4909 f4e4 -mousey1resolutionfix 4910 f4e4 - clc 4911 f4e4 - adc mouseydelta 4912 f4e4 - dey 4913 f4e4 - bpl mousey1resolutionfix 4914 f4e4 - clc 4915 f4e4 - adc mousey1 4916 f4e4 - sta mousey1 4917 f4e4 - endif ; MOUSEXONLY 4918 f4e4 - 4919 f4e4 - ldy port1resolution 4920 f4e4 - dey 4921 f4e4 - lda #0 4922 f4e4 -mousex1resolutionfix 4923 f4e4 - clc 4924 f4e4 - adc mousexdelta 4925 f4e4 - dey 4926 f4e4 - bpl mousex1resolutionfix 4927 f4e4 - ifnconst DRIVINGBOOST 4928 f4e4 - clc 4929 f4e4 - adc mousex1 4930 f4e4 - sta mousex1 4931 f4e4 - else 4932 f4e4 - cpx #6 4933 f4e4 - beq carryonmouse1boost 4934 f4e4 - clc 4935 f4e4 - adc mousex1 4936 f4e4 - sta mousex1 4937 f4e4 - jmp LLRET1 4938 f4e4 -carryonmouse1boost 4939 f4e4 - sta mousexdelta 4940 f4e4 - clc 4941 f4e4 - adc mousecodey1 4942 f4e4 - sta mousecodey1 4943 f4e4 - clc 4944 f4e4 - adc mousex1 4945 f4e4 - tay ; save the target X 4946 f4e4 - adc mousey1 ; average in the smoothly-trailing X 4947 f4e4 - ror 4948 f4e4 - sta mousex1 ; mousex0 now has the smoothly trailing X 4949 f4e4 - sty mousey1 ; and mousey0 has the the target X 4950 f4e4 - 4951 f4e4 - ; check to see if the coordinate wrapped. If so, undo the averaging code. 4952 f4e4 - ; A has mousex1, the smoothly trailing X 4953 f4e4 - sbc mousey1 ; less the target X 4954 f4e4 - bpl skipabsolutedrive1 4955 f4e4 - eor #$ff 4956 f4e4 -skipabsolutedrive1 4957 f4e4 - cmp #64 ; just an unreasonably large change 4958 f4e4 - bcc skipdrivewrapfix1 4959 f4e4 - sty mousex1 ; if X wrapped, we catch the trailing X up to the target X 4960 f4e4 -skipdrivewrapfix1 4961 f4e4 - 4962 f4e4 - ; get rid of the tweening if the distance travelled was very small 4963 f4e4 - lda mousexdelta 4964 f4e4 - cmp port1resolution 4965 f4e4 - bcs skipbetweenfix1 4966 f4e4 - lda mousex1 4967 f4e4 - sta mousey1 4968 f4e4 -skipbetweenfix1 4969 f4e4 - 4970 f4e4 -drivingboostreductioncheck1 4971 f4e4 - ; The below code amounts to mousecodey0=mousecodey0-(mousecodey0/8) 4972 f4e4 - ; +ve mousecodey0 is converted to -ve to do the calculation, and then 4973 f4e4 - ; negated again because truncation during BCD math results in 4974 f4e4 - ; differing magnitudes, depending if the value is +ve or -ve. 4975 f4e4 -driving1fix 4976 f4e4 - lax mousecodey1 4977 f4e4 - cmp #$80 4978 f4e4 - bcs driving0skipnegate1 4979 f4e4 - eor #$FF 4980 f4e4 - adc #1 4981 f4e4 - sta mousecodey1 4982 f4e4 -driving0skipnegate1 4983 f4e4 - cmp #$80 4984 f4e4 - ror 4985 f4e4 - cmp #$80 4986 f4e4 - ror 4987 f4e4 - cmp #$80 4988 f4e4 - ror 4989 f4e4 - sta inttemp1 4990 f4e4 - lda mousecodey1 4991 f4e4 - sec 4992 f4e4 - sbc inttemp1 4993 f4e4 - cpx #$80 4994 f4e4 - bcs driving1skipnegate2 4995 f4e4 - eor #$FF 4996 f4e4 - adc #1 4997 f4e4 -driving1skipnegate2 4998 f4e4 - sta mousecodey1 4999 f4e4 -drivingboostdone1 5000 f4e4 - endif ; DRIVINGBOOST 5001 f4e4 - 5002 f4e4 - jmp LLRET1 5003 f4e4 - 5004 f4e4 endif ; MOUSE1SUPPORT 5005 f4e4 5006 f4e4 5007 f4e4 trakball0update 5008 f4e4 - ifconst TRAKBALL0SUPPORT 5009 f4e4 - ifnconst TRAKTIME 5010 f4e4 - ifnconst TRAKXONLY 5011 f4e4 - lda #180 ; minimum for x+y 5012 f4e4 - else ; !TRAKXONLY 5013 f4e4 - lda #100 ; minimum for just x 5014 f4e4 - endif ; !TRAKXONLY 5015 f4e4 - else ; !TRAKTIME 5016 f4e4 - lda #TRAKTIME 5017 f4e4 - endif ; !TRAKTIME 5018 f4e4 - jsr SETTIM64T ; INTIM is in Y 5019 f4e4 - ldx #0 5020 f4e4 - ifnconst TRAKXONLY 5021 f4e4 - ldy #0 5022 f4e4 - endif ; TRAKXONLY 5023 f4e4 -trakball0updateloop 5024 f4e4 - lda SWCHA 5025 f4e4 - and #%00110000 5026 f4e4 - cmp trakballcodex0 5027 f4e4 - sta trakballcodex0 5028 f4e4 - beq trakball0movementXdone 5029 f4e4 - and #%00010000 5030 f4e4 - beq trakball0negativeX 5031 f4e4 -trakball0positiveX 5032 f4e4 - ;(2 from beq) 5033 f4e4 - inx ; 2 5034 f4e4 - jmp trakball0movementXdone ; 3 5035 f4e4 -trakball0negativeX 5036 f4e4 - ;(3 from beq) 5037 f4e4 - dex ; 2 5038 f4e4 - nop ; 2 5039 f4e4 -trakball0movementXdone 5040 f4e4 - 5041 f4e4 - ifnconst TRAKXONLY 5042 f4e4 - lda SWCHA 5043 f4e4 - and #%11000000 5044 f4e4 - cmp trakballcodey0 5045 f4e4 - sta trakballcodey0 5046 f4e4 - beq trakball0movementYdone 5047 f4e4 - and #%01000000 5048 f4e4 - beq trakball0negativeY 5049 f4e4 -trakball0positiveY 5050 f4e4 - ;(2 from beq) 5051 f4e4 - iny ; 2 5052 f4e4 - jmp trakball0movementYdone ; 3 5053 f4e4 -trakball0negativeY 5054 f4e4 - ;(3 from beq) 5055 f4e4 - dey ; 2 5056 f4e4 - nop ; 2 5057 f4e4 -trakball0movementYdone 5058 f4e4 - endif ; !TRAKXONLY 5059 f4e4 - 5060 f4e4 - lda TIMINT 5061 f4e4 - bpl trakball0updateloop 5062 f4e4 - lda #0 5063 f4e4 - cpx #0 5064 f4e4 - beq trakball0skipXadjust 5065 f4e4 - clc 5066 f4e4 -trakball0Xloop 5067 f4e4 - adc port0resolution 5068 f4e4 - dex 5069 f4e4 - bne trakball0Xloop 5070 f4e4 - clc 5071 f4e4 - adc trakballx0 5072 f4e4 - sta trakballx0 5073 f4e4 -trakball0skipXadjust 5074 f4e4 - ifnconst TRAKXONLY 5075 f4e4 - lda #0 5076 f4e4 - cpy #0 5077 f4e4 - beq trakball0skipYadjust 5078 f4e4 - clc 5079 f4e4 -trakball0yloop 5080 f4e4 - adc port0resolution 5081 f4e4 - dey 5082 f4e4 - bne trakball0yloop 5083 f4e4 - clc 5084 f4e4 - adc trakbally0 5085 f4e4 - sta trakbally0 5086 f4e4 -trakball0skipYadjust 5087 f4e4 - endif ; !TRAKXONLY 5088 f4e4 - 5089 f4e4 - jmp LLRET0 5090 f4e4 endif 5091 f4e4 5092 f4e4 5093 f4e4 5094 f4e4 trakball1update 5095 f4e4 - ifconst TRAKBALL1SUPPORT 5096 f4e4 - ifnconst TRAKTIME 5097 f4e4 - ifnconst TRAKXONLY 5098 f4e4 - lda #180 ; minimum for x+y 5099 f4e4 - else ; !TRAKXONLY 5100 f4e4 - lda #100 ; minimum for just x 5101 f4e4 - endif ; !TRAKXONLY 5102 f4e4 - else ; !TRAKTIME 5103 f4e4 - lda #TRAKTIME 5104 f4e4 - endif ; !TRAKTIME 5105 f4e4 - jsr SETTIM64T ; INTIM is in Y 5106 f4e4 - ldx #0 5107 f4e4 - ifnconst TRAKXONLY 5108 f4e4 - ldy #0 5109 f4e4 - endif ; TRAKXONLY 5110 f4e4 -trakball1updateloop 5111 f4e4 - lda SWCHA 5112 f4e4 - and #%00000011 5113 f4e4 - cmp trakballcodex1 5114 f4e4 - sta trakballcodex1 5115 f4e4 - beq trakball1movementXdone 5116 f4e4 - and #%00000001 5117 f4e4 - beq trakball1negativeX 5118 f4e4 -trakball1positiveX 5119 f4e4 - ;(2 from beq) 5120 f4e4 - inx ; 2 5121 f4e4 - jmp trakball1movementXdone ; 3 5122 f4e4 -trakball1negativeX 5123 f4e4 - ;(3 from beq) 5124 f4e4 - dex ; 2 5125 f4e4 - nop ; 2 5126 f4e4 -trakball1movementXdone 5127 f4e4 - 5128 f4e4 - ifnconst TRAKXONLY 5129 f4e4 - lda SWCHA 5130 f4e4 - and #%00001100 5131 f4e4 - cmp trakballcodey1 5132 f4e4 - sta trakballcodey1 5133 f4e4 - beq trakball1movementYdone 5134 f4e4 - and #%00000100 5135 f4e4 - beq trakball1negativeY 5136 f4e4 -trakball1positiveY 5137 f4e4 - ;(2 from beq) 5138 f4e4 - iny ; 2 5139 f4e4 - jmp trakball1movementYdone ; 3 5140 f4e4 -trakball1negativeY 5141 f4e4 - ;(3 from beq) 5142 f4e4 - dey ; 2 5143 f4e4 - nop ; 2 5144 f4e4 -trakball1movementYdone 5145 f4e4 - endif ; !TRAKXONLY 5146 f4e4 - 5147 f4e4 - lda TIMINT 5148 f4e4 - bpl trakball1updateloop 5149 f4e4 - lda #0 5150 f4e4 - cpx #0 5151 f4e4 - beq trakball1skipXadjust 5152 f4e4 - clc 5153 f4e4 -trakball1Xloop 5154 f4e4 - adc port1resolution 5155 f4e4 - dex 5156 f4e4 - bne trakball1Xloop 5157 f4e4 - clc 5158 f4e4 - adc trakballx1 5159 f4e4 - sta trakballx1 5160 f4e4 -trakball1skipXadjust 5161 f4e4 - ifnconst TRAKXONLY 5162 f4e4 - lda #0 5163 f4e4 - cpy #0 5164 f4e4 - beq trakball1skipYadjust 5165 f4e4 - clc 5166 f4e4 -trakball1yloop 5167 f4e4 - adc port1resolution 5168 f4e4 - dey 5169 f4e4 - bne trakball1yloop 5170 f4e4 - clc 5171 f4e4 - adc trakbally1 5172 f4e4 - sta trakbally1 5173 f4e4 -trakball1skipYadjust 5174 f4e4 - endif ; !TRAKXONLY 5175 f4e4 - 5176 f4e4 - jmp LLRET1 5177 f4e4 endif 5178 f4e4 5179 f4e4 5180 f4e4 paddleport0update 5181 f4e4 - ifconst PADDLE0SUPPORT 5182 f4e4 - lda #6 5183 f4e4 - sta VBLANK ; start charging the paddle caps 5184 f4e4 - lda #0 ; use PADDLE timing 5185 f4e4 - jsr SETTIM64T ; INTIM is in Y 5186 f4e4 - 5187 f4e4 -paddleport0updateloop 5188 f4e4 - lda INPT0 5189 f4e4 - bmi skippaddle0setposition 5190 f4e4 - sty paddleposition0 5191 f4e4 -skippaddle0setposition 5192 f4e4 - ifconst TWOPADDLESUPPORT 5193 f4e4 - lda INPT1 5194 f4e4 - bmi skippaddle1setposition 5195 f4e4 - sty paddleposition1 5196 f4e4 -skippaddle1setposition 5197 f4e4 - endif 5198 f4e4 - ldy INTIM 5199 f4e4 - cpy #TIMEOFFSET 5200 f4e4 - bcs paddleport0updateloop 5201 f4e4 - 5202 f4e4 - lda #%10000110 5203 f4e4 - sta VBLANK ; dump paddles to ground... this may not be great for genesis controllers 5204 f4e4 - sec 5205 f4e4 - lda paddleposition0 5206 f4e4 - sbc #TIMEOFFSET 5207 f4e4 - ifconst PADDLESCALEX2 5208 f4e4 - asl 5209 f4e4 - endif 5210 f4e4 - 5211 f4e4 - ifnconst PADDLESMOOTHINGOFF 5212 f4e4 - clc 5213 f4e4 - adc paddleprevious0 5214 f4e4 - ror 5215 f4e4 - sta paddleprevious0 5216 f4e4 - endif 5217 f4e4 - 5218 f4e4 - sta paddleposition0 5219 f4e4 - 5220 f4e4 - ifconst TWOPADDLESUPPORT 5221 f4e4 - sec 5222 f4e4 - lda paddleposition1 5223 f4e4 - sbc #TIMEOFFSET 5224 f4e4 - ifconst PADDLESCALEX2 5225 f4e4 - asl 5226 f4e4 - endif 5227 f4e4 - 5228 f4e4 - ifnconst PADDLESMOOTHINGOFF 5229 f4e4 - clc 5230 f4e4 - adc paddleprevious1 5231 f4e4 - ror 5232 f4e4 - sta paddleprevious1 5233 f4e4 - endif 5234 f4e4 - sta paddleposition1 5235 f4e4 - endif ; TWOPADDLESUPPORT 5236 f4e4 - 5237 f4e4 - jmp LLRET0 5238 f4e4 endif 5239 f4e4 5240 f4e4 paddleport1update 5241 f4e4 - ifconst PADDLE1SUPPORT 5242 f4e4 - lda #6 5243 f4e4 - sta VBLANK ; start charging the paddle caps 5244 f4e4 - 5245 f4e4 - lda #0 ; use PADDLE timing 5246 f4e4 - jsr SETTIM64T ; INTIM is in Y 5247 f4e4 - 5248 f4e4 -paddleport1updateloop 5249 f4e4 - lda INPT2 5250 f4e4 - bmi skippaddle2setposition 5251 f4e4 - sty paddleposition2 5252 f4e4 -skippaddle2setposition 5253 f4e4 - ifconst TWOPADDLESUPPORT 5254 f4e4 - lda INPT3 5255 f4e4 - bmi skippaddle3setposition 5256 f4e4 - sty paddleposition3 5257 f4e4 -skippaddle3setposition 5258 f4e4 - endif 5259 f4e4 - ldy INTIM 5260 f4e4 - cpy #TIMEOFFSET 5261 f4e4 - bcs paddleport1updateloop 5262 f4e4 - 5263 f4e4 - lda #%10000110 5264 f4e4 - sta VBLANK ; dump paddles to ground... this may not be great for genesis controllers 5265 f4e4 - sec 5266 f4e4 - lda paddleposition2 5267 f4e4 - sbc #TIMEOFFSET 5268 f4e4 - ifconst PADDLESCALEX2 5269 f4e4 - asl 5270 f4e4 - endif 5271 f4e4 - 5272 f4e4 - ifnconst PADDLESMOOTHINGOFF 5273 f4e4 - clc 5274 f4e4 - adc paddleprevious2 5275 f4e4 - ror 5276 f4e4 - sta paddleprevious2 5277 f4e4 - endif 5278 f4e4 - 5279 f4e4 - sta paddleposition2 5280 f4e4 - 5281 f4e4 - ifconst TWOPADDLESUPPORT 5282 f4e4 - sec 5283 f4e4 - lda paddleposition3 5284 f4e4 - sbc #TIMEOFFSET 5285 f4e4 - ifconst PADDLESCALEX2 5286 f4e4 - asl 5287 f4e4 - endif 5288 f4e4 - 5289 f4e4 - ifnconst PADDLESMOOTHINGOFF 5290 f4e4 - clc 5291 f4e4 - adc paddleprevious3 5292 f4e4 - ror 5293 f4e4 - sta paddleprevious3 5294 f4e4 - endif 5295 f4e4 - sta paddleposition3 5296 f4e4 - endif ; TWOPADDLESUPPORT 5297 f4e4 - 5298 f4e4 - jmp LLRET1 5299 f4e4 endif 5300 f4e4 5301 f4e4 5302 f4e4 paddlebuttonhandler ; outside of conditional, for button-handler LUT 5303 f4e4 - ifconst PADDLESUPPORT 5304 f4e4 - ; x=0|1 for port, rather than paddle #. 5305 f4e4 - ; Only the first paddle button will integrate into "joy0fire" testing. If the 5306 f4e4 - ; game wants to support 2 paddles, up to the game to instead test the 5307 f4e4 - ; joystick right+left directions instead. 5308 f4e4 - lda SWCHA ; top of nibble is first paddle button 5309 f4e4 - cpx #0 ; port 0? 5310 f4e4 - beq skippaddleport2shift 5311 f4e4 - asl ; shift second port to upper nibble 5312 f4e4 - asl 5313 f4e4 - asl 5314 f4e4 - asl 5315 f4e4 -skippaddleport2shift 5316 f4e4 - and #%10000000 5317 f4e4 - eor #%10000000 ; invert 5318 f4e4 - sta sINPT1,x 5319 f4e4 - jmp buttonreadloopreturn 5320 f4e4 endif ; PADDLESUPPORT 5321 f4e4 5322 f4e4 mousebuttonhandler ; outside of conditional, for button-handler LUT 5323 f4e4 - ifconst MOUSESUPPORT 5324 f4e4 - ; stick the mouse buttons in the correct shadow register... 5325 f4e4 - txa 5326 f4e4 - asl 5327 f4e4 - tay ; y=x*2 5328 f4e4 - lda INPT4,x 5329 f4e4 - eor #%10000000 5330 f4e4 - lsr 5331 f4e4 - sta sINPT1,x 5332 f4e4 - 5333 f4e4 - lda INPT1,y 5334 f4e4 - and #%10000000 5335 f4e4 - eor #%10000000 5336 f4e4 - ora sINPT1,x 5337 f4e4 - sta sINPT1,x 5338 f4e4 - jmp buttonreadloopreturn 5339 f4e4 endif ; MOUSESUPPORT 5340 f4e4 5341 f4e4 - ifconst KEYPADSUPPORT 5342 f4e4 - ; ** select keypad rows 0 to 3 over 4 frames... 5343 f4e4 -keypadrowselect 5344 f4e4 - ldy #0 5345 f4e4 - lda port0control 5346 f4e4 - cmp #7 5347 f4e4 - bne skipport0val 5348 f4e4 - iny ; y=y+1 5349 f4e4 -skipport0val 5350 f4e4 - lda port1control 5351 f4e4 - cmp #7 5352 f4e4 - bne skipport1val 5353 f4e4 - iny 5354 f4e4 - iny ; y=y+2 5355 f4e4 -skipport1val 5356 f4e4 - lda keyrowdirectionmask,y 5357 f4e4 - sta CTLSWA 5358 f4e4 - tya 5359 f4e4 - asl 5360 f4e4 - asl 5361 f4e4 - sta inttemp1 5362 f4e4 - lda framecounter 5363 f4e4 - and #3 5364 f4e4 - ora inttemp1 5365 f4e4 - tax 5366 f4e4 - lda keyrowselectvalue,x 5367 f4e4 - sta SWCHA 5368 f4e4 - rts 5369 f4e4 - 5370 f4e4 -keyrowdirectionmask 5371 f4e4 - .byte #%00000000 ; 0 : port0=input port1=input 5372 f4e4 - .byte #%11110000 ; 1 : port0=output port1=input 5373 f4e4 - .byte #%00001111 ; 2 : port0=input port1=output 5374 f4e4 - .byte #%11111111 ; 3 : port0=output port1=output 5375 f4e4 - 5376 f4e4 -keyrowselectvalue 5377 f4e4 - .byte #%00000000, #%00000000, #%00000000, #%00000000 ; no row selected, all pins high, always 5378 f4e4 - .byte #%11100000, #%11010000, #%10110000, #%01110000 ; p0 keypad in 5379 f4e4 - .byte #%00001110, #%00001101, #%00001011, #%00000111 ; p1 keypad in 5380 f4e4 - .byte #%11101110, #%11011101, #%10111011, #%01110111 ; p0+p1 keypads in 5381 f4e4 endif ; KEYPADSUPPORT 5382 f4e4 5383 f4e4 - ifconst KEYPADSUPPORT 5384 f4e4 - ; TODO - split into compile-time KEYPAD0SUPPORT and KEYPAD1SUPPORT 5385 f4e4 -keypadcolumnread 5386 f4e4 - lda port0control 5387 f4e4 - cmp #7 5388 f4e4 - bne skipkeypadcolumnread0 5389 f4e4 - lda framecounter 5390 f4e4 - and #3 5391 f4e4 - asl ; x2 because keypad variables are interleaved 5392 f4e4 - tax 5393 f4e4 - lda #0 5394 f4e4 - sta keypadmatrix0a,x 5395 f4e4 - lda INPT0 5396 f4e4 - cmp #$80 5397 f4e4 - rol keypadmatrix0a,x 5398 f4e4 - lda INPT1 5399 f4e4 - cmp #$80 5400 f4e4 - rol keypadmatrix0a,x 5401 f4e4 - lda INPT4 5402 f4e4 - cmp #$80 5403 f4e4 - rol keypadmatrix0a,x 5404 f4e4 - lda keypadmatrix0a,x 5405 f4e4 - eor #%00000111 5406 f4e4 - sta keypadmatrix0a,x 5407 f4e4 -skipkeypadcolumnread0 5408 f4e4 - 5409 f4e4 - lda port1control 5410 f4e4 - cmp #7 5411 f4e4 - bne skipkeypadcolumnread1 5412 f4e4 - lda framecounter 5413 f4e4 - and #3 5414 f4e4 - asl ; x2 because keypad variables are interleaved 5415 f4e4 - tax 5416 f4e4 - lda #0 5417 f4e4 - sta keypadmatrix1a,x 5418 f4e4 - rol keypadmatrix1a,x 5419 f4e4 - lda INPT2 5420 f4e4 - cmp #$80 5421 f4e4 - rol keypadmatrix1a,x 5422 f4e4 - lda INPT3 5423 f4e4 - cmp #$80 5424 f4e4 - rol keypadmatrix1a,x 5425 f4e4 - lda INPT5 5426 f4e4 - cmp #$80 5427 f4e4 - rol keypadmatrix1a,x 5428 f4e4 - lda keypadmatrix1a,x 5429 f4e4 - eor #%00000111 5430 f4e4 - sta keypadmatrix1a,x 5431 f4e4 -skipkeypadcolumnread1 5432 f4e4 - rts 5433 f4e4 endif ; KEYPADSUPPORT 5434 f4e4 5435 f4e4 setportforinput 5436 f4e4 a5 e4 lda CTLSWAs 5437 f4e6 3d ef f4 and allpinsinputlut,x 5438 f4e9 85 e4 sta CTLSWAs 5439 f4eb 8d 81 02 sta CTLSWA 5440 f4ee 60 rts 5441 f4ef 5442 f4ef allpinsinputlut 5443 f4ef 0f f0 .byte.b $0F, $F0 5444 f4f1 5445 f4f1 setonebuttonmode 5446 f4f1 a9 06 lda #6 ; in case we're in unlocked-bios mode 5447 f4f3 85 01 sta VBLANK ; if we were on paddles, the line is grounded out. 5448 f4f5 a9 14 lda #$14 5449 f4f7 8d 83 02 sta CTLSWB ; set both 2-button disable bits to writable 5450 f4fa a5 e5 lda CTLSWBs 5451 f4fc 1d 05 f5 ora thisjoy2buttonbit,x 5452 f4ff 85 e5 sta CTLSWBs 5453 f501 8d 82 02 sta SWCHB ; turn off the 2-button disable bits 5454 f504 60 rts 5455 f505 5456 f505 thisjoy2buttonbit 5457 f505 04 10 .byte.b $04, $10 5458 f507 5459 f507 settwobuttonmode 5460 f507 a9 06 lda #6 ; in case we're in unlocked-bios mode 5461 f509 85 01 sta VBLANK ; if we were on paddles, the line is grounded out. 5462 f50b a9 14 lda #$14 5463 f50d 8d 83 02 sta CTLSWB ; set both 2-button disable bits to writable 5464 f510 a5 e5 lda CTLSWBs 5465 f512 3d 1b f5 and thisjoy2buttonmask,x 5466 f515 85 e5 sta CTLSWBs 5467 f517 8d 82 02 sta SWCHB 5468 f51a 60 rts 5469 f51b 5470 f51b thisjoy2buttonmask 5471 f51b fb ef .byte.b $fb, $ef 5472 f51d 5473 f51d ; Provided under the CC0 license. See the included LICENSE.txt for details. 5474 f51d 5475 f51d START 5476 f51d start 5477 f51d 5478 f51d ;******** more or less the Atari recommended startup procedure 5479 f51d 5480 f51d 78 sei 5481 f51e d8 cld 5482 f51f 5483 f51f ifnconst NOTIALOCK 5484 f51f a9 07 lda #$07 5485 f521 - else 5486 f521 - lda #$06 5487 f521 endif 5488 f521 85 01 sta INPTCTRL ;lock 7800 into 7800 mode 5489 f523 a9 7f lda #$7F 5490 f525 85 3c sta CTRL ;disable DMA 5491 f527 a9 00 lda #$00 5492 f529 85 38 sta OFFSET 5493 f52b ifnconst NOTIALOCK 5494 f52b 85 01 sta INPTCTRL 5495 f52d 85 20 sta BACKGRND ; black default, in case a flash cart is using something else 5496 f52f endif 5497 f52f a2 ff ldx #$FF 5498 f531 9a txs 5499 f532 5500 f532 ;************** Clear Memory 5501 f532 5502 f532 a2 40 ldx #$40 5503 f534 a9 00 lda #$00 5504 f536 crloop1 5505 f536 95 00 sta $00,x ;Clear zero page 5506 f538 9d 00 01 sta $100,x ;Clear page 1 5507 f53b e8 inx 5508 f53c d0 f8 bne crloop1 5509 f53e 5510 f53e 5511 f53e a0 00 ldy #$00 ;Clear Ram 5512 f540 a9 18 lda #$18 ;Start at $1800 5513 f542 85 81 sta $81 5514 f544 a9 00 lda #$00 5515 f546 85 80 sta $80 5516 f548 crloop3 5517 f548 a9 00 lda #$00 5518 f54a 91 80 sta ($80),y ;Store data 5519 f54c c8 iny ;Next byte 5520 f54d d0 f9 bne crloop3 ;Branch if not done page 5521 f54f e6 81 inc $81 ;Next page 5522 f551 a5 81 lda $81 5523 f553 c9 20 cmp #$20 ;End at $1FFF 5524 f555 d0 f1 bne crloop3 ;Branch if not 5525 f557 5526 f557 a0 00 ldy #$00 ;Clear Ram 5527 f559 a9 22 lda #$22 ;Start at $2200 5528 f55b 85 81 sta $81 5529 f55d a9 00 lda #$00 5530 f55f 85 80 sta $80 5531 f561 crloop4 5532 f561 a9 00 lda #$00 5533 f563 91 80 sta ($80),y ;Store data 5534 f565 c8 iny ;Next byte 5535 f566 d0 f9 bne crloop4 ;Branch if not done page 5536 f568 e6 81 inc $81 ;Next page 5537 f56a a5 81 lda $81 5538 f56c c9 27 cmp #$27 ;End at $27FF 5539 f56e d0 f1 bne crloop4 ;Branch if not 5540 f570 5541 f570 a2 00 ldx #$00 5542 f572 a9 00 lda #$00 5543 f574 crloop5 ;Clear 2100-213F, 2000-203F 5544 f574 9d 00 20 sta $2000,x 5545 f577 9d 00 21 sta $2100,x 5546 f57a e8 inx 5547 f57b e0 40 cpx #$40 5548 f57d d0 f5 bne crloop5 5549 f57f 5550 f57f 85 80 sta $80 5551 f581 85 81 sta $81 5552 f583 85 82 sta $82 5553 f585 85 83 sta $83 5554 f587 5555 f587 ;seed random number with hopefully-random timer value 5556 f587 a9 01 lda #1 5557 f589 0d 84 02 ora INTIM 5558 f58c 85 40 sta rand 5559 f58e 5560 f58e ; detect the console type... 5561 f58e pndetectvblankstart 5562 f58e a5 28 lda MSTAT 5563 f590 10 fc bpl pndetectvblankstart ; if we're not in VBLANK, wait for it to start 5564 f592 pndetectvblankover 5565 f592 a5 28 lda MSTAT 5566 f594 30 fc bmi pndetectvblankover ; then wait for it to be over 5567 f596 a0 00 ldy #$00 5568 f598 a2 00 ldx #$00 5569 f59a pndetectvblankhappening 5570 f59a a5 28 lda MSTAT 5571 f59c 30 07 bmi pndetectinvblank ; if VBLANK starts, exit our counting loop 5572 f59e 85 24 sta WSYNC 5573 f5a0 85 24 sta WSYNC 5574 f5a2 e8 inx 5575 f5a3 d0 f5 bne pndetectvblankhappening 5576 f5a5 pndetectinvblank 5577 f5a5 e0 7d cpx #125 5578 f5a7 90 02 bcc pndetecispal 5579 f5a9 a0 01 ldy #$01 5580 f5ab pndetecispal 5581 f5ab 8c 09 21 sty paldetected 5582 f5ae 5583 f5ae 20 4a f4 jsr createallgamedlls 5584 f5b1 5585 f5b1 a9 18 lda #>DLLMEM 5586 f5b3 85 2c sta DPPH 5587 f5b5 a9 00 lda # 255 5782 f5e0 -DOUBLEBUFFEROFFSET = 255 5783 f5e0 else 5784 f5e0 00 48 DOUBLEBUFFEROFFSET = (DLLASTOBJ+2) 5785 f5e0 endif 5786 f5e0 5787 f5e0 - ifconst EXTRADLMEMORY 5788 f5e0 -SECONDDLHALFSTART SET $2300 5789 f5e0 endif 5790 f5e0 5791 f5e0 DLPOINTH 5792 f5e0 DLINDEX SET 0 5793 f5e0 REPEAT WZONECOUNT 5794 f5e0 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5795 f5e0 - ifconst EXTRADLMEMORY 5796 f5e0 - if TMPMEMADDRESS > $1FFF 5797 f5e0 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5798 f5e0 - else 5799 f5e0 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5800 f5e0 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5801 f5e0 -SECONDDLHALFSTART SET TMPMEMADDRESS 5802 f5e0 - endif 5803 f5e0 - endif ; TMPMEMADDRESS > $1FFF 5804 f5e0 endif ; EXTRADLMEMORY 5805 f5e0 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 5806 f5e0 18 .byte.b >TMPMEMADDRESS 5807 f5e0 DLINDEX SET DLINDEX + 1 5793 f5e0 REPEND 5794 f5e0 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5795 f5e1 - ifconst EXTRADLMEMORY 5796 f5e1 - if TMPMEMADDRESS > $1FFF 5797 f5e1 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5798 f5e1 - else 5799 f5e1 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5800 f5e1 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5801 f5e1 -SECONDDLHALFSTART SET TMPMEMADDRESS 5802 f5e1 - endif 5803 f5e1 - endif ; TMPMEMADDRESS > $1FFF 5804 f5e1 endif ; EXTRADLMEMORY 5805 f5e1 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 5806 f5e1 18 .byte.b >TMPMEMADDRESS 5807 f5e1 DLINDEX SET DLINDEX + 1 5793 f5e1 REPEND 5794 f5e1 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5795 f5e2 - ifconst EXTRADLMEMORY 5796 f5e2 - if TMPMEMADDRESS > $1FFF 5797 f5e2 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5798 f5e2 - else 5799 f5e2 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5800 f5e2 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5801 f5e2 -SECONDDLHALFSTART SET TMPMEMADDRESS 5802 f5e2 - endif 5803 f5e2 - endif ; TMPMEMADDRESS > $1FFF 5804 f5e2 endif ; EXTRADLMEMORY 5805 f5e2 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 5806 f5e2 19 .byte.b >TMPMEMADDRESS 5807 f5e2 DLINDEX SET DLINDEX + 1 5793 f5e2 REPEND 5794 f5e2 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5795 f5e3 - ifconst EXTRADLMEMORY 5796 f5e3 - if TMPMEMADDRESS > $1FFF 5797 f5e3 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5798 f5e3 - else 5799 f5e3 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5800 f5e3 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5801 f5e3 -SECONDDLHALFSTART SET TMPMEMADDRESS 5802 f5e3 - endif 5803 f5e3 - endif ; TMPMEMADDRESS > $1FFF 5804 f5e3 endif ; EXTRADLMEMORY 5805 f5e3 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 5806 f5e3 19 .byte.b >TMPMEMADDRESS 5807 f5e3 DLINDEX SET DLINDEX + 1 5793 f5e3 REPEND 5794 f5e3 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5795 f5e4 - ifconst EXTRADLMEMORY 5796 f5e4 - if TMPMEMADDRESS > $1FFF 5797 f5e4 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5798 f5e4 - else 5799 f5e4 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5800 f5e4 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5801 f5e4 -SECONDDLHALFSTART SET TMPMEMADDRESS 5802 f5e4 - endif 5803 f5e4 - endif ; TMPMEMADDRESS > $1FFF 5804 f5e4 endif ; EXTRADLMEMORY 5805 f5e4 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 5806 f5e4 19 .byte.b >TMPMEMADDRESS 5807 f5e4 DLINDEX SET DLINDEX + 1 5793 f5e4 REPEND 5794 f5e4 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5795 f5e5 - ifconst EXTRADLMEMORY 5796 f5e5 - if TMPMEMADDRESS > $1FFF 5797 f5e5 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5798 f5e5 - else 5799 f5e5 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5800 f5e5 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5801 f5e5 -SECONDDLHALFSTART SET TMPMEMADDRESS 5802 f5e5 - endif 5803 f5e5 - endif ; TMPMEMADDRESS > $1FFF 5804 f5e5 endif ; EXTRADLMEMORY 5805 f5e5 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 5806 f5e5 19 .byte.b >TMPMEMADDRESS 5807 f5e5 DLINDEX SET DLINDEX + 1 5793 f5e5 REPEND 5794 f5e5 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5795 f5e6 - ifconst EXTRADLMEMORY 5796 f5e6 - if TMPMEMADDRESS > $1FFF 5797 f5e6 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5798 f5e6 - else 5799 f5e6 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5800 f5e6 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5801 f5e6 -SECONDDLHALFSTART SET TMPMEMADDRESS 5802 f5e6 - endif 5803 f5e6 - endif ; TMPMEMADDRESS > $1FFF 5804 f5e6 endif ; EXTRADLMEMORY 5805 f5e6 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 5806 f5e6 1a .byte.b >TMPMEMADDRESS 5807 f5e6 DLINDEX SET DLINDEX + 1 5793 f5e6 REPEND 5794 f5e6 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5795 f5e7 - ifconst EXTRADLMEMORY 5796 f5e7 - if TMPMEMADDRESS > $1FFF 5797 f5e7 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5798 f5e7 - else 5799 f5e7 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5800 f5e7 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5801 f5e7 -SECONDDLHALFSTART SET TMPMEMADDRESS 5802 f5e7 - endif 5803 f5e7 - endif ; TMPMEMADDRESS > $1FFF 5804 f5e7 endif ; EXTRADLMEMORY 5805 f5e7 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 5806 f5e7 1a .byte.b >TMPMEMADDRESS 5807 f5e7 DLINDEX SET DLINDEX + 1 5793 f5e7 REPEND 5794 f5e7 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5795 f5e8 - ifconst EXTRADLMEMORY 5796 f5e8 - if TMPMEMADDRESS > $1FFF 5797 f5e8 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5798 f5e8 - else 5799 f5e8 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5800 f5e8 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5801 f5e8 -SECONDDLHALFSTART SET TMPMEMADDRESS 5802 f5e8 - endif 5803 f5e8 - endif ; TMPMEMADDRESS > $1FFF 5804 f5e8 endif ; EXTRADLMEMORY 5805 f5e8 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 5806 f5e8 1a .byte.b >TMPMEMADDRESS 5807 f5e8 DLINDEX SET DLINDEX + 1 5793 f5e8 REPEND 5794 f5e8 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5795 f5e9 - ifconst EXTRADLMEMORY 5796 f5e9 - if TMPMEMADDRESS > $1FFF 5797 f5e9 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5798 f5e9 - else 5799 f5e9 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5800 f5e9 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5801 f5e9 -SECONDDLHALFSTART SET TMPMEMADDRESS 5802 f5e9 - endif 5803 f5e9 - endif ; TMPMEMADDRESS > $1FFF 5804 f5e9 endif ; EXTRADLMEMORY 5805 f5e9 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 5806 f5e9 1b .byte.b >TMPMEMADDRESS 5807 f5e9 DLINDEX SET DLINDEX + 1 5793 f5e9 REPEND 5794 f5e9 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5795 f5ea - ifconst EXTRADLMEMORY 5796 f5ea - if TMPMEMADDRESS > $1FFF 5797 f5ea -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5798 f5ea - else 5799 f5ea - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5800 f5ea -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5801 f5ea -SECONDDLHALFSTART SET TMPMEMADDRESS 5802 f5ea - endif 5803 f5ea - endif ; TMPMEMADDRESS > $1FFF 5804 f5ea endif ; EXTRADLMEMORY 5805 f5ea ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 5806 f5ea 1b .byte.b >TMPMEMADDRESS 5807 f5ea DLINDEX SET DLINDEX + 1 5793 f5ea REPEND 5794 f5ea TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5795 f5eb - ifconst EXTRADLMEMORY 5796 f5eb - if TMPMEMADDRESS > $1FFF 5797 f5eb -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5798 f5eb - else 5799 f5eb - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5800 f5eb -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5801 f5eb -SECONDDLHALFSTART SET TMPMEMADDRESS 5802 f5eb - endif 5803 f5eb - endif ; TMPMEMADDRESS > $1FFF 5804 f5eb endif ; EXTRADLMEMORY 5805 f5eb ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 5806 f5eb 1b .byte.b >TMPMEMADDRESS 5807 f5eb DLINDEX SET DLINDEX + 1 5793 f5eb REPEND 5794 f5eb TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5795 f5ec - ifconst EXTRADLMEMORY 5796 f5ec - if TMPMEMADDRESS > $1FFF 5797 f5ec -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5798 f5ec - else 5799 f5ec - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5800 f5ec -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5801 f5ec -SECONDDLHALFSTART SET TMPMEMADDRESS 5802 f5ec - endif 5803 f5ec - endif ; TMPMEMADDRESS > $1FFF 5804 f5ec endif ; EXTRADLMEMORY 5805 f5ec ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 5806 f5ec 1b .byte.b >TMPMEMADDRESS 5807 f5ec DLINDEX SET DLINDEX + 1 5793 f5ec REPEND 5794 f5ec TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5795 f5ed - ifconst EXTRADLMEMORY 5796 f5ed - if TMPMEMADDRESS > $1FFF 5797 f5ed -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5798 f5ed - else 5799 f5ed - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5800 f5ed -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5801 f5ed -SECONDDLHALFSTART SET TMPMEMADDRESS 5802 f5ed - endif 5803 f5ed - endif ; TMPMEMADDRESS > $1FFF 5804 f5ed endif ; EXTRADLMEMORY 5805 f5ed ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 5806 f5ed 1c .byte.b >TMPMEMADDRESS 5807 f5ed DLINDEX SET DLINDEX + 1 5793 f5ed REPEND 5794 f5ed TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5795 f5ee - ifconst EXTRADLMEMORY 5796 f5ee - if TMPMEMADDRESS > $1FFF 5797 f5ee -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5798 f5ee - else 5799 f5ee - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5800 f5ee -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5801 f5ee -SECONDDLHALFSTART SET TMPMEMADDRESS 5802 f5ee - endif 5803 f5ee - endif ; TMPMEMADDRESS > $1FFF 5804 f5ee endif ; EXTRADLMEMORY 5805 f5ee ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 5806 f5ee 1c .byte.b >TMPMEMADDRESS 5807 f5ee DLINDEX SET DLINDEX + 1 5793 f5ee REPEND 5794 f5ee TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5795 f5ef - ifconst EXTRADLMEMORY 5796 f5ef - if TMPMEMADDRESS > $1FFF 5797 f5ef -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5798 f5ef - else 5799 f5ef - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5800 f5ef -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5801 f5ef -SECONDDLHALFSTART SET TMPMEMADDRESS 5802 f5ef - endif 5803 f5ef - endif ; TMPMEMADDRESS > $1FFF 5804 f5ef endif ; EXTRADLMEMORY 5805 f5ef ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 5806 f5ef 1c .byte.b >TMPMEMADDRESS 5807 f5ef DLINDEX SET DLINDEX + 1 5793 f5ef REPEND 5794 f5ef TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5795 f5f0 - ifconst EXTRADLMEMORY 5796 f5f0 - if TMPMEMADDRESS > $1FFF 5797 f5f0 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5798 f5f0 - else 5799 f5f0 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5800 f5f0 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5801 f5f0 -SECONDDLHALFSTART SET TMPMEMADDRESS 5802 f5f0 - endif 5803 f5f0 - endif ; TMPMEMADDRESS > $1FFF 5804 f5f0 endif ; EXTRADLMEMORY 5805 f5f0 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 5806 f5f0 1d .byte.b >TMPMEMADDRESS 5807 f5f0 DLINDEX SET DLINDEX + 1 5793 f5f0 REPEND 5794 f5f0 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5795 f5f1 - ifconst EXTRADLMEMORY 5796 f5f1 - if TMPMEMADDRESS > $1FFF 5797 f5f1 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5798 f5f1 - else 5799 f5f1 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5800 f5f1 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5801 f5f1 -SECONDDLHALFSTART SET TMPMEMADDRESS 5802 f5f1 - endif 5803 f5f1 - endif ; TMPMEMADDRESS > $1FFF 5804 f5f1 endif ; EXTRADLMEMORY 5805 f5f1 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 5806 f5f1 1d .byte.b >TMPMEMADDRESS 5807 f5f1 DLINDEX SET DLINDEX + 1 5793 f5f1 REPEND 5794 f5f1 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5795 f5f2 - ifconst EXTRADLMEMORY 5796 f5f2 - if TMPMEMADDRESS > $1FFF 5797 f5f2 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5798 f5f2 - else 5799 f5f2 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5800 f5f2 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5801 f5f2 -SECONDDLHALFSTART SET TMPMEMADDRESS 5802 f5f2 - endif 5803 f5f2 - endif ; TMPMEMADDRESS > $1FFF 5804 f5f2 endif ; EXTRADLMEMORY 5805 f5f2 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 5806 f5f2 1d .byte.b >TMPMEMADDRESS 5807 f5f2 DLINDEX SET DLINDEX + 1 5793 f5f2 REPEND 5794 f5f2 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5795 f5f3 - ifconst EXTRADLMEMORY 5796 f5f3 - if TMPMEMADDRESS > $1FFF 5797 f5f3 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5798 f5f3 - else 5799 f5f3 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5800 f5f3 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5801 f5f3 -SECONDDLHALFSTART SET TMPMEMADDRESS 5802 f5f3 - endif 5803 f5f3 - endif ; TMPMEMADDRESS > $1FFF 5804 f5f3 endif ; EXTRADLMEMORY 5805 f5f3 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 5806 f5f3 1d .byte.b >TMPMEMADDRESS 5807 f5f3 DLINDEX SET DLINDEX + 1 5793 f5f3 REPEND 5794 f5f3 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5795 f5f4 - ifconst EXTRADLMEMORY 5796 f5f4 - if TMPMEMADDRESS > $1FFF 5797 f5f4 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5798 f5f4 - else 5799 f5f4 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5800 f5f4 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5801 f5f4 -SECONDDLHALFSTART SET TMPMEMADDRESS 5802 f5f4 - endif 5803 f5f4 - endif ; TMPMEMADDRESS > $1FFF 5804 f5f4 endif ; EXTRADLMEMORY 5805 f5f4 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 5806 f5f4 1e .byte.b >TMPMEMADDRESS 5807 f5f4 DLINDEX SET DLINDEX + 1 5793 f5f4 REPEND 5794 f5f4 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5795 f5f5 - ifconst EXTRADLMEMORY 5796 f5f5 - if TMPMEMADDRESS > $1FFF 5797 f5f5 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5798 f5f5 - else 5799 f5f5 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5800 f5f5 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5801 f5f5 -SECONDDLHALFSTART SET TMPMEMADDRESS 5802 f5f5 - endif 5803 f5f5 - endif ; TMPMEMADDRESS > $1FFF 5804 f5f5 endif ; EXTRADLMEMORY 5805 f5f5 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 5806 f5f5 1e .byte.b >TMPMEMADDRESS 5807 f5f5 DLINDEX SET DLINDEX + 1 5793 f5f5 REPEND 5794 f5f5 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5795 f5f6 - ifconst EXTRADLMEMORY 5796 f5f6 - if TMPMEMADDRESS > $1FFF 5797 f5f6 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5798 f5f6 - else 5799 f5f6 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5800 f5f6 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5801 f5f6 -SECONDDLHALFSTART SET TMPMEMADDRESS 5802 f5f6 - endif 5803 f5f6 - endif ; TMPMEMADDRESS > $1FFF 5804 f5f6 endif ; EXTRADLMEMORY 5805 f5f6 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 5806 f5f6 1e .byte.b >TMPMEMADDRESS 5807 f5f6 DLINDEX SET DLINDEX + 1 5793 f5f6 REPEND 5794 f5f6 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5795 f5f7 - ifconst EXTRADLMEMORY 5796 f5f7 - if TMPMEMADDRESS > $1FFF 5797 f5f7 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5798 f5f7 - else 5799 f5f7 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5800 f5f7 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5801 f5f7 -SECONDDLHALFSTART SET TMPMEMADDRESS 5802 f5f7 - endif 5803 f5f7 - endif ; TMPMEMADDRESS > $1FFF 5804 f5f7 endif ; EXTRADLMEMORY 5805 f5f7 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 5806 f5f7 1f .byte.b >TMPMEMADDRESS 5807 f5f7 DLINDEX SET DLINDEX + 1 5793 f5f7 REPEND 5794 f5f7 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5795 f5f8 - ifconst EXTRADLMEMORY 5796 f5f8 - if TMPMEMADDRESS > $1FFF 5797 f5f8 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5798 f5f8 - else 5799 f5f8 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5800 f5f8 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5801 f5f8 -SECONDDLHALFSTART SET TMPMEMADDRESS 5802 f5f8 - endif 5803 f5f8 - endif ; TMPMEMADDRESS > $1FFF 5804 f5f8 endif ; EXTRADLMEMORY 5805 f5f8 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 5806 f5f8 1f .byte.b >TMPMEMADDRESS 5807 f5f8 DLINDEX SET DLINDEX + 1 5793 f5f8 REPEND 5794 f5f8 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5795 f5f9 - ifconst EXTRADLMEMORY 5796 f5f9 - if TMPMEMADDRESS > $1FFF 5797 f5f9 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5798 f5f9 - else 5799 f5f9 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5800 f5f9 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5801 f5f9 -SECONDDLHALFSTART SET TMPMEMADDRESS 5802 f5f9 - endif 5803 f5f9 - endif ; TMPMEMADDRESS > $1FFF 5804 f5f9 endif ; EXTRADLMEMORY 5805 f5f9 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 5806 f5f9 1f .byte.b >TMPMEMADDRESS 5807 f5f9 DLINDEX SET DLINDEX + 1 5808 f5fa REPEND 5809 f5fa 5810 f5fa - ifconst EXTRADLMEMORY 5811 f5fa - echo " ",[SECONDDLHALFSTART],"to",[$27FF],"was claimed as extra DL memory." 5812 f5fa endif 5813 f5fa 5814 f5fa 5815 f5fa DLPOINTL 5816 f5fa DLINDEX SET 0 5817 f5fa REPEAT WZONECOUNT 5818 f5fa TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5819 f5fa - ifconst EXTRADLMEMORY 5820 f5fa - if TMPMEMADDRESS > $1FFF 5821 f5fa -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5822 f5fa - else 5823 f5fa - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5824 f5fa -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5825 f5fa - endif 5826 f5fa - endif ; TMPMEMADDRESS > $1FFF 5827 f5fa endif ; EXTRADLMEMORY 5828 f5fa 80 .byte.b $1FFF 5821 f5fb -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5822 f5fb - else 5823 f5fb - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5824 f5fb -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5825 f5fb - endif 5826 f5fb - endif ; TMPMEMADDRESS > $1FFF 5827 f5fb endif ; EXTRADLMEMORY 5828 f5fb c9 .byte.b $1FFF 5821 f5fc -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5822 f5fc - else 5823 f5fc - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5824 f5fc -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5825 f5fc - endif 5826 f5fc - endif ; TMPMEMADDRESS > $1FFF 5827 f5fc endif ; EXTRADLMEMORY 5828 f5fc 13 .byte.b $1FFF 5821 f5fd -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5822 f5fd - else 5823 f5fd - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5824 f5fd -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5825 f5fd - endif 5826 f5fd - endif ; TMPMEMADDRESS > $1FFF 5827 f5fd endif ; EXTRADLMEMORY 5828 f5fd 5d .byte.b $1FFF 5821 f5fe -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5822 f5fe - else 5823 f5fe - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5824 f5fe -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5825 f5fe - endif 5826 f5fe - endif ; TMPMEMADDRESS > $1FFF 5827 f5fe endif ; EXTRADLMEMORY 5828 f5fe a7 .byte.b $1FFF 5821 f5ff -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5822 f5ff - else 5823 f5ff - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5824 f5ff -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5825 f5ff - endif 5826 f5ff - endif ; TMPMEMADDRESS > $1FFF 5827 f5ff endif ; EXTRADLMEMORY 5828 f5ff f1 .byte.b $1FFF 5821 f600 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5822 f600 - else 5823 f600 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5824 f600 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5825 f600 - endif 5826 f600 - endif ; TMPMEMADDRESS > $1FFF 5827 f600 endif ; EXTRADLMEMORY 5828 f600 3b .byte.b $1FFF 5821 f601 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5822 f601 - else 5823 f601 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5824 f601 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5825 f601 - endif 5826 f601 - endif ; TMPMEMADDRESS > $1FFF 5827 f601 endif ; EXTRADLMEMORY 5828 f601 84 .byte.b $1FFF 5821 f602 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5822 f602 - else 5823 f602 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5824 f602 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5825 f602 - endif 5826 f602 - endif ; TMPMEMADDRESS > $1FFF 5827 f602 endif ; EXTRADLMEMORY 5828 f602 ce .byte.b $1FFF 5821 f603 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5822 f603 - else 5823 f603 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5824 f603 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5825 f603 - endif 5826 f603 - endif ; TMPMEMADDRESS > $1FFF 5827 f603 endif ; EXTRADLMEMORY 5828 f603 18 .byte.b $1FFF 5821 f604 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5822 f604 - else 5823 f604 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5824 f604 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5825 f604 - endif 5826 f604 - endif ; TMPMEMADDRESS > $1FFF 5827 f604 endif ; EXTRADLMEMORY 5828 f604 62 .byte.b $1FFF 5821 f605 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5822 f605 - else 5823 f605 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5824 f605 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5825 f605 - endif 5826 f605 - endif ; TMPMEMADDRESS > $1FFF 5827 f605 endif ; EXTRADLMEMORY 5828 f605 ac .byte.b $1FFF 5821 f606 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5822 f606 - else 5823 f606 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5824 f606 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5825 f606 - endif 5826 f606 - endif ; TMPMEMADDRESS > $1FFF 5827 f606 endif ; EXTRADLMEMORY 5828 f606 f6 .byte.b $1FFF 5821 f607 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5822 f607 - else 5823 f607 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5824 f607 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5825 f607 - endif 5826 f607 - endif ; TMPMEMADDRESS > $1FFF 5827 f607 endif ; EXTRADLMEMORY 5828 f607 40 .byte.b $1FFF 5821 f608 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5822 f608 - else 5823 f608 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5824 f608 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5825 f608 - endif 5826 f608 - endif ; TMPMEMADDRESS > $1FFF 5827 f608 endif ; EXTRADLMEMORY 5828 f608 89 .byte.b $1FFF 5821 f609 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5822 f609 - else 5823 f609 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5824 f609 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5825 f609 - endif 5826 f609 - endif ; TMPMEMADDRESS > $1FFF 5827 f609 endif ; EXTRADLMEMORY 5828 f609 d3 .byte.b $1FFF 5821 f60a -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5822 f60a - else 5823 f60a - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5824 f60a -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5825 f60a - endif 5826 f60a - endif ; TMPMEMADDRESS > $1FFF 5827 f60a endif ; EXTRADLMEMORY 5828 f60a 1d .byte.b $1FFF 5821 f60b -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5822 f60b - else 5823 f60b - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5824 f60b -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5825 f60b - endif 5826 f60b - endif ; TMPMEMADDRESS > $1FFF 5827 f60b endif ; EXTRADLMEMORY 5828 f60b 67 .byte.b $1FFF 5821 f60c -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5822 f60c - else 5823 f60c - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5824 f60c -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5825 f60c - endif 5826 f60c - endif ; TMPMEMADDRESS > $1FFF 5827 f60c endif ; EXTRADLMEMORY 5828 f60c b1 .byte.b $1FFF 5821 f60d -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5822 f60d - else 5823 f60d - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5824 f60d -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5825 f60d - endif 5826 f60d - endif ; TMPMEMADDRESS > $1FFF 5827 f60d endif ; EXTRADLMEMORY 5828 f60d fb .byte.b $1FFF 5821 f60e -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5822 f60e - else 5823 f60e - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5824 f60e -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5825 f60e - endif 5826 f60e - endif ; TMPMEMADDRESS > $1FFF 5827 f60e endif ; EXTRADLMEMORY 5828 f60e 44 .byte.b $1FFF 5821 f60f -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5822 f60f - else 5823 f60f - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5824 f60f -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5825 f60f - endif 5826 f60f - endif ; TMPMEMADDRESS > $1FFF 5827 f60f endif ; EXTRADLMEMORY 5828 f60f 8e .byte.b $1FFF 5821 f610 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5822 f610 - else 5823 f610 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5824 f610 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5825 f610 - endif 5826 f610 - endif ; TMPMEMADDRESS > $1FFF 5827 f610 endif ; EXTRADLMEMORY 5828 f610 d8 .byte.b $1FFF 5821 f611 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5822 f611 - else 5823 f611 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5824 f611 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5825 f611 - endif 5826 f611 - endif ; TMPMEMADDRESS > $1FFF 5827 f611 endif ; EXTRADLMEMORY 5828 f611 22 .byte.b $1FFF 5821 f612 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5822 f612 - else 5823 f612 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5824 f612 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5825 f612 - endif 5826 f612 - endif ; TMPMEMADDRESS > $1FFF 5827 f612 endif ; EXTRADLMEMORY 5828 f612 6c .byte.b $1FFF 5821 f613 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5822 f613 - else 5823 f613 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5824 f613 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5825 f613 - endif 5826 f613 - endif ; TMPMEMADDRESS > $1FFF 5827 f613 endif ; EXTRADLMEMORY 5828 f613 b6 .byte.b $1FFF 5838 f614 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5839 f614 - else 5840 f614 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5841 f614 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5842 f614 - endif 5843 f614 - endif ; TMPMEMADDRESS > $1FFF 5844 f614 endif ; EXTRADLMEMORY 5845 f614 5846 f614 18 80 ZONE0ADDRESS = TMPMEMADDRESS 5847 f614 5848 f614 DLINDEX SET DLINDEX + 1 5834 f614 REPEND 5835 f614 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5836 f614 - ifconst EXTRADLMEMORY 5837 f614 - if TMPMEMADDRESS > $1FFF 5838 f614 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5839 f614 - else 5840 f614 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5841 f614 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5842 f614 - endif 5843 f614 - endif ; TMPMEMADDRESS > $1FFF 5844 f614 endif ; EXTRADLMEMORY 5845 f614 5846 f614 18 c9 ZONE1ADDRESS = TMPMEMADDRESS 5847 f614 5848 f614 DLINDEX SET DLINDEX + 1 5834 f614 REPEND 5835 f614 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5836 f614 - ifconst EXTRADLMEMORY 5837 f614 - if TMPMEMADDRESS > $1FFF 5838 f614 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5839 f614 - else 5840 f614 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5841 f614 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5842 f614 - endif 5843 f614 - endif ; TMPMEMADDRESS > $1FFF 5844 f614 endif ; EXTRADLMEMORY 5845 f614 5846 f614 19 13 ZONE2ADDRESS = TMPMEMADDRESS 5847 f614 5848 f614 DLINDEX SET DLINDEX + 1 5834 f614 REPEND 5835 f614 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5836 f614 - ifconst EXTRADLMEMORY 5837 f614 - if TMPMEMADDRESS > $1FFF 5838 f614 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5839 f614 - else 5840 f614 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5841 f614 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5842 f614 - endif 5843 f614 - endif ; TMPMEMADDRESS > $1FFF 5844 f614 endif ; EXTRADLMEMORY 5845 f614 5846 f614 19 5d ZONE3ADDRESS = TMPMEMADDRESS 5847 f614 5848 f614 DLINDEX SET DLINDEX + 1 5834 f614 REPEND 5835 f614 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5836 f614 - ifconst EXTRADLMEMORY 5837 f614 - if TMPMEMADDRESS > $1FFF 5838 f614 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5839 f614 - else 5840 f614 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5841 f614 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5842 f614 - endif 5843 f614 - endif ; TMPMEMADDRESS > $1FFF 5844 f614 endif ; EXTRADLMEMORY 5845 f614 5846 f614 19 a7 ZONE4ADDRESS = TMPMEMADDRESS 5847 f614 5848 f614 DLINDEX SET DLINDEX + 1 5834 f614 REPEND 5835 f614 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5836 f614 - ifconst EXTRADLMEMORY 5837 f614 - if TMPMEMADDRESS > $1FFF 5838 f614 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5839 f614 - else 5840 f614 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5841 f614 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5842 f614 - endif 5843 f614 - endif ; TMPMEMADDRESS > $1FFF 5844 f614 endif ; EXTRADLMEMORY 5845 f614 5846 f614 19 f1 ZONE5ADDRESS = TMPMEMADDRESS 5847 f614 5848 f614 DLINDEX SET DLINDEX + 1 5834 f614 REPEND 5835 f614 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5836 f614 - ifconst EXTRADLMEMORY 5837 f614 - if TMPMEMADDRESS > $1FFF 5838 f614 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5839 f614 - else 5840 f614 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5841 f614 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5842 f614 - endif 5843 f614 - endif ; TMPMEMADDRESS > $1FFF 5844 f614 endif ; EXTRADLMEMORY 5845 f614 5846 f614 1a 3b ZONE6ADDRESS = TMPMEMADDRESS 5847 f614 5848 f614 DLINDEX SET DLINDEX + 1 5834 f614 REPEND 5835 f614 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5836 f614 - ifconst EXTRADLMEMORY 5837 f614 - if TMPMEMADDRESS > $1FFF 5838 f614 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5839 f614 - else 5840 f614 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5841 f614 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5842 f614 - endif 5843 f614 - endif ; TMPMEMADDRESS > $1FFF 5844 f614 endif ; EXTRADLMEMORY 5845 f614 5846 f614 1a 84 ZONE7ADDRESS = TMPMEMADDRESS 5847 f614 5848 f614 DLINDEX SET DLINDEX + 1 5834 f614 REPEND 5835 f614 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5836 f614 - ifconst EXTRADLMEMORY 5837 f614 - if TMPMEMADDRESS > $1FFF 5838 f614 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5839 f614 - else 5840 f614 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5841 f614 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5842 f614 - endif 5843 f614 - endif ; TMPMEMADDRESS > $1FFF 5844 f614 endif ; EXTRADLMEMORY 5845 f614 5846 f614 1a ce ZONE8ADDRESS = TMPMEMADDRESS 5847 f614 5848 f614 DLINDEX SET DLINDEX + 1 5834 f614 REPEND 5835 f614 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5836 f614 - ifconst EXTRADLMEMORY 5837 f614 - if TMPMEMADDRESS > $1FFF 5838 f614 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5839 f614 - else 5840 f614 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5841 f614 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5842 f614 - endif 5843 f614 - endif ; TMPMEMADDRESS > $1FFF 5844 f614 endif ; EXTRADLMEMORY 5845 f614 5846 f614 1b 18 ZONE9ADDRESS = TMPMEMADDRESS 5847 f614 5848 f614 DLINDEX SET DLINDEX + 1 5834 f614 REPEND 5835 f614 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5836 f614 - ifconst EXTRADLMEMORY 5837 f614 - if TMPMEMADDRESS > $1FFF 5838 f614 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5839 f614 - else 5840 f614 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5841 f614 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5842 f614 - endif 5843 f614 - endif ; TMPMEMADDRESS > $1FFF 5844 f614 endif ; EXTRADLMEMORY 5845 f614 5846 f614 1b 62 ZONE10ADDRESS = TMPMEMADDRESS 5847 f614 5848 f614 DLINDEX SET DLINDEX + 1 5834 f614 REPEND 5835 f614 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5836 f614 - ifconst EXTRADLMEMORY 5837 f614 - if TMPMEMADDRESS > $1FFF 5838 f614 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5839 f614 - else 5840 f614 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5841 f614 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5842 f614 - endif 5843 f614 - endif ; TMPMEMADDRESS > $1FFF 5844 f614 endif ; EXTRADLMEMORY 5845 f614 5846 f614 1b ac ZONE11ADDRESS = TMPMEMADDRESS 5847 f614 5848 f614 DLINDEX SET DLINDEX + 1 5834 f614 REPEND 5835 f614 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5836 f614 - ifconst EXTRADLMEMORY 5837 f614 - if TMPMEMADDRESS > $1FFF 5838 f614 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5839 f614 - else 5840 f614 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5841 f614 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5842 f614 - endif 5843 f614 - endif ; TMPMEMADDRESS > $1FFF 5844 f614 endif ; EXTRADLMEMORY 5845 f614 5846 f614 1b f6 ZONE12ADDRESS = TMPMEMADDRESS 5847 f614 5848 f614 DLINDEX SET DLINDEX + 1 5834 f614 REPEND 5835 f614 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5836 f614 - ifconst EXTRADLMEMORY 5837 f614 - if TMPMEMADDRESS > $1FFF 5838 f614 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5839 f614 - else 5840 f614 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5841 f614 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5842 f614 - endif 5843 f614 - endif ; TMPMEMADDRESS > $1FFF 5844 f614 endif ; EXTRADLMEMORY 5845 f614 5846 f614 1c 40 ZONE13ADDRESS = TMPMEMADDRESS 5847 f614 5848 f614 DLINDEX SET DLINDEX + 1 5834 f614 REPEND 5835 f614 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5836 f614 - ifconst EXTRADLMEMORY 5837 f614 - if TMPMEMADDRESS > $1FFF 5838 f614 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5839 f614 - else 5840 f614 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5841 f614 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5842 f614 - endif 5843 f614 - endif ; TMPMEMADDRESS > $1FFF 5844 f614 endif ; EXTRADLMEMORY 5845 f614 5846 f614 1c 89 ZONE14ADDRESS = TMPMEMADDRESS 5847 f614 5848 f614 DLINDEX SET DLINDEX + 1 5834 f614 REPEND 5835 f614 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5836 f614 - ifconst EXTRADLMEMORY 5837 f614 - if TMPMEMADDRESS > $1FFF 5838 f614 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5839 f614 - else 5840 f614 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5841 f614 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5842 f614 - endif 5843 f614 - endif ; TMPMEMADDRESS > $1FFF 5844 f614 endif ; EXTRADLMEMORY 5845 f614 5846 f614 1c d3 ZONE15ADDRESS = TMPMEMADDRESS 5847 f614 5848 f614 DLINDEX SET DLINDEX + 1 5834 f614 REPEND 5835 f614 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5836 f614 - ifconst EXTRADLMEMORY 5837 f614 - if TMPMEMADDRESS > $1FFF 5838 f614 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5839 f614 - else 5840 f614 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5841 f614 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5842 f614 - endif 5843 f614 - endif ; TMPMEMADDRESS > $1FFF 5844 f614 endif ; EXTRADLMEMORY 5845 f614 5846 f614 1d 1d ZONE16ADDRESS = TMPMEMADDRESS 5847 f614 5848 f614 DLINDEX SET DLINDEX + 1 5834 f614 REPEND 5835 f614 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5836 f614 - ifconst EXTRADLMEMORY 5837 f614 - if TMPMEMADDRESS > $1FFF 5838 f614 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5839 f614 - else 5840 f614 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5841 f614 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5842 f614 - endif 5843 f614 - endif ; TMPMEMADDRESS > $1FFF 5844 f614 endif ; EXTRADLMEMORY 5845 f614 5846 f614 1d 67 ZONE17ADDRESS = TMPMEMADDRESS 5847 f614 5848 f614 DLINDEX SET DLINDEX + 1 5834 f614 REPEND 5835 f614 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5836 f614 - ifconst EXTRADLMEMORY 5837 f614 - if TMPMEMADDRESS > $1FFF 5838 f614 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5839 f614 - else 5840 f614 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5841 f614 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5842 f614 - endif 5843 f614 - endif ; TMPMEMADDRESS > $1FFF 5844 f614 endif ; EXTRADLMEMORY 5845 f614 5846 f614 1d b1 ZONE18ADDRESS = TMPMEMADDRESS 5847 f614 5848 f614 DLINDEX SET DLINDEX + 1 5834 f614 REPEND 5835 f614 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5836 f614 - ifconst EXTRADLMEMORY 5837 f614 - if TMPMEMADDRESS > $1FFF 5838 f614 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5839 f614 - else 5840 f614 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5841 f614 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5842 f614 - endif 5843 f614 - endif ; TMPMEMADDRESS > $1FFF 5844 f614 endif ; EXTRADLMEMORY 5845 f614 5846 f614 1d fb ZONE19ADDRESS = TMPMEMADDRESS 5847 f614 5848 f614 DLINDEX SET DLINDEX + 1 5834 f614 REPEND 5835 f614 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5836 f614 - ifconst EXTRADLMEMORY 5837 f614 - if TMPMEMADDRESS > $1FFF 5838 f614 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5839 f614 - else 5840 f614 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5841 f614 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5842 f614 - endif 5843 f614 - endif ; TMPMEMADDRESS > $1FFF 5844 f614 endif ; EXTRADLMEMORY 5845 f614 5846 f614 1e 44 ZONE20ADDRESS = TMPMEMADDRESS 5847 f614 5848 f614 DLINDEX SET DLINDEX + 1 5834 f614 REPEND 5835 f614 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5836 f614 - ifconst EXTRADLMEMORY 5837 f614 - if TMPMEMADDRESS > $1FFF 5838 f614 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5839 f614 - else 5840 f614 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5841 f614 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5842 f614 - endif 5843 f614 - endif ; TMPMEMADDRESS > $1FFF 5844 f614 endif ; EXTRADLMEMORY 5845 f614 5846 f614 1e 8e ZONE21ADDRESS = TMPMEMADDRESS 5847 f614 5848 f614 DLINDEX SET DLINDEX + 1 5834 f614 REPEND 5835 f614 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5836 f614 - ifconst EXTRADLMEMORY 5837 f614 - if TMPMEMADDRESS > $1FFF 5838 f614 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5839 f614 - else 5840 f614 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5841 f614 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5842 f614 - endif 5843 f614 - endif ; TMPMEMADDRESS > $1FFF 5844 f614 endif ; EXTRADLMEMORY 5845 f614 5846 f614 1e d8 ZONE22ADDRESS = TMPMEMADDRESS 5847 f614 5848 f614 DLINDEX SET DLINDEX + 1 5834 f614 REPEND 5835 f614 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5836 f614 - ifconst EXTRADLMEMORY 5837 f614 - if TMPMEMADDRESS > $1FFF 5838 f614 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5839 f614 - else 5840 f614 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5841 f614 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5842 f614 - endif 5843 f614 - endif ; TMPMEMADDRESS > $1FFF 5844 f614 endif ; EXTRADLMEMORY 5845 f614 5846 f614 1f 22 ZONE23ADDRESS = TMPMEMADDRESS 5847 f614 5848 f614 DLINDEX SET DLINDEX + 1 5834 f614 REPEND 5835 f614 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5836 f614 - ifconst EXTRADLMEMORY 5837 f614 - if TMPMEMADDRESS > $1FFF 5838 f614 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5839 f614 - else 5840 f614 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5841 f614 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5842 f614 - endif 5843 f614 - endif ; TMPMEMADDRESS > $1FFF 5844 f614 endif ; EXTRADLMEMORY 5845 f614 5846 f614 1f 6c ZONE24ADDRESS = TMPMEMADDRESS 5847 f614 5848 f614 DLINDEX SET DLINDEX + 1 5834 f614 REPEND 5835 f614 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 5836 f614 - ifconst EXTRADLMEMORY 5837 f614 - if TMPMEMADDRESS > $1FFF 5838 f614 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5839 f614 - else 5840 f614 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 5841 f614 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 5842 f614 - endif 5843 f614 - endif ; TMPMEMADDRESS > $1FFF 5844 f614 endif ; EXTRADLMEMORY 5845 f614 5846 f614 1f b6 ZONE25ADDRESS = TMPMEMADDRESS 5847 f614 5848 f614 DLINDEX SET DLINDEX + 1 5849 f614 REPEND 5850 f614 5851 f614 $1880 to $1fff used as zone memory, allowing 14 display objects per zone. 5852 f614 echo " ",[WDLMEMSTART],"to",[WDLMEMEND],"used as zone memory, allowing",[(DLLASTOBJ/5)]d,"display objects per zone." 5853 f614 5854 f614 DLHEIGHT 5855 f614 REPEAT WZONECOUNT 5856 f614 07 .byte.b (WZONEHEIGHT-1) 5855 f614 REPEND 5856 f615 07 .byte.b (WZONEHEIGHT-1) 5855 f615 REPEND 5856 f616 07 .byte.b (WZONEHEIGHT-1) 5855 f616 REPEND 5856 f617 07 .byte.b (WZONEHEIGHT-1) 5855 f617 REPEND 5856 f618 07 .byte.b (WZONEHEIGHT-1) 5855 f618 REPEND 5856 f619 07 .byte.b (WZONEHEIGHT-1) 5855 f619 REPEND 5856 f61a 07 .byte.b (WZONEHEIGHT-1) 5855 f61a REPEND 5856 f61b 07 .byte.b (WZONEHEIGHT-1) 5855 f61b REPEND 5856 f61c 07 .byte.b (WZONEHEIGHT-1) 5855 f61c REPEND 5856 f61d 07 .byte.b (WZONEHEIGHT-1) 5855 f61d REPEND 5856 f61e 07 .byte.b (WZONEHEIGHT-1) 5855 f61e REPEND 5856 f61f 07 .byte.b (WZONEHEIGHT-1) 5855 f61f REPEND 5856 f620 07 .byte.b (WZONEHEIGHT-1) 5855 f620 REPEND 5856 f621 07 .byte.b (WZONEHEIGHT-1) 5855 f621 REPEND 5856 f622 07 .byte.b (WZONEHEIGHT-1) 5855 f622 REPEND 5856 f623 07 .byte.b (WZONEHEIGHT-1) 5855 f623 REPEND 5856 f624 07 .byte.b (WZONEHEIGHT-1) 5855 f624 REPEND 5856 f625 07 .byte.b (WZONEHEIGHT-1) 5855 f625 REPEND 5856 f626 07 .byte.b (WZONEHEIGHT-1) 5855 f626 REPEND 5856 f627 07 .byte.b (WZONEHEIGHT-1) 5855 f627 REPEND 5856 f628 07 .byte.b (WZONEHEIGHT-1) 5855 f628 REPEND 5856 f629 07 .byte.b (WZONEHEIGHT-1) 5855 f629 REPEND 5856 f62a 07 .byte.b (WZONEHEIGHT-1) 5855 f62a REPEND 5856 f62b 07 .byte.b (WZONEHEIGHT-1) 5855 f62b REPEND 5856 f62c 07 .byte.b (WZONEHEIGHT-1) 5855 f62c REPEND 5856 f62d 07 .byte.b (WZONEHEIGHT-1) 5857 f62e REPEND 5858 f62e 5859 f62e ; Provided under the CC0 license. See the included LICENSE.txt for details. 5860 f62e 5861 f62e ; a simple guard, than ensures the 7800basic code hasn't 5862 f62e ; spilled into the encryption area... 2384 bytes left in the 7800basic reserved area. 5863 f62e echo " ",($FF7E-*)d,"bytes left in the 7800basic reserved area." 5864 f62e - if (*>$FF7D) 5865 f62e - ERR ; abort the assembly 5866 f62e endif 5867 f62e ; Provided under the CC0 license. See the included LICENSE.txt for details. 5868 f62e 5869 f62e - ifconst DEV 5870 f62e - ifnconst ZONEHEIGHT 5871 f62e - echo "* the 4k 7800basic area has",[($FF7E - *)]d,"bytes free." 5872 f62e - else 5873 f62e - if ZONEHEIGHT = 8 5874 f62e - echo "* the 4k 7800basic area has",[($FF7E - *)]d,"bytes free." 5875 f62e - else 5876 f62e - echo "* the 4k 7800basic area has",[($FF7E - *)]d,"bytes free." 5877 f62e - endif 5878 f62e - endif 5879 f62e endif 5880 f62e 5881 f62e ; FF7E/FF7F contains the 7800basic crc checksum word 5882 f62e 5883 f62e ; FF80 - FFF7 contains the 7800 encryption key 5884 f62e 5885 f62e ifnconst bankswitchmode 5886 fff8 ORG $FFF8 5887 fff8 - else 5888 fff8 - ifconst ROM128K 5889 fff8 - ORG $27FF8 5890 fff8 - RORG $FFF8 5891 fff8 - endif 5892 fff8 - ifconst ROM144K 5893 fff8 - ORG $27FF8 5894 fff8 - RORG $FFF8 5895 fff8 - endif 5896 fff8 - ifconst ROM256K 5897 fff8 - ORG $47FF8 5898 fff8 - RORG $FFF8 5899 fff8 - endif 5900 fff8 - ifconst ROM272K 5901 fff8 - ORG $47FF8 5902 fff8 - RORG $FFF8 5903 fff8 - endif 5904 fff8 - ifconst ROM512K 5905 fff8 - ORG $87FF8 5906 fff8 - RORG $FFF8 5907 fff8 - endif 5908 fff8 - ifconst ROM528K 5909 fff8 - ORG $87FF8 5910 fff8 - RORG $FFF8 5911 fff8 - endif 5912 fff8 endif 5913 fff8 5914 fff8 5915 fff8 ff .byte.b $FF ; region verification. $FF=all regions 5916 fff9 f7 .byte.b $F7 ; high nibble: encryption check from $N000 to $FF7F. we only hash the last 4k for faster boot. 5917 fffa ; low nibble : N=7 atari rainbow start, N=3 no atari rainbow 5918 fffa 5919 fffa ;Vectors 5920 fffa 00 f0 .word.w NMI 5921 fffc 1d f5 .word.w START 5922 fffe 5f f0 .word.w IRQ 5923 10000