-
Notifications
You must be signed in to change notification settings - Fork 53
Description
For my current project, I had to add a few features to DASM which may be useful for other DASM users:
-
source files now can have line numbers starting at first character. These are ignored / skipped.
As DASM required labels to begin at the first position in a line, here is the remedy for that: -
Labels terminated with a colon ':' are now recognized anywhere in first part of the line, before
any mnemonic or directive, but after the (optional) line numbers and '|' characters: -
a sequence of '|' characters (ASCII $7C) after the (optional) line number or at the beginning
of a line are ignored. The sequence can be of any length, but can't contain any other characters
nor any white space. This feature is meant to make nesting levels of .IF / .ENDIF blocks human
readable.
Yet another added feature:
- DCX directive added to automatically invert the MSB of the last byte of a string. This was a common
trick used, for instance, in the Microsoft BASIC interpreter.
This feature involves adding only one (!) line of code each in the files globals.c and ops.c
You might ask why I needed these extra features. Well, a few weeks ago, Microsoft has published their
original source code for Microsoft 6502 BASIC, see here:
https://github.com/microsoft/BASIC-M6502
... but this source won't assemble with any 6502 assembler I tried. I had to edit the original source to make it fit to assemble with DASM which involved adding lines and I wanted to keep track of which lines came from the original source and which were added by me. Hence, the line number feature. It also turned out that the deep nesting levels of their conditional assembly blocks are unfathomable for humans, so I made a machine do the tedious job to add the '|' indicating nesting levels. The added DCX is needed for their peculiar way to terminate strings. Which saves one byte per string. Some strings terminate with a zero, though, which is easy to implement, so no added DC variant for this.
The tgz file with my mods is attached. An example ('test.asm') showing all the new features is included.
I would appreciate if you could put these features into DASM as soon as possible, because I can release my edited Microsoft 6502 BASIC source code only when DASM has been upgraded to be able to handle it.
I think these added features are also useful for other developers, not only for those who want to explore Microsoft's 6502 BASIC.
- Uncle Bernie
Attachment: rename the file to UB_DASM_mods.tgz --- github refused this so I changed it to .zip