------- FILE c:\Users\Shane\Documents\my7800projects\Heofonfir\Game_over_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_gameover_v_mode = $00 4 28000 ???? 00 1e heofonfir_gameover_v_width_twoscompliment = $1e 5 28000 ???? 00 02 heofonfir_gameover_v_width = $02 6 28000 ???? 00 00 heofonfir_gameover_r_mode = $00 7 28000 ???? 00 1e heofonfir_gameover_r_width_twoscompliment = $1e 8 28000 ???? 00 02 heofonfir_gameover_r_width = $02 9 28000 ???? 00 00 heofonfir_gameover_o_mode = $00 10 28000 ???? 00 1e heofonfir_gameover_o_width_twoscompliment = $1e 11 28000 ???? 00 02 heofonfir_gameover_o_width = $02 12 28000 ???? 00 00 heofonfir_gameover_m_mode = $00 13 28000 ???? 00 1e heofonfir_gameover_m_width_twoscompliment = $1e 14 28000 ???? 00 02 heofonfir_gameover_m_width = $02 15 28000 ???? 00 00 heofonfir_gameover_g_mode = $00 16 28000 ???? 00 1e heofonfir_gameover_g_width_twoscompliment = $1e 17 28000 ???? 00 02 heofonfir_gameover_g_width = $02 18 28000 ???? 00 00 heofonfir_gameover_e_mode = $00 19 28000 ???? 00 1e heofonfir_gameover_e_width_twoscompliment = $1e 20 28000 ???? 00 02 heofonfir_gameover_e_width = $02 21 28000 ???? 00 00 heofonfir_gameover_a_mode = $00 22 28000 ???? 00 1e heofonfir_gameover_a_width_twoscompliment = $1e 23 28000 ???? 00 02 heofonfir_gameover_a_width = $02 24 28000 ???? 00 00 heofonfir_gameover_v_color3 = 0 25 28000 ???? 00 62 heofonfir_gameover_v_color2 = $62 26 28000 ???? 00 88 heofonfir_gameover_v_color1 = $88 27 28000 ???? 00 00 heofonfir_gameover_v_color0 = $00 28 28000 ???? 00 00 heofonfir_gameover_r_color3 = 0 29 28000 ???? 00 62 heofonfir_gameover_r_color2 = $62 30 28000 ???? 00 88 heofonfir_gameover_r_color1 = $88 31 28000 ???? 00 00 heofonfir_gameover_r_color0 = $00 32 28000 ???? 00 00 heofonfir_gameover_o_color3 = 0 33 28000 ???? 00 62 heofonfir_gameover_o_color2 = $62 34 28000 ???? 00 88 heofonfir_gameover_o_color1 = $88 35 28000 ???? 00 00 heofonfir_gameover_o_color0 = $00 36 28000 ???? 00 00 heofonfir_gameover_m_color3 = 0 37 28000 ???? 00 62 heofonfir_gameover_m_color2 = $62 38 28000 ???? 00 88 heofonfir_gameover_m_color1 = $88 39 28000 ???? 00 00 heofonfir_gameover_m_color0 = $00 40 28000 ???? 00 00 heofonfir_gameover_g_color3 = 0 41 28000 ???? 00 62 heofonfir_gameover_g_color2 = $62 42 28000 ???? 00 88 heofonfir_gameover_g_color1 = $88 43 28000 ???? 00 00 heofonfir_gameover_g_color0 = $00 44 28000 ???? 00 00 heofonfir_gameover_e_color3 = 0 45 28000 ???? 00 62 heofonfir_gameover_e_color2 = $62 46 28000 ???? 00 88 heofonfir_gameover_e_color1 = $88 47 28000 ???? 00 00 heofonfir_gameover_e_color0 = $00 48 28000 ???? 00 00 heofonfir_gameover_a_color3 = 0 49 28000 ???? 00 62 heofonfir_gameover_a_color2 = $62 50 28000 ???? 00 88 heofonfir_gameover_a_color1 = $88 51 28000 ???? 00 00 heofonfir_gameover_a_color0 = $00 52 28000 ???? 00 01 EXTRADLMEMORY = 1 53 28000 ???? 00 e0 SCREENHEIGHT = 224 54 28000 ???? 00 01 NTSC = 1 55 28000 ???? 00 01 CHECKOVERWRITE = 1 56 28000 ???? 00 10 ZONEHEIGHT = 16 57 28000 ???? 00 08 bankswitchmode = 8 58 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\Game_over_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_gameover_v_mode = $00 4 28000 ???? 00 1e heofonfir_gameover_v_width_twoscompliment = $1e 5 28000 ???? 00 02 heofonfir_gameover_v_width = $02 6 28000 ???? 00 00 heofonfir_gameover_r_mode = $00 7 28000 ???? 00 1e heofonfir_gameover_r_width_twoscompliment = $1e 8 28000 ???? 00 02 heofonfir_gameover_r_width = $02 9 28000 ???? 00 00 heofonfir_gameover_o_mode = $00 10 28000 ???? 00 1e heofonfir_gameover_o_width_twoscompliment = $1e 11 28000 ???? 00 02 heofonfir_gameover_o_width = $02 12 28000 ???? 00 00 heofonfir_gameover_m_mode = $00 13 28000 ???? 00 1e heofonfir_gameover_m_width_twoscompliment = $1e 14 28000 ???? 00 02 heofonfir_gameover_m_width = $02 15 28000 ???? 00 00 heofonfir_gameover_g_mode = $00 16 28000 ???? 00 1e heofonfir_gameover_g_width_twoscompliment = $1e 17 28000 ???? 00 02 heofonfir_gameover_g_width = $02 18 28000 ???? 00 00 heofonfir_gameover_e_mode = $00 19 28000 ???? 00 1e heofonfir_gameover_e_width_twoscompliment = $1e 20 28000 ???? 00 02 heofonfir_gameover_e_width = $02 21 28000 ???? 00 00 heofonfir_gameover_a_mode = $00 22 28000 ???? 00 1e heofonfir_gameover_a_width_twoscompliment = $1e 23 28000 ???? 00 02 heofonfir_gameover_a_width = $02 24 28000 ???? 00 00 heofonfir_gameover_v_color3 = 0 25 28000 ???? 00 62 heofonfir_gameover_v_color2 = $62 26 28000 ???? 00 88 heofonfir_gameover_v_color1 = $88 27 28000 ???? 00 00 heofonfir_gameover_v_color0 = $00 28 28000 ???? 00 00 heofonfir_gameover_r_color3 = 0 29 28000 ???? 00 62 heofonfir_gameover_r_color2 = $62 30 28000 ???? 00 88 heofonfir_gameover_r_color1 = $88 31 28000 ???? 00 00 heofonfir_gameover_r_color0 = $00 32 28000 ???? 00 00 heofonfir_gameover_o_color3 = 0 33 28000 ???? 00 62 heofonfir_gameover_o_color2 = $62 34 28000 ???? 00 88 heofonfir_gameover_o_color1 = $88 35 28000 ???? 00 00 heofonfir_gameover_o_color0 = $00 36 28000 ???? 00 00 heofonfir_gameover_m_color3 = 0 37 28000 ???? 00 62 heofonfir_gameover_m_color2 = $62 38 28000 ???? 00 88 heofonfir_gameover_m_color1 = $88 39 28000 ???? 00 00 heofonfir_gameover_m_color0 = $00 40 28000 ???? 00 00 heofonfir_gameover_g_color3 = 0 41 28000 ???? 00 62 heofonfir_gameover_g_color2 = $62 42 28000 ???? 00 88 heofonfir_gameover_g_color1 = $88 43 28000 ???? 00 00 heofonfir_gameover_g_color0 = $00 44 28000 ???? 00 00 heofonfir_gameover_e_color3 = 0 45 28000 ???? 00 62 heofonfir_gameover_e_color2 = $62 46 28000 ???? 00 88 heofonfir_gameover_e_color1 = $88 47 28000 ???? 00 00 heofonfir_gameover_e_color0 = $00 48 28000 ???? 00 00 heofonfir_gameover_a_color3 = 0 49 28000 ???? 00 62 heofonfir_gameover_a_color2 = $62 50 28000 ???? 00 88 heofonfir_gameover_a_color1 = $88 51 28000 ???? 00 00 heofonfir_gameover_a_color0 = $00 52 28000 ???? 00 01 EXTRADLMEMORY = 1 53 28000 ???? 00 e0 SCREENHEIGHT = 224 54 28000 ???? 00 01 NTSC = 1 55 28000 ???? 00 01 CHECKOVERWRITE = 1 56 28000 ???? 00 10 ZONEHEIGHT = 16 57 28000 ???? 00 08 bankswitchmode = 8 58 28000 ???? 00 01 ROM128K = 1 ------- FILE c:\Users\Shane\Documents\my7800projects\Heofonfir\Game_over_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 .L00 ;; set romsize 128k 664 8000 665 8000 .L01 ;; set zoneheight 16 666 8000 667 8000 .L02 ;; set basepath graphics 668 8000 669 8000 .L03 ;; set zoneprotection on 670 8000 671 8000 .L04 ;; set tv ntsc 672 8000 673 8000 .L05 ;; set screenheight 224 674 8000 675 8000 .L06 ;; set extradlmemory on 676 8000 677 8000 .L07 ;; displaymode 160A 678 8000 679 8000 a9 40 lda #%01000000 ;Enable DMA, mode=160x2/160x4 680 8002 85 3c sta CTRL 681 8004 682 8004 8d 07 21 sta sCTRL 683 8007 684 8007 . 685 8007 ;; 686 8007 687 8007 . 688 8007 ;; 689 8007 690 8007 .L08 ;; incgraphic heofonfir_gameover_a.png 160A 691 8007 692 8007 .L09 ;; incgraphic heofonfir_gameover_e.png 160A 693 8007 694 8007 .L010 ;; incgraphic heofonfir_gameover_g.png 160A 695 8007 696 8007 .L011 ;; incgraphic heofonfir_gameover_m.png 160A 697 8007 698 8007 .L012 ;; incgraphic heofonfir_gameover_o.png 160A 699 8007 700 8007 .L013 ;; incgraphic heofonfir_gameover_r.png 160A 701 8007 702 8007 .L014 ;; incgraphic heofonfir_gameover_v.png 160A 703 8007 704 8007 . 705 8007 ;; 706 8007 707 8007 .L015 ;; BACKGRND = $00 708 8007 709 8007 a9 00 LDA #$00 710 8009 85 20 STA BACKGRND 711 800b . 712 800b ;; 713 800b 714 800b .L016 ;; P0C1 = $F7 : P0C2 = $1C : P0C3 = $0F 715 800b 716 800b a9 f7 LDA #$F7 717 800d 85 21 STA P0C1 718 800f a9 1c LDA #$1C 719 8011 85 22 STA P0C2 720 8013 a9 0f LDA #$0F 721 8015 85 23 STA P0C3 722 8017 .L017 ;; P1C1 = $05 : P1C2 = $15 : P1C3 = $3D 723 8017 724 8017 a9 05 LDA #$05 725 8019 85 25 STA P1C1 726 801b a9 15 LDA #$15 727 801d 85 26 STA P1C2 728 801f a9 3d LDA #$3D 729 8021 85 27 STA P1C3 730 8023 .L018 ;; P2C1 = $90 : P2C2 = $96 : P2C3 = $AF 731 8023 732 8023 a9 90 LDA #$90 733 8025 85 29 STA P2C1 734 8027 a9 96 LDA #$96 735 8029 85 2a STA P2C2 736 802b a9 af LDA #$AF 737 802d 85 2b STA P2C3 738 802f .L019 ;; P3C1 = $77 : P3C2 = $7A : P3C3 = $6F 739 802f 740 802f a9 77 LDA #$77 741 8031 85 2d STA P3C1 742 8033 a9 7a LDA #$7A 743 8035 85 2e STA P3C2 744 8037 a9 6f LDA #$6F 745 8039 85 2f STA P3C3 746 803b .L020 ;; P4C1 = $E1 : P4C2 = $CA : P4C3 = $DD 747 803b 748 803b a9 e1 LDA #$E1 749 803d 85 31 STA P4C1 750 803f a9 ca LDA #$CA 751 8041 85 32 STA P4C2 752 8043 a9 dd LDA #$DD 753 8045 85 33 STA P4C3 754 8047 .L021 ;; P5C1 = $02 : P5C2 = $31 : P5C3 = $25 755 8047 756 8047 a9 02 LDA #$02 757 8049 85 35 STA P5C1 758 804b a9 31 LDA #$31 759 804d 85 36 STA P5C2 760 804f a9 25 LDA #$25 761 8051 85 37 STA P5C3 762 8053 .L022 ;; P6C1 = $07 : P6C2 = $0A : P6C3 = $0C 763 8053 764 8053 a9 07 LDA #$07 765 8055 85 39 STA P6C1 766 8057 a9 0a LDA #$0A 767 8059 85 3a STA P6C2 768 805b a9 0c LDA #$0C 769 805d 85 3b STA P6C3 770 805f .L023 ;; P7C1 = $78 : P7C2 = $50 : P7C3 = $64 771 805f 772 805f a9 78 LDA #$78 773 8061 85 3d STA P7C1 774 8063 a9 50 LDA #$50 775 8065 85 3e STA P7C2 776 8067 a9 64 LDA #$64 777 8069 85 3f STA P7C3 778 806b . 779 806b ;; 780 806b 781 806b . 782 806b ;; 783 806b 784 806b . 785 806b ;; 786 806b 787 806b . 788 806b ;; 789 806b 790 806b .L024 ;; plotsprite heofonfir_gameover_g 7 32 48 791 806b 792 806b a9 04 lda #heofonfir_gameover_g 796 8071 85 43 sta temp2 797 8073 798 8073 a9 fe lda #(224|heofonfir_gameover_g_width_twoscompliment) 799 8075 85 44 sta temp3 800 8077 801 8077 a9 20 lda #32 802 8079 85 45 sta temp4 803 807b 804 807b a9 30 lda #48 805 807d 806 807d 85 46 sta temp5 807 807f 808 807f a9 40 lda #(heofonfir_gameover_g_mode|%01000000) 809 8081 85 47 sta temp6 810 8083 811 8083 20 93 f2 jsr plotsprite 812 8086 .L025 ;; plotsprite heofonfir_gameover_a 7 40 48 813 8086 814 8086 a9 00 lda #heofonfir_gameover_a 818 808c 85 43 sta temp2 819 808e 820 808e a9 fe lda #(224|heofonfir_gameover_a_width_twoscompliment) 821 8090 85 44 sta temp3 822 8092 823 8092 a9 28 lda #40 824 8094 85 45 sta temp4 825 8096 826 8096 a9 30 lda #48 827 8098 828 8098 85 46 sta temp5 829 809a 830 809a a9 40 lda #(heofonfir_gameover_a_mode|%01000000) 831 809c 85 47 sta temp6 832 809e 833 809e 20 93 f2 jsr plotsprite 834 80a1 .L026 ;; plotsprite heofonfir_gameover_m 7 48 48 835 80a1 836 80a1 a9 06 lda #heofonfir_gameover_m 840 80a7 85 43 sta temp2 841 80a9 842 80a9 a9 fe lda #(224|heofonfir_gameover_m_width_twoscompliment) 843 80ab 85 44 sta temp3 844 80ad 845 80ad a9 30 lda #48 846 80af 85 45 sta temp4 847 80b1 848 80b1 a9 30 lda #48 849 80b3 850 80b3 85 46 sta temp5 851 80b5 852 80b5 a9 40 lda #(heofonfir_gameover_m_mode|%01000000) 853 80b7 85 47 sta temp6 854 80b9 855 80b9 20 93 f2 jsr plotsprite 856 80bc .L027 ;; plotsprite heofonfir_gameover_e 7 56 48 857 80bc 858 80bc a9 02 lda #heofonfir_gameover_e 862 80c2 85 43 sta temp2 863 80c4 864 80c4 a9 fe lda #(224|heofonfir_gameover_e_width_twoscompliment) 865 80c6 85 44 sta temp3 866 80c8 867 80c8 a9 38 lda #56 868 80ca 85 45 sta temp4 869 80cc 870 80cc a9 30 lda #48 871 80ce 872 80ce 85 46 sta temp5 873 80d0 874 80d0 a9 40 lda #(heofonfir_gameover_e_mode|%01000000) 875 80d2 85 47 sta temp6 876 80d4 877 80d4 20 93 f2 jsr plotsprite 878 80d7 .L028 ;; plotsprite heofonfir_gameover_o 7 80 48 879 80d7 880 80d7 a9 08 lda #heofonfir_gameover_o 884 80dd 85 43 sta temp2 885 80df 886 80df a9 fe lda #(224|heofonfir_gameover_o_width_twoscompliment) 887 80e1 85 44 sta temp3 888 80e3 889 80e3 a9 50 lda #80 890 80e5 85 45 sta temp4 891 80e7 892 80e7 a9 30 lda #48 893 80e9 894 80e9 85 46 sta temp5 895 80eb 896 80eb a9 40 lda #(heofonfir_gameover_o_mode|%01000000) 897 80ed 85 47 sta temp6 898 80ef 899 80ef 20 93 f2 jsr plotsprite 900 80f2 .L029 ;; plotsprite heofonfir_gameover_v 7 88 48 901 80f2 902 80f2 a9 0c lda #heofonfir_gameover_v 906 80f8 85 43 sta temp2 907 80fa 908 80fa a9 fe lda #(224|heofonfir_gameover_v_width_twoscompliment) 909 80fc 85 44 sta temp3 910 80fe 911 80fe a9 58 lda #88 912 8100 85 45 sta temp4 913 8102 914 8102 a9 30 lda #48 915 8104 916 8104 85 46 sta temp5 917 8106 918 8106 a9 40 lda #(heofonfir_gameover_v_mode|%01000000) 919 8108 85 47 sta temp6 920 810a 921 810a 20 93 f2 jsr plotsprite 922 810d .L030 ;; plotsprite heofonfir_gameover_e 7 96 48 923 810d 924 810d a9 02 lda #heofonfir_gameover_e 928 8113 85 43 sta temp2 929 8115 930 8115 a9 fe lda #(224|heofonfir_gameover_e_width_twoscompliment) 931 8117 85 44 sta temp3 932 8119 933 8119 a9 60 lda #96 934 811b 85 45 sta temp4 935 811d 936 811d a9 30 lda #48 937 811f 938 811f 85 46 sta temp5 939 8121 940 8121 a9 40 lda #(heofonfir_gameover_e_mode|%01000000) 941 8123 85 47 sta temp6 942 8125 943 8125 20 93 f2 jsr plotsprite 944 8128 .L031 ;; plotsprite heofonfir_gameover_r 7 104 48 945 8128 946 8128 a9 0a lda #heofonfir_gameover_r 950 812e 85 43 sta temp2 951 8130 952 8130 a9 fe lda #(224|heofonfir_gameover_r_width_twoscompliment) 953 8132 85 44 sta temp3 954 8134 955 8134 a9 68 lda #104 956 8136 85 45 sta temp4 957 8138 958 8138 a9 30 lda #48 959 813a 960 813a 85 46 sta temp5 961 813c 962 813c a9 40 lda #(heofonfir_gameover_r_mode|%01000000) 963 813e 85 47 sta temp6 964 8140 965 8140 20 93 f2 jsr plotsprite 966 8143 . 967 8143 ;; 968 8143 969 8143 .L032 ;; savescreen 970 8143 971 8143 20 a3 f0 jsr savescreen 972 8146 . 973 8146 ;; 974 8146 975 8146 ._mainloop 976 8146 ;; _mainloop 977 8146 978 8146 .L033 ;; clearscreen 979 8146 980 8146 20 7f f0 jsr clearscreen 981 8149 .L034 ;; restorescreen 982 8149 983 8149 20 91 f0 jsr restorescreen 984 814c .L035 ;; drawscreen 985 814c 986 814c 20 b3 f0 jsr drawscreen 987 814f .L036 ;; goto _mainloop 988 814f 4c 46 81 jmp ._mainloop 989 814f DMAHOLEEND0 SET . 990 8152 gameend 991 8152 DMAHOLEEND0 SET . 7854 bytes of ROM space left in the main area of bank 1. 992 8152 echo " ",[($A000 - .)]d , "bytes of ROM space left in the main area of bank 1." 993 8152 - if ($A000 - .) < 0 994 8152 -SPACEOVERFLOW SET (SPACEOVERFLOW+1) 995 8152 endif 996 8152 997 a000 ORG $A000,0 ; ************* 998 a000 999 a000 RORG $A000 ; ************* 1000 a000 1001 a000 heofonfir_gameover_a 1002 a000 00 00 HEX 0000 1003 a002 heofonfir_gameover_e 1004 a002 00 00 HEX 0000 1005 a004 heofonfir_gameover_g 1006 a004 00 00 HEX 0000 1007 a006 heofonfir_gameover_m 1008 a006 00 00 HEX 0000 1009 a008 heofonfir_gameover_o 1010 a008 00 00 HEX 0000 1011 a00a heofonfir_gameover_r 1012 a00a 00 00 HEX 0000 1013 a00c heofonfir_gameover_v 1014 a00c 00 00 HEX 0000 1015 a00e 1016 a100 ORG $A100,0 ; ************* 1017 a100 1018 a100 RORG $A100 ; ************* 1019 a100 1020 a100 ;heofonfir_gameover_a 1021 a100 2a aa HEX 2aaa 1022 a102 ;heofonfir_gameover_e 1023 a102 00 aa HEX 00aa 1024 a104 ;heofonfir_gameover_g 1025 a104 00 00 HEX 0000 1026 a106 ;heofonfir_gameover_m 1027 a106 20 02 HEX 2002 1028 a108 ;heofonfir_gameover_o 1029 a108 00 80 HEX 0080 1030 a10a ;heofonfir_gameover_r 1031 a10a 20 02 HEX 2002 1032 a10c ;heofonfir_gameover_v 1033 a10c 00 80 HEX 0080 1034 a10e 1035 a200 ORG $A200,0 ; ************* 1036 a200 1037 a200 RORG $A200 ; ************* 1038 a200 1039 a200 ;heofonfir_gameover_a 1040 a200 55 56 HEX 5556 1041 a202 ;heofonfir_gameover_e 1042 a202 01 54 HEX 0154 1043 a204 ;heofonfir_gameover_g 1044 a204 00 aa HEX 00aa 1045 a206 ;heofonfir_gameover_m 1046 a206 60 06 HEX 6006 1047 a208 ;heofonfir_gameover_o 1048 a208 01 80 HEX 0180 1049 a20a ;heofonfir_gameover_r 1050 a20a 60 04 HEX 6004 1051 a20c ;heofonfir_gameover_v 1052 a20c 01 80 HEX 0180 1053 a20e 1054 a300 ORG $A300,0 ; ************* 1055 a300 1056 a300 RORG $A300 ; ************* 1057 a300 1058 a300 ;heofonfir_gameover_a 1059 a300 60 06 HEX 6006 1060 a302 ;heofonfir_gameover_e 1061 a302 01 00 HEX 0100 1062 a304 ;heofonfir_gameover_g 1063 a304 01 56 HEX 0156 1064 a306 ;heofonfir_gameover_m 1065 a306 60 06 HEX 6006 1066 a308 ;heofonfir_gameover_o 1067 a308 01 20 HEX 0120 1068 a30a ;heofonfir_gameover_r 1069 a30a 60 10 HEX 6010 1070 a30c ;heofonfir_gameover_v 1071 a30c 01 80 HEX 0180 1072 a30e 1073 a400 ORG $A400,0 ; ************* 1074 a400 1075 a400 RORG $A400 ; ************* 1076 a400 1077 a400 ;heofonfir_gameover_a 1078 a400 60 06 HEX 6006 1079 a402 ;heofonfir_gameover_e 1080 a402 06 00 HEX 0600 1081 a404 ;heofonfir_gameover_g 1082 a404 06 06 HEX 0606 1083 a406 ;heofonfir_gameover_m 1084 a406 60 06 HEX 6006 1085 a408 ;heofonfir_gameover_o 1086 a408 06 60 HEX 0660 1087 a40a ;heofonfir_gameover_r 1088 a40a 60 40 HEX 6040 1089 a40c ;heofonfir_gameover_v 1090 a40c 01 80 HEX 0180 1091 a40e 1092 a500 ORG $A500,0 ; ************* 1093 a500 1094 a500 RORG $A500 ; ************* 1095 a500 1096 a500 ;heofonfir_gameover_a 1097 a500 60 06 HEX 6006 1098 a502 ;heofonfir_gameover_e 1099 a502 04 00 HEX 0400 1100 a504 ;heofonfir_gameover_g 1101 a504 04 06 HEX 0406 1102 a506 ;heofonfir_gameover_m 1103 a506 60 06 HEX 6006 1104 a508 ;heofonfir_gameover_o 1105 a508 04 48 HEX 0448 1106 a50a ;heofonfir_gameover_r 1107 a50a 61 00 HEX 6100 1108 a50c ;heofonfir_gameover_v 1109 a50c 01 20 HEX 0120 1110 a50e 1111 a600 ORG $A600,0 ; ************* 1112 a600 1113 a600 RORG $A600 ; ************* 1114 a600 1115 a600 ;heofonfir_gameover_a 1116 a600 48 04 HEX 4804 1117 a602 ;heofonfir_gameover_e 1118 a602 18 00 HEX 1800 1119 a604 ;heofonfir_gameover_g 1120 a604 18 06 HEX 1806 1121 a606 ;heofonfir_gameover_m 1122 a606 60 06 HEX 6006 1123 a608 ;heofonfir_gameover_o 1124 a608 18 18 HEX 1818 1125 a60a ;heofonfir_gameover_r 1126 a60a 64 00 HEX 6400 1127 a60c ;heofonfir_gameover_v 1128 a60c 06 60 HEX 0660 1129 a60e 1130 a700 ORG $A700,0 ; ************* 1131 a700 1132 a700 RORG $A700 ; ************* 1133 a700 1134 a700 ;heofonfir_gameover_a 1135 a700 18 18 HEX 1818 1136 a702 ;heofonfir_gameover_e 1137 a702 10 00 HEX 1000 1138 a704 ;heofonfir_gameover_g 1139 a704 10 06 HEX 1006 1140 a706 ;heofonfir_gameover_m 1141 a706 60 86 HEX 6086 1142 a708 ;heofonfir_gameover_o 1143 a708 10 12 HEX 1012 1144 a70a ;heofonfir_gameover_r 1145 a70a 52 00 HEX 5200 1146 a70c ;heofonfir_gameover_v 1147 a70c 06 60 HEX 0660 1148 a70e 1149 a800 ORG $A800,0 ; ************* 1150 a800 1151 a800 RORG $A800 ; ************* 1152 a800 1153 a800 ;heofonfir_gameover_a 1154 a800 18 18 HEX 1818 1155 a802 ;heofonfir_gameover_e 1156 a802 6a a0 HEX 6aa0 1157 a804 ;heofonfir_gameover_g 1158 a804 60 06 HEX 6006 1159 a806 ;heofonfir_gameover_m 1160 a806 61 86 HEX 6186 1161 a808 ;heofonfir_gameover_o 1162 a808 60 06 HEX 6006 1163 a80a ;heofonfir_gameover_r 1164 a80a 64 80 HEX 6480 1165 a80c ;heofonfir_gameover_v 1166 a80c 06 60 HEX 0660 1167 a80e 1168 a900 ORG $A900,0 ; ************* 1169 a900 1170 a900 RORG $A900 ; ************* 1171 a900 1172 a900 ;heofonfir_gameover_a 1173 a900 12 10 HEX 1210 1174 a902 ;heofonfir_gameover_e 1175 a902 55 40 HEX 5540 1176 a904 ;heofonfir_gameover_g 1177 a904 60 04 HEX 6004 1178 a906 ;heofonfir_gameover_m 1179 a906 61 26 HEX 6126 1180 a908 ;heofonfir_gameover_o 1181 a908 48 04 HEX 4804 1182 a90a ;heofonfir_gameover_r 1183 a90a 61 20 HEX 6120 1184 a90c ;heofonfir_gameover_v 1185 a90c 04 48 HEX 0448 1186 a90e 1187 aa00 ORG $AA00,0 ; ************* 1188 aa00 1189 aa00 RORG $AA00 ; ************* 1190 aa00 1191 aa00 ;heofonfir_gameover_a 1192 aa00 06 60 HEX 0660 1193 aa02 ;heofonfir_gameover_e 1194 aa02 48 00 HEX 4800 1195 aa04 ;heofonfir_gameover_g 1196 aa04 18 00 HEX 1800 1197 aa06 ;heofonfir_gameover_m 1198 aa06 66 66 HEX 6666 1199 aa08 ;heofonfir_gameover_o 1200 aa08 18 18 HEX 1818 1201 aa0a ;heofonfir_gameover_r 1202 aa0a 60 48 HEX 6048 1203 aa0c ;heofonfir_gameover_v 1204 aa0c 18 18 HEX 1818 1205 aa0e 1206 ab00 ORG $AB00,0 ; ************* 1207 ab00 1208 ab00 RORG $AB00 ; ************* 1209 ab00 1210 ab00 ;heofonfir_gameover_a 1211 ab00 06 60 HEX 0660 1212 ab02 ;heofonfir_gameover_e 1213 ab02 18 00 HEX 1800 1214 ab04 ;heofonfir_gameover_g 1215 ab04 18 00 HEX 1800 1216 ab06 ;heofonfir_gameover_m 1217 ab06 64 46 HEX 6446 1218 ab08 ;heofonfir_gameover_o 1219 ab08 12 10 HEX 1210 1220 ab0a ;heofonfir_gameover_r 1221 ab0a 60 12 HEX 6012 1222 ab0c ;heofonfir_gameover_v 1223 ab0c 18 18 HEX 1818 1224 ab0e 1225 ac00 ORG $AC00,0 ; ************* 1226 ac00 1227 ac00 RORG $AC00 ; ************* 1228 ac00 1229 ac00 ;heofonfir_gameover_a 1230 ac00 04 40 HEX 0440 1231 ac02 ;heofonfir_gameover_e 1232 ac02 12 00 HEX 1200 1233 ac04 ;heofonfir_gameover_g 1234 ac04 06 00 HEX 0600 1235 ac06 ;heofonfir_gameover_m 1236 ac06 58 16 HEX 5816 1237 ac08 ;heofonfir_gameover_o 1238 ac08 06 60 HEX 0660 1239 ac0a ;heofonfir_gameover_r 1240 ac0a 60 24 HEX 6024 1241 ac0c ;heofonfir_gameover_v 1242 ac0c 18 18 HEX 1818 1243 ac0e 1244 ad00 ORG $AD00,0 ; ************* 1245 ad00 1246 ad00 RORG $AD00 ; ************* 1247 ad00 1248 ad00 ;heofonfir_gameover_a 1249 ad00 01 80 HEX 0180 1250 ad02 ;heofonfir_gameover_e 1251 ad02 06 00 HEX 0600 1252 ad04 ;heofonfir_gameover_g 1253 ad04 06 00 HEX 0600 1254 ad06 ;heofonfir_gameover_m 1255 ad06 50 16 HEX 5016 1256 ad08 ;heofonfir_gameover_o 1257 ad08 04 40 HEX 0440 1258 ad0a ;heofonfir_gameover_r 1259 ad0a 62 50 HEX 6250 1260 ad0c ;heofonfir_gameover_v 1261 ad0c 10 12 HEX 1012 1262 ad0e 1263 ae00 ORG $AE00,0 ; ************* 1264 ae00 1265 ae00 RORG $AE00 ; ************* 1266 ae00 1267 ae00 ;heofonfir_gameover_a 1268 ae00 01 80 HEX 0180 1269 ae02 ;heofonfir_gameover_e 1270 ae02 04 aa HEX 04aa 1271 ae04 ;heofonfir_gameover_g 1272 ae04 01 aa HEX 01aa 1273 ae06 ;heofonfir_gameover_m 1274 ae06 60 06 HEX 6006 1275 ae08 ;heofonfir_gameover_o 1276 ae08 01 80 HEX 0180 1277 ae0a ;heofonfir_gameover_r 1278 ae0a 65 00 HEX 6500 1279 ae0c ;heofonfir_gameover_v 1280 ae0c 60 06 HEX 6006 1281 ae0e 1282 af00 ORG $AF00,0 ; ************* 1283 af00 1284 af00 RORG $AF00 ; ************* 1285 af00 1286 af00 ;heofonfir_gameover_a 1287 af00 01 00 HEX 0100 1288 af02 ;heofonfir_gameover_e 1289 af02 01 54 HEX 0154 1290 af04 ;heofonfir_gameover_g 1291 af04 01 54 HEX 0154 1292 af06 ;heofonfir_gameover_m 1293 af06 40 04 HEX 4004 1294 af08 ;heofonfir_gameover_o 1295 af08 01 00 HEX 0100 1296 af0a ;heofonfir_gameover_r 1297 af0a 50 00 HEX 5000 1298 af0c ;heofonfir_gameover_v 1299 af0c 40 04 HEX 4004 1300 af0e 1301 b000 ORG $B000,0 ; ************* 1302 b000 1303 b000 RORG $B000 ; ************* 1304 b000 - if SPACEOVERFLOW > 0 1305 b000 - echo "" 1306 b000 - echo "######## ERROR: space overflow detected in",[SPACEOVERFLOW]d,"areas." 1307 b000 - echo "######## look above for areas with negative ROM space left." 1308 b000 - echo "######## Aborting assembly." 1309 b000 - ERR 1310 b000 endif 1311 b000 1312 b000 1313 b000 ; Provided under the CC0 license. See the included LICENSE.txt for details. 1314 b000 1315 b000 - ifnconst bankswitchmode 1316 b000 - if ( * < $f000 ) 1317 b000 - ORG $F000 1318 b000 - endif 1319 b000 else 1320 b000 ifconst ROM128K 1321 b000 if ( * < $f000 ) 1322 27000 ORG $27000 1323 27000 RORG $F000 1324 27000 endif 1325 27000 endif 1326 27000 - ifconst ROM144K 1327 27000 - if ( * < $f000 ) 1328 27000 - ORG $27000 1329 27000 - RORG $F000 1330 27000 - endif 1331 27000 endif 1332 27000 - ifconst ROM256K 1333 27000 - if ( * < $f000 ) 1334 27000 - ORG $47000 1335 27000 - RORG $F000 1336 27000 - endif 1337 27000 endif 1338 27000 - ifconst ROM272K 1339 27000 - if ( * < $f000 ) 1340 27000 - ORG $47000 1341 27000 - RORG $F000 1342 27000 - endif 1343 27000 endif 1344 27000 - ifconst ROM512K 1345 27000 - if ( * < $f000 ) 1346 27000 - ORG $87000 1347 27000 - RORG $F000 1348 27000 - endif 1349 27000 endif 1350 27000 - ifconst ROM528K 1351 27000 - if ( * < $f000 ) 1352 27000 - ORG $87000 1353 27000 - RORG $F000 1354 27000 - endif 1355 27000 endif 1356 27000 endif 1357 27000 1358 27000 ; all of these "modules" have conditional clauses in them, so even though 1359 27000 ; they're always included here, they don't take up rom unless the user 1360 27000 ; explicitly enables support for the feature. 1361 27000 1362 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\Game_over_demo.bas.asm 1364 27000 endif 1365 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\Game_over_demo.bas.asm 1367 27000 endif 1368 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\Game_over_demo.bas.asm 1370 27000 endif 1371 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\Game_over_demo.bas.asm 1373 27000 endif 1374 27000 ; Provided under the CC0 license. See the included LICENSE.txt for details. 1375 27000 1376 27000 ;standard routimes needed for pretty much all games 1377 27000 1378 27000 ; some definitions used with "set debug color" 1379 27000 00 91 DEBUGCALC = $91 1380 27000 00 41 DEBUGWASTE = $41 1381 27000 00 c1 DEBUGDRAW = $C1 1382 27000 1383 27000 ;NMI and IRQ handlers 1384 27000 NMI 1385 27000 ;VISIBLEOVER is 255 while the screen is drawn, and 0 right after the visible screen is done. 1386 27000 48 pha ; save A 1387 27001 d8 cld 1388 27002 a5 4d lda visibleover 1389 27004 49 ff eor #255 1390 27006 85 4d sta visibleover 1391 27008 - ifconst DEBUGINTERRUPT 1392 27008 - and #$93 1393 27008 - sta BACKGRND 1394 27008 endif 1395 27008 8a txa ; save X 1396 27009 48 pha 1397 2700a 98 tya ; save Y 1398 2700b 48 pha 1399 2700c ce b2 01 dec interruptindex 1400 2700f d0 03 bne skipreallyoffvisible 1401 27011 4c 6b f0 jmp reallyoffvisible 1402 27014 skipreallyoffvisible 1403 27014 a5 4d lda visibleover 1404 27016 d0 03 bne carryontopscreenroutine 1405 27018 - ifconst .bottomscreenroutine 1406 27018 - lda interrupthold 1407 27018 - beq skipbottomroutine 1408 27018 - jsr .bottomscreenroutine 1409 27018 -skipbottomroutine 1410 27018 endif 1411 27018 4c 79 f0 jmp NMIexit 1412 2701b carryontopscreenroutine 1413 2701b - ifconst .topscreenroutine 1414 2701b - lda interrupthold 1415 2701b - beq skiptoproutine 1416 2701b - jsr .topscreenroutine 1417 2701b -skiptoproutine 1418 2701b endif 1419 2701b ifnconst CANARYOFF 1420 2701b ad c1 01 lda canary 1421 2701e f0 07 beq skipcanarytriggered 1422 27020 a9 45 lda #$45 1423 27022 85 20 sta BACKGRND 1424 27024 4c 63 f0 jmp skipbrkolorset ; common crash dump routine, if available 1425 27027 skipcanarytriggered 1426 27027 endif 1427 27027 1428 27027 ee 3e 21 inc frameslost ; this is balanced with a "dec frameslost" when drawscreen is called. 1429 2702a 1430 2702a ; ** Other important routines that need to regularly run, and can run onscreen. 1431 2702a ; ** Atarivox can't go here, because Maria might interrupt it while it's bit-banging. 1432 2702a 1433 2702a - ifconst LONGCONTROLLERREAD 1434 2702a -longcontrollerreads ; ** controllers that take a lot of time to read. We use much of the visible screen here. 1435 2702a - ldy port1control 1436 2702a - lda longreadtype,y 1437 2702a - beq LLRET1 1438 2702a - tay 1439 2702a - lda longreadroutinehiP1,y 1440 2702a - sta inttemp4 1441 2702a - lda longreadroutineloP1,y 1442 2702a - sta inttemp3 1443 2702a - jmp (inttemp3) 1444 2702a -LLRET1 1445 2702a - ldy port0control 1446 2702a - lda longreadtype,y 1447 2702a - beq LLRET0 1448 2702a - tay 1449 2702a - lda longreadroutinehiP0,y 1450 2702a - sta inttemp4 1451 2702a - lda longreadroutineloP0,y 1452 2702a - sta inttemp3 1453 2702a - jmp (inttemp3) 1454 2702a -LLRET0 1455 2702a - 1456 2702a - 1457 2702a - ifconst PADDLERANGE 1458 2702a -TIMEVAL = PADDLERANGE 1459 2702a - else 1460 2702a -TIMEVAL = 160 1461 2702a - endif 1462 2702a -TIMEOFFSET = 10 1463 2702a - 1464 2702a endif ; LONGCONTROLLERREAD 1465 2702a 1466 2702a 1467 2702a 20 d8 f1 jsr servicesfxchannels 1468 2702d - ifconst MUSICTRACKER 1469 2702d - jsr servicesong 1470 2702d endif ; MUSICTRACKER 1471 2702d 1472 2702d ee a4 01 inc framecounter 1473 27030 ad a4 01 lda framecounter 1474 27033 29 3f and #63 1475 27035 d0 08 bne skipcountdownseconds 1476 27037 ad a5 01 lda countdownseconds 1477 2703a f0 03 beq skipcountdownseconds 1478 2703c ce a5 01 dec countdownseconds 1479 2703f skipcountdownseconds 1480 2703f 1481 2703f a2 01 ldx #1 1482 27041 buttonreadloop 1483 27041 8a txa 1484 27042 48 pha 1485 27043 bc b7 01 ldy port0control,x 1486 27046 b9 bb f1 lda buttonhandlerlo,y 1487 27049 85 da sta inttemp3 1488 2704b b9 b0 f1 lda buttonhandlerhi,y 1489 2704e 85 db sta inttemp4 1490 27050 05 da ora inttemp3 1491 27052 f0 03 beq buttonreadloopreturn 1492 27054 6c da 00 jmp (inttemp3) 1493 27057 buttonreadloopreturn 1494 27057 68 pla 1495 27058 aa tax 1496 27059 ca dex 1497 2705a 10 e5 bpl buttonreadloop 1498 2705c 1499 2705c - ifconst KEYPADSUPPORT 1500 2705c - jsr keypadrowselect 1501 2705c endif ; KEYPADSUPPORT 1502 2705c 1503 2705c 1504 2705c - ifconst DOUBLEBUFFER 1505 2705c - lda doublebufferminimumframeindex 1506 2705c - beq skipdoublebufferminimumframeindexadjust 1507 2705c - dec doublebufferminimumframeindex 1508 2705c -skipdoublebufferminimumframeindexadjust 1509 2705c endif 1510 2705c 1511 2705c 4c 79 f0 jmp NMIexit 1512 2705f 1513 2705f IRQ ; the only source of non-nmi interrupt should be the BRK opcode. 1514 2705f ifnconst BREAKPROTECTOFF 1515 2705f a9 1a lda #$1A 1516 27061 85 20 sta BACKGRND 1517 27063 skipbrkolorset 1518 27063 skipbrkdetected 1519 27063 a9 60 lda #$60 1520 27065 8d 07 21 sta sCTRL 1521 27068 85 3c sta CTRL 1522 2706a ifnconst hiscorefont 1523 2706a 02 .byte.b $02 ; KIL/JAM 1524 2706b - else ; hiscorefont is present 1525 2706b - ifconst CRASHDUMP 1526 2706b - bit MSTAT 1527 2706b - bpl skipbrkdetected ; wait for vblank to ensure we're clear of NMI 1528 2706b - 1529 2706b - ifconst dumpbankswitch 1530 2706b - lda dumpbankswitch 1531 2706b - pha 1532 2706b - endif 1533 2706b - 1534 2706b - ; bankswitch if needed, to get to the hiscore font 1535 2706b - ifconst bankswitchmode 1536 2706b - ifconst included.hiscore.asm.bank 1537 2706b - ifconst MCPDEVCART 1538 2706b - lda #($18 | included.hiscore.asm.bank) 1539 2706b - sta $3000 1540 2706b - else 1541 2706b - lda #(included.hiscore.asm.bank) 1542 2706b - sta $8000 1543 2706b - endif 1544 2706b - endif ; included.hiscore.asm.bank 1545 2706b - endif ; bankswitchmode 1546 2706b - 1547 2706b - ifconst DOUBLEBUFFER 1548 2706b - ;turn off double-buffering, if on... 1549 2706b - lda #>DLLMEM 1550 2706b - sta DPPH 1551 2706b - lda #hiscorefont 1595 2706b - sta CHARBASE 1596 2706b - sta sCHARBASE 1597 2706b - lda #%01000011 ;Enable DMA, mode=320A 1598 2706b - sta CTRL 1599 2706b - sta sCTRL 1600 2706b - .byte $02 ; KIL/JAM 1601 2706b -hiscorehexlut 1602 2706b - ; 0 1 2 3 4 5 6 7 8 9 A B C D E F 1603 2706b - .byte 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 0, 1, 2, 3, 4, 5 1604 2706b -show2700 1605 2706b - ; lo mode hi width=29 x EODL 1606 2706b - .byte $00, %01100000, $27, 3, 20, 0,0,0 1607 2706b - else ; CRASHDUMP 1608 2706b - .byte $02 ; KIL/JAM 1609 2706b - endif ; crashdump 1610 2706b endif ; hiscorefont 1611 2706b - else 1612 2706b - RTI 1613 2706b endif 1614 2706b 1615 2706b - ifconst LONGCONTROLLERREAD 1616 2706b - 1617 2706b -longreadtype 1618 2706b - .byte 0, 0, 0, 1 ; NONE PROLINE LIGHTGUN PADDLE 1619 2706b - .byte 2, 0, 3, 0 ; TRKBALL VCSSTICK DRIVING KEYPAD 1620 2706b - .byte 3, 3, 0 ; STMOUSE AMOUSE ATARIVOX 1621 2706b - 1622 2706b -longreadroutineloP0 1623 2706b - .byte LLRET0 ; 0 = no routine 1630 2706b - .byte >paddleport0update ; 1 = paddle 1631 2706b - .byte >trakball0update ; 2 = trackball 1632 2706b - .byte >mouse0update ; 3 = mouse 1633 2706b - 1634 2706b -longreadroutineloP1 1635 2706b - .byte LLRET1 ; 0 = no routine 1642 2706b - .byte >paddleport1update ; 1 = paddle 1643 2706b - .byte >trakball1update ; 2 = trackball 1644 2706b - .byte >mouse1update ; 3 = mouse 1645 2706b - 1646 2706b - 1647 2706b -SETTIM64T 1648 2706b - bne skipdefaulttime 1649 2706b - ifnconst PADDLESMOOTHINGOFF 1650 2706b - lda #(TIMEVAL+TIMEOFFSET+1) 1651 2706b - else 1652 2706b - lda #(TIMEVAL+TIMEOFFSET) 1653 2706b - endif 1654 2706b -skipdefaulttime 1655 2706b - tay 1656 2706b - dey 1657 2706b -.setTIM64Tloop 1658 2706b - sta TIM64T 1659 2706b - cpy INTIM 1660 2706b - bne .setTIM64Tloop 1661 2706b - rts 1662 2706b endif ; LONGCONTROLLERREAD 1663 2706b 1664 2706b reallyoffvisible 1665 2706b 85 24 sta WSYNC 1666 2706d 1667 2706d a9 00 lda #0 1668 2706f 85 4d sta visibleover 1669 27071 - ifconst DEBUGINTERRUPT 1670 27071 - sta BACKGRND 1671 27071 endif 1672 27071 1673 27071 a9 03 lda #3 1674 27073 8d b2 01 sta interruptindex 1675 27076 1676 27076 20 52 f1 jsr uninterruptableroutines 1677 27079 1678 27079 - ifconst .userinterrupt 1679 27079 - lda interrupthold 1680 27079 - beq skipuserintroutine 1681 27079 - jsr .userinterrupt 1682 27079 -skipuserintroutine 1683 27079 endif 1684 27079 1685 27079 - ifconst KEYPADSUPPORT 1686 27079 - jsr keypadcolumnread 1687 27079 endif 1688 27079 1689 27079 NMIexit 1690 27079 68 pla 1691 2707a a8 tay 1692 2707b 68 pla 1693 2707c aa tax 1694 2707d 68 pla 1695 2707e 40 RTI 1696 2707f 1697 2707f clearscreen 1698 2707f a2 0d ldx #(WZONECOUNT-1) 1699 27081 a9 00 lda #0 1700 27083 clearscreenloop 1701 27083 95 65 sta dlend,x 1702 27085 ca dex 1703 27086 10 fb bpl clearscreenloop 1704 27088 a9 00 lda #0 1705 2708a 8d ad 01 sta valbufend ; clear the bcd value buffer 1706 2708d 8d ae 01 sta valbufendsave 1707 27090 60 rts 1708 27091 1709 27091 restorescreen 1710 27091 a2 0d ldx #(WZONECOUNT-1) 1711 27093 a9 00 lda #0 1712 27095 restorescreenloop 1713 27095 b5 82 lda dlendsave,x 1714 27097 95 65 sta dlend,x 1715 27099 ca dex 1716 2709a 10 f9 bpl restorescreenloop 1717 2709c ad ae 01 lda valbufendsave 1718 2709f 8d ad 01 sta valbufend 1719 270a2 60 rts 1720 270a3 1721 270a3 savescreen 1722 270a3 a2 0d ldx #(WZONECOUNT-1) 1723 270a5 savescreenloop 1724 270a5 b5 65 lda dlend,x 1725 270a7 95 82 sta dlendsave,x 1726 270a9 ca dex 1727 270aa 10 f9 bpl savescreenloop 1728 270ac ad ad 01 lda valbufend 1729 270af 8d ae 01 sta valbufendsave 1730 270b2 - ifconst DOUBLEBUFFER 1731 270b2 - lda doublebufferstate 1732 270b2 - beq savescreenrts 1733 270b2 - lda #1 1734 270b2 - sta doublebufferbufferdirty 1735 270b2 -savescreenrts 1736 270b2 endif ; DOUBLEBUFFER 1737 270b2 60 rts 1738 270b3 1739 270b3 drawscreen 1740 270b3 1741 270b3 - ifconst interrupthold 1742 270b3 - lda #$FF 1743 270b3 - sta interrupthold ; if the user called drawscreen, we're ready for interrupts 1744 270b3 endif 1745 270b3 1746 270b3 a9 00 lda #0 1747 270b5 85 42 sta temp1 ; not B&W if we're here... 1748 270b7 1749 270b7 drawscreenwait 1750 270b7 a5 4d lda visibleover 1751 270b9 d0 fc bne drawscreenwait ; make sure the visible screen isn't being drawn 1752 270bb 1753 270bb ;restore some registers in case the game changed them mid-screen... 1754 270bb ad 07 21 lda sCTRL 1755 270be 05 42 ora temp1 1756 270c0 85 3c sta CTRL 1757 270c2 ad 0b 21 lda sCHARBASE 1758 270c5 85 34 sta CHARBASE 1759 270c7 1760 270c7 ;ensure all of the display list is terminated... 1761 270c7 20 38 f1 jsr terminatedisplaylist 1762 270ca 1763 270ca ifnconst pauseroutineoff 1764 270ca 20 d5 f0 jsr pauseroutine 1765 270cd endif ; pauseroutineoff 1766 270cd 1767 270cd ; Make sure the visible screen has *started* before we exit. That way we can rely on drawscreen 1768 270cd ; delaying a full frame, but still allowing time for basic calculations. 1769 270cd visiblescreenstartedwait 1770 270cd a5 4d lda visibleover 1771 270cf f0 fc beq visiblescreenstartedwait 1772 270d1 visiblescreenstartedwaitdone 1773 270d1 ce 3e 21 dec frameslost ; ; this gets balanced with an "inc frameslost" by an NMI at the top of the screen 1774 270d4 60 rts 1775 270d5 1776 270d5 ifnconst pauseroutineoff 1777 270d5 ; check to see if pause was pressed and released 1778 270d5 pauseroutine 1779 270d5 ad b3 01 lda pausedisable 1780 270d8 d0 4e bne leavepauseroutine 1781 270da a9 08 lda #8 1782 270dc 2c 82 02 bit SWCHB 1783 270df f0 29 beq pausepressed 1784 270e1 1785 270e1 ifnconst SOFTRESETASPAUSEOFF 1786 270e1 ifnconst MOUSESUPPORT 1787 270e1 ifnconst TRAKBALLSUPPORT 1788 270e1 ad 80 02 lda SWCHA ; then check the soft "RESET" joysick code... 1789 270e4 29 70 and #%01110000 ; _LDU 1790 270e6 f0 22 beq pausepressed 1791 270e8 endif 1792 270e8 endif 1793 270e8 endif 1794 270e8 1795 270e8 ;pause isn't pressed 1796 270e8 a9 00 lda #0 1797 270ea 8d ac 01 sta pausebuttonflag ; clear pause hold state in case its set 1798 270ed 1799 270ed ;check if we're in an already paused state 1800 270ed ad 00 21 lda pausestate 1801 270f0 f0 36 beq leavepauseroutine ; nope, leave 1802 270f2 1803 270f2 c9 01 cmp #1 ; last frame was the start of pausing 1804 270f4 f0 2b beq enterpausestate2 ; move from state 1 to 2 1805 270f6 1806 270f6 c9 02 cmp #2 1807 270f8 f0 34 beq carryonpausing 1808 270fa 1809 270fa ;pausestate must be >2, which means we're ending an unpause 1810 270fa a9 00 lda #0 1811 270fc 8d ac 01 sta pausebuttonflag 1812 270ff 8d 00 21 sta pausestate 1813 27102 ad 07 21 lda sCTRL 1814 27105 85 3c sta CTRL 1815 27107 4c 28 f1 jmp leavepauseroutine 1816 2710a 1817 2710a pausepressed 1818 2710a ;pause is pressed 1819 2710a ad ac 01 lda pausebuttonflag 1820 2710d c9 ff cmp #$ff 1821 2710f f0 1d beq carryonpausing 1822 27111 1823 27111 ;its a new press, increment the state 1824 27111 ee 00 21 inc pausestate 1825 27114 1826 27114 ;silence volume at the start and end of pausing 1827 27114 a9 00 lda #0 1828 27116 85 19 sta AUDV0 1829 27118 85 1a sta AUDV1 1830 2711a 1831 2711a - ifconst pokeysupport 1832 2711a - ldy #7 1833 2711a -pausesilencepokeyaudioloop 1834 2711a - sta (pokeybase),y 1835 2711a - dey 1836 2711a - bpl pausesilencepokeyaudioloop 1837 2711a endif ; pokeysupport 1838 2711a 1839 2711a a9 ff lda #$ff 1840 2711c 8d ac 01 sta pausebuttonflag 1841 2711f d0 0d bne carryonpausing 1842 27121 1843 27121 enterpausestate2 1844 27121 a9 02 lda #2 1845 27123 8d 00 21 sta pausestate 1846 27126 d0 06 bne carryonpausing 1847 27128 leavepauseroutine 1848 27128 ad 07 21 lda sCTRL 1849 2712b 85 3c sta CTRL 1850 2712d 60 rts 1851 2712e carryonpausing 1852 2712e - ifconst .pause 1853 2712e - jsr .pause 1854 2712e endif ; .pause 1855 2712e ad 07 21 lda sCTRL 1856 27131 09 80 ora #%10000000 ; turn off colorburst during pause... 1857 27133 85 3c sta CTRL 1858 27135 4c d5 f0 jmp pauseroutine 1859 27138 endif ; pauseroutineoff 1860 27138 1861 27138 1862 27138 - ifconst DOUBLEBUFFER 1863 27138 -skipterminatedisplaylistreturn 1864 27138 - rts 1865 27138 endif ; DOUBLEBUFFER 1866 27138 terminatedisplaylist 1867 27138 - ifconst DOUBLEBUFFER 1868 27138 - lda doublebufferstate 1869 27138 - bne skipterminatedisplaylistreturn ; double-buffering runs it's own DL termination code 1870 27138 endif ; DOUBLEBUFFER 1871 27138 terminatedisplaybuffer 1872 27138 ;add DL end entry on each DL 1873 27138 a2 0d ldx #(WZONECOUNT-1) 1874 2713a dlendloop 1875 2713a bd da f5 lda DLPOINTL,x 1876 2713d - ifconst DOUBLEBUFFER 1877 2713d - clc 1878 2713d - adc doublebufferdloffset 1879 2713d endif ; DOUBLEBUFFER 1880 2713d 85 63 sta dlpnt 1881 2713f bd cc f5 lda DLPOINTH,x 1882 27142 - ifconst DOUBLEBUFFER 1883 27142 - adc #0 1884 27142 endif ; DOUBLEBUFFER 1885 27142 85 64 sta dlpnt+1 1886 27144 b4 65 ldy dlend,x 1887 27146 a9 00 lda #$00 1888 27148 dlendmoreloops 1889 27148 c8 iny 1890 27149 91 63 sta (dlpnt),y 1891 2714b - ifconst FRAMESKIPGLITCHFIXWEAK 1892 2714b - cpy #DLLASTOBJ+1 1893 2714b - beq dlendthiszonedone 1894 2714b - iny 1895 2714b - iny 1896 2714b - iny 1897 2714b - iny 1898 2714b - iny 1899 2714b - sta (dlpnt),y 1900 2714b -dlendthiszonedone 1901 2714b endif FRAMESKIPGLITCHFIXWEAK 1902 2714b - ifconst FRAMESKIPGLITCHFIX 1903 2714b - iny 1904 2714b - iny 1905 2714b - iny 1906 2714b - iny 1907 2714b - cpy #DLLASTOBJ-1 1908 2714b - bcc dlendmoreloops 1909 2714b endif ; FRAMESKIPGLITCHFIX 1910 2714b ca dex 1911 2714c 10 ec bpl dlendloop 1912 2714e 1913 2714e ifnconst pauseroutineoff 1914 2714e 20 d5 f0 jsr pauseroutine 1915 27151 endif ; pauseroutineoff 1916 27151 60 rts 1917 27152 1918 27152 uninterruptableroutines 1919 27152 ; this is for routines that must happen off the visible screen, each frame. 1920 27152 1921 27152 - ifconst AVOXVOICE 1922 27152 - jsr serviceatarivoxqueue 1923 27152 endif 1924 27152 1925 27152 a9 00 lda #0 1926 27154 8d b6 01 sta palfastframe 1927 27157 ad 09 21 lda paldetected 1928 2715a f0 10 beq skippalframeadjusting 1929 2715c ; ** PAL console is detected. we increment palframes to accurately count 5 frames, 1930 2715c ae b5 01 ldx palframes 1931 2715f e8 inx 1932 27160 e0 05 cpx #5 1933 27162 d0 05 bne palframeskipdone 1934 27164 ee b6 01 inc palfastframe 1935 27167 a2 00 ldx #0 1936 27169 palframeskipdone 1937 27169 8e b5 01 stx palframes 1938 2716c skippalframeadjusting 1939 2716c 1940 2716c - ifconst MUSICTRACKER 1941 2716c - ; We normally run the servicesong routine from the top-screen interrupt, but if it 1942 2716c - ; happens to interrupt the scheduling of a sound effect in the game code, we skip it. 1943 2716c - ; If that happens, we try again here. Chances are very small we'll run into the same 1944 2716c - ; problem twice, and if we do, we just drop a musical note or two. 1945 2716c - lda sfxschedulemissed 1946 2716c - beq servicesongwasnotmissed 1947 2716c - jsr servicesong 1948 2716c -servicesongwasnotmissed 1949 2716c endif ; MUSICTRACKER 1950 2716c 1951 2716c 60 rts 1952 2716d 1953 2716d serviceatarivoxqueue 1954 2716d - ifconst AVOXVOICE 1955 2716d - lda voxlock 1956 2716d - bne skipvoxprocessing ; the vox is in the middle of speech address update 1957 2716d -skipvoxqueuesizedec 1958 2716d - jmp processavoxvoice 1959 2716d -skipvoxprocessing 1960 2716d - rts 1961 2716d - 1962 2716d -processavoxvoice 1963 2716d - lda avoxenable 1964 2716d - bne avoxfixport 1965 2716d - SPKOUT tempavox 1966 2716d - rts 1967 2716d -avoxfixport 1968 2716d - lda #0 ; restore the port to all bits as inputs... 1969 2716d - sta CTLSWA 1970 2716d - rts 1971 2716d -silenceavoxvoice 1972 2716d - SPEAK avoxsilentdata 1973 2716d - rts 1974 2716d -avoxsilentdata 1975 2716d - .byte 31,255 1976 2716d else 1977 2716d 60 rts 1978 2716e endif ; AVOXVOICE 1979 2716e 1980 2716e joybuttonhandler 1981 2716e 8a txa 1982 2716f 0a asl 1983 27170 a8 tay 1984 27171 b9 08 00 lda INPT0,y 1985 27174 4a lsr 1986 27175 9d 02 21 sta sINPT1,x 1987 27178 b9 09 00 lda INPT1,y 1988 2717b 29 80 and #%10000000 1989 2717d 1d 02 21 ora sINPT1,x 1990 27180 9d 02 21 sta sINPT1,x 1991 27183 1992 27183 b5 0c lda INPT4,x 1993 27185 30 19 bmi .skip1bjoyfirecheck 1994 27187 ;one button joystick is down 1995 27187 49 80 eor #%10000000 1996 27189 9d 02 21 sta sINPT1,x 1997 2718c 1998 2718c ad b1 01 lda joybuttonmode 1999 2718f 3d a3 f1 and twobuttonmask,x 2000 27192 f0 0c beq .skip1bjoyfirecheck 2001 27194 ad b1 01 lda joybuttonmode 2002 27197 1d a3 f1 ora twobuttonmask,x 2003 2719a 8d b1 01 sta joybuttonmode 2004 2719d 8d 82 02 sta SWCHB 2005 271a0 .skip1bjoyfirecheck 2006 271a0 4c 57 f0 jmp buttonreadloopreturn 2007 271a3 2008 271a3 twobuttonmask 2009 271a3 04 10 .byte.b %00000100,%00010000 2010 271a5 2011 271a5 gunbuttonhandler ; outside of the conditional, so our button handler LUT is valid 2012 271a5 - ifconst LIGHTGUNSUPPORT 2013 271a5 - cpx #0 2014 271a5 - bne secondportgunhandler 2015 271a5 -firstportgunhandler 2016 271a5 - lda SWCHA 2017 271a5 - asl 2018 271a5 - asl 2019 271a5 - asl ; shift D4 to D7 2020 271a5 - and #%10000000 2021 271a5 - eor #%10000000 2022 271a5 - sta sINPT1 2023 271a5 - jmp buttonreadloopreturn 2024 271a5 -secondportgunhandler 2025 271a5 - lda SWCHA 2026 271a5 - lsr ; shift D0 into carry 2027 271a5 - lsr ; shift carry into D7 2028 271a5 - and #%10000000 2029 271a5 - eor #%10000000 2030 271a5 - sta sINPT3 2031 271a5 - jmp buttonreadloopreturn 2032 271a5 endif ; LIGHTGUNSUPPORT 2033 271a5 2034 271a5 controlsusing2buttoncode 2035 271a5 00 .byte.b 0 ; 00=no controller plugged in 2036 271a6 01 .byte.b 1 ; 01=proline joystick 2037 271a7 00 .byte.b 0 ; 02=lightgun 2038 271a8 00 .byte.b 0 ; 03=paddle 2039 271a9 01 .byte.b 1 ; 04=trakball 2040 271aa 01 .byte.b 1 ; 05=vcs joystick 2041 271ab 01 .byte.b 1 ; 06=driving control 2042 271ac 00 .byte.b 0 ; 07=keypad control 2043 271ad 00 .byte.b 0 ; 08=st mouse/cx80 2044 271ae 00 .byte.b 0 ; 09=amiga mouse 2045 271af 01 .byte.b 1 ; 10=atarivox 2046 271b0 2047 271b0 buttonhandlerhi 2048 271b0 00 .byte.b 0 ; 00=no controller plugged in 2049 271b1 f1 .byte.b >joybuttonhandler ; 01=proline joystick 2050 271b2 f1 .byte.b >gunbuttonhandler ; 02=lightgun 2051 271b3 f4 .byte.b >paddlebuttonhandler ; 03=paddle 2052 271b4 f1 .byte.b >joybuttonhandler ; 04=trakball 2053 271b5 f1 .byte.b >joybuttonhandler ; 05=vcs joystick 2054 271b6 f1 .byte.b >joybuttonhandler ; 06=driving control 2055 271b7 00 .byte.b 0 ; 07=keypad 2056 271b8 f4 .byte.b >mousebuttonhandler ; 08=st mouse 2057 271b9 f4 .byte.b >mousebuttonhandler ; 09=amiga mouse 2058 271ba f1 .byte.b >joybuttonhandler ; 10=atarivox 2059 271bb buttonhandlerlo 2060 271bb 00 .byte.b 0 ; 00=no controller plugged in 2061 271bc 6e .byte.b $0F means the sound is looped while priority is active 2162 27219 2163 27219 05 d9 ora inttemp2 2164 2721b 05 d8 ora inttemp1 ; check if F|C|V=0 2165 2721d f0 23 beq zerosfx ; if so, we're at the end of the sound. 2166 2721f 2167 2721f advancesfxpointer 2168 2721f ; advance the pointer to the next sound chunk 2169 2721f c8 iny 2170 27220 84 da sty inttemp3 2171 27222 18 clc 2172 27223 b5 4e lda sfx1pointlo,x 2173 27225 65 da adc inttemp3 2174 27227 95 4e sta sfx1pointlo,x 2175 27229 b5 50 lda sfx1pointhi,x 2176 2722b 69 00 adc #0 2177 2722d 95 50 sta sfx1pointhi,x 2178 2722f 4c da f1 jmp servicesfxchannelsloop 2179 27232 2180 27232 sfxsoundloop 2181 27232 48 pha 2182 27233 b5 52 lda sfx1priority,x 2183 27235 d0 04 bne sfxsoundloop_carryon 2184 27237 68 pla ; fix the stack before we go 2185 27238 4c 1f f2 jmp advancesfxpointer 2186 2723b sfxsoundloop_carryon 2187 2723b 68 pla 2188 2723c 29 f0 and #$F0 2189 2723e 4a lsr 2190 2723f 4a lsr 2191 27240 4a lsr 2192 27241 4a lsr 2193 27242 2194 27242 zerosfx 2195 27242 95 4e sta sfx1pointlo,x 2196 27244 95 50 sta sfx1pointhi,x 2197 27246 95 52 sta sfx1priority,x 2198 27248 4c da f1 jmp servicesfxchannelsloop 2199 2724b 2200 2724b 2201 2724b schedulesfx 2202 2724b ; called with sfxinstrumentlo=data sfxpitchoffset=pitch-offset sfxnoteindex=note index 2203 2724b a0 00 ldy #0 2204 2724d b1 e0 lda (sfxinstrumentlo),y 2205 2724f - ifconst pokeysupport 2206 2724f - cmp #$20 ; POKEY? 2207 2724f - bne scheduletiasfx 2208 2724f - jmp schedulepokeysfx 2209 2724f endif 2210 2724f scheduletiasfx 2211 2724f ;cmp #$10 ; TIA? 2212 2724f ;beq continuescheduletiasfx 2213 2724f ; rts ; unhandled!!! 2214 2724f continuescheduletiasfx 2215 2724f ifnconst TIASFXMONO 2216 2724f a5 4e lda sfx1pointlo 2217 27251 05 50 ora sfx1pointhi 2218 27253 f0 13 beq schedulesfx1 ;if channel 1 is idle, use it 2219 27255 a5 4f lda sfx2pointlo 2220 27257 05 51 ora sfx2pointhi 2221 27259 f0 11 beq schedulesfx2 ;if channel 2 is idle, use it 2222 2725b ; Both channels are scheduled. 2223 2725b a0 01 ldy #1 2224 2725d b1 e0 lda (sfxinstrumentlo),y 2225 2725f d0 01 bne interruptsfx 2226 27261 60 rts ; the new sound has 0 priority and both channels are busy. Skip playing it. 2227 27262 interruptsfx 2228 27262 ;Compare which active sound has a lower priority. We'll interrupt the lower one. 2229 27262 a5 52 lda sfx1priority 2230 27264 c5 53 cmp sfx2priority 2231 27266 b0 04 bcs schedulesfx2 2232 27268 endif ; !TIASFXMONO 2233 27268 2234 27268 schedulesfx1 2235 27268 a2 00 ldx #0 ; channel 1 2236 2726a ifnconst TIASFXMONO 2237 2726a f0 02 beq skipschedulesfx2 2238 2726c schedulesfx2 2239 2726c a2 01 ldx #1 ; channel 2 2240 2726e skipschedulesfx2 2241 2726e endif ; !TIASFXMONO 2242 2726e 2243 2726e - ifconst MUSICTRACKER 2244 2726e - lda sfxnoteindex 2245 2726e - bpl skipdrumkitoverride 2246 2726e - and #$7F ; subtract 128 2247 2726e - sec 2248 2726e - sbc #4 ; drums start at 132, i.e. octave 10 2249 2726e - asl 2250 2726e - tay 2251 2726e - lda tiadrumkitdefinition,y 2252 2726e - sta sfxinstrumentlo 2253 2726e - iny 2254 2726e - lda tiadrumkitdefinition,y 2255 2726e - sta sfxinstrumenthi 2256 2726e - lda #0 2257 2726e - sta sfxnoteindex ; and tell the driver it's a non-pitched instrument 2258 2726e -skipdrumkitoverride 2259 2726e endif ; MUSICTRACKER 2260 2726e a0 01 ldy #1 ; get priority and sound-resolution (in frames) 2261 27270 b1 e0 lda (sfxinstrumentlo),y 2262 27272 95 52 sta sfx1priority,x 2263 27274 c8 iny 2264 27275 b1 e0 lda (sfxinstrumentlo),y 2265 27277 95 56 sta sfx1frames,x 2266 27279 a5 e0 lda sfxinstrumentlo 2267 2727b 18 clc 2268 2727c 69 03 adc #3 2269 2727e 95 4e sta sfx1pointlo,x 2270 27280 a5 e1 lda sfxinstrumenthi 2271 27282 69 00 adc #0 2272 27284 95 50 sta sfx1pointhi,x 2273 27286 a5 e2 lda sfxpitchoffset 2274 27288 95 54 sta sfx1poffset,x 2275 2728a a9 00 lda #0 2276 2728c 95 58 sta sfx1tick,x 2277 2728e a5 e3 lda sfxnoteindex 2278 27290 95 cd sta sfx1notedata,x 2279 27292 60 rts 2280 27293 2281 27293 plotsprite 2282 27293 ifnconst NODRAWWAIT 2283 27293 - ifconst DOUBLEBUFFER 2284 27293 - lda doublebufferstate 2285 27293 - bne skipplotspritewait 2286 27293 endif ; DOUBLEBUFFER 2287 27293 - ifconst DEBUGWAITCOLOR 2288 27293 - lda #$41 2289 27293 - sta BACKGRND 2290 27293 endif 2291 27293 plotspritewait 2292 27293 a5 4d lda visibleover 2293 27295 d0 fc bne plotspritewait 2294 27297 skipplotspritewait 2295 27297 - ifconst DEBUGWAITCOLOR 2296 27297 - lda #$0 2297 27297 - sta BACKGRND 2298 27297 endif 2299 27297 endif 2300 27297 2301 27297 ;arguments: 2302 27297 ; temp1=lo graphicdata 2303 27297 ; temp2=hi graphicdata 2304 27297 ; temp3=palette | width byte 2305 27297 ; temp4=x 2306 27297 ; temp5=y 2307 27297 ; temp6=mode 2308 27297 a5 46 lda temp5 ;Y position 2309 27299 4a lsr ; 2 - Divide by 8 or 16 2310 2729a 4a lsr ; 2 2311 2729b 4a lsr ; 2 2312 2729c if WZONEHEIGHT = 16 2313 2729c 4a lsr ; 2 2314 2729d endif 2315 2729d 2316 2729d aa tax 2317 2729e 2318 2729e ifnconst NOLIMITCHECKING 2319 2729e 2320 2729e ; the next block allows for vertical masking, and ensures we don't overwrite non-DL memory 2321 2729e 2322 2729e c9 0e cmp #WZONECOUNT 2323 272a0 2324 272a0 90 0a bcc continueplotsprite1 ; the sprite is fully on-screen, so carry on... 2325 272a2 ; otherwise, check to see if the bottom half is in zone 0... 2326 272a2 2327 272a2 if WZONEHEIGHT = 16 2328 272a2 c9 0f cmp #15 2329 272a4 - else 2330 272a4 - cmp #31 2331 272a4 endif 2332 272a4 2333 272a4 d0 05 bne exitplotsprite1 2334 272a6 a2 00 ldx #0 2335 272a8 4c e5 f2 jmp continueplotsprite2 2336 272ab exitplotsprite1 2337 272ab 60 rts 2338 272ac 2339 272ac continueplotsprite1 2340 272ac endif 2341 272ac 2342 272ac bd da f5 lda DLPOINTL,x ;Get pointer to DL that this sprite starts in 2343 272af - ifconst DOUBLEBUFFER 2344 272af - clc 2345 272af - adc doublebufferdloffset 2346 272af endif ; DOUBLEBUFFER 2347 272af 85 63 sta dlpnt 2348 272b1 bd cc f5 lda DLPOINTH,x 2349 272b4 - ifconst DOUBLEBUFFER 2350 272b4 - adc #0 2351 272b4 endif ; DOUBLEBUFFER 2352 272b4 85 64 sta dlpnt+1 2353 272b6 2354 272b6 ;Create DL entry for upper part of sprite 2355 272b6 2356 272b6 b4 65 ldy dlend,x ;Get the index to the end of this DL 2357 272b8 2358 272b8 ifconst CHECKOVERWRITE 2359 272b8 c0 cd cpy #DLLASTOBJ 2360 272ba f0 21 beq checkcontinueplotsprite2 2361 272bc continueplotsprite1a 2362 272bc endif 2363 272bc 2364 272bc a5 42 lda temp1 ; graphic data, lo byte 2365 272be 91 63 sta (dlpnt),y ;Low byte of data address 2366 272c0 2367 272c0 ifnconst ATOMICSPRITEUPDATE 2368 272c0 c8 iny 2369 272c1 a5 47 lda temp6 2370 272c3 91 63 sta (dlpnt),y 2371 272c5 - else 2372 272c5 - iny 2373 272c5 - sty temp8 2374 272c5 endif 2375 272c5 2376 272c5 c8 iny 2377 272c6 2378 272c6 a5 46 lda temp5 ;Y position 2379 272c8 29 0f and #(WZONEHEIGHT - 1) 2380 272ca c9 01 cmp #1 ; clear carry if our sprite is just in this zone 2381 272cc 05 43 ora temp2 ; graphic data, hi byte 2382 272ce 91 63 sta (dlpnt),y 2383 272d0 2384 272d0 2385 272d0 c8 iny 2386 272d1 a5 44 lda temp3 ;palette|width 2387 272d3 91 63 sta (dlpnt),y 2388 272d5 2389 272d5 c8 iny 2390 272d6 a5 45 lda temp4 ;Horizontal position 2391 272d8 91 63 sta (dlpnt),y 2392 272da 2393 272da c8 iny 2394 272db 94 65 sty dlend,x 2395 272dd 2396 272dd - ifconst ALWAYSTERMINATE 2397 272dd - iny 2398 272dd - lda #0 2399 272dd - sta (dlpnt),y 2400 272dd endif 2401 272dd 2402 272dd - ifconst ATOMICSPRITEUPDATE 2403 272dd - ldy temp8 2404 272dd - lda temp6 2405 272dd - sta (dlpnt),y 2406 272dd endif 2407 272dd 2408 272dd checkcontinueplotsprite2 2409 272dd 2410 272dd 90 38 bcc doneSPDL ;branch if the sprite was fully in the last zone 2411 272df 2412 272df ;Create DL entry for lower part of sprite 2413 272df 2414 272df e8 inx ;Next region 2415 272e0 2416 272e0 ifnconst NOLIMITCHECKING 2417 272e0 e0 0e cpx #WZONECOUNT 2418 272e2 2419 272e2 90 01 bcc continueplotsprite2 ; the second half of the sprite is fully on-screen, so carry on... 2420 272e4 60 rts 2421 272e5 continueplotsprite2 2422 272e5 endif 2423 272e5 2424 272e5 bd da f5 lda DLPOINTL,x ;Get pointer to next DL 2425 272e8 - ifconst DOUBLEBUFFER 2426 272e8 - clc 2427 272e8 - adc doublebufferdloffset 2428 272e8 endif ; DOUBLEBUFFER 2429 272e8 85 63 sta dlpnt 2430 272ea bd cc f5 lda DLPOINTH,x 2431 272ed - ifconst DOUBLEBUFFER 2432 272ed - adc #0 2433 272ed endif ; DOUBLEBUFFER 2434 272ed 85 64 sta dlpnt+1 2435 272ef b4 65 ldy dlend,x ;Get the index to the end of this DL 2436 272f1 2437 272f1 ifconst CHECKOVERWRITE 2438 272f1 c0 cd cpy #DLLASTOBJ 2439 272f3 d0 01 bne continueplotsprite2a 2440 272f5 60 rts 2441 272f6 continueplotsprite2a 2442 272f6 endif 2443 272f6 2444 272f6 a5 42 lda temp1 ; graphic data, lo byte 2445 272f8 91 63 sta (dlpnt),y 2446 272fa 2447 272fa ifnconst ATOMICSPRITEUPDATE 2448 272fa c8 iny 2449 272fb a5 47 lda temp6 2450 272fd 91 63 sta (dlpnt),y 2451 272ff - else 2452 272ff - iny 2453 272ff - sty temp8 2454 272ff endif 2455 272ff 2456 272ff c8 iny 2457 27300 2458 27300 a5 46 lda temp5 ;Y position 2459 27302 0b 0f anc #(WZONEHEIGHT - 1) ; undocumented. A=A&IMM, then move bit 7 into carry 2460 27304 05 43 ora temp2 ; graphic data, hi byte 2461 27306 e9 0f sbc #(WZONEHEIGHT-1) ; start at the DMA hole. -1 because carry is clear 2462 27308 91 63 sta (dlpnt),y 2463 2730a 2464 2730a c8 iny 2465 2730b 2466 2730b a5 44 lda temp3 ;palette|width 2467 2730d 91 63 sta (dlpnt),y 2468 2730f 2469 2730f c8 iny 2470 27310 2471 27310 a5 45 lda temp4 ;Horizontal position 2472 27312 91 63 sta (dlpnt),y 2473 27314 2474 27314 c8 iny 2475 27315 94 65 sty dlend,x 2476 27317 2477 27317 - ifconst ALWAYSTERMINATE 2478 27317 - iny 2479 27317 - lda #0 2480 27317 - sta (dlpnt),y 2481 27317 endif 2482 27317 2483 27317 - ifconst ATOMICSPRITEUPDATE 2484 27317 - ldy temp8 2485 27317 - lda temp6 2486 27317 - sta (dlpnt),y 2487 27317 endif 2488 27317 2489 27317 doneSPDL 2490 27317 60 rts 2491 27318 2492 27318 2493 27318 lockzonex 2494 27318 - ifconst ZONELOCKS 2495 27318 - ldy dlend,x 2496 27318 - cpy #DLLASTOBJ 2497 27318 - beq lockzonexreturn ; the zone is either stuffed or locked. abort! 2498 27318 - lda DLPOINTL,x 2499 27318 - ifconst DOUBLEBUFFER 2500 27318 - clc 2501 27318 - adc doublebufferdloffset 2502 27318 - endif ; DOUBLEBUFFER 2503 27318 - sta dlpnt 2504 27318 - lda DLPOINTH,x 2505 27318 - ifconst DOUBLEBUFFER 2506 27318 - adc #0 2507 27318 - endif ; DOUBLEBUFFER 2508 27318 - sta dlpnt+1 2509 27318 - iny 2510 27318 - lda #0 2511 27318 - sta (dlpnt),y 2512 27318 - dey 2513 27318 - tya 2514 27318 - ldy #(DLLASTOBJ-1) 2515 27318 - sta (dlpnt),y 2516 27318 - iny 2517 27318 - sty dlend,x 2518 27318 -lockzonexreturn 2519 27318 - rts 2520 27318 endif ; ZONELOCKS 2521 27318 unlockzonex 2522 27318 - ifconst ZONELOCKS 2523 27318 - ldy dlend,x 2524 27318 - cpy #DLLASTOBJ 2525 27318 - bne unlockzonexreturn ; if the zone isn't stuffed, it's not locked. abort! 2526 27318 - lda DLPOINTL,x 2527 27318 - ifconst DOUBLEBUFFER 2528 27318 - clc 2529 27318 - adc doublebufferdloffset 2530 27318 - endif ; DOUBLEBUFFER 2531 27318 - sta dlpnt 2532 27318 - lda DLPOINTH,x 2533 27318 - ifconst DOUBLEBUFFER 2534 27318 - adc #0 2535 27318 - endif ; DOUBLEBUFFER 2536 27318 - sta dlpnt+1 2537 27318 - dey 2538 27318 - ;ldy #(DLLASTOBJ-1) 2539 27318 - lda (dlpnt),y 2540 27318 - tay 2541 27318 - sty dlend,x 2542 27318 -unlockzonexreturn 2543 27318 endif ; ZONELOCKS 2544 27318 60 rts 2545 27319 2546 27319 plotcharloop 2547 27319 ; ** read from a data indirectly pointed to from temp8,temp9 2548 27319 ; ** format is: lo_data, hi_data, palette|width, x, y 2549 27319 ; ** format ends with lo_data | hi_data = 0 2550 27319 2551 27319 - ifconst DOUBLEBUFFER 2552 27319 - lda doublebufferstate 2553 27319 - bne skipplotcharloopwait 2554 27319 endif ; DOUBLEBUFFER 2555 27319 - ifconst DEBUGWAITCOLOR 2556 27319 - lda #$61 2557 27319 - sta BACKGRND 2558 27319 endif 2559 27319 plotcharloopwait 2560 27319 a5 4d lda visibleover 2561 2731b d0 fc bne plotcharloopwait 2562 2731d - ifconst DEBUGWAITCOLOR 2563 2731d - lda #0 2564 2731d - sta BACKGRND 2565 2731d endif 2566 2731d skipplotcharloopwait 2567 2731d plotcharlooploop 2568 2731d a0 00 ldy #0 2569 2731f b1 49 lda (temp8),y 2570 27321 85 42 sta temp1 2571 27323 c8 iny 2572 27324 b1 49 lda (temp8),y 2573 27326 85 43 sta temp2 2574 27328 05 42 ora temp1 2575 2732a d0 01 bne plotcharloopcontinue 2576 2732c ;the pointer=0, so return 2577 2732c 60 rts 2578 2732d plotcharloopcontinue 2579 2732d c8 iny 2580 2732e b1 49 lda (temp8),y 2581 27330 85 44 sta temp3 2582 27332 c8 iny 2583 27333 b1 49 lda (temp8),y 2584 27335 85 45 sta temp4 2585 27337 c8 iny 2586 27338 b1 49 lda (temp8),y 2587 2733a ;sta temp5 ; not needed with our late entry. 2588 2733a 20 53 f3 jsr plotcharactersskipentry 2589 2733d a5 49 lda temp8 2590 2733f 18 clc 2591 27340 69 05 adc #5 2592 27342 85 49 sta temp8 2593 27344 a5 4a lda temp9 2594 27346 69 00 adc #0 2595 27348 85 4a sta temp9 2596 2734a 4c 1d f3 jmp plotcharlooploop 2597 2734d 2598 2734d plotcharacters 2599 2734d - ifconst DOUBLEBUFFER 2600 2734d - lda doublebufferstate 2601 2734d - bne skipplotcharacterswait 2602 2734d endif ; DOUBLEBUFFER 2603 2734d - ifconst DEBUGWAITCOLOR 2604 2734d - lda #$41 2605 2734d - sta BACKGRND 2606 2734d endif 2607 2734d plotcharacterswait 2608 2734d a5 4d lda visibleover 2609 2734f d0 fc bne plotcharacterswait 2610 27351 - ifconst DEBUGWAITCOLOR 2611 27351 - sta BACKGRND 2612 27351 endif 2613 27351 skipplotcharacterswait 2614 27351 ;arguments: 2615 27351 ; temp1=lo charactermap 2616 27351 ; temp2=hi charactermap 2617 27351 ; temp3=palette | width byte 2618 27351 ; temp4=x 2619 27351 ; temp5=y 2620 27351 2621 27351 a5 46 lda temp5 ;Y position 2622 27353 2623 27353 plotcharactersskipentry 2624 27353 2625 27353 ;ifconst ZONEHEIGHT 2626 27353 ; if ZONEHEIGHT = 16 2627 27353 ; and #$0F 2628 27353 ; endif 2629 27353 ; if ZONEHEIGHT = 8 2630 27353 ; and #$1F 2631 27353 ; endif 2632 27353 ;else 2633 27353 ; and #$0F 2634 27353 ;endif 2635 27353 2636 27353 aa tax 2637 27354 bd da f5 lda DLPOINTL,x ;Get pointer to DL that the characters are in 2638 27357 - ifconst DOUBLEBUFFER 2639 27357 - clc 2640 27357 - adc doublebufferdloffset 2641 27357 endif ; DOUBLEBUFFER 2642 27357 85 63 sta dlpnt 2643 27359 bd cc f5 lda DLPOINTH,x 2644 2735c - ifconst DOUBLEBUFFER 2645 2735c - adc #0 2646 2735c endif ; DOUBLEBUFFER 2647 2735c 85 64 sta dlpnt+1 2648 2735e 2649 2735e ;Create DL entry for the characters 2650 2735e 2651 2735e b4 65 ldy dlend,x ;Get the index to the end of this DL 2652 27360 2653 27360 ifconst CHECKOVERWRITE 2654 27360 c0 cd cpy #DLLASTOBJ 2655 27362 d0 01 bne continueplotcharacters 2656 27364 60 rts 2657 27365 continueplotcharacters 2658 27365 endif 2659 27365 2660 27365 a5 42 lda temp1 ; character map data, lo byte 2661 27367 91 63 sta (dlpnt),y ;(1) store low address 2662 27369 2663 27369 c8 iny 2664 2736a ad 06 21 lda charactermode 2665 2736d 91 63 sta (dlpnt),y ;(2) store mode 2666 2736f 2667 2736f c8 iny 2668 27370 a5 43 lda temp2 ; character map, hi byte 2669 27372 91 63 sta (dlpnt),y ;(3) store high address 2670 27374 2671 27374 c8 iny 2672 27375 a5 44 lda temp3 ;palette|width 2673 27377 91 63 sta (dlpnt),y ;(4) store palette|width 2674 27379 2675 27379 c8 iny 2676 2737a a5 45 lda temp4 ;Horizontal position 2677 2737c 91 63 sta (dlpnt),y ;(5) store horizontal position 2678 2737e 2679 2737e c8 iny 2680 2737f 94 65 sty dlend,x ; save display list end byte 2681 27381 60 rts 2682 27382 2683 27382 2684 27382 - ifconst plotvalueonscreen 2685 27382 -plotcharacterslive 2686 27382 - ; a version of plotcharacters that draws live and minimally disrupts the screen... 2687 27382 - 2688 27382 - ;arguments: 2689 27382 - ; temp1=lo charactermap 2690 27382 - ; temp2=hi charactermap 2691 27382 - ; temp3=palette | width byte 2692 27382 - ; temp4=x 2693 27382 - ; temp5=y 2694 27382 - 2695 27382 - lda temp5 ;Y position 2696 27382 - 2697 27382 - tax 2698 27382 - lda DLPOINTL,x ;Get pointer to DL that the characters are in 2699 27382 - ifconst DOUBLEBUFFER 2700 27382 - clc 2701 27382 - adc doublebufferdloffset 2702 27382 - endif ; DOUBLEBUFFER 2703 27382 - sta dlpnt 2704 27382 - lda DLPOINTH,x 2705 27382 - ifconst DOUBLEBUFFER 2706 27382 - adc #0 2707 27382 - endif ; DOUBLEBUFFER 2708 27382 - sta dlpnt+1 2709 27382 - 2710 27382 - ;Create DL entry for the characters 2711 27382 - 2712 27382 - ldy dlend,x ;Get the index to the end of this DL 2713 27382 - 2714 27382 - ifconst CHECKOVERWRITE 2715 27382 - cpy #DLLASTOBJ 2716 27382 - bne continueplotcharacterslive 2717 27382 - rts 2718 27382 -continueplotcharacterslive 2719 27382 - endif 2720 27382 - 2721 27382 - lda temp1 ; character map data, lo byte 2722 27382 - sta (dlpnt),y ;(1) store low address 2723 27382 - 2724 27382 - iny 2725 27382 - ; we don't add the second byte yet, since the charmap could briefly 2726 27382 - ; render without a proper character map address, width, or position. 2727 27382 - lda charactermode 2728 27382 - sta (dlpnt),y ;(2) store mode 2729 27382 - 2730 27382 - iny 2731 27382 - lda temp2 ; character map, hi byte 2732 27382 - sta (dlpnt),y ;(3) store high address 2733 27382 - 2734 27382 - iny 2735 27382 - lda temp3 ;palette|width 2736 27382 - sta (dlpnt),y ;(4) store palette|width 2737 27382 - 2738 27382 - iny 2739 27382 - lda temp4 ;Horizontal position 2740 27382 - sta (dlpnt),y ;(5) store horizontal position 2741 27382 - 2742 27382 - iny 2743 27382 - sty dlend,x ; save display list end byte 2744 27382 - 2745 27382 - rts 2746 27382 endif ;plotcharacterslive 2747 27382 2748 27382 - ifconst USED_PLOTVALUE 2749 27382 -plotvalue 2750 27382 - ; calling 7800basic command: 2751 27382 - ; plotvalue digit_gfx palette variable/data number_of_digits screen_x screen_y 2752 27382 - ; ...displays the variable as BCD digits 2753 27382 - ; 2754 27382 - ; asm sub arguments: 2755 27382 - ; temp1=lo charactermap 2756 27382 - ; temp2=hi charactermap 2757 27382 - ; temp3=palette | width byte 2758 27382 - ; temp4=x 2759 27382 - ; temp5=y 2760 27382 - ; temp6=number of digits 2761 27382 - ; temp7=lo variable 2762 27382 - ; temp8=hi variable 2763 27382 - ; temp9=character mode 2764 27382 - 2765 27382 -plotdigitcount = temp6 2766 27382 - 2767 27382 - ifconst ZONELOCKS 2768 27382 - ldx temp5 2769 27382 - ldy dlend,x 2770 27382 - cpy #DLLASTOBJ 2771 27382 - bne carryonplotvalue 2772 27382 - rts 2773 27382 -carryonplotvalue 2774 27382 - endif 2775 27382 - 2776 27382 - lda #0 2777 27382 - tay 2778 27382 - ldx valbufend 2779 27382 - 2780 27382 - lda plotdigitcount 2781 27382 - and #1 2782 27382 - beq pvnibble2char 2783 27382 - lda #0 2784 27382 - sta VALBUFFER,x ; just in case we skip this digit 2785 27382 - beq pvnibble2char_skipnibble 2786 27382 - 2787 27382 -pvnibble2char 2788 27382 - ; high nibble... 2789 27382 - lda (temp7),y 2790 27382 - and #$f0 2791 27382 - lsr 2792 27382 - lsr 2793 27382 - lsr 2794 27382 - ifnconst DOUBLEWIDE ; multiply value by 2 for double-width 2795 27382 - lsr 2796 27382 - endif 2797 27382 - 2798 27382 - clc 2799 27382 - adc temp1 ; add the offset to character graphics to our value 2800 27382 - sta VALBUFFER,x 2801 27382 - inx 2802 27382 - dec plotdigitcount 2803 27382 - 2804 27382 -pvnibble2char_skipnibble 2805 27382 - ; low nibble... 2806 27382 - lda (temp7),y 2807 27382 - and #$0f 2808 27382 - ifconst DOUBLEWIDE ; multiply value by 2 for double-width 2809 27382 - asl 2810 27382 - endif 2811 27382 - clc 2812 27382 - adc temp1 ; add the offset to character graphics to our value 2813 27382 - sta VALBUFFER,x 2814 27382 - inx 2815 27382 - iny 2816 27382 - 2817 27382 - dec plotdigitcount 2818 27382 - bne pvnibble2char 2819 27382 - 2820 27382 - ;point to the start of our valuebuffer 2821 27382 - clc 2822 27382 - lda #VALBUFFER 2826 27382 - adc #0 2827 27382 - sta temp2 2828 27382 - 2829 27382 - ;advance valbufend to the end of our value buffer 2830 27382 - stx valbufend 2831 27382 - 2832 27382 - ifnconst plotvalueonscreen 2833 27382 - jmp plotcharacters 2834 27382 - else 2835 27382 - jmp plotcharacterslive 2836 27382 - endif 2837 27382 - 2838 27382 endif ; USED_PLOTVALUE 2839 27382 2840 27382 2841 27382 - ifconst USED_PLOTVALUEEXTRA 2842 27382 -plotdigitcount = temp6 2843 27382 -plotvalueextra 2844 27382 - ; calling 7800basic command: 2845 27382 - ; plotvalue digit_gfx palette variable/data number_of_digits screen_x screen_y 2846 27382 - ; ...displays the variable as BCD digits 2847 27382 - ; 2848 27382 - ; asm sub arguments: 2849 27382 - ; temp1=lo charactermap 2850 27382 - ; temp2=hi charactermap 2851 27382 - ; temp3=palette | width byte 2852 27382 - ; temp4=x 2853 27382 - ; temp5=y 2854 27382 - ; temp6=number of digits 2855 27382 - ; temp7=lo variable 2856 27382 - ; temp8=hi variable 2857 27382 - 2858 27382 - lda #0 2859 27382 - tay 2860 27382 - ldx valbufend 2861 27382 - ifnconst plotvalueonscreen 2862 27382 - sta VALBUFFER,x 2863 27382 - endif 2864 27382 - 2865 27382 - lda plotdigitcount 2866 27382 - and #1 2867 27382 - 2868 27382 - bne pvnibble2char_skipnibbleextra 2869 27382 - 2870 27382 -pvnibble2charextra 2871 27382 - ; high nibble... 2872 27382 - lda (temp7),y 2873 27382 - and #$f0 2874 27382 - lsr 2875 27382 - lsr 2876 27382 - ifnconst DOUBLEWIDE ; multiply value by 2 for double-width 2877 27382 - lsr 2878 27382 - endif 2879 27382 - clc 2880 27382 - adc temp1 ; add the offset to character graphics to our value 2881 27382 - sta VALBUFFER,x 2882 27382 - inx 2883 27382 - 2884 27382 - ; second half of the digit 2885 27382 - clc 2886 27382 - adc #1 2887 27382 - sta VALBUFFER,x 2888 27382 - inx 2889 27382 - 2890 27382 -pvnibble2char_skipnibbleextra 2891 27382 - ; low nibble... 2892 27382 - lda (temp7),y 2893 27382 - and #$0f 2894 27382 - ifconst DOUBLEWIDE ; multiply value by 2 for double-width 2895 27382 - asl 2896 27382 - endif 2897 27382 - asl 2898 27382 - 2899 27382 - clc 2900 27382 - adc temp1 ; add the offset to character graphics to our value 2901 27382 - sta VALBUFFER,x 2902 27382 - inx 2903 27382 - 2904 27382 - clc 2905 27382 - adc #1 2906 27382 - sta VALBUFFER,x 2907 27382 - inx 2908 27382 - iny 2909 27382 - 2910 27382 - dec plotdigitcount 2911 27382 - bne pvnibble2charextra 2912 27382 - 2913 27382 - ;point to the start of our valuebuffer 2914 27382 - clc 2915 27382 - lda #VALBUFFER 2919 27382 - adc #0 2920 27382 - sta temp2 2921 27382 - 2922 27382 - ;advance valbufend to the end of our value buffer 2923 27382 - stx valbufend 2924 27382 - 2925 27382 - ifnconst plotvalueonscreen 2926 27382 - jmp plotcharacters 2927 27382 - else 2928 27382 - jmp plotcharacterslive 2929 27382 - endif 2930 27382 endif ; USED_PLOTVALUEEXTRA 2931 27382 2932 27382 boxcollision 2933 27382 - ifconst BOXCOLLISION 2934 27382 - ; the worst case cycle-time for the code below is 43 cycles. 2935 27382 - ; unfortunately, prior to getting here we've burned 44 cycles in argument setup. eep! 2936 27382 - 2937 27382 - ;__boxx1 = accumulator 2938 27382 - ;__boxy1 = y 2939 27382 -__boxw1 = temp3 2940 27382 -__boxh1 = temp4 2941 27382 - 2942 27382 -__boxx2 = temp5 2943 27382 -__boxy2 = temp6 2944 27382 -__boxw2 = temp7 2945 27382 -__boxh2 = temp8 2946 27382 - 2947 27382 -DoXCollisionCheck 2948 27382 - ;lda __boxx1 ; skipped. already in the accumulator 2949 27382 - cmp __boxx2 ;3 2950 27382 - bcs X1isbiggerthanX2 ;2/3 2951 27382 -X2isbiggerthanX1 2952 27382 - ; carry is clear 2953 27382 - adc __boxw1 ;3 2954 27382 - cmp __boxx2 ;3 2955 27382 - bcs DoYCollisionCheck ;3/2 2956 27382 - rts ;6 - carry clear, no collision 2957 27382 -X1isbiggerthanX2 2958 27382 - clc ;2 2959 27382 - sbc __boxw2 ;3 2960 27382 - cmp __boxx2 ;3 2961 27382 - bcs noboxcollision ;3/2 2962 27382 -DoYCollisionCheck 2963 27382 - tya ; 2 ; use to be "lda __boxy1" 2964 27382 - cmp __boxy2 ;3 2965 27382 - bcs Y1isbiggerthanY2 ;3/2 2966 27382 -Y2isbiggerthanY1 2967 27382 - ; carry is clear 2968 27382 - adc __boxh1 ;3 2969 27382 - cmp __boxy2 ;3 2970 27382 - rts ;6 2971 27382 -Y1isbiggerthanY2 2972 27382 - clc ;2 2973 27382 - sbc __boxh2 ;3 2974 27382 - cmp __boxy2 ;3 2975 27382 - bcs noboxcollision ;3/2 2976 27382 -yesboxcollision 2977 27382 - sec ;2 2978 27382 - rts ;6 2979 27382 -noboxcollision 2980 27382 - clc ;2 2981 27382 - rts ;6 2982 27382 endif ; BOXCOLLISION 2983 27382 2984 27382 randomize 2985 27382 a5 40 lda rand 2986 27384 4a lsr 2987 27385 26 41 rol rand16 2988 27387 90 02 bcc noeor 2989 27389 49 b4 eor #$B4 2990 2738b noeor 2991 2738b 85 40 sta rand 2992 2738d 45 41 eor rand16 2993 2738f 60 rts 2994 27390 2995 27390 ; *** bcd conversion routine courtesy Omegamatrix 2996 27390 ; *** http://atariage.com/forums/blog/563/entry-10832-hex-to-bcd-conversion-0-99/ 2997 27390 converttobcd 2998 27390 ;value to convert is in the accumulator 2999 27390 85 42 sta temp1 3000 27392 4a lsr 3001 27393 65 42 adc temp1 3002 27395 6a ror 3003 27396 4a lsr 3004 27397 4a lsr 3005 27398 65 42 adc temp1 3006 2739a 6a ror 3007 2739b 65 42 adc temp1 3008 2739d 6a ror 3009 2739e 4a lsr 3010 2739f 29 3c and #$3C 3011 273a1 85 43 sta temp2 3012 273a3 4a lsr 3013 273a4 65 43 adc temp2 3014 273a6 65 42 adc temp1 3015 273a8 60 rts ; return the result in the accumulator 3016 273a9 3017 273a9 ; Y and A contain multiplicands, result in A 3018 273a9 mul8 3019 273a9 84 42 sty temp1 3020 273ab 85 43 sta temp2 3021 273ad a9 00 lda #0 3022 273af reptmul8 3023 273af 46 43 lsr temp2 3024 273b1 90 03 bcc skipmul8 3025 273b3 18 clc 3026 273b4 65 42 adc temp1 3027 273b6 ;bcs donemul8 might save cycles? 3028 273b6 skipmul8 3029 273b6 ;beq donemul8 might save cycles? 3030 273b6 06 42 asl temp1 3031 273b8 d0 f5 bne reptmul8 3032 273ba donemul8 3033 273ba 60 rts 3034 273bb 3035 273bb div8 3036 273bb ; A=numerator Y=denominator, result in A 3037 273bb c0 02 cpy #2 3038 273bd 90 0a bcc div8end+1 ;div by 0 = bad, div by 1=no calc needed, so bail out 3039 273bf 84 42 sty temp1 3040 273c1 a0 ff ldy #$ff 3041 273c3 div8loop 3042 273c3 e5 42 sbc temp1 3043 273c5 c8 iny 3044 273c6 b0 fb bcs div8loop 3045 273c8 div8end 3046 273c8 98 tya 3047 273c9 ; result in A 3048 273c9 60 rts 3049 273ca 3050 273ca ; Y and A contain multiplicands, result in temp2,A=low, temp1=high 3051 273ca mul16 3052 273ca 84 42 sty temp1 3053 273cc 85 43 sta temp2 3054 273ce 3055 273ce a9 00 lda #0 3056 273d0 a2 08 ldx #8 3057 273d2 46 42 lsr temp1 3058 273d4 mul16_1 3059 273d4 90 03 bcc mul16_2 3060 273d6 18 clc 3061 273d7 65 43 adc temp2 3062 273d9 mul16_2 3063 273d9 6a ror 3064 273da 66 42 ror temp1 3065 273dc ca dex 3066 273dd d0 f5 bne mul16_1 3067 273df 85 43 sta temp2 3068 273e1 60 rts 3069 273e2 3070 273e2 ; div int/int 3071 273e2 ; numerator in A, denom in temp1 3072 273e2 ; returns with quotient in A, remainder in temp1 3073 273e2 div16 3074 273e2 85 43 sta temp2 3075 273e4 84 42 sty temp1 3076 273e6 a9 00 lda #0 3077 273e8 a2 08 ldx #8 3078 273ea 06 43 asl temp2 3079 273ec div16_1 3080 273ec 2a rol 3081 273ed c5 42 cmp temp1 3082 273ef 90 02 bcc div16_2 3083 273f1 e5 42 sbc temp1 3084 273f3 div16_2 3085 273f3 26 43 rol temp2 3086 273f5 ca dex 3087 273f6 d0 f4 bne div16_1 3088 273f8 85 42 sta temp1 3089 273fa a5 43 lda temp2 3090 273fc 60 rts 3091 273fd 3092 273fd ifconst bankswitchmode 3093 273fd BS_jsr 3094 273fd - ifconst dumpbankswitch 3095 273fd - sta dumpbankswitch 3096 273fd endif 3097 273fd - ifconst MCPDEVCART 3098 273fd - ora #$18 3099 273fd - sta $3000 3100 273fd else 3101 273fd 8d 00 80 sta $8000 3102 27400 endif 3103 27400 68 pla 3104 27401 aa tax 3105 27402 68 pla 3106 27403 60 rts 3107 27404 3108 27404 BS_return 3109 27404 68 pla ; bankswitch bank 3110 27405 - ifconst dumpbankswitch 3111 27405 - sta dumpbankswitch 3112 27405 endif 3113 27405 - ifconst BANKRAM 3114 27405 - sta currentbank 3115 27405 - ora currentrambank 3116 27405 endif 3117 27405 - ifconst MCPDEVCART 3118 27405 - ora #$18 3119 27405 - sta $3000 3120 27405 else 3121 27405 8d 00 80 sta $8000 3122 27408 endif 3123 27408 68 pla ; bankswitch $0 flag 3124 27409 60 rts 3125 2740a endif 3126 2740a 3127 2740a checkselectswitch 3128 2740a ad 82 02 lda SWCHB ; first check the real select switch... 3129 2740d 29 02 and #%00000010 3130 2740f ifnconst MOUSESUPPORT 3131 2740f f0 05 beq checkselectswitchreturn ; switch is pressed 3132 27411 ad 80 02 lda SWCHA ; then check the soft "select" joysick code... 3133 27414 29 b0 and #%10110000 ; R_DU 3134 27416 endif ; MOUSESUPPORT 3135 27416 checkselectswitchreturn 3136 27416 60 rts 3137 27417 3138 27417 checkresetswitch 3139 27417 ad 82 02 lda SWCHB ; first check the real reset switch... 3140 2741a 29 01 and #%00000001 3141 2741c ifnconst MOUSESUPPORT 3142 2741c f0 05 beq checkresetswitchreturn ; switch is pressed 3143 2741e ad 80 02 lda SWCHA ; then check the soft "reset" joysick code... 3144 27421 29 70 and #%01110000 ; _LDU 3145 27423 endif ; MOUSESUPPORT 3146 27423 checkresetswitchreturn 3147 27423 60 rts 3148 27424 3149 27424 - ifconst FINESCROLLENABLED 3150 27424 -finescrolldlls 3151 27424 - ldx temp1 ; first DLL index x3 3152 27424 - lda DLLMEM,x 3153 27424 - and #%11110000 3154 27424 - ora finescrolly 3155 27424 - sta DLLMEM,x 3156 27424 - 3157 27424 - ldx temp2 ; last DLL index x3 3158 27424 - lda DLLMEM,x 3159 27424 - and #%11110000 3160 27424 - ora finescrolly 3161 27424 - eor #(WZONEHEIGHT-1) 3162 27424 - sta DLLMEM,x 3163 27424 - rts 3164 27424 endif ; FINESCROLLENABLED 3165 27424 3166 27424 - ifconst USED_ADJUSTVISIBLE 3167 27424 -adjustvisible 3168 27424 - ; called with temp1=first visible zone *3, temp2=last visible zone *3 3169 27424 - jsr waitforvblankstart ; ensure vblank just started 3170 27424 - ldx visibleDLLstart 3171 27424 -findfirstinterrupt 3172 27424 - lda DLLMEM,x 3173 27424 - bmi foundfirstinterrupt 3174 27424 - inx 3175 27424 - inx 3176 27424 - inx 3177 27424 - bne findfirstinterrupt 3178 27424 -foundfirstinterrupt 3179 27424 - and #%01111111 ; clear the interrupt bit 3180 27424 - sta DLLMEM,x 3181 27424 - ifconst DOUBLEBUFFER 3182 27424 - sta DLLMEM+DBOFFSET,x 3183 27424 - endif ; DOUBLEBUFFER 3184 27424 - ldx overscanDLLstart 3185 27424 -findlastinterrupt 3186 27424 - lda DLLMEM,x 3187 27424 - bmi foundlastinterrupt 3188 27424 - dex 3189 27424 - dex 3190 27424 - dex 3191 27424 - bne findlastinterrupt 3192 27424 -foundlastinterrupt 3193 27424 - and #%01111111 ; clear the interrupt bit 3194 27424 - sta DLLMEM,x 3195 27424 - ifconst DOUBLEBUFFER 3196 27424 - sta DLLMEM+DBOFFSET,x 3197 27424 - endif ; DOUBLEBUFFER 3198 27424 - ;now we need to set the new interrupts 3199 27424 - clc 3200 27424 - lda temp1 3201 27424 - adc visibleDLLstart 3202 27424 - tax 3203 27424 - lda DLLMEM,x 3204 27424 - ora #%10000000 3205 27424 - sta DLLMEM,x 3206 27424 - ifconst DOUBLEBUFFER 3207 27424 - sta DLLMEM+DBOFFSET,x 3208 27424 - endif ; DOUBLEBUFFER 3209 27424 - clc 3210 27424 - lda temp2 3211 27424 - adc visibleDLLstart 3212 27424 - tax 3213 27424 - lda DLLMEM,x 3214 27424 - ora #%10000000 3215 27424 - sta DLLMEM,x 3216 27424 - ifconst DOUBLEBUFFER 3217 27424 - sta DLLMEM+DBOFFSET,x 3218 27424 - endif ; DOUBLEBUFFER 3219 27424 - jsr vblankresync 3220 27424 - rts 3221 27424 endif ; USED_ADJUSTVISIBLE 3222 27424 3223 27424 vblankresync 3224 27424 20 c2 f4 jsr waitforvblankstart ; ensure vblank just started 3225 27427 a9 00 lda #0 3226 27429 85 4d sta visibleover 3227 2742b a9 03 lda #3 3228 2742d 8d b2 01 sta interruptindex 3229 27430 60 rts 3230 27431 3231 27431 createallgamedlls 3232 27431 a2 00 ldx #0 3233 27433 a9 09 lda #NVLINES 3234 27435 ac 09 21 ldy paldetected 3235 27438 f0 03 beq skipcreatePALpadding 3236 2743a 18 clc 3237 2743b 69 15 adc #21 3238 2743d skipcreatePALpadding 3239 2743d 20 72 f4 jsr createnonvisibledlls 3240 27440 8e 3c 21 stx visibleDLLstart 3241 27443 20 a3 f4 jsr createvisiblezones 3242 27446 8e 3d 21 stx overscanDLLstart 3243 27449 createallgamedllscontinue 3244 27449 a9 40 lda #(NVLINES+55) ; extras for PAL 3245 2744b 20 72 f4 jsr createnonvisibledlls 3246 2744e 3247 2744e ae 3c 21 ldx visibleDLLstart 3248 27451 bd 00 18 lda DLLMEM,x 3249 27454 09 80 ora #%10000000 ; NMI 1 - start of visible screen 3250 27456 9d 00 18 sta DLLMEM,x 3251 27459 - ifconst DOUBLEBUFFER 3252 27459 - sta DLLMEM+DBOFFSET,x 3253 27459 endif ; DOUBLEBUFFER 3254 27459 3255 27459 ae 3d 21 ldx overscanDLLstart 3256 2745c bd 00 18 lda DLLMEM,x 3257 2745f 09 83 ora #%10000011 ; NMI 2 - end of visible screen 3258 27461 29 f3 and #%11110011 ; change this to a 1-line DLL, so there's time enough for the "deeper overscan" DLL 3259 27463 9d 00 18 sta DLLMEM,x 3260 27466 - ifconst DOUBLEBUFFER 3261 27466 - sta DLLMEM+DBOFFSET,x 3262 27466 endif ; DOUBLEBUFFER 3263 27466 3264 27466 e8 inx 3265 27467 e8 inx 3266 27468 e8 inx 3267 27469 3268 27469 bd 00 18 lda DLLMEM,x 3269 2746c 09 80 ora #%10000000 ; NMI 3 - deeper overscan 3270 2746e 9d 00 18 sta DLLMEM,x 3271 27471 - ifconst DOUBLEBUFFER 3272 27471 - sta DLLMEM+DBOFFSET,x 3273 27471 endif ; DOUBLEBUFFER 3274 27471 3275 27471 60 rts 3276 27472 3277 27472 createnonvisibledlls 3278 27472 85 42 sta temp1 3279 27474 4a lsr 3280 27475 4a lsr 3281 27476 4a lsr 3282 27477 4a lsr ; /16 3283 27478 f0 09 beq skipcreatenonvisibledlls1loop 3284 2747a a8 tay 3285 2747b createnonvisibledlls1loop 3286 2747b a9 4f lda #%01001111 ;low nibble=16 lines, high nibble=Holey DMA 3287 2747d 20 92 f4 jsr createblankdllentry 3288 27480 88 dey 3289 27481 d0 f8 bne createnonvisibledlls1loop 3290 27483 skipcreatenonvisibledlls1loop 3291 27483 a5 42 lda temp1 3292 27485 29 0f and #%00001111 3293 27487 f0 08 beq createnonvisibledllsreturn 3294 27489 38 sec 3295 2748a e9 01 sbc #1 3296 2748c 09 40 ora #%01000000 3297 2748e 20 92 f4 jsr createblankdllentry 3298 27491 createnonvisibledllsreturn 3299 27491 60 rts 3300 27492 3301 27492 createblankdllentry 3302 27492 9d 00 18 sta DLLMEM,x 3303 27495 - ifconst DOUBLEBUFFER 3304 27495 - sta DLLMEM+DBOFFSET,x 3305 27495 endif ; DOUBLEBUFFER 3306 27495 e8 inx 3307 27496 a9 21 lda #$21 ; blank 3308 27498 9d 00 18 sta DLLMEM,x 3309 2749b - ifconst DOUBLEBUFFER 3310 2749b - sta DLLMEM+DBOFFSET,x 3311 2749b endif ; DOUBLEBUFFER 3312 2749b e8 inx 3313 2749c a9 00 lda #$00 3314 2749e 9d 00 18 sta DLLMEM,x 3315 274a1 - ifconst DOUBLEBUFFER 3316 274a1 - sta DLLMEM+DBOFFSET,x 3317 274a1 endif ; DOUBLEBUFFER 3318 274a1 e8 inx 3319 274a2 60 rts 3320 274a3 3321 274a3 createvisiblezones 3322 274a3 a0 00 ldy #0 3323 274a5 createvisiblezonesloop 3324 274a5 b9 e8 f5 lda.w DLHEIGHT,y 3325 274a8 09 40 ora #(WZONEHEIGHT * 4) ; set Holey DMA for 8 or 16 tall zones 3326 274aa 9d 00 18 sta DLLMEM,x 3327 274ad - ifconst DOUBLEBUFFER 3328 274ad - sta DLLMEM+DBOFFSET,x 3329 274ad endif ; DOUBLEBUFFER 3330 274ad e8 inx 3331 274ae b9 cc f5 lda DLPOINTH,y 3332 274b1 9d 00 18 sta DLLMEM,x 3333 274b4 - ifconst DOUBLEBUFFER 3334 274b4 - sta DLLMEM+DBOFFSET,x 3335 274b4 endif ; DOUBLEBUFFER 3336 274b4 e8 inx 3337 274b5 b9 da f5 lda DLPOINTL,y 3338 274b8 9d 00 18 sta DLLMEM,x 3339 274bb - ifconst DOUBLEBUFFER 3340 274bb - clc 3341 274bb - adc #DOUBLEBUFFEROFFSET 3342 274bb - sta DLLMEM+DBOFFSET,x 3343 274bb - bcc skiphidoublebufferadjust ; dlls are big endian, so we need to fix the hi byte after-the-fact... 3344 274bb - inc DLLMEM+DBOFFSET-1,x 3345 274bb -skiphidoublebufferadjust 3346 274bb endif ; DOUBLEBUFFER 3347 274bb e8 inx 3348 274bc c8 iny 3349 274bd c0 0e cpy #WZONECOUNT 3350 274bf d0 e4 bne createvisiblezonesloop 3351 274c1 60 rts 3352 274c2 3353 274c2 waitforvblankstart 3354 274c2 vblankendwait 3355 274c2 24 28 BIT MSTAT 3356 274c4 30 fc bmi vblankendwait 3357 274c6 vblankstartwait 3358 274c6 24 28 BIT MSTAT 3359 274c8 10 fc bpl vblankstartwait 3360 274ca 60 rts 3361 274cb 3362 274cb - ifconst DOUBLEBUFFER 3363 274cb -flipdisplaybufferreturn 3364 274cb - rts 3365 274cb -flipdisplaybuffer 3366 274cb - ifconst interrupthold 3367 274cb - lda #$FF 3368 274cb - sta interrupthold 3369 274cb - endif 3370 274cb - lda doublebufferstate 3371 274cb - beq flipdisplaybufferreturn ; exit if we're not in double-buffer 3372 274cb - 3373 274cb - jsr terminatedisplaybuffer ; terminate the working buffer before we flip 3374 274cb - 3375 274cb - lda doublebufferstate 3376 274cb - lsr ; /2, so we'll see 0 or 1, rather than 1 or 3 3377 274cb - tax 3378 274cb - 3379 274cb - ; ensure we don't flip mid-display. otherwise the displayed DL will be the one the game is working on. 3380 274cb - 3381 274cb -flipdisplaybufferwait1 3382 274cb - lda visibleover 3383 274cb - beq flipdisplaybufferwait1 3384 274cb - 3385 274cb -flipdisplaybufferwait 3386 274cb - lda visibleover 3387 274cb - bne flipdisplaybufferwait 3388 274cb - 3389 274cb - lda doublebufferminimumframetarget 3390 274cb - beq skipminimumframecode 3391 274cb - lda doublebufferminimumframeindex 3392 274cb - bne flipdisplaybufferwait1 3393 274cb - lda doublebufferminimumframetarget 3394 274cb - sta doublebufferminimumframeindex 3395 274cb -skipminimumframecode 3396 274cb - 3397 274cb - lda DLLMEMLutHi,x 3398 274cb - sta DPPH 3399 274cb - lda DLLMEMLutLo,x 3400 274cb - sta DPPL 3401 274cb - 3402 274cb - lda NewPageflipstate,x 3403 274cb - sta doublebufferstate 3404 274cb - lda NewPageflipoffset,x 3405 274cb - sta doublebufferdloffset 3406 274cb - 3407 274cb - lda doublebufferbufferdirty 3408 274cb - beq flipdisplaybufferreturn 3409 274cb - 3410 274cb - ; The doublebuffer buffer is dirty, so the game code must have issued a savescreen recently. 3411 274cb - ; To make savescreen work with the new working buffer, we need to copy over the saved objects 3412 274cb - ; from the displayed buffer to the working buffer... 3413 274cb - 3414 274cb - lda doublebufferdloffset 3415 274cb - eor #DOUBLEBUFFEROFFSET 3416 274cb - sta temp6 ; make temp6 the anti-doublebufferdloffset variable 3417 274cb - 3418 274cb - ldx #(WZONECOUNT-1) 3419 274cb -copybufferzoneloop 3420 274cb - 3421 274cb - lda DLPOINTL,x 3422 274cb - clc 3423 274cb - adc doublebufferdloffset 3424 274cb - sta temp1 3425 274cb - lda DLPOINTH,x 3426 274cb - adc #0 3427 274cb - sta temp2 3428 274cb - 3429 274cb - lda DLPOINTL,x 3430 274cb - clc 3431 274cb - adc temp6 3432 274cb - sta temp3 3433 274cb - lda DLPOINTH,x 3434 274cb - adc #0 3435 274cb - sta temp4 3436 274cb - 3437 274cb - lda dlendsave,x 3438 274cb - tay 3439 274cb -copybuffercharsloop 3440 274cb - lda (temp3),y 3441 274cb - sta (temp1),y 3442 274cb - dey 3443 274cb - bpl copybuffercharsloop 3444 274cb - dex 3445 274cb - bpl copybufferzoneloop 3446 274cb - lda #0 3447 274cb - sta doublebufferbufferdirty 3448 274cb - rts 3449 274cb - 3450 274cb -doublebufferoff 3451 274cb - lda #1 3452 274cb - sta doublebufferstate 3453 274cb - jsr flipdisplaybuffer 3454 274cb - lda #0 3455 274cb - sta doublebufferstate 3456 274cb - sta doublebufferdloffset 3457 274cb - rts 3458 274cb - 3459 274cb -DLLMEMLutLo 3460 274cb - .byte DLLMEM,>(DLLMEM+DBOFFSET) 3463 274cb -NewPageflipstate 3464 274cb - .byte 3,1 3465 274cb -NewPageflipoffset 3466 274cb - .byte DOUBLEBUFFEROFFSET,0 3467 274cb - 3468 274cb endif ; DOUBLEBUFFER 3469 274cb 3470 274cb - ifconst MOUSESUPPORT 3471 274cb - 3472 274cb -rotationalcompare 3473 274cb - ; old = 00 01 10 11 3474 274cb - .byte $00, $01, $ff, $00 ; new=00 3475 274cb - .byte $ff, $00, $00, $01 ; new=01 3476 274cb - .byte $01, $00, $00, $ff ; new=10 3477 274cb - .byte $00, $ff, $01, $00 ; new=11 3478 274cb - 3479 274cb - ; 0000YyXx st mouse 3480 274cb - 3481 274cb - ; 0000xyXY amiga mouse 3482 274cb - 3483 274cb - ifconst MOUSEXONLY 3484 274cb -amigatoataribits ; swap bits 1 and 4... 3485 274cb - .byte %0000, %0000, %0010, %0010 3486 274cb - .byte %0000, %0000, %0010, %0010 3487 274cb - .byte %0001, %0001, %0011, %0011 3488 274cb - .byte %0001, %0001, %0011, %0011 3489 274cb - 3490 274cb - ; null change bits 3491 274cb - .byte %0000, %0001, %0010, %0011 3492 274cb - .byte %0000, %0001, %0010, %0011 3493 274cb - .byte %0000, %0001, %0010, %0011 3494 274cb - .byte %0000, %0001, %0010, %0011 3495 274cb - 3496 274cb - else ; !MOUSEXONLY 3497 274cb - 3498 274cb -amigatoataribits ; swap bits 1 and 4... 3499 274cb - .byte %0000, %1000, %0010, %1010 3500 274cb - .byte %0100, %1100, %0110, %1110 3501 274cb - .byte %0001, %1001, %0011, %1011 3502 274cb - .byte %0101, %1101, %0111, %1111 3503 274cb - ; null change bits 3504 274cb - .byte %0000, %0001, %0010, %0011 3505 274cb - .byte %0100, %0101, %0110, %0111 3506 274cb - .byte %1000, %1001, %1010, %1011 3507 274cb - .byte %1100, %1101, %1110, %1111 3508 274cb - endif ; !MOUSEXONLY 3509 274cb - 3510 274cb endif ; MOUSESUPPORT 3511 274cb 3512 274cb mouse0update 3513 274cb - ifconst MOUSE0SUPPORT 3514 274cb - 3515 274cb -mousetableselect = inttemp2 3516 274cb -mousexdelta = inttemp3 3517 274cb -mouseydelta = inttemp4 3518 274cb -lastSWCHA = inttemp6 3519 274cb - 3520 274cb - ; 0000YyXx st mouse 3521 274cb - ; 0000xyXY amiga mouse 3522 274cb - 3523 274cb - lda #$ff 3524 274cb - sta lastSWCHA 3525 274cb - 3526 274cb - ldy port0control 3527 274cb - 3528 274cb - lda #%00010000 3529 274cb - cpy #9 ; AMIGA? 3530 274cb - bne skipamigabitsfix0 3531 274cb - lda #0 3532 274cb -skipamigabitsfix0 3533 274cb - sta mousetableselect 3534 274cb - ifconst DRIVINGBOOST 3535 274cb - cpy #6 ; DRIVING? 3536 274cb - bne skipdriving0setup 3537 274cb - ; swap mousex0 and mousey0. mousex seen by the 7800basic program 3538 274cb - ; trails the actual mousex0, so we can smoothly interpolate toward 3539 274cb - ; the actual position. This actual position is stored in mousey0 3540 274cb - ; after the driver has run. 3541 274cb - ldx mousex0 3542 274cb - lda mousey0 3543 274cb - stx mousey0 3544 274cb - sta mousex0 3545 274cb -skipdriving0setup 3546 274cb - endif ; DRIVINGBOOST 3547 274cb - 3548 274cb - lda #0 3549 274cb - sta mousexdelta 3550 274cb - sta mouseydelta 3551 274cb - 3552 274cb - ifnconst MOUSETIME 3553 274cb - ifnconst MOUSEXONLY 3554 274cb - lda #180 ; minimum for x+y 3555 274cb - else 3556 274cb - lda #100 ; minimum for just x 3557 274cb - endif 3558 274cb - else 3559 274cb - lda #MOUSETIME 3560 274cb - endif 3561 274cb - jsr SETTIM64T ; INTIM is in Y 3562 274cb - 3563 274cb -mouse0updateloop 3564 274cb - lda SWCHA 3565 274cb - asr #%11110000 ; Undocumented. A = A & #IMM, then LSR A. 3566 274cb - cmp lastSWCHA 3567 274cb - beq mouse0loopcondition 3568 274cb - sta lastSWCHA 3569 274cb - lsr 3570 274cb - lsr 3571 274cb - lsr 3572 274cb - 3573 274cb - ora mousetableselect ; atari/amiga decoding table selection 3574 274cb - 3575 274cb - ; st mice encode on different bits/joystick-lines than amiga mice... 3576 274cb - ; 0000YyXx st mouse 3577 274cb - ; 0000xyXY amiga mouse 3578 274cb - ; ...so can shuffle the amiga bits to reuse the st driver. 3579 274cb - tay 3580 274cb - lax amigatoataribits,y 3581 274cb - 3582 274cb - ifnconst MOUSEXONLY 3583 274cb - ; first the Y... 3584 274cb - and #%00001100 3585 274cb - ora mousecodey0 3586 274cb - tay 3587 274cb - lda rotationalcompare,y 3588 274cb - clc 3589 274cb - adc mouseydelta 3590 274cb - sta mouseydelta 3591 274cb - tya 3592 274cb - lsr 3593 274cb - lsr 3594 274cb - sta mousecodey0 3595 274cb - txa 3596 274cb - ; ...then the X... 3597 274cb - and #%00000011 3598 274cb - tax 3599 274cb - endif ; !MOUSEXONLY 3600 274cb - 3601 274cb - asl 3602 274cb - asl 3603 274cb - ora mousecodex0 3604 274cb - tay 3605 274cb - lda rotationalcompare,y 3606 274cb - adc mousexdelta ; carry was clear by previous ASL 3607 274cb - sta mousexdelta 3608 274cb - stx mousecodex0 3609 274cb -mouse0loopcondition 3610 274cb - lda TIMINT 3611 274cb - bpl mouse0updateloop 3612 274cb - 3613 274cb - ; *** adapt to selected device resolution. 3614 274cb - ldx port0control 3615 274cb - 3616 274cb - ifconst PRECISIONMOUSING 3617 274cb - ldy port0resolution 3618 274cb - bne mouse0halveddone 3619 274cb - cpx #6 ; half-resolution is no good for driving wheels 3620 274cb - beq mouse0halveddone 3621 274cb - ; resolution=0 is half mouse resolution, necessary for precision 3622 274cb - ; mousing on a 160x240 screen with a 1000 dpi mouse. 3623 274cb - 3624 274cb - lda mousexdelta 3625 274cb - cmp #$80 3626 274cb - ror ; do a signed divide by 2. 3627 274cb - clc 3628 274cb - adc mousex0 3629 274cb - sta mousex0 3630 274cb - ifnconst MOUSEXONLY 3631 274cb - lda mouseydelta 3632 274cb - clc 3633 274cb - adc mousey0 3634 274cb - sta mousey0 3635 274cb - endif 3636 274cb - ; at half resolution we just exit after updating x and y 3637 274cb - jmp LLRET0 3638 274cb -mouse0halveddone 3639 274cb - endif ; PRECISIONMOUSING 3640 274cb - 3641 274cb - ifnconst MOUSEXONLY 3642 274cb - asl mouseydelta ; *2 because Y resolution is finer 3643 274cb - ldy port0resolution 3644 274cb - dey 3645 274cb - lda #0 3646 274cb -mousey0resolutionfix 3647 274cb - clc 3648 274cb - adc mouseydelta 3649 274cb - dey 3650 274cb - bpl mousey0resolutionfix 3651 274cb - clc 3652 274cb - adc mousey0 3653 274cb - sta mousey0 3654 274cb - endif ; MOUSEXONLY 3655 274cb - 3656 274cb - ldy port0resolution 3657 274cb - dey 3658 274cb - lda #0 3659 274cb -mousex0resolutionfix 3660 274cb - clc 3661 274cb - adc mousexdelta 3662 274cb - dey 3663 274cb - bpl mousex0resolutionfix 3664 274cb - ifnconst DRIVINGBOOST 3665 274cb - clc 3666 274cb - adc mousex0 3667 274cb - sta mousex0 3668 274cb - else 3669 274cb - cpx #6 3670 274cb - beq carryonmouse0boost 3671 274cb - clc 3672 274cb - adc mousex0 3673 274cb - sta mousex0 3674 274cb - jmp LLRET0 3675 274cb -carryonmouse0boost 3676 274cb - sta mousexdelta 3677 274cb - clc 3678 274cb - adc mousecodey0 3679 274cb - sta mousecodey0 3680 274cb - clc 3681 274cb - adc mousex0 3682 274cb - tay ; save the target X 3683 274cb - adc mousey0 ; average in the smoothly-trailing X 3684 274cb - ror 3685 274cb - sta mousex0 ; mousex0 now has the smoothly trailing X 3686 274cb - sty mousey0 ; and mousey0 has the the target X 3687 274cb - 3688 274cb - ; check to see if the coordinate wrapped. If so, undo the averaging code. 3689 274cb - ; A has mousex0, the smoothly trailing X 3690 274cb - sbc mousey0 ; less the target X 3691 274cb - bpl skipabsolutedrive0 3692 274cb - eor #$ff 3693 274cb -skipabsolutedrive0 3694 274cb - cmp #64 ; just an unreasonably large change 3695 274cb - bcc skipdrivewrapfix0 3696 274cb - sty mousex0 ; if X wrapped, we catch the trailing X up to the target X 3697 274cb -skipdrivewrapfix0 3698 274cb - 3699 274cb - ; get rid of the tweening if the distance travelled was very small 3700 274cb - lda mousexdelta 3701 274cb - cmp port0resolution 3702 274cb - bcs skipbetweenfix0 3703 274cb - lda mousex0 3704 274cb - sta mousey0 3705 274cb -skipbetweenfix0 3706 274cb - 3707 274cb -drivingboostreductioncheck0 3708 274cb - ; The below code amounts to mousecodey0=mousecodey0-(mousecodey0/8) 3709 274cb - ; +ve mousecodey0 is converted to -ve to do the calculation, and then 3710 274cb - ; negated again because truncation during BCD math results in 3711 274cb - ; differing magnitudes, depending if the value is +ve or -ve. 3712 274cb -driving0fix 3713 274cb - lax mousecodey0 3714 274cb - cmp #$80 3715 274cb - bcs driving0skipnegate1 3716 274cb - eor #$FF 3717 274cb - adc #1 3718 274cb - sta mousecodey0 3719 274cb -driving0skipnegate1 3720 274cb - cmp #$80 3721 274cb - ror 3722 274cb - cmp #$80 3723 274cb - ror 3724 274cb - cmp #$80 3725 274cb - ror 3726 274cb - sta inttemp1 3727 274cb - lda mousecodey0 3728 274cb - sec 3729 274cb - sbc inttemp1 3730 274cb - cpx #$80 3731 274cb - bcs driving0skipnegate2 3732 274cb - eor #$FF 3733 274cb - adc #1 3734 274cb -driving0skipnegate2 3735 274cb - sta mousecodey0 3736 274cb -drivingboostdone0 3737 274cb - endif ; DRIVINGBOOST 3738 274cb - 3739 274cb - jmp LLRET0 3740 274cb - 3741 274cb endif ; MOUSE0SUPPORT 3742 274cb 3743 274cb mouse1update 3744 274cb - ifconst MOUSE1SUPPORT 3745 274cb - 3746 274cb -mousetableselect = inttemp2 3747 274cb -mousexdelta = inttemp3 3748 274cb -mouseydelta = inttemp4 3749 274cb -lastSWCHA = inttemp6 3750 274cb - 3751 274cb - ; 0000YyXx st mouse 3752 274cb - ; 0000xyXY amiga mouse 3753 274cb - 3754 274cb - lda #$ff 3755 274cb - sta lastSWCHA 3756 274cb - 3757 274cb - ldy port1control 3758 274cb - 3759 274cb - lda #%00010000 3760 274cb - cpy #9 ; AMIGA? 3761 274cb - bne skipamigabitsfix1 3762 274cb - lda #0 3763 274cb -skipamigabitsfix1 3764 274cb - sta mousetableselect 3765 274cb - ifconst DRIVINGBOOST 3766 274cb - cpy #6 ; DRIVING? 3767 274cb - bne skipdriving1setup 3768 274cb - ; swap mousex1 and mousey1. mousex seen by the 7800basic program 3769 274cb - ; trails the actual mousex1, so we can smoothly interpolate toward 3770 274cb - ; the actual position. This actual position is stored in mousey1 3771 274cb - ; after the driver has run. 3772 274cb - ldx mousex1 3773 274cb - lda mousey1 3774 274cb - stx mousey1 3775 274cb - sta mousex1 3776 274cb -skipdriving1setup 3777 274cb - endif ; DRIVINGBOOST 3778 274cb - 3779 274cb - lda #0 3780 274cb - sta mousexdelta 3781 274cb - sta mouseydelta 3782 274cb - 3783 274cb - ifnconst MOUSETIME 3784 274cb - ifnconst MOUSEXONLY 3785 274cb - lda #180 ; minimum for x+y 3786 274cb - else 3787 274cb - lda #100 ; minimum for just x 3788 274cb - endif 3789 274cb - else 3790 274cb - lda #MOUSETIME 3791 274cb - endif 3792 274cb - jsr SETTIM64T ; INTIM is in Y 3793 274cb - 3794 274cb -mouse1updateloop 3795 274cb - lda SWCHA 3796 274cb - and #%00001111 3797 274cb - cmp lastSWCHA 3798 274cb - beq mouse1loopcondition 3799 274cb - sta lastSWCHA 3800 274cb - 3801 274cb - ora mousetableselect ; atari/amiga decoding table selection 3802 274cb - 3803 274cb - ; st mice encode on different bits/joystick-lines than amiga mice... 3804 274cb - ; 0000YyXx st mouse 3805 274cb - ; 0000xyXY amiga mouse 3806 274cb - ; ...so can shuffle the amiga bits to reuse the st driver. 3807 274cb - tay 3808 274cb - lax amigatoataribits,y 3809 274cb - 3810 274cb - ifnconst MOUSEXONLY 3811 274cb - ; first the Y... 3812 274cb - and #%00001100 3813 274cb - ora mousecodey1 3814 274cb - tay 3815 274cb - lda rotationalcompare,y 3816 274cb - clc 3817 274cb - adc mouseydelta 3818 274cb - sta mouseydelta 3819 274cb - tya 3820 274cb - lsr 3821 274cb - lsr 3822 274cb - sta mousecodey1 3823 274cb - txa 3824 274cb - ; ...then the X... 3825 274cb - and #%00000011 3826 274cb - tax 3827 274cb - endif ; !MOUSEXONLY 3828 274cb - 3829 274cb - asl 3830 274cb - asl 3831 274cb - ora mousecodex1 3832 274cb - tay 3833 274cb - lda rotationalcompare,y 3834 274cb - adc mousexdelta ; carry was clear by previous ASL 3835 274cb - sta mousexdelta 3836 274cb - stx mousecodex1 3837 274cb -mouse1loopcondition 3838 274cb - lda TIMINT 3839 274cb - bpl mouse1updateloop 3840 274cb - 3841 274cb - ; *** adapt to selected device resolution. 3842 274cb - ldx port1control 3843 274cb - 3844 274cb - ifconst PRECISIONMOUSING 3845 274cb - ldy port1resolution 3846 274cb - bne mouse1halveddone 3847 274cb - cpx #6 ; half-resolution is no good for driving wheels 3848 274cb - beq mouse1halveddone 3849 274cb - ; resolution=0 is half mouse resolution, necessary for precision 3850 274cb - ; mousing on a 160x240 screen with a 1000 dpi mouse. 3851 274cb - 3852 274cb - lda mousexdelta 3853 274cb - cmp #$80 3854 274cb - ror ; do a signed divide by 2. 3855 274cb - clc 3856 274cb - adc mousex1 3857 274cb - sta mousex1 3858 274cb - ifnconst MOUSEXONLY 3859 274cb - lda mouseydelta 3860 274cb - clc 3861 274cb - adc mousey1 3862 274cb - sta mousey1 3863 274cb - endif 3864 274cb - ; at half resolution we just exit after updating x and y 3865 274cb - jmp LLRET1 3866 274cb -mouse1halveddone 3867 274cb - endif ; PRECISIONMOUSING 3868 274cb - 3869 274cb - ifnconst MOUSEXONLY 3870 274cb - asl mouseydelta ; *2 because Y resolution is finer 3871 274cb - ldy port1resolution 3872 274cb - dey 3873 274cb - lda #0 3874 274cb -mousey1resolutionfix 3875 274cb - clc 3876 274cb - adc mouseydelta 3877 274cb - dey 3878 274cb - bpl mousey1resolutionfix 3879 274cb - clc 3880 274cb - adc mousey1 3881 274cb - sta mousey1 3882 274cb - endif ; MOUSEXONLY 3883 274cb - 3884 274cb - ldy port1resolution 3885 274cb - dey 3886 274cb - lda #0 3887 274cb -mousex1resolutionfix 3888 274cb - clc 3889 274cb - adc mousexdelta 3890 274cb - dey 3891 274cb - bpl mousex1resolutionfix 3892 274cb - ifnconst DRIVINGBOOST 3893 274cb - clc 3894 274cb - adc mousex1 3895 274cb - sta mousex1 3896 274cb - else 3897 274cb - cpx #6 3898 274cb - beq carryonmouse1boost 3899 274cb - clc 3900 274cb - adc mousex1 3901 274cb - sta mousex1 3902 274cb - jmp LLRET1 3903 274cb -carryonmouse1boost 3904 274cb - sta mousexdelta 3905 274cb - clc 3906 274cb - adc mousecodey1 3907 274cb - sta mousecodey1 3908 274cb - clc 3909 274cb - adc mousex1 3910 274cb - tay ; save the target X 3911 274cb - adc mousey1 ; average in the smoothly-trailing X 3912 274cb - ror 3913 274cb - sta mousex1 ; mousex0 now has the smoothly trailing X 3914 274cb - sty mousey1 ; and mousey0 has the the target X 3915 274cb - 3916 274cb - ; check to see if the coordinate wrapped. If so, undo the averaging code. 3917 274cb - ; A has mousex1, the smoothly trailing X 3918 274cb - sbc mousey1 ; less the target X 3919 274cb - bpl skipabsolutedrive1 3920 274cb - eor #$ff 3921 274cb -skipabsolutedrive1 3922 274cb - cmp #64 ; just an unreasonably large change 3923 274cb - bcc skipdrivewrapfix1 3924 274cb - sty mousex1 ; if X wrapped, we catch the trailing X up to the target X 3925 274cb -skipdrivewrapfix1 3926 274cb - 3927 274cb - ; get rid of the tweening if the distance travelled was very small 3928 274cb - lda mousexdelta 3929 274cb - cmp port1resolution 3930 274cb - bcs skipbetweenfix1 3931 274cb - lda mousex1 3932 274cb - sta mousey1 3933 274cb -skipbetweenfix1 3934 274cb - 3935 274cb -drivingboostreductioncheck1 3936 274cb - ; The below code amounts to mousecodey0=mousecodey0-(mousecodey0/8) 3937 274cb - ; +ve mousecodey0 is converted to -ve to do the calculation, and then 3938 274cb - ; negated again because truncation during BCD math results in 3939 274cb - ; differing magnitudes, depending if the value is +ve or -ve. 3940 274cb -driving1fix 3941 274cb - lax mousecodey1 3942 274cb - cmp #$80 3943 274cb - bcs driving0skipnegate1 3944 274cb - eor #$FF 3945 274cb - adc #1 3946 274cb - sta mousecodey1 3947 274cb -driving0skipnegate1 3948 274cb - cmp #$80 3949 274cb - ror 3950 274cb - cmp #$80 3951 274cb - ror 3952 274cb - cmp #$80 3953 274cb - ror 3954 274cb - sta inttemp1 3955 274cb - lda mousecodey1 3956 274cb - sec 3957 274cb - sbc inttemp1 3958 274cb - cpx #$80 3959 274cb - bcs driving1skipnegate2 3960 274cb - eor #$FF 3961 274cb - adc #1 3962 274cb -driving1skipnegate2 3963 274cb - sta mousecodey1 3964 274cb -drivingboostdone1 3965 274cb - endif ; DRIVINGBOOST 3966 274cb - 3967 274cb - jmp LLRET1 3968 274cb - 3969 274cb endif ; MOUSE1SUPPORT 3970 274cb 3971 274cb 3972 274cb trakball0update 3973 274cb - ifconst TRAKBALL0SUPPORT 3974 274cb - ifnconst TRAKTIME 3975 274cb - ifnconst TRAKXONLY 3976 274cb - lda #180 ; minimum for x+y 3977 274cb - else ; !TRAKXONLY 3978 274cb - lda #100 ; minimum for just x 3979 274cb - endif ; !TRAKXONLY 3980 274cb - else ; !TRAKTIME 3981 274cb - lda #TRAKTIME 3982 274cb - endif ; !TRAKTIME 3983 274cb - jsr SETTIM64T ; INTIM is in Y 3984 274cb - ldx #0 3985 274cb - ifnconst TRAKXONLY 3986 274cb - ldy #0 3987 274cb - endif ; TRAKXONLY 3988 274cb -trakball0updateloop 3989 274cb - lda SWCHA 3990 274cb - and #%00110000 3991 274cb - cmp trakballcodex0 3992 274cb - sta trakballcodex0 3993 274cb - beq trakball0movementXdone 3994 274cb - and #%00010000 3995 274cb - beq trakball0negativeX 3996 274cb -trakball0positiveX 3997 274cb - ;(2 from beq) 3998 274cb - inx ; 2 3999 274cb - jmp trakball0movementXdone ; 3 4000 274cb -trakball0negativeX 4001 274cb - ;(3 from beq) 4002 274cb - dex ; 2 4003 274cb - nop ; 2 4004 274cb -trakball0movementXdone 4005 274cb - 4006 274cb - ifnconst TRAKXONLY 4007 274cb - lda SWCHA 4008 274cb - and #%11000000 4009 274cb - cmp trakballcodey0 4010 274cb - sta trakballcodey0 4011 274cb - beq trakball0movementYdone 4012 274cb - and #%01000000 4013 274cb - beq trakball0negativeY 4014 274cb -trakball0positiveY 4015 274cb - ;(2 from beq) 4016 274cb - iny ; 2 4017 274cb - jmp trakball0movementYdone ; 3 4018 274cb -trakball0negativeY 4019 274cb - ;(3 from beq) 4020 274cb - dey ; 2 4021 274cb - nop ; 2 4022 274cb -trakball0movementYdone 4023 274cb - endif ; !TRAKXONLY 4024 274cb - 4025 274cb - lda TIMINT 4026 274cb - bpl trakball0updateloop 4027 274cb - lda #0 4028 274cb - cpx #0 4029 274cb - beq trakball0skipXadjust 4030 274cb - clc 4031 274cb -trakball0Xloop 4032 274cb - adc port0resolution 4033 274cb - dex 4034 274cb - bne trakball0Xloop 4035 274cb - clc 4036 274cb - adc trakballx0 4037 274cb - sta trakballx0 4038 274cb -trakball0skipXadjust 4039 274cb - ifnconst TRAKXONLY 4040 274cb - lda #0 4041 274cb - cpy #0 4042 274cb - beq trakball0skipYadjust 4043 274cb - clc 4044 274cb -trakball0yloop 4045 274cb - adc port0resolution 4046 274cb - dey 4047 274cb - bne trakball0yloop 4048 274cb - clc 4049 274cb - adc trakbally0 4050 274cb - sta trakbally0 4051 274cb -trakball0skipYadjust 4052 274cb - endif ; !TRAKXONLY 4053 274cb - 4054 274cb - jmp LLRET0 4055 274cb endif 4056 274cb 4057 274cb 4058 274cb 4059 274cb trakball1update 4060 274cb - ifconst TRAKBALL1SUPPORT 4061 274cb - ifnconst TRAKTIME 4062 274cb - ifnconst TRAKXONLY 4063 274cb - lda #180 ; minimum for x+y 4064 274cb - else ; !TRAKXONLY 4065 274cb - lda #100 ; minimum for just x 4066 274cb - endif ; !TRAKXONLY 4067 274cb - else ; !TRAKTIME 4068 274cb - lda #TRAKTIME 4069 274cb - endif ; !TRAKTIME 4070 274cb - jsr SETTIM64T ; INTIM is in Y 4071 274cb - ldx #0 4072 274cb - ifnconst TRAKXONLY 4073 274cb - ldy #0 4074 274cb - endif ; TRAKXONLY 4075 274cb -trakball1updateloop 4076 274cb - lda SWCHA 4077 274cb - and #%00000011 4078 274cb - cmp trakballcodex1 4079 274cb - sta trakballcodex1 4080 274cb - beq trakball1movementXdone 4081 274cb - and #%00000001 4082 274cb - beq trakball1negativeX 4083 274cb -trakball1positiveX 4084 274cb - ;(2 from beq) 4085 274cb - inx ; 2 4086 274cb - jmp trakball1movementXdone ; 3 4087 274cb -trakball1negativeX 4088 274cb - ;(3 from beq) 4089 274cb - dex ; 2 4090 274cb - nop ; 2 4091 274cb -trakball1movementXdone 4092 274cb - 4093 274cb - ifnconst TRAKXONLY 4094 274cb - lda SWCHA 4095 274cb - and #%00001100 4096 274cb - cmp trakballcodey1 4097 274cb - sta trakballcodey1 4098 274cb - beq trakball1movementYdone 4099 274cb - and #%00000100 4100 274cb - beq trakball1negativeY 4101 274cb -trakball1positiveY 4102 274cb - ;(2 from beq) 4103 274cb - iny ; 2 4104 274cb - jmp trakball1movementYdone ; 3 4105 274cb -trakball1negativeY 4106 274cb - ;(3 from beq) 4107 274cb - dey ; 2 4108 274cb - nop ; 2 4109 274cb -trakball1movementYdone 4110 274cb - endif ; !TRAKXONLY 4111 274cb - 4112 274cb - lda TIMINT 4113 274cb - bpl trakball1updateloop 4114 274cb - lda #0 4115 274cb - cpx #0 4116 274cb - beq trakball1skipXadjust 4117 274cb - clc 4118 274cb -trakball1Xloop 4119 274cb - adc port1resolution 4120 274cb - dex 4121 274cb - bne trakball1Xloop 4122 274cb - clc 4123 274cb - adc trakballx1 4124 274cb - sta trakballx1 4125 274cb -trakball1skipXadjust 4126 274cb - ifnconst TRAKXONLY 4127 274cb - lda #0 4128 274cb - cpy #0 4129 274cb - beq trakball1skipYadjust 4130 274cb - clc 4131 274cb -trakball1yloop 4132 274cb - adc port1resolution 4133 274cb - dey 4134 274cb - bne trakball1yloop 4135 274cb - clc 4136 274cb - adc trakbally1 4137 274cb - sta trakbally1 4138 274cb -trakball1skipYadjust 4139 274cb - endif ; !TRAKXONLY 4140 274cb - 4141 274cb - jmp LLRET1 4142 274cb endif 4143 274cb 4144 274cb 4145 274cb paddleport0update 4146 274cb - ifconst PADDLE0SUPPORT 4147 274cb - lda #6 4148 274cb - sta VBLANK ; start charging the paddle caps 4149 274cb - lda #0 ; use PADDLE timing 4150 274cb - jsr SETTIM64T ; INTIM is in Y 4151 274cb - 4152 274cb -paddleport0updateloop 4153 274cb - lda INPT0 4154 274cb - bmi skippaddle0setposition 4155 274cb - sty paddleposition0 4156 274cb -skippaddle0setposition 4157 274cb - ifconst TWOPADDLESUPPORT 4158 274cb - lda INPT1 4159 274cb - bmi skippaddle1setposition 4160 274cb - sty paddleposition1 4161 274cb -skippaddle1setposition 4162 274cb - endif 4163 274cb - ldy INTIM 4164 274cb - cpy #TIMEOFFSET 4165 274cb - bcs paddleport0updateloop 4166 274cb - 4167 274cb - lda #%10000110 4168 274cb - sta VBLANK ; dump paddles to ground... this may not be great for genesis controllers 4169 274cb - sec 4170 274cb - lda paddleposition0 4171 274cb - sbc #TIMEOFFSET 4172 274cb - ifconst PADDLESCALEX2 4173 274cb - asl 4174 274cb - endif 4175 274cb - 4176 274cb - ifnconst PADDLESMOOTHINGOFF 4177 274cb - clc 4178 274cb - adc paddleprevious0 4179 274cb - ror 4180 274cb - sta paddleprevious0 4181 274cb - endif 4182 274cb - 4183 274cb - sta paddleposition0 4184 274cb - 4185 274cb - ifconst TWOPADDLESUPPORT 4186 274cb - sec 4187 274cb - lda paddleposition1 4188 274cb - sbc #TIMEOFFSET 4189 274cb - ifconst PADDLESCALEX2 4190 274cb - asl 4191 274cb - endif 4192 274cb - 4193 274cb - ifnconst PADDLESMOOTHINGOFF 4194 274cb - clc 4195 274cb - adc paddleprevious1 4196 274cb - ror 4197 274cb - sta paddleprevious1 4198 274cb - endif 4199 274cb - sta paddleposition1 4200 274cb - endif ; TWOPADDLESUPPORT 4201 274cb - 4202 274cb - jmp LLRET0 4203 274cb endif 4204 274cb 4205 274cb paddleport1update 4206 274cb - ifconst PADDLE1SUPPORT 4207 274cb - lda #6 4208 274cb - sta VBLANK ; start charging the paddle caps 4209 274cb - 4210 274cb - lda #0 ; use PADDLE timing 4211 274cb - jsr SETTIM64T ; INTIM is in Y 4212 274cb - 4213 274cb -paddleport1updateloop 4214 274cb - lda INPT2 4215 274cb - bmi skippaddle2setposition 4216 274cb - sty paddleposition2 4217 274cb -skippaddle2setposition 4218 274cb - ifconst TWOPADDLESUPPORT 4219 274cb - lda INPT3 4220 274cb - bmi skippaddle3setposition 4221 274cb - sty paddleposition3 4222 274cb -skippaddle3setposition 4223 274cb - endif 4224 274cb - ldy INTIM 4225 274cb - cpy #TIMEOFFSET 4226 274cb - bcs paddleport1updateloop 4227 274cb - 4228 274cb - lda #%10000110 4229 274cb - sta VBLANK ; dump paddles to ground... this may not be great for genesis controllers 4230 274cb - sec 4231 274cb - lda paddleposition2 4232 274cb - sbc #TIMEOFFSET 4233 274cb - ifconst PADDLESCALEX2 4234 274cb - asl 4235 274cb - endif 4236 274cb - 4237 274cb - ifnconst PADDLESMOOTHINGOFF 4238 274cb - clc 4239 274cb - adc paddleprevious2 4240 274cb - ror 4241 274cb - sta paddleprevious2 4242 274cb - endif 4243 274cb - 4244 274cb - sta paddleposition2 4245 274cb - 4246 274cb - ifconst TWOPADDLESUPPORT 4247 274cb - sec 4248 274cb - lda paddleposition3 4249 274cb - sbc #TIMEOFFSET 4250 274cb - ifconst PADDLESCALEX2 4251 274cb - asl 4252 274cb - endif 4253 274cb - 4254 274cb - ifnconst PADDLESMOOTHINGOFF 4255 274cb - clc 4256 274cb - adc paddleprevious3 4257 274cb - ror 4258 274cb - sta paddleprevious3 4259 274cb - endif 4260 274cb - sta paddleposition3 4261 274cb - endif ; TWOPADDLESUPPORT 4262 274cb - 4263 274cb - jmp LLRET1 4264 274cb endif 4265 274cb 4266 274cb 4267 274cb paddlebuttonhandler ; outside of conditional, for button-handler LUT 4268 274cb - ifconst PADDLESUPPORT 4269 274cb - ; x=0|1 for port, rather than paddle #. 4270 274cb - ; Only the first paddle button will integrate into "joy0fire" testing. If the 4271 274cb - ; game wants to support 2 paddles, up to the game to instead test the 4272 274cb - ; joystick right+left directions instead. 4273 274cb - lda SWCHA ; top of nibble is first paddle button 4274 274cb - cpx #0 ; port 0? 4275 274cb - beq skippaddleport2shift 4276 274cb - asl ; shift second port to upper nibble 4277 274cb - asl 4278 274cb - asl 4279 274cb - asl 4280 274cb -skippaddleport2shift 4281 274cb - and #%10000000 4282 274cb - eor #%10000000 ; invert 4283 274cb - sta sINPT1,x 4284 274cb - jmp buttonreadloopreturn 4285 274cb endif ; PADDLESUPPORT 4286 274cb 4287 274cb mousebuttonhandler ; outside of conditional, for button-handler LUT 4288 274cb - ifconst MOUSESUPPORT 4289 274cb - ; stick the mouse buttons in the correct shadow register... 4290 274cb - txa 4291 274cb - asl 4292 274cb - tay ; y=x*2 4293 274cb - lda INPT4,x 4294 274cb - eor #%10000000 4295 274cb - lsr 4296 274cb - sta sINPT1,x 4297 274cb - 4298 274cb - lda INPT1,y 4299 274cb - and #%10000000 4300 274cb - eor #%10000000 4301 274cb - ora sINPT1,x 4302 274cb - sta sINPT1,x 4303 274cb - jmp buttonreadloopreturn 4304 274cb endif ; MOUSESUPPORT 4305 274cb 4306 274cb - ifconst KEYPADSUPPORT 4307 274cb - ; ** select keypad rows 0 to 3 over 4 frames... 4308 274cb -keypadrowselect 4309 274cb - ldy #0 4310 274cb - lda port0control 4311 274cb - cmp #7 4312 274cb - bne skipport0val 4313 274cb - iny ; y=y+1 4314 274cb -skipport0val 4315 274cb - lda port1control 4316 274cb - cmp #7 4317 274cb - bne skipport1val 4318 274cb - iny 4319 274cb - iny ; y=y+2 4320 274cb -skipport1val 4321 274cb - lda keyrowdirectionmask,y 4322 274cb - sta CTLSWA 4323 274cb - tya 4324 274cb - asl 4325 274cb - asl 4326 274cb - sta inttemp1 4327 274cb - lda framecounter 4328 274cb - and #3 4329 274cb - ora inttemp1 4330 274cb - tax 4331 274cb - lda keyrowselectvalue,x 4332 274cb - sta SWCHA 4333 274cb - rts 4334 274cb - 4335 274cb -keyrowdirectionmask 4336 274cb - .byte #%00000000 ; 0 : port0=input port1=input 4337 274cb - .byte #%11110000 ; 1 : port0=output port1=input 4338 274cb - .byte #%00001111 ; 2 : port0=input port1=output 4339 274cb - .byte #%11111111 ; 3 : port0=output port1=output 4340 274cb - 4341 274cb -keyrowselectvalue 4342 274cb - .byte #%00000000, #%00000000, #%00000000, #%00000000 ; no row selected, all pins high, always 4343 274cb - .byte #%11100000, #%11010000, #%10110000, #%01110000 ; p0 keypad in 4344 274cb - .byte #%00001110, #%00001101, #%00001011, #%00000111 ; p1 keypad in 4345 274cb - .byte #%11101110, #%11011101, #%10111011, #%01110111 ; p0+p1 keypads in 4346 274cb endif ; KEYPADSUPPORT 4347 274cb 4348 274cb - ifconst KEYPADSUPPORT 4349 274cb - ; TODO - split into compile-time KEYPAD0SUPPORT and KEYPAD1SUPPORT 4350 274cb -keypadcolumnread 4351 274cb - lda port0control 4352 274cb - cmp #7 4353 274cb - bne skipkeypadcolumnread0 4354 274cb - lda framecounter 4355 274cb - and #3 4356 274cb - asl ; x2 because keypad variables are interleaved 4357 274cb - tax 4358 274cb - lda #0 4359 274cb - sta keypadmatrix0a,x 4360 274cb - lda INPT0 4361 274cb - cmp #$80 4362 274cb - rol keypadmatrix0a,x 4363 274cb - lda INPT1 4364 274cb - cmp #$80 4365 274cb - rol keypadmatrix0a,x 4366 274cb - lda INPT4 4367 274cb - cmp #$80 4368 274cb - rol keypadmatrix0a,x 4369 274cb - lda keypadmatrix0a,x 4370 274cb - eor #%00000111 4371 274cb - sta keypadmatrix0a,x 4372 274cb -skipkeypadcolumnread0 4373 274cb - 4374 274cb - lda port1control 4375 274cb - cmp #7 4376 274cb - bne skipkeypadcolumnread1 4377 274cb - lda framecounter 4378 274cb - and #3 4379 274cb - asl ; x2 because keypad variables are interleaved 4380 274cb - tax 4381 274cb - lda #0 4382 274cb - sta keypadmatrix1a,x 4383 274cb - rol keypadmatrix1a,x 4384 274cb - lda INPT2 4385 274cb - cmp #$80 4386 274cb - rol keypadmatrix1a,x 4387 274cb - lda INPT3 4388 274cb - cmp #$80 4389 274cb - rol keypadmatrix1a,x 4390 274cb - lda INPT5 4391 274cb - cmp #$80 4392 274cb - rol keypadmatrix1a,x 4393 274cb - lda keypadmatrix1a,x 4394 274cb - eor #%00000111 4395 274cb - sta keypadmatrix1a,x 4396 274cb -skipkeypadcolumnread1 4397 274cb - rts 4398 274cb endif ; KEYPADSUPPORT 4399 274cb 4400 274cb setportforinput 4401 274cb a5 e4 lda CTLSWAs 4402 274cd 3d d6 f4 and allpinsinputlut,x 4403 274d0 85 e4 sta CTLSWAs 4404 274d2 8d 81 02 sta CTLSWA 4405 274d5 60 rts 4406 274d6 4407 274d6 allpinsinputlut 4408 274d6 0f f0 .byte.b $0F, $F0 4409 274d8 4410 274d8 setonebuttonmode 4411 274d8 a9 06 lda #6 ; in case we're in unlocked-bios mode 4412 274da 85 01 sta VBLANK ; if we were on paddles, the line is grounded out. 4413 274dc a9 14 lda #$14 4414 274de 8d 83 02 sta CTLSWB ; set both 2-button disable bits to writable 4415 274e1 a5 e5 lda CTLSWBs 4416 274e3 1d ec f4 ora thisjoy2buttonbit,x 4417 274e6 85 e5 sta CTLSWBs 4418 274e8 8d 82 02 sta SWCHB ; turn off the 2-button disable bits 4419 274eb 60 rts 4420 274ec 4421 274ec thisjoy2buttonbit 4422 274ec 04 10 .byte.b $04, $10 4423 274ee 4424 274ee settwobuttonmode 4425 274ee a9 06 lda #6 ; in case we're in unlocked-bios mode 4426 274f0 85 01 sta VBLANK ; if we were on paddles, the line is grounded out. 4427 274f2 a9 14 lda #$14 4428 274f4 8d 83 02 sta CTLSWB ; set both 2-button disable bits to writable 4429 274f7 a5 e5 lda CTLSWBs 4430 274f9 3d 02 f5 and thisjoy2buttonmask,x 4431 274fc 85 e5 sta CTLSWBs 4432 274fe 8d 82 02 sta SWCHB 4433 27501 60 rts 4434 27502 4435 27502 thisjoy2buttonmask 4436 27502 fb ef .byte.b $fb, $ef 4437 27504 4438 27504 ; Provided under the CC0 license. See the included LICENSE.txt for details. 4439 27504 4440 27504 START 4441 27504 start 4442 27504 4443 27504 ;******** more or less the Atari recommended startup procedure 4444 27504 4445 27504 78 sei 4446 27505 d8 cld 4447 27506 4448 27506 ifnconst NOTIALOCK 4449 27506 a9 07 lda #$07 4450 27508 - else 4451 27508 - lda #$06 4452 27508 endif 4453 27508 85 01 sta INPTCTRL ;lock 7800 into 7800 mode 4454 2750a a9 7f lda #$7F 4455 2750c 85 3c sta CTRL ;disable DMA 4456 2750e a9 00 lda #$00 4457 27510 85 38 sta OFFSET 4458 27512 ifnconst NOTIALOCK 4459 27512 85 01 sta INPTCTRL 4460 27514 85 20 sta BACKGRND ; black default, in case a flash cart is using something else 4461 27516 endif 4462 27516 a2 ff ldx #$FF 4463 27518 9a txs 4464 27519 4465 27519 ;************** Clear Memory 4466 27519 4467 27519 a2 40 ldx #$40 4468 2751b a9 00 lda #$00 4469 2751d crloop1 4470 2751d 95 00 sta $00,x ;Clear zero page 4471 2751f 9d 00 01 sta $100,x ;Clear page 1 4472 27522 e8 inx 4473 27523 d0 f8 bne crloop1 4474 27525 4475 27525 4476 27525 a0 00 ldy #$00 ;Clear Ram 4477 27527 a9 18 lda #$18 ;Start at $1800 4478 27529 85 81 sta $81 4479 2752b a9 00 lda #$00 4480 2752d 85 80 sta $80 4481 2752f crloop3 4482 2752f a9 00 lda #$00 4483 27531 91 80 sta ($80),y ;Store data 4484 27533 c8 iny ;Next byte 4485 27534 d0 f9 bne crloop3 ;Branch if not done page 4486 27536 e6 81 inc $81 ;Next page 4487 27538 a5 81 lda $81 4488 2753a c9 20 cmp #$20 ;End at $1FFF 4489 2753c d0 f1 bne crloop3 ;Branch if not 4490 2753e 4491 2753e a0 00 ldy #$00 ;Clear Ram 4492 27540 a9 22 lda #$22 ;Start at $2200 4493 27542 85 81 sta $81 4494 27544 a9 00 lda #$00 4495 27546 85 80 sta $80 4496 27548 crloop4 4497 27548 a9 00 lda #$00 4498 2754a 91 80 sta ($80),y ;Store data 4499 2754c c8 iny ;Next byte 4500 2754d d0 f9 bne crloop4 ;Branch if not done page 4501 2754f e6 81 inc $81 ;Next page 4502 27551 a5 81 lda $81 4503 27553 c9 27 cmp #$27 ;End at $27FF 4504 27555 d0 f1 bne crloop4 ;Branch if not 4505 27557 4506 27557 a2 00 ldx #$00 4507 27559 a9 00 lda #$00 4508 2755b crloop5 ;Clear 2100-213F, 2000-203F 4509 2755b 9d 00 20 sta $2000,x 4510 2755e 9d 00 21 sta $2100,x 4511 27561 e8 inx 4512 27562 e0 40 cpx #$40 4513 27564 d0 f5 bne crloop5 4514 27566 4515 27566 85 80 sta $80 4516 27568 85 81 sta $81 4517 2756a 85 82 sta $82 4518 2756c 85 83 sta $83 4519 2756e 4520 2756e ;seed random number with hopefully-random timer value 4521 2756e a9 01 lda #1 4522 27570 0d 84 02 ora INTIM 4523 27573 85 40 sta rand 4524 27575 4525 27575 ; detect the console type... 4526 27575 pndetectvblankstart 4527 27575 a5 28 lda MSTAT 4528 27577 10 fc bpl pndetectvblankstart ; if we're not in VBLANK, wait for it to start 4529 27579 pndetectvblankover 4530 27579 a5 28 lda MSTAT 4531 2757b 30 fc bmi pndetectvblankover ; then wait for it to be over 4532 2757d a0 00 ldy #$00 4533 2757f a2 00 ldx #$00 4534 27581 pndetectvblankhappening 4535 27581 a5 28 lda MSTAT 4536 27583 30 07 bmi pndetectinvblank ; if VBLANK starts, exit our counting loop 4537 27585 85 24 sta WSYNC 4538 27587 85 24 sta WSYNC 4539 27589 e8 inx 4540 2758a d0 f5 bne pndetectvblankhappening 4541 2758c pndetectinvblank 4542 2758c e0 7d cpx #125 4543 2758e 90 02 bcc pndetecispal 4544 27590 a0 01 ldy #$01 4545 27592 pndetecispal 4546 27592 8c 09 21 sty paldetected 4547 27595 4548 27595 20 31 f4 jsr createallgamedlls 4549 27598 4550 27598 a9 18 lda #>DLLMEM 4551 2759a 85 2c sta DPPH 4552 2759c a9 00 lda # 255 4747 275cc -DOUBLEBUFFEROFFSET = 255 4748 275cc else 4749 275cc 00 cf DOUBLEBUFFEROFFSET = (DLLASTOBJ+2) 4750 275cc endif 4751 275cc 4752 275cc ifconst EXTRADLMEMORY 4753 275cc SECONDDLHALFSTART SET $2300 4754 275cc endif 4755 275cc 4756 275cc DLPOINTH 4757 275cc DLINDEX SET 0 4758 275cc REPEAT WZONECOUNT 4759 275cc TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 4760 275cc ifconst EXTRADLMEMORY 4761 275cc - if TMPMEMADDRESS > $1FFF 4762 275cc -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4763 275cc else 4764 275cc - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 4765 275cc -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4766 275cc -SECONDDLHALFSTART SET TMPMEMADDRESS 4767 275cc endif 4768 275cc endif ; TMPMEMADDRESS > $1FFF 4769 275cc endif ; EXTRADLMEMORY 4770 275cc ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 4771 275cc 18 .byte.b >TMPMEMADDRESS 4772 275cc DLINDEX SET DLINDEX + 1 4758 275cc REPEND 4759 275cc TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 4760 275cd ifconst EXTRADLMEMORY 4761 275cd - if TMPMEMADDRESS > $1FFF 4762 275cd -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4763 275cd else 4764 275cd - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 4765 275cd -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4766 275cd -SECONDDLHALFSTART SET TMPMEMADDRESS 4767 275cd endif 4768 275cd endif ; TMPMEMADDRESS > $1FFF 4769 275cd endif ; EXTRADLMEMORY 4770 275cd ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 4771 275cd 19 .byte.b >TMPMEMADDRESS 4772 275cd DLINDEX SET DLINDEX + 1 4758 275cd REPEND 4759 275cd TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 4760 275ce ifconst EXTRADLMEMORY 4761 275ce - if TMPMEMADDRESS > $1FFF 4762 275ce -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4763 275ce else 4764 275ce - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 4765 275ce -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4766 275ce -SECONDDLHALFSTART SET TMPMEMADDRESS 4767 275ce endif 4768 275ce endif ; TMPMEMADDRESS > $1FFF 4769 275ce endif ; EXTRADLMEMORY 4770 275ce ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 4771 275ce 1a .byte.b >TMPMEMADDRESS 4772 275ce DLINDEX SET DLINDEX + 1 4758 275ce REPEND 4759 275ce TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 4760 275cf ifconst EXTRADLMEMORY 4761 275cf - if TMPMEMADDRESS > $1FFF 4762 275cf -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4763 275cf else 4764 275cf - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 4765 275cf -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4766 275cf -SECONDDLHALFSTART SET TMPMEMADDRESS 4767 275cf endif 4768 275cf endif ; TMPMEMADDRESS > $1FFF 4769 275cf endif ; EXTRADLMEMORY 4770 275cf ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 4771 275cf 1a .byte.b >TMPMEMADDRESS 4772 275cf DLINDEX SET DLINDEX + 1 4758 275cf REPEND 4759 275cf TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 4760 275d0 ifconst EXTRADLMEMORY 4761 275d0 - if TMPMEMADDRESS > $1FFF 4762 275d0 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4763 275d0 else 4764 275d0 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 4765 275d0 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4766 275d0 -SECONDDLHALFSTART SET TMPMEMADDRESS 4767 275d0 endif 4768 275d0 endif ; TMPMEMADDRESS > $1FFF 4769 275d0 endif ; EXTRADLMEMORY 4770 275d0 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 4771 275d0 1b .byte.b >TMPMEMADDRESS 4772 275d0 DLINDEX SET DLINDEX + 1 4758 275d0 REPEND 4759 275d0 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 4760 275d1 ifconst EXTRADLMEMORY 4761 275d1 - if TMPMEMADDRESS > $1FFF 4762 275d1 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4763 275d1 else 4764 275d1 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 4765 275d1 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4766 275d1 -SECONDDLHALFSTART SET TMPMEMADDRESS 4767 275d1 endif 4768 275d1 endif ; TMPMEMADDRESS > $1FFF 4769 275d1 endif ; EXTRADLMEMORY 4770 275d1 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 4771 275d1 1c .byte.b >TMPMEMADDRESS 4772 275d1 DLINDEX SET DLINDEX + 1 4758 275d1 REPEND 4759 275d1 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 4760 275d2 ifconst EXTRADLMEMORY 4761 275d2 - if TMPMEMADDRESS > $1FFF 4762 275d2 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4763 275d2 else 4764 275d2 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 4765 275d2 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4766 275d2 -SECONDDLHALFSTART SET TMPMEMADDRESS 4767 275d2 endif 4768 275d2 endif ; TMPMEMADDRESS > $1FFF 4769 275d2 endif ; EXTRADLMEMORY 4770 275d2 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 4771 275d2 1d .byte.b >TMPMEMADDRESS 4772 275d2 DLINDEX SET DLINDEX + 1 4758 275d2 REPEND 4759 275d2 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 4760 275d3 ifconst EXTRADLMEMORY 4761 275d3 - if TMPMEMADDRESS > $1FFF 4762 275d3 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4763 275d3 else 4764 275d3 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 4765 275d3 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4766 275d3 -SECONDDLHALFSTART SET TMPMEMADDRESS 4767 275d3 endif 4768 275d3 endif ; TMPMEMADDRESS > $1FFF 4769 275d3 endif ; EXTRADLMEMORY 4770 275d3 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 4771 275d3 1e .byte.b >TMPMEMADDRESS 4772 275d3 DLINDEX SET DLINDEX + 1 4758 275d3 REPEND 4759 275d3 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 4760 275d4 ifconst EXTRADLMEMORY 4761 275d4 - if TMPMEMADDRESS > $1FFF 4762 275d4 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4763 275d4 else 4764 275d4 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 4765 275d4 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4766 275d4 -SECONDDLHALFSTART SET TMPMEMADDRESS 4767 275d4 endif 4768 275d4 endif ; TMPMEMADDRESS > $1FFF 4769 275d4 endif ; EXTRADLMEMORY 4770 275d4 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 4771 275d4 1f .byte.b >TMPMEMADDRESS 4772 275d4 DLINDEX SET DLINDEX + 1 4758 275d4 REPEND 4759 275d4 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 4760 275d5 ifconst EXTRADLMEMORY 4761 275d5 - if TMPMEMADDRESS > $1FFF 4762 275d5 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4763 275d5 else 4764 275d5 if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 4765 275d5 TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4766 275d5 SECONDDLHALFSTART SET TMPMEMADDRESS 4767 275d5 endif 4768 275d5 endif ; TMPMEMADDRESS > $1FFF 4769 275d5 endif ; EXTRADLMEMORY 4770 275d5 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 4771 275d5 22 .byte.b >TMPMEMADDRESS 4772 275d5 DLINDEX SET DLINDEX + 1 4758 275d5 REPEND 4759 275d5 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 4760 275d6 ifconst EXTRADLMEMORY 4761 275d6 if TMPMEMADDRESS > $1FFF 4762 275d6 TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4763 275d6 - else 4764 275d6 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 4765 275d6 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4766 275d6 -SECONDDLHALFSTART SET TMPMEMADDRESS 4767 275d6 - endif 4768 275d6 endif ; TMPMEMADDRESS > $1FFF 4769 275d6 endif ; EXTRADLMEMORY 4770 275d6 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 4771 275d6 23 .byte.b >TMPMEMADDRESS 4772 275d6 DLINDEX SET DLINDEX + 1 4758 275d6 REPEND 4759 275d6 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 4760 275d7 ifconst EXTRADLMEMORY 4761 275d7 if TMPMEMADDRESS > $1FFF 4762 275d7 TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4763 275d7 - else 4764 275d7 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 4765 275d7 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4766 275d7 -SECONDDLHALFSTART SET TMPMEMADDRESS 4767 275d7 - endif 4768 275d7 endif ; TMPMEMADDRESS > $1FFF 4769 275d7 endif ; EXTRADLMEMORY 4770 275d7 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 4771 275d7 24 .byte.b >TMPMEMADDRESS 4772 275d7 DLINDEX SET DLINDEX + 1 4758 275d7 REPEND 4759 275d7 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 4760 275d8 ifconst EXTRADLMEMORY 4761 275d8 if TMPMEMADDRESS > $1FFF 4762 275d8 TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4763 275d8 - else 4764 275d8 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 4765 275d8 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4766 275d8 -SECONDDLHALFSTART SET TMPMEMADDRESS 4767 275d8 - endif 4768 275d8 endif ; TMPMEMADDRESS > $1FFF 4769 275d8 endif ; EXTRADLMEMORY 4770 275d8 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 4771 275d8 25 .byte.b >TMPMEMADDRESS 4772 275d8 DLINDEX SET DLINDEX + 1 4758 275d8 REPEND 4759 275d8 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 4760 275d9 ifconst EXTRADLMEMORY 4761 275d9 if TMPMEMADDRESS > $1FFF 4762 275d9 TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4763 275d9 - else 4764 275d9 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 4765 275d9 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4766 275d9 -SECONDDLHALFSTART SET TMPMEMADDRESS 4767 275d9 - endif 4768 275d9 endif ; TMPMEMADDRESS > $1FFF 4769 275d9 endif ; EXTRADLMEMORY 4770 275d9 ;echo " "," ZONE",[DLINDEX]d,"ADDRESS: ",TMPMEMADDRESS 4771 275d9 26 .byte.b >TMPMEMADDRESS 4772 275d9 DLINDEX SET DLINDEX + 1 4773 275da REPEND 4774 275da 4775 275da ifconst EXTRADLMEMORY $22e4 to $27ff was claimed as extra DL memory. 4776 275da echo " ",[SECONDDLHALFSTART],"to",[$27FF],"was claimed as extra DL memory." 4777 275da endif 4778 275da 4779 275da 4780 275da DLPOINTL 4781 275da DLINDEX SET 0 4782 275da REPEAT WZONECOUNT 4783 275da TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 4784 275da ifconst EXTRADLMEMORY 4785 275da - if TMPMEMADDRESS > $1FFF 4786 275da -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4787 275da else 4788 275da - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 4789 275da -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4790 275da endif 4791 275da endif ; TMPMEMADDRESS > $1FFF 4792 275da endif ; EXTRADLMEMORY 4793 275da 80 .byte.b $1FFF 4786 275db -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4787 275db else 4788 275db - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 4789 275db -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4790 275db endif 4791 275db endif ; TMPMEMADDRESS > $1FFF 4792 275db endif ; EXTRADLMEMORY 4793 275db 52 .byte.b $1FFF 4786 275dc -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4787 275dc else 4788 275dc - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 4789 275dc -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4790 275dc endif 4791 275dc endif ; TMPMEMADDRESS > $1FFF 4792 275dc endif ; EXTRADLMEMORY 4793 275dc 24 .byte.b $1FFF 4786 275dd -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4787 275dd else 4788 275dd - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 4789 275dd -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4790 275dd endif 4791 275dd endif ; TMPMEMADDRESS > $1FFF 4792 275dd endif ; EXTRADLMEMORY 4793 275dd f6 .byte.b $1FFF 4786 275de -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4787 275de else 4788 275de - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 4789 275de -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4790 275de endif 4791 275de endif ; TMPMEMADDRESS > $1FFF 4792 275de endif ; EXTRADLMEMORY 4793 275de c9 .byte.b $1FFF 4786 275df -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4787 275df else 4788 275df - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 4789 275df -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4790 275df endif 4791 275df endif ; TMPMEMADDRESS > $1FFF 4792 275df endif ; EXTRADLMEMORY 4793 275df 9b .byte.b $1FFF 4786 275e0 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4787 275e0 else 4788 275e0 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 4789 275e0 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4790 275e0 endif 4791 275e0 endif ; TMPMEMADDRESS > $1FFF 4792 275e0 endif ; EXTRADLMEMORY 4793 275e0 6d .byte.b $1FFF 4786 275e1 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4787 275e1 else 4788 275e1 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 4789 275e1 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4790 275e1 endif 4791 275e1 endif ; TMPMEMADDRESS > $1FFF 4792 275e1 endif ; EXTRADLMEMORY 4793 275e1 40 .byte.b $1FFF 4786 275e2 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4787 275e2 else 4788 275e2 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 4789 275e2 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4790 275e2 endif 4791 275e2 endif ; TMPMEMADDRESS > $1FFF 4792 275e2 endif ; EXTRADLMEMORY 4793 275e2 12 .byte.b $1FFF 4786 275e3 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4787 275e3 else 4788 275e3 if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 4789 275e3 TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4790 275e3 endif 4791 275e3 endif ; TMPMEMADDRESS > $1FFF 4792 275e3 endif ; EXTRADLMEMORY 4793 275e3 e4 .byte.b $1FFF 4786 275e4 TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4787 275e4 - else 4788 275e4 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 4789 275e4 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4790 275e4 - endif 4791 275e4 endif ; TMPMEMADDRESS > $1FFF 4792 275e4 endif ; EXTRADLMEMORY 4793 275e4 b6 .byte.b $1FFF 4786 275e5 TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4787 275e5 - else 4788 275e5 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 4789 275e5 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4790 275e5 - endif 4791 275e5 endif ; TMPMEMADDRESS > $1FFF 4792 275e5 endif ; EXTRADLMEMORY 4793 275e5 89 .byte.b $1FFF 4786 275e6 TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4787 275e6 - else 4788 275e6 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 4789 275e6 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4790 275e6 - endif 4791 275e6 endif ; TMPMEMADDRESS > $1FFF 4792 275e6 endif ; EXTRADLMEMORY 4793 275e6 5b .byte.b $1FFF 4786 275e7 TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4787 275e7 - else 4788 275e7 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 4789 275e7 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4790 275e7 - endif 4791 275e7 endif ; TMPMEMADDRESS > $1FFF 4792 275e7 endif ; EXTRADLMEMORY 4793 275e7 2d .byte.b $1FFF 4803 275e8 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4804 275e8 else 4805 275e8 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 4806 275e8 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4807 275e8 endif 4808 275e8 endif ; TMPMEMADDRESS > $1FFF 4809 275e8 endif ; EXTRADLMEMORY 4810 275e8 4811 275e8 18 80 ZONE0ADDRESS = TMPMEMADDRESS 4812 275e8 4813 275e8 DLINDEX SET DLINDEX + 1 4799 275e8 REPEND 4800 275e8 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 4801 275e8 ifconst EXTRADLMEMORY 4802 275e8 - if TMPMEMADDRESS > $1FFF 4803 275e8 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4804 275e8 else 4805 275e8 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 4806 275e8 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4807 275e8 endif 4808 275e8 endif ; TMPMEMADDRESS > $1FFF 4809 275e8 endif ; EXTRADLMEMORY 4810 275e8 4811 275e8 19 52 ZONE1ADDRESS = TMPMEMADDRESS 4812 275e8 4813 275e8 DLINDEX SET DLINDEX + 1 4799 275e8 REPEND 4800 275e8 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 4801 275e8 ifconst EXTRADLMEMORY 4802 275e8 - if TMPMEMADDRESS > $1FFF 4803 275e8 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4804 275e8 else 4805 275e8 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 4806 275e8 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4807 275e8 endif 4808 275e8 endif ; TMPMEMADDRESS > $1FFF 4809 275e8 endif ; EXTRADLMEMORY 4810 275e8 4811 275e8 1a 24 ZONE2ADDRESS = TMPMEMADDRESS 4812 275e8 4813 275e8 DLINDEX SET DLINDEX + 1 4799 275e8 REPEND 4800 275e8 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 4801 275e8 ifconst EXTRADLMEMORY 4802 275e8 - if TMPMEMADDRESS > $1FFF 4803 275e8 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4804 275e8 else 4805 275e8 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 4806 275e8 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4807 275e8 endif 4808 275e8 endif ; TMPMEMADDRESS > $1FFF 4809 275e8 endif ; EXTRADLMEMORY 4810 275e8 4811 275e8 1a f6 ZONE3ADDRESS = TMPMEMADDRESS 4812 275e8 4813 275e8 DLINDEX SET DLINDEX + 1 4799 275e8 REPEND 4800 275e8 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 4801 275e8 ifconst EXTRADLMEMORY 4802 275e8 - if TMPMEMADDRESS > $1FFF 4803 275e8 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4804 275e8 else 4805 275e8 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 4806 275e8 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4807 275e8 endif 4808 275e8 endif ; TMPMEMADDRESS > $1FFF 4809 275e8 endif ; EXTRADLMEMORY 4810 275e8 4811 275e8 1b c9 ZONE4ADDRESS = TMPMEMADDRESS 4812 275e8 4813 275e8 DLINDEX SET DLINDEX + 1 4799 275e8 REPEND 4800 275e8 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 4801 275e8 ifconst EXTRADLMEMORY 4802 275e8 - if TMPMEMADDRESS > $1FFF 4803 275e8 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4804 275e8 else 4805 275e8 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 4806 275e8 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4807 275e8 endif 4808 275e8 endif ; TMPMEMADDRESS > $1FFF 4809 275e8 endif ; EXTRADLMEMORY 4810 275e8 4811 275e8 1c 9b ZONE5ADDRESS = TMPMEMADDRESS 4812 275e8 4813 275e8 DLINDEX SET DLINDEX + 1 4799 275e8 REPEND 4800 275e8 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 4801 275e8 ifconst EXTRADLMEMORY 4802 275e8 - if TMPMEMADDRESS > $1FFF 4803 275e8 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4804 275e8 else 4805 275e8 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 4806 275e8 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4807 275e8 endif 4808 275e8 endif ; TMPMEMADDRESS > $1FFF 4809 275e8 endif ; EXTRADLMEMORY 4810 275e8 4811 275e8 1d 6d ZONE6ADDRESS = TMPMEMADDRESS 4812 275e8 4813 275e8 DLINDEX SET DLINDEX + 1 4799 275e8 REPEND 4800 275e8 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 4801 275e8 ifconst EXTRADLMEMORY 4802 275e8 - if TMPMEMADDRESS > $1FFF 4803 275e8 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4804 275e8 else 4805 275e8 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 4806 275e8 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4807 275e8 endif 4808 275e8 endif ; TMPMEMADDRESS > $1FFF 4809 275e8 endif ; EXTRADLMEMORY 4810 275e8 4811 275e8 1e 40 ZONE7ADDRESS = TMPMEMADDRESS 4812 275e8 4813 275e8 DLINDEX SET DLINDEX + 1 4799 275e8 REPEND 4800 275e8 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 4801 275e8 ifconst EXTRADLMEMORY 4802 275e8 - if TMPMEMADDRESS > $1FFF 4803 275e8 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4804 275e8 else 4805 275e8 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 4806 275e8 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4807 275e8 endif 4808 275e8 endif ; TMPMEMADDRESS > $1FFF 4809 275e8 endif ; EXTRADLMEMORY 4810 275e8 4811 275e8 1f 12 ZONE8ADDRESS = TMPMEMADDRESS 4812 275e8 4813 275e8 DLINDEX SET DLINDEX + 1 4799 275e8 REPEND 4800 275e8 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 4801 275e8 ifconst EXTRADLMEMORY 4802 275e8 - if TMPMEMADDRESS > $1FFF 4803 275e8 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4804 275e8 else 4805 275e8 if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 4806 275e8 TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4807 275e8 endif 4808 275e8 endif ; TMPMEMADDRESS > $1FFF 4809 275e8 endif ; EXTRADLMEMORY 4810 275e8 4811 275e8 22 e4 ZONE9ADDRESS = TMPMEMADDRESS 4812 275e8 4813 275e8 DLINDEX SET DLINDEX + 1 4799 275e8 REPEND 4800 275e8 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 4801 275e8 ifconst EXTRADLMEMORY 4802 275e8 if TMPMEMADDRESS > $1FFF 4803 275e8 TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4804 275e8 - else 4805 275e8 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 4806 275e8 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4807 275e8 - endif 4808 275e8 endif ; TMPMEMADDRESS > $1FFF 4809 275e8 endif ; EXTRADLMEMORY 4810 275e8 4811 275e8 23 b6 ZONE10ADDRESS = TMPMEMADDRESS 4812 275e8 4813 275e8 DLINDEX SET DLINDEX + 1 4799 275e8 REPEND 4800 275e8 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 4801 275e8 ifconst EXTRADLMEMORY 4802 275e8 if TMPMEMADDRESS > $1FFF 4803 275e8 TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4804 275e8 - else 4805 275e8 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 4806 275e8 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4807 275e8 - endif 4808 275e8 endif ; TMPMEMADDRESS > $1FFF 4809 275e8 endif ; EXTRADLMEMORY 4810 275e8 4811 275e8 24 89 ZONE11ADDRESS = TMPMEMADDRESS 4812 275e8 4813 275e8 DLINDEX SET DLINDEX + 1 4799 275e8 REPEND 4800 275e8 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 4801 275e8 ifconst EXTRADLMEMORY 4802 275e8 if TMPMEMADDRESS > $1FFF 4803 275e8 TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4804 275e8 - else 4805 275e8 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 4806 275e8 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4807 275e8 - endif 4808 275e8 endif ; TMPMEMADDRESS > $1FFF 4809 275e8 endif ; EXTRADLMEMORY 4810 275e8 4811 275e8 25 5b ZONE12ADDRESS = TMPMEMADDRESS 4812 275e8 4813 275e8 DLINDEX SET DLINDEX + 1 4799 275e8 REPEND 4800 275e8 TMPMEMADDRESS SET (((DLINDEX*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) 4801 275e8 ifconst EXTRADLMEMORY 4802 275e8 if TMPMEMADDRESS > $1FFF 4803 275e8 TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4804 275e8 - else 4805 275e8 - if ((((DLINDEX+1)*WMEMSIZE)/WZONECOUNT)+WDLMEMSTART) > $1FFF 4806 275e8 -TMPMEMADDRESS SET (TMPMEMADDRESS + $300) 4807 275e8 - endif 4808 275e8 endif ; TMPMEMADDRESS > $1FFF 4809 275e8 endif ; EXTRADLMEMORY 4810 275e8 4811 275e8 26 2d ZONE13ADDRESS = TMPMEMADDRESS 4812 275e8 4813 275e8 DLINDEX SET DLINDEX + 1 4814 275e8 REPEND 4815 275e8 4816 275e8 $1880 to $23ff used as zone memory, allowing 41 display objects per zone. 4817 275e8 echo " ",[WDLMEMSTART],"to",[WDLMEMEND],"used as zone memory, allowing",[(DLLASTOBJ/5)]d,"display objects per zone." 4818 275e8 4819 275e8 DLHEIGHT 4820 275e8 REPEAT WZONECOUNT 4821 275e8 0f .byte.b (WZONEHEIGHT-1) 4820 275e8 REPEND 4821 275e9 0f .byte.b (WZONEHEIGHT-1) 4820 275e9 REPEND 4821 275ea 0f .byte.b (WZONEHEIGHT-1) 4820 275ea REPEND 4821 275eb 0f .byte.b (WZONEHEIGHT-1) 4820 275eb REPEND 4821 275ec 0f .byte.b (WZONEHEIGHT-1) 4820 275ec REPEND 4821 275ed 0f .byte.b (WZONEHEIGHT-1) 4820 275ed REPEND 4821 275ee 0f .byte.b (WZONEHEIGHT-1) 4820 275ee REPEND 4821 275ef 0f .byte.b (WZONEHEIGHT-1) 4820 275ef REPEND 4821 275f0 0f .byte.b (WZONEHEIGHT-1) 4820 275f0 REPEND 4821 275f1 0f .byte.b (WZONEHEIGHT-1) 4820 275f1 REPEND 4821 275f2 0f .byte.b (WZONEHEIGHT-1) 4820 275f2 REPEND 4821 275f3 0f .byte.b (WZONEHEIGHT-1) 4820 275f3 REPEND 4821 275f4 0f .byte.b (WZONEHEIGHT-1) 4820 275f4 REPEND 4821 275f5 0f .byte.b (WZONEHEIGHT-1) 4822 275f6 REPEND 4823 275f6 4824 275f6 ; Provided under the CC0 license. See the included LICENSE.txt for details. 4825 275f6 4826 275f6 ; a simple guard, than ensures the 7800basic code hasn't 4827 275f6 ; spilled into the encryption area... 2440 bytes left in the 7800basic reserved area. 4828 275f6 echo " ",($FF7E-*)d,"bytes left in the 7800basic reserved area." 4829 275f6 - if (*>$FF7D) 4830 275f6 - ERR ; abort the assembly 4831 275f6 endif 4832 275f6 ; Provided under the CC0 license. See the included LICENSE.txt for details. 4833 275f6 4834 275f6 - ifconst DEV 4835 275f6 - ifnconst ZONEHEIGHT 4836 275f6 - echo "* the 4k 7800basic area has",[($FF7E - *)]d,"bytes free." 4837 275f6 - else 4838 275f6 - if ZONEHEIGHT = 8 4839 275f6 - echo "* the 4k 7800basic area has",[($FF7E - *)]d,"bytes free." 4840 275f6 - else 4841 275f6 - echo "* the 4k 7800basic area has",[($FF7E - *)]d,"bytes free." 4842 275f6 - endif 4843 275f6 - endif 4844 275f6 endif 4845 275f6 4846 275f6 ; FF7E/FF7F contains the 7800basic crc checksum word 4847 275f6 4848 275f6 ; FF80 - FFF7 contains the 7800 encryption key 4849 275f6 4850 275f6 - ifnconst bankswitchmode 4851 275f6 - ORG $FFF8 4852 275f6 else 4853 275f6 ifconst ROM128K 4854 27ff8 ORG $27FF8 4855 27ff8 RORG $FFF8 4856 27ff8 endif 4857 27ff8 - ifconst ROM144K 4858 27ff8 - ORG $27FF8 4859 27ff8 - RORG $FFF8 4860 27ff8 endif 4861 27ff8 - ifconst ROM256K 4862 27ff8 - ORG $47FF8 4863 27ff8 - RORG $FFF8 4864 27ff8 endif 4865 27ff8 - ifconst ROM272K 4866 27ff8 - ORG $47FF8 4867 27ff8 - RORG $FFF8 4868 27ff8 endif 4869 27ff8 - ifconst ROM512K 4870 27ff8 - ORG $87FF8 4871 27ff8 - RORG $FFF8 4872 27ff8 endif 4873 27ff8 - ifconst ROM528K 4874 27ff8 - ORG $87FF8 4875 27ff8 - RORG $FFF8 4876 27ff8 endif 4877 27ff8 endif 4878 27ff8 4879 27ff8 4880 27ff8 ff .byte.b $FF ; region verification. $FF=all regions 4881 27ff9 f7 .byte.b $F7 ; high nibble: encryption check from $N000 to $FF7F. we only hash the last 4k for faster boot. 4882 27ffa ; low nibble : N=7 atari rainbow start, N=3 no atari rainbow 4883 27ffa 4884 27ffa ;Vectors 4885 27ffa 00 f0 .word.w NMI 4886 27ffc 04 f5 .word.w START 4887 27ffe 5f f0 .word.w IRQ 4888 28000