Free42 with skins


Hi all,

In case you were wondering when the skin support in Free42 would ever get done (and I wouldn't blame you!, I was in a bit of a slump the last month or so), the latest version now has skin support in the Windows and X versions. Skin support for the Palm is still in the design stages but will hopefully arrive in a week or two.

The skin format is not compatible with that of Emu42, but it's pretty simple. The two main limitations at the moment are: the skin bitmaps must be in GIF format, and there's no support for keyboard mapping yet.

Regarding the first limitation: it seems to me that the existing Emu42 skins don't suffer noticeably from the conversion from 24-bit BMP to 8-bit GIF; they don't use a very large range of colors, so as long as you use some tool that does a decent job of palette optimization and color quantization, the result will look pretty good. But, if enough people complain (i.e., more than one ;-)), I'll add support for some 24-bit format -- maybe BMP, maybe PNG, maybe both.

Regarding the second limitation: keyboard mapping is the next item on my to-do list; once that's done, I'll define extensions to the skin layout format to allow users to customize the mapping.

So, what else is missing? One other thing -- true-color skins look pretty bad on 8-bit screens under Windows. The X version handles 8-bit screens pretty well, but the code that takes care of that magic still needs to be adapted and transplanted to the Windows version.

Here's hoping there aren't too many people still using less than 16 bits per pixel under Windows! (If there are, I'm sure I'll hear about it soon enough!)

The latest Free42, plus a separate package containing a few skins, including my adaptation of "ehrling42sl", is now available on the Free42 home page.

NOTE: you don't actually need to get the skins package; Free42 has two skins built in, so installation is just as simple as before: all you need is the executable and you're good to go.

- Thomas

Edited: 2 Mar 2005, 4:33 p.m.


Cool work Thomas! I like the skins feature. On my laptop the "natural" look is very cool!!!



The skins look great! I got a question. Why couldn't the skins go in the same folder as the program? Having one folder for all the files might cut down on any confusion later on. I first copied the skins into the same folder as the program and wondered why they did not show up until I read the read-me file. I then put them in the new folder and they worked. Just curious.


Why couldn't the skins go in the same folder as the program?

Good point. My main concern was secure multi-user installations: I wanted to support the scenario where Free42 is installed in one central location for multiple users (and that location may not be writeable for everyone), where any user-specific stuff (state and skins) should be in a user-specific directory (i.e., under My Documents).

But, there's something to be said for looking for skins in a central directory as well. I think I'll add that to the next version -- make it look in "My Documents\Free42" and in the directory containing the executable.

(That might be a nice idea for the X version as well, but it's a bit trickier there because Unix programs cannot reliably determine the location of the executable -- and while something like /usr/share/lib/free42 seems a reasonable choice to put a system-wide set of skins, I don't like hard-coding directory names. This will take some thought...)

- Thomas


Thomas Okken wrote:
> ... and while something like /usr/share/lib/free42 seems a
> reasonable choice to put a system-wide set of skins, I
> don't like hard-coding directory names.

Of course X has its own way of specifying user options,
using the Xresources. So you can have an Xresource that tells you where the directory is.



Hi Thomas,

Could you explain what "KML" files are?
The executable package of Emu42 for Pocket PC 2002 and 2003 v1.01 (ARM platform) without KML files

I run pocketPC, and have only been able to try a 15c emulator (pretty nice, btw). But the 42s would really be a treat!

Eric Lundgren


KML files are scripts that map keyboard functions to a bitmap for use with the emu family of emulators developed by Christoph Gießelink. Information on all of the emu emulators can be found here and for the 42s specifically can be found here. Some skins for use with emu42 and emu48 can be found here, as well as other places.
Be aware that you need rom images to run the emu emulators. The 42S rom is not publicly available, and is definitely not available at the above links. If you have access to a 42s and a 48G+ or 48GX, you can dump it yourself fairly easily.


Note that Free42 and Emu42 are completely separate projects.

Emu42 uses skin descriptions in KML format, and skin bitmaps in BMP format; it runs on Windows and Pocket PC; and it emulates the HP-42S at the hardware level, so you need a ROM image to use it; with different ROM images, it can also emulate other HP calculators that are based on the same hardware architecture. Emu42 was written by Christoph Gießelink, not by me; for more information, look at the Emu42 home page.

