-
Notifications
You must be signed in to change notification settings - Fork 0
/
playfield.asm
126 lines (102 loc) · 2.43 KB
/
playfield.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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
;;;;;;;;;;;;;;; Basic configurations ;;;;;;;;;;;;;;;
PROCESSOR 6502 ; processor MOS 6502/6507
; Macros for Atari 2600
INCLUDE "vcs.h"
INCLUDE "macro.h"
SEG CODE ; segment CODE
ORG $F000 ; ROM area begin
;;;;;;;;;;;;; Reset and initialize system ;;;;;;;;;;;;;
Reset:
CLEAN_START ; clear RAM and registers, reset flags
;;;;;;;;;; Define start point ;;;;;;;;;;;;
Start:
LDX #$80 ; blue color
LDY #$1C ; yellow
STX COLUBK ; set bg blue
STY COLUPF ; set playfield yellow
;;;;;; Start new frame ;;;;;;
StartFrame:
LDA #2 ; start bit
LDY #0 ; stop bit
STA VBLANK ; start vlbank
STA VSYNC ; start vsynk
;;;;;; VSYMC lines ;;;;;;;
REPEAT 3
STA WSYNC ; 3x scanlines
REPEND
STY VSYNC ; done vsync
;;;;;; VBLANK lines ;;;;;;
REPEAT 37
STA WSYNC ; 37x scanlines
REPEND
STY VBLANK ; done vblank
;;;;;; Playfield reflection ;;;;;;;;
LDX #%00000001 ; bit6 1
STX CTRLPF ; playfield reflection enabled
;;;;;;;; Visible area - Playfield ;;;;;;;;;;
LDA #0
; set empty border
; set all blank (no playfield)
STA PF0
STA PF1
STA PF2
REPEAT 7
STA WSYNC
REPEND
; set 7 lines for phsical pf border
; pf0 0011 => 1100 xxxx
; pf1 1111 1111
; pf2 1111 1111
;;; mirror ;;;
; pf2 1111 1111
; pf1 1111 1111
; pf0 1111 0000
; Top border lines
LDX #%11100000
LDY #%11111111
STX PF0
STY PF1
STY PF2
REPEAT 7
STA WSYNC
REPEND
; Left and right borders
; middle line
LDX #%00100000
LDY #%10000000
STX PF0
STA PF1
STY PF2
REPEAT 164
STA WSYNC
REPEND
; Bottom border lines
LDX #%11100000
LDY #%11111111
STX PF0
STY PF1
STY PF2
REPEAT 7
STA WSYNC
REPEND
; 0000 for bottom empty space
STA PF0
STA PF1
STA PF2
REPEAT 7
STA WSYNC
REPEND
;;;;;;;; Overscan area ;;;;;;;;;
LDA #2
LDY #0
STA VBLANK
REPEAT 30
STA WSYNC
REPEND
STY VBLANK
JMP StartFrame ; loop next frame
;;;;;;; Define end of cartridge ;;;;;;;
End:
ORG $FFFC ; goto cartridge end - 4 bytes
.word Reset ; add 2 bytes and Start address (FFFC-FFFD)
.word Reset ; another 2 bytes and Start address (FFFE-FFFF)