dwight wrote:
These are good meaningful comments but it clearly shows the desire to have an assembler that allowed multiple statements per line.
No such desire here. Even if I had such an assembler I would not place multiple statements on one line. Assembly language isn't BASIC—run-on lines in assembly language make it easier to make mistakes that are hard to pinpoint, with essentially no gain in typing speed. Also, the ability to clearly read each statement has become very important to me in recent years due to deteriorating vision.
Quote:
The comments could just as easily been put at the break comments you had as empty lines, in many of the cases.
Nope. The reason for the breaks is to clearly delineate blocks of code, such as the FIFO processing loop. Also, I always put a break after a branch instruction, as that is a "fork in the road" in the logic flow and thus is easier to pinpoint in large programs.
POC V1.1's firmware runs to over 12,000 lines of source code. POC V2's source code will be even larger (it's already near 14,000 lines) and more complex. Without rational formatting, it would be a reading quagmire, especially if lines contained multiple statements.
GARTHWILSON wrote:
I believe I've seen such assemblers (and Forth assemblers do it routinely); but again the power of assembly-language macros goes widely ignored, misunderstood, and unused. Used properly, macros can dramatically raise the level of the language, with, in most cases, no penalty of any kind, while improving programmer productivity and software maintainability, and reducing bugs.
I haven't used any macros in POC's firmware, other than those that synthesize 65C816 instructions. For some strange reason—likely due to having written 6502 assembly language for some 40 years—I have no trouble visualizing loops and similar program structures, so have not found an incentive to use macros in such areas. However, I do use macros in my application software to lessen the work of calling functions and processing multi-byte numbers. For example, it's definitely easier (and more mnemonic) when printing a character to the console display to write
prntchra 'A' than (in the case of POC V2) write the following:
Code:
LDA #'a' ;char to print
TRAP _b_writsioa ;write char to console
With the above encapsulated in a macro I am much less likely to miss a required parameter or otherwise upset the apple cart. The macro makes sure the right API index is specified during the API call. The assembler will complain, of course, if the parameter to
prntchra is missing or is not a single byte.
By the way, the
TRAP instruction itself is a macro:
Code:
TRAP .macro .api
.if .api = 0 || .api > maxapi
.error ""+%1+": API index out of range"
.else
PEA #.api ;API index to stack
COP #$00 ;call API handler in BIOS
.endm
Sure beats typing in all that gibberish with each API call.