Page 2 of 5

Re: SlipKnot-like Browser for QL - Mimir

Posted: Wed Aug 13, 2025 10:35 am
by RalfR
tofro wrote: Wed Aug 13, 2025 10:32 amThere actually is no easy way to check if something is a file/device name or not.
Tere must be something in Marcel's latest TK2, as he has changed the way of using default directories if the filename start with a real device.

Re: SlipKnot-like Browser for QL - Mimir

Posted: Wed Aug 13, 2025 10:37 am
by tofro
RalfR wrote: Wed Aug 13, 2025 10:35 am
tofro wrote: Wed Aug 13, 2025 10:32 amThere actually is no easy way to check if something is a file/device name or not.
Tere must be something in Marcel's latest TK2, as he has changed the way of using default directories if the filename start with a real device.
See what QPAC2 "Files" does - It somehow seems to extract all valid directory devices from the system and displays them. It even supports network devices.

Re: SlipKnot-like Browser for QL - Mimir

Posted: Wed Aug 13, 2025 12:10 pm
by bwinkel67
tofro wrote: Wed Aug 13, 2025 10:32 am You are certainly aware that

Code: Select all

if (name [4]=='_')
is not a very good test for a device name, especially not when considering default directories, the fact that QDOS device names don't need to be three characters long, that there are network file names, and that people can be (and have been, in the past) very creative with device names (at least 'dsk' and 'sdc' come to mind as examples). QPAC2 "Files" seems to have found a mechanism to extract the names of all directory device drivers in a system and displays them in the file selector - I do, however, have no idea what dirty trick it uses to achieve that....
Yup, that's just a quick hack for now. Although if the browser doesn't recognize the specific device (i.e. currently only supporting defaults for ram, mdv, flp, and win) then it reverts to full paths and accepts whatever string you give to open files. So something like dsk1_index_htm would work just fine, it just wouldn't set the default directory withing the browser to dsk1.

