1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-11-24 12:31:25 +00:00
8bitworkshop/presets/vcs/examples/playfield.a

65 lines
1.3 KiB
Plaintext
Raw Normal View History

2016-12-16 01:21:51 +00:00
processor 6502
include "vcs.h"
include "macro.h"
org $f000
2018-10-01 01:07:45 +00:00
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
2016-12-16 01:21:51 +00:00
; We're going to mess with the playfield registers, PF0, PF1 and PF2.
; Between them, they represent 20 bits of bitmap information
; which are replicated over 40 wide pixels for each scanline.
; By changing the registers before each scanline, we can draw bitmaps.
2018-10-01 01:07:45 +00:00
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2016-12-16 01:21:51 +00:00
Counter equ $81
Start CLEAN_START
NextFrame
; This macro efficiently gives us 1 + 3 lines of VSYNC
2016-12-16 01:21:51 +00:00
VERTICAL_SYNC
; 36 lines of VBLANK
ldx #36
2016-12-16 01:21:51 +00:00
LVBlank sta WSYNC
dex
bne LVBlank
; Disable VBLANK
stx VBLANK
; Set foreground color
lda #$82
sta COLUPF
; Draw the 192 scanlines
ldx #192
lda #0 ; changes every scanline
;lda Counter ; uncomment to scroll!
ScanLoop
sta WSYNC ; wait for next scanline
sta PF0 ; set the PF1 playfield pattern register
sta PF1 ; set the PF1 playfield pattern register
sta PF2 ; set the PF2 playfield pattern register
stx COLUBK ; set the background color
adc #1 ; increment A
dex
bne ScanLoop
; Reenable VBLANK for bottom (and top of next frame)
lda #2
sta VBLANK
; 30 lines of overscan
ldx #30
LVOver sta WSYNC
dex
bne LVOver
; Go back and do another frame
inc Counter
jmp NextFrame
org $fffc
.word Start
.word Start