processor 6502 include "vcs.h" include "macro.h" PATTERN1 = %00010000 PATTERN2 = %01110000 StartCount = 0 CURRPF = 1 Cycle = 1 SEG ORG $F000 Reset ; Clear RAM and all TIA registers ldx #0 lda #0 Clear sta 0,x inx bne Clear ;------------------------------------------------ ; Once-only initialization. . . lda #$55 sta COLUPF ; set the playfield color lda CURRPF sta CTRLPF ; reflect playfield ;------------------------------------------------ StartOfFrame ; Start of new frame ; Start of vertical blank processing lda #0 sta VBLANK lda #2 sta VSYNC sta WSYNC sta WSYNC sta WSYNC ; 3 scanlines of VSYNC signal lda #0 sta VSYNC ;------------------------------------------------ ; 37 scanlines of vertical blank. . . ldx #0 VerticalBlank sta WSYNC inx cpx #37 bne VerticalBlank ;------------------------------------------------ ; Do 192 scanlines of color-changing (our picture) ldx #0 ; this counts our scanline number ldy #0 Picture sta WSYNC ;3 3 cpy #20 ;3 8 bcc ShowPathern2 ;2 10 lda #PATTERN1 ;3 13 sta PF0 ;3 16 cpy #40 ;3 19 bpl ResetPFDraw ;2 21 iny inx ;2 23 cpx #192 ;2 25 bne Picture ;2 26 sta VBLANK ;3 29 ldx #0 ;2 31 ldy #0 ;2 33 jmp Overscan ShowPathern2 iny lda #PATTERN2 ;3 3 sta PF0 ;3 6 inx ;3 9 cpx #192 ;2 11 bne Picture ;2 13 sta VBLANK ;3 ldx #0 ;2 ldy #0 ;2 jmp Overscan ResetPFDraw ldy StartCount ;3 3 inx ;2 5 cpx #192 ;2 9 bne Picture ;2 12 sta VBLANK ;3 ldx #0 ;2 ldy #0 ;2 Overscan sta WSYNC inx cpx #30 bne Overscan jmp StartOfFrame ORG $FFFA InterruptVectors .word Reset .word Reset .word Reset END