Style Guide

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