Pixel Polizei

ppolizei-msx ppolizei-plus4 ppolizei

“Systeemin vartija se poliisin on työ / Poliisi hippejä pampulla lyö”

News

What?

Pixel Polizei is a tool for the retro/scene/retroscene artist. It lets you automatically check whether an image conforms to the color limits of a particular oldschool platform and save the result in certain native formats. The underlying idea is that you can use whatever paint program you happen to prefer for creating the images and observe – almost real-time – if you’ve made a mistake somewhere. One more fundamental bit is that the tool is multiplatform unlike many others.

Pixel Polizei is not a paint program or a generic image format converter, even though the aim is to implement at least the most typical file types for the supported platforms. Neither is it meant to be used as a converter for random family photos. You can use it for that purpose too, but the end results won’t be as good as with dedicated tools. For converting various old formats to modern images check out the Recoil project.

Usage

There’s not much to it: load an image, check whether it’s ok and save it in another format. In the case of errors you can either fix them in your favorite paint program and retry or force the colors to comply. When a piccy is loaded it is automatically converted to the native colorset without dithering, so do that kind of magic elsewhere if needed. Furthermore, remove any borders that you might have or the image will be scaled incorrectly.

If the loaded png or gif is not of the native resolution, it will be down- or upscaled as necessary, which might or might not produce the desired result. Therefore it’s generally better to do the scaling elsewhere. C-64 multicolor and CPC mode 0 have very flat pixels, so drawing a 320×200 image will probably be easier; every second column will just be discarded.

Checking and forcing can be done automatically. In that case Polizei works according to its name and constantly polls whether you’ve saved the file anew. If there is an updated version, it’s loaded and checked automatically. This way you can quickly find and fix color clashes – keep the Polizei window always visible on another screen or in some corner.

The zoom toggle lets you look at the image closer, and a grid is available for you as well to better see the character block locations. If the platform has a selectable border color, just click on the color selector.

Check out the “palettes” directory to find the exact colors used on each platform. Drawing with those colors ensures that there’s no complications when importing the image.

Keyboard shortcuts

In some modes you need to press shift when clicking the color selector to set the background color.

Settings

Some settings can be controlled through prefs.txt which should reside in the same directory as the program itself. The following options can be used:

Supported Platforms

Next follows a list of the supported machines, graphics modes and file formats, coupled with platform-specific quirks (if any). New file formats and machines will most likely be added later.

Amstrad CPC

The CPC is an exceptional 8-bit as you don’t need to care about color clashes: any pixel can be of any color (16 colors in mode 0 and 4 in mode 1). It also has a palette of 27 jolly happy colors to choose from. I found myself wondering what the heck they were thinking when designing the bitmap layout like that.

To display the image on an emulator or a real machine, you need to get the file to a floppy – most likely a DSK image. There’s ManageDSK for Windows and iDSK for the rest of us. iDSK probably won’t compile out of the box, but just keep adding #include <stdio.h> to the offending source files until it does. After that you should be able to do this:

iDSK mydisk.dsk -n
iDSK mydisk.dsk -i piccy.bin -t 1 -e 6000 -c 6000

And run the binary from BASIC with:

run"piccy

ColecoVision

This console is so close to MSX (same CPU and VDP) that it was easy to add trivial support for it.

COL is essentially a module dump that you can feed to any emulator or flash cart. I’m not sure if there’s much use for this particular converter, but at least you can show pics on your old hardware – a nostalgic birthday gift for a Coleco fan maybe?

Commodore 64

This old workhorse has been explored over and over again throughout the years. From a graphician’s perspective there are dozens of curious hacks that let you display more colors and pixels than what the standard modes allow. Use the well-known Pepto palette to ensure a faithful conversion.

There is automated logic which tries to choose the multicolor common “background” color wisely, but as it doesn’t always work out, you can also select the color yourself (shift-click or rmb) and turn fixed bg on.

The resulting PRG files can be run directly by using VICE, 1541 Ultimate or SD2IEC. For some situations you may want to create a floppy image, which can be done with for example c1541 that comes with VICE:

c1541 -format mypic,0 d64 mypic.d64 -attach mypic.d64 -write piccy.prg piccy

Commodore Plus/4

It wasn’t a biggie to add support for the Plus/4 after getting the C-64 side working. A lot of colors available for you (121 shades) and practically square pixels in hires. Not that different otherwise to the C-64, except in multicolor you have 2 global colors and only 2 free colors per block.

There is automated logic which tries to choose the common “background” colors for multicolor pics, but you can also select the color yourself (shift-click and rmb) and turn fixed bg on.

