processor 6502 include "vcs.h" include "macro.h" PATTERN = $80 SEG ORG $F800 Reset ; Clear RAM and all TIA registers ldx #0 lda #0 Clear sta 0,x inx bne Clear ;------------------------------------------------ ; Once-only initialisation... lda #%11110000 sta PATTERN ; The binary PF 'pattern' (not used in here.) lda #$c8 sta COLUPF ; set the playfield colour lda #$0e sta COLUBK ; set the playfield colour ldy #0 ; "speed" counter StartOfFrame lda #2 sta WSYNC ; ADDED sta VSYNC sta WSYNC sta WSYNC lda #0 ; MOVED sta WSYNC ; 3 scanlines of VSYNC signal sta VSYNC ldx #0 ; this counts our scanline number VerticalBlank: sta WSYNC inx cpx #37 bne VerticalBlank lda #0 sta VBLANK Picture: sta WSYNC lda #0 sta PF1 SLEEP 12 inx cpx #50 ; are we at line bne Picture ; No, so do another Forehead: sta WSYNC ; wait till end of scanline lda #%11111000 sta PF1 lda #0 sta PF2 sta PF0 SLEEP 28 lda #0 sta PF1 inx cpx #54 bne Forehead Eyes: sta WSYNC ; wait till end of scanline lda #%10101000 sta PF1 lda #0 sta PF2 sta PF0 SLEEP 28 lda #0 sta PF1 inx cpx #58 bne Eyes Middlehead: sta WSYNC ; wait till end of scanline lda #%11111000 sta PF1 lda #0 sta PF2 sta PF0 SLEEP 28 lda #0 sta PF1 inx cpx #70 bne Middlehead Mouth: sta WSYNC ; wait till end of scanline lda #%10001000 sta PF1 lda #0 sta PF2 sta PF0 SLEEP 28 lda #0 sta PF1 inx cpx #74 bne Mouth Celery: sta WSYNC ; wait till end of scanline lda #%11111000 sta PF1 lda #0 sta PF2 SLEEP 22 lda #0 sta PF0 SLEEP 8 lda #0 sta PF1 inx cpx #192 bne Celery lda #2 sta VBLANK ; end of screen - enter blanking ; 30 scanlines of overscan... ldx #0 Overscan: sta WSYNC inx cpx #66 bne Overscan jmp StartOfFrame ORG $FFFA InterruptVectors .word Reset ; NMI .word Reset ; RESET .word Reset ; IRQ END