Created
February 9, 2015 16:21
-
-
Save Arclite/59471ebc24bb782c91b8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
processor 6502 | |
include "vcs.h" | |
include "macro.h" | |
SEG | |
ORG $F000 | |
Reset | |
; Clear RAM and all TIA registers | |
ldx #0 | |
lda #0 | |
Clear | |
sta 0,x | |
inx | |
bne Clear | |
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 | |
ldx #0 | |
VerticalBlank | |
sta WSYNC | |
inx | |
cpx #37 | |
bne VerticalBlank | |
ldx #0 ; what line of the code are we on | |
ldy #9 ; how many pixels in this line | |
DrawLine | |
sta WSYNC ; wait till end of scanline | |
lda #0 | |
sta PF0 | |
lda PFData1Left,X | |
sta PF1 | |
lda PFData2Left,X | |
sta PF2 | |
sleep 20 | |
lda PFData0Right,X | |
sta PF0 | |
lda PFData1Right,X | |
sta PF1 | |
lda #0 | |
sta PF2 | |
dey | |
bne RedrawLine | |
inx | |
cpx #21 | |
beq StartFinish | |
ldy #9 | |
RedrawLine | |
jmp DrawLine | |
StartFinish | |
ldx #189 | |
Finish | |
sta WSYNC | |
lda #0 | |
sta PF0 | |
sta PF1 | |
sta PF2 | |
inx | |
cpx #192 | |
bne Finish | |
;------------------------------------------------ | |
lda #%01000010 | |
sta VBLANK ; end of screen - enter blanking | |
; 30 scanlines of overscan... | |
ldx #0 | |
Overscan | |
sta WSYNC | |
inx | |
cpx #30 | |
bne Overscan | |
jmp StartOfFrame | |
;------------------------------------------------------------------------------ | |
PFData1Left | |
.byte #%00000111 | |
.byte #%00000100 | |
.byte #%00000101 | |
.byte #%00000101 | |
.byte #%00000101 | |
.byte #%00000100 | |
.byte #%00000111 | |
.byte #%00000000 | |
.byte #%00000111 | |
.byte #%00000001 | |
.byte #%00000111 | |
.byte #%00000111 | |
.byte #%00000001 | |
.byte #%00000000 | |
.byte #%00000111 | |
.byte #%00000100 | |
.byte #%00000101 | |
.byte #%00000101 | |
.byte #%00000101 | |
.byte #%00000100 | |
.byte #%00000111 | |
PFData2Left | |
.byte #%00001111 | |
.byte #%00101000 | |
.byte #%01001011 | |
.byte #%01101011 | |
.byte #%10001011 | |
.byte #%11101000 | |
.byte #%10101111 | |
.byte #%10000000 | |
.byte #%01111011 | |
.byte #%10010010 | |
.byte #%01011001 | |
.byte #%01000010 | |
.byte #%10001000 | |
.byte #%10100000 | |
.byte #%00101111 | |
.byte #%00001000 | |
.byte #%11101011 | |
.byte #%00101011 | |
.byte #%10101011 | |
.byte #%00101000 | |
.byte #%11101111 | |
PFData0Right | |
.byte #%10000000 | |
.byte #%10110000 | |
.byte #%10110000 | |
.byte #%10010000 | |
.byte #%10000000 | |
.byte #%10110000 | |
.byte #%10100000 | |
.byte #%00110000 | |
.byte #%01100000 | |
.byte #%00000000 | |
.byte #%00110000 | |
.byte #%01000000 | |
.byte #%10010000 | |
.byte #%00000000 | |
.byte #%01110000 | |
.byte #%01000000 | |
.byte #%10010000 | |
.byte #%01000000 | |
.byte #%00100000 | |
.byte #%01010000 | |
.byte #%10010000 | |
PFData1Right | |
.byte #%11111100 | |
.byte #%00000100 | |
.byte #%01110100 | |
.byte #%01110100 | |
.byte #%01110100 | |
.byte #%00000100 | |
.byte #%11111100 | |
.byte #%00000000 | |
.byte #%10101000 | |
.byte #%01111100 | |
.byte #%00011000 | |
.byte #%01110000 | |
.byte #%01100100 | |
.byte #%11110100 | |
.byte #%10011000 | |
.byte #%01110000 | |
.byte #%01100000 | |
.byte #%11011000 | |
.byte #%10010000 | |
.byte #%11010000 | |
.byte #%11101000 | |
ORG $FFFA | |
InterruptVectors | |
.word Reset ; NMI | |
.word Reset ; RESET | |
.word Reset ; IRQ | |
END |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To be fair, I was really bored.