Continuing on the topic of clean code, even though its not X16 Edit specific, I have some thoughts on how to apply to assembly programming.
In the lesson linked above, Uncle Bob is talking a lot about the design of functions:
Names of functions (and variables) should be carefully chosen, so that reading code is like reading (good?) prose
Function names should contain verbs, as they are doing something
A function should do only one thing; the process of cleaning code entails breaking a function into the smaller and smaller parts, and you know you're done when no more functions can reasonably be extracted
A function should be short (most often 5 lines)
In a modern cross assembler, such as ca65, there's nothing stopping you from naming things properly.
But what about functions doing only one thing, and functions being short like 5 lines?
Any high level language examines functions at compile time, and decides wether the resulting machine code is inlined or made into an actual machine language subroutine. Even if you are writing a lot of really small functions in a high level language, the binary code will probably be efficient.
In 6502 assembly, if you do a lot of subroutine calls with JSR+RTS, they will all stay in the final binary code making it inefficient.
I have never seen 6502 assembly code trying to be clean code in the way Uncle Bob describes. Would it even be possible without loosing performance?
I think it might be, if you use extensive use of macros for code that you want to break out into a separate "function" where the resulting machine code is inlined.
A simple example. Is this a good idea?
.macro goto_topleft
stz VERA_L
stz VERA_M
lda #(2<<4)
sta VERA_H
.endmacro
.macro clear_line
ldx #80
lda #32
: sta VERA_D0
dex
bne :-
.endmacro
.macro goto_nextline
stz VERA_L
inc VERA_M
.endmacro
.macro is_finished
lda VERA_M
cmp #60
.endmacro
.proc clear_screen
goto_topleft
loop:
clear_line
goto_nextline
is_finished
bne loop
rts
.endproc
VERA_L = $9f20
VERA_M = $9f21
VERA_H = $9f22
VERA_D0 = $9f23