processor 6502 include "vcs.h" include "macro.h" include "xmacro.h" ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; seg.u Variables org $80 Temp .byte Temp2 .byte CSJump .word ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; seg Code org $f000 Start CLEAN_START lda #0 sta Temp NextFrame VERTICAL_SYNC TIMER_SETUP 37 inc Temp lda Temp and #$1f eor #$ff clc adc #ClockslideEnd sta CSJump+1 TIMER_WAIT TIMER_SETUP 216 lda Temp and #$7f jsr WaitForScanline sta COLUBK lda #180 jsr WaitForScanline lda #0 sta COLUBK lda #192 jsr WaitForScanline jmp TimerDone jmp (CSJump) REPEAT 36 .byte $c9 REPEND .byte $c9,$c5 ClockslideEnd nop ScanLoop ldy INTIM beq TimerDone lda Timer2Scanline,y sta COLUBK jmp ScanLoop TimerDone lda #0 sta COLUBK TIMER_SETUP 30 TIMER_WAIT jmp NextFrame align $10 WaitForScanline subroutine ldy INTIM ; Fetch timer value .Wait cpy INTIM beq .Wait ; Wait for it to change sta WSYNC ; Sync with scan line cmp Timer2Scanline,y bcs WaitForScanline rts ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; align $100 Timer2Scanline .byte 215, 0,214,213,212,211,210, 0,209,208,207,206,205,204, 0,203 .byte 202,201,200,199, 0,198,197,196,195,194, 0,193,192,191,190,189 .byte 188, 0,187,186,185,184,183, 0,182,181,180,179,178, 0,177,176 .byte 175,174,173,172, 0,171,170,169,168,167, 0,166,165,164,163,162 .byte 0,161,160,159,158,157,156, 0,155,154,153,152,151, 0,150,149 .byte 148,147,146, 0,145,144,143,142,141,140, 0,139,138,137,136,135 .byte 0,134,133,132,131,130, 0,129,128,127,126,125,124, 0,123,122 .byte 121,120,119, 0,118,117,116,115,114, 0,113,112,111,110,109,108 .byte 0,107,106,105,104,103, 0,102,101,100, 99, 98, 0, 97, 96, 95 .byte 94, 93, 92, 0, 91, 90, 89, 88, 87, 0, 86, 85, 84, 83, 82, 0 .byte 81, 80, 79, 78, 77, 76, 0, 75, 74, 73, 72, 71, 0, 70, 69, 68 .byte 67, 66, 0, 65, 64, 63, 62, 61, 60, 0, 59, 58, 57, 56, 55, 0 .byte 54, 53, 52, 51, 50, 0, 49, 48, 47, 46, 45, 44, 0, 43, 42, 41 .byte 40, 39, 0, 38, 37, 36, 35, 34, 0, 33, 32, 31, 30, 29, 28, 0 .byte 27, 26, 25, 24, 23, 0, 22, 21, 20, 19, 18, 0, 17, 16, 15, 14 .byte 13, 12, 0, 11, 10, 9, 8, 7, 0, 6, 5, 4, 3, 2, 0, 1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Epilogue org $fffc .word Start .word Start