PUCrunch

Talk about programming CreatiVision (except games programming). Projects of homebrew hardware are also welcome.
Post Reply
User avatar
@username@
Posts: 320
Joined: Tue Oct 22, 2013 6:59 pm
Location: Scotland

PUCrunch

Post by @username@ » Fri Nov 28, 2014 4:51 pm

While working on some CV code, I realised pretty quickly that there was a need for some form of compression to stay under the 4k boundaries.

In my search, I found PUCrunch by Pasi 'Albert' Ojala, which was open source and easy to modify for the CV.

To compress graphics, you would pass a binary image to pucrunch, pucrunch -c0 -d binary.img output.pu

Broken down, these options are -c0, do not target any machine, and -d, treat input as raw data.

The output.pu is the compressed file.

The problem for me, was that the compressed file would always waste 8 bytes of header - as the CV does not need load, execute addresses etc.

The solution is a small utility which removes them and sets the load address for the stand alone decompressor, namely, pucut

To use, it's simply pucut -l 0x0000 -i infile.pu -o outfile.cpu, where -l is the decompression address in VRAM.

The Demo code

As a means of testing this I developed a script to capture screens from State saves in MESS 0.15x. To use the attached, you should be using MESS 0.156 - which is the latest as of posting.
To create a save state in MESS, just hit SHIFT-F7 and select a slot from 1-9. Then use the STA2CV.CMD script to convert to a CV demo.
The supported machines are ColecoVision, CreatiVision, Tatung Einstein TC01, Canon V8 (MSX 1), Sega SG1000, SpectraVideo i318, Sord M5, Ti99/4A, Tomy Tutor, ZX Spectrum and ZX Spectrum SCR (http://www.zxart.ee).

The decompression code, in particular VRAM timings, were verified and tested on real hardware by Mobsie and Scouter3D.

As PUCrunch is released as LGPL, it follows that all modifications are also under LGPL, and you are free to modify and use in any project.
You do not have the required permissions to view the files attached to this post.
Last edited by @username@ on Mon Dec 01, 2014 12:51 pm, edited 1 time in total.
User avatar
Mobsie
Posts: 708
Joined: Fri Jun 13, 2008 10:38 am
Location: Weinheim, Germany

Re: PUCrunch

Post by Mobsie » Fri Nov 28, 2014 11:03 pm

Great to see it here! I also replace my packer with this one and use it first time in my Tetris Game, now also in all other projects.
Post Reply