MGx ROM bug + Q-emuLator + 100% speed

Discussion and advice about emulating the QL on other machines.
Post Reply
User avatar
programandala.net
Chuggy Microdrive
Posts: 74
Joined: Mon Dec 13, 2010 12:41 pm
Location: Spain
Contact:

MGx ROM bug + Q-emuLator + 100% speed

Post by programandala.net »

The strange problem I suffered with Q-emuLator and Display Toolkit has been solved; well, the problem is not solved but at least it has an explanation.

Daniele Terdina, the Q-emulator's author, has confirmed the problem is the combination of a bug in the MGx ROMs with a patch in the emulator:
you hit a MGx ROM bug, and one of the subtle differences between full speed
and QL speed in Q-emuLator.

When parsing keywords, the MGx code uses a MOVE.W where it should have used
MOVE.B (for the keyword length). This bug was not present in earlier ROMs.

You may get the same problem on a real QL with MGx ROM, it would be
interesting to check. Or at times programs may only work if a OS call
returns a particular value in a register that the interface says is
undefined, so they work on the original QL, but when running with different
device drivers (on a real QL, for example a disk interface or RAM disk, or
the emulator's devices) the traps may return different values for the
undefined parameters and the program hits the bug (in this case, I can
usually change the emulator to simulate the original QL behavior by having
my driver returning the same value).

Do you remember that on a real QL loading SuperBASIC programs is really
slow, even (much) slower than reading the microdrives? For long programs it
takes forever, while the microdrive led goes on and off at intervals
(incidentally, this slowness might be what dictated a detail of the design
of the microdrive driver implementation). That's because the code that
parses the keywords is quite unoptimal (I think Minerva fixed that and has a
much faster implementation). When I started writing Q-emuLator in 1991, it
was running on a Mac with a processor not much more powerful than the QL's,
so I added a couple of 'ROM optimizations' to speedup things like loading
SuperBASIC programs. That optimization is still there and it has a fix for
the MGx bug, but the optimization is disabled when running at 'QL Speed',
this explains the behavior you see.
In order to make my program (page in Spanish; see the program description in English, in this forum) work with the free version of Q-emuLator I published an alternative QLPAK that uses the JS ROM insted the MGE ROM. Q-emuLator manages the keyboard, so the Spanish letters can be typed without any problem.


Marcos Cruz (programandala.net)
Post Reply