Thanks to Marcel's comments, I have amended the RW_GD2 function to work on Minerva, standard smsq/e for Gold Card (v3.07 tested) and high colour smsq/e (v3.03 for Gold Card and latest QPC2 version tested).

The code appears below for comment or criticism. Hopefully I have interpreted this all correctly. The only real change from Dilwyn's Display_cde is earmaked "NEW CODE". Though Dilwyn, you need to check the parameters passed to IOP.SLNK in your display_cde version as I have not looked myself.

Basically, the routine needs the pointer interface - it will then look for the identifier PTR2 at offset $128 within the pointer device linkeage block. If this is not present, then it is an old version of the Pointer Interface, which definitely means that GD2 drivers are not present.

If the GD2 drivers are present, then the program looks at the five bytes at offset $141 within the pointer device linkeage block (which is what I believe Marcel was referring to when he used the term CON driver linkeage block).
These bytes are described in the smsq/e sources (keys_con) helpfully as "modes relating to resolutions". No idea what this means, but my guess is that the five bytes represent the modes which DISP_COLOUR x tries to set up.


On current QPC2 systems, the 5 bytes are:
$00
$00
$10
$20
$00

DISP_COLOUR 0, DISP_COLOUR 1 and DISP_COLOUR 5 all set the MODE to mode 0 (standard QL mode 4). I guess DISP_COLOUR 1 is set aside for 16 colour mode (which has never been implemented) and DISP_COLOUR 5 for natural colour mode??
DISP_COLOUR 2 gives us mode $10 (256 colour mode 16)
DISP_COLOUR 3 gives us mode $20 (65536 colour mode 32)


These values are all set to zero in the standard smsq/e though I have no idea if this is true for all versions of smsq/e - Marcel??

At least, this appears to provide a good test for whether the current system supports high colour mode...

If I am barking up completely the wrong tree, I am sure someone will shout.


RW_GD2
* Routine to check for availability of GD2 colour drivers
moveq #0,d0 Presume default is #0
cmpa.l a3,a5
beq.s no_GD2CH No parameter
lea.l 1*8(a3),a0
cmpa.l a0,a5 One parameters?
bne bad_param
btst #7,1(a3,a6.l) First one preceded by hash?
beq bad_param
movea.w $0112,a2 SB.GTINT - Fetch the integer params
jsr (a2)
bne bad_exit
moveq #0,d0
move.w 0(a6,a1.l),d0 Get BASIC channel number
no_GD2CH
bsr GetChannelID Convert channel number to channel ID
tst.l d0
bne what_chan


* First of all check for pointer interface
          moveq     #$70,d0              IOP.PINF
          moveq     #-1,d3
          trap      #3
          tst.l     d0                   Is the pointer interface present?
          bne       no_ptr               Return -19 (no pointer interface)

moveq #$6F,d0 IOP.SLNK to get pointer device definition block
moveq #0,d1 Position in linkage to set
moveq #0,d2 Number of bytes to set (0)
moveq #-1,d3 Timeout
suba.l a1,a1 Pointer to data to set
trap #3
tst.l d0
bne no_ptr


* NEW CODE ADDED **
move.l $128(a1),d1 Grab pt_ident
moveq #0,d5
cmpi.l #'PTR2',d1 Check for GD2 drivers
bne no_GD2
move.b $143(a1),d1 Look at the modes for each DISP_COLOUR
cmpi.b #$10,d1 Does DISP_COLOUR 2 set Mode 16?
beq.s GD2_Found Yes, so high colour drivers available
move.b $144(a1),d1
cmpi.b #$20,d1 Does DISP_COLOUR 3 set Mode 32?
beq.s GD2_Found Yes, so high colour drivers available
cmpi.b #$21,d1 Does DISP_COLOUR 3 set Mode 33?
beq.s GD2_Found Yes, so high colour drivers available
bra.s no_GD2 Nothing set up to handle non-standard QL modes
* END OF NEW CODE **


GD2_Found
          lea.l     Hardware_Flag,a4
          moveq     #1,d1
          move.w    #0,(a4)              Store GD2 drivers present flag
          bra       float_ret

no_GD2
lea.l Hardware_Flag,a4
move.w #1,(a4)
lea.l PointerDef_addr,a4
move.l a1,(a4) Store pointer definition block address
moveq #0,d1
bra float_ret


no_ptr
          moveq     #-19,d1
          bra       float_ret



--
Rich Mellor
RWAP Services
26 Oak Road, Shelfield, Walsall, West Midlands WS4 1RQ

http://www.rwapservices.co.uk/

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

Reply via email to