
Flashing Cursor Position
- belg4rion67
- Trump Card
- Posts: 194
- Joined: Sun Feb 20, 2011 6:15 pm
- Location: Milan - Italy
Re: Flashing Cursor Position
As an interesting idea, in addition to drawing around the cursor, if the name of the job owning the cursor can be found, then this job name could be displayed on the screen somewhere, perhaps using some combination of CSIZE 3,1 OVER -1, FLASHING or something along those lines. I have been looking at the Do It Youself Toolkit Series, and apparently, it appears that the job name can be found directly, without any need for searching for it. I have written a function, Q_NAME$, that returns the required name, and this is based on Simon Goodwin’s CHANS code. This has been slightly modified so that it can cope with the pointer environment and QPC2. See what you think.
Michael
Code: Select all
1000 REMark Q_NAME$ By Michael Bulford (EmmBee) 25 November 2014
1010 :
1020 REMark Uses CHANNEL_ID, PEEK$ from Turbo Toolkit
1030 REMark Uses DIY TOOLKIT FNs SYSBASE, CHBASE from DIY VolQ_CHANLIST_CODE
1040 REMark See DIY VolQ_QBASEBAS_DOC
1050 REMark Adapted from DIY VolQ_QBASE_CHLIST_BAS ...
1060 REMark ... modified to cope with the pointer environment and QPC2
1070 :
1080 REMark RETurns the name of the job owning the keyboard queue
1090 :
1100 REMark To try this out ... Compile and run, then Ctrl_C a few times ...
1110 :
1120 CSIZE 3,1 : REPeat loop : AT 1,1 : PRINT "---->" ! Q_NAME$ ! "<----"
1130 :
1140 DEFine FuNction Q_NAME$
1150 LOCal id, num, sv_chbas, adr, window_offset, base, address
1160 OPEN #15,'scr_2x2a510x10'
1170 id = CHANNEL_ID(#15)
1180 num = id - INT(id/65536)*65536
1190 sv_chbas = PEEK_L(SYSBASE+120)
1200 adr = sv_chbas + 4*num
1210 window_offset = CHBASE(#15) - PEEK_L(adr)
1220 CLOSE #15
1230 base = PEEK_L(SYSBASE+76)-104
1240 address = base - window_offset
1250 IF INT(address/2)*2 <> address : RETurn ""
1260 RETurn JOB_NAME$(PEEK_W(address+10),PEEK_W(address+8))
1270 END DEFine Q_NAME$
1280 :
1290 DEFine FuNction JOB_NAME$(num,tag)
1300 LOCal sv_chbas, jb_ptr, jb_start
1310 IF num = 0 THEN
1320 RETurn "SuperBASIC"
1330 ELSE
1340 sv_chbas = PEEK_L(SYSBASE+104)
1350 jb_ptr = sv_chbas+(num*4)
1360 REMark Is this job number in use ?
1370 IF PEEK(jb_ptr) <> 255 THEN
1380 jb_start = PEEK_L(jb_ptr)
1390 REMark Is the tag correct ?
1400 IF tag = PEEK_W(jb_start+16) THEN
1410 REMark Is that an Ident Word (19195 = $4AFB) ?
1420 IF PEEK_W(jb_start+110) = 19195 THEN
1430 RETurn PEEK$(jb_start+114,PEEK_W(jb_start+112))
1440 ELSE
1450 RETurn "No Name"
1460 END IF
1470 END IF
1480 END IF
1490 RETurn "** Not Valid"
1500 END IF
1510 END DEFine JOB_NAME$
Re: Flashing Cursor Position
Looks interesting - I'll see what I can do with this. Thanks Michael.
--
All things QL - https://dilwyn.theqlforum.com
All things QL - https://dilwyn.theqlforum.com
-
- QL Wafer Drive
- Posts: 1066
- Joined: Sat Oct 25, 2014 9:53 am
Re: Flashing Cursor Position
martyn_hill wrote:MaQnifier ???

--
All things QL - https://dilwyn.theqlforum.com
All things QL - https://dilwyn.theqlforum.com
Re: Flashing Cursor Position
Can anyone explain how to work backwards from the queue and screen driver definition block to find the channel ID? I'm not sure if I'm doing something wrong, it just doesn't seem to work as described in QL technical documentation in that the values I get are not what I expect, almost as though there is something else below the offset of the start ($18) of the definition block. Hopefully, it's just me having a complete brainstorm.
--
All things QL - https://dilwyn.theqlforum.com
All things QL - https://dilwyn.theqlforum.com
Re: Flashing Cursor Position
Hi Dilwyn,dilwyn wrote:Can anyone explain how to work backwards from the queue and screen driver definition block to find the channel ID? I'm not sure if I'm doing something wrong, it just doesn't seem to work as described in QL technical documentation in that the values I get are not what I expect, almost as though there is something else below the offset of the start ($18) of the definition block. Hopefully, it's just me having a complete brainstorm.
I thought I had explained this in my Q_NAME$ function. You end up with the channel ID contained in the function JOB_NAME$(num,tag).
The offset of $18 contains the windows start position, as a word, from the left hand side of the screen. The actual base of the definition block is of course at $00. In my Q_NAME$ function, this calculates a value into the variable "window_offset", which would typically get a value of 48, but could be otherwise. On QDOS systems without the pointer environment that value would be zero. The function then calculates the variable "address" to be base - window_offset, and from there, the channel ID is obtained from the words at address+10 and address+8
Have you tried my program, yet? I perhaps should have said that you should start off my compiled program with ... EXEP ram1_test_task, U. The U parameter creates unlocked windows and will ensure that all of the output will end up visible on the screen. Before compiling, you will have to ensure you have lrespr ed the Turbo TK and the DIY TK. And before trying my program, you would need to load several jobs and all requesting input, say at different positions on the screen. Then, as you type Ctrl and "C" the names of the jobs should appear near the top of the screen.
Michael
Re: Flashing Cursor Position
Sounds like it works the way I thought it ought to. I must have made a mistake somewhere (I'm at work at the moment so can't check) when I adapted it for the MaQnifer... will have a more detailed look at it soon. Is there a specific reason why #15 was used (which I think is highest Turbo channel)?
--
All things QL - https://dilwyn.theqlforum.com
All things QL - https://dilwyn.theqlforum.com
Re: Flashing Cursor Position
Any channel number would suffice, of course. Since #15 may already be in use, it might be better to use a variable, eg. c = FOPEN("SCR_").
I like the name - MaQnifier - very good name.
Michael
I like the name - MaQnifier - very good name.
Michael
Re: Flashing Cursor Position
Umm, now I feel a bit silly. Having spent hours on this last tonight and tonight, it was all down to a silly and stupid typing mistake.
Because my system has an extension called ADDRESS I renamed the variable name 'address' to adr2. Guess what, one instance ended up as adr which is also used in the program.
Amazing how long I managed to look at the typo and still miss a one character difference.
Oh dear... after EmmBee's hard work
Because my system has an extension called ADDRESS I renamed the variable name 'address' to adr2. Guess what, one instance ended up as adr which is also used in the program.
Amazing how long I managed to look at the typo and still miss a one character difference.
Oh dear... after EmmBee's hard work

--
All things QL - https://dilwyn.theqlforum.com
All things QL - https://dilwyn.theqlforum.com