Friday, 24 January 2014

Hardware Version, progress report #1

Arduino board
Some progress on the hardware. The code is built and running on the Arduino, and it appears to be working. I've not written any of the actual rendering code, but dumping what the LCD should be to the serial port shows that the rendering data is correct.

So if I actually dump that status to the LCD, then I should be getting (hopefully) the start up screen on the display.

The Arduino thing is a bit annoying. The 'IDE' is nice and easy if you just want a few simple bits, but try anything complicated and it just falls apart. The only way I can figure out to cross compile without abandoning it altogether is to #include the C files with a full path name (presumably because it copies source somewhere else - gawd knows). If you put the C files in the directory it compiles them, but bizarrely doesn't link them in.  The Arduino is a great bit of hardware, and so is avr-gcc and avrdude, but the Arduino toolkit outside that is messy.

(One of the things I hate about the Mac is that there isn't a bl**dy key with a hash on it on the standard keyboard. So typing in #include or whatever means you have to press ALT 3. It's really annoying. The big keyboard has one but isn't wireless......)

The implementation is going to be pretty basic. I hacked the emulator so it dumped an include file line creating the ROM image in Arduino ROM if you precede the file name with an 'at'. That then is included into the source code which is compiled and uploaded.


Hardware Prototype

Microvision 2014
I now have a working hardware prototype. It is an Arduino Duemanolive (or however you spell it....), a Piezo Beeper, a 100R resistor for the Beeper, the LCD48x84 Shield and one of those cheap 3x4 keypads.

The shield plugs on the top, the beeper is connected to Pin 8, and the keyboard is connected as follows:

Arduino 13 -> Keyboard 3 (C0)
Arduino 12 -> Keyboard 1 (C1)
Arduino 11 -> Keyboard 5 (C2)
Arduino A5 -> Keyboard 2 (R0)
Arduino A4 -> Keyboard 7 (R1)
Arduino A3 -> Keyboard 6 (R2)
Arduino A2 -> Keyboard 4 (R3)

Leaving A1 free if I ever decide to implement the rotary control (which would just be a pot on there !). I make use of three libraries, Beep (included as standard) LCD4884 (v1.2) and Keypad


Release 11

A new release of the Emulator, for Windows and OSX and Linux probably. Source is in the OSX bundle.

What's new :-

  • Support for Pinball Game
  • Support for Overlays (included for Pinball)
  • Paddle controllable by Mouse
  • Game main display enlarged

For some reason the paddle control by mouse does not work under Windows. I don't know if this is SDL, VirtualBox (I build under XP/VirtualBox) or me - it seems to work perfectly under OSX and the code is very simple, a call to SDL to tell it to pass events on and a bit of code to change the rotary control in response to those events.

I will have a look later on.

Overlays have to be in .bmp format (same name as cartridge) unfortunately as it's the only format that SDL will load without support libraries.

Overlays and Mouse control added.

Made some changes this morning - the main ones  you can see here. When running the display now takes over about a quarter of the screen rather than just being up in the corner (still there for debug mode) & I got rid of the grid (useful for debugging but not otherwise), and the overlay is over the display.

The mouse also controls the paddle - you can still use O & P but this is much better.

I have one fix to make later - the pinball rotary timing is different for the Pinball cartridge, this manifests itself as not being able to go to the right hand last quarter, which makes playing the game difficult.

For some reason, probably the scanning of the overlay being a cm or two off the scanner surface or possibly the blurring or both, the circles aren't in quite the right position, but then this was only a quick hack up of the overlay anyway. My coding skills aren't bad, but I cannot draw at all. I think this is why I quite like coding games for these sorts of machines ; put me on a PC or Tablet and the graphics talent shines through, sort of ...

I will update everything when I've fixed the Pinball timing, which will be later today sometime hopefully.

Couple of ideas

Knockup Pinball Overlay
Couple of ideas appeared in the comments today. A great idea to use the mouse for the paddle controller, and Pinball. Pinball really needs the overlay to be playable, so I ran a cartridge through my scanner (so I can get the scale right !) and painted in the areas to get a very rough and ready copy of the pinball overlay as a PNG.

So today or this weekend I'll get that up and running and make the mouse control work.

Thursday, 23 January 2014

Everything now current again.

So, everything has been updated on the right apart from the old data sheets - everything is, I think current.

The main changes is that the Emulator now has a proper latency implementation. The picture on the right (Bowling again) shows the two pixels rather than one, and it doesn't flicker like the optimised one does.

The Space Invaders source has been packaged with a Binary and updated (it does run on MESS) and so has the system library, though I don't think that's been updated since the last time I used it.

Windows, OSX and source versions are available. Linux users should fine it compiles fine from the OSX sources. Windows users who want to compile it, well, good luck !

Space Invaders uses three keys, one from the left row, one from the middle, and one from the right. You move with left and middle, and fire with right.

To get off the static score screen press Left/Right (e.g. Left and Middle on the keyboard) at the same time.

It doesn't matter which row you use .... I've got 1k of code to fix the key routines if anyone really minds.

Too smart for my own good.

This is the Microvision Bowling Cart which was dumped in the last day or two by Sean R.  by the carve the top off and take a picture with an electronic microscope method.

Unfortunately it didn't work properly on the emulator. A couple of easy fixes - it has the 'reversed output' like Vegas Slots,  and there were a couple of error bits that meant it went haywire.

But it kept flickering - switching 45 degrees all the time. I thought it was a timing bug or possibly a polarity reversal issue. MESS was fine (albeit the data was bit reversed) and MESS doesn't do the polarity reversal, not that it actually matters, you can't have too much DC in an emulator.

It was actually my try-to-be-too-smart optimised LCD code, which tried to second guess the programmer as to whether they were writing vertically or horizontally or both to the LCD controller. It got it right, but this cartridge, technically does both, sort of. The top left most pixel should be set as well as the one below it, but because it does multiple writes to these lines, it got confused, and switched between the two all the time. So sorry, that was really dumb and I hope I haven't wasted too much of Sean's time.

So my plan X is to write a proper LCD rendering routine and use that for the PC based emulator and the row one for the Arduino (I don't think it could do a pixel based one and keep up). This isn't hard, my optimised version treats a row as a single entity with a single entity whereas in reality each pixel has its own latency. This will mean the bomber game which draws everything as columns won't work on the Arduino.

Once I've done that I will update everything, rebuild the Windows version and so on.

Then maybe this weekend I can see if I can build the hardware version.