Some years back QLToday wrote about testing the machine you are using by
reading the sys_vars (PEEK (sv +167)).
The test on Q-emulator returns zero, as the standard QL, so this could be
used to assume there is no Level2 device.
This number is held in the 5 lowest bits, I believe 14, 15, 18 to 23, 25
to 27 & 29 are still free.
To check for level 2 drivers present or not, use the IOF.XINF trap #3 with D0=hex4F (QDOS Reference Guide, section 15, page13).

Norman Dunbar uses this call for the "LEVEL2" function in the djtoolkit, source of which is included with the package on toolkits page of my website showing how to use the test for Level2 drivers.

Testing for QemuLator: This is a text which Daniele sent me some time back. As it was a while back, probably best to check with Daniele if this is still valid, or has been extended or whatever.

==========================================================
Use Trap #1 with D0.L = -26 to get some emulator info. The trap is
designed to be usable by other emulators, but I don't think anybody
else is using it, so it works only with Q-emuLator.
In systems where the trap is not implemented you will get an error
in D0.L (bad parameter, I think), in Q-emuLator you get 0 in D0.L.
There are three commands, identified by the value in D1:
========================================================
D1.L = 0
Currently returns 0 in both D1.L and D2.L. I don't remember anymore
for sure what the intended meaning was :(. I think D1 was the
version of the D0=-26 TRAP implemented by the emulator (for example
in the future there might be a version 1 TRAP that returns extra info,
or allows more values in D1.L), and D2 is probably reserved for future
use. Just ignore D1 and D2 and look only at D0 (0 = trap is supported,
error = it is not), or directly call with D1.L = 1 or 2.
=========================================================
D1.L = 1
Returns in D1.L info about the host system:
D1.L = $00aabbcc, where
     aa = host OS
        0 = Windows
        3 = Mac OS
     bb = host OS variant (for example, if aa was Unix, bb would
        identify whether it is BSD, Linux, etc.). Currently always zero.
     cc = emulator ID
        1 = Q-emuLator
Returns in D2.L the version of the emulator:

D2.L = $xxyyzzww, where
   xx = major version number
   yy = middle version number
   zz = minor version number
  ww was supposed to be a global incremental number, but a 0-255
  range is probably too little, so you can just ignore it.

D3.L = type of build
  0 = alpha
  1 = beta
  2 = release

For example,
 D2.L = $02010005 and D3.L = 2 means version 2.1
 D2.L = $01030218 and D3.L = 1 means version 1.3.2b

======================================================================


D1.L = 2
A1.L = pointer to memory buffer
D2.L = length of buffer

Fills the buffer with a short QL string identifying the emulator
(for example "Q-emuLator 2.2").
Returns a buffer full error in D0 if the buffer is smaller than the
string (and the buffer content is not valid in this case).

======================================================================
Daniele added at the time:
Hope this helps. Most of this is untested so you may find some bugs.
The only piece of software currently using one of these traps is the
Q-emuLator's mouse driver (it refuses to install and prints an error
if it's not running in Q-emuLator).

_______________________________________________
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm

Reply via email to