-
Notifications
You must be signed in to change notification settings - Fork 2
/
demo2_1.asm
110 lines (96 loc) · 1.49 KB
/
demo2_1.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
;
; Ball demo
;
; by Oscar Toledo G.
; https://nanochess.org/
;
; Creation date: Jun/01/2022.
;
PROCESSOR 6502
INCLUDE "vcs.h"
ORG $F000
START:
SEI ; Disable interrupts.
CLD ; Clear decimal mode.
LDX #$FF ; X = $ff
TXS ; S = $ff
LDA #$00 ; A = $00
CLEAR:
STA 0,X ; Clear memory.
DEX ; Decrement X.
BNE CLEAR ; Branch if not zero.
SHOW_FRAME:
LDA #$88 ; Blue.
STA COLUBK ; Background color.
LDA #$0F ; White.
STA COLUPF ; Playfield color.
STA WSYNC
LDA #2 ; Start of vertical retrace.
STA VSYNC
STA WSYNC
STA WSYNC
STA WSYNC
LDA #0 ; End of vertical retrace.
STA VSYNC
; Ball horizontal position (23 NOPs for center)
STA WSYNC ; Cycle 3
NOP ; 5
NOP ; 7
NOP ; 9
NOP ; 11
NOP ; 13
NOP ; 15
NOP ; 17
NOP ; 19
NOP ; 21
NOP ; 23
NOP ; 25
NOP ; 27
NOP ; 29
NOP ; 31
NOP ; 33
NOP ; 35
NOP ; 37
NOP ; 39
NOP ; 41
NOP ; 43
NOP ; 45
NOP ; 47
NOP ; 49
STA RESBL ; 52
LDX #35 ; Remains 35 scanlines of top border
TOP:
STA WSYNC
DEX
BNE TOP
LDA #0 ; Disable blanking
STA VBLANK
LDX #95 ; 95 scanlines in blue
VISIBLE:
STA WSYNC
DEX
BNE VISIBLE
STA WSYNC ; One scanline
LDA #$02 ; Ball enable
STA ENABL
STA WSYNC ; One scanline
LDA #$00
STA ENABL
LDA #$F8 ; Sand color
STA COLUBK
LDX #95 ; 95 scanlines
VISIBLE2:
STA WSYNC
DEX
BNE VISIBLE2
LDA #2 ; Enable blanking
STA VBLANK
LDX #30 ; 30 scanlines of bottom border
BOTTOM:
STA WSYNC
DEX
BNE BOTTOM
JMP SHOW_FRAME
ORG $FFFC
.word START
.word START