Author Archives: Marcel

Toolkit II – The sequel

Update v2.32 (2018-03-04)

The basic problem is that TK2 already didn’t quite fit into 16KB during its last official versions and it became a lot worse once I packed in all the new features available in SMSQ/E. To make it fit again I had to remove something and I chose the network driver code, last having used it myself 20 years ago to prank my dad. Some people weren’t happy with that, which was to be expected, but there is one point which did stick: the network code cannot even be loaded afterwards as the timing needs to be precise and this is (almost) only possible when the code runs from ROM.

Some time later I found a way to free a few more bytes in the ROM and thought about what I could do with them and eventually came up with the idea of splitting the network code: I re-added just the timing critical hardware access routines to the ROM so that the network driver can be loaded later and still work. I think this is a fairly good compromise that would make most people happy.

Martyn Hill kindly beta tested the version for me and later inquired if one could have a full network stack in the ROM and remove some other stuff instead. I was hesitant because for me TK2 is foremost a SuperBasic toolkit and most of the remaining stuff is the basic commands. There is only one part that is even a bit bigger than the network code: the “ED” SuperBasic editor. It includes many improvement over the original TK2 code and thus grew considerably in size. Removing it also has the advantage that you wouldn’t put it into actual SuperBasic code, so the toolkit stays 100% compatible. For me personally “ED” is about a million times more useful than the network code but if you absolutely have to bootstrap a QL without any file systems over the network this is the way to go. Also I do provide a standalone binary for loading later.

Choose your poison

So here are all the different flavours:

TK2 v2.32 ROM version (with separate NET_bin file for full network support)
TK2 v2.32 network ROM version (with separate ED_bin file for the SuperBasic editor)
TK2 v2.32 RESPR version (this version includes everything though the network code will not work unless burned into a ROM or executed from zero waitstate RAM)

Update v2.31 (2017-03-27)

Fixed a bug in CDEC$

Original post for v2.30

As any QL owner will know, the Toolkit 2 from QJUMP/Tony Tebby was THE toolkit without which a QL was almost unusable, arguably its contents should have been in the ROM from the start. And I always thought it was quite a shame that such an important toolkit hasn’t been updated in two decades. This got me thinking that most TK2 source files at one time were incorporated into SMSQ/E and that with a little bit of work it should be possible to re-create something resembling TK2 from them again. Turns out I was right, but also completely wrong in how “little” that work is. But still, too many hours later, I can now present to you a brand new Toolkit II release I arbitrarily labeled version 2.30.

This is now based on the latest SMSQ/E source code, with new SMSQ/E features left intact if it was feasible (e.g. the “LOAD” command now automatically tries to append a “_bas” extension to the filename) plus many commands that have been added in the last 20 years (EXF, EX_M, FET, FEW, FEX, FEX_M, HGET, HPUT, JOBID, LGET, LPUT, UPUT, WGET and WPUT).

Unfortunately there are also parts of the source code that were completely missing, like the extended MDV driver. In this case I completely reverse engineered it from an existing ROM binary in a way that you can’t tell anymore that this isn’t the original source code.

The old network server code is actually still supplied with the SMSQ/E source code even though it’s not actually used there. The problem with that is that it’s just too big to fit into the ROM anymore and it probably doesn’t make much sense to run it from RAM because of the different timing. Therefore I didn’t include it. The ALARM and CLOCK commands had a similar fate.

The ALTKEY code, too, is included in SMSQ/E without seeing any usage. I didn’t want to include it at first, because with the Hotkey System II it’s very much obsolete. But when tinkering with my QL system the HK2 is often not loaded yet and it drives me crazy when ALT+ENTER doesn’t work to recall the last line. So it went back in. Problem then was that the result was about 200 or 300 bytes too big, so I removed the ALTKEY code but left the ALT+ENTER code in. The result was still 20 bytes too big, but with a few tweaks I now actually have 8 bytes left 🙂

So without further ado, here it is:

TK2 v2.31 ROM version
TK2 v2.31 RESPR version (full ALTKEY support because space doesn’t matter here)
TK2 v2.31 source code (needs rest of SMSQ/E source code to compile)