It could get tripped up if the device is more than three characters and one number since if it doesn't recognize a device it appends the default device to it, so you could have things like mdv1_dsk10_index_htm if say the dsk device had more than 9 devices. But instead of being exhaustive about trying to cover every conceivable thing, I think I'd add a quoted URL where it uses it as is and never appends a device (so I just need to parse it starting with " or ').

Making it fully robust is for later. Right now I just want to create a working prototype. The more interesting part will be to actually have it grab live web pages from the internet and display them locally, so the http/https suffixes are a bit more important to parse correctly.

Re: SlipKnot-like Browser for QL - Mimir

Posted: Wed Aug 13, 2025 12:23 pm
by dilwyn
I've not been following this thread too closely, so please excuse me if this is not really what was being discussed. Wrote this in a hurry just before going out.

This is a short BASIC program used in my Q-Trans, for example, which extracts the directory device names from the system. Don't remember if it detects network device names or not:

Code: Select all

100 REMark Read directory devices lists
110 :
120 sv = 163840 : REMark QDOS default system variables address
130 REMark are we on Minerva or SBASIC?
140 v$ = VER$ : IF v$ = 'JSL1' OR v$ = 'HBA' THEN sv= VER$(-2)
150 :
160 REMark get pointer to the directory device driver linked list
170 ad_ptr = PEEK_L(sv+72)
180 :
190 ndevs%   = 0 : REMark number of device names
200 longest% = 0 : REMark length of longest name
210 REPeat pass1
220   dnl_ptr = ad_ptr+36    : REMark device name length pointer
230   lon% = PEEK_W(dnl_ptr) : REMark length of name
240   IF lon% > longest% THEN longest% = lon%
250   ndevs% = ndevs%+1             : REMark count number of device names
260   ad_ptr = PEEK_L(ad_ptr)       : REMark next linked list entry
270   IF ad_ptr = 0 THEN EXIT pass1 : REMark end of list
280 END REPeat pass1
290 :
300 REMark dimension array to hold device names
310 DIM devs$(ndevs%-1,longest%)
320 :
330 ad_ptr = PEEK_L(sv+72) : REMark restart list
340 ndevs% = 0
350 REPeat pass2
360   dnl_ptr = ad_ptr+36
370   lon = PEEK_W(dnl_ptr)
380   REMark add device driver name to list in devs$() array
390   FOR i = dnl_ptr+2 TO dnl_ptr+lon+1
400     devs$(ndevs%) = devs$(ndevs%) & CHR$(PEEK(i))
410   END FOR i
420   ndevs% = ndevs%+1
430   ad_ptr = PEEK_L(ad_ptr)
440   IF ad_ptr = 0 THEN EXIT pass2
450 END REPeat pass2
460 :
470 CLS : PRINT ndevs%;' devices:'\devs$! : REMark show it worked!
There are some routines in the BASIC and File Handling pages on my site which show how to slice up a filename into drive/directory/filename/extension, e.g. https://dilwyn.theqlforum.com/files/dirnames.zip and https://dilwyn.theqlforum.com/basic/direxists.zip

Obviously, directory handling depends on there being a level 2 filing system.

If you study the assembler source in https://dilwyn.theqlforum.com/tk/display2.zip it shows how to detect the presence of Level 2, etc.

If doing things from BASIC or compiled BASIC, you could use Norman's DJToolkit https://dilwyn.theqlforum.com/tk/djtk.zip

Re: SlipKnot-like Browser for QL - Mimir

Posted: Wed Aug 13, 2025 12:28 pm
by bwinkel67
dilwyn wrote: Wed Aug 13, 2025 12:23 pm I've not been following this thread too closely, so please excuse me if this is not really what was being discussed. Wrote this in a hurry just before going out.

This is a short BASIC program used in my Q-Trans, for example, which extracts the directory device names from the system. Don't remember if it detects network device names or not:

Code: Select all

100 REMark Read directory devices lists
110 :
120 sv = 163840 : REMark QDOS default system variables address
130 REMark are we on Minerva or SBASIC?
140 v$ = VER$ : IF v$ = 'JSL1' OR v$ = 'HBA' THEN sv= VER$(-2)
150 :
160 REMark get pointer to the directory device driver linked list
170 ad_ptr = PEEK_L(sv+72)
180 :
190 ndevs%   = 0 : REMark number of device names
200 longest% = 0 : REMark length of longest name
210 REPeat pass1
220   dnl_ptr = ad_ptr+36    : REMark device name length pointer
230   lon% = PEEK_W(dnl_ptr) : REMark length of name
240   IF lon% > longest% THEN longest% = lon%
250   ndevs% = ndevs%+1             : REMark count number of device names
260   ad_ptr = PEEK_L(ad_ptr)       : REMark next linked list entry
270   IF ad_ptr = 0 THEN EXIT pass1 : REMark end of list
280 END REPeat pass1
290 :
300 REMark dimension array to hold device names
310 DIM devs$(ndevs%-1,longest%)
320 :
330 ad_ptr = PEEK_L(sv+72) : REMark restart list
340 ndevs% = 0
350 REPeat pass2
360   dnl_ptr = ad_ptr+36
370   lon = PEEK_W(dnl_ptr)
380   REMark add device driver name to list in devs$() array
390   FOR i = dnl_ptr+2 TO dnl_ptr+lon+1
400     devs$(ndevs%) = devs$(ndevs%) & CHR$(PEEK(i))
410   END FOR i
420   ndevs% = ndevs%+1
430   ad_ptr = PEEK_L(ad_ptr)
440   IF ad_ptr = 0 THEN EXIT pass2
450 END REPeat pass2
460 :
470 CLS : PRINT ndevs%;' devices:'\devs$! : REMark show it worked!
There are some routines in the BASIC and File Handling pages on my site which show how to slice up a filename into drive/directory/filename/extension, e.g. https://dilwyn.theqlforum.com/files/dirnames.zip and https://dilwyn.theqlforum.com/basic/direxists.zip

Obviously, directory handling depends on there being a level 2 filing system.

If you study the assembler source in https://dilwyn.theqlforum.com/tk/display2.zip it shows how to detect the presence of Level 2, etc.

If doing things from BASIC or compiled BASIC, you could use Norman's DJToolkit https://dilwyn.theqlforum.com/tk/djtk.zip
Oh, that's pretty cool code. I could probably create something in C that follows this to do the same thing. It really depends on how big my final implementation is. I'd like to keep exec size small since I need room to cache incoming webpages for my browser to then parse.

Re: SlipKnot-like Browser for QL - Mimir

Posted: Wed Aug 13, 2025 7:10 pm
by M68008
RalfR wrote: Wed Aug 13, 2025 10:35 am 7000 4E75
is it concerning that I can disassemble this without looking it up? :D

Re: SlipKnot-like Browser for QL - Mimir

Posted: Wed Aug 13, 2025 7:27 pm
by RalfR
:D :D :D A good way to get out.

Re: SlipKnot-like Browser for QL - Mimir

Posted: Wed Aug 13, 2025 8:11 pm
by bwinkel67
I didn't have to look it up either...I asked Google AI :-)

Re: SlipKnot-like Browser for QL - Mimir

Posted: Wed Aug 13, 2025 9:47 pm
by dilwyn
Do you also recognise HEX$(12648430,24) ? :geek:

Re: SlipKnot-like Browser for QL - Mimir

Posted: Wed Aug 13, 2025 11:39 pm
by M68008
dilwyn wrote: Wed Aug 13, 2025 9:47 pm Do you also recognise HEX$(12648430,24) ? :geek:
No, had to try it :)
Reminds me of the 0xbaadf00d value sometimes used in old (32 bit!) projects for uninitialized pointers.