• Bit 64

  • by jwhoag

Commodore-related project and thoughts I have worked on

May
15

Announcing C64List 4.03 (Covid-19 special bonus edition)

Minor fixes you'll want, plus some inner-circle secrets!

Yep, found a few minor bugs and made some improvements since the last release. Find the new release on our Facebook page: https://www.facebook.com/c64List


For those interested, here are the release notes for the past few minor updates

4.03:
  - In DATA statements, omitted parameters (multiple commas in a row) didn't parse correctly
  - Adjust amount of output at verbosity levels
  - Added command line parameter -language:bas|asm|auto to replace -notbasic (-notbasic still works at this time but will be removed eventually)
  - Added more tests for QA'ing releases
  - Better handling for tick character inside quotes

4.02
    *(fixed) -lst a file that ends at $ffff caused endless loop
 
4.01
    *(fixed) -lst did not output if loaded from .prg
    *(fixed) -lst outputs illegal instructions by default
4.02
    *(fixed) -lst a file that ends at $ffff caused endless loop
 
4.01
    *(fixed) -lst did not output if loaded from .prg
    *(fixed) -lst outputs illegal instructions by default
4.02
 - lst a file that ended at $ffff caused endless loop
 - .prg files ending at address $ffff didn't load
 - some minor fixes to alpha modes
 
4.01
 -lst did not output code in some cases
 -don't decode illegal 6510 instructions by default
 -fixed issue with asmfmt pseduo op (this pseudo op is not fully supported or officially recognized at this time)


Now for the secrets.

There are a couple of not-currently-officially-released features that are mostly working but are not considered complete, and are as-yet undocumented. Feel free to try these features out and provide feedback if you like, however be aware that they may not work in all cases and will likely change in upcoming releases. Also I don't currently do any automated testing on these features before I make a new release, so it's very possible that issues will slip through.

1) When converting from .prg to text files, C64List makes some assumptions on how to interpret the file.

If the load address is 0x0801:

C64List assumes that the .prg file contains BASIC. The code is detokenized as into BASIC text until the end-of-BASIC terminator is found. Any remaining bytes are truncated and a warning is inserted indicating that there is likely some assembly code that will need to be ported manually.

The -lst command line parameter by default will begin listing assembly after the end-of-BASIC mark. A different range may be specified if desired.

If the load address is not 0x0801:

C64List assumes the .prg file is probably assembly. -txt and -lbl may not output any code in this case, and -lbl will disassemble the entire loaded range.

You may override C64List's assumptions using the undocumented -language command line parameter.
 -language:bas  or basic  or b --> treat the file as BASIC code
 -language:asm or assembly or a --> treat the file as machine language code
 -language:auto --> (default) uses the default assumptions

2) New pseudo-op: asmfmt

When you -lst a file, C64List outputs an assembly list file that contains the following columns: address, opcodes, decoded instruction, and a comment field that lists the instructions operand (if any) as a value. For example:
begin:
   1000  4c 24 10   jmp function1      ;$1024
If there's no label for the operand, you'll see the operand's value listed in both places:
   1000  4c 24 10   jmp $1024          ;$1024

However, you can change the format by using a preface file and inserting a single instruction: the asmfmt pseudo op. This pseudo op does not generate any bytes of code, which is fortunate because preface files explicitly disallow anything that would output any code. So you can add asmfmt into your preface file along with any symbols you wish to define for use in the disassembly.

The asmfmt pseudo op takes a single string-type parameter enclosed in quotes. Inside this quoted string are one or more parameters.

The pre-canned options for asmfmt currently are:
"-dbg"  (debug output--the default)
"-mon" (monitor-style output--don't use symbols)
"-src" (source code--> does not output opcode bytes, and uses symbols if they are available, so it would be much easier to use the output as source code). This option outputs this style of code.
  startprogram:
                lda #$14
                jsr subroutine1
                rts

You can also customize it a lot more. The underlying formatting gives you these options:
 -illegal    (instead of showing ??? for illegal opcodes, show a mnemonic that kind of describes what it does)
-addlabels (inserts label lines where an instruction's address matches an imported symbol)
-'' formatting characters as follows:
   %a        (address of instruction)
   %b        (opcode bytes)
   %i         (instruction mnemonic)
   %o        (instruction operand)
   %s        (instruction operand as a symbol, if the operand corresponds to a symbol)
   %t         (tab character)
    outputs as itself

For example, the -dbg canned option corresponds to this:
 asmfmt "-'%t%a  %b%t %i %o %t;%s'"
If you wanted to add illegal opcode mnemonics you can do this:
 asmfmt  "-'%t%a  %b%t %i %o %t;%s' -illegal"
or just
 asmfmt "-dbg -illegal"

A couple of notes here:
  1) note the single quotes around the build-it-yourself formatting string.
  2) if you use a formatting string to build upon a canned option, you will need to list it first, because any canned option clears all the formatting before it.


I hope you enjoy playing with these new and undocumented features! In the spirit of social distancing, I figured I'd help alleviate some boredom and provide some new things to investigate. Stay home and disassemble!

Leave a Comment

You must be signed-in to post comments.

Responses