Recap: latest code, including extended MDV driver (not necessary and therefore disabled on Minerva), all new commands, no ALTKEY, but ALT+ENTER support.

Enjoy!

QMake released for free

This has been a long time in the making, actually I wanted to do this many years ago, but the day is finally here: QMake is here for everybody to enjoy. QMake is a “make” tool which basically takes a linker file as input, collects all files that make up the executable and assembles any where the source is newer than the relocatable file. You can also add dependencies like “reassemble win1_fu_asm if win1_keys_bar changes”. I’ve used this tool for well over 20 years to build SMSQ/E and all my other projects and consider it to be pretty much essential.

I’ve created a new page for it, check it out here.

German Minerva-ROM

Since changing from MGG to the Minerva ROM a few decades ago I’ve never used an unmodified Minerva ROM, I always used one where the German keyboard tables were patched into the binary somehow (by Jochen Hassler I think). This changed when I installed the QL-SD interface in my QL as it comes with a vanilla ROM where the German keyboard support had to be loaded every time, which I found fairly annoying. But now that the Minerva sources are publicly available changing this is fairly easy: take the Minerva source code plus the source of the German language pack, stir a bit and voila, a new ROM. The only thing missing is the printer translation table as that pushes the ROM beyond the 48KB limit.
As probably not everybody can do such a thing I provide the resulting binaries here, in case somebody finds it useful:

Minerva 1G98
Minerva 1G98 with QL-SD driver (2018-01-22: updated ROM with Wolfgang Lenerz’ QLWA driver)

As for an EEPROM programmer I ordered one at my currently favourite Chinese store Ali-Express (being so cheap that I spent a truck-load of money there this year…). In this case I got myself the somewhat more expensive TL866A for just 60€, which also includes a lot of adapters:

TL866A universal chip programmer

But the smaller brother TL866 can be had for less than 35€ including shipping. This is an amazing piece of hardware for the price (usually it’s also available on eBay for slightly more) that finally lets me retire Jochen Hassler’s excellent but nowadays slightly outdated QL Eprommer II board:

Jochen Hassler’s Eprommer II board

Of mice and men (but mostly mice)

Mice for the QL always have been kind of a problem. In the age that predated USB by two decades there was simply not the one mouse standard to rule them all. Every system did pretty much its own thing and getting a mouse that actually worked wasn’t that easy to begin with. In fact I have never even owned a mouse for the QL that worked right out of the box, every mouse had its electronics ripped out and replaced by something else to work with my trusty SuperQBoard clone. This posed a problem for me as I have recently resurrected my trusty QL but apparently the mice were thrown away at some point or other. Jochen Hassler kindly gifted me one of his old mice, but it was brown with age, the ergonomics is questionable and I really didn’t remember what a pain the ball-based mice were to use compared to their optical brethren.

This lead to the idea of implementing a converter, like taking a cheap Arduino Pro Mini to interface a modern USB mouse to the old SuperQBoard port. Fortunately before starting such a project I had a look at what’s already there and found the “New MKIV Amiga/Atari USB mouse adapter” for about 16€ plus postage. Atari mice are generally the type used for the QL, too, so I just bought it. The first tests a few days later weren’t that encouraging, nothing worked at all. So I had a look at the schematics of the SuperQBoard and found out that although electronically it’s Atari/QIMI compatible, it used a completely different pin layout!

Long story short, this is the pin mapping I came up with

SuperQBoard QIMI/Atari Signal
1 9 Right button
2 6 Left button
3 1 XB
4 3 YA
5 7 +5V
6 4 YB
7 2 XA
8 5 n/c or middle button
9 8 GND

After building a suitable adapter cable the optical mouse began to light up, indicating the power is there, and the buttons worked, too, indicating a working mouse protocol on the USB side (or rather PS/2 side really, the adapter only works with mice that can speak the PS/2 protocol over the USB connector) but the pointer only moved very erratically. So after some hair pulling (as if I still had any) I went back to the schematics and saw that apparently unlike QIMI my SuperQBoard clone only had pull-up resistors on the mouse button lines and not on the lines responsible for X/Y movement! So I decided to integrate them quick&dirty style into the adapter cable:

Quick&dirty integration of pull-up resistors…

