MEGA65 Links

Tuesday, October 14, 2014

Found a sneaky CPU bug

While trying to run some graphic test programmes supplied by Rayne, I found that the CPU was mis-behaving in a way that reminded me of the bug I was seeing with BoulderMark, and probably Lemmings as well. Basically all was fine until a raster interrupt occurred, and then things would go odd or outright crash. What was extra odd was that BoulderMark would still run on the FPGA at work, but not on the one here at home, which shouldn't happen -- FPGAs shouldn't be picky like that.

Anyway, Rayne's programmes are much simpler, and offered the prospect of easily debugging what was going on.

So after a bit of poking around I discovered that the C65GS would go to lala-land after INC $D019.

This got me thinking, because $D019 is special in my CPU, because it adds a dummy write for RMW instructions that touch $D019, but not any other address. This is to avoid wasting a CPU cycle on the dummy write of the original value back to memory, except when required for C64 compatibility.

The lack of this dummy write on the C65, that acts to clear the VIC-II interrupt on a C64, is one of the major sources of incompatibility between the C65 and C64, and stops the majority of software from running on it. Thus I had gone to special effort to make sure it wouldn't be a problem on the C65GS, but without the CPU speed penalty of doing it on every address.

Oops.. not actually all fixed. It is now writing to $D019 in RAM, not IO. Lucky I decided to write this blog post, or I wouldn't have spotted that I still had the memory write flags slightly messed up. Specifically memory_access_resolve_address wasn't asserted, so the 16-bit address was not being translated to the physical 28-bit address. Fix that and try again:

I second that - I follow every single blog post, and I can't wait for the next progress update! I'd easily shell up some money for a finished C65 clone with Ethernet-connectivity, a C64/128-compatible keyboard and a plastic wedge case in classic Commodore pale-beige! Count me in if printed manuals for the finished product are on your agenda and you need a Swedish translation!

Thanks -- Also if you do wish to write any manuals, in English or Swedish, you are most welcome to do so :)As for the eventual cost of a conversion kit (including PCB with many or all C64 connectors that accepts the FPGA board) for an old C64 keyboard, my best estimate at this point in time would be ~AU$200-AU$400 + the cost of the FPGA board, which is US$160 with academic pricing or US$320 without. So expect total cost to be between US$350 and US$800. But these are only wild estimates at this point in time.

The pleasure is all mine - and I may very well take you up on that offer, if this project will (eventually) set commercial sails, so to speak. With print-on-demand services and the dawn of 3D printing technology in mind, I'm hoping that low-cost solutions for shipping complete DIY (or pre-assembled) C65 kits will actually be viable - and that's where those comb bound manuals should prove valuable! :)

About Me

Dr.
Paul Gardner-Stephen has had an interest in making computers do things
hey weren't designed to do reaching back to his school years, including helping to write LUnix, a UNIX-like preemptively multi-tasking operating system for the Commodore 64 computer.

At age
17 he had written software in assembly code to control a 30' industrial roll-former for export to Brazil before moving on create software to use PCs as hard-drives for 8-bit
computers. This software was sold on three continents and resulted in
Paul's first experience with mobile telecommunications in the form of
an NEC P3 analog cell phone in 1995.

Soon
after obtaining his doctoral degree Paul created the world's first
working and wearable shoe phone, and then made the necessary
arrangements to wear it aboard a commercial flight into US air space in
the post 9-11 era to demonstrate the increasing ubiquity of wearable
computers, with a particular focus on wireless health applications.

Along
the way Paul has remained deeply involved with his local church and
supporting development and disaster response activities in a variety of
locations.

No longer content to participate remotely, he is passionate
about creating technology that can save and transform the lives of
millions.

This passion has expressed itself in founding The Serval Project, a not-for-profit organisation that has created the first practical mesh mobile telephony system. It uses off-the-shelf cell phones, and even lets you keep your existing phone number while making free calls on the mesh. The Serval Project has reached the prototype stage and is expected to be trialled in various locations from late 2011.