Summarized Pre-commenting
Posted: Sun 19 Jun, 2005 8:51 pm
I got a nice idea (some of you might have already tried this) to add a summarized block of comments before your code to explain what all the code does, in order. Through the summary you could put number and letter labels that share the same label with the code that does what it's describing. This could help in debugging or even going back to the code after a long period of inactive programming. A very simple example:
Probably not the *most* efficient way to do it, but if you do it enough you might adjust it to work better.
Code: Select all
-First block of code is simple: [1a] include ion and keypress data, as well as [1b] required headers.
-Start of the loop, we have the [2] square thrown onto the screen at 0,0. Whee.
-Then we do a [3a] direct input check to see if MODE was pressed, if so [3b] exit.
-[4] Loop!
-[5] Square's image data. Simple.
.nolist
#include "ion.inc" ; [1a] Included files, duh.
#include "keys.inc"
.list
#ifdef TI83P ; [1b] Headers and such. m00.
.org progstart - 2
.db $BB,$6D
#else
.org progstart
#endif
ret
jr nc, start
.db "Blah",0
start:
xor a ; [2] Load coords for 0,0
ld l,a
ld b,8
ld ix,Square
call ionPutSprite ; And put onto the screen!
call ionFastCopy
ld a,Group7 ; [3a] Check to see if MODE was pressed
out (1),a
in a,(1)
cp kMode
ret z ; [3b] Exit the program upon hitting CLEAR
jp Start ; [4] Jump back to the beginning! AGAIN! AGAINN!
.end
END
; [5] Aaaand here's data. Boring data at that.
Square:
.db $FF, $FF, $FF, $FF
.db $FF, $FF, $FF, $FF