Monthly Archives: January 2016

How to connect your Xbox 360 Controller to Dolphin for Mac

DolphinI’ve been experimenting with the marvellous Dolphin Emulator recently. It’s an open source project that allows us to play Nintendo Gamecube and Wii games on modern hardware. Dolphin is available for Windows, OS X and Linux.

I have a wireless Xbox 360 controller for Windows at my disposal, but the only Windows hardware I have is the first generation Surface Pro. While the controller connects without issues, the Surface¬†sadly just isn’t¬†fast enough to run Dolphin.

My more powerful hardware is Mac based, and Dolphin runs great on my Mac Mini. But I had no idea how to connect my Xbox controller to it.

Turns out it’s actually a breeze to setup: let me show you how it worked for me on OS X El Capitan.

Continue reading How to connect your Xbox 360 Controller to Dolphin for Mac

How to use direct block access commands in Commodore DOS

Commodore-Logo-PaddedWe can access each sector’s raw data on Commodore disk drives with direct block access commands. Supported drives include the 1541, 1571, the VICE emulator as well as the SD2IEC card reader (for the most part).

Each single sided floppy contains 35 sectors, while a double sided 1571 formatted disk contains 70 sectors. Each track contains between 17 and 21 sectors depending on how far inside or outside they are. Each sector contains 255 bytes we can read or write.

Sectors are the same as blocks: only the directory refers to them as “blocks” and shows us how many we have available.

We’ll need to open two channels to our disk drives: a command channel and a data channel. Here’s how to do it:
Continue reading How to use direct block access commands in Commodore DOS

How to save data to your C128 RAM Expansion Unit (REU)

Commodore-Logo-PaddedWith a RAM Expansion Unit (REU), the Commodore 128 could address up to 512k of data. That was huge in the late eighties! All you needed was one of those REUs, plug it into your cartridge port, and so much more super fast memory was at your fingertips.

But even with such a cartridge at hand, how do we actually make use of it from CBM BASIC 7.0? With three funky commands called STASH, FETCH and SWAP. Here’s how we can use them.

The REUs cannot be addressed directly, like other memory in your computer. Instead, data has to be either copied from the C128 to the REU, or vice versa, or swapped out. All three commands take the same four parameters:

  • number of bytes to transfer
  • location in the C128 memory to start
  • REU bank (0-7, depending on the size of the REU)
  • location in the REU bank memory

This sounds more cryptic than it actually is: the largest REU split 512k over 8 banks of 64k, so that the 8bit operating system could address it.

So to store 200 bytes of C128 memory, starting at location 5000, saving it inside the REU’s bank 0, location 0, we can use the STASH command like so:

To retrieve our data later and bring it back to the same C128 location as before, we can use FETCH with the same parameters:

Rather than copying, we can also exchange data in two places by literally swapping it over. Again the parameters are the same:

Enabling REUs in VICE

Although I have a physical C128, I do not have a real REU. Maybe one day I’ll find one on eBay, but until then there’s an easy way to emulate an REU using VICE.

To enable one, head over to Settings – Resource Inspector – Cartridges – REU. Pick the size you like, and even a hard disk location to make the contents of your REU survive restarts.

Screen Shot 2016-01-02 at 09.08.35

Screen Shot 2016-01-02 at 09.09.19

Demo Listing

Here’s a quick test that allows us to store an arbitrary message in memory, then stash or retrieve it from an attached REU.

We don’t see many BASIC listings these days anymore. Enjoy!