… but in the end, who can tell

And what can I say, it worked so smoothly it was a pure joy to use.

So, lessons learned:

  • The adapter might be used together with a QIMI interface right out of the box
  • SuperQBoards used a pinout different from QIMI
  • SuperQBoards might be lacking the necessary pull-up resistors
  • Hardware tinkering is still fun

New QPC2, DISA and more

Every year I take the birthday of my daughter as an incentive to get stuff out of the door.

So this year I present to you:

QPC2 v4.05

This is mostly a bugfix release. It includes the latest SMSQ/E 3.28. One option was added that instead of a fixed resolution it can use the maximum resolution of the current monitor. Select “Max” as a resolution to do this.

Get it from the Downloads page.

… but there is more

The disclaimer for the following software: you may not sell the software and they come with no support whatsoever.

DISA

My old friend Jochen Hassler was over for dinner a few days ago and I asked him if I may release his software. He said yes, so here I present to you DISA, a pretty revolutionary disassembler at its time. V3.04 was the last official release done by Jochen in 1999. I adapted the source code for high colour in 2003, but this release 3.05 has never left my hard drive until today. So here they are:

DISA 3.04
DISA 3.05
DISA examples

As I got most of my software directly from the authors I usually lack the original manuals, as it is in this case. If somebody could provide that to me I can add it to the distribution.

Update: Thanks to Albin Hessler (who provided the Word document for v2) and David Westbury (who provided a scan of v3) I can now provide the latest manual here: DISA3E.pdf

ATR device

I didn’t have the time to sort through the source and binaries I have of the ATR device, but I know for example that Dilwyn has a few ROMs or binaries and those can now be used freely, too.

QMenu

And finally I had a chat with another old friend of mine, Jochen Merz, and he agreed to officially release QMenu for everybody to use. So here is my latest menu_rext file:

Menu_rext 7.66

Update: apparently I’m not up to date in regards to QMenu, but 7.66 is the latest version I had the source code to. I will do a follow up when I know more about the later versions.

Was this a great birthday or what? 🙂

Have fun, Marcel

HomeMatic: Gehäuse/Verstärker für HM-OU-CM-PCB

English: HomeMatic home automation articles will be in German as this system is mainly used there.

Den Anfang meiner (zumindest geplanten) HomeMatic Serie macht ein bereits älterer Aufschrieb über den Bau eines Gehäuses für den HM-OU-CM-PCB. Als Ausgangs-Basis dient ein bei Pollin erhältliche “Tragbarer Aktiv-Lautsprecher PULSE”. Anders als bei Pollin üblich ist das Ding auch ein Jahr nach meinem Bastel-Projekt noch erhältlich, mittlerweile sogar schon für wahnsinnige 3,95€!

Der eingebaute Verstärker liefert mit 3 Watt viel Bumms, läuft allerdings mit 5V während der HM-OU-CM-PCB mindestens 8V fordert. Der “richtige” Weg wäre es wohl 8V außen anzuschließen und dann intern auf 5V zu senken, wie es der HM ohnehin macht. Bedeutet aber größere Arbeiten an der Verstärker-Platine wenn man die vorhanden Buchsen des Verstärkers weiter benutzen will und Wegfall der USB Versorgung. Ich hab mich dafür entschieden den Step-Down Wandler auf dem HM zu umgehen und die Platine direkt mit 5V an Pin MP11 zu speisen. Auf eigene Gefahr, man verliert damit den Verpolschutz! Dies stellt dann auch erhöhte Anforderungen an das verwendete Netzteil, die 5V müssen sehr sauber reinkommen sonst gibt’s jede Menge Stör-Geräusche! Ein altes iPhone Netzteil bzw mittlerweile sogar ein billiger 5€ ALDI Zwischenstecker mit USB-Ladeausgängen verrichten hier bei mir aber sehr gute Dienste.

Den internen Verstärker des HM sollte man wie in der Anleitung beschrieben abklemmen und den Ausgang dann mit der Klinken-Buchse am Verstärker verlöten. Dann noch Masse und die 5V rüber und fertig ist die Kiste. Für den physischen Halt habe ich den Batterie-Halter etwas aufgedremelt so dass man die Platine hineinschieben kann. Hält ganz gut und man kommt nach dem Öffnen des Deckels bequem an die SD-Karte.

