mads 2.1.0 build 8 (23 Dec 19) Source: antic_pfstoptiming.s 1 ; Altirra Acid800 test suite 2 ; Copyright (C) 2010-2011 Avery Lee, All Rights Reserved. 3 ; 4 ; Permission is hereby granted, free of charge, to any person obtaining a copy 5 ; of this software and associated documentation files (the "Software"), to deal 6 ; in the Software without restriction, including without limitation the rights 7 ; to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 ; copies of the Software, and to permit persons to whom the Software is 9 ; furnished to do so, subject to the following conditions: 10 ; 11 ; The above copyright notice and this permission notice shall be included in 12 ; all copies or substantial portions of the Software. 13 ; 14 ; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 ; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 ; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 ; AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 ; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 ; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 ; SOFTWARE. 21 22 FFFF0001 _SAP_HEADER "ANTIC: Playfield stop timing" Macro: _SAP_HEADER [Source: library.s] Source: antic_pfstoptiming.s 23 24 opt h+o+ 25 26 icl 'library.s' Source: library.s 1 ; Altirra Acid800 test suite 2 ; Copyright (C) 2010 Avery Lee, All Rights Reserved. 3 ; 4 ; Permission is hereby granted, free of charge, to any person obtaining a copy 5 ; of this software and associated documentation files (the "Software"), to deal 6 ; in the Software without restriction, including without limitation the rights 7 ; to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 ; copies of the Software, and to permit persons to whom the Software is 9 ; furnished to do so, subject to the following conditions: 10 ; 11 ; The above copyright notice and this permission notice shall be included in 12 ; all copies or substantial portions of the Software. 13 ; 14 ; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 ; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 ; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 ; AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 ; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 ; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 ; SOFTWARE. 21 22 ;========================================================================== 23 ; MEMORY MAP (800) 24 ; 25 ; $0000-007F OS zero page 26 ; $0080-00BF Module zero page 27 ; $00C0-00DF Library zero page 28 ; $00E0-00EF 80-column zero page 29 ; $0100-01FF 6502 stack 30 ; $0200-03FF OS database 31 ; $0400-09FF Boot loader / unused 32 ; $0A00-0AFF Boot loader / Veronica support resident page 33 ; $0B00-0BFF Boot loader / sector load buffer 34 ; $0C00-0FFF Boot loader / 16K display 35 ; $1000-18FF Resident test driver (full suite only) 36 ; $1900-19FF Segment tables (full suite only) 37 ; $1A00-1FFF Library code 38 ; $2000-3FFF Module run area 39 ; $4000-5FFF Segment load area / Extended memory window 40 ; $6000-7FFF 80-column screen A / Extended memory window 41 ; $9000-9BFF 80-column driver 42 ; $9C00-9FFF Unused (display list if cart) 43 ; $A000-BFFF 80-column screen B 44 ; 45 ; MEMORY MAP (5200) 46 ; 47 ; $0000-001F OS zero page 48 ; $0020-003F Display zero page 49 ; $0080-00BF Module zero page 50 ; $00C0-00DF Library zero page 51 ; $0100-01FF 6502 stack 52 ; $0200-021F OS database 53 ; $0220-027F Unused 54 ; $0280-02FF Library database 55 ; $0300-07FF Display memory 56 ; $0800-0FFF Unused 57 ; $1000-1FFF LZ decompression history window 58 ; $2000-3FFF Module run area 59 ; $4000-BFFF Cartridge library code and module store 60 ; 61 ; MEMORY MAP (SAP) 62 ; 63 ; $0080-00BF Module zero page 64 ; $00C0-00DF Library zero page 65 ; $0280-02FF Library database 66 ; $0300-07FF Display memory 67 ; $2000-3FFF Module run area 68 ; $4000-BFFF Module store 69 70 ;========================================================================== 71 ; CONFIGURATION 72 ; 73 .ifndef SYS800 74 = 0001 SEGS_IN_ROM = 1 75 .else 76 SEGS_MIN_MEM = 1 77 .endif 78 79 .ifdef SYS5200 80 = 0001 SEGS_LZPACK = 1 81 .endif 82 83 ;========================================================================== 84 ; HARDWARE INCLUDES 85 ; 86 .ifdef SYS5200 87 ;GTIA 88 = C000 gtia = $c000 89 = C000 m0pf equ $c000 90 = C001 m1pf equ $c001 91 = C002 m2pf equ $c002 92 = C003 m3pf equ $c003 93 = C004 p0pf equ $c004 94 = C005 p1pf equ $c005 95 = C006 p2pf equ $c006 96 = C007 p3pf equ $c007 97 = C008 m0pl equ $c008 98 = C009 m1pl equ $c009 99 = C00A m2pl equ $c00a 100 = C00B m3pl equ $c00b 101 = C00C p0pl equ $c00c 102 = C00D p1pl equ $c00d 103 = C00E p2pl equ $c00e 104 = C00F p3pl equ $c00f 105 = C000 hposp0 equ $c000 106 = C001 hposp1 equ $c001 107 = C002 hposp2 equ $c002 108 = C003 hposp3 equ $c003 109 = C004 hposm0 equ $c004 110 = C005 hposm1 equ $c005 111 = C006 hposm2 equ $c006 112 = C007 hposm3 equ $c007 113 = C008 sizep0 equ $c008 114 = C009 sizep1 equ $c009 115 = C00A sizep2 equ $c00a 116 = C00B sizep3 equ $c00b 117 = C00C sizem equ $c00c 118 = C00D grafp0 equ $c00d 119 = C00E grafp1 equ $c00e 120 = C00F grafp2 equ $c00f 121 = C010 grafp3 equ $c010 122 = C010 trig0 equ $c010 123 = C011 grafm equ $c011 124 = C012 colpm0 equ $c012 125 = C013 colpm1 equ $c013 126 = C014 colpm2 equ $c014 127 = C014 pal equ $c014 128 = C015 colpm3 equ $c015 129 = C016 colpf0 equ $c016 130 = C017 colpf1 equ $c017 131 = C018 colpf2 equ $c018 132 = C019 colpf3 equ $c019 133 = C01A colbk equ $c01a 134 = C01B prior equ $c01b 135 = C01C vdelay equ $c01c 136 = C01D gractl equ $c01d 137 = C01E hitclr equ $c01e 138 = C01F consol equ $c01f 139 140 ;POKEY 141 = E800 pokey = $e800 142 = E800 audf1 equ $e800 143 = E801 audc1 equ $e801 144 = E802 audf2 equ $e802 145 = E803 audc2 equ $e803 146 = E804 audf3 equ $e804 147 = E805 audc3 equ $e805 148 = E806 audf4 equ $e806 149 = E807 audc4 equ $e807 150 = E808 audctl equ $e808 151 = E809 stimer equ $e809 152 = E80A random equ $e80a 153 = E80A skres equ $e80a 154 = E80D serin equ $e80d 155 = E80D serout equ $e80d 156 = E80E irqen equ $e80e 157 = E80E irqst equ $e80e 158 = E80F skctl equ $e80f 159 = E80F skstat equ $e80f 160 .else 161 ;GTIA 162 gtia = $d000 163 m0pf equ $d000 164 m1pf equ $d001 165 m2pf equ $d002 166 m3pf equ $d003 167 p0pf equ $d004 168 p1pf equ $d005 169 p2pf equ $d006 170 p3pf equ $d007 171 m0pl equ $d008 172 m1pl equ $d009 173 m2pl equ $d00a 174 m3pl equ $d00b 175 p0pl equ $d00c 176 p1pl equ $d00d 177 p2pl equ $d00e 178 p3pl equ $d00f 179 hposp0 equ $d000 180 hposp1 equ $d001 181 hposp2 equ $d002 182 hposp3 equ $d003 183 hposm0 equ $d004 184 hposm1 equ $d005 185 hposm2 equ $d006 186 hposm3 equ $d007 187 sizep0 equ $d008 188 sizep1 equ $d009 189 sizep2 equ $d00a 190 sizep3 equ $d00b 191 sizem equ $d00c 192 grafp0 equ $d00d 193 grafp1 equ $d00e 194 grafp2 equ $d00f 195 grafp3 equ $d010 196 trig0 equ $d010 197 grafm equ $d011 198 colpm0 equ $d012 199 colpm1 equ $d013 200 colpm2 equ $d014 201 pal equ $d014 202 colpm3 equ $d015 203 colpf0 equ $d016 204 colpf1 equ $d017 205 colpf2 equ $d018 206 colpf3 equ $d019 207 colbk equ $d01a 208 prior equ $d01b 209 vdelay equ $d01c 210 gractl equ $d01d 211 hitclr equ $d01e 212 consol equ $d01f 213 214 ;POKEY 215 pokey = $d200 216 audf1 equ $d200 217 audc1 equ $d201 218 audf2 equ $d202 219 audc2 equ $d203 220 audf3 equ $d204 221 audc3 equ $d205 222 audf4 equ $d206 223 audc4 equ $d207 224 audctl equ $d208 225 stimer equ $d209 226 kbcode equ $d209 227 random equ $d20a 228 skres equ $d20a 229 serin equ $d20d 230 serout equ $d20d 231 irqen equ $d20e 232 irqst equ $d20e 233 skctl equ $d20f 234 skstat equ $d20f 235 236 ;PIA 237 porta equ $d300 238 portb equ $d301 239 pactl equ $d302 240 pbctl equ $d303 241 .endif 242 243 ;ANTIC 244 = D400 dmactl equ $d400 245 = D401 chactl equ $d401 246 = D402 dlistl equ $d402 247 = D403 dlisth equ $d403 248 = D404 hscrol equ $d404 249 = D405 vscrol equ $d405 250 = D407 pmbase equ $d407 251 = D409 chbase equ $d409 252 = D40A wsync equ $d40a 253 = D40B vcount equ $d40b 254 = D40E nmien equ $d40e 255 = D40F nmires equ $d40f 256 = D40F nmist equ $d40f 257 258 ;========================================================================== 259 ; OS INCLUDES (5200) 260 ; 261 .ifdef SYS5200 262 = 0000 pokmsk equ $00 263 = 0001 rtclok equ $01 264 ; equ $02 265 = 0003 critic equ $03 266 = 0004 atract equ $04 267 = 0005 sdlstl equ $05 268 = 0006 sdlsth equ $06 269 = 0007 sdmctl equ $07 270 = 0008 pcolr0 equ $08 271 = 0009 pcolr1 equ $09 272 = 000A pcolr2 equ $0a 273 = 000B pcolr3 equ $0b 274 = 000C color0 equ $0c 275 = 000D color1 equ $0d 276 = 000E color2 equ $0e 277 = 000F color3 equ $0f 278 = 0010 color4 equ $10 279 280 = 0200 vimirq equ $0200 ;IRQ immediate vector 281 = 0202 vvblki equ $0202 ;VBI immediate vector 282 = 0204 vvblkd equ $0204 ;VBI deferred vector 283 = 0206 vdslst equ $0206 ;display list vector 284 = 0208 vkybdi equ $0208 ;keyboard immediate vector 285 = 020A vkybdf equ $020a ;keyboard deferred vector 286 .endif 287 288 ;========================================================================== 289 ; OS INCLUDES (800) 290 ; 291 .ifndef SYS5200 292 pokmsk equ $10 293 rtclok equ $12 294 savmsc equ $58 295 ramtop equ $6a 296 297 vdslst equ $0200 298 vkeybd equ $0208 299 vimirq equ $0216 300 cdtmv1 equ $0218 301 vvblki equ $0222 302 vvblkd equ $0224 303 cdtma1 equ $0226 304 sdmctl equ $022f 305 sdlstl equ $0230 306 sdlsth equ $0231 307 sskctl equ $0232 308 runad equ $02e0 309 initad equ $02e2 310 memtop equ $02e5 311 ch1 equ $02f2 312 ch equ $02fc 313 314 ddevic equ $0300 315 dunit equ $0301 316 dcomnd equ $0302 317 dstats equ $0303 318 dbuflo equ $0304 319 dbufhi equ $0305 320 dtimlo equ $0306 321 dbytlo equ $0308 322 dbythi equ $0309 323 daux1 equ $030a 324 daux2 equ $030b 325 326 ichid equ $0340 327 iccmd equ $0342 328 icbal equ $0344 329 icbah equ $0345 330 icptl equ $0346 331 icpth equ $0347 332 icbll equ $0348 333 icblh equ $0349 334 icax1 equ $034a 335 icax2 equ $034b 336 337 basicf equ $03f8 338 339 dskinv equ $e453 340 ciov equ $e456 341 siov equ $e459 342 xitvbv equ $e462 343 .endif 344 345 ;========================================================================== 346 ; LIBRARY ZP 347 ; 348 = 00C0 a0 equ $c0 349 = 00C2 a1 equ $c2 350 = 00C4 a2 equ $c4 351 = 00C6 a3 equ $c6 352 = 00C8 d0 equ $c8 353 = 00C9 d1 equ $c9 354 = 00CA d2 equ $ca 355 = 00CB d3 equ $cb 356 = 00CC d4 equ $cc 357 = 00CD d5 equ $cd 358 = 00CE d6 equ $ce 359 = 00CF d7 equ $cf 360 361 ;========================================================================== 362 ; LIBRARY VARS 363 ; 364 opt o- 365 366 .ifdef SYS5200 367 opt f- 368 .else 369 .ifdef STANDALONE 370 opt o+ 371 .endif 372 .ifdef GENLIBRARY 373 opt o+ 374 .endif 375 .endif 376 377 .ifdef SYSSAP 378 org $0280 379 .endif 380 381 .ifdef SYS5200 382 org $0280 383 .endif 384 385 .ifdef SYS800 386 org $1a20 387 .endif 388 _intsOff dta 0 389 _scrnOff dta 0 390 _prevIRQ dta a(0) 391 _prevVBI dta a(0) 392 _exitTest dta a(0) 393 _exitTestS dta $ff 394 _vputchar dta a(0) 395 396 .ifdef SYS800 397 _vputunhook dta a(0) 398 .endif 399 400 = 0000 CPUMODE_6502 = 0 401 = 0001 CPUMODE_65C02 = 1 402 = 0080 CPUMODE_65C816_16 = 0x80 403 = 0081 CPUMODE_65C816_24 = 0x81 404 _cpuMode dta 0 405 406 _veronica dta 0 407 408 .ifdef SYS5200 409 sskctl dta 0 410 ch dta 0 411 keydel dta 0 412 413 org $02e0 414 runad dta a(0) 415 initad dta a(0) 416 .endif 417 418 .ifdef SEGS_IN_ROM 419 _lastMod dta 0 420 .endif 421 .ifdef SEGS_MIN_MEM 422 _lastMod dta 0 423 .endif 424 425 .ifdef SYS5200 426 .ifdef STANDALONE 427 opt o+f+ 428 .endif 429 .ifdef GENLIBRARY 430 opt o+f+ 431 .endif 432 433 .ifdef LIBBASE 434 org LIBBASE 435 .else 436 org $4000 437 .endif 438 .endif 439 440 .ifdef SYSSAP 441 org $4000 442 .endif 443 444 ;========================================================================== 445 ; MACROS 446 ; 447 .macro _INITTEST 448 jsr _imTestInit 449 dta :1,0 450 .endm 451 452 .macro _ASSERT1 453 lda :1 454 cmp #:2 455 beq pass 456 457 sta d1 458 jsr _testFailed 459 dta :3,0 460 pass: 461 .endm 462 463 .macro _ASSERT1_DUAL 464 lda :1 465 cmp #:2 466 beq pass 467 cmp #:3 468 beq pass 469 470 sta d1 471 jsr _testFailed 472 dta :4,0 473 pass: 474 .endm 475 476 .macro _ASSERTA 477 cmp #:1 478 beq pass 479 480 sta d1 481 jsr _testFailed 482 dta :2,0 483 pass: 484 .endm 485 486 .macro _ASSERTX 487 cpx #:1 488 beq pass 489 490 stx d1 491 jsr _testFailed 492 dta :2,0 493 pass: 494 .endm 495 496 .macro _ASSERTY 497 cpy #:1 498 beq pass 499 500 sty d1 501 jsr _testFailed 502 dta :2,0 503 pass: 504 .endm 505 506 .macro _FAIL 507 jsr _testFailed 508 dta :1,0 509 .endm 510 511 .macro _SKIP 512 jsr _testSkipped 513 dta :1,0 514 .endm 515 516 .macro _SAP_HEADER 517 .ifdef GENSAP 518 opt o+h-f- 519 org $0700 520 dta c"SAP",$0d,$0a 521 dta c"AUTHOR ",$22,c"Avery Lee",$22,$0d,$0a 522 dta c"NAME ",$22,c":1",$22,$0d,$0a 523 dta c"TYPE D",$0d,$0a 524 dta c"INIT 2000",$0d,$0a 525 dta c"TIME 00:",c"05",$0d,$0a 526 dta a($ffff) 527 .endif 528 .endm 529 530 ;========================================================================== 531 .nowarn .proc _crt0init 532 .ifdef SYSSAP 533 jsr _crt0init_sap 534 .endif 535 536 ;clear zero page and database 537 .ifdef SYS5200 538 ldx #$20 539 lda #0 540 zploop: 541 sta 0,x 542 inx 543 bne zploop 544 ldx #$80 545 dbloop: 546 sta $0200,x 547 inx 548 bne dbloop 549 .endif 550 551 ;clear options (keep in sync with options.s) 552 ldx #6 553 lda #0 554 .ifdef SYS5200 555 sta:rpl $02f0,x- 556 .else 557 sta:rpl $1a00,x- 558 .endif 559 560 ;detect CPU 561 ldy #CPUMODE_6502 562 sed 563 lda #$99 564 clc 565 adc #$01 566 cld 567 bne detdone 568 569 ;we have at least a 65C02... check for 65C816 570 ldy #CPUMODE_65C02 571 572 sec 573 opt c+ 574 rep #$01 575 bcs detdone 576 sep #$01 577 bcc detdone 578 579 ldy #CPUMODE_65C816_16 580 581 ;check for 24-bit addressing 582 lda d3+$10000 583 tax 584 eor #$f5 585 sta d3 586 txa 587 cmp d3+$10000 588 sne 589 iny 590 591 opt c- 592 593 detdone: 594 sty _cpuMode 595 596 .ifdef SYS5200 597 jsr _crt0init_5200 598 .endif 599 600 .ifdef SYS800 601 ;init putchar handler 602 mwa icptl _vputchar 603 inw _vputchar 604 .endif 605 606 rts 607 .endp 608 609 ;========================================================================== 610 .nowarn .proc _interruptsOff 611 lda _intsOff 612 bmi xit 613 sei 614 mwa vimirq _prevIRQ 615 mva #$ff _intsOff 616 xit: 617 rts 618 .endp 619 620 ;========================================================================== 621 .nowarn .proc _interruptsOn 622 lda _intsOff 623 bpl xit 624 sei 625 mwa _prevIRQ vimirq 626 mva pokmsk irqen 627 mva #$00 _intsOff 628 cli 629 xit: 630 rts 631 .endp 632 633 ;========================================================================== 634 .nowarn .proc _screenOn 635 .ifndef SYSSAP 636 lda _scrnOff 637 bpl xit 638 639 jsr _waitVBL 640 641 sei 642 lda #0 643 sta wsync 644 sta nmien 645 mva #$22 dmactl 646 mwa sdlstl dlistl 647 mwa _prevVBI vvblki 648 lda #$40 649 sta nmien 650 cli 651 652 jsr _waitVBL 653 sta wsync 654 sta wsync 655 jsr _waitVBL 656 .endif 657 658 mva #$00 _scrnOff 659 xit: 660 rts 661 .endp 662 663 ;========================================================================== 664 .nowarn .proc _screenOff 665 .ifndef SYSSAP 666 lda _scrnOff 667 bmi xit 668 669 jsr _waitVBL 670 671 php 672 sei 673 lda #0 674 sta wsync 675 sta nmien 676 sta dmactl 677 mwa vvblki _prevVBI 678 plp 679 .endif 680 681 mva #$ff _scrnOff 682 xit: 683 rts 684 .endp 685 686 ;========================================================================== 687 .nowarn .proc _waitVBL 688 lda #123 689 cmp:rne vcount 690 cmp:req vcount 691 rts 692 .endp 693 694 ;========================================================================== 695 .nowarn .proc _waitFrame 696 inc wsync 697 inc wsync 698 jmp _waitVBL 699 .endp 700 701 ;========================================================================== 702 .nowarn .proc _waitKeyPrompt 703 jsr _imprint 704 dta c"Press a key...",0 705 .ifdef SYS5200 706 mva #$ff ch 707 lda:rmi ch 708 .else 709 lda #0 710 sta ch 711 sta ch1 712 lda:req ch 713 .endif 714 jsr _imprint 715 dta $9c,0 716 rts 717 .endp 718 719 ;========================================================================== 720 .nowarn .proc _resetAV 721 lda #0 722 sta gractl 723 sta grafp0 724 sta grafp1 725 sta grafp2 726 sta grafp3 727 sta grafm 728 sta audc1 729 sta audc2 730 sta audc3 731 sta audc4 732 rts 733 .endp 734 735 ;========================================================================== 736 .nowarn .proc _imprint 737 pla 738 tax 739 pla 740 tay 741 inx 742 sne:iny 743 txa 744 jsr _print 745 lda a0+1 746 pha 747 lda a0 748 pha 749 rts 750 .endp 751 752 ;========================================================================== 753 .nowarn .proc _imprintf 754 pla 755 tax 756 pla 757 tay 758 inx 759 sne:iny 760 txa 761 jsr _printf 762 lda a0+1 763 pha 764 lda a0 765 pha 766 rts 767 .endp 768 769 ;========================================================================== 770 .nowarn .proc _print 771 sta a0 772 sty a0+1 773 charloop: 774 ldy #0 775 lda (a0),y 776 beq done 777 inw a0 778 jsr _printf.putbyte 779 jmp charloop 780 done: 781 rts 782 .endp 783 784 ;========================================================================== 785 .nowarn .proc _println 786 jsr _imprint 787 dta $9b,0 788 rts 789 .endp 790 ;========================================================================== 791 .nowarn .proc _printf 792 sta a0 793 sty a0+1 794 ldy #0 795 sty d0 796 charloop: 797 lda (a0),y 798 beq done 799 inw a0 800 cmp #'%' 801 beq special 802 escaped: 803 jsr putbyte 804 nextchar: 805 ldy #0 806 jmp charloop 807 done: 808 rts 809 special: 810 inc d0 811 ldx d0 812 lda (a0),y 813 inw a0 814 cmp #'d' 815 bne notdec 816 tya 817 sty a1 818 ldy #6 819 sei 820 sed 821 decloop1: 822 rol d0,x 823 adc a1 824 sta a1 825 dey 826 bne decloop1 827 sty a1+1 828 ldy #2 829 decloop2: 830 rol d0,x 831 adc a1 832 sta a1 833 rol a1+1 834 dey 835 bne decloop2 836 cld 837 cli 838 lda a1+1 839 beq decdigit2 840 tax 841 lda _hexdig,x 842 jsr putbyte 843 lda a1 844 jsr puthex 845 jmp nextchar 846 decdigit2: 847 lda a1 848 cmp #$10 849 bcc decdigit1 850 jsr puthex 851 jmp nextchar 852 decdigit1: 853 tax 854 lda _hexdig,x 855 jmp escaped 856 857 notdec: 858 cmp #'x' 859 bne nothex 860 lda d0,x 861 jsr puthex 862 jmp nextchar 863 864 nothex: 865 cmp #'X' 866 bne nothexword 867 inc d0 868 lda d1,x 869 jsr puthex 870 ldx d0 871 lda d0-1,x 872 jsr puthex 873 jmp nextchar 874 875 nothexword: 876 cmp #'D' 877 bne notdecword 878 879 ldy #8 880 lda #0 881 sta a1 882 sta a1+1 883 sta a2 884 sei 885 sed 886 decword1: 887 rol d1,x 888 lda a1 889 adc a1 890 sta a1 891 lda a1+1 892 adc a1+1 893 sta a1+1 894 dey 895 bne decword1 896 897 ldy #8 898 decword2: 899 rol d0,x 900 lda a1 901 adc a1 902 sta a1 903 lda a1+1 904 adc a1+1 905 sta a1+1 906 lda a2 907 adc a2 908 sta a2 909 dey 910 bne decword2 911 cld 912 cli 913 914 tax 915 beq decword3 916 jsr puthexcond 917 lda a1+1 918 jsr puthex 919 lda a1 920 jsr puthex 921 jmp nextchar 922 923 decword3: 924 lda a1+1 925 beq decword4 926 lda a1 927 jsr puthex 928 jmp nextchar 929 930 decword4: 931 lda a1 932 jsr puthex 933 jmp nextchar 934 935 notdecword: 936 cmp #'c' 937 bne notchar 938 inc d0 939 lda d0,x 940 jsr putbyte 941 jmp nextchar 942 943 notchar: 944 cmp #'s' 945 bne notstr 946 947 inc d0 948 lda d0,x 949 sta a1 950 lda d0+1,x 951 sta a1+1 952 953 strloop: 954 ldy #0 955 lda (a1),y 956 beq strdone 957 jsr putbyte2 958 inw a1 959 jmp strloop 960 961 strdone: 962 jmp nextchar 963 964 notstr: 965 dec d0 966 jmp escaped 967 968 puthexcond: 969 cmp #$10 970 bcs puthex 971 tax 972 lda _hexdig,x 973 jmp putbyte 974 puthex: 975 pha 976 lsr 977 lsr 978 lsr 979 lsr 980 tax 981 lda _hexdig,x 982 jsr putbyte 983 pla 984 and #$0f 985 tax 986 lda _hexdig,x 987 jmp putbyte 988 989 putbyte: 990 tax 991 jsr putbyte2 992 txa 993 rts 994 995 putbyte2: 996 jmp (_vputchar) 997 .endp 998 999 ;========================================================================== 1000 .nowarn .proc _jam 1001 loop: 1002 jmp loop 1003 .endp 1004 1005 ;========================================================================== 1006 .nowarn .proc _waitVCount 1007 cmp:rne vcount 1008 rts 1009 .endp 1010 1011 ;========================================================================= 1012 .nowarn .proc _imTestInit 1013 pla 1014 sta a0 1015 tay 1016 pla 1017 sta a0+1 1018 1019 inw a0 1020 1021 mva #0 a1 1022 mva a0+1 a1+1 1023 skiploop: 1024 lda (a1),y 1025 beq skipdone 1026 iny 1027 sne:inc a1+1 1028 jmp skiploop 1029 skipdone: 1030 lda a1+1 1031 pha 1032 tya 1033 pha 1034 lda a0 1035 ldy a0+1 1036 jmp _testInit 1037 .endp 1038 1039 ;========================================================================= 1040 .nowarn .proc _testInit 1041 .ifdef STANDALONE 1042 pha 1043 tya 1044 pha 1045 1046 .ifdef SYS800 1047 ;MaxFlash carts run executables with E: closed. Check for this and 1048 ;reopen it if necessary. 1049 lda ichid 1050 bpl iocb0_open 1051 1052 ;reopen IOCB 0 1053 mva #$03 iccmd 1054 mwa #e_name icbal 1055 ldx #0 1056 stx icax1 1057 mva #$0c icax2 1058 jsr ciov 1059 1060 iocb0_open: 1061 .endif 1062 1063 jsr _crt0init 1064 1065 pla 1066 tay 1067 pla 1068 .endif 1069 1070 jsr _print 1071 jsr _imprint 1072 dta c"...",0 1073 1074 .ifdef STANDALONE 1075 mwa #_testEnd _exitTest 1076 .else 1077 :10 nop 1078 .endif 1079 1080 rts 1081 1082 msg: 1083 dta c"...",0 1084 e_name: 1085 dta 'E',$9B 1086 .endp 1087 1088 ;========================================================================= 1089 .nowarn .proc _testEnd 1090 .ifdef SYSSAP 1091 .ifdef STANDALONE 1092 jmp _sap_testEnd 1093 .else 1094 jmp _jam 1095 .endif 1096 .else 1097 .ifdef SYS5200 1098 jmp _jam 1099 .else 1100 ;wait for key 1101 sei 1102 lda #0 1103 sta nmien 1104 sta irqen 1105 mva #3 skctl 1106 mva #$40 irqen 1107 bit:rne irqst 1108 1109 ;initiate soft reset 1110 jmp ($fffc) 1111 .endif 1112 .endif 1113 .endp 1114 1115 ;========================================================================= 1116 .nowarn .proc _testRestore 1117 cld 1118 php 1119 sei 1120 1121 ;check if the screen is off; if so, make sure we kill DLIs 1122 lda _scrnOff 1123 beq scrnOK 1124 1125 lda #0 1126 inc wsync 1127 sta nmien 1128 1129 scrnOK: 1130 1131 mva sskctl skctl 1132 1133 .ifdef SYSSAP 1134 ;kill PIA port A interrupt 1135 mva #$3c pactl 1136 1137 ;force kernel ROMs back _out_ 1138 mva #$38 pbctl 1139 mva #$ff portb 1140 mva #$3c pbctl 1141 mva #$82 portb 1142 .endif 1143 1144 .ifdef SYS5200 1145 mva #$00 prior 1146 mva #$f8 chbase 1147 mva #$02 chactl 1148 mva #$04 consol 1149 .endif 1150 1151 .ifdef SYS800 1152 ;kill PIA port A interrupt 1153 mva #$3c pactl 1154 1155 ;force kernel ROMs back in 1156 mva #$38 pbctl 1157 mva #$00 portb 1158 mva #$3c pbctl 1159 mva #$83 portb 1160 1161 ;kill OS timer 1 1162 ldx #$ff 1163 stx wsync 1164 stx cdtmv1 1165 inx 1166 stx cdtmv1 1167 stx cdtmv1+1 1168 .endif 1169 1170 plp 1171 jsr _interruptsOn 1172 jsr _screenOn 1173 jsr _resetAV 1174 1175 ;unmask interrupts 1176 cli 1177 rts 1178 .endp 1179 1180 ;========================================================================= 1181 .nowarn .proc _testPassed 1182 jsr _testRestore 1183 1184 jsr _imprint 1185 dta c"Pass",$9b,0 1186 1187 ldx _exitTestS 1188 txs 1189 ldy #0 1190 jmp (_exitTest) 1191 .endp 1192 1193 ;========================================================================= 1194 .nowarn .proc _testFailed 1195 jsr _testRestore 1196 1197 jsr _imprint 1198 dta c"FAIL.",$9b,0 1199 1200 nomsgentry: 1201 pla 1202 tax 1203 pla 1204 tay 1205 inx 1206 sne:iny 1207 txa 1208 jsr _printf 1209 jsr _println 1210 1211 ldx _exitTestS 1212 txs 1213 ldy #$80 1214 jmp (_exitTest) 1215 1216 msg2: 1217 dta $9b,0 1218 .endp 1219 1220 ;========================================================================= 1221 .nowarn .proc _testFailed2 1222 jsr _testRestore 1223 jmp _testFailed.nomsgentry 1224 .endp 1225 1226 ;========================================================================= 1227 .nowarn .proc _testSkipped 1228 jsr _testRestore 1229 1230 jsr _imprint 1231 dta c"Skipped",$9b,0 1232 1233 pla 1234 tax 1235 pla 1236 tay 1237 inx 1238 sne:iny 1239 txa 1240 jsr _printf 1241 1242 jsr _println 1243 1244 ldx _exitTestS 1245 txs 1246 ldy #$40 1247 jmp (_exitTest) 1248 .endp 1249 1250 ;========================================================================== 1251 ; _loadSeg() 1252 ; 1253 ; Module loader. 1254 ; 1255 ; X = index of module to load 1256 ; 1257 .ifdef SEGS_MIN_MEM 1258 .nowarn .proc _loadSeg 1259 ;get starting sector 1260 mva segaddrlo,x daux1 1261 mva segaddrhi,x daux2 1262 1263 ;get ending sector 1264 lda segaddrlo+1,x 1265 sub daux1 1266 sta d7 1267 1268 ;setup sector load command and relocation 1269 mva #'R' dcomnd 1270 mva #1 dunit 1271 lda #$00 1272 sta dbuflo 1273 sta a0 1274 sta runad+1 1275 lda #$0b 1276 sta dbufhi 1277 sta a0+1 1278 1279 ;preload first two sectors 1280 jsr step_sector 1281 relocloop: 1282 ;load starting address 1283 mva (a0),y a1 1284 iny:sne:jsr step_sector 1285 mva (a0),y a1+1 1286 iny:sne:jsr step_sector 1287 1288 ;skip $ffff words 1289 lda a1 1290 and a1+1 1291 cmp #$ff 1292 beq relocloop 1293 1294 ;load ending address 1295 mva (a0),y a2 1296 iny:sne:jsr step_sector 1297 mva (a0),y a2+1 1298 iny:sne:jsr step_sector 1299 inw a2 1300 1301 mwa #definit initad 1302 1303 ;copy data (slow, but oh well) 1304 ldx #0 1305 copyloop: 1306 lda (a0),y 1307 sta (a1,x) 1308 iny:sne:jsr step_sector 1309 inw a1 1310 lda a1 1311 cmp a2 1312 bne copyloop 1313 lda a1+1 1314 cmp a2+1 1315 bne copyloop 1316 1317 ;init a segment 1318 jsr doinit 1319 1320 ;check if we're done 1321 lda runad+1 1322 beq relocloop 1323 rts 1324 1325 doinit: 1326 jmp (initad) 1327 1328 step_sector: 1329 lda d7 1330 beq no_sectors_left 1331 jsr dskinv 1332 dec d7 1333 inw daux1 1334 lda dbuflo 1335 eor #$80 1336 sta dbuflo 1337 bne step_sector 1338 no_sectors_left: 1339 ldy #0 1340 ldx #0 1341 definit: 1342 rts 1343 .endp 1344 .else 1345 .nowarn .proc _loadSeg 1346 .ifdef SEGS_IN_ROM 1347 stx _lastMod 1348 rts 1349 .else 1350 ;get starting sector 1351 mva segaddrlo,x daux1 1352 mva segaddrhi,x daux2 1353 1354 ;get ending sector 1355 mva segaddrlo+1,x a0 1356 mva segaddrhi+1,x a0+1 1357 1358 ;load sectors starting at $4000 1359 sectorloop: 1360 mva #'R' dcomnd 1361 mva #1 dunit 1362 mwa #$4000 dbuflo 1363 1364 jsr dskinv 1365 tya 1366 bmi sectorloop 1367 1368 lda #$80 1369 eor dbuflo 1370 sta dbuflo 1371 sne:inc dbufhi 1372 1373 inc daux1 1374 sne:inc daux2 1375 1376 lda daux1 1377 cmp a0 1378 bne sectorloop 1379 lda daux2 1380 cmp a0+1 1381 bne sectorloop 1382 rts 1383 .endif 1384 .endp 1385 .endif 1386 1387 ;========================================================================== 1388 ; _runSeg() 1389 ; 1390 ; Module relocator and executor. 1391 ; 1392 ; The last segment loaded by _loadSeg() is relocated and executed. 1393 ; 1394 1395 .ifdef SEGS_MIN_MEM 1396 1397 ;----------------------------------------------- 1398 ; Minimum memory implementation. 1399 .nowarn .proc _runSeg 1400 jmp (runad) 1401 .endp 1402 1403 .else 1404 1405 ;----------------------------------------------- 1406 .nowarn .proc _runSeg 1407 1408 ;begin relocation 1409 mwa #relocloop runad 1410 1411 .ifdef SEGS_IN_ROM 1412 ldx _lastMod 1413 mva segaddrlo,x a0 1414 mva segaddrhi,x a0+1 1415 .else 1416 mwa #$4000 a0 1417 .endif 1418 1419 .ifndef SEGS_LZPACK 1420 1421 ;==== uncompressed version 1422 1423 ldy #0 1424 relocloop: 1425 ;load starting address 1426 mva (a0),y a1 1427 inw a0 1428 mva (a0),y a1+1 1429 inw a0 1430 1431 ;skip $ffff words 1432 lda a1 1433 and a1+1 1434 cmp #$ff 1435 beq relocloop 1436 1437 ;load ending address 1438 mva (a0),y a2 1439 inw a0 1440 mva (a0),y a2+1 1441 inw a0 1442 inw a2 1443 1444 ;copy data (slow, but oh well) 1445 copyloop: 1446 lda (a0),y 1447 sta (a1),y 1448 inw a0 1449 inw a1 1450 lda a1 1451 cmp a2 1452 bne copyloop 1453 lda a1+1 1454 cmp a2+1 1455 bne copyloop 1456 1457 ;init a segment 1458 mwa #definit initad 1459 jsr doinit 1460 jmp (runad) 1461 1462 doinit: 1463 jmp (initad) 1464 1465 definit: 1466 rts 1467 1468 .else 1469 1470 ;==== compressed version 1471 ; 1472 ;loader: 1473 ; a3 destination 1474 ; d6/d7 segment end address 1475 ; 1476 ;decompressor: 1477 ; a0 raw source stream 1478 ; a1 run source pointer 1479 ; a2 window pointer ($1000-1fff) 1480 ; d0 literal/run flag bits 1481 ; d1 remaining flag bits shifter 1482 ; d2 run length counter 1483 ; d3 temporary 1484 ; d4 superflag bits 1485 ; d5 superflag shifter 1486 1487 lda #0 1488 sta d0 1489 sta d1 1490 sta d2 1491 sta d5 1492 sta a2 1493 lda #$10 1494 sta a2+1 1495 relocloop: 1496 ldy #0 1497 ;load starting address 1498 jsr getbyte 1499 sta a3 1500 jsr getbyte 1501 sta a3+1 1502 1503 ;skip $ffff words 1504 and a3 1505 cmp #$ff 1506 beq relocloop 1507 1508 ;load ending address 1509 jsr getbyte 1510 sta d6 1511 jsr getbyte 1512 sta d7 1513 inw d6 1514 1515 ;copy data (slow, but oh well) 1516 copyloop: 1517 jsr getbyte 1518 sta (a3),y 1519 inw a3 1520 lda a3 1521 cmp d6 1522 bne copyloop 1523 lda a3+1 1524 cmp d7 1525 bne copyloop 1526 1527 ;init a segment 1528 mwa #definit initad 1529 jsr doinit 1530 jmp (runad) 1531 1532 doinit: 1533 jmp (initad) 1534 1535 getbyte: 1536 ;check if we have a run in progress 1537 lda d2 1538 bne getrunbyte 1539 1540 ;check if we need to reload flag bits 1541 asl d1 1542 bne havebits 1543 1544 ;check if we need to reload superflag bits 1545 asl d5 1546 bne havesuperbits 1547 1548 ;load next superflag byte 1549 jsr getrawbyte 1550 sta d4 1551 lda #$7f 1552 sta d5 1553 1554 havesuperbits: 1555 ;pull next superflag and check if it's all literals (0) 1556 asl d4 1557 bcc all_literals 1558 1559 ;nope... read next byte as flags byte 1560 jsr getrawbyte 1561 sta d0 1562 1563 all_literals: 1564 lda #$7f 1565 sta d1 1566 havebits: 1567 asl d0 1568 bcs isrun 1569 1570 ;store byte into window 1571 jsr getrawbyte 1572 jmp putwinbyte 1573 1574 isrun: 1575 ;load offset/run bytes 1576 jsr getrawbyte 1577 sta d3 1578 jsr getrawbyte 1579 sta d2 1580 1581 ;compute run source from current position and offset 1582 lda a2 1583 clc 1584 sbc d3 1585 sta a1 1586 lda a2+1 1587 sbc d2 1588 and #$0f 1589 ora #$10 1590 sta a1+1 1591 1592 ;compute length and stash run length 1593 lda d2 1594 lsr 1595 lsr 1596 lsr 1597 lsr 1598 add #3 1599 sta d2 1600 getrunbyte: 1601 dec d2 1602 ldy #0 1603 lda (a1),y 1604 inc a1 1605 bne putwinbyte 1606 inc a1+1 1607 pha 1608 lda a1+1 1609 and #$0f 1610 ora #$10 1611 sta a1+1 1612 pla 1613 jmp putwinbyte 1614 1615 getrawbyte: 1616 lda (a0),y 1617 inw a0 1618 rts 1619 1620 putwinbyte: 1621 sta (a2),y 1622 inc a2 1623 seq:rts 1624 ldy a2+1 1625 iny 1626 cpy #$20 1627 sne:ldy #$10 1628 sty a2+1 1629 ldy #0 1630 definit: 1631 rts 1632 1633 .endif 1634 .endp 1635 .endif 1636 1637 ;========================================================================== 1638 _hexdig dta c"0123456789ABCDEF" 1639 1640 ;========================================================================== 1641 ; segment table 1642 ; 1643 .ifndef SYS800 1644 = BF00 segaddrlo equ $bf00 1645 = BF80 segaddrhi equ $bf80 1646 .else 1647 segaddrlo equ $1900 1648 segaddrhi equ $1980 1649 .endif 1650 1651 = 0900 _veronicaLaunch = $0900 1652 1653 ;========================================================================== 1654 ; platform-specific library 1655 ; 1656 .ifdef SYS5200 1657 icl 'lib5200.s' Source: lib5200.s 1 ; Altirra Acid800 test suite 2 ; Copyright (C) 2010 Avery Lee, All Rights Reserved. 3 ; 4 ; Permission is hereby granted, free of charge, to any person obtaining a copy 5 ; of this software and associated documentation files (the "Software"), to deal 6 ; in the Software without restriction, including without limitation the rights 7 ; to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 ; copies of the Software, and to permit persons to whom the Software is 9 ; furnished to do so, subject to the following conditions: 10 ; 11 ; The above copyright notice and this permission notice shall be included in 12 ; all copies or substantial portions of the Software. 13 ; 14 ; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 ; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 ; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 ; AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 ; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 ; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 ; SOFTWARE. 21 22 .proc _crt0init_5200 23 lda #$02 24 sta sskctl 25 sta skctl 26 27 mva #$04 consol 28 mva #$00 keydel 29 30 php 31 sei 32 33 lda pokmsk 34 ora #$c0 35 sta pokmsk 36 sta irqen 37 38 mwa #_kybd_handler vkybdf 39 mwa #_vbd_handler vvblkd 40 41 plp 42 rts 43 .endp 44 45 ;========================================================================== 46 .proc _kybd_handler 47 ;The bass-ackward design of the 5200 keyboard causes an IRQ to occur 48 ;every 32 scanlines while a key is held down. We require keys to be 49 ;released for at least one full frame before we recognize another 50 ;one. 51 ldx keydel 52 sne:sta ch 53 lda #2 54 sta keydel 55 pla 56 tay 57 pla 58 tax 59 pla 60 rti 61 .endp 62 63 ;========================================================================== 64 .proc _vbd_handler 65 lda keydel 66 seq:dec keydel 67 68 plr 69 rti 70 .endp 71 1658 .endif 1659 .ifdef SYSSAP 1660 icl 'libsap.s' 1661 .endif 1662 1663 ;========================================================================== 1664 .ifndef STANDALONE 1665 .ifdef SYS5200 1666 opt o+ 1667 .else 1668 opt h+o+ 1669 .endif 1670 .endif 27 28 org $2000 29 30 ;DISPLAY_MODE = 1 31 32 main: 33 2000 _INITTEST c"ANTIC: Playfield stop timing" Macro: _INITTEST [Source: library.s] 1 FFFF> 2000-24FD> 20 EC + jsr _imTestInit 2 2003 41 4E 54 49 43 3A + dta c"ANTIC: Playfield stop timing",0 Source: antic_pfstoptiming.s 34 35 ;kill screen 36 2020 20 C5 A0 jsr _screenOff 37 2023 20 4B A0 jsr _interruptsOff 38 39 ;wait for vertical blank and swap in new display list 40 2026 20 ED A0 jsr _waitVBL 41 42 2029 A9 88 8D 06 02 A9 + mwa #dli1 vdslst 43 2033 A9 00 8D 02 D4 A9 + mwa #dlist dlistl 44 203D A9 21 8D 00 D4 mva #$21 dmactl 45 2042 A9 80 8D 00 C0 mva #$80 hposp0 46 2047 A9 84 8D 01 C0 mva #$84 hposp1 47 204C A9 F0 8D 0D C0 mva #$f0 grafp0 48 2051 A9 F0 8D 0E C0 mva #$f0 grafp1 49 2056 A9 00 8D 08 C0 mva #$00 sizep0 50 205B A9 00 8D 09 C0 mva #$00 sizep1 51 2060 A9 00 8D 1D C0 mva #$00 gractl 52 2065 A9 80 8D 0E D4 mva #$80 nmien 53 206A A9 07 8D 05 D4 mva #$07 vscrol 54 55 .ifdef DISPLAY_MODE 56 jmp * 57 .else 58 206F 20 FA A0 jsr _waitFrame 59 2072 _FAIL c"DLIs did not fire." Macro: _FAIL [Source: library.s] 1 2072 20 82 A3 jsr _testFailed 2 2075 44 4C 49 73 20 64 + dta c"DLIs did not fire.",0 Source: antic_pfstoptiming.s 60 .endif 61 62 ;========================================================================= 63 2088 .proc dli1 64 2088 48 8A 48 98 48 phr 65 208D 8D 0A D4 sta wsync 66 2090 A9 07 8D 05 D4 mva #$07 vscrol 67 2095 A9 22 lda #$22 68 2097 A2 21 ldx #$21 69 2099 EA nop 70 209A 8D 0A D4 sta wsync 71 209D 48 68 pha:pla ;*, 104, 105, 106, 107, 108, 109 72 209F 48 68 pha:pla ;110, 111, 112, 113, 0, 1*, 2, 3 73 20A1 EA EA EA nop:nop:nop ;4, 5, 6, 7, 8, 9 74 20A4 48 68 48 68 48 68 + :4 pha:pla 75 20AC 24 FF bit $ff 76 20AE 8D 00 D4 sta dmactl ; 77 20B1 8D 0A D4 sta wsync 78 20B4 8E 00 D4 stx dmactl 79 20B7 8D 1E C0 sta hitclr 80 20BA 8D 0A D4 sta wsync 81 20BD AD 04 C0 lda p0pf 82 20C0 0A asl 83 20C1 0A asl 84 20C2 0D 05 C0 ora p1pf 85 20C5 18 69 0E add #14 86 .ifndef DISPLAY_MODE 87 20C8 _ASSERTA 18, c"Character mode DMACTL early test failed: stride=%d" Macro: _ASSERTA [Source: library.s] 1 20C8 C9 12 cmp #18 2 20CA F0 38 beq pass 4 20CC 85 C9 sta d1 5 20CE 20 82 A3 jsr _testFailed 6 20D1 43 68 61 72 61 63 + dta c"Character mode DMACTL early test failed: stride=%d",0 7 2104 pass: Source: antic_pfstoptiming.s 88 .endif 89 90 2104 A9 14 8D 06 02 A9 + mwa #dli2 vdslst 91 210E 68 A8 68 AA 68 plr 92 2113 40 rti 93 .endp 94 95 ;========================================================================= 96 2114 .proc dli2 97 2114 48 8A 48 98 48 phr 98 2119 8D 0A D4 sta wsync 99 211C A9 07 8D 05 D4 mva #$07 vscrol 100 2121 A9 22 lda #$22 101 2123 A2 21 ldx #$21 102 2125 EA nop 103 2126 8D 0A D4 sta wsync 104 2129 48 68 pha:pla ;*, 104, 105, 106, 107, 108, 109 105 212B 48 68 pha:pla ;110, 111, 112, 113, 0, 1*, 2, 3 106 212D 48 68 pha:pla ;4, 5, 6, 7, 8, 9, 10 107 212F 48 68 48 68 48 68 + :4 pha:pla 108 2137 EA EA nop:nop 109 2139 8D 00 D4 sta dmactl ; 110 213C 8D 0A D4 sta wsync 111 213F 8E 00 D4 stx dmactl 112 2142 8D 1E C0 sta hitclr 113 2145 8D 0A D4 sta wsync 114 2148 AD 04 C0 lda p0pf 115 214B 0A asl 116 214C 0A asl 117 214D 0D 05 C0 ora p1pf 118 2150 18 69 0E add #14 119 .ifndef DISPLAY_MODE 120 2153 _ASSERTA 16, c"Character mode DMACTL late test failed: stride=%d" Macro: _ASSERTA [Source: library.s] 1 2153 C9 10 cmp #16 2 2155 F0 37 beq pass 4 2157 85 C9 sta d1 5 2159 20 82 A3 jsr _testFailed 6 215C 43 68 61 72 61 63 + dta c"Character mode DMACTL late test failed: stride=%d",0 7 218E pass: Source: antic_pfstoptiming.s 121 .endif 122 123 218E A9 9E 8D 06 02 A9 + mwa #dli3 vdslst 124 2198 68 A8 68 AA 68 plr 125 219D 40 rti 126 .endp 127 128 ;========================================================================= 129 219E .proc dli3 130 219E 48 8A 48 98 48 phr 131 21A3 8D 0A D4 sta wsync 132 21A6 A9 03 8D 05 D4 mva #$03 vscrol 133 21AB A9 22 lda #$22 134 21AD A2 21 ldx #$21 135 21AF EA nop 136 21B0 8D 0A D4 sta wsync 137 21B3 48 68 pha:pla ;*, 104, 105, 106, 107, 108, 109 138 21B5 48 68 pha:pla ;110, 111, 112, 113, 0, 1*, 2, 3 139 21B7 EA EA EA nop:nop:nop ;4, 5, 6, 7, 8, 9 140 21BA 48 68 48 68 48 68 + :6 pha:pla 141 21C6 EA EA nop:nop 142 21C8 8D 00 D4 sta dmactl ; 143 21CB 8D 0A D4 sta wsync 144 21CE 8E 00 D4 stx dmactl 145 21D1 8D 1E C0 sta hitclr 146 21D4 8D 0A D4 sta wsync 147 21D7 AD 04 C0 lda p0pf 148 21DA 0A asl 149 21DB 0A asl 150 21DC 0D 05 C0 ora p1pf 151 21DF 18 69 0E add #14 152 .ifndef DISPLAY_MODE 153 21E2 _ASSERTA 18, c"Bitmap mode DMACTL early test failed: stride=%d" Macro: _ASSERTA [Source: library.s] 1 21E2 C9 12 cmp #18 2 21E4 F0 35 beq pass 4 21E6 85 C9 sta d1 5 21E8 20 82 A3 jsr _testFailed 6 21EB 42 69 74 6D 61 70 + dta c"Bitmap mode DMACTL early test failed: stride=%d",0 7 221B pass: Source: antic_pfstoptiming.s 154 .endif 155 156 221B A9 2B 8D 06 02 A9 + mwa #dli4 vdslst 157 2225 68 A8 68 AA 68 plr 158 222A 40 rti 159 .endp 160 161 ;========================================================================= 162 222B .proc dli4 163 222B 48 8A 48 98 48 phr 164 2230 8D 0A D4 sta wsync 165 2233 A9 03 8D 05 D4 mva #$03 vscrol 166 2238 A9 22 lda #$22 167 223A A2 21 ldx #$21 168 223C EA nop 169 223D 8D 0A D4 sta wsync 170 2240 48 68 pha:pla ;*, 104, 105, 106, 107, 108, 109 171 2242 48 68 pha:pla ;110, 111, 112, 113, 0, 1*, 2, 3 172 2244 48 68 pha:pla ;4, 5, 6, 7, 8, 9, 10 173 2246 48 68 48 68 48 68 + :6 pha:pla 174 2252 EA nop 175 2253 24 FF bit $ff 176 2255 8D 00 D4 sta dmactl ; 177 2258 8D 0A D4 sta wsync 178 225B 8E 00 D4 stx dmactl 179 225E 8D 1E C0 sta hitclr 180 2261 8D 0A D4 sta wsync 181 2264 AD 04 C0 lda p0pf 182 2267 0A asl 183 2268 0A asl 184 2269 0D 05 C0 ora p1pf 185 226C 18 69 0E add #14 186 .ifndef DISPLAY_MODE 187 226F _ASSERTA 16, c"Bitmap mode DMACTL late test failed: stride=%d" Macro: _ASSERTA [Source: library.s] 1 226F C9 10 cmp #16 2 2271 F0 34 beq pass 4 2273 85 C9 sta d1 5 2275 20 82 A3 jsr _testFailed 6 2278 42 69 74 6D 61 70 + dta c"Bitmap mode DMACTL late test failed: stride=%d",0 7 22A7 pass: Source: antic_pfstoptiming.s 188 .endif 189 190 22A7 A9 B7 8D 06 02 A9 + mwa #dli5 vdslst 191 22B1 68 A8 68 AA 68 plr 192 22B6 40 rti 193 .endp 194 195 ;========================================================================= 196 22B7 .proc dli5 197 22B7 48 8A 48 98 48 phr 198 22BC 8D 0A D4 sta wsync 199 22BF A9 07 8D 05 D4 mva #$07 vscrol 200 22C4 A9 21 8D 00 D4 mva #$21 dmactl 201 22C9 A2 00 ldx #$00 202 22CB 8E 04 D4 stx hscrol 203 22CE A9 08 lda #$08 204 22D0 EA nop 205 22D1 8D 0A D4 sta wsync 206 22D4 48 68 pha:pla ;*, 105, 106, 107, 108, 109, 110 207 22D6 48 68 pha:pla ;111, 112, 113, 0, 1*, 2, 3, 4 208 22D8 EA EA EA nop:nop:nop ;5, 6, 7, 8, 9, 10 209 22DB 48 68 48 68 48 68 + :4 pha:pla 210 22E3 24 FF bit $ff 211 22E5 8D 04 D4 sta hscrol ;write at 95 212 22E8 8D 0A D4 sta wsync 213 22EB 8E 04 D4 stx hscrol 214 22EE 8D 1E C0 sta hitclr 215 22F1 8D 0A D4 sta wsync 216 22F4 AD 04 C0 lda p0pf 217 22F7 0A asl 218 22F8 0A asl 219 22F9 0D 05 C0 ora p1pf 220 22FC 18 69 0E add #14 221 .ifndef DISPLAY_MODE 222 22FF _ASSERTA 21, c"Character mode HSCROL early test failed: stride=%d" Macro: _ASSERTA [Source: library.s] 1 22FF C9 15 cmp #21 2 2301 F0 38 beq pass 4 2303 85 C9 sta d1 5 2305 20 82 A3 jsr _testFailed 6 2308 43 68 61 72 61 63 + dta c"Character mode HSCROL early test failed: stride=%d",0 7 233B pass: Source: antic_pfstoptiming.s 223 .endif 224 225 233B A9 4B 8D 06 02 A9 + mwa #dli6 vdslst 226 2345 68 A8 68 AA 68 plr 227 234A 40 rti 228 .endp 229 230 ;========================================================================= 231 234B .proc dli6 232 234B 48 8A 48 98 48 phr 233 2350 8D 0A D4 sta wsync 234 2353 A9 07 8D 05 D4 mva #$07 vscrol 235 2358 A9 21 8D 00 D4 mva #$21 dmactl 236 235D A2 00 ldx #$00 237 235F 8E 04 D4 stx hscrol 238 2362 A9 08 lda #$08 239 2364 EA nop 240 2365 8D 0A D4 sta wsync 241 2368 48 68 pha:pla ;*, 104, 105, 106, 107, 108, 109 242 236A 48 68 pha:pla ;110, 111, 112, 113, 0, 1*, 2, 3 243 236C 48 68 pha:pla ;4, 5, 6, 7, 8, 9, 10 244 236E 48 68 48 68 48 68 + :4 pha:pla 245 2376 EA EA nop:nop 246 2378 8D 04 D4 sta hscrol ;write at 96 247 237B 8D 0A D4 sta wsync 248 237E 8E 04 D4 stx hscrol 249 2381 8D 1E C0 sta hitclr 250 2384 8D 0A D4 sta wsync 251 2387 AD 04 C0 lda p0pf 252 238A 0A asl 253 238B 0A asl 254 238C 0D 05 C0 ora p1pf 255 238F 18 69 0E add #14 256 .ifndef DISPLAY_MODE 257 2392 _ASSERTA 20, c"Character mode HSCROL late test failed: stride=%d" Macro: _ASSERTA [Source: library.s] 1 2392 C9 14 cmp #20 2 2394 F0 37 beq pass 4 2396 85 C9 sta d1 5 2398 20 82 A3 jsr _testFailed 6 239B 43 68 61 72 61 63 + dta c"Character mode HSCROL late test failed: stride=%d",0 7 23CD pass: Source: antic_pfstoptiming.s 258 .endif 259 260 23CD A9 DD 8D 06 02 A9 + mwa #dli7 vdslst 261 23D7 68 A8 68 AA 68 plr 262 23DC 40 rti 263 .endp 264 265 ;========================================================================= 266 23DD .proc dli7 267 23DD 48 8A 48 98 48 phr 268 23E2 8D 0A D4 sta wsync 269 23E5 A9 03 8D 05 D4 mva #$03 vscrol 270 23EA A9 21 8D 00 D4 mva #$21 dmactl 271 23EF A2 00 ldx #$00 272 23F1 8E 04 D4 stx hscrol 273 23F4 A9 08 lda #$08 274 23F6 EA nop 275 23F7 8D 0A D4 sta wsync 276 23FA 48 68 pha:pla ;*, 104, 105, 106, 107, 108, 109 277 23FC 48 68 pha:pla ;110, 111, 112, 113, 0, 1*, 2, 3 278 23FE 48 68 pha:pla ;4, 5, 6, 7, 8, 9 279 2400 48 68 48 68 48 68 + :6 pha:pla 280 240C EA EA EA nop:nop:nop 281 240F 8D 04 D4 sta hscrol ; 282 2412 8D 0A D4 sta wsync 283 2415 8E 04 D4 stx hscrol 284 2418 8D 1E C0 sta hitclr 285 241B 8D 0A D4 sta wsync 286 241E AD 04 C0 lda p0pf 287 2421 0A asl 288 2422 0A asl 289 2423 0D 05 C0 ora p1pf 290 2426 18 69 0E add #14 291 .ifndef DISPLAY_MODE 292 2429 _ASSERTA 21, c"Bitmap mode HSCROL early test failed: stride=%d" Macro: _ASSERTA [Source: library.s] 1 2429 C9 15 cmp #21 2 242B F0 35 beq pass 4 242D 85 C9 sta d1 5 242F 20 82 A3 jsr _testFailed 6 2432 42 69 74 6D 61 70 + dta c"Bitmap mode HSCROL early test failed: stride=%d",0 7 2462 pass: Source: antic_pfstoptiming.s 293 .endif 294 295 2462 A9 72 8D 06 02 A9 + mwa #dli8 vdslst 296 246C 68 A8 68 AA 68 plr 297 2471 40 rti 298 .endp 299 300 ;========================================================================= 301 2472 .proc dli8 302 2472 48 8A 48 98 48 phr 303 2477 8D 0A D4 sta wsync 304 247A A9 03 8D 05 D4 mva #$03 vscrol 305 247F A9 21 8D 00 D4 mva #$21 dmactl 306 2484 A2 00 ldx #$00 307 2486 8E 04 D4 stx hscrol 308 2489 A9 08 lda #$08 309 248B EA nop 310 248C 8D 0A D4 sta wsync 311 248F 48 68 pha:pla ;*, 104, 105, 106, 107, 108, 109 312 2491 48 68 pha:pla ;110, 111, 112, 113, 0, 1*, 2, 3 313 2493 48 68 pha:pla ;4, 5, 6, 7, 8, 9, 10 314 2495 48 68 48 68 48 68 + :6 pha:pla 315 24A1 48 68 pha:pla 316 24A3 EA nop 317 24A4 8D 04 D4 sta hscrol ; 318 24A7 8D 0A D4 sta wsync 319 24AA 8E 04 D4 stx hscrol 320 24AD 8D 1E C0 sta hitclr 321 24B0 8D 0A D4 sta wsync 322 24B3 AD 04 C0 lda p0pf 323 24B6 0A asl 324 24B7 0A asl 325 24B8 0D 05 C0 ora p1pf 326 24BB 18 69 0E add #14 327 328 .ifndef DISPLAY_MODE 329 24BE _ASSERTA 20, c"Bitmap mode HSCROL late test failed: stride=%d" Macro: _ASSERTA [Source: library.s] 1 24BE C9 14 cmp #20 2 24C0 F0 34 beq pass 4 24C2 85 C9 sta d1 5 24C4 20 82 A3 jsr _testFailed 6 24C7 42 69 74 6D 61 70 + dta c"Bitmap mode HSCROL late test failed: stride=%d",0 7 24F6 pass: Source: antic_pfstoptiming.s 330 331 24F6 A9 00 8D 0E D4 mva #$00 nmien 332 24FB 4C 6D A3 jmp _testPassed 333 .else 334 mva #$21 dmactl 335 mwa #dli1 vdslst 336 plr 337 rti 338 .endif 339 .endp 340 341 ;========================================================================= 342 343 24FE org $2c00 344 2C00 dlist: 345 2C00-2C34> 70 dta $70 346 2C01 70 dta $70 347 348 ;DMACTL test - character mode 349 2C02 F0 dta $f0 350 2C03 00 dta $00 351 2C04 66 00 2D dta $66,a(framedata) 352 2C07 0A dta $0a 353 2C08 F0 dta $f0 354 2C09 00 dta $00 355 2C0A 66 00 2D dta $66,a(framedata) 356 2C0D 0A dta $0a 357 358 ;DMACTL test - bitmap mode 359 2C0E F0 dta $f0 360 2C0F 00 dta $00 361 2C10 6A 00 2D dta $6a,a(framedata) 362 2C13 0A dta $0a 363 2C14 F0 dta $f0 364 2C15 00 dta $00 365 2C16 6A 00 2D dta $6a,a(framedata) 366 2C19 0A dta $0a 367 368 ;HSCROL test - character mode 369 2C1A F0 dta $f0 370 2C1B 00 dta $00 371 2C1C 76 00 2D dta $76,a(framedata) 372 2C1F 0A dta $0a 373 2C20 F0 dta $f0 374 2C21 00 dta $00 375 2C22 76 00 2D dta $76,a(framedata) 376 2C25 0A dta $0a 377 378 ;HSCROL test - bitmap mode 379 2C26 F0 dta $f0 380 2C27 00 dta $00 381 2C28 7A 00 2D dta $7a,a(framedata) 382 2C2B 0A dta $0a 383 2C2C F0 dta $f0 384 2C2D 00 dta $00 385 2C2E 7A 00 2D dta $7a,a(framedata) 386 2C31 0A dta $0a 387 2C32 dlist2: 388 .ifndef DISPLAY_MODE 389 2C32 41 32 2C dta $41,a(dlist2) 390 .else 391 dta $41,a(dlist) 392 .endif 393 394 2C35 org $2d00 395 2D00 framedata: 396 2D00-2D25> 00 00 00 00 + :22 dta $00 397 2D16 00 01 08 09 dta $00,$01,$08,$09 398 2D1A 10 11 18 19 dta $10,$11,$18,$19 399 2D1E 80 81 88 89 dta $80,$81,$88,$89 400 2D22 90 91 98 99 dta $90,$91,$98,$99 401 402 02E0-02E1> 00 20 run $2000 403 end