-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathVectorHardware.a
More file actions
178 lines (144 loc) · 3.6 KB
/
Copy pathVectorHardware.a
File metadata and controls
178 lines (144 loc) · 3.6 KB
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
kVectorHardware_longSpan = $fe
!zn
VectorHardwareFillBlank
ldx #0
ldy #$20
.cl1
+MBus24Bit_Send8BitValue 0
+MBus24Bit_Send8BitValue kVectorHardware_longSpan
dex
bne .cl1
dey
bne .cl1
rts
!zn
VectorHardwareInit
+MBus24Bit_SetAddress_AXY kBus24Bit_VectorsScreen_Bank0_EBBS , kBus24Bit_VectorsScreen_Bank0_Plane
jsr VectorHardwareFillBlank
+MBus24Bit_SetAddress_AXY kBus24Bit_VectorsScreen_Bank1_EBBS , kBus24Bit_VectorsScreen_Bank1_Plane
jsr VectorHardwareFillBlank
rts
!zn
.colTab
+MBus24Bit_MakePaletteRGB 255 , 0 , 255
!for .i , 15 {
+MBus24Bit_MakePaletteRGB (.i * 16) + 15 , (.i * 16) + 15 , (.i * 16) + 15
}
VectorHardwareInitPalette
+MBus24Bit_SetAddress_AXY kBus24Bit_VideoLayer_EBBS , kBus24Bit_VideoLayer_Palette + (8 * kBus24Bit_VideoLayer_BytesPerPalette)
ldx #0
.cl1
lda .colTab,x
+MBus24Bit_Send8BitValueFromA
inx
cpx #kBus24Bit_VideoLayer_BytesPerPalette
bne .cl1
rts
!zn
VectorPlot_drawSpansLo
; Needs + $0040
+MBus24Bit_SetAddress_AXY kBus24Bit_VectorsScreen_Bank0_EBBS , kBus24Bit_VectorsScreen_Bank0_Plane
jmp VectorPlot_drawSpansInternal
VectorPlot_drawSpansHi
+MBus24Bit_SetAddress_AXY kBus24Bit_VectorsScreen_Bank1_EBBS , kBus24Bit_VectorsScreen_Bank1_Plane
VectorPlot_drawSpansInternal
lda #kVectorHardware_longSpan
ldy #$40
jsr Bus24Bit_WriteAForY
lda #0
sta Vector_CurrentYPos
.l1
lda #0
sta .currentSpanLength
!ifndef kVectorHardware_sideBarsSizeLeft {
kVectorHardware_sideBarsSizeLeft = $12
}
!if kVectorHardware_sideBarsSizeLeft > 0 {
; Output a constant colour for left edge debugging
lda #$8f
+MBus24Bit_Send8BitValueFromA
; Note: First pixel coordinate is double clocked in hardware, so no -1 adjustment
lda #kVectorHardware_sideBarsSizeLeft
+MBus24Bit_Send8BitValueFromA
}
ldx Vector_CurrentYPos
lda Segments_linesHi,x
beq .completeSpan
sta ZPSegments_currentSegmentHi
lda Segments_linesLo,x
sta ZPSegments_currentSegmentLo
.gotSegment
ldy #kSegment_offset_left
lda (ZPSegments_currentSegmentLo),y
cmp .currentSpanLength
beq .inSync
; Output a transparent span to match the sparse span left pos
sec
sbc .currentSpanLength
ldx #0
jsr .outputSpan
.inSync
; Now output a span with its colour
ldy #kSegment_offset_colour
lda (ZPSegments_currentSegmentLo),y
; lda #1 ; Debug force colour
; Adjust colour range to avoid transparent colour 0
and #%111
ora #$80
tax
inx
ldy #kSegment_offset_right
lda (ZPSegments_currentSegmentLo),y
sec
sbc .currentSpanLength
jsr .outputSpan
+Segments_getNextSegment
lda ZPSegments_currentSegmentHi
bne .gotSegment
.completeSpan
; Complete any length remaining
lda .currentSpanLength
cmp #kSpanPlot_maxLen
bcs .endSpan
lda #kSpanPlot_maxLen
sec
sbc .currentSpanLength
sbc #2
; Output an end span, twice. This makes the maths and logic easier
ldx #0
stx CIA2PortBRS232
+MBus24Bit_Send8BitValueFromA
stx CIA2PortBRS232
+MBus24Bit_Send8BitValueFromA
.endSpan
!ifndef kVectorHardware_sideBarsColourRight {
kVectorHardware_sideBarsColourRight = $8f
}
; Output a very long end span to take this into or beyond the hsync
; Output a constant colour for right edge debugging
lda #kVectorHardware_sideBarsColourRight
+MBus24Bit_Send8BitValueFromA
lda #kVectorHardware_longSpan
+MBus24Bit_Send8BitValueFromA
inc Vector_CurrentYPos
lda Vector_CurrentYPos
cmp #kSpanPlot_maxHeight
+lbne .l1
rts
; A = Length (never 0)
; X = Colour
.outputSpan
tay
clc
adc .currentSpanLength
sta .currentSpanLength
dey ; -2 Adjustment for hardware
dey
; Double draw the span in hardware, makes the logic a lot easier
stx CIA2PortBRS232
sty CIA2PortBRS232
stx CIA2PortBRS232
sty CIA2PortBRS232
rts
.currentSpanLength
!by 0