QDOS Internals

Anything you never knew you wanted to know about the Sinclair QL.

User Tools

Site Tools



This trap communicates with the 8049 IPC chip on a QL. This Trap activates sound via SMSQ/E.

Call ParametersReturn Parameters
D1.LUnused.D1.BReturn parameter.
A3.LPointer to command string.A3.LPreserved.


No errors are returned by this trap.


  • All registers not shown above are not used on entry and are preserved on exit.
  • The command string to which A3.L points is shown in more detail below. It consists of a command followed by the number of parameters, codes for the parameters, the parameters themselves and a code for the returned parameter.
  • There are only three commands useful for an application programmer. These are to start or stop sound and to read the keyboard.

Command String

ByteNumber of parameters
LongCodes for each parameter
Byte1st parameter
Byte2nd parameter
ByteCode for the reply

The codes are each two bits long and indicate whether 0, 4 or 8 bits of each parameter are to be transferred. The value of the codes is:

%004 bits (least significant)
%010 bits
%108 bits
%110 bits

The codes for the parameters to be sent to the IPC are in a long word, which allows up to 16 parameters. The code for the first word is in the least significant two bits of the long word (bits 1 and 0), the code for the next parameter is in the next two bits (bits 3 and 2) and so on.

The code for the returned parameter is in the least significant two bits of the byte containing it.


Read the Keyboard
Number of parameters1
Long word of codes$00000000
ParameterKeyboard row
Reply code$02
Initiate Sound
Number of parameters8
Long word of codes$0000AAAA
Parameter 1Pitch 1
Parameter 2Pitch 2
Parameters 3 & 4Interval between steps
Parameters 5 & 6Duration
Parameter 7 MSNStep in pitch
Parameter 7 LSNWrap
Parameter 8 MSNRandomness
Parameter 8 LSNFuzziness
Reply code$01

Here MSN means Most significant Nibble and LSN means Least Significant Nibble.

Kill sound
Number of parameters0
Long word of codes$00000000
Reply code$01
qdosmsq/traps/trap_1/hdop.txt · Last modified: 2010/11/07 17:25 by george.gwilt