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