Den Rest erklären hoffentlich die Bilder.

QMovie v2.00

In my last post I lied that regarding the QMovie player “I’m done here”. OK, to my defense, even I didn’t know that I’m not done yet. So today I present to you QMovie v2.0:

The details and downloads are on a dedicated QMovie page.

QMovie SMSQ/E movie player

This has been superseded by QMovie v2

QMovie is a quick&dirty full colour movie player including sound for QPC. I really didn’t have the time to write this, but sometimes an idea latches itself into my head and I can’t let go until I have done something about it. So the target for this was “be done quickly” and not “be done perfectly”.

You can download it here (135MB). Just start the QPC2.exe and it should run. The movie frames are time synchronised to the audio. No double buffering (neither for the screen nor for the play buffer) nor any other fancy stuff is performed as the performance was already good enough.

Clip: The Iron Maidens recorded at the LKA Stuttgart by me. 10 fps, 20kHz mono

Creation of this video:

ffmpeg -i “IMG_7696.MOV” -r 10 -s 480×270 Frame_%04d.png
ffmpeg -i “IMG_7696.MOV” -f u8 -ar 20k -ac 1 sound.raw

Convert all Frame_%04d.png into _spr files using PNGConv. Settings: “binary”, “.” separator, “solid mask”, “no compression”.

The resulting Frame_xxx.spr and sound.raw files are combined using a quick Perl script called qmovie-concat.pl.

The QMV Format is an interleaved data format with one second of audio, followed by one second (10 frames) of video in Sprite format (fixed size, must not be RLE compressed). No meta data is saved (remember, “quick” was the motto here), all things like resolution and frame rate are hard coded into the qmovie_exe file.

Feel free to improve it, I’m done here 😉

Wrapping stdcall functions in Node FFI

A colleague of mine needed help wrapping some C DLLs for NodeJS. He’s using the Node FFI API for the wrapping, which unfortunately is a little light on documentation. The problem was that by default Node FFI wraps cdecl functions and there is no mention of stdcall anywhere. In fact the consensus on the net seems to be that it’s not possible at all. Reading the sources proved more fruitful and so I document the way here for future generations to find:

The standard way of initializing a FFI wrapper using the array in the constructor

actually takes an additional parameter with the calling convention, but in stdcall the function names are often decorated with an additional “@x” which denotes the bytes the function parameters need on the stack. Problem is, blah@x is not a valid identifier and in the array the Javascript function pointer always has the same name as the function in the DLL. The solution is to manually wrap the functions, which I actually prefer anyway as the function pointer doesn’t end in a struct but can be used directly afterwards:

The resulting wrapper is called using “AdsPortOpen()” and it accesses the function with the decorated name “_AdsPortOpen@0”. The easiest way to get the decorated name is using the dumpbin utility from Visual Studio with the “/exports” parameter:

C:\Windows\System32>dumpbin /exports gdi32.dll
Microsoft (R) COFF/PE Dumper Version 10.00.40219.01
Copyright (C) Microsoft Corporation.  All rights reserved.


Dump of file gdi32.dll

File Type: DLL

  Section contains the following exports for GDI32.dll

    00000000 characteristics
    573C8294 time date stamp Wed May 18 16:56:20 2016
        0.00 version
        1000 ordinal base
         727 number of functions
         715 number of names

    ordinal hint RVA      name

       1012    0 00043F40 AbortDoc = _AbortDoc@4
       1013    1 00045806 AbortPath = _AbortPath@4
       1014    2 0003BA5C AddFontMemResourceEx = _AddFontMemResourceEx@16
[...]

HTTPS everywhere

Out of the blue my hosting provider finally offers one SSL certificate for free to use with my site. I’ve been using StartSSL certificates for my home servers for a long time now, but on the shared hosting servers I couldn’t just install my certificates and I felt the prices for regular ones are a pure rip-off.

In any case, kilgus.net finally got HTTPS support and I have adapted the site accordingly. I had to change all download links for this to work, so if I have missed a broken link or in case of any other problems, give me a shout.