Dear Forum Members:
I have been following the Andrew Davie Tutorial on Randomterrain.com . I think that it is very well written. Essentially, I am learning assembly language from scratch. I have three questions that I hope that you may be able to help me with:
1. The code below is from an Excercise in chapter 13 : Playfield Basics. I have been able to complete the exercise making the playfield rainbow striped vs. the background. However, in achieving the effect, I believe that I have unnecessary code, which apparently is a 'no-no' in Atari programming because of the limitations. What unnecessary code can I take out below to make the solution still work?
2. The last exercise in this section asks, how do you make the Stripe appear on one side and not the other? It hints that you have to change the playfield mid-scanline. I do not know how to do this, but I think that it will be explained in a later chapter. Anyone have a very concise explanation?
I have a renewed appreciation for early video game programmers after going through the first 13 chapters! Any and all help is greatly appreciated!
------------------------------------------------
;
; My VCS Game
; by Author
;
; VCS template file by Ian Bogost
; http://www.bogost.com
;
;------------------------------------------------
processor 6502
include vcs.h
include macro.h
;------------------------------------------------------------------------------
PATTERN = $80 ; storage location (1st byte in RAM)
TIMETOCHANGE = 1 ; speed of "animation" - change as desired
;------------------------------------------------------------------------------
SEG
ORG $F000
Reset
; Clear RAM and all TIA registers
ldx #0
lda #0
Clear sta 0,x
inx
bne Clear
;------------------------------------------------
; Once-only initialization...
lda #%11111111
sta PATTERN ; The binary PF 'pattern'
lda #$54
sta COLUPF ; set the playfield color
ldy #0 ; "speed" counter
;------------------------------------------------
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
;------------------------------------------------
; 37 scanlines of vertical blank...
ldx #0
VerticalBlank sta WSYNC
inx
cpx #37
bne VerticalBlank
;------------------------------------------------
; Handle a change in the pattern once every 1 frames
; and write the pattern to the PF1 register
iny ; increment speed count by one
cpy #TIMETOCHANGE ; has it reached our "change point"?
bne notyet ; no, so branch past
ldy #0
notyet
lda PATTERN
sta PF1 ; as the playfield shape
;------------------------------------------------
; Do 192 scanlines of color-changing (our picture)
ldx #0 ; this counts our scanline number
Picture ; change background color (rainbow effect)
sta WSYNC ; wait till end of scanline
stx COLUPF
inx
cpx #192
bne Picture
;------------------------------------------------
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
;------------------------------------------------------------------------------
ORG $FFFA
InterruptVectors
.word Reset ; NMI
.word Reset ; RESET
.word Reset ; IRQ
END