-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathBitmapPlotMacros.a
More file actions
109 lines (93 loc) · 2.04 KB
/
Copy pathBitmapPlotMacros.a
File metadata and controls
109 lines (93 loc) · 2.04 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
!macro GetSpan .el1 , .scanLengths , .scanColours , .bankSelect , .spanTab_lo , .spanTab_hi {
!ifdef kSpanPlot_SupportLongerSegmentsAsChunks {
lda ZPBitmap_IsLongerSpan
beq .notLonger
lda #0
sta ZPBitmap_IsLongerSpan
rts
.notLonger
}
ldy .scanLengths,x
bne .got
jmp .el1
.got
!ifdef kSpanPlot_SupportLongerSegmentsAsChunks {
.tryAgain
cpy #kSpanPlot_maxLen
bcc .isOKLength
inc ZPBitmap_IsLongerSpan
tya
pha
; Process this chunk using this length, which is not the maximum, but does preserve alignment. This is a little faster.
lda .spanTab_lo + kSpanPlot_maxLen-1-4
sta .smp0js+1
lda .spanTab_hi + kSpanPlot_maxLen-1-4
sta .smp0js+2
ldy .scanColours,x
lda (ZPBitmap_PaletteLo),y
ldy #0
.smp0js jsr $1234
pla
sec
sbc #kSpanPlot_maxLen-4
tay
+lbeq .el1
+lbcc .el1
jmp .tryAgain
.isOKLength
}
!ifdef SpanTable_IsInCart {
lda .bankSelect - 1,y
sta CART_SELECT_BANK
}
lda .spanTab_lo - 1,y
sta .smp0j+1
lda .spanTab_hi - 1,y
sta .smp0j+2
ldy .scanColours,x
lda (ZPBitmap_PaletteLo),y
inx
ldy #0
.smp0j jmp $1234
}
!macro ScanCalc_GetSegment .index , .doScanDraw , .scanLengths , .scanColours {
lda ZPSegments_currentSegmentHi
bne .gotSpan
; Handle filling until the end of the line
lda #kSpanPlot_maxLinePlotLen
sec
sbc ZPBitmap_SegmentsPos
sta .scanLengths + .index
lda #kSpanCalc_backgroundColour
sta .scanColours + .index
lda #0
sta .scanLengths + .index + 1
jmp .doScanDraw
.gotSpan
ldy #kSegment_offset_left
lda (ZPSegments_currentSegmentLo),y
sta ZPSegments_segmentLeft
cmp ZPBitmap_SegmentsPos
beq .inSync
; Handle filling in missing sparse spans
sec
sbc ZPBitmap_SegmentsPos
sta .scanLengths + .index
lda ZPSegments_segmentLeft
sta ZPBitmap_SegmentsPos
lda #kSpanCalc_backgroundColour
sta .scanColours + .index
jmp .end
.inSync
ldy #kSegment_offset_right
lda (ZPSegments_currentSegmentLo),y
sta ZPBitmap_SegmentsPos
sec
sbc ZPSegments_segmentLeft
sta .scanLengths + .index
ldy #kSegment_offset_colour
lda (ZPSegments_currentSegmentLo),y
sta .scanColours + .index
+Segments_getNextSegment
.end
}