------- FILE c:\Users\Shane\Documents\my7800projects\platformer_demos\template\platformer_demo_v01.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 platformer_test_item_3_mode = $00 4 10000 ???? 00 1f platformer_test_item_3_width_twoscompliment = $1f 5 10000 ???? 00 01 platformer_test_item_3_width = $01 6 10000 ???? 00 00 platformer_test_item_2_mode = $00 7 10000 ???? 00 1f platformer_test_item_2_width_twoscompliment = $1f 8 10000 ???? 00 01 platformer_test_item_2_width = $01 9 10000 ???? 00 00 platformer_test_item_1_mode = $00 10 10000 ???? 00 1f platformer_test_item_1_width_twoscompliment = $1f 11 10000 ???? 00 01 platformer_test_item_1_width = $01 12 10000 ???? 00 00 platformer_test_item_0_mode = $00 13 10000 ???? 00 1f platformer_test_item_0_width_twoscompliment = $1f 14 10000 ???? 00 01 platformer_test_item_0_width = $01 15 10000 ???? 00 00 platformer_test_fontCS_mode = $00 16 10000 ???? 00 06 platformer_test_fontCS_width_twoscompliment = $06 17 10000 ???? 00 3a platformer_test_fontCS_width = $3a 18 10000 ???? 00 80 platformer_test_sprite8_mode = $80 19 10000 ???? 00 1c platformer_test_sprite8_width_twoscompliment = $1c 20 10000 ???? 00 04 platformer_test_sprite8_width = $04 21 10000 ???? 00 80 platformer_test_sprite7_mode = $80 22 10000 ???? 00 1c platformer_test_sprite7_width_twoscompliment = $1c 23 10000 ???? 00 04 platformer_test_sprite7_width = $04 24 10000 ???? 00 80 platformer_test_sprite6_mode = $80 25 10000 ???? 00 1c platformer_test_sprite6_width_twoscompliment = $1c 26 10000 ???? 00 04 platformer_test_sprite6_width = $04 27 10000 ???? 00 80 platformer_test_sprite5_mode = $80 28 10000 ???? 00 1c platformer_test_sprite5_width_twoscompliment = $1c 29 10000 ???? 00 04 platformer_test_sprite5_width = $04 30 10000 ???? 00 80 platformer_test_sprite4_mode = $80 31 10000 ???? 00 1c platformer_test_sprite4_width_twoscompliment = $1c 32 10000 ???? 00 04 platformer_test_sprite4_width = $04 33 10000 ???? 00 80 platformer_test_sprite3_mode = $80 34 10000 ???? 00 1c platformer_test_sprite3_width_twoscompliment = $1c 35 10000 ???? 00 04 platformer_test_sprite3_width = $04 36 10000 ???? 00 80 platformer_test_sprite2_mode = $80 37 10000 ???? 00 1c platformer_test_sprite2_width_twoscompliment = $1c 38 10000 ???? 00 04 platformer_test_sprite2_width = $04 39 10000 ???? 00 80 platformer_test_sprite1_mode = $80 40 10000 ???? 00 1c platformer_test_sprite1_width_twoscompliment = $1c 41 10000 ???? 00 04 platformer_test_sprite1_width = $04 42 10000 ???? 00 80 platformer_test_sprite0_mode = $80 43 10000 ???? 00 1c platformer_test_sprite0_width_twoscompliment = $1c 44 10000 ???? 00 04 platformer_test_sprite0_width = $04 45 10000 ???? 00 00 platformer_test_tiles_ramchar_mode = $00 46 10000 ???? 00 0c platformer_test_tiles_ramchar_width_twoscompliment = $0c 47 10000 ???? 00 14 platformer_test_tiles_ramchar_width = $14 48 10000 ???? 02 80 level4_length = .skipL0134-level4 49 10000 ???? 50 10000 ???? 02 80 level3_length = .skipL0133-level3 51 10000 ???? 52 10000 ???? 02 80 level2_length = .skipL0132-level2 53 10000 ???? 54 10000 ???? 02 80 level1_length = .skipL0131-level1 55 10000 ???? 56 10000 ???? 00 01 BOXCOLLISION = 1 57 10000 ???? 00 bd platformer_test_item_3_color3 = $bd 58 10000 ???? 00 91 platformer_test_item_3_color2 = $91 59 10000 ???? 00 a6 platformer_test_item_3_color1 = $a6 60 10000 ???? 00 00 platformer_test_item_3_color0 = $00 61 10000 ???? 00 bd platformer_test_item_2_color3 = $bd 62 10000 ???? 00 91 platformer_test_item_2_color2 = $91 63 10000 ???? 00 a6 platformer_test_item_2_color1 = $a6 64 10000 ???? 00 00 platformer_test_item_2_color0 = $00 65 10000 ???? 00 bd platformer_test_item_1_color3 = $bd 66 10000 ???? 00 91 platformer_test_item_1_color2 = $91 67 10000 ???? 00 a6 platformer_test_item_1_color1 = $a6 68 10000 ???? 00 00 platformer_test_item_1_color0 = $00 69 10000 ???? 00 bd platformer_test_item_0_color3 = $bd 70 10000 ???? 00 91 platformer_test_item_0_color2 = $91 71 10000 ???? 00 a6 platformer_test_item_0_color1 = $a6 72 10000 ???? 00 00 platformer_test_item_0_color0 = $00 73 10000 ???? 00 0f platformer_test_fontCS_color1 = $0f 74 10000 ???? 00 00 platformer_test_fontCS_color0 = $00 75 10000 ???? 00 00 platformer_test_sprite8_color15 = 0 76 10000 ???? 00 00 platformer_test_sprite8_color14 = 0 77 10000 ???? 00 00 platformer_test_sprite8_color13 = 0 78 10000 ???? 00 00 platformer_test_sprite8_color12 = 0 79 10000 ???? 00 00 platformer_test_sprite8_color11 = 0 80 10000 ???? 00 00 platformer_test_sprite8_color10 = 0 81 10000 ???? 00 00 platformer_test_sprite8_color9 = 0 82 10000 ???? 00 00 platformer_test_sprite8_color8 = 0 83 10000 ???? 00 00 platformer_test_sprite8_color7 = 0 84 10000 ???? 00 00 platformer_test_sprite8_color6 = $00 85 10000 ???? 00 68 platformer_test_sprite8_color5 = $68 86 10000 ???? 00 6c platformer_test_sprite8_color4 = $6c 87 10000 ???? 00 08 platformer_test_sprite8_color3 = $08 88 10000 ???? 00 0f platformer_test_sprite8_color2 = $0f 89 10000 ???? 00 04 platformer_test_sprite8_color1 = $04 90 10000 ???? 00 00 platformer_test_sprite8_color0 = $00 91 10000 ???? 00 00 platformer_test_sprite7_color15 = 0 92 10000 ???? 00 00 platformer_test_sprite7_color14 = 0 93 10000 ???? 00 00 platformer_test_sprite7_color13 = 0 94 10000 ???? 00 00 platformer_test_sprite7_color12 = 0 95 10000 ???? 00 00 platformer_test_sprite7_color11 = 0 96 10000 ???? 00 00 platformer_test_sprite7_color10 = 0 97 10000 ???? 00 00 platformer_test_sprite7_color9 = 0 98 10000 ???? 00 00 platformer_test_sprite7_color8 = 0 99 10000 ???? 00 00 platformer_test_sprite7_color7 = 0 100 10000 ???? 00 00 platformer_test_sprite7_color6 = $00 101 10000 ???? 00 68 platformer_test_sprite7_color5 = $68 102 10000 ???? 00 0f platformer_test_sprite7_color4 = $0f 103 10000 ???? 00 6c platformer_test_sprite7_color3 = $6c 104 10000 ???? 00 08 platformer_test_sprite7_color2 = $08 105 10000 ???? 00 04 platformer_test_sprite7_color1 = $04 106 10000 ???? 00 00 platformer_test_sprite7_color0 = $00 107 10000 ???? 00 00 platformer_test_sprite6_color15 = 0 108 10000 ???? 00 00 platformer_test_sprite6_color14 = 0 109 10000 ???? 00 00 platformer_test_sprite6_color13 = 0 110 10000 ???? 00 00 platformer_test_sprite6_color12 = 0 111 10000 ???? 00 00 platformer_test_sprite6_color11 = 0 112 10000 ???? 00 00 platformer_test_sprite6_color10 = 0 113 10000 ???? 00 00 platformer_test_sprite6_color9 = 0 114 10000 ???? 00 00 platformer_test_sprite6_color8 = 0 115 10000 ???? 00 00 platformer_test_sprite6_color7 = 0 116 10000 ???? 00 00 platformer_test_sprite6_color6 = $00 117 10000 ???? 00 68 platformer_test_sprite6_color5 = $68 118 10000 ???? 00 6c platformer_test_sprite6_color4 = $6c 119 10000 ???? 00 04 platformer_test_sprite6_color3 = $04 120 10000 ???? 00 0f platformer_test_sprite6_color2 = $0f 121 10000 ???? 00 08 platformer_test_sprite6_color1 = $08 122 10000 ???? 00 00 platformer_test_sprite6_color0 = $00 123 10000 ???? 00 00 platformer_test_sprite5_color15 = 0 124 10000 ???? 00 00 platformer_test_sprite5_color14 = 0 125 10000 ???? 00 00 platformer_test_sprite5_color13 = 0 126 10000 ???? 00 00 platformer_test_sprite5_color12 = 0 127 10000 ???? 00 00 platformer_test_sprite5_color11 = 0 128 10000 ???? 00 00 platformer_test_sprite5_color10 = 0 129 10000 ???? 00 00 platformer_test_sprite5_color9 = 0 130 10000 ???? 00 00 platformer_test_sprite5_color8 = 0 131 10000 ???? 00 00 platformer_test_sprite5_color7 = 0 132 10000 ???? 00 00 platformer_test_sprite5_color6 = $00 133 10000 ???? 00 68 platformer_test_sprite5_color5 = $68 134 10000 ???? 00 6c platformer_test_sprite5_color4 = $6c 135 10000 ???? 00 0f platformer_test_sprite5_color3 = $0f 136 10000 ???? 00 08 platformer_test_sprite5_color2 = $08 137 10000 ???? 00 04 platformer_test_sprite5_color1 = $04 138 10000 ???? 00 00 platformer_test_sprite5_color0 = $00 139 10000 ???? 00 00 platformer_test_sprite4_color15 = 0 140 10000 ???? 00 00 platformer_test_sprite4_color14 = 0 141 10000 ???? 00 00 platformer_test_sprite4_color13 = 0 142 10000 ???? 00 00 platformer_test_sprite4_color12 = 0 143 10000 ???? 00 00 platformer_test_sprite4_color11 = 0 144 10000 ???? 00 00 platformer_test_sprite4_color10 = 0 145 10000 ???? 00 00 platformer_test_sprite4_color9 = 0 146 10000 ???? 00 00 platformer_test_sprite4_color8 = 0 147 10000 ???? 00 00 platformer_test_sprite4_color7 = 0 148 10000 ???? 00 00 platformer_test_sprite4_color6 = $00 149 10000 ???? 00 68 platformer_test_sprite4_color5 = $68 150 10000 ???? 00 08 platformer_test_sprite4_color4 = $08 151 10000 ???? 00 0f platformer_test_sprite4_color3 = $0f 152 10000 ???? 00 6c platformer_test_sprite4_color2 = $6c 153 10000 ???? 00 04 platformer_test_sprite4_color1 = $04 154 10000 ???? 00 00 platformer_test_sprite4_color0 = $00 155 10000 ???? 00 00 platformer_test_sprite3_color15 = 0 156 10000 ???? 00 00 platformer_test_sprite3_color14 = 0 157 10000 ???? 00 00 platformer_test_sprite3_color13 = 0 158 10000 ???? 00 00 platformer_test_sprite3_color12 = 0 159 10000 ???? 00 00 platformer_test_sprite3_color11 = 0 160 10000 ???? 00 00 platformer_test_sprite3_color10 = 0 161 10000 ???? 00 00 platformer_test_sprite3_color9 = 0 162 10000 ???? 00 00 platformer_test_sprite3_color8 = 0 163 10000 ???? 00 00 platformer_test_sprite3_color7 = 0 164 10000 ???? 00 00 platformer_test_sprite3_color6 = $00 165 10000 ???? 00 68 platformer_test_sprite3_color5 = $68 166 10000 ???? 00 0f platformer_test_sprite3_color4 = $0f 167 10000 ???? 00 6c platformer_test_sprite3_color3 = $6c 168 10000 ???? 00 08 platformer_test_sprite3_color2 = $08 169 10000 ???? 00 04 platformer_test_sprite3_color1 = $04 170 10000 ???? 00 00 platformer_test_sprite3_color0 = $00 171 10000 ???? 00 00 platformer_test_sprite2_color15 = 0 172 10000 ???? 00 00 platformer_test_sprite2_color14 = 0 173 10000 ???? 00 00 platformer_test_sprite2_color13 = 0 174 10000 ???? 00 00 platformer_test_sprite2_color12 = 0 175 10000 ???? 00 00 platformer_test_sprite2_color11 = 0 176 10000 ???? 00 00 platformer_test_sprite2_color10 = 0 177 10000 ???? 00 00 platformer_test_sprite2_color9 = 0 178 10000 ???? 00 00 platformer_test_sprite2_color8 = 0 179 10000 ???? 00 00 platformer_test_sprite2_color7 = 0 180 10000 ???? 00 00 platformer_test_sprite2_color6 = $00 181 10000 ???? 00 68 platformer_test_sprite2_color5 = $68 182 10000 ???? 00 6c platformer_test_sprite2_color4 = $6c 183 10000 ???? 00 08 platformer_test_sprite2_color3 = $08 184 10000 ???? 00 04 platformer_test_sprite2_color2 = $04 185 10000 ???? 00 0f platformer_test_sprite2_color1 = $0f 186 10000 ???? 00 00 platformer_test_sprite2_color0 = $00 187 10000 ???? 00 00 platformer_test_sprite1_color15 = 0 188 10000 ???? 00 00 platformer_test_sprite1_color14 = 0 189 10000 ???? 00 00 platformer_test_sprite1_color13 = 0 190 10000 ???? 00 00 platformer_test_sprite1_color12 = 0 191 10000 ???? 00 00 platformer_test_sprite1_color11 = 0 192 10000 ???? 00 00 platformer_test_sprite1_color10 = 0 193 10000 ???? 00 00 platformer_test_sprite1_color9 = 0 194 10000 ???? 00 00 platformer_test_sprite1_color8 = 0 195 10000 ???? 00 00 platformer_test_sprite1_color7 = 0 196 10000 ???? 00 00 platformer_test_sprite1_color6 = $00 197 10000 ???? 00 68 platformer_test_sprite1_color5 = $68 198 10000 ???? 00 6c platformer_test_sprite1_color4 = $6c 199 10000 ???? 00 04 platformer_test_sprite1_color3 = $04 200 10000 ???? 00 08 platformer_test_sprite1_color2 = $08 201 10000 ???? 00 0f platformer_test_sprite1_color1 = $0f 202 10000 ???? 00 00 platformer_test_sprite1_color0 = $00 203 10000 ???? 00 00 platformer_test_sprite0_color15 = 0 204 10000 ???? 00 00 platformer_test_sprite0_color14 = 0 205 10000 ???? 00 00 platformer_test_sprite0_color13 = 0 206 10000 ???? 00 00 platformer_test_sprite0_color12 = 0 207 10000 ???? 00 00 platformer_test_sprite0_color11 = 0 208 10000 ???? 00 00 platformer_test_sprite0_color10 = 0 209 10000 ???? 00 00 platformer_test_sprite0_color9 = 0 210 10000 ???? 00 00 platformer_test_sprite0_color8 = 0 211 10000 ???? 00 00 platformer_test_sprite0_color7 = 0 212 10000 ???? 00 00 platformer_test_sprite0_color6 = $00 213 10000 ???? 00 68 platformer_test_sprite0_color5 = $68 214 10000 ???? 00 6c platformer_test_sprite0_color4 = $6c 215 10000 ???? 00 04 platformer_test_sprite0_color3 = $04 216 10000 ???? 00 08 platformer_test_sprite0_color2 = $08 217 10000 ???? 00 0f platformer_test_sprite0_color1 = $0f 218 10000 ???? 00 00 platformer_test_sprite0_color0 = $00 219 10000 ???? 00 00 platformer_test_tiles_ramchar_color3 = $00 220 10000 ???? 00 08 platformer_test_tiles_ramchar_color2 = $08 221 10000 ???? 00 04 platformer_test_tiles_ramchar_color1 = $04 222 10000 ???? 00 00 platformer_test_tiles_ramchar_color0 = $00 223 10000 ???? 01 54 item_aniframe = var20 224 10000 ???? 225 10000 ???? 01 53 item_ypos = var19 226 10000 ???? 227 10000 ???? 01 52 item_xpos = var18 228 10000 ???? 229 10000 ???? 01 51 item_isgotten = var17 230 10000 ???? 231 10000 ???? 23 10 vSpeed = $2310 232 10000 ???? 233 10000 ???? 23 00 hSpeed = $2300 234 10000 ???? 235 10000 ???? 22 00 screendata = $2200 236 10000 ???? 237 10000 ???? 01 50 level = var16 238 10000 ???? 239 10000 ???? 01 4f pTemp2 = var15 240 10000 ???? 241 10000 ???? 01 4e pTemp1 = var14 242 10000 ???? 243 10000 ???? 01 4d gen_frame = var13 244 10000 ???? 245 10000 ???? 01 4c playerChar = var12 246 10000 ???? 247 10000 ???? 01 4b player_aniframe = var11 248 10000 ???? 249 10000 ???? 01 4a player_dir = var10 250 10000 ???? 251 10000 ???? 01 49 player_moving = var9 252 10000 ???? 253 10000 ???? 01 48 button2_Debounce = var8 254 10000 ???? 255 10000 ???? 01 47 button1_Debounce = var7 256 10000 ???? 257 10000 ???? 01 46 joyposright = var6 258 10000 ???? 259 10000 ???? 01 45 joyposleft = var5 260 10000 ???? 261 10000 ???? 01 44 joyposup = var4 262 10000 ???? 263 10000 ???? 01 43 joyposdown = var3 264 10000 ???? 265 10000 ???? 01 42 player_y = var2 266 10000 ???? 267 10000 ???? 01 41 player_x = var1 268 10000 ???? 269 10000 ???? 01 40 frameCounter = var0 270 10000 ???? 271 10000 ???? 00 01 collisionwrap = 1 272 10000 ???? 00 01 NTSC = 1 273 10000 ???? 00 c0 SCREENHEIGHT = 192 274 10000 ???? 00 01 CHECKOVERWRITE = 1 275 10000 ???? 00 10 ZONEHEIGHT = 16 276 10000 ???? 00 01 ROM48K = 1 ------- FILE 7800basic.h 6 10000 ???? 7 10000 ???? ;************ 7800 overall RAM map ************** 8 10000 ???? 9 10000 ???? ; 40-FF zero page RAM 10 10000 ???? ; 140-1FF RAM (stack) 11 10000 ???? ; 1800-203F RAM 12 10000 ???? ; 2100-213F RAM 13 10000 ???? ; 2200-27FF RAM 14 10000 ???? 15 10000 ???? ;************ 7800basic RAM usage map ************** 16 10000 ???? 17 10000 ???? ; 40-FF numerous defines, listed below 18 10000 ???? ; 140-1FF RAM (stack) 19 10000 ???? 20 10000 ???? ; 1800-187F DLL (1800-18DF with page flipping enabled) 21 10000 ???? ; 1880-1FFF DLs (18E0-1FFF with page flipping enabled) 22 10000 ???? 23 10000 ???? ; 2000-203F Reserved 24 10000 ???? ; 2100-213F Reserved 25 10000 ???? ; 2200-27FF Free 26 10000 ???? 27 10000 ???? 1f e0 eeprombuffer = $1FE0 28 10000 ???? 18 00 DLLMEM = $1800 29 10000 ???? 00 70 DBOFFSET = $70 ; $E0 length DL is /2 for double-buffering 30 10000 ???? 31 10000 ???? - ifconst PLOTVALUEPAGE 32 10000 ???? -VALBUFFER = (PLOTVALUEPAGE*256) 33 10000 ???? else 34 10000 ???? 20 00 VALBUFFER = $2000 ; to $203F ** never let VALBUFFER straddle pages 35 10000 ???? endif 36 10000 ???? 37 10000 ???? 38 10000 ???? 21 00 pausestate = $2100 39 10000 ???? 21 01 dlzero = $2101 ; zero to force end of $2100 DL, which we use in vblank and overscan 40 10000 ???? 21 02 sINPT1 = $2102 ; save register for joy button joy0 41 10000 ???? 21 03 sINPT3 = $2103 ; save register for joy button joy1 42 10000 ???? 21 04 currentbank = $2104 43 10000 ???? 44 10000 ???? 21 05 currentrambank = $2105 45 10000 ???? 21 06 charactermode = $2106 46 10000 ???? 21 07 sCTRL = $2107 47 10000 ???? 21 08 pokeydetected = $2108 48 10000 ???? 21 09 paldetected = $2109 49 10000 ???? 21 0a avoxdetected = $210A 50 10000 ???? 21 0b sCHARBASE = $210B ; save register for CHARBASE 51 10000 ???? 52 10000 ???? 21 0c hsdevice = $210C 53 10000 ???? 21 0d hsdifficulty = $210D 54 10000 ???? 21 0e hserror = $210E 55 10000 ???? 21 0f hsgameslot = $210F 56 10000 ???? 21 10 hsnewscoreline = $2110 57 10000 ???? 21 11 hsnewscorerank = $2111 58 10000 ???? 21 12 HSRAMTable = $2112 ; to $212F (30 bytes) Format: III*5, SSS*5 59 10000 ???? 21 12 HSRAMInitials = $2112 ; see above 60 10000 ???? 21 21 HSRAMScores = $2121 ; see above 61 10000 ???? 62 10000 ???? 21 31 ssCTRL = $2131 63 10000 ???? 21 32 ssCHARBASE = $2132 64 10000 ???? 21 33 hsdisplaymode = $2133 65 10000 ???? 21 34 gamedifficulty = $2134 66 10000 ???? 21 35 hsinitialpos = $2135 67 10000 ???? 21 36 hsinitialhold = $2136 68 10000 ???? 21 37 hscursorx = $2137 69 10000 ???? 21 38 hsjoydebounce = $2138 70 10000 ???? 21 39 hsswcha = $2139 71 10000 ???? 21 3a hsinpt1 = $213A 72 10000 ???? 21 3b hscolorchaseindex = $213B 73 10000 ???? 21 3c visibleDLLstart = $213C 74 10000 ???? 21 3d overscanDLLstart = $213D 75 10000 ???? 21 3e frameslost = $213E 76 10000 ???? 77 10000 ???? 78 10000 ???? 00 40 rand = $40 79 10000 ???? 00 41 rand16 = $41 80 10000 ???? 00 42 temp1 = $42 81 10000 ???? 00 43 temp2 = $43 82 10000 ???? 00 44 temp3 = $44 83 10000 ???? 00 45 temp4 = $45 84 10000 ???? 00 46 temp5 = $46 85 10000 ???? 00 47 temp6 = $47 86 10000 ???? 00 48 temp7 = $48 87 10000 ???? 00 49 temp8 = $49 88 10000 ???? 00 4a temp9 = $4a 89 10000 ???? 90 10000 ???? 00 4b pokeybase = $4b 91 10000 ???? 00 4b pokeybaselo = $4b 92 10000 ???? 00 4c pokeybasehi = $4c 93 10000 ???? 94 10000 ???? 00 4d visibleover = $4d 95 10000 ???? 96 10000 ???? 00 4e sfx1pointlo = $4e 97 10000 ???? 00 4f sfx2pointlo = $4f 98 10000 ???? 00 50 sfx1pointhi = $50 99 10000 ???? 00 51 sfx2pointhi = $51 100 10000 ???? 101 10000 ???? 00 52 sfx1priority = $52 102 10000 ???? 00 53 sfx2priority = $53 103 10000 ???? 00 54 sfx1poffset = $54 104 10000 ???? 00 55 sfx2poffset = $55 105 10000 ???? 106 10000 ???? 00 56 sfx1frames = $56 107 10000 ???? 00 57 sfx2frames = $57 108 10000 ???? 00 58 sfx1tick = $58 109 10000 ???? 00 59 sfx2tick = $59 110 10000 ???? 111 10000 ???? 00 5a tempmath = $5a 112 10000 ???? 113 10000 ???? 00 5b pokey1pointlo = $5b 114 10000 ???? 00 5c pokey1pointhi = $5c 115 10000 ???? 00 5d pokey2pointlo = $5d 116 10000 ???? 00 5e pokey2pointhi = $5e 117 10000 ???? 00 5f pokey3pointlo = $5f 118 10000 ???? 00 60 pokey3pointhi = $60 119 10000 ???? 00 61 pokey4pointlo = $61 120 10000 ???? 00 62 pokey4pointhi = $62 121 10000 ???? 122 10000 ???? 00 63 dlpnt = $63 ; to $64 123 10000 ???? 00 65 dlend = $65 ; to $81 - for 28 possible visible dll entries 124 10000 ???? 00 82 dlendsave = $82 ; to $9e - for 28 possible visible dll entries 125 10000 ???? 126 10000 ???? 00 9f speech_addr = $9f 127 10000 ???? 00 a0 speech_addr_hi = $a0 128 10000 ???? 129 10000 ???? 00 a1 HSGameTableLo = $a1 130 10000 ???? 00 a2 HSGameTableHi = $a2 131 10000 ???? 00 a3 HSVoxHi = $a3 132 10000 ???? 00 a4 HSVoxLo = $a4 133 10000 ???? 134 10000 ???? ;channel pointers 135 10000 ???? 136 10000 ???? 00 a5 songchannel1layer1lo = $a5 137 10000 ???? 00 a6 songchannel2layer1lo = $a6 138 10000 ???? 00 a7 songchannel3layer1lo = $a7 139 10000 ???? 00 a8 songchannel4layer1lo = $a8 140 10000 ???? 141 10000 ???? 00 a9 songchannel1layer2lo = $a9 142 10000 ???? 00 aa songchannel2layer2lo = $aA 143 10000 ???? 00 ab songchannel3layer2lo = $aB 144 10000 ???? 00 ac songchannel4layer2lo = $aC 145 10000 ???? 146 10000 ???? 00 ad songchannel1layer3lo = $aD 147 10000 ???? 00 ae songchannel2layer3lo = $aE 148 10000 ???? 00 af songchannel3layer3lo = $aF 149 10000 ???? 00 b0 songchannel4layer3lo = $b0 150 10000 ???? 151 10000 ???? 00 b1 songchannel1layer1hi = $b1 152 10000 ???? 00 b2 songchannel2layer1hi = $b2 153 10000 ???? 00 b3 songchannel3layer1hi = $b3 154 10000 ???? 00 b4 songchannel4layer1hi = $b4 155 10000 ???? 156 10000 ???? 00 b5 songchannel1layer2hi = $b5 157 10000 ???? 00 b6 songchannel2layer2hi = $b6 158 10000 ???? 00 b7 songchannel3layer2hi = $b7 159 10000 ???? 00 b8 songchannel4layer2hi = $b8 160 10000 ???? 161 10000 ???? 00 b9 songchannel1layer3hi = $b9 162 10000 ???? 00 ba songchannel2layer3hi = $bA 163 10000 ???? 00 bb songchannel3layer3hi = $bB 164 10000 ???? 00 bc songchannel4layer3hi = $bC 165 10000 ???? 166 10000 ???? 00 bd songdatalo = $bd 167 10000 ???? 00 be songdatahi = $be 168 10000 ???? 169 10000 ???? 00 bf inactivechannelcount = $bf 170 10000 ???? 171 10000 ???? 172 10000 ???? 00 c0 songchannel1transpose = $c0 173 10000 ???? 00 c1 songchannel2transpose = $c1 174 10000 ???? 00 c2 songchannel3transpose = $c2 175 10000 ???? 00 c3 songchannel4transpose = $c3 176 10000 ???? 177 10000 ???? 00 c4 songstackindex = $c4 178 10000 ???? 179 10000 ???? 00 c5 songchannel1instrumentlo = $c5 180 10000 ???? 00 c6 songchannel2instrumentlo = $c6 181 10000 ???? 00 c7 songchannel3instrumentlo = $c7 182 10000 ???? 00 c8 songchannel4instrumentlo = $c8 183 10000 ???? 184 10000 ???? 00 c9 songchannel1instrumenthi = $c9 185 10000 ???? 00 ca songchannel2instrumenthi = $ca 186 10000 ???? 00 cb songchannel3instrumenthi = $cb 187 10000 ???? 00 cc songchannel4instrumenthi = $cc 188 10000 ???? 189 10000 ???? 00 cd sfx1notedata = $cd 190 10000 ???? 00 ce sfx2notedata = $ce 191 10000 ???? 192 10000 ???? 00 cf songloops = $cf 193 10000 ???? 194 10000 ???? 00 d0 songpointerlo = $D0 195 10000 ???? 00 d1 songpointerhi = $D1 196 10000 ???? 197 10000 ???? 00 d2 voxlock = $D2 198 10000 ???? 00 d3 voxqueuesize = $D3 199 10000 ???? 200 10000 ???? 00 d4 vblankroutines = $D4 201 10000 ???? 202 10000 ???? 00 d5 doublebufferstate = $D5 203 10000 ???? 00 d6 doublebufferdloffset = $D6 204 10000 ???? 00 d7 doublebufferbufferdirty = $D7 205 10000 ???? 206 10000 ???? 00 d8 inttemp1 = $D8 207 10000 ???? 00 d9 inttemp2 = $D9 208 10000 ???? 00 da inttemp3 = $DA 209 10000 ???? 00 db inttemp4 = $DB 210 10000 ???? 00 dc inttemp5 = $DC 211 10000 ???? 00 dd inttemp6 = $DD 212 10000 ???? 213 10000 ???? 00 de sfxschedulelock = $DE 214 10000 ???? 00 df sfxschedulemissed = $DF 215 10000 ???? 00 e0 sfxinstrumentlo = $E0 216 10000 ???? 00 e1 sfxinstrumenthi = $E1 217 10000 ???? 00 e2 sfxpitchoffset = $E2 218 10000 ???? 00 e3 sfxnoteindex = $E3 219 10000 ???? 220 10000 ???? 00 e4 CTLSWAs = $E4 221 10000 ???? 00 e5 CTLSWBs = $E5 222 10000 ???? 223 10000 ???? 00 e6 A = $e6 224 10000 ???? 00 e6 a = $e6 225 10000 ???? 00 e7 B = $e7 226 10000 ???? 00 e7 b = $e7 227 10000 ???? 00 e8 C = $e8 228 10000 ???? 00 e8 c = $e8 229 10000 ???? 00 e9 D = $e9 230 10000 ???? 00 e9 d = $e9 231 10000 ???? 00 ea E = $ea 232 10000 ???? 00 ea e = $ea 233 10000 ???? 00 eb F = $eb 234 10000 ???? 00 eb f = $eb 235 10000 ???? 00 ec G = $ec 236 10000 ???? 00 ec g = $ec 237 10000 ???? 00 ed H = $ed 238 10000 ???? 00 ed h = $ed 239 10000 ???? 00 ee I = $ee 240 10000 ???? 00 ee i = $ee 241 10000 ???? 00 ef J = $ef 242 10000 ???? 00 ef j = $ef 243 10000 ???? 00 f0 K = $f0 244 10000 ???? 00 f0 k = $f0 245 10000 ???? 00 f1 L = $f1 246 10000 ???? 00 f1 l = $f1 247 10000 ???? 00 f2 M = $f2 248 10000 ???? 00 f2 m = $f2 249 10000 ???? 00 f3 N = $f3 250 10000 ???? 00 f3 n = $f3 251 10000 ???? 00 f4 O = $f4 252 10000 ???? 00 f4 o = $f4 253 10000 ???? 00 f5 P = $f5 254 10000 ???? 00 f5 p = $f5 255 10000 ???? 00 f6 Q = $f6 256 10000 ???? 00 f6 q = $f6 257 10000 ???? 00 f7 R = $f7 258 10000 ???? 00 f7 r = $f7 259 10000 ???? 00 f8 S = $f8 260 10000 ???? 00 f8 s = $f8 261 10000 ???? 00 f9 T = $f9 262 10000 ???? 00 f9 t = $f9 263 10000 ???? 00 fa U = $fa 264 10000 ???? 00 fa u = $fa 265 10000 ???? 00 fb V = $fb 266 10000 ???? 00 fb v = $fb 267 10000 ???? 00 fc W = $fc 268 10000 ???? 00 fc w = $fc 269 10000 ???? 00 fd X = $fd 270 10000 ???? 00 fd x = $fd 271 10000 ???? 00 fe Y = $fe 272 10000 ???? 00 fe y = $fe 273 10000 ???? 00 ff Z = $ff 274 10000 ???? 00 ff z = $ff 275 10000 ???? 276 10000 ???? ; var0-var99 variables use the top of the stack 277 10000 ???? 01 40 var0 = $140 278 10000 ???? 01 41 var1 = $141 279 10000 ???? 01 42 var2 = $142 280 10000 ???? 01 43 var3 = $143 281 10000 ???? 01 44 var4 = $144 282 10000 ???? 01 45 var5 = $145 283 10000 ???? 01 46 var6 = $146 284 10000 ???? 01 47 var7 = $147 285 10000 ???? 01 48 var8 = $148 286 10000 ???? 01 49 var9 = $149 287 10000 ???? 01 4a var10 = $14a 288 10000 ???? 01 4b var11 = $14b 289 10000 ???? 01 4c var12 = $14c 290 10000 ???? 01 4d var13 = $14d 291 10000 ???? 01 4e var14 = $14e 292 10000 ???? 01 4f var15 = $14f 293 10000 ???? 01 50 var16 = $150 294 10000 ???? 01 51 var17 = $151 295 10000 ???? 01 52 var18 = $152 296 10000 ???? 01 53 var19 = $153 297 10000 ???? 01 54 var20 = $154 298 10000 ???? 01 55 var21 = $155 299 10000 ???? 01 56 var22 = $156 300 10000 ???? 01 57 var23 = $157 301 10000 ???? 01 58 var24 = $158 302 10000 ???? 01 59 var25 = $159 303 10000 ???? 01 5a var26 = $15a 304 10000 ???? 01 5b var27 = $15b 305 10000 ???? 01 5c var28 = $15c 306 10000 ???? 01 5d var29 = $15d 307 10000 ???? 01 5e var30 = $15e 308 10000 ???? 01 5f var31 = $15f 309 10000 ???? 01 60 var32 = $160 310 10000 ???? 01 61 var33 = $161 311 10000 ???? 01 62 var34 = $162 312 10000 ???? 01 63 var35 = $163 313 10000 ???? 01 64 var36 = $164 314 10000 ???? 01 65 var37 = $165 315 10000 ???? 01 66 var38 = $166 316 10000 ???? 01 67 var39 = $167 317 10000 ???? 01 68 var40 = $168 318 10000 ???? 01 69 var41 = $169 319 10000 ???? 01 6a var42 = $16a 320 10000 ???? 01 6b var43 = $16b 321 10000 ???? 01 6c var44 = $16c 322 10000 ???? 01 6d var45 = $16d 323 10000 ???? 01 6e var46 = $16e 324 10000 ???? 01 6f var47 = $16f 325 10000 ???? 01 70 var48 = $170 326 10000 ???? 01 71 var49 = $171 327 10000 ???? 01 72 var50 = $172 328 10000 ???? 01 73 var51 = $173 329 10000 ???? 01 74 var52 = $174 330 10000 ???? 01 75 var53 = $175 331 10000 ???? 01 76 var54 = $176 332 10000 ???? 01 77 var55 = $177 333 10000 ???? 01 78 var56 = $178 334 10000 ???? 01 79 var57 = $179 335 10000 ???? 01 7a var58 = $17a 336 10000 ???? 01 7b var59 = $17b 337 10000 ???? 01 7c var60 = $17c 338 10000 ???? 01 7d var61 = $17d 339 10000 ???? 01 7e var62 = $17e 340 10000 ???? 01 7f var63 = $17f 341 10000 ???? 01 80 var64 = $180 342 10000 ???? 01 81 var65 = $181 343 10000 ???? 01 82 var66 = $182 344 10000 ???? 01 83 var67 = $183 345 10000 ???? 01 84 var68 = $184 346 10000 ???? 01 85 var69 = $185 347 10000 ???? 01 86 var70 = $186 348 10000 ???? 01 87 var71 = $187 349 10000 ???? 01 88 var72 = $188 350 10000 ???? 01 89 var73 = $189 351 10000 ???? 01 8a var74 = $18a 352 10000 ???? 01 8b var75 = $18b 353 10000 ???? 01 8c var76 = $18c 354 10000 ???? 01 8d var77 = $18d 355 10000 ???? 01 8e var78 = $18e 356 10000 ???? 01 8f var79 = $18f 357 10000 ???? 01 90 var80 = $190 358 10000 ???? 01 91 var81 = $191 359 10000 ???? 01 92 var82 = $192 360 10000 ???? 01 93 var83 = $193 361 10000 ???? 01 94 var84 = $194 362 10000 ???? 01 95 var85 = $195 363 10000 ???? 01 96 var86 = $196 364 10000 ???? 01 97 var87 = $197 365 10000 ???? 01 98 var88 = $198 366 10000 ???? 01 99 var89 = $199 367 10000 ???? 01 9a var90 = $19a 368 10000 ???? 01 9b var91 = $19b 369 10000 ???? 01 9c var92 = $19c 370 10000 ???? 01 9d var93 = $19d 371 10000 ???? 01 9e var94 = $19e 372 10000 ???? 01 9f var95 = $19f 373 10000 ???? 01 a0 var96 = $1a0 374 10000 ???? 01 a1 var97 = $1a1 375 10000 ???? 01 a2 var98 = $1a2 376 10000 ???? 01 a3 var99 = $1a3 377 10000 ???? 378 U01c2 ???? SEG.U "7800basicRAM" 379 U01a4 ORG $1A4 380 U01a4 381 U01a4 ; MAX allocation locations are in comments... 382 U01a4 00 framecounter DS 1 ; $1A4 383 U01a5 00 countdownseconds DS 1 ; $1A5 384 U01a6 00 00 00 score0 DS 3 ; $1A6 $1A7 $1A8 385 U01a9 00 00 00 score1 DS 3 ; $1A9 $1AA $1AB 386 U01ac 00 pausebuttonflag DS 1 ; $1AC 387 U01ad 00 valbufend DS 1 ; $1AD 388 U01ae 00 valbufendsave DS 1 ; $1AE 389 U01af 00 finescrollx DS 1 ; $1AF 390 U01b0 00 finescrolly DS 1 ; $1B0 391 U01b1 00 joybuttonmode DS 1 ; $1B1 ; track joysticks that were changed to one-button mode 392 U01b2 00 interruptindex DS 1 ; $1B2 393 U01b3 394 U01b3 - ifconst DOUBLEBUFFER 395 U01b3 -doublebufferminimumframetarget DS 1 ; $1B3 396 U01b3 -doublebufferminimumframeindex DS 1 ; $1B4 397 U01b3 endif 398 U01b3 399 U01b3 00 pausedisable DS 1 ; $1B5 400 U01b4 00 XCTRL1s DS 1 ; $1B6 401 U01b5 402 U01b5 - ifconst AVOXVOICE 403 U01b5 -avoxenable DS 1 ; $1B7 404 U01b5 -tempavox DS 1 ; $1B8 405 U01b5 endif 406 U01b5 407 U01b5 - ifconst MUSICTRACKER 408 U01b5 -songtempo DS 1 ; $1B9 409 U01b5 -songtick DS 1 ; $1BA 410 U01b5 - 411 U01b5 -songchannel1layer1loops DS 1 ; $1BB 412 U01b5 -songchannel2layer1loops DS 1 ; $1BC 413 U01b5 -songchannel3layer1loops DS 1 ; $1BD 414 U01b5 -songchannel4layer1loops DS 1 ; $1BE 415 U01b5 - 416 U01b5 -songchannel1layer2loops DS 1 ; $1BF 417 U01b5 -songchannel2layer2loops DS 1 ; $1C0 418 U01b5 -songchannel3layer2loops DS 1 ; $1C1 419 U01b5 -songchannel4layer2loops DS 1 ; $1C2 420 U01b5 - 421 U01b5 -songchannel1layer3loops DS 1 ; $1C3 422 U01b5 -songchannel2layer3loops DS 1 ; $1C4 423 U01b5 -songchannel3layer3loops DS 1 ; $1C5 424 U01b5 -songchannel4layer3loops DS 1 ; $1C6 425 U01b5 - 426 U01b5 -songchannel1busywait DS 1 ; $1C7 427 U01b5 -songchannel2busywait DS 1 ; $1C8 428 U01b5 -songchannel3busywait DS 1 ; $1C9 429 U01b5 -songchannel4busywait DS 1 ; $1CA 430 U01b5 - 431 U01b5 -songchannel1stackdepth DS 1 ; $1CB 432 U01b5 -songchannel2stackdepth DS 1 ; $1CC 433 U01b5 -songchannel3stackdepth DS 1 ; $1CD 434 U01b5 -songchannel4stackdepth DS 1 ; $1CE 435 U01b5 endif 436 U01b5 437 U01b5 00 palframes DS 1 ; $1CF 438 U01b6 00 palfastframe DS 1 ; $1D0 439 U01b7 440 U01b7 - ifconst MOUSESUPPORT 441 U01b7 -port0resolution DS 1 ; $1D1 442 U01b7 -port1resolution DS 1 ; $1D2 443 U01b7 else 444 U01b7 - ifconst TRAKBALLSUPPORT 445 U01b7 -port0resolution DS 1 ; $1D1 446 U01b7 -port1resolution DS 1 ; $1D2 447 U01b7 endif 448 U01b7 endif 449 U01b7 450 U01b7 00 port0control DS 1 ; $1D3 451 U01b8 00 port1control DS 1 ; $1D4 452 U01b9 453 U01b9 ; port#control values... 454 U01b9 ; 1 = proline 455 U01b9 ; 2 = lightgun 456 U01b9 ; 3 = paddle 457 U01b9 ; 4 = trakball 458 U01b9 ; 5 = vcs joystick 459 U01b9 ; 6 = driving 460 U01b9 ; 7 = keypad 461 U01b9 ; 8 = st mouse/cx80 462 U01b9 ; 9 = amiga mouse 463 U01b9 ; 10 = atarivox 464 U01b9 465 U01b9 ; controller 0 data... 466 U01b9 00 paddleposition0 DS 1 ; $1D5 467 U01b9 01 b9 keypadmatrix0a = paddleposition0 468 U01b9 01 b9 drivingposition0 = paddleposition0 469 U01b9 01 b9 trakballx0 = paddleposition0 470 U01b9 01 b9 mousex0 = paddleposition0 471 U01b9 01 b9 lighttgunx0 = paddleposition0 472 U01ba 473 U01ba ; controller 1 data... 474 U01ba 00 paddleposition2 DS 1 ; $1D6 475 U01ba 01 ba keypadmatrix1a = paddleposition2 476 U01ba 01 ba drivingposition1 = paddleposition2 477 U01ba 01 ba trakballx1 = paddleposition2 478 U01ba 01 ba mousex1 = paddleposition2 479 U01ba 01 ba lightgunx1 = paddleposition2 480 U01bb 481 U01bb ; controller 0 altdata... 482 U01bb 00 paddleposition1 DS 1 ; $1D7 483 U01bb 01 bb keypadmatrix0b = paddleposition1 484 U01bb 01 bb trakbally0 = paddleposition1 485 U01bb 01 bb mousey0 = paddleposition1 486 U01bb 01 bb lightguny0 = paddleposition1 487 U01bc 488 U01bc ; controller 1 altdata... 489 U01bc 00 paddleposition3 DS 1 ; $1D8 490 U01bc 01 bc keypadmatrix1b = paddleposition3 491 U01bc 01 bc trakbally1 = paddleposition3 492 U01bc 01 bc mousey1 = paddleposition3 493 U01bc 01 bc lightguny1 = paddleposition3 494 U01bd 495 U01bd ; controller state save. for trakball state+dir codes, rotary position codes 496 U01bd 00 controller0statesave DS 1 ; $1D9 497 U01bd 01 bd paddleprevious0 = controller0statesave 498 U01bd 01 bd mousecodex0 = controller0statesave 499 U01bd 01 bd trakballcodex0 = controller0statesave 500 U01bd 01 bd keypadmatrix0c = controller0statesave 501 U01be 502 U01be 00 controller1statesave DS 1 ; $1DA 503 U01be 01 be paddleprevious2 = controller1statesave 504 U01be 01 be mousecodex1 = controller1statesave 505 U01be 01 be trakballcodex1 = controller1statesave 506 U01be 01 be keypadmatrix1c = controller1statesave 507 U01bf 508 U01bf 00 paddleprevious1 DS 1 ; $1DB 509 U01bf 01 bf keypadmatrix0d = paddleprevious1 510 U01bf 01 bf mousecodey0 = paddleprevious1 511 U01bf 01 bf trakballcodey0 = paddleprevious1 512 U01c0 513 U01c0 00 paddleprevious3 DS 1 ; $1DC 514 U01c0 01 c0 keypadmatrix1d = paddleprevious3 515 U01c0 01 c0 mousecodey1 = paddleprevious3 516 U01c0 01 c0 trakballcodey1 = paddleprevious3 517 U01c1 518 U01c1 - ifconst pokeysupport 519 U01c1 -pokey1frames DS 1 ; $1DD 520 U01c1 -pokey1tick DS 1 ; $1DE 521 U01c1 -pokey2frames DS 1 ; $1DF 522 U01c1 -pokey2tick DS 1 ; $1E0 523 U01c1 -pokey3frames DS 1 ; $1E1 524 U01c1 -pokey3tick DS 1 ; $1E2 525 U01c1 -pokey4frames DS 1 ; $1E3 526 U01c1 -pokey4tick DS 1 ; $1E4 527 U01c1 -pokey1priority DS 1 ; $1E5 528 U01c1 -pokey1offset DS 1 ; $1E6 529 U01c1 -pokey2priority DS 1 ; $1E7 530 U01c1 -pokey2offset DS 1 ; $1E8 531 U01c1 -pokey3priority DS 1 ; $1E9 532 U01c1 -pokey3offset DS 1 ; $1EA 533 U01c1 -pokey4priority DS 1 ; $1EB 534 U01c1 -pokey4offset DS 1 ; $1EC 535 U01c1 endif 536 U01c1 537 U01c1 ; see if we need an interrupthold byte... 538 U01c1 INTERRUPTNEEDED SET 0 539 U01c1 - ifconst .topscreenroutine 540 U01c1 -INTERRUPTNEEDED SET 1 541 U01c1 endif 542 U01c1 - ifconst .bottomscreenroutine 543 U01c1 -INTERRUPTNEEDED SET 1 544 U01c1 endif 545 U01c1 - ifconst .userinterrupt 546 U01c1 -INTERRUPTNEEDED SET 1 547 U01c1 endif 548 U01c1 - if INTERRUPTNEEDED = 1 549 U01c1 -interrupthold DS 1 ; $1ED 550 U01c1 endif 551 U01c1 552 U01c1 ifnconst CANARYOFF 553 U01c1 00 canary DS 1 ; $1EF 554 U01c2 endif 555 U01c2 556 U01c2 557 U01c2 ifnconst bankswitchmode stack allowance: 30 nested subroutines. 558 U01c2 echo " stack allowance:",[($1FF - .)/2]d,"nested subroutines." 559 U01c2 - else 560 U01c2 - echo " stack allowance:",[($1FF - .)/3]d,"nested subroutines." 561 U01c2 endif 562 U01c2 ifnconst CANARYOFF the canary is situated at: $1c1 563 U01c2 echo " the canary is situated at:",[canary] 564 U01c2 - else 565 U01c2 - echo " the canary is disabled." 566 U01c2 endif 567 U01c2 568 U01c2 ; $1EE - $1FF reserved for stack 569 U01c2 570 10000 ???? SEG "GAME" 571 10000 ???? ------- FILE c:\Users\Shane\Documents\my7800projects\platformer_demos\template\platformer_demo_v01.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 platformer_test_item_3_mode = $00 4 10000 ???? 00 1f platformer_test_item_3_width_twoscompliment = $1f 5 10000 ???? 00 01 platformer_test_item_3_width = $01 6 10000 ???? 00 00 platformer_test_item_2_mode = $00 7 10000 ???? 00 1f platformer_test_item_2_width_twoscompliment = $1f 8 10000 ???? 00 01 platformer_test_item_2_width = $01 9 10000 ???? 00 00 platformer_test_item_1_mode = $00 10 10000 ???? 00 1f platformer_test_item_1_width_twoscompliment = $1f 11 10000 ???? 00 01 platformer_test_item_1_width = $01 12 10000 ???? 00 00 platformer_test_item_0_mode = $00 13 10000 ???? 00 1f platformer_test_item_0_width_twoscompliment = $1f 14 10000 ???? 00 01 platformer_test_item_0_width = $01 15 10000 ???? 00 00 platformer_test_fontCS_mode = $00 16 10000 ???? 00 06 platformer_test_fontCS_width_twoscompliment = $06 17 10000 ???? 00 3a platformer_test_fontCS_width = $3a 18 10000 ???? 00 80 platformer_test_sprite8_mode = $80 19 10000 ???? 00 1c platformer_test_sprite8_width_twoscompliment = $1c 20 10000 ???? 00 04 platformer_test_sprite8_width = $04 21 10000 ???? 00 80 platformer_test_sprite7_mode = $80 22 10000 ???? 00 1c platformer_test_sprite7_width_twoscompliment = $1c 23 10000 ???? 00 04 platformer_test_sprite7_width = $04 24 10000 ???? 00 80 platformer_test_sprite6_mode = $80 25 10000 ???? 00 1c platformer_test_sprite6_width_twoscompliment = $1c 26 10000 ???? 00 04 platformer_test_sprite6_width = $04 27 10000 ???? 00 80 platformer_test_sprite5_mode = $80 28 10000 ???? 00 1c platformer_test_sprite5_width_twoscompliment = $1c 29 10000 ???? 00 04 platformer_test_sprite5_width = $04 30 10000 ???? 00 80 platformer_test_sprite4_mode = $80 31 10000 ???? 00 1c platformer_test_sprite4_width_twoscompliment = $1c 32 10000 ???? 00 04 platformer_test_sprite4_width = $04 33 10000 ???? 00 80 platformer_test_sprite3_mode = $80 34 10000 ???? 00 1c platformer_test_sprite3_width_twoscompliment = $1c 35 10000 ???? 00 04 platformer_test_sprite3_width = $04 36 10000 ???? 00 80 platformer_test_sprite2_mode = $80 37 10000 ???? 00 1c platformer_test_sprite2_width_twoscompliment = $1c 38 10000 ???? 00 04 platformer_test_sprite2_width = $04 39 10000 ???? 00 80 platformer_test_sprite1_mode = $80 40 10000 ???? 00 1c platformer_test_sprite1_width_twoscompliment = $1c 41 10000 ???? 00 04 platformer_test_sprite1_width = $04 42 10000 ???? 00 80 platformer_test_sprite0_mode = $80 43 10000 ???? 00 1c platformer_test_sprite0_width_twoscompliment = $1c 44 10000 ???? 00 04 platformer_test_sprite0_width = $04 45 10000 ???? 00 00 platformer_test_tiles_ramchar_mode = $00 46 10000 ???? 00 0c platformer_test_tiles_ramchar_width_twoscompliment = $0c 47 10000 ???? 00 14 platformer_test_tiles_ramchar_width = $14 48 10000 ???? 02 80 level4_length = .skipL0134-level4 49 10000 ???? 50 10000 ???? 02 80 level3_length = .skipL0133-level3 51 10000 ???? 52 10000 ???? 02 80 level2_length = .skipL0132-level2 53 10000 ???? 54 10000 ???? 02 80 level1_length = .skipL0131-level1 55 10000 ???? 56 10000 ???? 00 01 BOXCOLLISION = 1 57 10000 ???? 00 bd platformer_test_item_3_color3 = $bd 58 10000 ???? 00 91 platformer_test_item_3_color2 = $91 59 10000 ???? 00 a6 platformer_test_item_3_color1 = $a6 60 10000 ???? 00 00 platformer_test_item_3_color0 = $00 61 10000 ???? 00 bd platformer_test_item_2_color3 = $bd 62 10000 ???? 00 91 platformer_test_item_2_color2 = $91 63 10000 ???? 00 a6 platformer_test_item_2_color1 = $a6 64 10000 ???? 00 00 platformer_test_item_2_color0 = $00 65 10000 ???? 00 bd platformer_test_item_1_color3 = $bd 66 10000 ???? 00 91 platformer_test_item_1_color2 = $91 67 10000 ???? 00 a6 platformer_test_item_1_color1 = $a6 68 10000 ???? 00 00 platformer_test_item_1_color0 = $00 69 10000 ???? 00 bd platformer_test_item_0_color3 = $bd 70 10000 ???? 00 91 platformer_test_item_0_color2 = $91 71 10000 ???? 00 a6 platformer_test_item_0_color1 = $a6 72 10000 ???? 00 00 platformer_test_item_0_color0 = $00 73 10000 ???? 00 0f platformer_test_fontCS_color1 = $0f 74 10000 ???? 00 00 platformer_test_fontCS_color0 = $00 75 10000 ???? 00 00 platformer_test_sprite8_color15 = 0 76 10000 ???? 00 00 platformer_test_sprite8_color14 = 0 77 10000 ???? 00 00 platformer_test_sprite8_color13 = 0 78 10000 ???? 00 00 platformer_test_sprite8_color12 = 0 79 10000 ???? 00 00 platformer_test_sprite8_color11 = 0 80 10000 ???? 00 00 platformer_test_sprite8_color10 = 0 81 10000 ???? 00 00 platformer_test_sprite8_color9 = 0 82 10000 ???? 00 00 platformer_test_sprite8_color8 = 0 83 10000 ???? 00 00 platformer_test_sprite8_color7 = 0 84 10000 ???? 00 00 platformer_test_sprite8_color6 = $00 85 10000 ???? 00 68 platformer_test_sprite8_color5 = $68 86 10000 ???? 00 6c platformer_test_sprite8_color4 = $6c 87 10000 ???? 00 08 platformer_test_sprite8_color3 = $08 88 10000 ???? 00 0f platformer_test_sprite8_color2 = $0f 89 10000 ???? 00 04 platformer_test_sprite8_color1 = $04 90 10000 ???? 00 00 platformer_test_sprite8_color0 = $00 91 10000 ???? 00 00 platformer_test_sprite7_color15 = 0 92 10000 ???? 00 00 platformer_test_sprite7_color14 = 0 93 10000 ???? 00 00 platformer_test_sprite7_color13 = 0 94 10000 ???? 00 00 platformer_test_sprite7_color12 = 0 95 10000 ???? 00 00 platformer_test_sprite7_color11 = 0 96 10000 ???? 00 00 platformer_test_sprite7_color10 = 0 97 10000 ???? 00 00 platformer_test_sprite7_color9 = 0 98 10000 ???? 00 00 platformer_test_sprite7_color8 = 0 99 10000 ???? 00 00 platformer_test_sprite7_color7 = 0 100 10000 ???? 00 00 platformer_test_sprite7_color6 = $00 101 10000 ???? 00 68 platformer_test_sprite7_color5 = $68 102 10000 ???? 00 0f platformer_test_sprite7_color4 = $0f 103 10000 ???? 00 6c platformer_test_sprite7_color3 = $6c 104 10000 ???? 00 08 platformer_test_sprite7_color2 = $08 105 10000 ???? 00 04 platformer_test_sprite7_color1 = $04 106 10000 ???? 00 00 platformer_test_sprite7_color0 = $00 107 10000 ???? 00 00 platformer_test_sprite6_color15 = 0 108 10000 ???? 00 00 platformer_test_sprite6_color14 = 0 109 10000 ???? 00 00 platformer_test_sprite6_color13 = 0 110 10000 ???? 00 00 platformer_test_sprite6_color12 = 0 111 10000 ???? 00 00 platformer_test_sprite6_color11 = 0 112 10000 ???? 00 00 platformer_test_sprite6_color10 = 0 113 10000 ???? 00 00 platformer_test_sprite6_color9 = 0 114 10000 ???? 00 00 platformer_test_sprite6_color8 = 0 115 10000 ???? 00 00 platformer_test_sprite6_color7 = 0 116 10000 ???? 00 00 platformer_test_sprite6_color6 = $00 117 10000 ???? 00 68 platformer_test_sprite6_color5 = $68 118 10000 ???? 00 6c platformer_test_sprite6_color4 = $6c 119 10000 ???? 00 04 platformer_test_sprite6_color3 = $04 120 10000 ???? 00 0f platformer_test_sprite6_color2 = $0f 121 10000 ???? 00 08 platformer_test_sprite6_color1 = $08 122 10000 ???? 00 00 platformer_test_sprite6_color0 = $00 123 10000 ???? 00 00 platformer_test_sprite5_color15 = 0 124 10000 ???? 00 00 platformer_test_sprite5_color14 = 0 125 10000 ???? 00 00 platformer_test_sprite5_color13 = 0 126 10000 ???? 00 00 platformer_test_sprite5_color12 = 0 127 10000 ???? 00 00 platformer_test_sprite5_color11 = 0 128 10000 ???? 00 00 platformer_test_sprite5_color10 = 0 129 10000 ???? 00 00 platformer_test_sprite5_color9 = 0 130 10000 ???? 00 00 platformer_test_sprite5_color8 = 0 131 10000 ???? 00 00 platformer_test_sprite5_color7 = 0 132 10000 ???? 00 00 platformer_test_sprite5_color6 = $00 133 10000 ???? 00 68 platformer_test_sprite5_color5 = $68 134 10000 ???? 00 6c platformer_test_sprite5_color4 = $6c 135 10000 ???? 00 0f platformer_test_sprite5_color3 = $0f 136 10000 ???? 00 08 platformer_test_sprite5_color2 = $08 137 10000 ???? 00 04 platformer_test_sprite5_color1 = $04 138 10000 ???? 00 00 platformer_test_sprite5_color0 = $00 139 10000 ???? 00 00 platformer_test_sprite4_color15 = 0 140 10000 ???? 00 00 platformer_test_sprite4_color14 = 0 141 10000 ???? 00 00 platformer_test_sprite4_color13 = 0 142 10000 ???? 00 00 platformer_test_sprite4_color12 = 0 143 10000 ???? 00 00 platformer_test_sprite4_color11 = 0 144 10000 ???? 00 00 platformer_test_sprite4_color10 = 0 145 10000 ???? 00 00 platformer_test_sprite4_color9 = 0 146 10000 ???? 00 00 platformer_test_sprite4_color8 = 0 147 10000 ???? 00 00 platformer_test_sprite4_color7 = 0 148 10000 ???? 00 00 platformer_test_sprite4_color6 = $00 149 10000 ???? 00 68 platformer_test_sprite4_color5 = $68 150 10000 ???? 00 08 platformer_test_sprite4_color4 = $08 151 10000 ???? 00 0f platformer_test_sprite4_color3 = $0f 152 10000 ???? 00 6c platformer_test_sprite4_color2 = $6c 153 10000 ???? 00 04 platformer_test_sprite4_color1 = $04 154 10000 ???? 00 00 platformer_test_sprite4_color0 = $00 155 10000 ???? 00 00 platformer_test_sprite3_color15 = 0 156 10000 ???? 00 00 platformer_test_sprite3_color14 = 0 157 10000 ???? 00 00 platformer_test_sprite3_color13 = 0 158 10000 ???? 00 00 platformer_test_sprite3_color12 = 0 159 10000 ???? 00 00 platformer_test_sprite3_color11 = 0 160 10000 ???? 00 00 platformer_test_sprite3_color10 = 0 161 10000 ???? 00 00 platformer_test_sprite3_color9 = 0 162 10000 ???? 00 00 platformer_test_sprite3_color8 = 0 163 10000 ???? 00 00 platformer_test_sprite3_color7 = 0 164 10000 ???? 00 00 platformer_test_sprite3_color6 = $00 165 10000 ???? 00 68 platformer_test_sprite3_color5 = $68 166 10000 ???? 00 0f platformer_test_sprite3_color4 = $0f 167 10000 ???? 00 6c platformer_test_sprite3_color3 = $6c 168 10000 ???? 00 08 platformer_test_sprite3_color2 = $08 169 10000 ???? 00 04 platformer_test_sprite3_color1 = $04 170 10000 ???? 00 00 platformer_test_sprite3_color0 = $00 171 10000 ???? 00 00 platformer_test_sprite2_color15 = 0 172 10000 ???? 00 00 platformer_test_sprite2_color14 = 0 173 10000 ???? 00 00 platformer_test_sprite2_color13 = 0 174 10000 ???? 00 00 platformer_test_sprite2_color12 = 0 175 10000 ???? 00 00 platformer_test_sprite2_color11 = 0 176 10000 ???? 00 00 platformer_test_sprite2_color10 = 0 177 10000 ???? 00 00 platformer_test_sprite2_color9 = 0 178 10000 ???? 00 00 platformer_test_sprite2_color8 = 0 179 10000 ???? 00 00 platformer_test_sprite2_color7 = 0 180 10000 ???? 00 00 platformer_test_sprite2_color6 = $00 181 10000 ???? 00 68 platformer_test_sprite2_color5 = $68 182 10000 ???? 00 6c platformer_test_sprite2_color4 = $6c 183 10000 ???? 00 08 platformer_test_sprite2_color3 = $08 184 10000 ???? 00 04 platformer_test_sprite2_color2 = $04 185 10000 ???? 00 0f platformer_test_sprite2_color1 = $0f 186 10000 ???? 00 00 platformer_test_sprite2_color0 = $00 187 10000 ???? 00 00 platformer_test_sprite1_color15 = 0 188 10000 ???? 00 00 platformer_test_sprite1_color14 = 0 189 10000 ???? 00 00 platformer_test_sprite1_color13 = 0 190 10000 ???? 00 00 platformer_test_sprite1_color12 = 0 191 10000 ???? 00 00 platformer_test_sprite1_color11 = 0 192 10000 ???? 00 00 platformer_test_sprite1_color10 = 0 193 10000 ???? 00 00 platformer_test_sprite1_color9 = 0 194 10000 ???? 00 00 platformer_test_sprite1_color8 = 0 195 10000 ???? 00 00 platformer_test_sprite1_color7 = 0 196 10000 ???? 00 00 platformer_test_sprite1_color6 = $00 197 10000 ???? 00 68 platformer_test_sprite1_color5 = $68 198 10000 ???? 00 6c platformer_test_sprite1_color4 = $6c 199 10000 ???? 00 04 platformer_test_sprite1_color3 = $04 200 10000 ???? 00 08 platformer_test_sprite1_color2 = $08 201 10000 ???? 00 0f platformer_test_sprite1_color1 = $0f 202 10000 ???? 00 00 platformer_test_sprite1_color0 = $00 203 10000 ???? 00 00 platformer_test_sprite0_color15 = 0 204 10000 ???? 00 00 platformer_test_sprite0_color14 = 0 205 10000 ???? 00 00 platformer_test_sprite0_color13 = 0 206 10000 ???? 00 00 platformer_test_sprite0_color12 = 0 207 10000 ???? 00 00 platformer_test_sprite0_color11 = 0 208 10000 ???? 00 00 platformer_test_sprite0_color10 = 0 209 10000 ???? 00 00 platformer_test_sprite0_color9 = 0 210 10000 ???? 00 00 platformer_test_sprite0_color8 = 0 211 10000 ???? 00 00 platformer_test_sprite0_color7 = 0 212 10000 ???? 00 00 platformer_test_sprite0_color6 = $00 213 10000 ???? 00 68 platformer_test_sprite0_color5 = $68 214 10000 ???? 00 6c platformer_test_sprite0_color4 = $6c 215 10000 ???? 00 04 platformer_test_sprite0_color3 = $04 216 10000 ???? 00 08 platformer_test_sprite0_color2 = $08 217 10000 ???? 00 0f platformer_test_sprite0_color1 = $0f 218 10000 ???? 00 00 platformer_test_sprite0_color0 = $00 219 10000 ???? 00 00 platformer_test_tiles_ramchar_color3 = $00 220 10000 ???? 00 08 platformer_test_tiles_ramchar_color2 = $08 221 10000 ???? 00 04 platformer_test_tiles_ramchar_color1 = $04 222 10000 ???? 00 00 platformer_test_tiles_ramchar_color0 = $00 223 10000 ???? 01 54 item_aniframe = var20 224 10000 ???? 225 10000 ???? 01 53 item_ypos = var19 226 10000 ???? 227 10000 ???? 01 52 item_xpos = var18 228 10000 ???? 229 10000 ???? 01 51 item_isgotten = var17 230 10000 ???? 231 10000 ???? 23 10 vSpeed = $2310 232 10000 ???? 233 10000 ???? 23 00 hSpeed = $2300 234 10000 ???? 235 10000 ???? 22 00 screendata = $2200 236 10000 ???? 237 10000 ???? 01 50 level = var16 238 10000 ???? 239 10000 ???? 01 4f pTemp2 = var15 240 10000 ???? 241 10000 ???? 01 4e pTemp1 = var14 242 10000 ???? 243 10000 ???? 01 4d gen_frame = var13 244 10000 ???? 245 10000 ???? 01 4c playerChar = var12 246 10000 ???? 247 10000 ???? 01 4b player_aniframe = var11 248 10000 ???? 249 10000 ???? 01 4a player_dir = var10 250 10000 ???? 251 10000 ???? 01 49 player_moving = var9 252 10000 ???? 253 10000 ???? 01 48 button2_Debounce = var8 254 10000 ???? 255 10000 ???? 01 47 button1_Debounce = var7 256 10000 ???? 257 10000 ???? 01 46 joyposright = var6 258 10000 ???? 259 10000 ???? 01 45 joyposleft = var5 260 10000 ???? 261 10000 ???? 01 44 joyposup = var4 262 10000 ???? 263 10000 ???? 01 43 joyposdown = var3 264 10000 ???? 265 10000 ???? 01 42 player_y = var2 266 10000 ???? 267 10000 ???? 01 41 player_x = var1 268 10000 ???? 269 10000 ???? 01 40 frameCounter = var0 270 10000 ???? 271 10000 ???? 00 01 collisionwrap = 1 272 10000 ???? 00 01 NTSC = 1 273 10000 ???? 00 c0 SCREENHEIGHT = 192 274 10000 ???? 00 01 CHECKOVERWRITE = 1 275 10000 ???? 00 10 ZONEHEIGHT = 16 276 10000 ???? 00 01 ROM48K = 1 ------- FILE c:\Users\Shane\Documents\my7800projects\platformer_demos\template\platformer_demo_v01.78b.asm 555 10000 ???? 556 10000 ???? ; A BEAD header gets automatically incorportated into the ROM header. 557 10000 ???? ; For more BEAD executable info, check out the spec... 558 10000 ???? ; http://7800.8bitdev.org/index.php/The_Atari_7800_BEAD_Execuable_Specification 559 10000 ???? 560 10000 ???? 00 01 GAMEDESCRIPTIONSET = 1 561 10000 ???? 4e 61 6d 65 GAMEDESCRIPTION = "Test Name" 562 10000 ???? 563 10000 ???? 00 40 BDHSC = %01000000 564 10000 ???? 00 20 BDYM = %00100000 565 10000 ???? 00 10 BDPOKEY = %00010000 566 10000 ???? 00 08 BDROF = %00001000 567 10000 ???? 00 00 BD16K = %00000000 568 10000 ???? 00 01 BD32K = %00000001 569 10000 ???? 00 02 BD48K = %00000010 570 10000 ???? 00 05 BD1800 = %00000101 571 10000 ???? 00 06 BD4000 = %00000110 572 10000 ???? 573 10000 ???? - ifconst ROM32K 574 10000 ???? -BEADHEADER = 1 575 10000 ???? endif 576 10000 ???? ifconst ROM48K 577 10000 ???? 00 01 BEADHEADER = 1 578 10000 ???? endif 579 10000 ???? 580 10000 ???? ifconst BEADHEADER 581 10000 ???? BEADHARDWARE SET 0 582 10000 ???? - ifconst ROM16K 583 10000 ???? -BEADHARDWARE SET (BEADHARDWARE|BD16K) 584 10000 ???? endif 585 10000 ???? - ifconst ROM32K 586 10000 ???? -BEADHARDWARE SET (BEADHARDWARE|BD32K) 587 10000 ???? endif 588 10000 ???? ifconst ROM48K 589 10000 ???? BEADHARDWARE SET (BEADHARDWARE|BD48K) 590 10000 ???? endif 591 10000 ???? - ifconst pokeysupport 592 10000 ???? -BEADHARDWARE SET (BEADHARDWARE|BDPOKEY) 593 10000 ???? endif 594 10000 ???? - ifconst HSSUPPORT 595 10000 ???? -BEADHARDWARE SET (BEADHARDWARE|BDHSC) 596 10000 ???? endif 597 10000 ???? endif 598 10000 ???? 599 10000 ???? ;start address of cart... 600 10000 ???? ifconst ROM48K 601 4000 ORG $4000,0 602 4000 ifconst BEADHEADER 603 4000 be ad 02 .byte.b $BE,$AD,BEADHARDWARE 604 4003 ifconst GAMEDESCRIPTIONSET 605 4003 18 CLC 606 4004 90 0a BCC _SKIPDESCRIPTION 607 4006 54 65 73 74* .byte.b GAMEDESCRIPTION,0 608 4010 _SKIPDESCRIPTION 609 4010 endif 610 4010 6c fc ff jmp ($FFFC) 611 4013 endif 612 4013 - else 613 4013 - ifconst bankswitchmode 614 4013 - ifconst ROMAT4K 615 4013 - ORG $4000,0 616 4013 - RORG $4000 617 4013 - else 618 4013 - ORG $8000,0 619 4013 - RORG $8000 620 4013 - endif 621 4013 - else ; not bankswitchmode 622 4013 - ifconst ROM16K 623 4013 - ORG $C000,0 624 4013 - ifconst BEADHEADER 625 4013 - .byte $BE,$AD,BEADHARDWARE 626 4013 - ifconst GAMEDESCRIPTION 627 4013 - CLC 628 4013 - BCC _SKIPDESCRIPTION 629 4013 - .byte GAMEDESCRIPTION,0 630 4013 -_SKIPDESCRIPTION 631 4013 - endif 632 4013 - jmp ($FFFC) 633 4013 - endif 634 4013 - else 635 4013 - ifconst ROM8K 636 4013 - ORG $E000,0 637 4013 - else 638 4013 - ORG $8000,0 639 4013 - ifconst BEADHEADER 640 4013 - .byte $BE,$AD,BEADHARDWARE 641 4013 - ifconst GAMEDESCRIPTION 642 4013 - CLC 643 4013 - BCC _SKIPDESCRIPTION 644 4013 - .byte GAMEDESCRIPTION,0 645 4013 -_SKIPDESCRIPTION 646 4013 - endif 647 4013 - jmp ($FFFC) 648 4013 - endif 649 4013 - endif 650 4013 - endif 651 4013 - endif 652 4013 endif 653 4013 654 4013 ;7800basic v0.18 Mar 14 2021 14:27:24 655 4013 SPACEOVERFLOW SET 0 656 4013 game 657 4013 . 658 4013 ;; 659 4013 660 4013 . 661 4013 ;; 662 4013 663 4013 .L00 ;; set romsize 48k 664 4013 665 4013 .L01 ;; set zoneheight 16 666 4013 667 4013 .L02 ;; set zoneprotection on 668 4013 669 4013 .L03 ;; set basepath gfx 670 4013 671 4013 .L04 ;; set tallsprite on 672 4013 673 4013 .L05 ;; set pauseroutine on 674 4013 675 4013 .L06 ;; set screenheight 192 676 4013 677 4013 .L07 ;; set tv ntsc 678 4013 679 4013 .L08 ;; set collisionwrap on 680 4013 681 4013 .L09 ;; set doublewide off 682 4013 683 4013 .L010 ;; displaymode 160A 684 4013 685 4013 a9 40 lda #%01000000 ;Enable DMA, mode=160x2/160x4 686 4015 85 3c sta CTRL 687 4017 688 4017 8d 07 21 sta sCTRL 689 401a 690 401a . 691 401a ;; 692 401a 693 401a .L011 ;; dim frameCounter = var0 694 401a 695 401a .L012 ;; dim player_x = var1 696 401a 697 401a .L013 ;; dim player_y = var2 698 401a 699 401a .L014 ;; dim joyposdown = var3 700 401a 701 401a .L015 ;; dim joyposup = var4 702 401a 703 401a .L016 ;; dim joyposleft = var5 704 401a 705 401a .L017 ;; dim joyposright = var6 706 401a 707 401a .L018 ;; dim button1_Debounce = var7 708 401a 709 401a .L019 ;; dim button2_Debounce = var8 710 401a 711 401a .L020 ;; dim player_moving = var9 712 401a 713 401a .L021 ;; dim player_dir = var10 714 401a 715 401a .L022 ;; dim player_aniframe = var11 716 401a 717 401a .L023 ;; dim playerChar = var12 718 401a 719 401a .L024 ;; dim gen_frame = var13 720 401a 721 401a .L025 ;; dim pTemp1 = var14 722 401a 723 401a .L026 ;; dim pTemp2 = var15 724 401a 725 401a .L027 ;; dim level = var16 726 401a 727 401a .L028 ;; dim screendata = $2200 728 401a 729 401a .L029 ;; dim hSpeed = $2300 730 401a 731 401a .L030 ;; dim vSpeed = $2310 732 401a 733 401a .L031 ;; dim item_isgotten = var17 734 401a 735 401a .L032 ;; dim item_xpos = var18 736 401a 737 401a .L033 ;; dim item_ypos = var19 738 401a 739 401a .L034 ;; dim item_aniframe = var20 740 401a 741 401a . 742 401a ;; 743 401a 744 401a . 745 401a ;; 746 401a 747 401a .L035 ;; BACKGRND = $00 748 401a 749 401a a9 00 LDA #$00 750 401c 85 20 STA BACKGRND 751 401e .L036 ;; P0C1 = $6C : P0C2 = $57 : P0C3 = $0F 752 401e 753 401e a9 6c LDA #$6C 754 4020 85 21 STA P0C1 755 4022 a9 57 LDA #$57 756 4024 85 22 STA P0C2 757 4026 a9 0f LDA #$0F 758 4028 85 23 STA P0C3 759 402a .L037 ;; P1C1 = $96 : P1C2 = $90 : P1C3 = $AF 760 402a 761 402a a9 96 LDA #$96 762 402c 85 25 STA P1C1 763 402e a9 90 LDA #$90 764 4030 85 26 STA P1C2 765 4032 a9 af LDA #$AF 766 4034 85 27 STA P1C3 767 4036 .L038 ;; P2C1 = $15 : P2C2 = $10 : P2C3 = $1C 768 4036 769 4036 a9 15 LDA #$15 770 4038 85 29 STA P2C1 771 403a a9 10 LDA #$10 772 403c 85 2a STA P2C2 773 403e a9 1c LDA #$1C 774 4040 85 2b STA P2C3 775 4042 .L039 ;; P3C1 = $05 : P3C2 = $01 : P3C3 = $09 776 4042 777 4042 a9 05 LDA #$05 778 4044 85 2d STA P3C1 779 4046 a9 01 LDA #$01 780 4048 85 2e STA P3C2 781 404a a9 09 LDA #$09 782 404c 85 2f STA P3C3 783 404e .L040 ;; P4C1 = $F2 : P4C2 = $F9 : P4C3 = $F4 784 404e 785 404e a9 f2 LDA #$F2 786 4050 85 31 STA P4C1 787 4052 a9 f9 LDA #$F9 788 4054 85 32 STA P4C2 789 4056 a9 f4 LDA #$F4 790 4058 85 33 STA P4C3 791 405a .L041 ;; P5C1 = $B3 : P5C2 = $DB : P5C3 = $C8 792 405a 793 405a a9 b3 LDA #$B3 794 405c 85 35 STA P5C1 795 405e a9 db LDA #$DB 796 4060 85 36 STA P5C2 797 4062 a9 c8 LDA #$C8 798 4064 85 37 STA P5C3 799 4066 .L042 ;; P6C1 = $30 : P6C2 = $2B : P6C3 = $38 800 4066 801 4066 a9 30 LDA #$30 802 4068 85 39 STA P6C1 803 406a a9 2b LDA #$2B 804 406c 85 3a STA P6C2 805 406e a9 38 LDA #$38 806 4070 85 3b STA P6C3 807 4072 .L043 ;; P7C1 = $82 : P7C2 = $78 : P7C3 = $85 808 4072 809 4072 a9 82 LDA #$82 810 4074 85 3d STA P7C1 811 4076 a9 78 LDA #$78 812 4078 85 3e STA P7C2 813 407a a9 85 LDA #$85 814 407c 85 3f STA P7C3 815 407e . 816 407e ;; 817 407e 818 407e .init 819 407e ;; init 820 407e 821 407e .L044 ;; frameCounter = 0 822 407e 823 407e a9 00 LDA #0 824 4080 8d 40 01 STA frameCounter 825 4083 .L045 ;; player_x = 0 : player_y = 0 826 4083 827 4083 a9 00 LDA #0 828 4085 8d 41 01 STA player_x 829 4088 8d 42 01 STA player_y 830 408b .L046 ;; joyposdown = 0 : joyposup = 0 : joyposleft = 0 : joyposright = 0 831 408b 832 408b a9 00 LDA #0 833 408d 8d 43 01 STA joyposdown 834 4090 8d 44 01 STA joyposup 835 4093 8d 45 01 STA joyposleft 836 4096 8d 46 01 STA joyposright 837 4099 .L047 ;; button1_Debounce = 0 : button2_Debounce = 0 838 4099 839 4099 a9 00 LDA #0 840 409b 8d 47 01 STA button1_Debounce 841 409e 8d 48 01 STA button2_Debounce 842 40a1 .L048 ;; player_moving = 0 : player_dir = 0 : player_aniframe = 0 : playerChar = 0 843 40a1 844 40a1 a9 00 LDA #0 845 40a3 8d 49 01 STA player_moving 846 40a6 8d 4a 01 STA player_dir 847 40a9 8d 4b 01 STA player_aniframe 848 40ac 8d 4c 01 STA playerChar 849 40af .L049 ;; gen_frame = 0 : hSpeed = 0 : vSpeed = 0 850 40af 851 40af a9 00 LDA #0 852 40b1 8d 4d 01 STA gen_frame 853 40b4 8d 00 23 STA hSpeed 854 40b7 8d 10 23 STA vSpeed 855 40ba .L050 ;; item_isgotten = 0 : item_xpos = 0 : item_ypos = 0 856 40ba 857 40ba a9 00 LDA #0 858 40bc 8d 51 01 STA item_isgotten 859 40bf 8d 52 01 STA item_xpos 860 40c2 8d 53 01 STA item_ypos 861 40c5 . 862 40c5 ;; 863 40c5 864 40c5 . 865 40c5 ;; 866 40c5 867 40c5 .L051 ;; incgraphic platformer_test_tiles_ramchar.png 160A 3 868 40c5 869 40c5 .L052 ;; incgraphic platformer_test_sprite0.png 160B 0 870 40c5 871 40c5 .L053 ;; incgraphic platformer_test_sprite1.png 160B 0 872 40c5 873 40c5 .L054 ;; incgraphic platformer_test_sprite2.png 160B 0 874 40c5 875 40c5 .L055 ;; incgraphic platformer_test_sprite3.png 160B 0 876 40c5 877 40c5 .L056 ;; incgraphic platformer_test_sprite4.png 160B 0 878 40c5 879 40c5 .L057 ;; incgraphic platformer_test_sprite5.png 160B 0 880 40c5 881 40c5 .L058 ;; incgraphic platformer_test_sprite6.png 160B 0 882 40c5 883 40c5 .L059 ;; incgraphic platformer_test_sprite7.png 160B 0 884 40c5 885 40c5 .L060 ;; incgraphic platformer_test_sprite8.png 160B 0 886 40c5 887 40c5 .L061 ;; incgraphic platformer_test_fontCS.png 160A 0 888 40c5 889 40c5 .L062 ;; incgraphic platformer_test_item_0.png 160A 1 890 40c5 891 40c5 .L063 ;; incgraphic platformer_test_item_1.png 160A 1 892 40c5 893 40c5 .L064 ;; incgraphic platformer_test_item_2.png 160A 1 894 40c5 895 40c5 .L065 ;; incgraphic platformer_test_item_3.png 160A 1 896 40c5 897 40c5 . 898 40c5 ;; 899 40c5 900 40c5 .L066 ;; gosub titlescreen 901 40c5 902 40c5 20 e8 41 jsr .titlescreen 903 40c8 904 40c8 .L067 ;; gosub initialise_gamescreen 905 40c8 906 40c8 20 47 43 jsr .initialise_gamescreen 907 40cb 908 40cb .L068 ;; gosub load_level 909 40cb 910 40cb 20 9f 43 jsr .load_level 911 40ce 912 40ce .main 913 40ce ;; main 914 40ce 915 40ce .L069 ;; restorescreen 916 40ce 917 40ce 20 91 f0 jsr restorescreen 918 40d1 .L070 ;; if switchreset then reboot 919 40d1 920 40d1 20 31 f4 jsr checkresetswitch 921 40d4 d0 03 BNE .skipL070 922 40d6 .condpart0 923 40d6 4c 1e f5 JMP START 924 40d9 .skipL070 925 40d9 .L071 ;; frameCounter = frameCounter + 1 926 40d9 927 40d9 ad 40 01 LDA frameCounter 928 40dc 18 CLC 929 40dd 69 01 ADC #1 930 40df 8d 40 01 STA frameCounter 931 40e2 .L072 ;; if frameCounter > 10 then frameCounter = 0 932 40e2 933 40e2 a9 0a LDA #10 934 40e4 cd 40 01 CMP frameCounter 935 40e7 b0 05 BCS .skipL072 936 40e9 .condpart1 937 40e9 a9 00 LDA #0 938 40eb 8d 40 01 STA frameCounter 939 40ee .skipL072 940 40ee . 941 40ee ;; 942 40ee 943 40ee . 944 40ee ;; 945 40ee 946 40ee .L073 ;; gen_frame = gen_frame + 1 947 40ee 948 40ee ad 4d 01 LDA gen_frame 949 40f1 18 CLC 950 40f2 69 01 ADC #1 951 40f4 8d 4d 01 STA gen_frame 952 40f7 .L074 ;; if ( gen_frame & 3 ) = 0 then player_aniframe = player_aniframe + 1 953 40f7 954 40f7 ; complex condition detected 955 40f7 ; complex statement detected 956 40f7 ad 4d 01 LDA gen_frame 957 40fa 29 03 AND #3 958 40fc c9 00 CMP #0 959 40fe d0 09 BNE .skipL074 960 4100 .condpart2 961 4100 ad 4b 01 LDA player_aniframe 962 4103 18 CLC 963 4104 69 01 ADC #1 964 4106 8d 4b 01 STA player_aniframe 965 4109 .skipL074 966 4109 .L075 ;; player_aniframe = player_aniframe & 3 967 4109 968 4109 ad 4b 01 LDA player_aniframe 969 410c 29 03 AND #3 970 410e 8d 4b 01 STA player_aniframe 971 4111 . 972 4111 ;; 973 4111 974 4111 .L076 ;; if ( gen_frame & 1 ) then joydone 975 4111 976 4111 ; complex statement detected 977 4111 ad 4d 01 LDA gen_frame 978 4114 29 01 AND #1 979 4116 if ((* - .joydone) < 127) && ((* - .joydone) > -128) 980 4116 d0 39 BNE .joydone 981 4118 - else 982 4118 - beq .0skipjoydone 983 4118 - jmp .joydone 984 4118 -.0skipjoydone 985 4118 endif 986 4118 .skipL076 987 4118 .condpart3 988 4118 .skipL076 989 4118 .L077 ;; if joy0left then player_moving = 1 : player_dir = 0 : player_x = player_x - 1 : goto joydone 990 4118 991 4118 2c 80 02 bit SWCHA 992 411b 70 16 BVS .skipL077 993 411d .condpart4 994 411d a9 01 LDA #1 995 411f 8d 49 01 STA player_moving 996 4122 a9 00 LDA #0 997 4124 8d 4a 01 STA player_dir 998 4127 ad 41 01 LDA player_x 999 412a 38 SEC 1000 412b e9 01 SBC #1 1001 412d 8d 41 01 STA player_x 1002 4130 4c 51 41 jmp .joydone 1003 4133 1004 4133 .skipL077 1005 4133 .L078 ;; if joy0right then player_moving = 1 : player_dir = 1 : player_x = player_x + 1 : goto joydone 1006 4133 1007 4133 2c 80 02 bit SWCHA 1008 4136 30 14 BMI .skipL078 1009 4138 .condpart5 1010 4138 a9 01 LDA #1 1011 413a 8d 49 01 STA player_moving 1012 413d 8d 4a 01 STA player_dir 1013 4140 ad 41 01 LDA player_x 1014 4143 18 CLC 1015 4144 69 01 ADC #1 1016 4146 8d 41 01 STA player_x 1017 4149 4c 51 41 jmp .joydone 1018 414c 1019 414c .skipL078 1020 414c .L079 ;; player_aniframe = 0 1021 414c 1022 414c a9 00 LDA #0 1023 414e 8d 4b 01 STA player_aniframe 1024 4151 .joydone 1025 4151 ;; joydone 1026 4151 1027 4151 .L080 ;; pTemp1 = ( player_x + 4 ) / 8 1028 4151 1029 4151 ; complex statement detected 1030 4151 ad 41 01 LDA player_x 1031 4154 18 CLC 1032 4155 69 04 ADC #4 1033 4157 4a lsr 1034 4158 4a lsr 1035 4159 4a lsr 1036 415a 8d 4e 01 STA pTemp1 1037 415d .L081 ;; pTemp2 = player_y / 8 1038 415d 1039 415d ad 42 01 LDA player_y 1040 4160 4a lsr 1041 4161 4a lsr 1042 4162 4a lsr 1043 4163 8d 4f 01 STA pTemp2 1044 4166 .L082 ;; pTemp2 = pTemp2 + 1 1045 4166 1046 4166 ad 4f 01 LDA pTemp2 1047 4169 18 CLC 1048 416a 69 01 ADC #1 1049 416c 8d 4f 01 STA pTemp2 1050 416f .L083 ;; player_moving = 0 1051 416f 1052 416f a9 00 LDA #0 1053 4171 8d 49 01 STA player_moving 1054 4174 . 1055 4174 ;; 1056 4174 1057 4174 .L084 ;; if pTemp1 > 19 || pTemp2 > 23 then goto falling 1058 4174 1059 4174 a9 13 LDA #19 1060 4176 cd 4e 01 CMP pTemp1 1061 4179 b0 03 BCS .skipL084 1062 417b .condpart6 1063 417b 4c 85 41 jmp .condpart7 1064 417e .skipL084 1065 417e a9 17 LDA #23 1066 4180 cd 4f 01 CMP pTemp2 1067 4183 b0 03 BCS .skip0OR 1068 4185 .condpart7 1069 4185 4c d3 41 jmp .falling 1070 4188 1071 4188 .skip0OR 1072 4188 . 1073 4188 ;; 1074 4188 1075 4188 .L085 ;; playerChar = peekchar ( screendata , pTemp1 , pTemp2 , 20 , 24 ) 1076 4188 1077 4188 ac 4f 01 ldy pTemp2 1078 418b b9 76 ef lda screendata_mult_lo,y 1079 418e 85 42 sta temp1 1080 4190 b9 8e ef lda screendata_mult_hi,y 1081 4193 85 43 sta temp2 1082 4195 ac 4e 01 ldy pTemp1 1083 4198 b1 42 lda (temp1),y 1084 419a 8d 4c 01 STA playerChar 1085 419d .L086 ;; if playerChar > 0 then goto done_falling 1086 419d 1087 419d a9 00 LDA #0 1088 419f cd 4c 01 CMP playerChar 1089 41a2 b0 03 BCS .skipL086 1090 41a4 .condpart8 1091 41a4 4c dc 41 jmp .done_falling 1092 41a7 1093 41a7 .skipL086 1094 41a7 . 1095 41a7 ;; 1096 41a7 1097 41a7 .player_jump 1098 41a7 ;; player_jump 1099 41a7 1100 41a7 .L087 ;; if joy0fire then player_y = player_y - 1 1101 41a7 1102 41a7 2c 02 21 bit sINPT1 1103 41aa 10 09 BPL .skipL087 1104 41ac .condpart9 1105 41ac ad 42 01 LDA player_y 1106 41af 38 SEC 1107 41b0 e9 01 SBC #1 1108 41b2 8d 42 01 STA player_y 1109 41b5 .skipL087 1110 41b5 .L088 ;; if !joy0fire then button1_Debounce = 0 : button2_Debounce = 0 1111 41b5 1112 41b5 2c 02 21 bit sINPT1 1113 41b8 30 08 BMI .skipL088 1114 41ba .condpart10 1115 41ba a9 00 LDA #0 1116 41bc 8d 47 01 STA button1_Debounce 1117 41bf 8d 48 01 STA button2_Debounce 1118 41c2 .skipL088 1119 41c2 .L089 ;; if button1_Debounce = 0 && button2_Debounce = 0 then goto falling 1120 41c2 1121 41c2 ad 47 01 LDA button1_Debounce 1122 41c5 c9 00 CMP #0 1123 41c7 d0 0a BNE .skipL089 1124 41c9 .condpart11 1125 41c9 ad 48 01 LDA button2_Debounce 1126 41cc c9 00 CMP #0 1127 41ce d0 03 BNE .skip11then 1128 41d0 .condpart12 1129 41d0 4c d3 41 jmp .falling 1130 41d3 1131 41d3 .skip11then 1132 41d3 .skipL089 1133 41d3 . 1134 41d3 ;; 1135 41d3 1136 41d3 .falling 1137 41d3 ;; falling 1138 41d3 1139 41d3 .L090 ;; player_y = player_y + 1 1140 41d3 1141 41d3 ad 42 01 LDA player_y 1142 41d6 18 CLC 1143 41d7 69 01 ADC #1 1144 41d9 8d 42 01 STA player_y 1145 41dc .done_falling 1146 41dc ;; done_falling 1147 41dc 1148 41dc . 1149 41dc ;; 1150 41dc 1151 41dc .L091 ;; gosub draw_sprites 1152 41dc 1153 41dc 20 a1 42 jsr .draw_sprites 1154 41df 1155 41df .L092 ;; gosub check_collisions 1156 41df 1157 41df 20 05 43 jsr .check_collisions 1158 41e2 1159 41e2 .L093 ;; drawscreen 1160 41e2 1161 41e2 20 b3 f0 jsr drawscreen 1162 41e5 .L094 ;; goto main 1163 41e5 1164 41e5 4c ce 40 jmp .main 1165 41e8 1166 41e8 . 1167 41e8 ;; 1168 41e8 1169 41e8 .titlescreen 1170 41e8 ;; titlescreen 1171 41e8 1172 41e8 .L095 ;; characterset platformer_test_fontCS 1173 41e8 1174 41e8 a9 e0 lda #>platformer_test_fontCS 1175 41ea 8d 0b 21 sta sCHARBASE 1176 41ed 1177 41ed 85 34 sta CHARBASE 1178 41ef a9 60 lda #(platformer_test_fontCS_mode | %01100000) 1179 41f1 8d 06 21 sta charactermode 1180 41f4 1181 41f4 .L096 ;; alphachars '0123456789 .,?!:;`abcdefghijklmnopqrstuvwxyz@#$%^&*()/-_=+' 1182 41f4 1183 41f4 .L097 ;; plotchars 'platformer^demo^by' 0 38 2 1184 41f4 1185 41f4 4c 09 42 JMP skipalphadata0 1186 41f7 alphadata0 1187 41f7 59 .byte.b (alphadata0 1210 420f 85 43 sta temp2 1211 4211 1212 4211 a9 0e lda #14 ; width in two's complement 1213 4213 09 00 ora #0 ; palette left shifted 5 bits 1214 4215 85 44 sta temp3 1215 4217 a9 26 lda #38 1216 4219 85 45 sta temp4 1217 421b 1218 421b a9 02 lda #2 1219 421d 1220 421d 85 46 sta temp5 1221 421f 1222 421f 20 4d f3 jsr plotcharacters 1223 4222 .L098 ;; plotchars 'shane^skekel.' 0 48 4 1224 4222 1225 4222 4c 32 42 JMP skipalphadata1 1226 4225 alphadata1 1227 4225 5c .byte.b (alphadata1 1245 4238 85 43 sta temp2 1246 423a 1247 423a a9 13 lda #19 ; width in two's complement 1248 423c 09 00 ora #0 ; palette left shifted 5 bits 1249 423e 85 44 sta temp3 1250 4240 a9 30 lda #48 1251 4242 85 45 sta temp4 1252 4244 1253 4244 a9 04 lda #4 1254 4246 1255 4246 85 46 sta temp5 1256 4248 1257 4248 20 4d f3 jsr plotcharacters 1258 424b .L099 ;; plotchars 'press^fire!' 1 56 8 1259 424b 1260 424b 4c 59 42 JMP skipalphadata2 1261 424e alphadata2 1262 424e 59 .byte.b (alphadata2 1278 425f 85 43 sta temp2 1279 4261 1280 4261 a9 15 lda #21 ; width in two's complement 1281 4263 09 20 ora #32 ; palette left shifted 5 bits 1282 4265 85 44 sta temp3 1283 4267 a9 38 lda #56 1284 4269 85 45 sta temp4 1285 426b 1286 426b a9 08 lda #8 1287 426d 1288 426d 85 46 sta temp5 1289 426f 1290 426f 20 4d f3 jsr plotcharacters 1291 4272 .L0100 ;; savescreen 1292 4272 1293 4272 20 a3 f0 jsr savescreen 1294 4275 .L0101 ;; drawscreen 1295 4275 1296 4275 20 b3 f0 jsr drawscreen 1297 4278 . 1298 4278 ;; 1299 4278 1300 4278 . 1301 4278 ;; 1302 4278 1303 4278 .titlescreenloop 1304 4278 ;; titlescreenloop 1305 4278 1306 4278 .L0102 ;; restorescreen 1307 4278 1308 4278 20 91 f0 jsr restorescreen 1309 427b .L0103 ;; if switchreset then reboot 1310 427b 1311 427b 20 31 f4 jsr checkresetswitch 1312 427e d0 03 BNE .skipL0103 1313 4280 .condpart13 1314 4280 4c 1e f5 JMP START 1315 4283 .skipL0103 1316 4283 .L0104 ;; if joy0fire then clearscreen : savescreen : goto main 1317 4283 1318 4283 2c 02 21 bit sINPT1 1319 4286 10 09 BPL .skipL0104 1320 4288 .condpart14 1321 4288 20 7f f0 jsr clearscreen 1322 428b 20 a3 f0 jsr savescreen 1323 428e 4c ce 40 jmp .main 1324 4291 1325 4291 .skipL0104 1326 4291 .L0105 ;; if !joy0fire then button1_Debounce = 0 : button2_Debounce = 0 1327 4291 1328 4291 2c 02 21 bit sINPT1 1329 4294 30 08 BMI .skipL0105 1330 4296 .condpart15 1331 4296 a9 00 LDA #0 1332 4298 8d 47 01 STA button1_Debounce 1333 429b 8d 48 01 STA button2_Debounce 1334 429e .skipL0105 1335 429e .L0106 ;; goto titlescreenloop 1336 429e 1337 429e 4c 78 42 jmp .titlescreenloop 1338 42a1 1339 42a1 . 1340 42a1 ;; 1341 42a1 1342 42a1 . 1343 42a1 ;; 1344 42a1 1345 42a1 .draw_sprites 1346 42a1 ;; draw_sprites 1347 42a1 1348 42a1 .L0107 ;; pTemp1 = player_dir + player_aniframe 1349 42a1 1350 42a1 ad 4a 01 LDA player_dir 1351 42a4 18 CLC 1352 42a5 6d 4b 01 ADC player_aniframe 1353 42a8 8d 4e 01 STA pTemp1 1354 42ab .L0108 ;; plotsprite platformer_test_sprite0 0 player_x player_y pTemp1 1355 42ab 1356 42ab a9 14 lda #platformer_test_sprite0 1368 42bc 85 43 sta temp2 1369 42be 1370 42be a9 1c lda #(0|platformer_test_sprite0_width_twoscompliment) 1371 42c0 85 44 sta temp3 1372 42c2 1373 42c2 ad 41 01 lda player_x 1374 42c5 85 45 sta temp4 1375 42c7 1376 42c7 ad 42 01 lda player_y 1377 42ca 85 46 sta temp5 1378 42cc 1379 42cc a9 c0 lda #(platformer_test_sprite0_mode|%01000000) 1380 42ce 85 47 sta temp6 1381 42d0 1382 42d0 20 93 f2 jsr plotsprite 1383 42d3 .L0109 ;; pTemp2 = player_y - 8 1384 42d3 1385 42d3 ad 42 01 LDA player_y 1386 42d6 38 SEC 1387 42d7 e9 08 SBC #8 1388 42d9 8d 4f 01 STA pTemp2 1389 42dc . 1390 42dc ;; 1391 42dc 1392 42dc .L0110 ;; plotsprite platformer_test_item_0 1 item_xpos item_ypos item_aniframe 1393 42dc 1394 42dc a9 72 lda #platformer_test_item_0 1406 42ed 85 43 sta temp2 1407 42ef 1408 42ef a9 3f lda #(32|platformer_test_item_0_width_twoscompliment) 1409 42f1 85 44 sta temp3 1410 42f3 1411 42f3 ad 52 01 lda item_xpos 1412 42f6 85 45 sta temp4 1413 42f8 1414 42f8 ad 53 01 lda item_ypos 1415 42fb 85 46 sta temp5 1416 42fd 1417 42fd a9 40 lda #(platformer_test_item_0_mode|%01000000) 1418 42ff 85 47 sta temp6 1419 4301 1420 4301 20 93 f2 jsr plotsprite 1421 4304 .L0111 ;; return 1422 4304 1423 4304 60 RTS 1424 4305 . 1425 4305 ;; 1426 4305 1427 4305 .check_collisions 1428 4305 ;; check_collisions 1429 4305 1430 4305 .L0112 ;; if boxcollision ( player_x , player_y , 8 , 16 , item_xpos , item_ypos , 4 , 8 ) then item_xpos = 200 : item_ypos = 224 : item_isgotten = 1 : goto _checkCollisionsExit 1431 4305 1432 4305 1433 4305 18 clc ; one clc only. If we overflow we're screwed anyway. 1434 4306 a0 07 ldy #(8-1) 1435 4308 84 44 sty temp3 1436 430a a0 0f ldy #(16-1) 1437 430c 84 45 sty temp4 1438 430e ad 52 01 lda item_xpos 1439 4311 69 30 adc #48 1440 4313 85 46 sta temp5 1441 4315 ad 53 01 lda item_ypos 1442 4318 69 20 adc #((256-WSCREENHEIGHT)/2) 1443 431a 85 47 sta temp6 1444 431c a0 03 ldy #(4-1) 1445 431e 84 48 sty temp7 1446 4320 a0 07 ldy #(8-1) 1447 4322 84 49 sty temp8 1448 4324 ad 42 01 lda player_y 1449 4327 69 20 adc #((256-WSCREENHEIGHT)/2) 1450 4329 a8 tay 1451 432a ad 41 01 lda player_x 1452 432d 69 30 adc #48 1453 432f 20 82 f3 jsr boxcollision 1454 4332 1455 4332 90 12 BCC .skipL0112 1456 4334 .condpart16 1457 4334 a9 c8 LDA #200 1458 4336 8d 52 01 STA item_xpos 1459 4339 a9 e0 LDA #224 1460 433b 8d 53 01 STA item_ypos 1461 433e a9 01 LDA #1 1462 4340 8d 51 01 STA item_isgotten 1463 4343 4c 46 43 jmp ._checkCollisionsExit 1464 4346 1465 4346 .skipL0112 1466 4346 ._checkCollisionsExit 1467 4346 ;; _checkCollisionsExit 1468 4346 1469 4346 .L0113 ;; return 1470 4346 1471 4346 60 RTS 1472 4347 . 1473 4347 ;; 1474 4347 1475 4347 .initialise_gamescreen 1476 4347 ;; initialise_gamescreen 1477 4347 1478 4347 .L0114 ;; clearscreen 1479 4347 1480 4347 20 7f f0 jsr clearscreen 1481 434a . 1482 434a ;; 1483 434a 1484 434a .L0115 ;; characterset platformer_test_tiles_ramchar 1485 434a 1486 434a a9 e0 lda #>platformer_test_tiles_ramchar 1487 434c 8d 0b 21 sta sCHARBASE 1488 434f 1489 434f 85 34 sta CHARBASE 1490 4351 a9 60 lda #(platformer_test_tiles_ramchar_mode | %01100000) 1491 4353 8d 06 21 sta charactermode 1492 4356 1493 4356 .L0116 ;; plotmap screendata 0 0 0 20 16 1494 4356 1495 4356 a9 0c lda #12 ; width in two's complement 1496 4358 85 44 sta temp3 1497 435a 09 00 ora #0 ; palette left shifted 5 bits 1498 435c 85 44 sta temp3 1499 435e a9 00 lda #0 1500 4360 85 45 sta temp4 1501 4362 1502 4362 a9 00 lda #0 1503 4364 85 46 sta temp5 1504 4366 1505 4366 a9 10 lda #16 1506 4368 1507 4368 85 47 sta temp6 1508 436a a9 00 lda #screendata 1512 4370 85 43 sta temp2 1513 4372 1514 4372 plotcharactersloop5 1515 4372 20 4d f3 jsr plotcharacters 1516 4375 18 clc 1517 4376 a9 14 lda #20 1518 4378 65 42 adc temp1 1519 437a 85 42 sta temp1 1520 437c a9 00 lda #0 1521 437e 65 43 adc temp2 1522 4380 85 43 sta temp2 1523 4382 e6 46 inc temp5 1524 4384 c6 47 dec temp6 1525 4386 d0 ea bne plotcharactersloop5 1526 4388 .L0117 ;; savescreen 1527 4388 1528 4388 20 a3 f0 jsr savescreen 1529 438b .L0118 ;; return 1530 438b 1531 438b 60 RTS 1532 438c . 1533 438c ;; 1534 438c 1535 438c .next_level 1536 438c ;; next_level 1537 438c 1538 438c .L0119 ;; if item_isgotten = 0 then level = level + 1 : gosub load_level 1539 438c 1540 438c ad 51 01 LDA item_isgotten 1541 438f c9 00 CMP #0 1542 4391 d0 0c BNE .skipL0119 1543 4393 .condpart17 1544 4393 ad 50 01 LDA level 1545 4396 18 CLC 1546 4397 69 01 ADC #1 1547 4399 8d 50 01 STA level 1548 439c 20 9f 43 jsr .load_level 1549 439f 1550 439f .skipL0119 1551 439f . 1552 439f ;; 1553 439f 1554 439f .load_level 1555 439f ;; load_level 1556 439f 1557 439f .L0120 ;; player_x = 40 1558 439f 1559 439f a9 28 LDA #40 1560 43a1 8d 41 01 STA player_x 1561 43a4 .L0121 ;; player_y = 3 1562 43a4 1563 43a4 a9 03 LDA #3 1564 43a6 8d 42 01 STA player_y 1565 43a9 .L0122 ;; item_xpos = 80 1566 43a9 1567 43a9 a9 50 LDA #80 1568 43ab 8d 52 01 STA item_xpos 1569 43ae .L0123 ;; item_ypos = 1 1570 43ae 1571 43ae a9 01 LDA #1 1572 43b0 8d 53 01 STA item_ypos 1573 43b3 . 1574 43b3 ;; 1575 43b3 1576 43b3 .L0124 ;; level = level & 3 1577 43b3 1578 43b3 ad 50 01 LDA level 1579 43b6 29 03 AND #3 1580 43b8 8d 50 01 STA level 1581 43bb .L0125 ;; if level = 0 then memcpy screendata level1 480 1582 43bb 1583 43bb ad 50 01 LDA level 1584 43be c9 00 CMP #0 1585 43c0 d0 21 BNE .skipL0125 1586 43c2 .condpart18 1587 43c2 a0 00 ldy #0 1588 43c4 memcpyloop6 1589 43c4 b9 5f 44 lda level1+0,y 1590 43c7 99 00 22 sta screendata+0,y 1591 43ca 88 dey 1592 43cb d0 f7 bne memcpyloop6 1593 43cd a0 e0 ldy #224 1594 43cf memcpyloop7 1595 43cf b9 5e 45 lda level1-1+256,y 1596 43d2 99 ff 22 sta screendata-1+256,y 1597 43d5 88 dey 1598 43d6 d0 f7 bne memcpyloop7 1599 43d8 a0 e0 ldy #224 1600 43da memcpyloop8 1601 43da b9 5e 44 lda level1-1,y 1602 43dd 99 ff 21 sta screendata-1,y 1603 43e0 88 dey 1604 43e1 d0 f7 bne memcpyloop8 1605 43e3 .skipL0125 1606 43e3 .L0126 ;; if level = 1 then memcpy screendata level2 480 1607 43e3 1608 43e3 ad 50 01 LDA level 1609 43e6 c9 01 CMP #1 1610 43e8 d0 21 BNE .skipL0126 1611 43ea .condpart19 1612 43ea a0 00 ldy #0 1613 43ec memcpyloop9 1614 43ec b9 e2 46 lda level2+0,y 1615 43ef 99 00 22 sta screendata+0,y 1616 43f2 88 dey 1617 43f3 d0 f7 bne memcpyloop9 1618 43f5 a0 e0 ldy #224 1619 43f7 memcpyloop10 1620 43f7 b9 e1 47 lda level2-1+256,y 1621 43fa 99 ff 22 sta screendata-1+256,y 1622 43fd 88 dey 1623 43fe d0 f7 bne memcpyloop10 1624 4400 a0 e0 ldy #224 1625 4402 memcpyloop11 1626 4402 b9 e1 46 lda level2-1,y 1627 4405 99 ff 21 sta screendata-1,y 1628 4408 88 dey 1629 4409 d0 f7 bne memcpyloop11 1630 440b .skipL0126 1631 440b .L0127 ;; if level = 2 then memcpy screendata level3 480 1632 440b 1633 440b ad 50 01 LDA level 1634 440e c9 02 CMP #2 1635 4410 d0 21 BNE .skipL0127 1636 4412 .condpart20 1637 4412 a0 00 ldy #0 1638 4414 memcpyloop12 1639 4414 b9 65 49 lda level3+0,y 1640 4417 99 00 22 sta screendata+0,y 1641 441a 88 dey 1642 441b d0 f7 bne memcpyloop12 1643 441d a0 e0 ldy #224 1644 441f memcpyloop13 1645 441f b9 64 4a lda level3-1+256,y 1646 4422 99 ff 22 sta screendata-1+256,y 1647 4425 88 dey 1648 4426 d0 f7 bne memcpyloop13 1649 4428 a0 e0 ldy #224 1650 442a memcpyloop14 1651 442a b9 64 49 lda level3-1,y 1652 442d 99 ff 21 sta screendata-1,y 1653 4430 88 dey 1654 4431 d0 f7 bne memcpyloop14 1655 4433 .skipL0127 1656 4433 .L0128 ;; if level = 3 then memcpy screendata level4 480 1657 4433 1658 4433 ad 50 01 LDA level 1659 4436 c9 03 CMP #3 1660 4438 d0 21 BNE .skipL0128 1661 443a .condpart21 1662 443a a0 00 ldy #0 1663 443c memcpyloop15 1664 443c b9 e8 4b lda level4+0,y 1665 443f 99 00 22 sta screendata+0,y 1666 4442 88 dey 1667 4443 d0 f7 bne memcpyloop15 1668 4445 a0 e0 ldy #224 1669 4447 memcpyloop16 1670 4447 b9 e7 4c lda level4-1+256,y 1671 444a 99 ff 22 sta screendata-1+256,y 1672 444d 88 dey 1673 444e d0 f7 bne memcpyloop16 1674 4450 a0 e0 ldy #224 1675 4452 memcpyloop17 1676 4452 b9 e7 4b lda level4-1,y 1677 4455 99 ff 21 sta screendata-1,y 1678 4458 88 dey 1679 4459 d0 f7 bne memcpyloop17 1680 445b .skipL0128 1681 445b .L0129 ;; return 1682 445b 1683 445b 60 RTS 1684 445c . 1685 445c ;; 1686 445c 1687 445c .L0130 ;; alphachars ' abcdefghi' 1688 445c 1689 445c . 1690 445c ;; 1691 445c 1692 445c .L0131 ;; alphadata level1 platformer_test_tiles_ramchar extrawide; 20x16 1693 445c 1694 445c 4c df 46 JMP .skipL0131 1695 445f level1 1696 445f 00 01 .byte.b ((screendata+0) 3579 ef8f 22 .byte.b >(screendata+20) 3580 ef90 22 .byte.b >(screendata+40) 3581 ef91 22 .byte.b >(screendata+60) 3582 ef92 22 .byte.b >(screendata+80) 3583 ef93 22 .byte.b >(screendata+100) 3584 ef94 22 .byte.b >(screendata+120) 3585 ef95 22 .byte.b >(screendata+140) 3586 ef96 22 .byte.b >(screendata+160) 3587 ef97 22 .byte.b >(screendata+180) 3588 ef98 22 .byte.b >(screendata+200) 3589 ef99 22 .byte.b >(screendata+220) 3590 ef9a 22 .byte.b >(screendata+240) 3591 ef9b 23 .byte.b >(screendata+260) 3592 ef9c 23 .byte.b >(screendata+280) 3593 ef9d 23 .byte.b >(screendata+300) 3594 ef9e 23 .byte.b >(screendata+320) 3595 ef9f 23 .byte.b >(screendata+340) 3596 efa0 23 .byte.b >(screendata+360) 3597 efa1 23 .byte.b >(screendata+380) 3598 efa2 23 .byte.b >(screendata+400) 3599 efa3 23 .byte.b >(screendata+420) 3600 efa4 23 .byte.b >(screendata+440) 3601 efa5 23 .byte.b >(screendata+460) 3602 efa6 - if SPACEOVERFLOW > 0 3603 efa6 - echo "" 3604 efa6 - echo "######## ERROR: space overflow detected in",[SPACEOVERFLOW]d,"areas." 3605 efa6 - echo "######## look above for areas with negative ROM space left." 3606 efa6 - echo "######## Aborting assembly." 3607 efa6 - ERR 3608 efa6 endif 3609 efa6 3610 efa6 3611 efa6 ; Provided under the CC0 license. See the included LICENSE.txt for details. 3612 efa6 3613 efa6 ifnconst bankswitchmode 3614 efa6 if ( * < $f000 ) 3615 f000 ORG $F000 3616 f000 endif 3617 f000 - else 3618 f000 - ifconst ROM128K 3619 f000 - if ( * < $f000 ) 3620 f000 - ORG $27000 3621 f000 - RORG $F000 3622 f000 - endif 3623 f000 - endif 3624 f000 - ifconst ROM144K 3625 f000 - if ( * < $f000 ) 3626 f000 - ORG $27000 3627 f000 - RORG $F000 3628 f000 - endif 3629 f000 - endif 3630 f000 - ifconst ROM256K 3631 f000 - if ( * < $f000 ) 3632 f000 - ORG $47000 3633 f000 - RORG $F000 3634 f000 - endif 3635 f000 - endif 3636 f000 - ifconst ROM272K 3637 f000 - if ( * < $f000 ) 3638 f000 - ORG $47000 3639 f000 - RORG $F000 3640 f000 - endif 3641 f000 - endif 3642 f000 - ifconst ROM512K 3643 f000 - if ( * < $f000 ) 3644 f000 - ORG $87000 3645 f000 - RORG $F000 3646 f000 - endif 3647 f000 - endif 3648 f000 - ifconst ROM528K 3649 f000 - if ( * < $f000 ) 3650 f000 - ORG $87000 3651 f000 - RORG $F000 3652 f000 - endif 3653 f000 - endif 3654 f000 endif 3655 f000 3656 f000 ; all of these "modules" have conditional clauses in them, so even though 3657 f000 ; they're always included here, they don't take up rom unless the user 3658 f000 ; explicitly enables support for the feature. 3659 f000 3660 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\platformer_demos\template\platformer_demo_v01.78b.asm 3662 f000 endif 3663 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\platformer_demos\template\platformer_demo_v01.78b.asm 3665 f000 endif 3666 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\platformer_demos\template\platformer_demo_v01.78b.asm 3668 f000 endif 3669 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\platformer_demos\template\platformer_demo_v01.78b.asm 3671 f000 endif 3672 f000 ; Provided under the CC0 license. See the included LICENSE.txt for details. 3673 f000 3674 f000 ;standard routimes needed for pretty much all games 3675 f000 3676 f000 ; some definitions used with "set debug color" 3677 f000 00 91 DEBUGCALC = $91 3678 f000 00 41 DEBUGWASTE = $41 3679 f000 00 c1 DEBUGDRAW = $C1 3680 f000 3681 f000 ;NMI and IRQ handlers 3682 f000 NMI 3683 f000 ;VISIBLEOVER is 255 while the screen is drawn, and 0 right after the visible screen is done. 3684 f000 48 pha ; save A 3685 f001 d8 cld 3686 f002 a5 4d lda visibleover 3687 f004 49 ff eor #255 3688 f006 85 4d sta visibleover 3689 f008 - ifconst DEBUGINTERRUPT 3690 f008 - and #$93 3691 f008 - sta BACKGRND 3692 f008 endif 3693 f008 8a txa ; save X 3694 f009 48 pha 3695 f00a 98 tya ; save Y 3696 f00b 48 pha 3697 f00c ce b2 01 dec interruptindex 3698 f00f d0 03 bne skipreallyoffvisible 3699 f011 4c 6b f0 jmp reallyoffvisible 3700 f014 skipreallyoffvisible 3701 f014 a5 4d lda visibleover 3702 f016 d0 03 bne carryontopscreenroutine 3703 f018 - ifconst .bottomscreenroutine 3704 f018 - lda interrupthold 3705 f018 - beq skipbottomroutine 3706 f018 - jsr .bottomscreenroutine 3707 f018 -skipbottomroutine 3708 f018 endif 3709 f018 4c 79 f0 jmp NMIexit 3710 f01b carryontopscreenroutine 3711 f01b - ifconst .topscreenroutine 3712 f01b - lda interrupthold 3713 f01b - beq skiptoproutine 3714 f01b - jsr .topscreenroutine 3715 f01b -skiptoproutine 3716 f01b endif 3717 f01b ifnconst CANARYOFF 3718 f01b ad c1 01 lda canary 3719 f01e f0 07 beq skipcanarytriggered 3720 f020 a9 45 lda #$45 3721 f022 85 20 sta BACKGRND 3722 f024 4c 63 f0 jmp skipbrkolorset ; common crash dump routine, if available 3723 f027 skipcanarytriggered 3724 f027 endif 3725 f027 3726 f027 ee 3e 21 inc frameslost ; this is balanced with a "dec frameslost" when drawscreen is called. 3727 f02a 3728 f02a ; ** Other important routines that need to regularly run, and can run onscreen. 3729 f02a ; ** Atarivox can't go here, because Maria might interrupt it while it's bit-banging. 3730 f02a 3731 f02a - ifconst LONGCONTROLLERREAD 3732 f02a -longcontrollerreads ; ** controllers that take a lot of time to read. We use much of the visible screen here. 3733 f02a - ldy port1control 3734 f02a - lda longreadtype,y 3735 f02a - beq LLRET1 3736 f02a - tay 3737 f02a - lda longreadroutinehiP1,y 3738 f02a - sta inttemp4 3739 f02a - lda longreadroutineloP1,y 3740 f02a - sta inttemp3 3741 f02a - jmp (inttemp3) 3742 f02a -LLRET1 3743 f02a - ldy port0control 3744 f02a - lda longreadtype,y 3745 f02a - beq LLRET0 3746 f02a - tay 3747 f02a - lda longreadroutinehiP0,y 3748 f02a - sta inttemp4 3749 f02a - lda longreadroutineloP0,y 3750 f02a - sta inttemp3 3751 f02a - jmp (inttemp3) 3752 f02a -LLRET0 3753 f02a - 3754 f02a - 3755 f02a - ifconst PADDLERANGE 3756 f02a -TIMEVAL = PADDLERANGE 3757 f02a - else 3758 f02a -TIMEVAL = 160 3759 f02a - endif 3760 f02a -TIMEOFFSET = 10 3761 f02a - 3762 f02a endif ; LONGCONTROLLERREAD 3763 f02a 3764 f02a 3765 f02a 20 d8 f1 jsr servicesfxchannels 3766 f02d - ifconst MUSICTRACKER 3767 f02d - jsr servicesong 3768 f02d endif ; MUSICTRACKER 3769 f02d 3770 f02d ee a4 01 inc framecounter 3771 f030 ad a4 01 lda framecounter 3772 f033 29 3f and #63 3773 f035 d0 08 bne skipcountdownseconds 3774 f037 ad a5 01 lda countdownseconds 3775 f03a f0 03 beq skipcountdownseconds 3776 f03c ce a5 01 dec countdownseconds 3777 f03f skipcountdownseconds 3778 f03f 3779 f03f a2 01 ldx #1 3780 f041 buttonreadloop 3781 f041 8a txa 3782 f042 48 pha 3783 f043 bc b7 01 ldy port0control,x 3784 f046 b9 bb f1 lda buttonhandlerlo,y 3785 f049 85 da sta inttemp3 3786 f04b b9 b0 f1 lda buttonhandlerhi,y 3787 f04e 85 db sta inttemp4 3788 f050 05 da ora inttemp3 3789 f052 f0 03 beq buttonreadloopreturn 3790 f054 6c da 00 jmp (inttemp3) 3791 f057 buttonreadloopreturn 3792 f057 68 pla 3793 f058 aa tax 3794 f059 ca dex 3795 f05a 10 e5 bpl buttonreadloop 3796 f05c 3797 f05c - ifconst KEYPADSUPPORT 3798 f05c - jsr keypadrowselect 3799 f05c endif ; KEYPADSUPPORT 3800 f05c 3801 f05c 3802 f05c - ifconst DOUBLEBUFFER 3803 f05c - lda doublebufferminimumframeindex 3804 f05c - beq skipdoublebufferminimumframeindexadjust 3805 f05c - dec doublebufferminimumframeindex 3806 f05c -skipdoublebufferminimumframeindexadjust 3807 f05c endif 3808 f05c 3809 f05c 4c 79 f0 jmp NMIexit 3810 f05f 3811 f05f IRQ ; the only source of non-nmi interrupt should be the BRK opcode. 3812 f05f ifnconst BREAKPROTECTOFF 3813 f05f a9 1a lda #$1A 3814 f061 85 20 sta BACKGRND 3815 f063 skipbrkolorset 3816 f063 skipbrkdetected 3817 f063 a9 60 lda #$60 3818 f065 8d 07 21 sta sCTRL 3819 f068 85 3c sta CTRL 3820 f06a ifnconst hiscorefont 3821 f06a 02 .byte.b $02 ; KIL/JAM 3822 f06b - else ; hiscorefont is present 3823 f06b - ifconst CRASHDUMP 3824 f06b - bit MSTAT 3825 f06b - bpl skipbrkdetected ; wait for vblank to ensure we're clear of NMI 3826 f06b - 3827 f06b - ifconst dumpbankswitch 3828 f06b - lda dumpbankswitch 3829 f06b - pha 3830 f06b - endif 3831 f06b - 3832 f06b - ; bankswitch if needed, to get to the hiscore font 3833 f06b - ifconst bankswitchmode 3834 f06b - ifconst included.hiscore.asm.bank 3835 f06b - ifconst MCPDEVCART 3836 f06b - lda #($18 | included.hiscore.asm.bank) 3837 f06b - sta $3000 3838 f06b - else 3839 f06b - lda #(included.hiscore.asm.bank) 3840 f06b - sta $8000 3841 f06b - endif 3842 f06b - endif ; included.hiscore.asm.bank 3843 f06b - endif ; bankswitchmode 3844 f06b - 3845 f06b - ifconst DOUBLEBUFFER 3846 f06b - ;turn off double-buffering, if on... 3847 f06b - lda #>DLLMEM 3848 f06b - sta DPPH 3849 f06b - lda #hiscorefont 3893 f06b - sta CHARBASE 3894 f06b - sta sCHARBASE 3895 f06b - lda #%01000011 ;Enable DMA, mode=320A 3896 f06b - sta CTRL 3897 f06b - sta sCTRL 3898 f06b - .byte $02 ; KIL/JAM 3899 f06b -hiscorehexlut 3900 f06b - ; 0 1 2 3 4 5 6 7 8 9 A B C D E F 3901 f06b - .byte 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 0, 1, 2, 3, 4, 5 3902 f06b -show2700 3903 f06b - ; lo mode hi width=29 x EODL 3904 f06b - .byte $00, %01100000, $27, 3, 20, 0,0,0 3905 f06b - else ; CRASHDUMP 3906 f06b - .byte $02 ; KIL/JAM 3907 f06b - endif ; crashdump 3908 f06b endif ; hiscorefont 3909 f06b - else 3910 f06b - RTI 3911 f06b endif 3912 f06b 3913 f06b - ifconst LONGCONTROLLERREAD 3914 f06b - 3915 f06b -longreadtype 3916 f06b - .byte 0, 0, 0, 1 ; NONE PROLINE LIGHTGUN PADDLE 3917 f06b - .byte 2, 0, 3, 0 ; TRKBALL VCSSTICK DRIVING KEYPAD 3918 f06b - .byte 3, 3, 0 ; STMOUSE AMOUSE ATARIVOX 3919 f06b - 3920 f06b -longreadroutineloP0 3921 f06b - .byte LLRET0 ; 0 = no routine 3928 f06b - .byte >paddleport0update ; 1 = paddle 3929 f06b - .byte >trakball0update ; 2 = trackball 3930 f06b - .byte >mouse0update ; 3 = mouse 3931 f06b - 3932 f06b -longreadroutineloP1 3933 f06b - .byte LLRET1 ; 0 = no routine 3940 f06b - .byte >paddleport1update ; 1 = paddle 3941 f06b - .byte >trakball1update ; 2 = trackball 3942 f06b - .byte >mouse1update ; 3 = mouse 3943 f06b - 3944 f06b - 3945 f06b -SETTIM64T 3946 f06b - bne skipdefaulttime 3947 f06b - ifnconst PADDLESMOOTHINGOFF 3948 f06b - lda #(TIMEVAL+TIMEOFFSET+1) 3949 f06b - else 3950 f06b - lda #(TIMEVAL+TIMEOFFSET) 3951 f06b - endif 3952 f06b -skipdefaulttime 3953 f06b - tay 3954 f06b - dey 3955 f06b -.setTIM64Tloop 3956 f06b - sta TIM64T 3957 f06b - cpy INTIM 3958 f06b - bne .setTIM64Tloop 3959 f06b - rts 3960 f06b endif ; LONGCONTROLLERREAD 3961 f06b 3962 f06b reallyoffvisible 3963 f06b 85 24 sta WSYNC 3964 f06d 3965 f06d a9 00 lda #0 3966 f06f 85 4d sta visibleover 3967 f071 - ifconst DEBUGINTERRUPT 3968 f071 - sta BACKGRND 3969 f071 endif 3970 f071 3971 f071 a9 03 lda #3 3972 f073 8d b2 01 sta interruptindex 3973 f076 3974 f076 20 52 f1 jsr uninterruptableroutines 3975 f079 3976 f079 - ifconst .userinterrupt 3977 f079 - lda interrupthold 3978 f079 - beq skipuserintroutine 3979 f079 - jsr .userinterrupt 3980 f079 -skipuserintroutine 3981 f079 endif 3982 f079 3983 f079 - ifconst KEYPADSUPPORT 3984 f079 - jsr keypadcolumnread 3985 f079 endif 3986 f079 3987 f079 NMIexit 3988 f079 68 pla 3989 f07a a8 tay 3990 f07b 68 pla 3991 f07c aa tax 3992 f07d 68 pla 3993 f07e 40 RTI 3994 f07f 3995 f07f clearscreen 3996 f07f a2 0b ldx #(WZONECOUNT-1) 3997 f081 a9 00 lda #0 3998 f083 clearscreenloop 3999 f083 95 65 sta dlend,x 4000 f085 ca dex 4001 f086 10 fb bpl clearscreenloop 4002 f088 a9 00 lda #0 4003 f08a 8d ad 01 sta valbufend ; clear the bcd value buffer 4004 f08d 8d ae 01 sta valbufendsave 4005 f090 60 rts 4006 f091 4007 f091 restorescreen 4008 f091 a2 0b ldx #(WZONECOUNT-1) 4009 f093 a9 00 lda #0 4010 f095 restorescreenloop 4011 f095 b5 82 lda dlendsave,x 4012 f097 95 65 sta dlend,x 4013 f099 ca dex 4014 f09a 10 f9 bpl restorescreenloop 4015 f09c ad ae 01 lda valbufendsave 4016 f09f 8d ad 01 sta valbufend 4017 f0a2 60 rts 4018 f0a3 4019 f0a3 savescreen 4020 f0a3 a2 0b ldx #(WZONECOUNT-1) 4021 f0a5 savescreenloop 4022 f0a5 b5 65 lda dlend,x 4023 f0a7 95 82 sta dlendsave,x 4024 f0a9 ca dex 4025 f0aa 10 f9 bpl savescreenloop 4026 f0ac ad ad 01 lda valbufend 4027 f0af 8d ae 01 sta valbufendsave 4028 f0b2 - ifconst DOUBLEBUFFER 4029 f0b2 - lda doublebufferstate 4030 f0b2 - beq savescreenrts 4031 f0b2 - lda #1 4032 f0b2 - sta doublebufferbufferdirty 4033 f0b2 -savescreenrts 4034 f0b2 endif ; DOUBLEBUFFER 4035 f0b2 60 rts 4036 f0b3 4037 f0b3 drawscreen 4038 f0b3 4039 f0b3 - ifconst interrupthold 4040 f0b3 - lda #$FF 4041 f0b3 - sta interrupthold ; if the user called drawscreen, we're ready for interrupts 4042 f0b3 endif 4043 f0b3 4044 f0b3 a9 00 lda #0 4045 f0b5 85 42 sta temp1 ; not B&W if we're here... 4046 f0b7 4047 f0b7 drawscreenwait 4048 f0b7 a5 4d lda visibleover 4049 f0b9 d0 fc bne drawscreenwait ; make sure the visible screen isn't being drawn 4050 f0bb 4051 f0bb ;restore some registers in case the game changed them mid-screen... 4052 f0bb ad 07 21 lda sCTRL 4053 f0be 05 42 ora temp1 4054 f0c0 85 3c sta CTRL 4055 f0c2 ad 0b 21 lda sCHARBASE 4056 f0c5 85 34 sta CHARBASE 4057 f0c7 4058 f0c7 ;ensure all of the display list is terminated... 4059 f0c7 20 38 f1 jsr terminatedisplaylist 4060 f0ca 4061 f0ca ifnconst pauseroutineoff 4062 f0ca 20 d5 f0 jsr pauseroutine 4063 f0cd endif ; pauseroutineoff 4064 f0cd 4065 f0cd ; Make sure the visible screen has *started* before we exit. That way we can rely on drawscreen 4066 f0cd ; delaying a full frame, but still allowing time for basic calculations. 4067 f0cd visiblescreenstartedwait 4068 f0cd a5 4d lda visibleover 4069 f0cf f0 fc beq visiblescreenstartedwait 4070 f0d1 visiblescreenstartedwaitdone 4071 f0d1 ce 3e 21 dec frameslost ; ; this gets balanced with an "inc frameslost" by an NMI at the top of the screen 4072 f0d4 60 rts 4073 f0d5 4074 f0d5 ifnconst pauseroutineoff 4075 f0d5 ; check to see if pause was pressed and released 4076 f0d5 pauseroutine 4077 f0d5 ad b3 01 lda pausedisable 4078 f0d8 d0 4e bne leavepauseroutine 4079 f0da a9 08 lda #8 4080 f0dc 2c 82 02 bit SWCHB 4081 f0df f0 29 beq pausepressed 4082 f0e1 4083 f0e1 ifnconst SOFTRESETASPAUSEOFF 4084 f0e1 ifnconst MOUSESUPPORT 4085 f0e1 ifnconst TRAKBALLSUPPORT 4086 f0e1 ad 80 02 lda SWCHA ; then check the soft "RESET" joysick code... 4087 f0e4 29 70 and #%01110000 ; _LDU 4088 f0e6 f0 22 beq pausepressed 4089 f0e8 endif 4090 f0e8 endif 4091 f0e8 endif 4092 f0e8 4093 f0e8 ;pause isn't pressed 4094 f0e8 a9 00 lda #0 4095 f0ea 8d ac 01 sta pausebuttonflag ; clear pause hold state in case its set 4096 f0ed 4097 f0ed ;check if we're in an already paused state 4098 f0ed ad 00 21 lda pausestate 4099 f0f0 f0 36 beq leavepauseroutine ; nope, leave 4100 f0f2 4101 f0f2 c9 01 cmp #1 ; last frame was the start of pausing 4102 f0f4 f0 2b beq enterpausestate2 ; move from state 1 to 2 4103 f0f6 4104 f0f6 c9 02 cmp #2 4105 f0f8 f0 34 beq carryonpausing 4106 f0fa 4107 f0fa ;pausestate must be >2, which means we're ending an unpause 4108 f0fa a9 00 lda #0 4109 f0fc 8d ac 01 sta pausebuttonflag 4110 f0ff 8d 00 21 sta pausestate 4111 f102 ad 07 21 lda sCTRL 4112 f105 85 3c sta CTRL 4113 f107 4c 28 f1 jmp leavepauseroutine 4114 f10a 4115 f10a pausepressed 4116 f10a ;pause is pressed 4117 f10a ad ac 01 lda pausebuttonflag 4118 f10d c9 ff cmp #$ff 4119 f10f f0 1d beq carryonpausing 4120 f111 4121 f111 ;its a new press, increment the state 4122 f111 ee 00 21 inc pausestate 4123 f114 4124 f114 ;silence volume at the start and end of pausing 4125 f114 a9 00 lda #0 4126 f116 85 19 sta AUDV0 4127 f118 85 1a sta AUDV1 4128 f11a 4129 f11a - ifconst pokeysupport 4130 f11a - ldy #7 4131 f11a -pausesilencepokeyaudioloop 4132 f11a - sta (pokeybase),y 4133 f11a - dey 4134 f11a - bpl pausesilencepokeyaudioloop 4135 f11a endif ; pokeysupport 4136 f11a 4137 f11a a9 ff lda #$ff 4138 f11c 8d ac 01 sta pausebuttonflag 4139 f11f d0 0d bne carryonpausing 4140 f121 4141 f121 enterpausestate2 4142 f121 a9 02 lda #2 4143 f123 8d 00 21 sta pausestate 4144 f126 d0 06 bne carryonpausing 4145 f128 leavepauseroutine 4146 f128 ad 07 21 lda sCTRL 4147 f12b 85 3c sta CTRL 4148 f12d 60 rts 4149 f12e carryonpausing 4150 f12e - ifconst .pause 4151 f12e - jsr .pause 4152 f12e endif ; .pause 4153 f12e ad 07 21 lda sCTRL 4154 f131 09 80 ora #%10000000 ; turn off colorburst during pause... 4155 f133 85 3c sta CTRL 4156 f135 4c d5 f0 jmp pauseroutine 4157 f138 endif ; pauseroutineoff 4158 f138 4159 f138 4160 f138 - ifconst DOUBLEBUFFER 4161 f138 -skipterminatedisplaylistreturn 4162 f138 - rts 4163 f138 endif ; DOUBLEBUFFER 4164 f138 terminatedisplaylist 4165 f138 - ifconst DOUBLEBUFFER 4166 f138 - lda doublebufferstate 4167 f138 - bne skipterminatedisplaylistreturn ; double-buffering runs it's own DL termination code 4168 f138 endif ; DOUBLEBUFFER 4169 f138 terminatedisplaybuffer 4170 f138 ;add DL end entry on each DL 4171 f138 a2 0b ldx #(WZONECOUNT-1) 4172 f13a dlendloop 4173 f13a bd ed f5 lda DLPOINTL,x 4174 f13d - ifconst DOUBLEBUFFER 4175 f13d - clc 4176 f13d - adc doublebufferdloffset 4177 f13d endif ; DOUBLEBUFFER 4178 f13d 85 63 sta dlpnt 4179 f13f bd e1 f5 lda DLPOINTH,x 4180 f142 - ifconst DOUBLEBUFFER 4181 f142 - adc #0 4182 f142 endif ; DOUBLEBUFFER 4183 f142 85 64 sta dlpnt+1 4184 f144 b4 65 ldy dlend,x 4185 f146 a9 00 lda #$00 4186 f148 dlendmoreloops 4187 f148 c8 iny 4188 f149 91 63 sta (dlpnt),y 4189 f14b - ifconst FRAMESKIPGLITCHFIXWEAK 4190 f14b - cpy #DLLASTOBJ+1 4191 f14b - beq dlendthiszonedone 4192 f14b - iny 4193 f14b - iny 4194 f14b - iny 4195 f14b - iny 4196 f14b - iny 4197 f14b - sta (dlpnt),y 4198 f14b -dlendthiszonedone 4199 f14b endif FRAMESKIPGLITCHFIXWEAK 4200 f14b - ifconst FRAMESKIPGLITCHFIX 4201 f14b - iny 4202 f14b - iny 4203 f14b - iny 4204 f14b - iny 4205 f14b - cpy #DLLASTOBJ-1 4206 f14b - bcc dlendmoreloops 4207 f14b endif ; FRAMESKIPGLITCHFIX 4208 f14b ca dex 4209 f14c 10 ec bpl dlendloop 4210 f14e 4211 f14e ifnconst pauseroutineoff 4212 f14e 20 d5 f0 jsr pauseroutine 4213 f151 endif ; pauseroutineoff 4214 f151 60 rts 4215 f152 4216 f152 uninterruptableroutines 4217 f152 ; this is for routines that must happen off the visible screen, each frame. 4218 f152 4219 f152 - ifconst AVOXVOICE 4220 f152 - jsr serviceatarivoxqueue 4221 f152 endif 4222 f152 4223 f152 a9 00 lda #0 4224 f154 8d b6 01 sta palfastframe 4225 f157 ad 09 21 lda paldetected 4226 f15a f0 10 beq skippalframeadjusting 4227 f15c ; ** PAL console is detected. we increment palframes to accurately count 5 frames, 4228 f15c ae b5 01 ldx palframes 4229 f15f e8 inx 4230 f160 e0 05 cpx #5 4231 f162 d0 05 bne palframeskipdone 4232 f164 ee b6 01 inc palfastframe 4233 f167 a2 00 ldx #0 4234 f169 palframeskipdone 4235 f169 8e b5 01 stx palframes 4236 f16c skippalframeadjusting 4237 f16c 4238 f16c - ifconst MUSICTRACKER 4239 f16c - ; We normally run the servicesong routine from the top-screen interrupt, but if it 4240 f16c - ; happens to interrupt the scheduling of a sound effect in the game code, we skip it. 4241 f16c - ; If that happens, we try again here. Chances are very small we'll run into the same 4242 f16c - ; problem twice, and if we do, we just drop a musical note or two. 4243 f16c - lda sfxschedulemissed 4244 f16c - beq servicesongwasnotmissed 4245 f16c - jsr servicesong 4246 f16c -servicesongwasnotmissed 4247 f16c endif ; MUSICTRACKER 4248 f16c 4249 f16c 60 rts 4250 f16d 4251 f16d serviceatarivoxqueue 4252 f16d - ifconst AVOXVOICE 4253 f16d - lda voxlock 4254 f16d - bne skipvoxprocessing ; the vox is in the middle of speech address update 4255 f16d -skipvoxqueuesizedec 4256 f16d - jmp processavoxvoice 4257 f16d -skipvoxprocessing 4258 f16d - rts 4259 f16d - 4260 f16d -processavoxvoice 4261 f16d - lda avoxenable 4262 f16d - bne avoxfixport 4263 f16d - SPKOUT tempavox 4264 f16d - rts 4265 f16d -avoxfixport 4266 f16d - lda #0 ; restore the port to all bits as inputs... 4267 f16d - sta CTLSWA 4268 f16d - rts 4269 f16d -silenceavoxvoice 4270 f16d - SPEAK avoxsilentdata 4271 f16d - rts 4272 f16d -avoxsilentdata 4273 f16d - .byte 31,255 4274 f16d else 4275 f16d 60 rts 4276 f16e endif ; AVOXVOICE 4277 f16e 4278 f16e joybuttonhandler 4279 f16e 8a txa 4280 f16f 0a asl 4281 f170 a8 tay 4282 f171 b9 08 00 lda INPT0,y 4283 f174 4a lsr 4284 f175 9d 02 21 sta sINPT1,x 4285 f178 b9 09 00 lda INPT1,y 4286 f17b 29 80 and #%10000000 4287 f17d 1d 02 21 ora sINPT1,x 4288 f180 9d 02 21 sta sINPT1,x 4289 f183 4290 f183 b5 0c lda INPT4,x 4291 f185 30 19 bmi .skip1bjoyfirecheck 4292 f187 ;one button joystick is down 4293 f187 49 80 eor #%10000000 4294 f189 9d 02 21 sta sINPT1,x 4295 f18c 4296 f18c ad b1 01 lda joybuttonmode 4297 f18f 3d a3 f1 and twobuttonmask,x 4298 f192 f0 0c beq .skip1bjoyfirecheck 4299 f194 ad b1 01 lda joybuttonmode 4300 f197 1d a3 f1 ora twobuttonmask,x 4301 f19a 8d b1 01 sta joybuttonmode 4302 f19d 8d 82 02 sta SWCHB 4303 f1a0 .skip1bjoyfirecheck 4304 f1a0 4c 57 f0 jmp buttonreadloopreturn 4305 f1a3 4306 f1a3 twobuttonmask 4307 f1a3 04 10 .byte.b %00000100,%00010000 4308 f1a5 4309 f1a5 gunbuttonhandler ; outside of the conditional, so our button handler LUT is valid 4310 f1a5 - ifconst LIGHTGUNSUPPORT 4311 f1a5 - cpx #0 4312 f1a5 - bne secondportgunhandler 4313 f1a5 -firstportgunhandler 4314 f1a5 - lda SWCHA 4315 f1a5 - asl 4316 f1a5 - asl 4317 f1a5 - asl ; shift D4 to D7 4318 f1a5 - and #%10000000 4319 f1a5 - eor #%10000000 4320 f1a5 - sta sINPT1 4321 f1a5 - jmp buttonreadloopreturn 4322 f1a5 -secondportgunhandler 4323 f1a5 - lda SWCHA 4324 f1a5 - lsr ; shift D0 into carry 4325 f1a5 - lsr ; shift carry into D7 4326 f1a5 - and #%10000000 4327 f1a5 - eor #%10000000 4328 f1a5 - sta sINPT3 4329 f1a5 - jmp buttonreadloopreturn 4330 f1a5 endif ; LIGHTGUNSUPPORT 4331 f1a5 4332 f1a5 controlsusing2buttoncode 4333 f1a5 00 .byte.b 0 ; 00=no controller plugged in 4334 f1a6 01 .byte.b 1 ; 01=proline joystick 4335 f1a7 00 .byte.b 0 ; 02=lightgun 4336 f1a8 00 .byte.b 0 ; 03=paddle 4337 f1a9 01 .byte.b 1 ; 04=trakball 4338 f1aa 01 .byte.b 1 ; 05=vcs joystick 4339 f1ab 01 .byte.b 1 ; 06=driving control 4340 f1ac 00 .byte.b 0 ; 07=keypad control 4341 f1ad 00 .byte.b 0 ; 08=st mouse/cx80 4342 f1ae 00 .byte.b 0 ; 09=amiga mouse 4343 f1af 01 .byte.b 1 ; 10=atarivox 4344 f1b0 4345 f1b0 buttonhandlerhi 4346 f1b0 00 .byte.b 0 ; 00=no controller plugged in 4347 f1b1 f1 .byte.b >joybuttonhandler ; 01=proline joystick 4348 f1b2 f1 .byte.b >gunbuttonhandler ; 02=lightgun 4349 f1b3 f4 .byte.b >paddlebuttonhandler ; 03=paddle 4350 f1b4 f1 .byte.b >joybuttonhandler ; 04=trakball 4351 f1b5 f1 .byte.b >joybuttonhandler ; 05=vcs joystick 4352 f1b6 f1 .byte.b >joybuttonhandler ; 06=driving control 4353 f1b7 00 .byte.b 0 ; 07=keypad 4354 f1b8 f4 .byte.b >mousebuttonhandler ; 08=st mouse 4355 f1b9 f4 .byte.b >mousebuttonhandler ; 09=amiga mouse 4356 f1ba f1 .byte.b >joybuttonhandler ; 10=atarivox 4357 f1bb buttonhandlerlo 4358 f1bb 00 .byte.b 0 ; 00=no controller plugged in 4359 f1bc 6e .byte.b $0F means the sound is looped while priority is active 4460 f219 4461 f219 05 d9 ora inttemp2 4462 f21b 05 d8 ora inttemp1 ; check if F|C|V=0 4463 f21d f0 23 beq zerosfx ; if so, we're at the end of the sound. 4464 f21f 4465 f21f advancesfxpointer 4466 f21f ; advance the pointer to the next sound chunk 4467 f21f c8 iny 4468 f220 84 da sty inttemp3 4469 f222 18 clc 4470 f223 b5 4e lda sfx1pointlo,x 4471 f225 65 da adc inttemp3 4472 f227 95 4e sta sfx1pointlo,x 4473 f229 b5 50 lda sfx1pointhi,x 4474 f22b 69 00 adc #0 4475 f22d 95 50 sta sfx1pointhi,x 4476 f22f 4c da f1 jmp servicesfxchannelsloop 4477 f232 4478 f232 sfxsoundloop 4479 f232 48 pha 4480 f233 b5 52 lda sfx1priority,x 4481 f235 d0 04 bne sfxsoundloop_carryon 4482 f237 68 pla ; fix the stack before we go 4483 f238 4c 1f f2 jmp advancesfxpointer 4484 f23b sfxsoundloop_carryon 4485 f23b 68 pla 4486 f23c 29 f0 and #$F0 4487 f23e 4a lsr 4488 f23f 4a lsr 4489 f240 4a lsr 4490 f241 4a lsr 4491 f242 4492 f242 zerosfx 4493 f242 95 4e sta sfx1pointlo,x 4494 f244 95 50 sta sfx1pointhi,x 4495 f246 95 52 sta sfx1priority,x 4496 f248 4c da f1 jmp servicesfxchannelsloop 4497 f24b 4498 f24b 4499 f24b schedulesfx 4500 f24b ; called with sfxinstrumentlo=data sfxpitchoffset=pitch-offset sfxnoteindex=note index 4501 f24b a0 00 ldy #0 4502 f24d b1 e0 lda (sfxinstrumentlo),y 4503 f24f - ifconst pokeysupport 4504 f24f - cmp #$20 ; POKEY? 4505 f24f - bne scheduletiasfx 4506 f24f - jmp schedulepokeysfx 4507 f24f endif 4508 f24f scheduletiasfx 4509 f24f ;cmp #$10 ; TIA? 4510 f24f ;beq continuescheduletiasfx 4511 f24f ; rts ; unhandled!!! 4512 f24f continuescheduletiasfx 4513 f24f ifnconst TIASFXMONO 4514 f24f a5 4e lda sfx1pointlo 4515 f251 05 50 ora sfx1pointhi 4516 f253 f0 13 beq schedulesfx1 ;if channel 1 is idle, use it 4517 f255 a5 4f lda sfx2pointlo 4518 f257 05 51 ora sfx2pointhi 4519 f259 f0 11 beq schedulesfx2 ;if channel 2 is idle, use it 4520 f25b ; Both channels are scheduled. 4521 f25b a0 01 ldy #1 4522 f25d b1 e0 lda (sfxinstrumentlo),y 4523 f25f d0 01 bne interruptsfx 4524 f261 60 rts ; the new sound has 0 priority and both channels are busy. Skip playing it. 4525 f262 interruptsfx 4526 f262 ;Compare which active sound has a lower priority. We'll interrupt the lower one. 4527 f262 a5 52 lda sfx1priority 4528 f264 c5 53 cmp sfx2priority 4529 f266 b0 04 bcs schedulesfx2 4530 f268 endif ; !TIASFXMONO 4531 f268 4532 f268 schedulesfx1 4533 f268 a2 00 ldx #0 ; channel 1 4534 f26a ifnconst TIASFXMONO 4535 f26a f0 02 beq skipschedulesfx2 4536 f26c schedulesfx2 4537 f26c a2 01 ldx #1 ; channel 2 4538 f26e skipschedulesfx2 4539 f26e endif ; !TIASFXMONO 4540 f26e 4541 f26e - ifconst MUSICTRACKER 4542 f26e - lda sfxnoteindex 4543 f26e - bpl skipdrumkitoverride 4544 f26e - and #$7F ; subtract 128 4545 f26e - sec 4546 f26e - sbc #4 ; drums start at 132, i.e. octave 10 4547 f26e - asl 4548 f26e - tay 4549 f26e - lda tiadrumkitdefinition,y 4550 f26e - sta sfxinstrumentlo 4551 f26e - iny 4552 f26e - lda tiadrumkitdefinition,y 4553 f26e - sta sfxinstrumenthi 4554 f26e - lda #0 4555 f26e - sta sfxnoteindex ; and tell the driver it's a non-pitched instrument 4556 f26e -skipdrumkitoverride 4557 f26e endif ; MUSICTRACKER 4558 f26e a0 01 ldy #1 ; get priority and sound-resolution (in frames) 4559 f270 b1 e0 lda (sfxinstrumentlo),y 4560 f272 95 52 sta sfx1priority,x 4561 f274 c8 iny 4562 f275 b1 e0 lda (sfxinstrumentlo),y 4563 f277 95 56 sta sfx1frames,x 4564 f279 a5 e0 lda sfxinstrumentlo 4565 f27b 18 clc 4566 f27c 69 03 adc #3 4567 f27e 95 4e sta sfx1pointlo,x 4568 f280 a5 e1 lda sfxinstrumenthi 4569 f282 69 00 adc #0 4570 f284 95 50 sta sfx1pointhi,x 4571 f286 a5 e2 lda sfxpitchoffset 4572 f288 95 54 sta sfx1poffset,x 4573 f28a a9 00 lda #0 4574 f28c 95 58 sta sfx1tick,x 4575 f28e a5 e3 lda sfxnoteindex 4576 f290 95 cd sta sfx1notedata,x 4577 f292 60 rts 4578 f293 4579 f293 plotsprite 4580 f293 ifnconst NODRAWWAIT 4581 f293 - ifconst DOUBLEBUFFER 4582 f293 - lda doublebufferstate 4583 f293 - bne skipplotspritewait 4584 f293 endif ; DOUBLEBUFFER 4585 f293 - ifconst DEBUGWAITCOLOR 4586 f293 - lda #$41 4587 f293 - sta BACKGRND 4588 f293 endif 4589 f293 plotspritewait 4590 f293 a5 4d lda visibleover 4591 f295 d0 fc bne plotspritewait 4592 f297 skipplotspritewait 4593 f297 - ifconst DEBUGWAITCOLOR 4594 f297 - lda #$0 4595 f297 - sta BACKGRND 4596 f297 endif 4597 f297 endif 4598 f297 4599 f297 ;arguments: 4600 f297 ; temp1=lo graphicdata 4601 f297 ; temp2=hi graphicdata 4602 f297 ; temp3=palette | width byte 4603 f297 ; temp4=x 4604 f297 ; temp5=y 4605 f297 ; temp6=mode 4606 f297 a5 46 lda temp5 ;Y position 4607 f299 4a lsr ; 2 - Divide by 8 or 16 4608 f29a 4a lsr ; 2 4609 f29b 4a lsr ; 2 4610 f29c if WZONEHEIGHT = 16 4611 f29c 4a lsr ; 2 4612 f29d endif 4613 f29d 4614 f29d aa tax 4615 f29e 4616 f29e ifnconst NOLIMITCHECKING 4617 f29e 4618 f29e ; the next block allows for vertical masking, and ensures we don't overwrite non-DL memory 4619 f29e 4620 f29e c9 0c cmp #WZONECOUNT 4621 f2a0 4622 f2a0 90 0a bcc continueplotsprite1 ; the sprite is fully on-screen, so carry on... 4623 f2a2 ; otherwise, check to see if the bottom half is in zone 0... 4624 f2a2 4625 f2a2 if WZONEHEIGHT = 16 4626 f2a2 c9 0f cmp #15 4627 f2a4 - else 4628 f2a4 - cmp #31 4629 f2a4 endif 4630 f2a4 4631 f2a4 d0 05 bne exitplotsprite1 4632 f2a6 a2 00 ldx #0 4633 f2a8 4c e5 f2 jmp continueplotsprite2 4634 f2ab exitplotsprite1 4635 f2ab 60 rts 4636 f2ac 4637 f2ac continueplotsprite1 4638 f2ac endif 4639 f2ac 4640 f2ac bd ed f5 lda DLPOINTL,x ;Get pointer to DL that this sprite starts in 4641 f2af - ifconst DOUBLEBUFFER 4642 f2af - clc 4643 f2af - adc doublebufferdloffset 4644 f2af endif ; DOUBLEBUFFER 4645 f2af 85 63 sta dlpnt 4646 f2b1 bd e1 f5 lda DLPOINTH,x 4647 f2b4 - ifconst DOUBLEBUFFER 4648 f2b4 - adc #0 4649 f2b4 endif ; DOUBLEBUFFER 4650 f2b4 85 64 sta dlpnt+1 4651 f2b6 4652 f2b6 ;Create DL entry for upper part of sprite 4653 f2b6 4654 f2b6 b4 65 ldy dlend,x ;Get the index to the end of this DL 4655 f2b8 4656 f2b8 ifconst CHECKOVERWRITE 4657 f2b8 c0 9b cpy #DLLASTOBJ 4658 f2ba f0 21 beq checkcontinueplotsprite2 4659 f2bc continueplotsprite1a 4660 f2bc endif 4661 f2bc 4662 f2bc a5 42 lda temp1 ; graphic data, lo byte 4663 f2be 91 63 sta (dlpnt),y ;Low byte of data address 4664 f2c0 4665 f2c0 ifnconst ATOMICSPRITEUPDATE 4666 f2c0 c8 iny 4667 f2c1 a5 47 lda temp6 4668 f2c3 91 63 sta (dlpnt),y 4669 f2c5 - else 4670 f2c5 - iny 4671 f2c5 - sty temp8 4672 f2c5 endif 4673 f2c5 4674 f2c5 c8 iny 4675 f2c6 4676 f2c6 a5 46 lda temp5 ;Y position 4677 f2c8 29 0f and #(WZONEHEIGHT - 1) 4678 f2ca c9 01 cmp #1 ; clear carry if our sprite is just in this zone 4679 f2cc 05 43 ora temp2 ; graphic data, hi byte 4680 f2ce 91 63 sta (dlpnt),y 4681 f2d0 4682 f2d0 4683 f2d0 c8 iny 4684 f2d1 a5 44 lda temp3 ;palette|width 4685 f2d3 91 63 sta (dlpnt),y 4686 f2d5 4687 f2d5 c8 iny 4688 f2d6 a5 45 lda temp4 ;Horizontal position 4689 f2d8 91 63 sta (dlpnt),y 4690 f2da 4691 f2da c8 iny 4692 f2db 94 65 sty dlend,x 4693 f2dd 4694 f2dd - ifconst ALWAYSTERMINATE 4695 f2dd - iny 4696 f2dd - lda #0 4697 f2dd - sta (dlpnt),y 4698 f2dd endif 4699 f2dd 4700 f2dd - ifconst ATOMICSPRITEUPDATE 4701 f2dd - ldy temp8 4702 f2dd - lda temp6 4703 f2dd - sta (dlpnt),y 4704 f2dd endif 4705 f2dd 4706 f2dd checkcontinueplotsprite2 4707 f2dd 4708 f2dd 90 38 bcc doneSPDL ;branch if the sprite was fully in the last zone 4709 f2df 4710 f2df ;Create DL entry for lower part of sprite 4711 f2df 4712 f2df e8 inx ;Next region 4713 f2e0 4714 f2e0 ifnconst NOLIMITCHECKING 4715 f2e0 e0 0c cpx #WZONECOUNT 4716 f2e2 4717 f2e2 90 01 bcc continueplotsprite2 ; the second half of the sprite is fully on-screen, so carry on... 4718 f2e4 60 rts 4719 f2e5 continueplotsprite2 4720 f2e5 endif 4721 f2e5 4722 f2e5 bd ed f5 lda DLPOINTL,x ;Get pointer to next DL 4723 f2e8 - ifconst DOUBLEBUFFER 4724 f2e8 - clc 4725 f2e8 - adc doublebufferdloffset 4726 f2e8 endif ; DOUBLEBUFFER 4727 f2e8 85 63 sta dlpnt 4728 f2ea bd e1 f5 lda DLPOINTH,x 4729 f2ed - ifconst DOUBLEBUFFER 4730 f2ed - adc #0 4731 f2ed endif ; DOUBLEBUFFER 4732 f2ed 85 64 sta dlpnt+1 4733 f2ef b4 65 ldy dlend,x ;Get the index to the end of this DL 4734 f2f1 4735 f2f1 ifconst CHECKOVERWRITE 4736 f2f1 c0 9b cpy #DLLASTOBJ 4737 f2f3 d0 01 bne continueplotsprite2a 4738 f2f5 60 rts 4739 f2f6 continueplotsprite2a 4740 f2f6 endif 4741 f2f6 4742 f2f6 a5 42 lda temp1 ; graphic data, lo byte 4743 f2f8 91 63 sta (dlpnt),y 4744 f2fa 4745 f2fa ifnconst ATOMICSPRITEUPDATE 4746 f2fa c8 iny 4747 f2fb a5 47 lda temp6 4748 f2fd 91 63 sta (dlpnt),y 4749 f2ff - else 4750 f2ff - iny 4751 f2ff - sty temp8 4752 f2ff endif 4753 f2ff 4754 f2ff c8 iny 4755 f300 4756 f300 a5 46 lda temp5 ;Y position 4757 f302 0b 0f anc #(WZONEHEIGHT - 1) ; undocumented. A=A&IMM, then move bit 7 into carry 4758 f304 05 43 ora temp2 ; graphic data, hi byte 4759 f306 e9 0f sbc #(WZONEHEIGHT-1) ; start at the DMA hole. -1 because carry is clear 4760 f308 91 63 sta (dlpnt),y 4761 f30a 4762 f30a c8 iny 4763 f30b 4764 f30b a5 44 lda temp3 ;palette|width 4765 f30d 91 63 sta (dlpnt),y 4766 f30f 4767 f30f c8 iny 4768 f310 4769 f310 a5 45 lda temp4 ;Horizontal position 4770 f312 91 63 sta (dlpnt),y 4771 f314 4772 f314 c8 iny 4773 f315 94 65 sty dlend,x 4774 f317 4775 f317 - ifconst ALWAYSTERMINATE 4776 f317 - iny 4777 f317 - lda #0 4778 f317 - sta (dlpnt),y 4779 f317 endif 4780 f317 4781 f317 - ifconst ATOMICSPRITEUPDATE 4782 f317 - ldy temp8 4783 f317 - lda temp6 4784 f317 - sta (dlpnt),y 4785 f317 endif 4786 f317 4787 f317 doneSPDL 4788 f317 60 rts 4789 f318 4790 f318 4791 f318 lockzonex 4792 f318 - ifconst ZONELOCKS 4793 f318 - ldy dlend,x 4794 f318 - cpy #DLLASTOBJ 4795 f318 - beq lockzonexreturn ; the zone is either stuffed or locked. abort! 4796 f318 - lda DLPOINTL,x 4797 f318 - ifconst DOUBLEBUFFER 4798 f318 - clc 4799 f318 - adc doublebufferdloffset 4800 f318 - endif ; DOUBLEBUFFER 4801 f318 - sta dlpnt 4802 f318 - lda DLPOINTH,x 4803 f318 - ifconst DOUBLEBUFFER 4804 f318 - adc #0 4805 f318 - endif ; DOUBLEBUFFER 4806 f318 - sta dlpnt+1 4807 f318 - iny 4808 f318 - lda #0 4809 f318 - sta (dlpnt),y 4810 f318 - dey 4811 f318 - tya 4812 f318 - ldy #(DLLASTOBJ-1) 4813 f318 - sta (dlpnt),y 4814 f318 - iny 4815 f318 - sty dlend,x 4816 f318 -lockzonexreturn 4817 f318 - rts 4818 f318 endif ; ZONELOCKS 4819 f318 unlockzonex 4820 f318 - ifconst ZONELOCKS 4821 f318 - ldy dlend,x 4822 f318 - cpy #DLLASTOBJ 4823 f318 - bne unlockzonexreturn ; if the zone isn't stuffed, it's not locked. abort! 4824 f318 - lda DLPOINTL,x 4825 f318 - ifconst DOUBLEBUFFER 4826 f318 - clc 4827 f318 - adc doublebufferdloffset 4828 f318 - endif ; DOUBLEBUFFER 4829 f318 - sta dlpnt 4830 f318 - lda DLPOINTH,x 4831 f318 - ifconst DOUBLEBUFFER 4832 f318 - adc #0 4833 f318 - endif ; DOUBLEBUFFER 4834 f318 - sta dlpnt+1 4835 f318 - dey 4836 f318 - ;ldy #(DLLASTOBJ-1) 4837 f318 - lda (dlpnt),y 4838 f318 - tay 4839 f318 - sty dlend,x 4840 f318 -unlockzonexreturn 4841 f318 endif ; ZONELOCKS 4842 f318 60 rts 4843 f319 4844 f319 plotcharloop 4845 f319 ; ** read from a data indirectly pointed to from temp8,temp9 4846 f319 ; ** format is: lo_data, hi_data, palette|width, x, y 4847 f319 ; ** format ends with lo_data | hi_data = 0 4848 f319 4849 f319 - ifconst DOUBLEBUFFER 4850 f319 - lda doublebufferstate 4851 f319 - bne skipplotcharloopwait 4852 f319 endif ; DOUBLEBUFFER 4853 f319 - ifconst DEBUGWAITCOLOR 4854 f319 - lda #$61 4855 f319 - sta BACKGRND 4856 f319 endif 4857 f319 plotcharloopwait 4858 f319 a5 4d lda visibleover 4859 f31b d0 fc bne plotcharloopwait 4860 f31d - ifconst DEBUGWAITCOLOR 4861 f31d - lda #0 4862 f31d - sta BACKGRND 4863 f31d endif 4864 f31d skipplotcharloopwait 4865 f31d plotcharlooploop 4866 f31d a0 00 ldy #0 4867 f31f b1 49 lda (temp8),y 4868 f321 85 42 sta temp1 4869 f323 c8 iny 4870 f324 b1 49 lda (temp8),y 4871 f326 85 43 sta temp2 4872 f328 05 42 ora temp1 4873 f32a d0 01 bne plotcharloopcontinue 4874 f32c ;the pointer=0, so return 4875 f32c 60 rts 4876 f32d plotcharloopcontinue 4877 f32d c8 iny 4878 f32e b1 49 lda (temp8),y 4879 f330 85 44 sta temp3 4880 f332 c8 iny 4881 f333 b1 49 lda (temp8),y 4882 f335 85 45 sta temp4 4883 f337 c8 iny 4884 f338 b1 49 lda (temp8),y 4885 f33a ;sta temp5 ; not needed with our late entry. 4886 f33a 20 53 f3 jsr plotcharactersskipentry 4887 f33d a5 49 lda temp8 4888 f33f 18 clc 4889 f340 69 05 adc #5 4890 f342 85 49 sta temp8 4891 f344 a5 4a lda temp9 4892 f346 69 00 adc #0 4893 f348 85 4a sta temp9 4894 f34a 4c 1d f3 jmp plotcharlooploop 4895 f34d 4896 f34d plotcharacters 4897 f34d - ifconst DOUBLEBUFFER 4898 f34d - lda doublebufferstate 4899 f34d - bne skipplotcharacterswait 4900 f34d endif ; DOUBLEBUFFER 4901 f34d - ifconst DEBUGWAITCOLOR 4902 f34d - lda #$41 4903 f34d - sta BACKGRND 4904 f34d endif 4905 f34d plotcharacterswait 4906 f34d a5 4d lda visibleover 4907 f34f d0 fc bne plotcharacterswait 4908 f351 - ifconst DEBUGWAITCOLOR 4909 f351 - sta BACKGRND 4910 f351 endif 4911 f351 skipplotcharacterswait 4912 f351 ;arguments: 4913 f351 ; temp1=lo charactermap 4914 f351 ; temp2=hi charactermap 4915 f351 ; temp3=palette | width byte 4916 f351 ; temp4=x 4917 f351 ; temp5=y 4918 f351 4919 f351 a5 46 lda temp5 ;Y position 4920 f353 4921 f353 plotcharactersskipentry 4922 f353 4923 f353 ;ifconst ZONEHEIGHT 4924 f353 ; if ZONEHEIGHT = 16 4925 f353 ; and #$0F 4926 f353 ; endif 4927 f353 ; if ZONEHEIGHT = 8 4928 f353 ; and #$1F 4929 f353 ; endif 4930 f353 ;else 4931 f353 ; and #$0F 4932 f353 ;endif 4933 f353 4934 f353 aa tax 4935 f354 bd ed f5 lda DLPOINTL,x ;Get pointer to DL that the characters are in 4936 f357 - ifconst DOUBLEBUFFER 4937 f357 - clc 4938 f357 - adc doublebufferdloffset 4939 f357 endif ; DOUBLEBUFFER 4940 f357 85 63 sta dlpnt 4941 f359 bd e1 f5 lda DLPOINTH,x 4942 f35c - ifconst DOUBLEBUFFER 4943 f35c - adc #0 4944 f35c endif ; DOUBLEBUFFER 4945 f35c 85 64 sta dlpnt+1 4946 f35e 4947 f35e ;Create DL entry for the characters 4948 f35e 4949 f35e b4 65 ldy dlend,x ;Get the index to the end of this DL 4950 f360 4951 f360 ifconst CHECKOVERWRITE 4952 f360 c0 9b cpy #DLLASTOBJ 4953 f362 d0 01 bne continueplotcharacters 4954 f364 60 rts 4955 f365 continueplotcharacters 4956 f365 endif 4957 f365 4958 f365 a5 42 lda temp1 ; character map data, lo byte 4959 f367 91 63 sta (dlpnt),y ;(1) store low address 4960 f369 4961 f369 c8 iny 4962 f36a ad 06 21 lda charactermode 4963 f36d 91 63 sta (dlpnt),y ;(2) store mode 4964 f36f 4965 f36f c8 iny 4966 f370 a5 43 lda temp2 ; character map, hi byte 4967 f372 91 63 sta (dlpnt),y ;(3) store high address 4968 f374 4969 f374 c8 iny 4970 f375 a5 44 lda temp3 ;palette|width 4971 f377 91 63 sta (dlpnt),y ;(4) store palette|width 4972 f379 4973 f379 c8 iny 4974 f37a a5 45 lda temp4 ;Horizontal position 4975 f37c 91 63 sta (dlpnt),y ;(5) store horizontal position 4976 f37e 4977 f37e c8 iny 4978 f37f 94 65 sty dlend,x ; save display list end byte 4979 f381 60 rts 4980 f382 4981 f382 4982 f382 - ifconst plotvalueonscreen 4983 f382 -plotcharacterslive 4984 f382 - ; a version of plotcharacters that draws live and minimally disrupts the screen... 4985 f382 - 4986 f382 - ;arguments: 4987 f382 - ; temp1=lo charactermap 4988 f382 - ; temp2=hi charactermap 4989 f382 - ; temp3=palette | width byte 4990 f382 - ; temp4=x 4991 f382 - ; temp5=y 4992 f382 - 4993 f382 - lda temp5 ;Y position 4994 f382 - 4995 f382 - tax 4996 f382 - lda DLPOINTL,x ;Get pointer to DL that the characters are in 4997 f382 - ifconst DOUBLEBUFFER 4998 f382 - clc 4999 f382 - adc doublebufferdloffset 5000 f382 - endif ; DOUBLEBUFFER 5001 f382 - sta dlpnt 5002 f382 - lda DLPOINTH,x 5003 f382 - ifconst DOUBLEBUFFER 5004 f382 - adc #0 5005 f382 - endif ; DOUBLEBUFFER 5006 f382 - sta dlpnt+1 5007 f382 - 5008 f382 - ;Create DL entry for the characters 5009 f382 - 5010 f382 - ldy dlend,x ;Get the index to the end of this DL 5011 f382 - 5012 f382 - ifconst CHECKOVERWRITE 5013 f382 - cpy #DLLASTOBJ 5014 f382 - bne continueplotcharacterslive 5015 f382 - rts 5016 f382 -continueplotcharacterslive 5017 f382 - endif 5018 f382 - 5019 f382 - lda temp1 ; character map data, lo byte 5020 f382 - sta (dlpnt),y ;(1) store low address 5021 f382 - 5022 f382 - iny 5023 f382 - ; we don't add the second byte yet, since the charmap could briefly 5024 f382 - ; render without a proper character map address, width, or position. 5025 f382 - lda charactermode 5026 f382 - sta (dlpnt),y ;(2) store mode 5027 f382 - 5028 f382 - iny 5029 f382 - lda temp2 ; character map, hi byte 5030 f382 - sta (dlpnt),y ;(3) store high address 5031 f382 - 5032 f382 - iny 5033 f382 - lda temp3 ;palette|width 5034 f382 - sta (dlpnt),y ;(4) store palette|width 5035 f382 - 5036 f382 - iny 5037 f382 - lda temp4 ;Horizontal position 5038 f382 - sta (dlpnt),y ;(5) store horizontal position 5039 f382 - 5040 f382 - iny 5041 f382 - sty dlend,x ; save display list end byte 5042 f382 - 5043 f382 - rts 5044 f382 endif ;plotcharacterslive 5045 f382 5046 f382 - ifconst USED_PLOTVALUE 5047 f382 -plotvalue 5048 f382 - ; calling 7800basic command: 5049 f382 - ; plotvalue digit_gfx palette variable/data number_of_digits screen_x screen_y 5050 f382 - ; ...displays the variable as BCD digits 5051 f382 - ; 5052 f382 - ; asm sub arguments: 5053 f382 - ; temp1=lo charactermap 5054 f382 - ; temp2=hi charactermap 5055 f382 - ; temp3=palette | width byte 5056 f382 - ; temp4=x 5057 f382 - ; temp5=y 5058 f382 - ; temp6=number of digits 5059 f382 - ; temp7=lo variable 5060 f382 - ; temp8=hi variable 5061 f382 - ; temp9=character mode 5062 f382 - 5063 f382 -plotdigitcount = temp6 5064 f382 - 5065 f382 - ifconst ZONELOCKS 5066 f382 - ldx temp5 5067 f382 - ldy dlend,x 5068 f382 - cpy #DLLASTOBJ 5069 f382 - bne carryonplotvalue 5070 f382 - rts 5071 f382 -carryonplotvalue 5072 f382 - endif 5073 f382 - 5074 f382 - lda #0 5075 f382 - tay 5076 f382 - ldx valbufend 5077 f382 - 5078 f382 - lda plotdigitcount 5079 f382 - and #1 5080 f382 - beq pvnibble2char 5081 f382 - lda #0 5082 f382 - sta VALBUFFER,x ; just in case we skip this digit 5083 f382 - beq pvnibble2char_skipnibble 5084 f382 - 5085 f382 -pvnibble2char 5086 f382 - ; high nibble... 5087 f382 - lda (temp7),y 5088 f382 - and #$f0 5089 f382 - lsr 5090 f382 - lsr 5091 f382 - lsr 5092 f382 - ifnconst DOUBLEWIDE ; multiply value by 2 for double-width 5093 f382 - lsr 5094 f382 - endif 5095 f382 - 5096 f382 - clc 5097 f382 - adc temp1 ; add the offset to character graphics to our value 5098 f382 - sta VALBUFFER,x 5099 f382 - inx 5100 f382 - dec plotdigitcount 5101 f382 - 5102 f382 -pvnibble2char_skipnibble 5103 f382 - ; low nibble... 5104 f382 - lda (temp7),y 5105 f382 - and #$0f 5106 f382 - ifconst DOUBLEWIDE ; multiply value by 2 for double-width 5107 f382 - asl 5108 f382 - endif 5109 f382 - clc 5110 f382 - adc temp1 ; add the offset to character graphics to our value 5111 f382 - sta VALBUFFER,x 5112 f382 - inx 5113 f382 - iny 5114 f382 - 5115 f382 - dec plotdigitcount 5116 f382 - bne pvnibble2char 5117 f382 - 5118 f382 - ;point to the start of our valuebuffer 5119 f382 - clc 5120 f382 - lda #VALBUFFER 5124 f382 - adc #0 5125 f382 - sta temp2 5126 f382 - 5127 f382 - ;advance valbufend to the end of our value buffer 5128 f382 - stx valbufend 5129 f382 - 5130 f382 - ifnconst plotvalueonscreen 5131 f382 - jmp plotcharacters 5132 f382 - else 5133 f382 - jmp plotcharacterslive 5134 f382 - endif 5135 f382 - 5136 f382 endif ; USED_PLOTVALUE 5137 f382 5138 f382 5139 f382 - ifconst USED_PLOTVALUEEXTRA 5140 f382 -plotdigitcount = temp6 5141 f382 -plotvalueextra 5142 f382 - ; calling 7800basic command: 5143 f382 - ; plotvalue digit_gfx palette variable/data number_of_digits screen_x screen_y 5144 f382 - ; ...displays the variable as BCD digits 5145 f382 - ; 5146 f382 - ; asm sub arguments: 5147 f382 - ; temp1=lo charactermap 5148 f382 - ; temp2=hi charactermap 5149 f382 - ; temp3=palette | width byte 5150 f382 - ; temp4=x 5151 f382 - ; temp5=y 5152 f382 - ; temp6=number of digits 5153 f382 - ; temp7=lo variable 5154 f382 - ; temp8=hi variable 5155 f382 - 5156 f382 - lda #0 5157 f382 - tay 5158 f382 - ldx valbufend 5159 f382 - ifnconst plotvalueonscreen 5160 f382 - sta VALBUFFER,x 5161 f382 - endif 5162 f382 - 5163 f382 - lda plotdigitcount 5164 f382 - and #1 5165 f382 - 5166 f382 - bne pvnibble2char_skipnibbleextra 5167 f382 - 5168 f382 -pvnibble2charextra 5169 f382 - ; high nibble... 5170 f382 - lda (temp7),y 5171 f382 - and #$f0 5172 f382 - lsr 5173 f382 - lsr 5174 f382 - ifnconst DOUBLEWIDE ; multiply value by 2 for double-width 5175 f382 - lsr 5176 f382 - endif 5177 f382 - clc 5178 f382 - adc temp1 ; add the offset to character graphics to our value 5179 f382 - sta VALBUFFER,x 5180 f382 - inx 5181 f382 - 5182 f382 - ; second half of the digit 5183 f382 - clc 5184 f382 - adc #1 5185 f382 - sta VALBUFFER,x 5186 f382 - inx 5187 f382 - 5188 f382 -pvnibble2char_skipnibbleextra 5189 f382 - ; low nibble... 5190 f382 - lda (temp7),y 5191 f382 - and #$0f 5192 f382 - ifconst DOUBLEWIDE ; multiply value by 2 for double-width 5193 f382 - asl 5194 f382 - endif 5195 f382 - asl 5196 f382 - 5197 f382 - clc 5198 f382 - adc temp1 ; add the offset to character graphics to our value 5199 f382 - sta VALBUFFER,x 5200 f382 - inx 5201 f382 - 5202 f382 - clc 5203 f382 - adc #1 5204 f382 - sta VALBUFFER,x 5205 f382 - inx 5206 f382 - iny 5207 f382 - 5208 f382 - dec plotdigitcount 5209 f382 - bne pvnibble2charextra 5210 f382 - 5211 f382 - ;point to the start of our valuebuffer 5212 f382 - clc 5213 f382 - lda #VALBUFFER 5217 f382 - adc #0 5218 f382 - sta temp2 5219 f382 - 5220 f382 - ;advance valbufend to the end of our value buffer 5221 f382 - stx valbufend 5222 f382 - 5223 f382 - ifnconst plotvalueonscreen 5224 f382 - jmp plotcharacters 5225 f382 - else 5226 f382 - jmp plotcharacterslive 5227 f382 - endif 5228 f382 endif ; USED_PLOTVALUEEXTRA 5229 f382 5230 f382 boxcollision 5231 f382 ifconst BOXCOLLISION 5232 f382 ; the worst case cycle-time for the code below is 43 cycles. 5233 f382 ; unfortunately, prior to getting here we've burned 44 cycles in argument setup. eep! 5234 f382 5235 f382 ;__boxx1 = accumulator 5236 f382 ;__boxy1 = y 5237 f382 00 44 __boxw1 = temp3 5238 f382 00 45 __boxh1 = temp4 5239 f382 5240 f382 00 46 __boxx2 = temp5 5241 f382 00 47 __boxy2 = temp6 5242 f382 00 48 __boxw2 = temp7 5243 f382 00 49 __boxh2 = temp8 5244 f382 5245 f382 DoXCollisionCheck 5246 f382 ;lda __boxx1 ; skipped. already in the accumulator 5247 f382 c5 46 cmp __boxx2 ;3 5248 f384 b0 07 bcs X1isbiggerthanX2 ;2/3 5249 f386 X2isbiggerthanX1 5250 f386 ; carry is clear 5251 f386 65 44 adc __boxw1 ;3 5252 f388 c5 46 cmp __boxx2 ;3 5253 f38a b0 08 bcs DoYCollisionCheck ;3/2 5254 f38c 60 rts ;6 - carry clear, no collision 5255 f38d X1isbiggerthanX2 5256 f38d 18 clc ;2 5257 f38e e5 48 sbc __boxw2 ;3 5258 f390 c5 46 cmp __boxx2 ;3 5259 f392 b0 13 bcs noboxcollision ;3/2 5260 f394 DoYCollisionCheck 5261 f394 98 tya ; 2 ; use to be "lda __boxy1" 5262 f395 c5 47 cmp __boxy2 ;3 5263 f397 b0 05 bcs Y1isbiggerthanY2 ;3/2 5264 f399 Y2isbiggerthanY1 5265 f399 ; carry is clear 5266 f399 65 45 adc __boxh1 ;3 5267 f39b c5 47 cmp __boxy2 ;3 5268 f39d 60 rts ;6 5269 f39e Y1isbiggerthanY2 5270 f39e 18 clc ;2 5271 f39f e5 49 sbc __boxh2 ;3 5272 f3a1 c5 47 cmp __boxy2 ;3 5273 f3a3 b0 02 bcs noboxcollision ;3/2 5274 f3a5 yesboxcollision 5275 f3a5 38 sec ;2 5276 f3a6 60 rts ;6 5277 f3a7 noboxcollision 5278 f3a7 18 clc ;2 5279 f3a8 60 rts ;6 5280 f3a9 endif ; BOXCOLLISION 5281 f3a9 5282 f3a9 randomize 5283 f3a9 a5 40 lda rand 5284 f3ab 4a lsr 5285 f3ac 26 41 rol rand16 5286 f3ae 90 02 bcc noeor 5287 f3b0 49 b4 eor #$B4 5288 f3b2 noeor 5289 f3b2 85 40 sta rand 5290 f3b4 45 41 eor rand16 5291 f3b6 60 rts 5292 f3b7 5293 f3b7 ; *** bcd conversion routine courtesy Omegamatrix 5294 f3b7 ; *** http://atariage.com/forums/blog/563/entry-10832-hex-to-bcd-conversion-0-99/ 5295 f3b7 converttobcd 5296 f3b7 ;value to convert is in the accumulator 5297 f3b7 85 42 sta temp1 5298 f3b9 4a lsr 5299 f3ba 65 42 adc temp1 5300 f3bc 6a ror 5301 f3bd 4a lsr 5302 f3be 4a lsr 5303 f3bf 65 42 adc temp1 5304 f3c1 6a ror 5305 f3c2 65 42 adc temp1 5306 f3c4 6a ror 5307 f3c5 4a lsr 5308 f3c6 29 3c and #$3C 5309 f3c8 85 43 sta temp2 5310 f3ca 4a lsr 5311 f3cb 65 43 adc temp2 5312 f3cd 65 42 adc temp1 5313 f3cf 60 rts ; return the result in the accumulator 5314 f3d0 5315 f3d0 ; Y and A contain multiplicands, result in A 5316 f3d0 mul8 5317 f3d0 84 42 sty temp1 5318 f3d2 85 43 sta temp2 5319 f3d4 a9 00 lda #0 5320 f3d6 reptmul8 5321 f3d6 46 43 lsr temp2 5322 f3d8 90 03 bcc skipmul8 5323 f3da 18 clc 5324 f3db 65 42 adc temp1 5325 f3dd ;bcs donemul8 might save cycles? 5326 f3dd skipmul8 5327 f3dd ;beq donemul8 might save cycles? 5328 f3dd 06 42 asl temp1 5329 f3df d0 f5 bne reptmul8 5330 f3e1 donemul8 5331 f3e1 60 rts 5332 f3e2 5333 f3e2 div8 5334 f3e2 ; A=numerator Y=denominator, result in A 5335 f3e2 c0 02 cpy #2 5336 f3e4 90 0a bcc div8end+1 ;div by 0 = bad, div by 1=no calc needed, so bail out 5337 f3e6 84 42 sty temp1 5338 f3e8 a0 ff ldy #$ff 5339 f3ea div8loop 5340 f3ea e5 42 sbc temp1 5341 f3ec c8 iny 5342 f3ed b0 fb bcs div8loop 5343 f3ef div8end 5344 f3ef 98 tya 5345 f3f0 ; result in A 5346 f3f0 60 rts 5347 f3f1 5348 f3f1 ; Y and A contain multiplicands, result in temp2,A=low, temp1=high 5349 f3f1 mul16 5350 f3f1 84 42 sty temp1 5351 f3f3 85 43 sta temp2 5352 f3f5 5353 f3f5 a9 00 lda #0 5354 f3f7 a2 08 ldx #8 5355 f3f9 46 42 lsr temp1 5356 f3fb mul16_1 5357 f3fb 90 03 bcc mul16_2 5358 f3fd 18 clc 5359 f3fe 65 43 adc temp2 5360 f400 mul16_2 5361 f400 6a ror 5362 f401 66 42 ror temp1 5363 f403 ca dex 5364 f404 d0 f5 bne mul16_1 5365 f406 85 43 sta temp2 5366 f408 60 rts 5367 f409 5368 f409 ; div int/int 5369 f409 ; numerator in A, denom in temp1 5370 f409 ; returns with quotient in A, remainder in temp1 5371 f409 div16 5372 f409 85 43 sta temp2 5373 f40b 84 42 sty temp1 5374 f40d a9 00 lda #0 5375 f40f a2 08 ldx #8 5376 f411 06 43 asl temp2 5377 f413 div16_1 5378 f413 2a rol 5379 f414 c5 42 cmp temp1 5380 f416 90 02 bcc div16_2 5381 f418 e5 42 sbc temp1 5382 f41a div16_2 5383 f41a 26 43 rol temp2 5384 f41c ca dex 5385 f41d d0 f4 bne div16_1 5386 f41f 85 42 sta temp1 5387 f421 a5 43 lda temp2 5388 f423 60 rts 5389 f424 5390 f424 - ifconst bankswitchmode 5391 f424 -BS_jsr 5392 f424 - ifconst dumpbankswitch 5393 f424 - sta dumpbankswitch 5394 f424 - endif 5395 f424 - ifconst MCPDEVCART 5396 f424 - ora #$18 5397 f424 - sta $3000 5398 f424 - else 5399 f424 - sta $8000 5400 f424 - endif 5401 f424 - pla 5402 f424 - tax 5403 f424 - pla 5404 f424 - rts 5405 f424 - 5406 f424 -BS_return 5407 f424 - pla ; bankswitch bank 5408 f424 - ifconst dumpbankswitch 5409 f424 - sta dumpbankswitch 5410 f424 - endif 5411 f424 - ifconst BANKRAM 5412 f424 - sta currentbank 5413 f424 - ora currentrambank 5414 f424 - endif 5415 f424 - ifconst MCPDEVCART 5416 f424 - ora #$18 5417 f424 - sta $3000 5418 f424 - else 5419 f424 - sta $8000 5420 f424 - endif 5421 f424 - pla ; bankswitch $0 flag 5422 f424 - rts 5423 f424 endif 5424 f424 5425 f424 checkselectswitch 5426 f424 ad 82 02 lda SWCHB ; first check the real select switch... 5427 f427 29 02 and #%00000010 5428 f429 ifnconst MOUSESUPPORT 5429 f429 f0 05 beq checkselectswitchreturn ; switch is pressed 5430 f42b ad 80 02 lda SWCHA ; then check the soft "select" joysick code... 5431 f42e 29 b0 and #%10110000 ; R_DU 5432 f430 endif ; MOUSESUPPORT 5433 f430 checkselectswitchreturn 5434 f430 60 rts 5435 f431 5436 f431 checkresetswitch 5437 f431 ad 82 02 lda SWCHB ; first check the real reset switch... 5438 f434 29 01 and #%00000001 5439 f436 ifnconst MOUSESUPPORT 5440 f436 f0 05 beq checkresetswitchreturn ; switch is pressed 5441 f438 ad 80 02 lda SWCHA ; then check the soft "reset" joysick code... 5442 f43b 29 70 and #%01110000 ; _LDU 5443 f43d endif ; MOUSESUPPORT 5444 f43d checkresetswitchreturn 5445 f43d 60 rts 5446 f43e 5447 f43e - ifconst FINESCROLLENABLED 5448 f43e -finescrolldlls 5449 f43e - ldx temp1 ; first DLL index x3 5450 f43e - lda DLLMEM,x 5451 f43e - and #%11110000 5452 f43e - ora finescrolly 5453 f43e - sta DLLMEM,x 5454 f43e - 5455 f43e - ldx temp2 ; last DLL index x3 5456 f43e - lda DLLMEM,x 5457 f43e - and #%11110000 5458 f43e - ora finescrolly 5459 f43e - eor #(WZONEHEIGHT-1) 5460 f43e - sta DLLMEM,x 5461 f43e - rts 5462 f43e endif ; FINESCROLLENABLED 5463 f43e 5464 f43e - ifconst USED_ADJUSTVISIBLE 5465 f43e -adjustvisible 5466 f43e - ; called with temp1=first visible zone *3, temp2=last visible zone *3 5467 f43e - jsr waitforvblankstart ; ensure vblank just started 5468 f43e - ldx visibleDLLstart 5469 f43e -findfirstinterrupt 5470 f43e - lda DLLMEM,x 5471 f43e - bmi foundfirstinterrupt 5472 f43e - inx 5473 f43e - inx 5474 f43e - inx 5475 f43e - bne findfirstinterrupt 5476 f43e -foundfirstinterrupt 5477 f43e - and #%01111111 ; clear the interrupt bit 5478 f43e - sta DLLMEM,x 5479 f43e - ifconst DOUBLEBUFFER 5480 f43e - sta DLLMEM+DBOFFSET,x 5481 f43e - endif ; DOUBLEBUFFER 5482 f43e - ldx overscanDLLstart 5483 f43e -findlastinterrupt 5484 f43e - lda DLLMEM,x 5485 f43e - bmi foundlastinterrupt 5486 f43e - dex 5487 f43e - dex 5488 f43e - dex 5489 f43e - bne findlastinterrupt 5490 f43e -foundlastinterrupt 5491 f43e - and #%01111111 ; clear the interrupt bit 5492 f43e - sta DLLMEM,x 5493 f43e - ifconst DOUBLEBUFFER 5494 f43e - sta DLLMEM+DBOFFSET,x 5495 f43e - endif ; DOUBLEBUFFER 5496 f43e - ;now we need to set the new interrupts 5497 f43e - clc 5498 f43e - lda temp1 5499 f43e - adc visibleDLLstart 5500 f43e - tax 5501 f43e - lda DLLMEM,x 5502 f43e - ora #%10000000 5503 f43e - sta DLLMEM,x 5504 f43e - ifconst DOUBLEBUFFER 5505 f43e - sta DLLMEM+DBOFFSET,x 5506 f43e - endif ; DOUBLEBUFFER 5507 f43e - clc 5508 f43e - lda temp2 5509 f43e - adc visibleDLLstart 5510 f43e - tax 5511 f43e - lda DLLMEM,x 5512 f43e - ora #%10000000 5513 f43e - sta DLLMEM,x 5514 f43e - ifconst DOUBLEBUFFER 5515 f43e - sta DLLMEM+DBOFFSET,x 5516 f43e - endif ; DOUBLEBUFFER 5517 f43e - jsr vblankresync 5518 f43e - rts 5519 f43e endif ; USED_ADJUSTVISIBLE 5520 f43e 5521 f43e vblankresync 5522 f43e 20 dc f4 jsr waitforvblankstart ; ensure vblank just started 5523 f441 a9 00 lda #0 5524 f443 85 4d sta visibleover 5525 f445 a9 03 lda #3 5526 f447 8d b2 01 sta interruptindex 5527 f44a 60 rts 5528 f44b 5529 f44b createallgamedlls 5530 f44b a2 00 ldx #0 5531 f44d a9 19 lda #NVLINES 5532 f44f ac 09 21 ldy paldetected 5533 f452 f0 03 beq skipcreatePALpadding 5534 f454 18 clc 5535 f455 69 15 adc #21 5536 f457 skipcreatePALpadding 5537 f457 20 8c f4 jsr createnonvisibledlls 5538 f45a 8e 3c 21 stx visibleDLLstart 5539 f45d 20 bd f4 jsr createvisiblezones 5540 f460 8e 3d 21 stx overscanDLLstart 5541 f463 createallgamedllscontinue 5542 f463 a9 50 lda #(NVLINES+55) ; extras for PAL 5543 f465 20 8c f4 jsr createnonvisibledlls 5544 f468 5545 f468 ae 3c 21 ldx visibleDLLstart 5546 f46b bd 00 18 lda DLLMEM,x 5547 f46e 09 80 ora #%10000000 ; NMI 1 - start of visible screen 5548 f470 9d 00 18 sta DLLMEM,x 5549 f473 - ifconst DOUBLEBUFFER 5550 f473 - sta DLLMEM+DBOFFSET,x 5551 f473 endif ; DOUBLEBUFFER 5552 f473 5553 f473 ae 3d 21 ldx overscanDLLstart 5554 f476 bd 00 18 lda DLLMEM,x 5555 f479 09 83 ora #%10000011 ; NMI 2 - end of visible screen 5556 f47b 29 f3 and #%11110011 ; change this to a 1-line DLL, so there's time enough for the "deeper overscan" DLL 5557 f47d 9d 00 18 sta DLLMEM,x 5558 f480 - ifconst DOUBLEBUFFER 5559 f480 - sta DLLMEM+DBOFFSET,x 5560 f480 endif ; DOUBLEBUFFER 5561 f480 5562 f480 e8 inx 5563 f481 e8 inx 5564 f482 e8 inx 5565 f483 5566 f483 bd 00 18 lda DLLMEM,x 5567 f486 09 80 ora #%10000000 ; NMI 3 - deeper overscan 5568 f488 9d 00 18 sta DLLMEM,x 5569 f48b - ifconst DOUBLEBUFFER 5570 f48b - sta DLLMEM+DBOFFSET,x 5571 f48b endif ; DOUBLEBUFFER 5572 f48b 5573 f48b 60 rts 5574 f48c 5575 f48c createnonvisibledlls 5576 f48c 85 42 sta temp1 5577 f48e 4a lsr 5578 f48f 4a lsr 5579 f490 4a lsr 5580 f491 4a lsr ; /16 5581 f492 f0 09 beq skipcreatenonvisibledlls1loop 5582 f494 a8 tay 5583 f495 createnonvisibledlls1loop 5584 f495 a9 4f lda #%01001111 ;low nibble=16 lines, high nibble=Holey DMA 5585 f497 20 ac f4 jsr createblankdllentry 5586 f49a 88 dey 5587 f49b d0 f8 bne createnonvisibledlls1loop 5588 f49d skipcreatenonvisibledlls1loop 5589 f49d a5 42 lda temp1 5590 f49f 29 0f and #%00001111 5591 f4a1 f0 08 beq createnonvisibledllsreturn 5592 f4a3 38 sec 5593 f4a4 e9 01 sbc #1 5594 f4a6 09 40 ora #%01000000 5595 f4a8 20 ac f4 jsr createblankdllentry 5596 f4ab createnonvisibledllsreturn 5597 f4ab 60 rts 5598 f4ac 5599 f4ac createblankdllentry 5600 f4ac 9d 00 18 sta DLLMEM,x 5601 f4af - ifconst DOUBLEBUFFER 5602 f4af - sta DLLMEM+DBOFFSET,x 5603 f4af endif ; DOUBLEBUFFER 5604 f4af e8 inx 5605 f4b0 a9 21 lda #$21 ; blank 5606 f4b2 9d 00 18 sta DLLMEM,x 5607 f4b5 - ifconst DOUBLEBUFFER 5608 f4b5 - sta DLLMEM+DBOFFSET,x 5609 f4b5 endif ; DOUBLEBUFFER 5610 f4b5 e8 inx 5611 f4b6 a9 00 lda #$00 5612 f4b8 9d 00 18 sta DLLMEM,x 5613 f4bb - ifconst DOUBLEBUFFER 5614 f4bb - sta DLLMEM+DBOFFSET,x 5615 f4bb endif ; DOUBLEBUFFER 5616 f4bb e8 inx 5617 f4bc 60 rts 5618 f4bd 5619 f4bd createvisiblezones 5620 f4bd a0 00 ldy #0 5621 f4bf createvisiblezonesloop 5622 f4bf b9 f9 f5 lda.w DLHEIGHT,y 5623 f4c2 09 40 ora #(WZONEHEIGHT * 4) ; set Holey DMA for 8 or 16 tall zones 5624 f4c4 9d 00 18 sta DLLMEM,x 5625 f4c7 - ifconst DOUBLEBUFFER 5626 f4c7 - sta DLLMEM+DBOFFSET,x 5627 f4c7 endif ; DOUBLEBUFFER 5628 f4c7 e8 inx 5629 f4c8 b9 e1 f5 lda DLPOINTH,y 5630 f4cb 9d 00 18 sta DLLMEM,x 5631 f4ce - ifconst DOUBLEBUFFER 5632 f4ce - sta DLLMEM+DBOFFSET,x 5633 f4ce endif ; DOUBLEBUFFER 5634 f4ce e8 inx 5635 f4cf b9 ed f5 lda DLPOINTL,y 5636 f4d2 9d 00 18 sta DLLMEM,x 5637 f4d5 - ifconst DOUBLEBUFFER 5638 f4d5 - clc 5639 f4d5 - adc #DOUBLEBUFFEROFFSET 5640 f4d5 - sta DLLMEM+DBOFFSET,x 5641 f4d5 - bcc skiphidoublebufferadjust ; dlls are big endian, so we need to fix the hi byte after-the-fact... 5642 f4d5 - inc DLLMEM+DBOFFSET-1,x 5643 f4d5 -skiphidoublebufferadjust 5644 f4d5 endif ; DOUBLEBUFFER 5645 f4d5 e8 inx 5646 f4d6 c8 iny 5647 f4d7 c0 0c cpy #WZONECOUNT 5648 f4d9 d0 e4 bne createvisiblezonesloop 5649 f4db 60 rts 5650 f4dc 5651 f4dc waitforvblankstart 5652 f4dc vblankendwait 5653 f4dc 24 28 BIT MSTAT 5654 f4de 30 fc bmi vblankendwait 5655 f4e0 vblankstartwait 5656 f4e0 24 28 BIT MSTAT 5657 f4e2 10 fc bpl vblankstartwait 5658 f4e4 60 rts 5659 f4e5 5660 f4e5 - ifconst DOUBLEBUFFER 5661 f4e5 -flipdisplaybufferreturn 5662 f4e5 - rts 5663 f4e5 -flipdisplaybuffer 5664 f4e5 - ifconst interrupthold 5665 f4e5 - lda #$FF 5666 f4e5 - sta interrupthold 5667 f4e5 - endif 5668 f4e5 - lda doublebufferstate 5669 f4e5 - beq flipdisplaybufferreturn ; exit if we're not in double-buffer 5670 f4e5 - 5671 f4e5 - jsr terminatedisplaybuffer ; terminate the working buffer before we flip 5672 f4e5 - 5673 f4e5 - lda doublebufferstate 5674 f4e5 - lsr ; /2, so we'll see 0 or 1, rather than 1 or 3 5675 f4e5 - tax 5676 f4e5 - 5677 f4e5 - ; ensure we don't flip mid-display. otherwise the displayed DL will be the one the game is working on. 5678 f4e5 - 5679 f4e5 -flipdisplaybufferwait1 5680 f4e5 - lda visibleover 5681 f4e5 - beq flipdisplaybufferwait1 5682 f4e5 - 5683 f4e5 -flipdisplaybufferwait 5684 f4e5 - lda visibleover 5685 f4e5 - bne flipdisplaybufferwait 5686 f4e5 - 5687 f4e5 - lda doublebufferminimumframetarget 5688 f4e5 - beq skipminimumframecode 5689 f4e5 - lda doublebufferminimumframeindex 5690 f4e5 - bne flipdisplaybufferwait1 5691 f4e5 - lda doublebufferminimumframetarget 5692 f4e5 - sta doublebufferminimumframeindex 5693 f4e5 -skipminimumframecode 5694 f4e5 - 5695 f4e5 - lda DLLMEMLutHi,x 5696 f4e5 - sta DPPH 5697 f4e5 - lda DLLMEMLutLo,x 5698 f4e5 - sta DPPL 5699 f4e5 - 5700 f4e5 - lda NewPageflipstate,x 5701 f4e5 - sta doublebufferstate 5702 f4e5 - lda NewPageflipoffset,x 5703 f4e5 - sta doublebufferdloffset 5704 f4e5 - 5705 f4e5 - lda doublebufferbufferdirty 5706 f4e5 - beq flipdisplaybufferreturn 5707 f4e5 - 5708 f4e5 - ; The doublebuffer buffer is dirty, so the game code must have issued a savescreen recently. 5709 f4e5 - ; To make savescreen work with the new working buffer, we need to copy over the saved objects 5710 f4e5 - ; from the displayed buffer to the working buffer... 5711 f4e5 - 5712 f4e5 - lda doublebufferdloffset 5713 f4e5 - eor #DOUBLEBUFFEROFFSET 5714 f4e5 - sta temp6 ; make temp6 the anti-doublebufferdloffset variable 5715 f4e5 - 5716 f4e5 - ldx #(WZONECOUNT-1) 5717 f4e5 -copybufferzoneloop 5718 f4e5 - 5719 f4e5 - lda DLPOINTL,x 5720 f4e5 - clc 5721 f4e5 - adc doublebufferdloffset 5722 f4e5 - sta temp1 5723 f4e5 - lda DLPOINTH,x 5724 f4e5 - adc #0 5725 f4e5 - sta temp2 5726 f4e5 - 5727 f4e5 - lda DLPOINTL,x 5728 f4e5 - clc 5729 f4e5 - adc temp6 5730 f4e5 - sta temp3 5731 f4e5 - lda DLPOINTH,x 5732 f4e5 - adc #0 5733 f4e5 - sta temp4 5734 f4e5 - 5735 f4e5 - lda dlendsave,x 5736 f4e5 - tay 5737 f4e5 -copybuffercharsloop 5738 f4e5 - lda (temp3),y 5739 f4e5 - sta (temp1),y 5740 f4e5 - dey 5741 f4e5 - bpl copybuffercharsloop 5742 f4e5 - dex 5743 f4e5 - bpl copybufferzoneloop 5744 f4e5 - lda #0 5745 f4e5 - sta doublebufferbufferdirty 5746 f4e5 - rts 5747 f4e5 - 5748 f4e5 -doublebufferoff 5749 f4e5 - lda #1 5750 f4e5 - sta doublebufferstate 5751 f4e5 - jsr flipdisplaybuffer 5752 f4e5 - lda #0 5753 f4e5 - sta doublebufferstate 5754 f4e5 - sta doublebufferdloffset 5755 f4e5 - rts 5756 f4e5 - 5757 f4e5 -DLLMEMLutLo 5758 f4e5 - .byte DLLMEM,>(DLLMEM+DBOFFSET) 5761 f4e5 -NewPageflipstate 5762 f4e5 - .byte 3,1 5763 f4e5 -NewPageflipoffset 5764 f4e5 - .byte DOUBLEBUFFEROFFSET,0 5765 f4e5 - 5766 f4e5 endif ; DOUBLEBUFFER 5767 f4e5 5768 f4e5 - ifconst MOUSESUPPORT 5769 f4e5 - 5770 f4e5 -rotationalcompare 5771 f4e5 - ; old = 00 01 10 11 5772 f4e5 - .byte $00, $01, $ff, $00 ; new=00 5773 f4e5 - .byte $ff, $00, $00, $01 ; new=01 5774 f4e5 - .byte $01, $00, $00, $ff ; new=10 5775 f4e5 - .byte $00, $ff, $01, $00 ; new=11 5776 f4e5 - 5777 f4e5 - ; 0000YyXx st mouse 5778 f4e5 - 5779 f4e5 - ; 0000xyXY amiga mouse 5780 f4e5 - 5781 f4e5 - ifconst MOUSEXONLY 5782 f4e5 -amigatoataribits ; swap bits 1 and 4... 5783 f4e5 - .byte %0000, %0000, %0010, %0010 5784 f4e5 - .byte %0000, %0000, %0010, %0010 5785 f4e5 - .byte %0001, %0001, %0011, %0011 5786 f4e5 - .byte %0001, %0001, %0011, %0011 5787 f4e5 - 5788 f4e5 - ; null change bits 5789 f4e5 - .byte %0000, %0001, %0010, %0011 5790 f4e5 - .byte %0000, %0001, %0010, %0011 5791 f4e5 - .byte %0000, %0001, %0010, %0011 5792 f4e5 - .byte %0000, %0001, %0010, %0011 5793 f4e5 - 5794 f4e5 - else ; !MOUSEXONLY 5795 f4e5 - 5796 f4e5 -amigatoataribits ; swap bits 1 and 4... 5797 f4e5 - .byte %0000, %1000, %0010, %1010 5798 f4e5 - .byte %0100, %1100, %0110, %1110 5799 f4e5 - .byte %0001, %1001, %0011, %1011 5800 f4e5 - .byte %0101, %1101, %0111, %1111 5801 f4e5 - ; null change bits 5802 f4e5 - .byte %0000, %0001, %0010, %0011 5803 f4e5 - .byte %0100, %0101, %0110, %0111 5804 f4e5 - .byte %1000, %1001, %1010, %1011 5805 f4e5 - .byte %1100, %1101, %1110, %1111 5806 f4e5 - endif ; !MOUSEXONLY 5807 f4e5 - 5808 f4e5 endif ; MOUSESUPPORT 5809 f4e5 5810 f4e5 mouse0update 5811 f4e5 - ifconst MOUSE0SUPPORT 5812 f4e5 - 5813 f4e5 -mousetableselect = inttemp2 5814 f4e5 -mousexdelta = inttemp3 5815 f4e5 -mouseydelta = inttemp4 5816 f4e5 -lastSWCHA = inttemp6 5817 f4e5 - 5818 f4e5 - ; 0000YyXx st mouse 5819 f4e5 - ; 0000xyXY amiga mouse 5820 f4e5 - 5821 f4e5 - lda #$ff 5822 f4e5 - sta lastSWCHA 5823 f4e5 - 5824 f4e5 - ldy port0control 5825 f4e5 - 5826 f4e5 - lda #%00010000 5827 f4e5 - cpy #9 ; AMIGA? 5828 f4e5 - bne skipamigabitsfix0 5829 f4e5 - lda #0 5830 f4e5 -skipamigabitsfix0 5831 f4e5 - sta mousetableselect 5832 f4e5 - ifconst DRIVINGBOOST 5833 f4e5 - cpy #6 ; DRIVING? 5834 f4e5 - bne skipdriving0setup 5835 f4e5 - ; swap mousex0 and mousey0. mousex seen by the 7800basic program 5836 f4e5 - ; trails the actual mousex0, so we can smoothly interpolate toward 5837 f4e5 - ; the actual position. This actual position is stored in mousey0 5838 f4e5 - ; after the driver has run. 5839 f4e5 - ldx mousex0 5840 f4e5 - lda mousey0 5841 f4e5 - stx mousey0 5842 f4e5 - sta mousex0 5843 f4e5 -skipdriving0setup 5844 f4e5 - endif ; DRIVINGBOOST 5845 f4e5 - 5846 f4e5 - lda #0 5847 f4e5 - sta mousexdelta 5848 f4e5 - sta mouseydelta 5849 f4e5 - 5850 f4e5 - ifnconst MOUSETIME 5851 f4e5 - ifnconst MOUSEXONLY 5852 f4e5 - lda #180 ; minimum for x+y 5853 f4e5 - else 5854 f4e5 - lda #100 ; minimum for just x 5855 f4e5 - endif 5856 f4e5 - else 5857 f4e5 - lda #MOUSETIME 5858 f4e5 - endif 5859 f4e5 - jsr SETTIM64T ; INTIM is in Y 5860 f4e5 - 5861 f4e5 -mouse0updateloop 5862 f4e5 - lda SWCHA 5863 f4e5 - asr #%11110000 ; Undocumented. A = A & #IMM, then LSR A. 5864 f4e5 - cmp lastSWCHA 5865 f4e5 - beq mouse0loopcondition 5866 f4e5 - sta lastSWCHA 5867 f4e5 - lsr 5868 f4e5 - lsr 5869 f4e5 - lsr 5870 f4e5 - 5871 f4e5 - ora mousetableselect ; atari/amiga decoding table selection 5872 f4e5 - 5873 f4e5 - ; st mice encode on different bits/joystick-lines than amiga mice... 5874 f4e5 - ; 0000YyXx st mouse 5875 f4e5 - ; 0000xyXY amiga mouse 5876 f4e5 - ; ...so can shuffle the amiga bits to reuse the st driver. 5877 f4e5 - tay 5878 f4e5 - lax amigatoataribits,y 5879 f4e5 - 5880 f4e5 - ifnconst MOUSEXONLY 5881 f4e5 - ; first the Y... 5882 f4e5 - and #%00001100 5883 f4e5 - ora mousecodey0 5884 f4e5 - tay 5885 f4e5 - lda rotationalcompare,y 5886 f4e5 - clc 5887 f4e5 - adc mouseydelta 5888 f4e5 - sta mouseydelta 5889 f4e5 - tya 5890 f4e5 - lsr 5891 f4e5 - lsr 5892 f4e5 - sta mousecodey0 5893 f4e5 - txa 5894 f4e5 - ; ...then the X... 5895 f4e5 - and #%00000011 5896 f4e5 - tax 5897 f4e5 - endif ; !MOUSEXONLY 5898 f4e5 - 5899 f4e5 - asl 5900 f4e5 - asl 5901 f4e5 - ora mousecodex0 5902 f4e5 - tay 5903 f4e5 - lda rotationalcompare,y 5904 f4e5 - adc mousexdelta ; carry was clear by previous ASL 5905 f4e5 - sta mousexdelta 5906 f4e5 - stx mousecodex0 5907 f4e5 -mouse0loopcondition 5908 f4e5 - lda TIMINT 5909 f4e5 - bpl mouse0updateloop 5910 f4e5 - 5911 f4e5 - ; *** adapt to selected device resolution. 5912 f4e5 - ldx port0control 5913 f4e5 - 5914 f4e5 - ifconst PRECISIONMOUSING 5915 f4e5 - ldy port0resolution 5916 f4e5 - bne mouse0halveddone 5917 f4e5 - cpx #6 ; half-resolution is no good for driving wheels 5918 f4e5 - beq mouse0halveddone 5919 f4e5 - ; resolution=0 is half mouse resolution, necessary for precision 5920 f4e5 - ; mousing on a 160x240 screen with a 1000 dpi mouse. 5921 f4e5 - 5922 f4e5 - lda mousexdelta 5923 f4e5 - cmp #$80 5924 f4e5 - ror ; do a signed divide by 2. 5925 f4e5 - clc 5926 f4e5 - adc mousex0 5927 f4e5 - sta mousex0 5928 f4e5 - ifnconst MOUSEXONLY 5929 f4e5 - lda mouseydelta 5930 f4e5 - clc 5931 f4e5 - adc mousey0 5932 f4e5 - sta mousey0 5933 f4e5 - endif 5934 f4e5 - ; at half resolution we just exit after updating x and y 5935 f4e5 - jmp LLRET0 5936 f4e5 -mouse0halveddone 5937 f4e5 - endif ; PRECISIONMOUSING 5938 f4e5 - 5939 f4e5 - ifnconst MOUSEXONLY 5940 f4e5 - asl mouseydelta ; *2 because Y resolution is finer 5941 f4e5 - ldy port0resolution 5942 f4e5 - dey 5943 f4e5 - lda #0 5944 f4e5 -mousey0resolutionfix 5945 f4e5 - clc 5946 f4e5 - adc mouseydelta 5947 f4e5 - dey 5948 f4e5 - bpl mousey0resolutionfix 5949 f4e5 - clc 5950 f4e5 - adc mousey0 5951 f4e5 - sta mousey0 5952 f4e5 - endif ; MOUSEXONLY 5953 f4e5 - 5954 f4e5 - ldy port0resolution 5955 f4e5 - dey 5956 f4e5 - lda #0 5957 f4e5 -mousex0resolutionfix 5958 f4e5 - clc 5959 f4e5 - adc mousexdelta 5960 f4e5 - dey 5961 f4e5 - bpl mousex0resolutionfix 5962 f4e5 - ifnconst DRIVINGBOOST 5963 f4e5 - clc 5964 f4e5 - adc mousex0 5965 f4e5 - sta mousex0 5966 f4e5 - else 5967 f4e5 - cpx #6 5968 f4e5 - beq carryonmouse0boost 5969 f4e5 - clc 5970 f4e5 - adc mousex0 5971 f4e5 - sta mousex0 5972 f4e5 - jmp LLRET0 5973 f4e5 -carryonmouse0boost 5974 f4e5 - sta mousexdelta 5975 f4e5 - clc 5976 f4e5 - adc mousecodey0 5977 f4e5 - sta mousecodey0 5978 f4e5 - clc 5979 f4e5 - adc mousex0 5980 f4e5 - tay ; save the target X 5981 f4e5 - adc mousey0 ; average in the smoothly-trailing X 5982 f4e5 - ror 5983 f4e5 - sta mousex0 ; mousex0 now has the smoothly trailing X 5984 f4e5 - sty mousey0 ; and mousey0 has the the target X 5985 f4e5 - 5986 f4e5 - ; check to see if the coordinate wrapped. If so, undo the averaging code. 5987 f4e5 - ; A has mousex0, the smoothly trailing X 5988 f4e5 - sbc mousey0 ; less the target X 5989 f4e5 - bpl skipabsolutedrive0 5990 f4e5 - eor #$ff 5991 f4e5 -skipabsolutedrive0 5992 f4e5 - cmp #64 ; just an unreasonably large change 5993 f4e5 - bcc skipdrivewrapfix0 5994 f4e5 - sty mousex0 ; if X wrapped, we catch the trailing X up to the target X 5995 f4e5 -skipdrivewrapfix0 5996 f4e5 - 5997 f4e5 - ; get rid of the tweening if the distance travelled was very small 5998 f4e5 - lda mousexdelta 5999 f4e5 - cmp port0resolution 6000 f4e5 - bcs skipbetweenfix0 6001 f4e5 - lda mousex0 6002 f4e5 - sta mousey0 6003 f4e5 -skipbetweenfix0 6004 f4e5 - 6005 f4e5 -drivingboostreductioncheck0 6006 f4e5 - ; The below code amounts to mousecodey0=mousecodey0-(mousecodey0/8) 6007 f4e5 - ; +ve mousecodey0 is converted to -ve to do the calculation, and then 6008 f4e5 - ; negated again because truncation during BCD math results in 6009 f4e5 - ; differing magnitudes, depending if the value is +ve or -ve. 6010 f4e5 -driving0fix 6011 f4e5 - lax mousecodey0 6012 f4e5 - cmp #$80 6013 f4e5 - bcs driving0skipnegate1 6014 f4e5 - eor #$FF 6015 f4e5 - adc #1 6016 f4e5 - sta mousecodey0 6017 f4e5 -driving0skipnegate1 6018 f4e5 - cmp #$80 6019 f4e5 - ror 6020 f4e5 - cmp #$80 6021 f4e5 - ror 6022 f4e5 - cmp #$80 6023 f4e5 - ror 6024 f4e5 - sta inttemp1 6025 f4e5 - lda mousecodey0 6026 f4e5 - sec 6027 f4e5 - sbc inttemp1 6028 f4e5 - cpx #$80 6029 f4e5 - bcs driving0skipnegate2 6030 f4e5 - eor #$FF 6031 f4e5 - adc #1 6032 f4e5 -driving0skipnegate2 6033 f4e5 - sta mousecodey0 6034 f4e5 -drivingboostdone0 6035 f4e5 - endif ; DRIVINGBOOST 6036 f4e5 - 6037 f4e5 - jmp LLRET0 6038 f4e5 - 6039 f4e5 endif ; MOUSE0SUPPORT 6040 f4e5 6041 f4e5 mouse1update 6042 f4e5 - ifconst MOUSE1SUPPORT 6043 f4e5 - 6044 f4e5 -mousetableselect = inttemp2 6045 f4e5 -mousexdelta = inttemp3 6046 f4e5 -mouseydelta = inttemp4 6047 f4e5 -lastSWCHA = inttemp6 6048 f4e5 - 6049 f4e5 - ; 0000YyXx st mouse 6050 f4e5 - ; 0000xyXY amiga mouse 6051 f4e5 - 6052 f4e5 - lda #$ff 6053 f4e5 - sta lastSWCHA 6054 f4e5 - 6055 f4e5 - ldy port1control 6056 f4e5 - 6057 f4e5 - lda #%00010000 6058 f4e5 - cpy #9 ; AMIGA? 6059 f4e5 - bne skipamigabitsfix1 6060 f4e5 - lda #0 6061 f4e5 -skipamigabitsfix1 6062 f4e5 - sta mousetableselect 6063 f4e5 - ifconst DRIVINGBOOST 6064 f4e5 - cpy #6 ; DRIVING? 6065 f4e5 - bne skipdriving1setup 6066 f4e5 - ; swap mousex1 and mousey1. mousex seen by the 7800basic program 6067 f4e5 - ; trails the actual mousex1, so we can smoothly interpolate toward 6068 f4e5 - ; the actual position. This actual position is stored in mousey1 6069 f4e5 - ; after the driver has run. 6070 f4e5 - ldx mousex1 6071 f4e5 - lda mousey1 6072 f4e5 - stx mousey1 6073 f4e5 - sta mousex1 6074 f4e5 -skipdriving1setup 6075 f4e5 - endif ; DRIVINGBOOST 6076 f4e5 - 6077 f4e5 - lda #0 6078 f4e5 - sta mousexdelta 6079 f4e5 - sta mouseydelta 6080 f4e5 - 6081 f4e5 - ifnconst MOUSETIME 6082 f4e5 - ifnconst MOUSEXONLY 6083 f4e5 - lda #180 ; minimum for x+y 6084 f4e5 - else 6085 f4e5 - lda #100 ; minimum for just x 6086 f4e5 - endif 6087 f4e5 - else 6088 f4e5 - lda #MOUSETIME 6089 f4e5 - endif 6090 f4e5 - jsr SETTIM64T ; INTIM is in Y 6091 f4e5 - 6092 f4e5 -mouse1updateloop 6093 f4e5 - lda SWCHA 6094 f4e5 - and #%00001111 6095 f4e5 - cmp lastSWCHA 6096 f4e5 - beq mouse1loopcondition 6097 f4e5 - sta lastSWCHA 6098 f4e5 - 6099 f4e5 - ora mousetableselect ; atari/amiga decoding table selection 6100 f4e5 - 6101 f4e5 - ; st mice encode on different bits/joystick-lines than amiga mice... 6102 f4e5 - ; 0000YyXx st mouse 6103 f4e5 - ; 0000xyXY amiga mouse 6104 f4e5 - ; ...so can shuffle the amiga bits to reuse the st driver. 6105 f4e5 - tay 6106 f4e5 - lax amigatoataribits,y 6107 f4e5 - 6108 f4e5 - ifnconst MOUSEXONLY 6109 f4e5 - ; first the Y... 6110 f4e5 - and #%00001100 6111 f4e5 - ora mousecodey1 6112 f4e5 - tay 6113 f4e5 - lda rotationalcompare,y 6114 f4e5 - clc 6115 f4e5 - adc mouseydelta 6116 f4e5 - sta mouseydelta 6117 f4e5 - tya 6118 f4e5 - lsr 6119 f4e5 - lsr 6120 f4e5 - sta mousecodey1 6121 f4e5 - txa 6122 f4e5 - ; ...then the X... 6123 f4e5 - and #%00000011 6124 f4e5 - tax 6125 f4e5 - endif ; !MOUSEXONLY 6126 f4e5 - 6127 f4e5 - asl 6128 f4e5 - asl 6129 f4e5 - ora mousecodex1 6130 f4e5 - tay 6131 f4e5 - lda rotationalcompare,y 6132 f4e5 - adc mousexdelta ; carry was clear by previous ASL 6133 f4e5 - sta mousexdelta 6134 f4e5 - stx mousecodex1 6135 f4e5 -mouse1loopcondition 6136 f4e5 - lda TIMINT 6137 f4e5 - bpl mouse1updateloop 6138 f4e5 - 6139 f4e5 - ; *** adapt to selected device resolution. 6140 f4e5 - ldx port1control 6141 f4e5 - 6142 f4e5 - ifconst PRECISIONMOUSING 6143 f4e5 - ldy port1resolution 6144 f4e5 - bne mouse1halveddone 6145 f4e5 - cpx #6 ; half-resolution is no good for driving wheels 6146 f4e5 - beq mouse1halveddone 6147 f4e5 - ; resolution=0 is half mouse resolution, necessary for precision 6148 f4e5 - ; mousing on a 160x240 screen with a 1000 dpi mouse. 6149 f4e5 - 6150 f4e5 - lda mousexdelta 6151 f4e5 - cmp #$80 6152 f4e5 - ror ; do a signed divide by 2. 6153 f4e5 - clc 6154 f4e5 - adc mousex1 6155 f4e5 - sta mousex1 6156 f4e5 - ifnconst MOUSEXONLY 6157 f4e5 - lda mouseydelta 6158 f4e5 - clc 6159 f4e5 - adc mousey1 6160 f4e5 - sta mousey1 6161 f4e5 - endif 6162 f4e5 - ; at half resolution we just exit after updating x and y 6163 f4e5 - jmp LLRET1 6164 f4e5 -mouse1halveddone 6165 f4e5 - endif ; PRECISIONMOUSING 6166 f4e5 - 6167 f4e5 - ifnconst MOUSEXONLY 6168 f4e5 - asl mouseydelta ; *2 because Y resolution is finer 6169 f4e5 - ldy port1resolution 6170 f4e5 - dey 6171 f4e5 - lda #0 6172 f4e5 -mousey1resolutionfix 6173 f4e5 - clc 6174 f4e5 - adc mouseydelta 6175 f4e5 - dey 6176 f4e5 - bpl mousey1resolutionfix 6177 f4e5 - clc 6178 f4e5 - adc mousey1 6179 f4e5 - sta mousey1 6180 f4e5 - endif ; MOUSEXONLY 6181 f4e5 - 6182 f4e5 - ldy port1resolution 6183 f4e5 - dey 6184 f4e5 - lda #0 6185 f4e5 -mousex1resolutionfix 6186 f4e5 - clc 6187 f4e5 - adc mousexdelta 6188 f4e5 - dey 6189 f4e5 - bpl mousex1resolutionfix 6190 f4e5 - ifnconst DRIVINGBOOST 6191 f4e5 - clc 6192 f4e5 - adc mousex1 6193 f4e5 - sta mousex1 6194 f4e5 - else 6195 f4e5 - cpx #6 6196 f4e5 - beq carryonmouse1boost 6197 f4e5 - clc 6198 f4e5 - adc mousex1 6199 f4e5 - sta mousex1 6200 f4e5 - jmp LLRET1 6201 f4e5 -carryonmouse1boost 6202 f4e5 - sta mousexdelta 6203 f4e5 - clc 6204 f4e5 - adc mousecodey1 6205 f4e5 - sta mousecodey1 6206 f4e5 - clc 6207 f4e5 - adc mousex1 6208 f4e5 - tay ; save the target X 6209 f4e5 - adc mousey1 ; average in the smoothly-trailing X 6210 f4e5 - ror 6211 f4e5 - sta mousex1 ; mousex0 now has the smoothly trailing X 6212 f4e5 - sty mousey1 ; and mousey0 has the the target X 6213 f4e5 - 6214 f4e5 - ; check to see if the coordinate wrapped. If so, undo the averaging code. 6215 f4e5 - ; A has mousex1, the smoothly trailing X 6216 f4e5 - sbc mousey1 ; less the target X 6217 f4e5 - bpl skipabsolutedrive1 6218 f4e5 - eor #$ff 6219 f4e5 -skipabsolutedrive1 6220 f4e5 - cmp #64 ; just an unreasonably large change 6221 f4e5 - bcc skipdrivewrapfix1 6222 f4e5 - sty mousex1 ; if X wrapped, we catch the trailing X up to the target X 6223 f4e5 -skipdrivewrapfix1 6224 f4e5 - 6225 f4e5 - ; get rid of the tweening if the distance travelled was very small 6226 f4e5 - lda mousexdelta 6227 f4e5 - cmp port1resolution 6228 f4e5 - bcs skipbetweenfix1 6229 f4e5 - lda mousex1 6230 f4e5 - sta mousey1 6231 f4e5 -skipbetweenfix1 6232 f4e5 - 6233 f4e5 -drivingboostreductioncheck1 6234 f4e5 - ; The below code amounts to mousecodey0=mousecodey0-(mousecodey0/8) 6235 f4e5 - ; +ve mousecodey0 is converted to -ve to do the calculation, and then 6236 f4e5 - ; negated again because truncation during BCD math results in 6237 f4e5 - ; differing magnitudes, depending if the value is +ve or -ve. 6238 f4e5 -driving1fix 6239 f4e5 - lax mousecodey1 6240 f4e5 - cmp #$80 6241 f4e5 - bcs driving0skipnegate1 6242 f4e5 - eor #$FF 6243 f4e5 - adc #1 6244 f4e5 - sta mousecodey1 6245 f4e5 -driving0skipnegate1 6246 f4e5 - cmp #$80 6247 f4e5 - ror 6248 f4e5 - cmp #$80 6249 f4e5 - ror 6250 f4e5 - cmp #$80 6251 f4e5 - ror 6252 f4e5 - sta inttemp1 6253 f4e5 - lda mousecodey1 6254 f4e5 - sec 6255 f4e5 - sbc inttemp1 6256 f4e5 - cpx #$80 6257 f4e5 - bcs driving1skipnegate2 6258 f4e5 - eor #$FF 6259 f4e5 - adc #1 6260 f4e5 -driving1skipnegate2 6261 f4e5 - sta mousecodey1 6262 f4e5 -drivingboostdone1 6263 f4e5 - endif ; DRIVINGBOOST 6264 f4e5 - 6265 f4e5 - jmp LLRET1 6266 f4e5 - 6267 f4e5 endif ; MOUSE1SUPPORT 6268 f4e5 6269 f4e5 6270 f4e5 trakball0update 6271 f4e5 - ifconst TRAKBALL0SUPPORT 6272 f4e5 - ifnconst TRAKTIME 6273 f4e5 - ifnconst TRAKXONLY 6274 f4e5 - lda #180 ; minimum for x+y 6275 f4e5 - else ; !TRAKXONLY 6276 f4e5 - lda #100 ; minimum for just x 6277 f4e5 - endif ; !TRAKXONLY 6278 f4e5 - else ; !TRAKTIME 6279 f4e5 - lda #TRAKTIME 6280 f4e5 - endif ; !TRAKTIME 6281 f4e5 - jsr SETTIM64T ; INTIM is in Y 6282 f4e5 - ldx #0 6283 f4e5 - ifnconst TRAKXONLY 6284 f4e5 - ldy #0 6285 f4e5 - endif ; TRAKXONLY 6286 f4e5 -trakball0updateloop 6287 f4e5 - lda SWCHA 6288 f4e5 - and #%00110000 6289 f4e5 - cmp trakballcodex0 6290 f4e5 - sta trakballcodex0 6291 f4e5 - beq trakball0movementXdone 6292 f4e5 - and #%00010000 6293 f4e5 - beq trakball0negativeX 6294 f4e5 -trakball0positiveX 6295 f4e5 - ;(2 from beq) 6296 f4e5 - inx ; 2 6297 f4e5 - jmp trakball0movementXdone ; 3 6298 f4e5 -trakball0negativeX 6299 f4e5 - ;(3 from beq) 6300 f4e5 - dex ; 2 6301 f4e5 - nop ; 2 6302 f4e5 -trakball0movementXdone 6303 f4e5 - 6304 f4e5 - ifnconst TRAKXONLY 6305 f4e5 - lda SWCHA 6306 f4e5 - and #%11000000 6307 f4e5 - cmp trakballcodey0 6308 f4e5 - sta trakballcodey0 6309 f4e5 - beq trakball0movementYdone 6310 f4e5 - and #%01000000 6311 f4e5 - beq trakball0negativeY 6312 f4e5 -trakball0positiveY 6313 f4e5 - ;(2 from beq) 6314 f4e5 - iny ; 2 6315 f4e5 - jmp trakball0movementYdone ; 3 6316 f4e5 -trakball0negativeY 6317 f4e5 - ;(3 from beq) 6318 f4e5 - dey ; 2 6319 f4e5 - nop ; 2 6320 f4e5 -trakball0movementYdone 6321 f4e5 - endif ; !TRAKXONLY 6322 f4e5 - 6323 f4e5 - lda TIMINT 6324 f4e5 - bpl trakball0updateloop 6325 f4e5 - lda #0 6326 f4e5 - cpx #0 6327 f4e5 - beq trakball0skipXadjust 6328 f4e5 - clc 6329 f4e5 -trakball0Xloop 6330 f4e5 - adc port0resolution 6331 f4e5 - dex 6332 f4e5 - bne trakball0Xloop 6333 f4e5 - clc 6334 f4e5 - adc trakballx0 6335 f4e5 - sta trakballx0 6336 f4e5 -trakball0skipXadjust 6337 f4e5 - ifnconst TRAKXONLY 6338 f4e5 - lda #0 6339 f4e5 - cpy #0 6340 f4e5 - beq trakball0skipYadjust 6341 f4e5 - clc 6342 f4e5 -trakball0yloop 6343 f4e5 - adc port0resolution 6344 f4e5 - dey 6345 f4e5 - bne trakball0yloop 6346 f4e5 - clc 6347 f4e5 - adc trakbally0 6348 f4e5 - sta trakbally0 6349 f4e5 -trakball0skipYadjust 6350 f4e5 - endif ; !TRAKXONLY 6351 f4e5 - 6352 f4e5 - jmp LLRET0 6353 f4e5 endif 6354 f4e5 6355 f4e5 6356 f4e5 6357 f4e5 trakball1update 6358 f4e5 - ifconst TRAKBALL1SUPPORT 6359 f4e5 - ifnconst TRAKTIME 6360 f4e5 - ifnconst TRAKXONLY 6361 f4e5 - lda #180 ; minimum for x+y 6362 f4e5 - else ; !TRAKXONLY 6363 f4e5 - lda #100 ; minimum for just x 6364 f4e5 - endif ; !TRAKXONLY 6365 f4e5 - else ; !TRAKTIME 6366 f4e5 - lda #TRAKTIME 6367 f4e5 - endif ; !TRAKTIME 6368 f4e5 - jsr SETTIM64T ; INTIM is in Y 6369 f4e5 - ldx #0 6370 f4e5 - ifnconst TRAKXONLY 6371 f4e5 - ldy #0 6372 f4e5 - endif ; TRAKXONLY 6373 f4e5 -trakball1updateloop 6374 f4e5 - lda SWCHA 6375 f4e5 - and #%00000011 6376 f4e5 - cmp trakballcodex1 6377 f4e5 - sta trakballcodex1 6378 f4e5 - beq trakball1movementXdone 6379 f4e5 - and #%00000001 6380 f4e5 - beq trakball1negativeX 6381 f4e5 -trakball1positiveX 6382 f4e5 - ;(2 from beq) 6383 f4e5 - inx ; 2 6384 f4e5 - jmp trakball1movementXdone ; 3 6385 f4e5 -trakball1negativeX 6386 f4e5 - ;(3 from beq) 6387 f4e5 - dex ; 2 6388 f4e5 - nop ; 2 6389 f4e5 -trakball1movementXdone 6390 f4e5 - 6391 f4e5 - ifnconst TRAKXONLY 6392 f4e5 - lda SWCHA 6393 f4e5 - and #%00001100 6394 f4e5 - cmp trakballcodey1 6395 f4e5 - sta trakballcodey1 6396 f4e5 - beq trakball1movementYdone 6397 f4e5 - and #%00000100 6398 f4e5 - beq trakball1negativeY 6399 f4e5 -trakball1positiveY 6400 f4e5 - ;(2 from beq) 6401 f4e5 - iny ; 2 6402 f4e5 - jmp trakball1movementYdone ; 3 6403 f4e5 -trakball1negativeY 6404 f4e5 - ;(3 from beq) 6405 f4e5 - dey ; 2 6406 f4e5 - nop ; 2 6407 f4e5 -trakball1movementYdone 6408 f4e5 - endif ; !TRAKXONLY 6409 f4e5 - 6410 f4e5 - lda TIMINT 6411 f4e5 - bpl trakball1updateloop 6412 f4e5 - lda #0 6413 f4e5 - cpx #0 6414 f4e5 - beq trakball1skipXadjust 6415 f4e5 - clc 6416 f4e5 -trakball1Xloop 6417 f4e5 - adc port1resolution 6418 f4e5 - dex 6419 f4e5 - bne trakball1Xloop 6420 f4e5 - clc 6421 f4e5 - adc trakballx1 6422 f4e5 - sta trakballx1 6423 f4e5 -trakball1skipXadjust 6424 f4e5 - ifnconst TRAKXONLY 6425 f4e5 - lda #0 6426 f4e5 - cpy #0 6427 f4e5 - beq trakball1skipYadjust 6428 f4e5 - clc 6429 f4e5 -trakball1yloop 6430 f4e5 - adc port1resolution 6431 f4e5 - dey 6432 f4e5 - bne trakball1yloop 6433 f4e5 - clc 6434 f4e5 - adc trakbally1 6435 f4e5 - sta trakbally1 6436 f4e5 -trakball1skipYadjust 6437 f4e5 - endif ; !TRAKXONLY 6438 f4e5 - 6439 f4e5 - jmp LLRET1 6440 f4e5 endif 6441 f4e5 6442 f4e5 6443 f4e5 paddleport0update 6444 f4e5 - ifconst PADDLE0SUPPORT 6445 f4e5 - lda #6 6446 f4e5 - sta VBLANK ; start charging the paddle caps 6447 f4e5 - lda #0 ; use PADDLE timing 6448 f4e5 - jsr SETTIM64T ; INTIM is in Y 6449 f4e5 - 6450 f4e5 -paddleport0updateloop 6451 f4e5 - lda INPT0 6452 f4e5 - bmi skippaddle0setposition 6453 f4e5 - sty paddleposition0 6454 f4e5 -skippaddle0setposition 6455 f4e5 - ifconst TWOPADDLESUPPORT 6456 f4e5 - lda INPT1 6457 f4e5 - bmi skippaddle1setposition 6458 f4e5 - sty paddleposition1 6459 f4e5 -skippaddle1setposition 6460 f4e5 - endif 6461 f4e5 - ldy INTIM 6462 f4e5 - cpy #TIMEOFFSET 6463 f4e5 - bcs paddleport0updateloop 6464 f4e5 - 6465 f4e5 - lda #%10000110 6466 f4e5 - sta VBLANK ; dump paddles to ground... this may not be great for genesis controllers 6467 f4e5 - sec 6468 f4e5 - lda paddleposition0 6469 f4e5 - sbc #TIMEOFFSET 6470 f4e5 - ifconst PADDLESCALEX2 6471 f4e5 - asl 6472 f4e5 - endif 6473 f4e5 - 6474 f4e5 - ifnconst PADDLESMOOTHINGOFF 6475 f4e5 - clc 6476 f4e5 - adc paddleprevious0 6477 f4e5 - ror 6478 f4e5 - sta paddleprevious0 6479 f4e5 - endif 6480 f4e5 - 6481 f4e5 - sta paddleposition0 6482 f4e5 - 6483 f4e5 - ifconst TWOPADDLESUPPORT 6484 f4e5 - sec 6485 f4e5 - lda paddleposition1 6486 f4e5 - sbc #TIMEOFFSET 6487 f4e5 - ifconst PADDLESCALEX2 6488 f4e5 - asl 6489 f4e5 - endif 6490 f4e5 - 6491 f4e5 - ifnconst PADDLESMOOTHINGOFF 6492 f4e5 - clc 6493 f4e5 - adc paddleprevious1 6494 f4e5 - ror 6495 f4e5 - sta paddleprevious1 6496 f4e5 - endif 6497 f4e5 - sta paddleposition1 6498 f4e5 - endif ; TWOPADDLESUPPORT 6499 f4e5 - 6500 f4e5 - jmp LLRET0 6501 f4e5 endif 6502 f4e5 6503 f4e5 paddleport1update 6504 f4e5 - ifconst PADDLE1SUPPORT 6505 f4e5 - lda #6 6506 f4e5 - sta VBLANK ; start charging the paddle caps 6507 f4e5 - 6508 f4e5 - lda #0 ; use PADDLE timing 6509 f4e5 - jsr SETTIM64T ; INTIM is in Y 6510 f4e5 - 6511 f4e5 -paddleport1updateloop 6512 f4e5 - lda INPT2 6513 f4e5 - bmi skippaddle2setposition 6514 f4e5 - sty paddleposition2 6515 f4e5 -skippaddle2setposition 6516 f4e5 - ifconst TWOPADDLESUPPORT 6517 f4e5 - lda INPT3 6518 f4e5 - bmi skippaddle3setposition 6519 f4e5 - sty paddleposition3 6520 f4e5 -skippaddle3setposition 6521 f4e5 - endif 6522 f4e5 - ldy INTIM 6523 f4e5 - cpy #TIMEOFFSET 6524 f4e5 - bcs paddleport1updateloop 6525 f4e5 - 6526 f4e5 - lda #%10000110 6527 f4e5 - sta VBLANK ; dump paddles to ground... this may not be great for genesis controllers 6528 f4e5 - sec 6529 f4e5 - lda paddleposition2 6530 f4e5 - sbc #TIMEOFFSET 6531 f4e5 - ifconst PADDLESCALEX2 6532 f4e5 - asl 6533 f4e5 - endif 6534 f4e5 - 6535 f4e5 - ifnconst PADDLESMOOTHINGOFF 6536 f4e5 - clc 6537 f4e5 - adc paddleprevious2 6538 f4e5 - ror 6539 f4e5 - sta paddleprevious2 6540 f4e5 - endif 6541 f4e5 - 6542 f4e5 - sta paddleposition2 6543 f4e5 - 6544 f4e5 - ifconst TWOPADDLESUPPORT 6545 f4e5 - sec 6546 f4e5 - lda paddleposition3 6547 f4e5 - sbc #TIMEOFFSET 6548 f4e5 - ifconst PADDLESCALEX2 6549 f4e5 - asl 6550 f4e5 - endif 6551 f4e5 - 6552 f4e5 - ifnconst PADDLESMOOTHINGOFF 6553 f4e5 - clc 6554 f4e5 - adc paddleprevious3 6555 f4e5 - ror 6556 f4e5 - sta paddleprevious3 6557 f4e5 - endif 6558 f4e5 - sta paddleposition3 6559 f4e5 - endif ; TWOPADDLESUPPORT 6560 f4e5 - 6561 f4e5 - jmp LLRET1 6562 f4e5 endif 6563 f4e5 6564 f4e5 6565 f4e5 paddlebuttonhandler ; outside of conditional, for button-handler LUT 6566 f4e5 - ifconst PADDLESUPPORT 6567 f4e5 - ; x=0|1 for port, rather than paddle #. 6568 f4e5 - ; Only the first paddle button will integrate into "joy0fire" testing. If the 6569 f4e5 - ; game wants to support 2 paddles, up to the game to instead test the 6570 f4e5 - ; joystick right+left directions instead. 6571 f4e5 - lda SWCHA ; top of nibble is first paddle button 6572 f4e5 - cpx #0 ; port 0? 6573 f4e5 - beq skippaddleport2shift 6574 f4e5 - asl ; shift second port to upper nibble 6575 f4e5 - asl 6576 f4e5 - asl 6577 f4e5 - asl 6578 f4e5 -skippaddleport2shift 6579 f4e5 - and #%10000000 6580 f4e5 - eor #%10000000 ; invert 6581 f4e5 - sta sINPT1,x 6582 f4e5 - jmp buttonreadloopreturn 6583 f4e5 endif ; PADDLESUPPORT 6584 f4e5 6585 f4e5 mousebuttonhandler ; outside of conditional, for button-handler LUT 6586 f4e5 - ifconst MOUSESUPPORT 6587 f4e5 - ; stick the mouse buttons in the correct shadow register... 6588 f4e5 - txa 6589 f4e5 - asl 6590 f4e5 - tay ; y=x*2 6591 f4e5 - lda INPT4,x 6592 f4e5 - eor #%10000000 6593 f4e5 - lsr 6594 f4e5 - sta sINPT1,x 6595 f4e5 - 6596 f4e5 - lda INPT1,y 6597 f4e5 - and #%10000000 6598 f4e5 - eor #%10000000 6599 f4e5 - ora sINPT1,x 6600 f4e5 - sta sINPT1,x 6601 f4e5 - jmp buttonreadloopreturn 6602 f4e5 endif ; MOUSESUPPORT 6603 f4e5 6604 f4e5 - ifconst KEYPADSUPPORT 6605 f4e5 - ; ** select keypad rows 0 to 3 over 4 frames... 6606 f4e5 -keypadrowselect 6607 f4e5 - ldy #0 6608 f4e5 - lda port0control 6609 f4e5 - cmp #7 6610 f4e5 - bne skipport0val 6611 f4e5 - iny ; y=y+1 6612 f4e5 -skipport0val 6613 f4e5 - lda port1control 6614 f4e5 - cmp #7 6615 f4e5 - bne skipport1val 6616 f4e5 - iny 6617 f4e5 - iny ; y=y+2 6618 f4e5 -skipport1val 6619 f4e5 - lda keyrowdirectionmask,y 6620 f4e5 - sta CTLSWA 6621 f4e5 - tya 6622 f4e5 - asl 6623 f4e5 - asl 6624 f4e5 - sta inttemp1 6625 f4e5 - lda framecounter 6626 f4e5 - and #3 6627 f4e5 - ora inttemp1 6628 f4e5 - tax 6629 f4e5 - lda keyrowselectvalue,x 6630 f4e5 - sta SWCHA 6631 f4e5 - rts 6632 f4e5 - 6633 f4e5 -keyrowdirectionmask 6634 f4e5 - .byte #%00000000 ; 0 : port0=input port1=input 6635 f4e5 - .byte #%11110000 ; 1 : port0=output port1=input 6636 f4e5 - .byte #%00001111 ; 2 : port0=input port1=output 6637 f4e5 - .byte #%11111111 ; 3 : port0=output port1=output 6638 f4e5 - 6639 f4e5 -keyrowselectvalue 6640 f4e5 - .byte #%00000000, #%00000000, #%00000000, #%00000000 ; no row selected, all pins high, always 6641 f4e5 - .byte #%11100000, #%11010000, #%10110000, #%01110000 ; p0 keypad in 6642 f4e5 - .byte #%00001110, #%00001101, #%00001011, #%00000111 ; p1 keypad in 6643 f4e5 - .byte #%11101110, #%11011101, #%10111011, #%01110111 ; p0+p1 keypads in 6644 f4e5 endif ; KEYPADSUPPORT 6645 f4e5 6646 f4e5 - ifconst KEYPADSUPPORT 6647 f4e5 - ; TODO - split into compile-time KEYPAD0SUPPORT and KEYPAD1SUPPORT 6648 f4e5 -keypadcolumnread 6649 f4e5 - lda port0control 6650 f4e5 - cmp #7 6651 f4e5 - bne skipkeypadcolumnread0 6652 f4e5 - lda framecounter 6653 f4e5 - and #3 6654 f4e5 - asl ; x2 because keypad variables are interleaved 6655 f4e5 - tax 6656 f4e5 - lda #0 6657 f4e5 - sta keypadmatrix0a,x 6658 f4e5 - lda INPT0 6659 f4e5 - cmp #$80 6660 f4e5 - rol keypadmatrix0a,x 6661 f4e5 - lda INPT1 6662 f4e5 - cmp #$80 6663 f4e5 - rol keypadmatrix0a,x 6664 f4e5 - lda INPT4 6665 f4e5 - cmp #$80 6666 f4e5 - rol keypadmatrix0a,x 6667 f4e5 - lda keypadmatrix0a,x 6668 f4e5 - eor #%00000111 6669 f4e5 - sta keypadmatrix0a,x 6670 f4e5 -skipkeypadcolumnread0 6671 f4e5 - 6672 f4e5 - lda port1control 6673 f4e5 - cmp #7 6674 f4e5 - bne skipkeypadcolumnread1 6675 f4e5 - lda framecounter 6676 f4e5 - and #3 6677 f4e5 - asl ; x2 because keypad variables are interleaved 6678 f4e5 - tax 6679 f4e5 - lda #0 6680 f4e5 - sta keypadmatrix1a,x 6681 f4e5 - rol keypadmatrix1a,x 6682 f4e5 - lda INPT2 6683 f4e5 - cmp #$80 6684 f4e5 - rol keypadmatrix1a,x 6685 f4e5 - lda INPT3 6686 f4e5 - cmp #$80 6687 f4e5 - rol keypadmatrix1a,x 6688 f4e5 - lda INPT5 6689 f4e5 - cmp #$80 6690 f4e5 - rol keypadmatrix1a,x 6691 f4e5 - lda keypadmatrix1a,x 6692 f4e5 - eor #%00000111 6693 f4e5 - sta keypadmatrix1a,x 6694 f4e5 -skipkeypadcolumnread1 6695 f4e5 - rts 6696 f4e5 endif ; KEYPADSUPPORT 6697 f4e5 6698 f4e5 setportforinput 6699 f4e5 a5 e4 lda CTLSWAs 6700 f4e7 3d f0 f4 and allpinsinputlut,x 6701 f4ea 85 e4 sta CTLSWAs 6702 f4ec 8d 81 02 sta CTLSWA 6703 f4ef 60 rts 6704 f4f0 6705 f4f0 allpinsinputlut 6706 f4f0 0f f0 .byte.b $0F, $F0 6707 f4f2 6708 f4f2 setonebuttonmode 6709 f4f2 a9 06 lda #6 ; in case we're in unlocked-bios mode 6710 f4f4 85 01 sta VBLANK ; if we were on paddles, the line is grounded out. 6711 f4f6 a9 14 lda #$14 6712 f4f8 8d 83 02 sta CTLSWB ; set both 2-button disable bits to writable 6713 f4fb a5 e5 lda CTLSWBs 6714 f4fd 1d 06 f5 ora thisjoy2buttonbit,x 6715 f500 85 e5 sta CTLSWBs 6716 f502 8d 82 02 sta SWCHB ; turn off the 2-button disable bits 6717 f505 60 rts 6718 f506 6719 f506 thisjoy2buttonbit 6720 f506 04 10 .byte.b $04, $10 6721 f508 6722 f508 settwobuttonmode 6723 f508 a9 06 lda #6 ; in case we're in unlocked-bios mode 6724 f50a 85 01 sta VBLANK ; if we were on paddles, the line is grounded out. 6725 f50c a9 14 lda #$14 6726 f50e 8d 83 02 sta CTLSWB ; set both 2-button disable bits to writable 6727 f511 a5 e5 lda CTLSWBs 6728 f513 3d 1c f5 and thisjoy2buttonmask,x 6729 f516 85 e5 sta CTLSWBs 6730 f518 8d 82 02 sta SWCHB 6731 f51b 60 rts 6732 f51c 6733 f51c thisjoy2buttonmask 6734 f51c fb ef .byte.b $fb, $ef 6735 f51e 6736 f51e ; Provided under the CC0 license. See the included LICENSE.txt for details. 6737 f51e 6738 f51e START 6739 f51e start 6740 f51e 6741 f51e ;******** more or less the Atari recommended startup procedure 6742 f51e 6743 f51e 78 sei 6744 f51f d8 cld 6745 f520 6746 f520 ifnconst NOTIALOCK 6747 f520 a9 07 lda #$07 6748 f522 - else 6749 f522 - lda #$06 6750 f522 endif 6751 f522 85 01 sta INPTCTRL ;lock 7800 into 7800 mode 6752 f524 a9 7f lda #$7F 6753 f526 85 3c sta CTRL ;disable DMA 6754 f528 a9 00 lda #$00 6755 f52a 85 38 sta OFFSET 6756 f52c ifnconst NOTIALOCK 6757 f52c 85 01 sta INPTCTRL 6758 f52e 85 20 sta BACKGRND ; black default, in case a flash cart is using something else 6759 f530 endif 6760 f530 a2 ff ldx #$FF 6761 f532 9a txs 6762 f533 6763 f533 ;************** Clear Memory 6764 f533 6765 f533 a2 40 ldx #$40 6766 f535 a9 00 lda #$00 6767 f537 crloop1 6768 f537 95 00 sta $00,x ;Clear zero page 6769 f539 9d 00 01 sta $100,x ;Clear page 1 6770 f53c e8 inx 6771 f53d d0 f8 bne crloop1 6772 f53f 6773 f53f 6774 f53f a0 00 ldy #$00 ;Clear Ram 6775 f541 a9 18 lda #$18 ;Start at $1800 6776 f543 85 81 sta $81 6777 f545 a9 00 lda #$00 6778 f547 85 80 sta $80 6779 f549 crloop3 6780 f549 a9 00 lda #$00 6781 f54b 91 80 sta ($80),y ;Store data 6782 f54d c8 iny ;Next byte 6783 f54e d0 f9 bne crloop3 ;Branch if not done page 6784 f550 e6 81 inc $81 ;Next page 6785 f552 a5 81 lda $81 6786 f554 c9 20 cmp #$20 ;End at $1FFF 6787 f556 d0 f1 bne crloop3 ;Branch if not 6788 f558 6789 f558 a0 00 ldy #$00 ;Clear Ram 6790 f55a a9 22 lda #$22 ;Start at $2200 6791 f55c 85 81 sta $81 6792 f55e a9 00 lda #$00 6793 f560 85 80 sta $80 6794 f562 crloop4 6795 f562 a9 00 lda #$00 6796 f564 91 80 sta ($80),y ;Store data 6797 f566 c8 iny ;Next byte 6798 f567 d0 f9 bne crloop4 ;Branch if not done page 6799 f569 e6 81 inc $81 ;Next page 6800 f56b a5 81 lda $81 6801 f56d c9 27 cmp #$27 ;End at $27FF 6802 f56f d0 f1 bne crloop4 ;Branch if not 6803 f571 6804 f571 a2 00 ldx #$00 6805 f573 a9 00 lda #$00 6806 f575 crloop5 ;Clear 2100-213F, 2000-203F 6807 f575 9d 00 20 sta $2000,x 6808 f578 9d 00 21 sta $2100,x 6809 f57b e8 inx 6810 f57c e0 40 cpx #$40 6811 f57e d0 f5 bne crloop5 6812 f580 6813 f580 85 80 sta $80 6814 f582 85 81 sta $81 6815 f584 85 82 sta $82 6816 f586 85 83 sta $83 6817 f588 6818 f588 ;seed random number with hopefully-random timer value 6819 f588 a9 01 lda #1 6820 f58a 0d 84 02 ora INTIM 6821 f58d 85 40 sta rand 6822 f58f 6823 f58f ; detect the console type... 6824 f58f pndetectvblankstart 6825 f58f a5 28 lda MSTAT 6826 f591 10 fc bpl pndetectvblankstart ; if we're not in VBLANK, wait for it to start 6827 f593 pndetectvblankover 6828 f593 a5 28 lda MSTAT 6829 f595 30 fc bmi pndetectvblankover ; then wait for it to be over 6830 f597 a0 00 ldy #$00 6831 f599 a2 00 ldx #$00 6832 f59b pndetectvblankhappening 6833 f59b a5 28 lda MSTAT 6834 f59d 30 07 bmi pndetectinvblank ; if VBLANK starts, exit our counting loop 6835 f59f 85 24 sta WSYNC 6836 f5a1 85 24 sta WSYNC 6837 f5a3 e8 inx 6838 f5a4 d0 f5 bne pndetectvblankhappening 6839 f5a6 pndetectinvblank 6840 f5a6 e0 7d cpx #125 6841 f5a8 90 02 bcc pndetecispal 6842 f5aa a0 01 ldy #$01 6843 f5ac pndetecispal 6844 f5ac 8c 09 21 sty paldetected 6845 f5af 6846 f5af 20 4b f4 jsr createallgamedlls 6847 f5b2 6848 f5b2 a9 18 lda #>DLLMEM 6849 f5b4 85 2c sta DPPH 6850 f5b6 a9 00 lda # 255 7045 f5e1 -DOUBLEBUFFEROFFSET = 255 7046 f5e1 else 7047 f5e1 00 9d DOUBLEBUFFEROFFSET = (DLLASTOBJ+2) 7048 f5e1 endif 7049 f5e1 7050 f5e1 - ifconst EXTRADLMEMORY 7051 f5e1 -SECONDDLHALFSTART SET $2300 7052 f5e1 endif 7053 f5e1 7054 f5e1 DLPOINTH 7055 f5e1 DLINDEX SET 0 7056 f5e1 REPEAT WZONECOUNT 7057 f5e1 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 7058 f5e1 - ifconst EXTRADLMEMORY 7059 f5e1 - if TMPMEMADDRESS > $1FFF 7060 f5e1 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 7061 f5e1 - else 7062 f5e1 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 7063 f5e1 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 7064 f5e1 -SECONDDLHALFSTART SET TMPMEMADDRESS 7065 f5e1 - endif 7066 f5e1 - endif ; TMPMEMADDRESS > $1FFF 7067 f5e1 endif ; EXTRADLMEMORY 7068 f5e1 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 7069 f5e1 18 .byte.b >TMPMEMADDRESS 7070 f5e1 DLINDEX SET DLINDEX + 1 7056 f5e1 REPEND 7057 f5e1 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 7058 f5e2 - ifconst EXTRADLMEMORY 7059 f5e2 - if TMPMEMADDRESS > $1FFF 7060 f5e2 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 7061 f5e2 - else 7062 f5e2 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 7063 f5e2 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 7064 f5e2 -SECONDDLHALFSTART SET TMPMEMADDRESS 7065 f5e2 - endif 7066 f5e2 - endif ; TMPMEMADDRESS > $1FFF 7067 f5e2 endif ; EXTRADLMEMORY 7068 f5e2 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 7069 f5e2 19 .byte.b >TMPMEMADDRESS 7070 f5e2 DLINDEX SET DLINDEX + 1 7056 f5e2 REPEND 7057 f5e2 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 7058 f5e3 - ifconst EXTRADLMEMORY 7059 f5e3 - if TMPMEMADDRESS > $1FFF 7060 f5e3 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 7061 f5e3 - else 7062 f5e3 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 7063 f5e3 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 7064 f5e3 -SECONDDLHALFSTART SET TMPMEMADDRESS 7065 f5e3 - endif 7066 f5e3 - endif ; TMPMEMADDRESS > $1FFF 7067 f5e3 endif ; EXTRADLMEMORY 7068 f5e3 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 7069 f5e3 19 .byte.b >TMPMEMADDRESS 7070 f5e3 DLINDEX SET DLINDEX + 1 7056 f5e3 REPEND 7057 f5e3 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 7058 f5e4 - ifconst EXTRADLMEMORY 7059 f5e4 - if TMPMEMADDRESS > $1FFF 7060 f5e4 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 7061 f5e4 - else 7062 f5e4 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 7063 f5e4 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 7064 f5e4 -SECONDDLHALFSTART SET TMPMEMADDRESS 7065 f5e4 - endif 7066 f5e4 - endif ; TMPMEMADDRESS > $1FFF 7067 f5e4 endif ; EXTRADLMEMORY 7068 f5e4 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 7069 f5e4 1a .byte.b >TMPMEMADDRESS 7070 f5e4 DLINDEX SET DLINDEX + 1 7056 f5e4 REPEND 7057 f5e4 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 7058 f5e5 - ifconst EXTRADLMEMORY 7059 f5e5 - if TMPMEMADDRESS > $1FFF 7060 f5e5 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 7061 f5e5 - else 7062 f5e5 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 7063 f5e5 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 7064 f5e5 -SECONDDLHALFSTART SET TMPMEMADDRESS 7065 f5e5 - endif 7066 f5e5 - endif ; TMPMEMADDRESS > $1FFF 7067 f5e5 endif ; EXTRADLMEMORY 7068 f5e5 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 7069 f5e5 1b .byte.b >TMPMEMADDRESS 7070 f5e5 DLINDEX SET DLINDEX + 1 7056 f5e5 REPEND 7057 f5e5 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 7058 f5e6 - ifconst EXTRADLMEMORY 7059 f5e6 - if TMPMEMADDRESS > $1FFF 7060 f5e6 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 7061 f5e6 - else 7062 f5e6 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 7063 f5e6 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 7064 f5e6 -SECONDDLHALFSTART SET TMPMEMADDRESS 7065 f5e6 - endif 7066 f5e6 - endif ; TMPMEMADDRESS > $1FFF 7067 f5e6 endif ; EXTRADLMEMORY 7068 f5e6 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 7069 f5e6 1b .byte.b >TMPMEMADDRESS 7070 f5e6 DLINDEX SET DLINDEX + 1 7056 f5e6 REPEND 7057 f5e6 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 7058 f5e7 - ifconst EXTRADLMEMORY 7059 f5e7 - if TMPMEMADDRESS > $1FFF 7060 f5e7 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 7061 f5e7 - else 7062 f5e7 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 7063 f5e7 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 7064 f5e7 -SECONDDLHALFSTART SET TMPMEMADDRESS 7065 f5e7 - endif 7066 f5e7 - endif ; TMPMEMADDRESS > $1FFF 7067 f5e7 endif ; EXTRADLMEMORY 7068 f5e7 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 7069 f5e7 1c .byte.b >TMPMEMADDRESS 7070 f5e7 DLINDEX SET DLINDEX + 1 7056 f5e7 REPEND 7057 f5e7 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 7058 f5e8 - ifconst EXTRADLMEMORY 7059 f5e8 - if TMPMEMADDRESS > $1FFF 7060 f5e8 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 7061 f5e8 - else 7062 f5e8 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 7063 f5e8 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 7064 f5e8 -SECONDDLHALFSTART SET TMPMEMADDRESS 7065 f5e8 - endif 7066 f5e8 - endif ; TMPMEMADDRESS > $1FFF 7067 f5e8 endif ; EXTRADLMEMORY 7068 f5e8 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 7069 f5e8 1c .byte.b >TMPMEMADDRESS 7070 f5e8 DLINDEX SET DLINDEX + 1 7056 f5e8 REPEND 7057 f5e8 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 7058 f5e9 - ifconst EXTRADLMEMORY 7059 f5e9 - if TMPMEMADDRESS > $1FFF 7060 f5e9 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 7061 f5e9 - else 7062 f5e9 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 7063 f5e9 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 7064 f5e9 -SECONDDLHALFSTART SET TMPMEMADDRESS 7065 f5e9 - endif 7066 f5e9 - endif ; TMPMEMADDRESS > $1FFF 7067 f5e9 endif ; EXTRADLMEMORY 7068 f5e9 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 7069 f5e9 1d .byte.b >TMPMEMADDRESS 7070 f5e9 DLINDEX SET DLINDEX + 1 7056 f5e9 REPEND 7057 f5e9 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 7058 f5ea - ifconst EXTRADLMEMORY 7059 f5ea - if TMPMEMADDRESS > $1FFF 7060 f5ea -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 7061 f5ea - else 7062 f5ea - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 7063 f5ea -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 7064 f5ea -SECONDDLHALFSTART SET TMPMEMADDRESS 7065 f5ea - endif 7066 f5ea - endif ; TMPMEMADDRESS > $1FFF 7067 f5ea endif ; EXTRADLMEMORY 7068 f5ea ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 7069 f5ea 1e .byte.b >TMPMEMADDRESS 7070 f5ea DLINDEX SET DLINDEX + 1 7056 f5ea REPEND 7057 f5ea TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 7058 f5eb - ifconst EXTRADLMEMORY 7059 f5eb - if TMPMEMADDRESS > $1FFF 7060 f5eb -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 7061 f5eb - else 7062 f5eb - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 7063 f5eb -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 7064 f5eb -SECONDDLHALFSTART SET TMPMEMADDRESS 7065 f5eb - endif 7066 f5eb - endif ; TMPMEMADDRESS > $1FFF 7067 f5eb endif ; EXTRADLMEMORY 7068 f5eb ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 7069 f5eb 1e .byte.b >TMPMEMADDRESS 7070 f5eb DLINDEX SET DLINDEX + 1 7056 f5eb REPEND 7057 f5eb TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 7058 f5ec - ifconst EXTRADLMEMORY 7059 f5ec - if TMPMEMADDRESS > $1FFF 7060 f5ec -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 7061 f5ec - else 7062 f5ec - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 7063 f5ec -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 7064 f5ec -SECONDDLHALFSTART SET TMPMEMADDRESS 7065 f5ec - endif 7066 f5ec - endif ; TMPMEMADDRESS > $1FFF 7067 f5ec endif ; EXTRADLMEMORY 7068 f5ec ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 7069 f5ec 1f .byte.b >TMPMEMADDRESS 7070 f5ec DLINDEX SET DLINDEX + 1 7071 f5ed REPEND 7072 f5ed 7073 f5ed - ifconst EXTRADLMEMORY 7074 f5ed - echo " ",[SECONDDLHALFSTART],"to",[$27FF],"was claimed as extra DL memory." 7075 f5ed endif 7076 f5ed 7077 f5ed 7078 f5ed DLPOINTL 7079 f5ed DLINDEX SET 0 7080 f5ed REPEAT WZONECOUNT 7081 f5ed TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 7082 f5ed - ifconst EXTRADLMEMORY 7083 f5ed - if TMPMEMADDRESS > $1FFF 7084 f5ed -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 7085 f5ed - else 7086 f5ed - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 7087 f5ed -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 7088 f5ed - endif 7089 f5ed - endif ; TMPMEMADDRESS > $1FFF 7090 f5ed endif ; EXTRADLMEMORY 7091 f5ed 80 .byte.b $1FFF 7084 f5ee -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 7085 f5ee - else 7086 f5ee - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 7087 f5ee -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 7088 f5ee - endif 7089 f5ee - endif ; TMPMEMADDRESS > $1FFF 7090 f5ee endif ; EXTRADLMEMORY 7091 f5ee 20 .byte.b $1FFF 7084 f5ef -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 7085 f5ef - else 7086 f5ef - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 7087 f5ef -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 7088 f5ef - endif 7089 f5ef - endif ; TMPMEMADDRESS > $1FFF 7090 f5ef endif ; EXTRADLMEMORY 7091 f5ef c0 .byte.b $1FFF 7084 f5f0 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 7085 f5f0 - else 7086 f5f0 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 7087 f5f0 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 7088 f5f0 - endif 7089 f5f0 - endif ; TMPMEMADDRESS > $1FFF 7090 f5f0 endif ; EXTRADLMEMORY 7091 f5f0 60 .byte.b $1FFF 7084 f5f1 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 7085 f5f1 - else 7086 f5f1 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 7087 f5f1 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 7088 f5f1 - endif 7089 f5f1 - endif ; TMPMEMADDRESS > $1FFF 7090 f5f1 endif ; EXTRADLMEMORY 7091 f5f1 00 .byte.b $1FFF 7084 f5f2 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 7085 f5f2 - else 7086 f5f2 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 7087 f5f2 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 7088 f5f2 - endif 7089 f5f2 - endif ; TMPMEMADDRESS > $1FFF 7090 f5f2 endif ; EXTRADLMEMORY 7091 f5f2 a0 .byte.b $1FFF 7084 f5f3 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 7085 f5f3 - else 7086 f5f3 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 7087 f5f3 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 7088 f5f3 - endif 7089 f5f3 - endif ; TMPMEMADDRESS > $1FFF 7090 f5f3 endif ; EXTRADLMEMORY 7091 f5f3 40 .byte.b $1FFF 7084 f5f4 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 7085 f5f4 - else 7086 f5f4 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 7087 f5f4 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 7088 f5f4 - endif 7089 f5f4 - endif ; TMPMEMADDRESS > $1FFF 7090 f5f4 endif ; EXTRADLMEMORY 7091 f5f4 e0 .byte.b $1FFF 7084 f5f5 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 7085 f5f5 - else 7086 f5f5 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 7087 f5f5 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 7088 f5f5 - endif 7089 f5f5 - endif ; TMPMEMADDRESS > $1FFF 7090 f5f5 endif ; EXTRADLMEMORY 7091 f5f5 80 .byte.b $1FFF 7084 f5f6 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 7085 f5f6 - else 7086 f5f6 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 7087 f5f6 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 7088 f5f6 - endif 7089 f5f6 - endif ; TMPMEMADDRESS > $1FFF 7090 f5f6 endif ; EXTRADLMEMORY 7091 f5f6 20 .byte.b $1FFF 7084 f5f7 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 7085 f5f7 - else 7086 f5f7 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 7087 f5f7 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 7088 f5f7 - endif 7089 f5f7 - endif ; TMPMEMADDRESS > $1FFF 7090 f5f7 endif ; EXTRADLMEMORY 7091 f5f7 c0 .byte.b $1FFF 7084 f5f8 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 7085 f5f8 - else 7086 f5f8 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 7087 f5f8 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 7088 f5f8 - endif 7089 f5f8 - endif ; TMPMEMADDRESS > $1FFF 7090 f5f8 endif ; EXTRADLMEMORY 7091 f5f8 60 .byte.b $1FFF 7101 f5f9 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 7102 f5f9 - else 7103 f5f9 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 7104 f5f9 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 7105 f5f9 - endif 7106 f5f9 - endif ; TMPMEMADDRESS > $1FFF 7107 f5f9 endif ; EXTRADLMEMORY 7108 f5f9 7109 f5f9 18 80 ZONE0ADDRESS = TMPMEMADDRESS 7110 f5f9 7111 f5f9 DLINDEX SET DLINDEX + 1 7097 f5f9 REPEND 7098 f5f9 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 7099 f5f9 - ifconst EXTRADLMEMORY 7100 f5f9 - if TMPMEMADDRESS > $1FFF 7101 f5f9 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 7102 f5f9 - else 7103 f5f9 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 7104 f5f9 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 7105 f5f9 - endif 7106 f5f9 - endif ; TMPMEMADDRESS > $1FFF 7107 f5f9 endif ; EXTRADLMEMORY 7108 f5f9 7109 f5f9 19 20 ZONE1ADDRESS = TMPMEMADDRESS 7110 f5f9 7111 f5f9 DLINDEX SET DLINDEX + 1 7097 f5f9 REPEND 7098 f5f9 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 7099 f5f9 - ifconst EXTRADLMEMORY 7100 f5f9 - if TMPMEMADDRESS > $1FFF 7101 f5f9 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 7102 f5f9 - else 7103 f5f9 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 7104 f5f9 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 7105 f5f9 - endif 7106 f5f9 - endif ; TMPMEMADDRESS > $1FFF 7107 f5f9 endif ; EXTRADLMEMORY 7108 f5f9 7109 f5f9 19 c0 ZONE2ADDRESS = TMPMEMADDRESS 7110 f5f9 7111 f5f9 DLINDEX SET DLINDEX + 1 7097 f5f9 REPEND 7098 f5f9 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 7099 f5f9 - ifconst EXTRADLMEMORY 7100 f5f9 - if TMPMEMADDRESS > $1FFF 7101 f5f9 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 7102 f5f9 - else 7103 f5f9 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 7104 f5f9 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 7105 f5f9 - endif 7106 f5f9 - endif ; TMPMEMADDRESS > $1FFF 7107 f5f9 endif ; EXTRADLMEMORY 7108 f5f9 7109 f5f9 1a 60 ZONE3ADDRESS = TMPMEMADDRESS 7110 f5f9 7111 f5f9 DLINDEX SET DLINDEX + 1 7097 f5f9 REPEND 7098 f5f9 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 7099 f5f9 - ifconst EXTRADLMEMORY 7100 f5f9 - if TMPMEMADDRESS > $1FFF 7101 f5f9 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 7102 f5f9 - else 7103 f5f9 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 7104 f5f9 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 7105 f5f9 - endif 7106 f5f9 - endif ; TMPMEMADDRESS > $1FFF 7107 f5f9 endif ; EXTRADLMEMORY 7108 f5f9 7109 f5f9 1b 00 ZONE4ADDRESS = TMPMEMADDRESS 7110 f5f9 7111 f5f9 DLINDEX SET DLINDEX + 1 7097 f5f9 REPEND 7098 f5f9 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 7099 f5f9 - ifconst EXTRADLMEMORY 7100 f5f9 - if TMPMEMADDRESS > $1FFF 7101 f5f9 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 7102 f5f9 - else 7103 f5f9 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 7104 f5f9 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 7105 f5f9 - endif 7106 f5f9 - endif ; TMPMEMADDRESS > $1FFF 7107 f5f9 endif ; EXTRADLMEMORY 7108 f5f9 7109 f5f9 1b a0 ZONE5ADDRESS = TMPMEMADDRESS 7110 f5f9 7111 f5f9 DLINDEX SET DLINDEX + 1 7097 f5f9 REPEND 7098 f5f9 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 7099 f5f9 - ifconst EXTRADLMEMORY 7100 f5f9 - if TMPMEMADDRESS > $1FFF 7101 f5f9 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 7102 f5f9 - else 7103 f5f9 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 7104 f5f9 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 7105 f5f9 - endif 7106 f5f9 - endif ; TMPMEMADDRESS > $1FFF 7107 f5f9 endif ; EXTRADLMEMORY 7108 f5f9 7109 f5f9 1c 40 ZONE6ADDRESS = TMPMEMADDRESS 7110 f5f9 7111 f5f9 DLINDEX SET DLINDEX + 1 7097 f5f9 REPEND 7098 f5f9 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 7099 f5f9 - ifconst EXTRADLMEMORY 7100 f5f9 - if TMPMEMADDRESS > $1FFF 7101 f5f9 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 7102 f5f9 - else 7103 f5f9 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 7104 f5f9 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 7105 f5f9 - endif 7106 f5f9 - endif ; TMPMEMADDRESS > $1FFF 7107 f5f9 endif ; EXTRADLMEMORY 7108 f5f9 7109 f5f9 1c e0 ZONE7ADDRESS = TMPMEMADDRESS 7110 f5f9 7111 f5f9 DLINDEX SET DLINDEX + 1 7097 f5f9 REPEND 7098 f5f9 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 7099 f5f9 - ifconst EXTRADLMEMORY 7100 f5f9 - if TMPMEMADDRESS > $1FFF 7101 f5f9 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 7102 f5f9 - else 7103 f5f9 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 7104 f5f9 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 7105 f5f9 - endif 7106 f5f9 - endif ; TMPMEMADDRESS > $1FFF 7107 f5f9 endif ; EXTRADLMEMORY 7108 f5f9 7109 f5f9 1d 80 ZONE8ADDRESS = TMPMEMADDRESS 7110 f5f9 7111 f5f9 DLINDEX SET DLINDEX + 1 7097 f5f9 REPEND 7098 f5f9 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 7099 f5f9 - ifconst EXTRADLMEMORY 7100 f5f9 - if TMPMEMADDRESS > $1FFF 7101 f5f9 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 7102 f5f9 - else 7103 f5f9 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 7104 f5f9 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 7105 f5f9 - endif 7106 f5f9 - endif ; TMPMEMADDRESS > $1FFF 7107 f5f9 endif ; EXTRADLMEMORY 7108 f5f9 7109 f5f9 1e 20 ZONE9ADDRESS = TMPMEMADDRESS 7110 f5f9 7111 f5f9 DLINDEX SET DLINDEX + 1 7097 f5f9 REPEND 7098 f5f9 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 7099 f5f9 - ifconst EXTRADLMEMORY 7100 f5f9 - if TMPMEMADDRESS > $1FFF 7101 f5f9 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 7102 f5f9 - else 7103 f5f9 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 7104 f5f9 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 7105 f5f9 - endif 7106 f5f9 - endif ; TMPMEMADDRESS > $1FFF 7107 f5f9 endif ; EXTRADLMEMORY 7108 f5f9 7109 f5f9 1e c0 ZONE10ADDRESS = TMPMEMADDRESS 7110 f5f9 7111 f5f9 DLINDEX SET DLINDEX + 1 7097 f5f9 REPEND 7098 f5f9 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 7099 f5f9 - ifconst EXTRADLMEMORY 7100 f5f9 - if TMPMEMADDRESS > $1FFF 7101 f5f9 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 7102 f5f9 - else 7103 f5f9 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 7104 f5f9 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 7105 f5f9 - endif 7106 f5f9 - endif ; TMPMEMADDRESS > $1FFF 7107 f5f9 endif ; EXTRADLMEMORY 7108 f5f9 7109 f5f9 1f 60 ZONE11ADDRESS = TMPMEMADDRESS 7110 f5f9 7111 f5f9 DLINDEX SET DLINDEX + 1 7112 f5f9 REPEND 7113 f5f9 7114 f5f9 $1880 to $1fff used as zone memory, allowing 31 display objects per zone. 7115 f5f9 echo " ",[WDLMEMSTART],"to",[WDLMEMEND],"used as zone memory, allowing",[(DLLASTOBJ/5)]d,"display objects per zone." 7116 f5f9 7117 f5f9 DLHEIGHT 7118 f5f9 REPEAT WZONECOUNT 7119 f5f9 0f .byte.b (WZONEHEIGHT-1) 7118 f5f9 REPEND 7119 f5fa 0f .byte.b (WZONEHEIGHT-1) 7118 f5fa REPEND 7119 f5fb 0f .byte.b (WZONEHEIGHT-1) 7118 f5fb REPEND 7119 f5fc 0f .byte.b (WZONEHEIGHT-1) 7118 f5fc REPEND 7119 f5fd 0f .byte.b (WZONEHEIGHT-1) 7118 f5fd REPEND 7119 f5fe 0f .byte.b (WZONEHEIGHT-1) 7118 f5fe REPEND 7119 f5ff 0f .byte.b (WZONEHEIGHT-1) 7118 f5ff REPEND 7119 f600 0f .byte.b (WZONEHEIGHT-1) 7118 f600 REPEND 7119 f601 0f .byte.b (WZONEHEIGHT-1) 7118 f601 REPEND 7119 f602 0f .byte.b (WZONEHEIGHT-1) 7118 f602 REPEND 7119 f603 0f .byte.b (WZONEHEIGHT-1) 7118 f603 REPEND 7119 f604 0f .byte.b (WZONEHEIGHT-1) 7120 f605 REPEND 7121 f605 7122 f605 ; Provided under the CC0 license. See the included LICENSE.txt for details. 7123 f605 7124 f605 ; a simple guard, than ensures the 7800basic code hasn't 7125 f605 ; spilled into the encryption area... 2425 bytes left in the 7800basic reserved area. 7126 f605 echo " ",($FF7E-*)d,"bytes left in the 7800basic reserved area." 7127 f605 - if (*>$FF7D) 7128 f605 - ERR ; abort the assembly 7129 f605 endif 7130 f605 ; Provided under the CC0 license. See the included LICENSE.txt for details. 7131 f605 7132 f605 - ifconst DEV 7133 f605 - ifnconst ZONEHEIGHT 7134 f605 - echo "* the 4k 7800basic area has",[($FF7E - *)]d,"bytes free." 7135 f605 - else 7136 f605 - if ZONEHEIGHT = 8 7137 f605 - echo "* the 4k 7800basic area has",[($FF7E - *)]d,"bytes free." 7138 f605 - else 7139 f605 - echo "* the 4k 7800basic area has",[($FF7E - *)]d,"bytes free." 7140 f605 - endif 7141 f605 - endif 7142 f605 endif 7143 f605 7144 f605 ; FF7E/FF7F contains the 7800basic crc checksum word 7145 f605 7146 f605 ; FF80 - FFF7 contains the 7800 encryption key 7147 f605 7148 f605 ifnconst bankswitchmode 7149 fff8 ORG $FFF8 7150 fff8 - else 7151 fff8 - ifconst ROM128K 7152 fff8 - ORG $27FF8 7153 fff8 - RORG $FFF8 7154 fff8 - endif 7155 fff8 - ifconst ROM144K 7156 fff8 - ORG $27FF8 7157 fff8 - RORG $FFF8 7158 fff8 - endif 7159 fff8 - ifconst ROM256K 7160 fff8 - ORG $47FF8 7161 fff8 - RORG $FFF8 7162 fff8 - endif 7163 fff8 - ifconst ROM272K 7164 fff8 - ORG $47FF8 7165 fff8 - RORG $FFF8 7166 fff8 - endif 7167 fff8 - ifconst ROM512K 7168 fff8 - ORG $87FF8 7169 fff8 - RORG $FFF8 7170 fff8 - endif 7171 fff8 - ifconst ROM528K 7172 fff8 - ORG $87FF8 7173 fff8 - RORG $FFF8 7174 fff8 - endif 7175 fff8 endif 7176 fff8 7177 fff8 7178 fff8 ff .byte.b $FF ; region verification. $FF=all regions 7179 fff9 f7 .byte.b $F7 ; high nibble: encryption check from $N000 to $FF7F. we only hash the last 4k for faster boot. 7180 fffa ; low nibble : N=7 atari rainbow start, N=3 no atari rainbow 7181 fffa 7182 fffa ;Vectors 7183 fffa 00 f0 .word.w NMI 7184 fffc 1e f5 .word.w START 7185 fffe 5f f0 .word.w IRQ 7186 10000