If you write an assembler, please, please, please:
ORG $8000
ORG 8000H
ORG 0x8000 ; although I personally hate this one!
org $8000
.org $8000
*=$8000
*=*+$40 ; skip $40 bytes
ORG $ + $40 ; skip $40 bytes
<etc.>
The $ above, when not followed by hex digits, is the way all three commercial assemblers I've
used returned the current value of the program counter.
CLR_FLAG ICNT, IHEAD, ITAIL, OCNT, OHEAD, OTAIL, OIE ; Init the software flags.
which stores a zero in each of those. If the maximum number of flag variables to clear were 8,
IFMA...ENDIF would be used eight times in the macro definition (or actually seven, assuming
the first one is not optional, so you don't use the IFMA on that one). In this case,
each IFMA would be followed by a STZ <addr> (STore Zero)
line (or STA <addr> if you had an NMOS 6502 and had to start with
LDA #0 at the top), before the ENDIF line.
Anything that starts in column 1 (other than a semicolon) should be considered a label, regardless of whether it's followed by a colon or not. A label not starting in column 1 should definitely have the colon. Without it, the assemblers I've used would give an error message saying the name is not defined. Regardless, the colon always means a symbol is being defined; so there's no ambiguity there.
COMMENT
Don't use N-1 like other systems. It's not necessary with 816 & it'll put you
in XSAVE. You DEX twice before writing the first stack cell, so S0adr isn't
used by stack. X holds the actual ZP address of the top stack cell. Top of
both stacks is the stack cell closest to address 0. Altho' the '816 can have
the direct page anywhere in bank 0, it runs fastest if we leave the direct
page on a page boundary, so we might as well leave it at ZP just like w/ 6502.
END_COMMENT