Running the resulting PRG files is pretty much the same as on the C-64. See above.

MSX

A plain MSX1 can do 256×192 pixels with 15 – not 16 – washed-out colors. PAL machines produce a really flat “widescreen” image, whereas the NTSC ones are more or less 4:3. MSX2 computers could display a lot more colors at better resolutions, but at least as of now they’re not supported, as they’re not that special from a conversion point of view.

The com files are normal MSX-DOS programs that you can copy to a floppy or an image for running them on a real machine or an emulator. The good old wrdsk will do the trick:

wrdsk myfloppy.dsk msxdos.sys command.com piccy.com

SC2 files are essentially screen memory dumps that can be directly loaded from BASIC like this:

bload"piccy.sc2",s

Oric

Le Oric’s graphiques are completely different to almost any other machine. It’s a bit like teletext in some sense: you can either show pixels or change the paper/ink color. To make it even more complicated, any 6×1 block can also be shown in inverted colors and the bottom of the screen (3 character rows) is hardwired to text mode. Read this.

The tap files can be run from basic with a CLOAD”” or CLOAD”PICCY” depending on the emulator. Use the tap2wav utility to turn the emulator file into audio that can be played back to the cassette port on a real machine. I’ll look into disk files later, but no promises yet.

HRS (HIR) files are simple screen memory dumps saved from BASIC. They can be displayed by switching to HIRES and then simply cloading the file as above. To save one on a real machine, try this:

CSAVE"PICCY.HRS",A#A000,E#BF3F

Panasonic JR-200

Not many have ever even seen this failed Panasonic venture. See here for some technical discussion. From an artist’s standpoint it’s not unlike the Spectrum, except there’s no brightness bit and you can only have 320 different 8×8 character blocks. In addition, there’s blocky 64×48 pseudographics without attribute limits – both “modes” can be mixed freely.

Panasonic emulators are scarce, but Virtual Panasonic JR-200 will get you started at least. CJR files can be loaded to the emulator or converted to wavs for playing back to the cassette port. See here again. If your goal is to convert Spectrum images to the JR-200, check you-know-where for an interactive tool aimed specifically for that. The images can be displayed as follows:

mload:a=usr($1000)

Sharp MZ-700

The MZ-700 is a slightly revamped consumer version of Sharp’s old microcomputer series. 64k memory, color graphics and… wait, there’s only 80×50 pseudographics with a 40×25 color grid.

When approximating pixel graphics with characters you may gain a slight advantage by including the absurd 2nd character set in the conversion. Beware, however, that the output won’t work correctly on Japanese machines that used the 2nd set for something useful instead of various 2×2 character faces and Pacmen.

Pretty much any emulator supports MZF files, which you can load from the monitor by typing L. For a real machine take a look at mzf2wav.

Sharp MZ-800

A lot more capable than its predecessor, the MZ-800 can display 320×200 pixels with four colors or 640×200 with two. Rather exceptionally the graphics are planar and thus pixel placement is free. Add another 16k of VRAM and you get 320x200x16 and 640x200x4.

Like with the MZ-700, emulators support MZF loading. In addition to the monitor method you can also choose option ‘C’ from the main menu. mzf2wav is again your friend when dealing with real machines.

ZX Spectrum

The British miracle can display 256×192 pixels with 15 different colors, but in a block of 8×8 you can only have two different colors, which makes the machine a true giant when it comes to color clashes. Furthermore, you can’t have bright and dark colors in the same block.

An scr file (also known as SCREEN$) is a simple memory dump of the Spectrum screen and supported by various tools and emulators. A tap file can be loaded by emulators or from a card reader such as divIDE. You can also convert .taps to audio using tap2wav and then play them back to a real Spectrum through the cassette port. LOAD”” is all you have to type.

Download

The latest stable binary is available here: ppolizei.zip. If you’re after the latest features and bugs, check out svn://kameli.net/marq/ppolizei. Because the program is written in Processing you – unfortunately – need to install Java 7 or newer to run it. Mac users should visit System PreferencesSecurity & Privacy if you see something like “blah blah is damaged and can’t be opened”. Allow “any” software to run to correct the problem.

If all else fails, download Processing 2.x (3.x won’t work at least as of yet) and run from source: copy the “ppolizei” folder from “src” to your sketchbook and open ppolizei (.pde if you’re using the file selector). Press the play button and enjoy.

It shouldn’t be too tricky to add new file formats or even totally new machines. Contributions are welcome, but let’s stick to a 4-char tab to keep the source uniform. The code is released under the liberal WTFPL license.

Credits