Arakula / dasmfw

The DisASseMbler FrameWork
GNU General Public License v2.0
13 stars 4 forks source link

'mnemo org repl' not working as expected #16

Closed phillipeaton closed 2 years ago

phillipeaton commented 2 years ago

For the new mnemo option, it appears that you don't need the word option a the start of the line. But in the dasmfw.htm documentation, it's not really clear if you need it or not. However, the mnemo option doesn't appear to work with option in place, whereas the other options work fine with option there. This gets me thinking, are some/all of the option statements in my options.nfo redundant?

Additionaly, should mnemo org repl really be orig, or is it referring to the address org directive? (I'm thinking not, but it's not clear.)

The documentation of the mnemo command is hard to understand. The complex parts I can't understand by just reading the description, I will need to experiment. Perhaps some real life examples would help.

Below my current info file, mnemo is at the end of the file without option at the start:

*** GENERAL COMMAND LINE OPTIONS ***
* Options begin,end,offset,interleave,bus always define settings for the following file
option dasm 6502            * Select disassembler type
option out jetpac.a65       * Select output filename of dissasembly
option offset 2000          * Select start address of supplied binary
file   jetpac_2000-3fff.bin * Instructs dasmfw to load the given file at the given address

*** OUTPUT FORMATTING OPTIONS ***
*option addr off     * Show address field output for clean assembler source files
*option hex on       * Show hex dump output
option asc off       * Show output of the ASCII equivalent to code/data
*option cref on      * Show cross-referece table
*option unused on    * Show unused labels
option labellen 9   * Def=8  Reserve spaces for code labels.
option eqlbllen 24   * Def=8  Reserve spaces for EQU labels.
option copndlen 24   * Def=24 Reserve spaces for operand part of disassembled instruction with line comment
option uopndlen 52   * Def=52 Reserve spaces for operand part of disassembled instruction without line comment
option dbcount 3     * Def=5  Reserve spaces for hex/ascii dump bytes if hex or asc options enabled.

*** DISASSEMBLER OPTIONS ***
*option pbase 16     * Default parsing base, default is 16
option defdisp hex  * Default display base, default is hex
*option cchar //     * Set end of line comment character
*option cchar ;      * Set end of line comment character
*option multilabel on * Create multiple labels for a single address
*option autolabel on  * Generate label based on previous label, instead of m1234/z1234
option upmnemo off   * Upper case mnemonics in output file
mnemo fcb .byte * Output .byte instead of fbc for Kick Assembler
Arakula commented 2 years ago

You're right, that's not an option, but an info file instruction; I've put it into the wrong position in the documentation. And no, the option is not redundant. I could make it redundant by adding a little "if it's not a recognized info file instruction, try it as if it had optionprepended to it" logic, but that might lead to unintended consequences; I'll think about it.

BTW, I answered your comment to the commit before that with a complete Kick assembler example. Here's it again:

option cchar //
option ldchar :
option noaccparm
mnemo org \*=$(parm)
mnemo end //end  * Kick doesn't seem to have that
mnemo equ .const $(label)=$(parm)
mnemo fcb .byte
mnemo fcw .word
mnemo fcc .text
* doesn't seem to work properly - .text "p", for example, results in a $10 byte(?)
* since .text doesn't work as intended, don't use it ...
option nofcc

See the mnemo org and mnemo equ parts for a slightly trickier example.

Arakula commented 2 years ago

Next upload will have the documentation in the correct position.

phillipeaton commented 2 years ago

Ah, yes, I recall seeing that comment reply now...but I was in Croatia at the time in holiday mode. I already tried the org replacement, which worked ok. mnemo equ .const $(label)=$(parm) completes the understanding, thanks!

I'm not sure I'll actually use Kick Ass Assembler, it seems a bit overkill if you're not actually writing code, but on the other hand there is a VSCode extension for 6502, which includes Kick integration, although VSCode might be overkill too. TextPad I've used for many years and it works well, setting up syntax highlighting for info files and shortcuts for running dasmfw and as65 was easy.

Too many tool choices!

Arakula commented 2 years ago

For my 10yo laptop, VSCode is definitely an overkill - it takes quite some time to load that monster :sunglasses: But it's the method of choice now for quite a lot of stuff (ESP32 programs, for example), so ... well, I got to live with it.

phillipeaton commented 2 years ago

Did you spot this question I posed? (Maybe you've already fixed it in the next documentation update?)

Additionaly, should mnemo org repl really be orig, or is it referring to the address org directive? (I'm thinking not, but it's not clear.)

Arakula commented 2 years ago

You answered it yourself, but it'll be orig in the next upload.

Arakula commented 2 years ago

Also, just in case you didn't notice yet, you can load two or more info files into dasmfw from the command line, like in dasmfw -info kick.nfo -info myproject.nfo so it might be preferrable to put the setup for a specific assembler into its own info file. Makes retargetting a lot easier.

phillipeaton commented 2 years ago

Yup, here's the first few lines of my main info file: include nfo_options.nfo * dasmfw options

include nfo_memory_map.nfo * Include VIC-20 memory map info

include nfo_separators.nfo * Include JMP/JSR separator lines

include nfo_code_data.nfo * Everything is data, unless it's not

include nfo_variables.nfo * Zero Page and others with persistency