Style Guide
stylexyw follows a few simple conventions aimed at making programs more coherent and readable.
macros not resolving to an address: UPPERCASE
label/macro resolving to an address: lowercase
spare zero-page address (byte): z.<name>
device registers: <device>.<name>
sublabels: <label>.<name>
macro consuming a word: ends with w
subroutine: start with verb (unless a getter)
subroutine consuming a word: ends with _w
word value: ends with _w (or _W)
address of string: ends with _s
pointer to address: start with _
word separator: _
macro names must not clash with instruction mnemonics optionally followed by x/y/w
stack effects should be documented with comments above subroutines (see notation)
device names (system, terminal, clock, file, beeper) are reserved and can only be used in device register macros
=== Examples
prompt_s
-> address of a string
file._path_s
-> register holding an address of a string
system._on_error
-> register pointing to an address
z.mode
-> address of a byte stored on zero page
z.size_w
-> address of a word stored on zero page
DBGw
-> macro consuming a two-byte value
ARG_SEP
-> macro resolving to a byte value
DBGw
-> macro consuming a word
MAX_SIZE_W
-> macro resolving to a word value
handle_keypress
-> subroutine
handle_keypress.check
-> sublabel within subroutine
length_w
-> subroutine returning a word or label to word value