forked from martinpiper/C64Public
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBitmapPlot.feature
More file actions
239 lines (177 loc) · 6.97 KB
/
Copy pathBitmapPlot.feature
File metadata and controls
239 lines (177 loc) · 6.97 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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
Feature: Bitmap plotting tests
Tests the bitmap plotting routines for expected screen output
Scenario: Simple line plot draw test
Given I have a simple overclocked 6502 system
And I create file "t.a" with
"""
!source "../stdlib/stdlib.a"
kSpanCalc_backgroundColour = 0
kSpanPlot_maxHeight = 16 ; Limited size execution
; kSpanPlot_maxHeight = 1 ; Very limited size execution
SpanPlot_MaskEnds = 1
;EnableInterlace = 1
Bitmap0Memory = $2000
!source "BitmapPlotMacros.a"
ZPBitmap_VarBase = $02
!source "BitmapPlotVars.a"
ZPSegments_VarBase = ZPBitmap_endVars
!source "SegmentsVars.a"
!source "SegmentsMacros.a"
!source "SpanCalcMacros.a"
* = $4000
init
lda #>Bitmap0Memory
ldy #%10000100
jsr BitmapPlot_clear
lda #>Bitmap_paletteStart
sta ZPBitmap_PaletteHi
jsr Segments_initStorage
rts
doPlot
lda #5 ; Dithering colours
ldx #0
ldy #kSpanPlot_maxHeight
jsr Segments_processLines
+MWordValueToAddress_A Bitmap0Memory , ZPBitmap_CurrentPos
jsr BitmapPlot_drawSpans
rts
!source "BitmapPlot.a"
!source "SegmentsMemory.a"
!source "Segments.a"
SpanBanks_p0
SpanBanks_p1
SpanBanks_p2
SpanBanks_p3
Poly_linesLeft
!for .i , kSpanPlot_maxHeight {
!by .i-1
}
Poly_linesLeftEnd
Poly_linesRight
!for .i , kSpanPlot_maxHeight {
!by 63 - .i
}
Poly_linesRightEnd
!source "SpanTable.a"
"""
And I run the command line: ..\acme.exe -o t.prg --labeldump t.lbl -f cbm t.a
And I load prg "t.prg"
And I load labels "t.lbl"
When I execute the procedure at init for no more than 25000 instructions
When I execute the procedure at doPlot for no more than 3200 instructions
When I hex dump memory between Segments_array and Segments_arrayEnd
When I hex dump memory between Segments_linesLo and Segments_linesLoEnd
When I hex dump memory between Segments_linesHi and Segments_linesHiEnd
Then I expect to see ZPSegments_primaryAllocatorAddrLo equal lo(Segments_array+(kSpanPlot_maxHeight*kSegment_length))
Then I expect to see ZPSegments_primaryAllocatorAddrHi equal hi(Segments_array+(kSpanPlot_maxHeight*kSegment_length))
# Start slope
When I hex dump memory between Bitmap0Memory+$00 and Bitmap0Memory+$08
Then property "test.BDD6502.lastHexDump" must contain string ignoring whitespace "99 26 09 02 00 00 00 00"
When I hex dump memory between Bitmap0Memory+$08 and Bitmap0Memory+$10
Then property "test.BDD6502.lastHexDump" must contain string ignoring whitespace "99 66 99 66 99 26 09 02"
When I hex dump memory between Bitmap0Memory+$10 and Bitmap0Memory+$18
Then property "test.BDD6502.lastHexDump" must contain string ignoring whitespace "99 66 99 66 99 66 99 66"
# End slope
When I hex dump memory between Bitmap0Memory+$68 and Bitmap0Memory+$70
Then property "test.BDD6502.lastHexDump" must contain string ignoring whitespace "99 66 99 66 99 66 99 64"
When I hex dump memory between Bitmap0Memory+$70 and Bitmap0Memory+$78
Then property "test.BDD6502.lastHexDump" must contain string ignoring whitespace "99 66 99 64 90 40 00 00"
When I hex dump memory between Bitmap0Memory+$78 and Bitmap0Memory+$80
Then property "test.BDD6502.lastHexDump" must contain string ignoring whitespace "90 40 00 00 00 00 00 00"
Scenario: Poly scans, edge trace and plot test
Given I have a simple overclocked 6502 system
And I create file "t.a" with
"""
!source "../stdlib/stdlib.a"
kSpanCalc_backgroundColour = 0
kSpanPlot_maxHeight = 64
SpanPlot_MaskEnds = 1
;EnableInterlace = 1
Bitmap0Memory = $2000
ZPBitmap_VarBase = $02
!source "BitmapPlotVars.a"
ZPSegments_VarBase = ZPBitmap_endVars
!source "SegmentsVars.a"
ZPPoly2D_VarBase = ZPSegments_endVars
!source "Poly2DVars.a"
!source "BitmapPlotMacros.a"
!source "SegmentsMacros.a"
!source "SpanCalcMacros.a"
!source "Poly2DMacros.a"
* = $4000
init
lda #>Bitmap0Memory
ldy #%10000100
jsr BitmapPlot_clear
lda #>Bitmap_paletteStart
sta ZPBitmap_PaletteHi
jsr Segments_initStorage
rts
doTrace1
; Setup 2D coords
lda #15
sta Poly2D_vertexBufferX
lda #0
sta Poly2D_vertexBufferY
lda #43
sta Poly2D_vertexBufferX+1
lda #16
sta Poly2D_vertexBufferY+1
lda #38
sta Poly2D_vertexBufferX+2
lda #32
sta Poly2D_vertexBufferY+2
jsr Poly2D_scanTriangle
lda #1
jsr Segments_processLines
rts
doTrace2
; Setup 2D coords
lda #25
sta Poly2D_vertexBufferX
lda #8
sta Poly2D_vertexBufferY
lda #63
sta Poly2D_vertexBufferX+1
lda #20
sta Poly2D_vertexBufferY+1
lda #0
sta Poly2D_vertexBufferX+2
lda #28
sta Poly2D_vertexBufferY+2
jsr Poly2D_scanTriangle
lda #2
jsr Segments_processLines
rts
doPlot
+MWordValueToAddress_A Bitmap0Memory , ZPBitmap_CurrentPos
jsr BitmapPlot_drawSpans
rts
!source "BitmapPlot.a"
!source "SegmentsMemory.a"
!source "Segments.a"
!source "Poly2D.a"
SpanBanks_p0
SpanBanks_p1
SpanBanks_p2
SpanBanks_p3
!source "Poly2DMem.a"
!source "SpanTable.a"
"""
And I run the command line: ..\acme.exe -o t.prg --labeldump t.lbl -f cbm t.a
And I load prg "t.prg"
And I load labels "t.lbl"
When I execute the procedure at init for no more than 25000 instructions
When I execute the procedure at doTrace1 for no more than 25000 instructions
When I hex dump memory between ZPSegments_primaryAllocatorAddrLo and ZPSegments_primaryAllocatorAddrHi+1
When I hex dump memory between Segments_array and Segments_arrayEnd
When I hex dump memory between Segments_linesLo and Segments_linesLoEnd
When I hex dump memory between Segments_linesHi and Segments_linesHiEnd
When I execute the procedure at doTrace2 for no more than 25000 instructions
When I hex dump memory between ZPSegments_primaryAllocatorAddrLo and ZPSegments_primaryAllocatorAddrHi+1
When I hex dump memory between Segments_array and Segments_arrayEnd
When I hex dump memory between Segments_linesLo and Segments_linesLoEnd
When I hex dump memory between Segments_linesHi and Segments_linesHiEnd
When I execute the procedure at doPlot for no more than 10000 instructions
# Then I expect to see ZPSegments_primaryAllocatorAddrLo equal lo(Segments_array+(kSpanPlot_maxHeight*kSegment_length))
# Then I expect to see ZPSegments_primaryAllocatorAddrHi equal hi(Segments_array+(kSpanPlot_maxHeight*kSegment_length))