Addressing mode!

I was rewriting parts of my RTC module driver for the Commodore 64 when I stumbled into an issue for which none of the bytes read from the RTC were buffered correctly so it was consistently giving out an invalid date/time:

00:00:00 00/00/2000

As I got enthusiastic about my Logic analyser I decided to look at the communication itself, trying to hunt down a bug in my new code. Oddly enough the signal looked perfect but read bytes were not stored as expected.

So I looked at the code and found the mistake. I had written:

sta ($fd),x

64tass silently converted it into the closest supported addressing mode without giving me any warning:

sta $fd,x

Obviously that’s not what I meant. What I meant to write was:

sta ($fd,x)

Once fixed my new code was working perfectly! Driver + BASIC boot + little demo application are about 0x200 bytes and that includes a couple of text messages too 🙂

This entry was posted in Retrocomputing, Technical and tagged , . Bookmark the permalink.

One Response to Addressing mode!

  1. luigidifraia says:

    The above behaviour in 64tass has been changed by soci as per commit log here:
    The world is a better place now 🙂

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s