Free42 uses a different layout format (called, very imaginatively, "layout"), and skin bitmaps in GIF format; it runs on Windows, Unix, and PalmOS (NOT on Pocket PC (yet)). It emulates the HP-42S at the user level, so no ROM images are required (but note that it uses binary math, unlike the real HP-42S and Emu42, so it's not yet 100% compatible).

Hope that clears things up!

- Thomas



I do not regard the use of 8-bit GIF as a limitation. All skins I use for Emu42 and Emu48 are BMPs reduced to 256 colors, two even to 16 only -- but that's for fun only.

I once asked Christoph "why BMPs only" and he replied "feel free to add the code for others". My idea was to use Stefan Peichl's LXPIC with the built-in programmer interface (using 16 bytes of the BIOS data area, see to convert GIFs or JPGs to BMP on the fly. Well, I had a closer look to the source ... and - ah - you know... it would take some time just for the gain of saving some kB.

So using GIFs for Free42 is no limitation (IMHO).



My main reason for supporting only GIF for skin bitmaps initially, is that I wanted to keep the build simple. I already had a GIF encoder/decoder that I had written for another project last summer, and so that was easy to integrate into Free42.

Adding PNG and JPEG support is relatively easy, as well -- there are excellent open-source/LGPL libraries out there, not too difficult to use, and integrating them into Free42 would be no problem, either. BUT it would mean adding third-party code to my project, or making it a multi-part project, or requiring people to download the libs in question separately, etc... I didn't want to deal with those issues just yet.

BMP might actually be the best option, as I suspect it's sufficiently easy to decode that I could just write my own decoder and not worry about third-party code and licensing issues etc. (Anyone have a link to a good, comprehensive, BMP file format spec?)

- Thomas


Did you see the disclaimer agreement for LXPIC?

LxPic is copyrighted freeware. If you bundle LxPic with your
software or use the internal interface of LxPic, you have to
ask me for permission and you have to mention LxPic and the
copyright somewhere in your product.
As your Fre42 is freeware too I am quite sure Stefan will aggree to use his little 20kB gem.


PS: I'll ask him if he may point me to the specs of the graphic formats. M.

Edited: 4 Mar 2005, 3:51 a.m.


I recently recognized that the Win32 versions of Emu28/42/48 also accept RLE4 & RLE8 compressed bitmaps.




Thank you very much for that info. It will give me some work as the compression for BMPs with 16 colors only (4 bit) is quite good (110kB to 20kB for my EMU42Sbeta.bmp), for 8 bit BMPs (256 colors) the ratio is not so good.

Tnx again.....M.


The compression rate also depends very much on the used encoder. Some sizes for a good compressable bitmap:

Size uncompressed: 130KB

Size RLE4: 4KB (with Paint Shop Pro 5.0)

Size RLE4: 128 Bytes! (with Photoshop 6.0)

The difference between Paint Shop Pro and Photoshop is, that Photoshop use the Delta Escape sequence. The pity is,
that in many cases Photoshop 6.0 corrupts the bitmap when saving in RLE4 mode.

Then I replaced the black background with blue. Then Photoshop also need the 4KB from Paint Shop Pro. With palette renaming it would be possible to get still the 128 Bytes from the 1st example with black background.




Well, I never went too deep in that business, as with the tools I have at hand (Stefan Peichl's LXpic, XNview, IrfanView, PSP8) I am not sure if a pic's properties are analyzed correctly and if a format change (RLE, uncompressed, etc.) is saved according to the set options. I hope to meet Stefan next week and get some hints about formats.



Do you read the BMP files using CreateDIBSection()?

From what I understand, if you use that, you automagically support all BMP sub-variants.

I guess if that works as easily as I suspect, that would make it very easy to add BMP support to the Windows version of Free42. Of course I'd still be on my own for the Unix version, but of course there's always bmptoppm to use as sample code...

- Thomas


There are different methods for loading bitmaps under Win32. The emulators of my Win32 Emu family use CreateDIBitmap() (used in Emu48 sources / Files.c / Function LoadBitmapFile()), a little bit more high level function than CreateDIBSection().

The easiest way to load bitmaps is to use LoadImage(). But the disadvantage of this function is the difficult way to get the palette information necessary for high color bitmaps on 256 color devices.

Some words to CreateDIBSection(), I use this function in the PocketPC emulators because the Win32 function CreateDIBitmap() is missing in the PocketPC 2002 SDK. Furthermore the PocketPC only supports RGB bitmaps, the RLE decoder is missing. Because of this the limitation "Win32" in my previous post. But everything change, so the next versions of my PocketPC emulators (Emu42PPC v1.02 and Emu48PPC v1.02) will also support RLE coded bitmaps (a small addition). My current beta versions use them already especially for the VGA mode KML background bitmaps.

Finally some words to the use of different bitmap formats. RGB bitmaps are the best supported graphic format in windows. Furthermore, the base of Emu48, Win48 is now nearly 10! years old, or better Emu48 base on 10 years old source code. Until now, you can everthing do with bitmaps. So there was never a real need on PC's to have a different graphic format. Discussing bitmap sizes in the times of > 100GB hard disk space is IMHO useless. Also PocketPC devices getting more and more memory. Do we really need several faceplates for the same calculator at the same time? Do we really need more than one emulator on the Pocket PC device at the same time? --- I must confess on my Jornada 565 I have 5 emulators/simulators and on my Axim x50v I have 3 emulators installed.

But I don't agree with you that 256 colors are enough, there are many "real" Emu42 & Emu48 KML bitmaps using high or true color mode. Of course when you limit yourself onto "synthetic" KML scripts using only 16 or 256 colors a 8 bit limited graphic format will be enough.




Thanks for your insights -- I clearly have some reading to do but now I have a better idea where to look!

BTW, I agree that it would be better to support true-color skins; the reason why I decided 256 colors was good enough for now is that all the Emu42 skins that I have look excellent after conversion to 8 bpp... But of course there may well be "rainbow" skins (or "cloudy skies", etc.) that would look really bad in 256 colors. At any rate, nobody has complained *yet*. :-)

- Thomas


Mike (and Christoph),

Micro$oft have an API which might make your job easier. It is only applicable to Wintel platforms. Check out OleLoadPicture() in the docs. If you find the docs too terse, Paul DiLascia wrote a tutorial on its use.

I wrap this function in a class which I use to load both BMP and JPEG skins on my 16C simulation.

This API is apparently emulated by Wine which makes it accessible to linux platforms too. I've been told that my simulation runs under Wine.



Tnx a lot 4 that hint.




I can't find the thread again where I promised to ask Stefan Peichl about his sources of the definitions of various graphic formats. Well, about JPG he once bought a book what is rather thick, GIF are about 10 pages, PCX about 2. All may be found in the Internet. That was all he did tell me.


BTW - something waaay off topic:

Possibly Related Threads...
Thread Author Replies Views Last Post
  old wine in new skins Mike (Stgt) 11 1,030 12-05-2012, 08:00 AM
Last Post: Mike (Stgt)
  The latest version of Free42 is now a OS X Universal application..... zeno333 1 391 10-21-2012, 11:12 PM
Last Post: Matt Agajanian
  I need the last OS X "Universal" version of Free42..... zeno333 0 308 10-13-2012, 04:45 PM
Last Post: zeno333
  [WP34s] Manual, Emulator and Skins fhub 7 758 05-31-2012, 03:46 PM
Last Post: Marcus von Cube, Germany
  [OT] Free42 on the BlackBerry PlayBook Les Wright 1 378 02-25-2012, 10:56 AM
Last Post: Thomas Okken
  Free42 ? fhub 24 1,848 10-24-2011, 10:06 AM
Last Post: Egan Ford
  Re: Free42 - A Complex glitch? fhub 3 464 09-22-2011, 09:36 PM
Last Post: Thomas Okken
  Re: Free42 - A Complex glitch? Thomas Okken 23 1,863 09-18-2011, 09:10 PM
Last Post: Thomas Okken
  Free42 - A Complex glitch? Ángel Martin 23 1,870 09-14-2011, 09:39 AM
Last Post: Ángel Martin
  Thomas Okken and free42 ? sylvandb 5 611 07-11-2011, 09:18 PM
Last Post: sylvandb

Forum Jump: