QDOS Internals

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

User Tools

Site Tools


Table of Contents


This trap reads a pixel colour.

Call ParametersReturn Parameters
D0.B$72D0.LError return
D1.Lx,y coordinatesD1.LNew position/colour
D2.LScan key/Scan colourD2.LPreserved
A0.LWindow Channel IDA0.LPreserved


ERR_NINot mode 4 or 8
ERR_NOChannel not open
ERR_ORx,y not in window


  • All registers not shown above are not used and are preserved.
  • This trap only works with mode 4 and 8 colours.
  • This trap finds the pixel colour either at the position given in D1.L or scanned from that position.
  • The pixel position in D1.L is relative to the window whose ID is in A0.L.
  • If the most significant bit of D2 is 0, then the colour of the pixel at position D1.L is returned in D1.W.
  • If bit 31 of D2.L is 1 then the window is scanned until a pixel is found which satisfies the rules given in the scan key in bits 16 to 19 of D2.L. The meanings of the scan key are given in a table below.
  • The scan takes place in one of the four directions, up, down, left and right and finishes when a pixel is found which meets the conditions relating to the initial colour. The initial colour is either that given in D2.W or the colour of the pixel at the position given in D1.L. If no such pixel meeting the conditions is found before the scan reaches an edge of the window, the upper word of D1 is set to -1. Otherwise the upper word of D1 contains the value of x or y where the pixel is found. The value is that of x when the scan is left or right and that of y otherwise.

Scan Key

191 → scan until the same : 0 → scan until different
18/1700 → scan up : 01 → scan down : 10 → scan left : 11 → scan right
161 → Initial colour is that in D2.W : 0 → initial colour is that of the first pixel
qdosmsq/pe/rpxl.txt · Last modified: 2011/02/18 16:46 by george.gwilt