Posted August 14, 2026 by polytricity
#c64 #programming #6502
CODE EDITOR:
Each code block will have its own UNDO/REDO and works when closed and re-opened.
Also added Low/Hi Literals: #<$literal/#>$literal
Also made sure inline byte tables push the program counter bytes in place.
Here is a useful routine for code block:
; ============================================
; Pre-populate Colour RAM ($D800) per row
; 25 rows x 40 columns - one colour per row,
; taken from a 25-entry table
; ============================================
LDA #<$D800
STA $F6 ; pointer lo
LDA #>$D800
STA $F7 ; pointer hi
LDX #$00 ; X = row index, 0..24
ROWLOOP:
LDA ROWCOLOURS,X
STA $FC ; this row's colour, stashed
LDY #$00
COLLOOP:
LDA $FC
STA ($F6),Y
INY
CPY #40
BNE COLLOOP
; advance pointer by 40 for next row
CLC
LDA $F6
ADC #40
STA $F6
LDA $F7
ADC #0
STA $F7
INX
CPX #25
BNE ROWLOOP
JMP ROWSKIP ; jump clean over the data table below
ROWCOLOURS:
.byte $01,$0F,$0c,$0b,$06,$04,$0e,$05,$03,$0d
.byte $01,$07,$0a,$08,$02,$09,$0b,$0c,$0f,$07
.byte $03,$05,$0e,$06,$0c
ROWSKIP: