I came up with a system based on Spasm macros:
Code:
#ifdef REGENERATE_DOCUMENTATION
#macro documentSection(text)
.echo >> microsRoutines.txt "\n\n================================================================================\n"
.echo >> microsRoutines.txt "======= ", text, " =======\n"
.echo >> microsRoutines.txt "================================================================================\n"
#endmacro
#macro documentRoutine(text)
.echo >> microsRoutines.txt "\n------- ", text, " -------\n"
#endmacro
#macro document(text)
.echo >> microsRoutines.txt text, "\n"
#endmacro
; This regex replaces comments with document()
; Find: \r\n; ([^(\r\n)]+) Replace: \r\ndocument\("$1"\)
; This regex replaces labels followed by document() with the label and documentRoutine()
; Find: \r\n(\w*):\r\ndocument\( Replace: \r\n$1:\r\ndocumentRoutine\("$1"\)\r\ndocument\(
; Reset document.
.echo > microsRoutines.txt "MICROS SYSTEM ROUTINES DOCUMENTATION\n"
#else
#macro documentSection(text)
; Do nothing.
#endmacro
#macro documentRoutine(text)
; Do nothing.
#endmacro
#macro document(text)
; Do nothing.
#endmacro
#endif
.
.
.
documentSection("KEYBOARD")
document("It might be nice to have a GetString routine at some point. Whatever.")
;------ GetAscii ---------------------------------------------------------------
GetAscii:
documentRoutine("GetAscii")
document("Gets a single key press, with modifiers from shiftFlags processed. 2nd and")
document("Alpha flags are reset, unless alpha-lock is enabled, in which case only 2nd is")
document("reset.")
document("Inputs:")
document(" - inputerFlags")
document("Outputs:")
document(" - ASCII char in B, might be a control char")
document(" - D: Shift flags")
document(" - E: inputerFlags")
document("Destroys:")
document(" - Pretty much everything, most likely.")
Output:
Code:
================================================================================
======= KEYBOARD =======
================================================================================
It might be nice to have a GetString routine at some point. Whatever.
------- GetAscii -------
Gets a single key press, with modifiers from shiftFlags processed. 2nd and
Alpha flags are reset, unless alpha-lock is enabled, in which case only 2nd is
reset.
Inputs:
- inputerFlags
Outputs:
- ASCII char in B, might be a control char
- D: Shift flags
- E: inputerFlags
Destroys:
- Pretty much everything, most likely.