Insane Contraption

Discuss anything not related to the current Uzebox design like successors and other open source gaming hardware
User avatar
Jubatian
Posts: 1560
Joined: Thu Oct 01, 2015 9:44 pm
Location: Hungary
Contact:

Insane Contraption

Post by Jubatian »

So at last I started building hardware. Quite an adventure, now hopefully I have something which should not have too many defects. That is, it didn't go up in smoke when applying power, and the programmer sees the chip!
Power and Programmer attached
Power and Programmer attached
PC277204.JPG (170.04 KiB) Viewed 11133 times
Side view showing the mess inside
Side view showing the mess inside
PC277206.JPG (142.09 KiB) Viewed 11133 times
It can be taken apart!
It can be taken apart!
PC277208.JPG (161.81 KiB) Viewed 11133 times
This for now is more or less an E-Uzebox with an ATmega1284 and a 18MHz crystal, otherwise I followed an E-Uzebox schematics with some changes applied here and there, such as notably putting Sync on a PWM capable pin.

There is more to it though, as I laid this one out with the intention of being compatible with a more elaborate plan involving a 32KBytes static RAM chip and a few latches. The novelty of that system is that it could palettize video through the RAM chip by diverting the chip's data to the video DAC, so you could OUT palette indices as addresses, allowing high-resolution 4bpp, while outside video, you could still use it as normal, as significantly faster random accessible external memory than an SPI RAM. So the overall design would be that game binaries created for this currently assembled system would run on the bigger one as well.

The 1284 has a quite crazy possibility for video coding (on this smaller system primarily) as the full address space is populated, there are high-resolution video modes which would rely on this. Next thing is that I am going to build a bootloader capable to support this (using only every second 128 word Flash page, leaving the upper halves of 256 word segments free, available for games).

Emulation is (will be) possible by porting CUzeBox to this or adding support for it, the overall mechanics are not too complex, even the bigger system having the RAM chip would do well, and notably due to the 18MHz clock, actually could perform better than Uzebox.

Otherwise next steps would be building a prototype of the bigger system, creating a bootloader, then eventually I might also design PCB for it (wow, building this prototype stuff, producing all that entangled mess of wiring is difficult!). NTSC support would be provided in a similar way to Uzebox, however the NTSC chip clocked on its own. It wouldn't really be a problem, the color clock could slightly drift, but that's all (there are other projects out there using this solution).

Source compatibility with Uzebox migth be possible to some degree. At least I figured out how I could sort of get Mode 3 on this thing, with some limitations, but maybe I could eventually create a kernel which provides an interface sufficiently similar to Uzebox Mode 3 for making it easier to realize a game which could be compiled for both.

Anyway, still quite a way to go to get there, first to see whether this thing ends up blowing up something else than itself and so on :P
User avatar
Jubatian
Posts: 1560
Joined: Thu Oct 01, 2015 9:44 pm
Location: Hungary
Contact:

Re: Insane Contraption

Post by Jubatian »

Anyone any weird idea on how to get a bootloader on a 1284 with USBTinyISP?

