-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path5-BookVersion.asm
59 lines (46 loc) · 1.2 KB
/
5-BookVersion.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
;@com.wudsn.ide.asm.hardware=ATARI2600
icl "vcs.asm"
icl "macro.asm"
opt h-f+l+ ;Create plain 4k ROM file
org $f000 ;start code at $f000
.proc Cart
BGColor = $81; ;declare local (to Cart procedure) variable BGColor at memory address $81
Start
Clean_Start ;macro to safely clear memory and TIA
NextFrame
lda #2 ;same as binary #%00000010
sta VBLANK ;turn on VBLANK
sta VSYNC ;turn on VSYNC
sta WSYNC ;first scanline
sta WSYNC ;second scanline
sta WSYNC ;third scanline
lda #0
sta VSYNC ;turn off VSYNC
ldx #37 ;count 37 scanlines
LVBLank
sta WSYNC ;wait for next scanline
dex ;decrement X
bne LVBlank ;loop while X != 0
lda #0
sta VBLANK ;turn off VBLANK
ldx #192 ;count 192 scanlines
ldy BGColor ;load the background color from RAM
LVScan
sty COLUBK ;set the background color
sta WSYNC ;wait for the next scanline
iny ;increment the background color
dex ;decrement X
bne LVSCAN ;loop while X != 0
lda #2
sta VBLANK ;turn on VBLANK again
ldx #30 ;count 30 scanlines
LVOver
sta WSYNC ;wait for next scanline
dex ;decrement X
bne LVOver ;loop while X != 0
dec BGColor
jmp NextFrame
.endp
org $fffc
.word Cart.Start
.word $ffff