-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtogglepixel.asm
More file actions
108 lines (89 loc) · 2.33 KB
/
togglepixel.asm
File metadata and controls
108 lines (89 loc) · 2.33 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
;===============================================================================
; Command Handler: toggle editing pixel on/off
;===============================================================================
checkfirebtn
LDA joystickport2
CMP #$6F
BEQ pixelinvert
RTS
pixelinvert
LDX #$00
LDA (editgridposlo,X)
CMP keyfullblock ; pixel on?
BEQ clrpixel
LDA keyfullblock ; set pixel
STA (editgridposlo,X)
JMP showpixel
clrpixel
LDA keyspace ; clear pixel
STA (editgridposlo,X)
showpixel
NOP
NOP
NOP
storeditgrid
LDY #$00 ; clear 8-bytes in-memory of the char ready for new values
LDA #$00
clrmempixel
STA (charmemposlo),Y
INY
CPY #$08
BNE clrmempixel
LDA #<editgridhome ; start at top-left of display 8*8 edit grid
STA workgridposlo
LDA #>editgridhome
STA workgridposhi
LDX #$00
stormempixel
TXA
PHA
JSR setmempixel
PLA
TAX
INX
CPX #$08
BNE stormempixel
SEC ; set character memory pointer positions back to char start
LDA charmemposlo
SBC #$08
STA charmemposlo
LDA charmemposhi
SBC #$00
STA charmemposhi
RTS
;
; Utility function : set pixel in character memory from display editing grid
;
Align
setmempixel
LDY #$80
chkgridpixel
LDX #$00
LDA (workgridposlo,X)
CMP keyfullblock ; is the pixel set? representing a '1', ignore if clear/'0'
BNE nextpixelpos
TYA
CLC
ADC (charmemposlo,X)
STA (charmemposlo,X)
nextpixelpos
INC workgridposlo ; move to next 'pixel' in display 8*8 edit grid
BNE nextpixelcol
INC workgridposhi
nextpixelcol
TYA
LSR
TAY
BNE chkgridpixel
CLC
LDA workgridposlo ; move to next row in display 8*8 edit grid
ADC #$20
STA workgridposlo
LDA workgridposhi
ADC #$00
STA workgridposhi
INC charmemposlo ; move to next character memory position
BNE exitsetmempixel
INC charmemposhi
exitsetmempixel
RTS