Thursday 23 April 2009

Did You Know

The position of the EE pointer can be monitored without resorting to any of the QPTR or WMAN easyPTR extensions. The pointer record is in the channel#0 driver.

This may be found as follows :

chbas=PEEK_L(SVbase+120)
firstdev=PEEK_L(SVbase+68):REMark device list
:
channel0_driver=PEEK_L(PEEK_L(chbas)+4)
addr=channel0_driver : REMark pointer record is in this driver
:

ptrmove=PEEK_L(addr+126) : REMark read x+y position !!
ptrkey=PEEK(addr+49)+PEEK(addr+50)

Or slightly more robustly - this one finds all window channel definition blocks #0 being the first in the list :

DEFine FuNction Find_driver
REMark LOCal chbas,chmax,cnt,chp
cnt=0
chbas=PEEK_L(SYSBASE+120)
chmax=PEEK_W(SYSBASE+114)
DIM Drivers(chmax)
FOR chp = chbas TO (chbas+chmax*4) STEP 4
IF PEEK(chp)<>255
addr = PEEK_L(chp)
driver=PEEK_L(addr+4)
Definition_length=PEEK_L(addr)
IF Definition_length=defn_block
Drivers(cnt)=driver
cnt=cnt+1
END IF
END IF
END FOR chp
:
pop=0 :cntmax=cnt-1
REPeat TestDriver
IF pop>cnt/2:EXIT TestDriver
TestDriver=Drivers(cntmax)
FOR i=0 TO cnt-1
IF Drivers(i)=TestDriver:pop=pop+1
END FOR i
cntmax=cntmax-1
END REPeat TestDriver
RETurn TestDriver
END DEFine Find_driver
:
What use is this?

No comments:

Post a Comment