I spent a few hours to end up figuring out that I have the problem that the USBTinyISP can not program above 64K (thankfully I didn't end up tearing the prototype apart to "fix" the problem, I just spent the time meticulously verifying that every connection everywhere is correct). So I ran into this problem described here on an Arduino forum.

Right now it seems like I am stuck with 64K (which I checked, I can indeed upload stuff fine to this prototype as long as it is below 64K), and no bootloader. SPM as far as I understand the datasheet is only available in the bootloader area, so as of now, with the existing tools, it seems like I can not create some code which would write a bootloader into its intended location.

The programmer is Pocket AVR programmer, which seems to be programmable itself using an ISP header, but that would need another programmer. One possibility of course given that I have a bunch of ATmegas and random components to build things is building my own programmer :P Still, maybe I will rather buy one later that case (or pick up a smaller AVR and DIY one, hurling a 44 pin ATmega644 at the task feels pretty much an overkill).

Anyway, it is good enough for now to do random prototyping and experimenting, but if you have any idea on how to get around this (any tricky AVR code does, just keep in mind that the Flash is erased, so bootloader area is all 0xFF, no random SPM instruction there to hijack) without shopping anything (or DIY-ing a programmer), it is welcomed! :D
CunningFellow
Posts: 1445
Joined: Mon Feb 11, 2013 8:08 am
Location: Brisbane, Australia

Re: Insane Contraption

Post by CunningFellow »

If you have a parallel port

http://www.lancos.com/prog.html

Most modern motherboards STILL do have a parallel port - it is just as a 26 pin header on the board and not broken out to a DB25 on the backplane.
User avatar
Jubatian
Posts: 1560
Joined: Thu Oct 01, 2015 9:44 pm
Location: Hungary
Contact:

Re: Insane Contraption

Post by Jubatian »

CunningFellow wrote: Sat Dec 28, 2019 9:39 pm If you have a parallel port

http://www.lancos.com/prog.html

Most modern motherboards STILL do have a parallel port - it is just as a 26 pin header on the board and not broken out to a DB25 on the backplane.
Eh, I hoped for some dirty trick making an empty ROM somehow still appear as an SPM instruction for something loaded in the low half :D Nice, but it still needs a couple of parts I don't have at the moment (nor did I dig into my PC yet to see if there was a parallel port somewhere). Anyway, will see later.

For now I managed to produce proper sync, and it is displaying stuff.
First display test
First display test
PC297212.JPG (128.26 KiB) Viewed 11108 times
Doing sync using PWM is a lot easier! It only needs properly setting up the timer doing it, with a few reprogramming from interrupt to produce the VSync waveform, but nothing timing sensitive there (it would even swallow 500 clocks interrupt disable periods just fine, thanks to the buffered OCR1A & OCR1B registers). The display would be just a cycle through the 256 colors, same palette as Uzebox (intentionally), the camera didn't manage to capture it very well (especially the green ramp), but I see here that everything looks like it should. So slowly it is ongoing, first likely focusing on bootloader related things.
User avatar
nicksen782
Posts: 714
Joined: Wed Feb 01, 2012 8:23 pm
Location: Detroit, United States
Contact:

Re: Insane Contraption

Post by nicksen782 »

This is exciting! I look forward to seeing more.
User avatar
Jubatian
Posts: 1560
Joined: Thu Oct 01, 2015 9:44 pm
Location: Hungary
Contact:

Re: Insane Contraption

Post by Jubatian »

Today I managed to complete (well, mostly) the hardware of IC32, the system with the 32K SRAM, powered it up, successfully uploaded some stuff to the ATmega.
IC32 powered up
IC32 powered up
P1127218_sm.JPG (176.47 KiB) Viewed 10995 times
IC32 Bottom
IC32 Bottom
P1127220_sm.JPG (186.25 KiB) Viewed 10995 times
Actual software is still quite some way to go, but the hardware is hopefully ready now! (I still didn't connect the Audio, I would like to look at something in that regard on the other HW first, but compared to all the rest, it is just a few wires and done)

There are two octal latches, an octal buffer, and the 32K SRAM in this system apart from the ATmega1284, still hoping that all these are OK, I made sure wirings are all fine (things which should be connected are connected, and what shouldn't isn't), at least as far as my intentions went. No smoke, which is a good sign. Will see what I can get out of it otherwise!

Sure will take quite some time, but hopefully eventually I will get there.
User avatar
Jubatian
Posts: 1560
Joined: Thu Oct 01, 2015 9:44 pm
Location: Hungary
Contact:

Re: Insane Contraption

Post by Jubatian »

The adventure continues, now also using the 32K SRAM system. I sorted out the differences, now I have code (including video mode) which is running on both. So one further step forth.
A bit of bootloader graphics
A bit of bootloader graphics
IC32_test.jpg (237.5 KiB) Viewed 10900 times
There is quite some clutter on my desk :P The metal box below the TV is an actual E-Uzebox (with an SPI RAM extension), then by the multimeter there is the simple system which I first posted, and the 32K SRAM one is displaying the graphics. The initialization code works by setting up the SRAM and then the latches / bus buffer proper for hiding them, as if it was the smaller system without these components. So this way the code runs on both, games designed for the small system would also run on the larger one.
User avatar
Jubatian
Posts: 1560
Joined: Thu Oct 01, 2015 9:44 pm
Location: Hungary
Contact:

Re: Insane Contraption

Post by Jubatian »

Just a bit of (lack of) progress report.

Seems like it is a lot more difficult to get myself developing the emulator than soldering stuff together (now that I have the equipment for it).

But I would like to innovate in this regard, if I can manage. To build a new emulator based on CUzeBox, retaining its performance, while making it reasonably possible to realize new designs. So one which can do Uzebox, this system, and likely also others, such as the Arduboy, or whatever I can find following similar principles with a couple of interesting games to go along with it. Difficult, but could be an interesting longer term goal.
User avatar
Artcfox
Posts: 1382
Joined: Thu Jun 04, 2015 5:35 pm
Contact:

Re: Insane Contraption

Post by Artcfox »

Wow, this is awesome!

With something like mode 3, would cycles be the limiting factor for the blitter, or would this allow many more 8x8 sprites on the screen than mode 3 does on a Uzebox?
User avatar
Jubatian
Posts: 1560
Joined: Thu Oct 01, 2015 9:44 pm
Location: Hungary
Contact:

Re: Insane Contraption

Post by Jubatian »

Artcfox wrote: Wed Feb 12, 2020 10:51 pm Wow, this is awesome!

With something like mode 3, would cycles be the limiting factor for the blitter, or would this allow many more 8x8 sprites on the screen than mode 3 does on a Uzebox?
Mode 3 is certainly a tricky beast on this one, but once coded, it wouldn't be anything difficult to use in terms of how its interface looks like.

I think blitting performance would end up being something like Uzebox's. Not faster, but probably not slower either, due to two things: One is better memory allocation, I would set up the kernel to have the tiles aligned out-of-the-box (it is not even possible to realize Mode 3's resolution otherwise), so the blitter would take fewer cycles than on Uzebox. The other one is the audio, which would use a technique impossible on Uzebox, essentially running a VSync mixer in HSync (the big advantage of this is that if there is enough HSync time for it, the entire audio can be done within the display area's HSync, resulting in no cycles taken for anything audio in VBlank).

Otherwise there are tricky things here, all the tiles are RAM tiles, so ideally likely you would have something like 128 background tiles and 64 sprite blitter tiles, or some distribution alike, the total on-screen tile count, depending on your memory demands otherwise, capped around 200 - 220 tiles. But since these are all RAM tiles, it is also more flexible, you can fill them up however you like (for status bar and other text like material, a split-screen with an 1bpp + attributes text mode, or even some code tile mode can be possible, the point is you get this extra tile material for those without taking away precious tiles from your main game field).

The real killer graphic modes however I think would be the 4bpp ones: either 3 cycles per pixel for square pixels or 3.5 cycles per pixels for Mode 3 like resolution is possible with the RAM chip (so the latter is like Mode 13 of Uzebox, just a lot more powerful), there are some variations which would also give you lots of HSync time for running a potentially lot more complex mixer still without impacting VBlank. With some modes, even 31KHz audio is possible.

Eh, but still a way to go until getting there. Emulator from about ground zero again, although now I really want to build one which does it all, like I mentioned above. Notably Arduboy as the other main ATmega game console.
Post Reply