Hisoft Basic bug: INKEY$ in tight loop

The place for codemasters or beginners to talk about programming any language for the Spectrum.
Post Reply
equinox
Dynamite Dan
Posts: 1052
Joined: Mon Oct 08, 2018 1:57 am
Location: SE England

Hisoft Basic bug: INKEY$ in tight loop

Post by equinox »

Out of interest: I think I've found a previously unknown bug in the Hisoft Basic compiler. If you write a tight "key debouncing" loop with INKEY$, waiting until no key is pressed, like this:

Code: Select all

1 REM: OPEN #
5 IF LEN INKEY$>0 THEN GO TO 5
(the REM is just a standard directive telling Hisoft where the code begins)
...and then you run your compiled code, and hold down a key for a fairly long time, it eventually crashes back to BASIC with "4 Out of memory".

I don't know whether the error report is actually relevant (why would GOTO be consuming more memory over time?), and it might also be possible to trigger a similar bug without INKEY$. This is just the case that I discovered.

The bug is present in the original 48k Hisoft Basic, and in Zeljko Juric's 1996 fixed version; but not in the 128k version.
equinox
Dynamite Dan
Posts: 1052
Joined: Mon Oct 08, 2018 1:57 am
Location: SE England

Re: Hisoft Basic bug: INKEY$ in tight loop

Post by equinox »

Heh, I've just spotted a funny glitch in the 128 version too.

Use the context menu (Edit key) to Exit from BASIC and then enter Calculator mode. You can still use the True+Inv Video key shortcut to compile your BASIC and do other things — and it seems to work — but the output text hangs around on screen and you can type over it.
Post Reply