Well, this is a bit random, but I came up with this ca65 macro for converting a nibble (number $0..$F) to its corresponding ASCII character code, when said nibble isn't a compile time constant, and thought I would share it. The main use case would be some sort of debugging. One could, for example, generate a textual log file similar to using .out, but without the limitations of .out.

Without the context it might not be clear, but some members are familiar with my high-level macro code - that's a line from the flag evaluation: I abuse the boolean values to return a value from 1 to 5. A value of zero is an error.

Edit:Now you got me thinking though.. I might be able to simulate an array with .ident() and .sprintf(), but too tired at the moment.

That is one reason why some people don't use ca65. (I don't use ca65 either, but I can understand some of things you write in here, some of which might help people using any system, I suppose.)

Movax12 wrote:

Without the context it might not be clear, but some members are familiar with my high-level macro code - that's a line from the flag evaluation: I abuse the boolean values to return a value from 1 to 5. A value of zero is an error.

O, I "abuse" boolean values like that a lot...

Author:

Movax12 [ Sun Mar 23, 2014 11:42 pm ]

Post subject:

Re: ca65 goodies

tepples wrote:

Then I must have an installation problem:

Code:

$ cl65 -t none n2ha.sld65: Error: Cannot find config file `none.cfg'

Guessing a bit, but if you specify a -t none you should also have a -C config.cfg. If cl65 is going to be assembling, it doesn't matter, but if it is going to be linking, you have to use -C

Author:

thefox [ Mon Mar 24, 2014 4:06 am ]

Post subject:

Re: ca65 goodies

Movax12 wrote:

Guessing a bit, but if you specify a -t none you should also have a -C config.cfg. If cl65 is going to be assembling, it doesn't matter, but if it is going to be linking, you have to use -C

Not sure why it works here without -C, then. I can't easily check what configuration it defaults to, either, but it doesn't seem to be the C64 config (which is otherwise the default).

That is one reason why some people don't use ca65. (I don't use ca65 either, but I can understand some of things you write in here, some of which might help people using any system, I suppose.)

I don't know why tepples talks about creating a project: there's no notion of "project" with cl65, and if he's talking about NESICIDE projects, it's unnecessary to use it to test those macros, as the shell is sufficient and the simplest way to test simple things like the macros of this thread.

Besides, an important information for troubleshooting is lacking: version information of cl65.

tl;dr -t none works for me too without giving a config file. Mind that the default start address is $200, that's why the first example gives 0217.

I use the latest available version of the debian repo available here. Note that the latest version available in the github repo is ~2.14 at the time of writing.

Nifty macro btw.

Author:

thefox [ Mon Mar 24, 2014 7:57 am ]

Post subject:

Re: ca65 goodies

Jarhmander wrote:

Besides, an important information for troubleshooting is lacking: version information of cl65.

Unfortunately there are a lot of "snapshot builds" of cc65 out in the wild with the same version numbers and nothing to distinguish each other. It looks like the recent snapshot versions do include the first 7 characters of the Git revision hash, though, which is good.

It also looks like some older versions included the SVN revision as well, but only for the C compiler (cc65):

Function parameters and local variables can be accessed in the function:

Code:

xproc testFunc lda param foo sta local dog rtsendxproc

Here's how you would call an xparam function:

Code:

ldx #111xinvoke testFunc, foo: x, bar: #$5566, xxx: structInMemory

Inputs can be registers, immediate values or memory addresses. Everything is stored on the zero page. See README.txt in ZIP for caveats/more info.

Also note that build.cmd in the ZIP file requires that the ZEROPAGE segment is at least 32 bytes big (it uses the "none" configuration, which by default for some strange reason only has $1F bytes of zero page). To fix it, modify none.cfg in your ca65 installation directory.

Here's a commented disassembly of the binary produced by the files in the ZIP: