;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Exercise 3 ; In this exercise you will cycle the background color smoothly. ; This is the first exercise with the full screen cycle in place. ; ; Written for use with 8bitworkshop.com. ; Code included there and "Making Games For The Atari 2600" ; by Steven Hugg ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; Header ;;;; Needed at top of all your source files ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; processor 6502 include "vcs.h" org $f000 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; GENERAL INIT ;;;; This code is necessary for initialization ;;;; but you can ignore it until you get curious ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Start sei cld ldx #$ff txs lda #0 ; ldx #$ff ZeroZP sta $0,X dex bne ZeroZP ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; NextFrame ; next two lines turn off beam lda #2 sta VBLANK ; now three lines of vsync per spec sta VSYNC sta WSYNC sta WSYNC sta WSYNC ; turn off vsync lda #0 sta VSYNC ; now loop through 36 vertical blank lines ldx #37 VBlankLoop sta WSYNC dex bne VBlankLoop ; we will use our final vblank line to setup ; any drawing ;;; INSERT YOUR CODE BELOW THIS ;;; AND ABOVE THIS ; now turn beam back on and draw 192 lines lda #0 sta VBLANK ldx #192 ScanLoop sta WSYNC dex bne ScanLoop ; now draw 30 lines of overscan after ; turning beam off again lda #2 sta VBLANK ldx #30 OverscanLoop sta WSYNC dex bne OverscanLoop ;;; Now we've drawn our ;;; 3 VSYNC lines ;;; 37 VBLANK lines ;;; 192 scan lines ;;; 30 overscan lines jmp NextFrame ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; Footer ;;;; Needed at bottom of all your source files ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; org $fffc .word Start .word Start