Skip to content

Instantly share code, notes, and snippets.

@futureperfect
Created September 14, 2017 02:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save futureperfect/e9ee4fef95e4b5aa3773387bae66048d to your computer and use it in GitHub Desktop.
Save futureperfect/e9ee4fef95e4b5aa3773387bae66048d to your computer and use it in GitHub Desktop.
Atari 2600 - Draw colored stripes to screen
; stripes.asm
;
; Example Atari 2600 program - paints
; colored stripes to the screen
;
; dasm stripes.asm -f3 -ostripes.bin
;
;
processor 6502
include "vcs.h"
include "macro.h"
SEG
ORG $F000
Reset:
StartOfFrame:
lda #0 ; Start of vertical blank processing
sta VBLANK
lda #2
sta VSYNC
REPEAT 3
sta WSYNC
REPEND
lda #0
sta VSYNC
REPEAT 37 ; 37 scanlines of vertical blank...
sta WSYNC
REPEND
ldx #0
REPEAT 192 ; 192 scanlines of picture...
inx
stx COLUBK
sta WSYNC
REPEND
Overscan:
lda #%01000010 ; turn "off" beam
sta VBLANK ; end of screen - enter blanking
REPEAT 30 ; 30 scanlines of overscan...
sta WSYNC
REPEND
jmp StartOfFrame
ORG $FFFA ; Cart config (so 6502 can start it up)
.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