Re: Q68 direct sector access

Anything QL Software or Programming Related.
User avatar
pjw
QL Wafer Drive
Posts: 1320
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway
Contact:

Re: Q68 direct sector access

Post by pjw »

Moved to Software by order of Peter ;)
martyn_hill wrote: Sat Apr 20, 2024 6:03 pm Hi Per

I don't have the answer, but wondered if you were trying to do what I wanted-to recently, i.e. to change the embedded Volume name of a WIN Container file - you'd expect to be able to set the Volume name at point of FORMAT, but you seem only able to set the volume size in the format string and the Volume name always ends up as simply WIN1 or whatever the container was mounted at at the time of format.

Is that what you were trying to do, as well?
Hi Martyn,

No, that one was sorted long ago. The hack below works on QPC2 and SMSQmulator and possibly elsewhere. (Use at own risk!)

But Q68 is different in that its virtual container files dont appear to be accessible in the same way. On the Atari, which uses real hard disks, sector #0 led you to the partition table, which you had to navigate in order to get to the QLWA disk partition, but youd end up with a routine similar to this one.

So here goes:

Code: Select all

100 REMark WIN hard disk rename
110 REMark pjwitte 1998, 2o2o
120 REMark V0.05, Set length word debugged
130 :
140 ch = 1: namel% = 20: esc$ = CHR$(27)
150 CLS#ch
160 PRINT#ch; '      Rename harddisk'
170 PRINT#ch; 'Note: No other application'
180 PRINT#ch; 'may access the hard disk'
190 PRINT#ch; 'during this call'
200 PRINT#ch\\ 'Enter drive number <1..8> ';
210 CURSEN#ch
220 REPeat
230  n$ = INKEY$(#ch; -1)
240  IF n$ INSTR '12345678' & esc$: EXIT
250  BEEP 2000, 200
260 END REPeat
270 CURDIS#ch: BEEP 2000, 2
280 IF n$ = esc$: PRINT#ch; '^ESC': STOP
290 PRINT#ch; n$
300 w = FOPEN("win" & n$ & '_*D2d')
310 IF w = -9 THEN
320  PRINT#ch; 'HD is in use. Close all open'
330  PRINT#ch; 'channels on this drive and'
340  PRINT#ch; 'then try again.': STOP
350  ELSE : IF w < 0: ERT w
360 END IF
370 GET#w\ 0; sec$
380 IF sec$(1 TO 4) <> 'QLWA' THEN
390  PRINT#ch; 'Unsupported hard disk format:' !n$: CLOSE#w: STOP
400 END IF
410 n$ = sec$(7 TO 6 + namel%)
420 PRINT#ch\\ 'Current name is "'; n$; '"'
430 PRINT#ch\\'Enter new name (max'! namel%! 'chars)'
440 INPUT#ch;, n$: n% = LEN(n$)
450 IF n% = 0: PRINT#ch; 'Aborted': CLOSE#w: STOP
460 IF n% < namel% THEN
470  n$ = n$ & FILL$(' ', namel% - n%)
480 ELSE
490  IF n% > namel%: n$ = n$(1 TO namel%): n% = namel%
500 END IF
510 sec$ = 'QLWA' & CHR$(0) & CHR$(n%) & n$ & sec$(27 TO 512)
520 PRINT#ch; 'Writing...'
530 PUT#w\ 0; sec$: CLOSE#w
540 PRINT#ch\\ 'Done': BEEP 2000, 2
550 :


Per
dont be happy. worry
- ?
User avatar
pjw
QL Wafer Drive
Posts: 1320
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway
Contact:

Re: Q68 direct sector access

Post by pjw »

Peter wrote: Sat Apr 20, 2024 7:13 pm
pjw wrote: Sat Apr 20, 2024 5:13 pm Im trying to change the internal Qdos name of a QL hard drive.
Use a hex editor to change the string at offset 6 in the image file.
pjw wrote: Sat Apr 20, 2024 5:13 pm How does one do direct sector access on a Q68 QLWA virtual disk?
It is probably not implemented yet. The best would be to ask Wolfgang on ql-users.
Not a hardware issue by the way. ;)
Thanks, but its getting to the image file that is the problem. I'll check with Wolfgang when he's back.


Per
dont be happy. worry
- ?
User avatar
Peter
Font of All Knowledge
Posts: 2024
Joined: Sat Jan 22, 2011 8:47 am

Re: Q68 direct sector access

Post by Peter »

pjw wrote: Sat Apr 20, 2024 7:38 pm Thanks, but its getting to the image file that is the problem. I'll check with Wolfgang when he's back.
I'm all for QL side programming, but if all you want is to change is the volume name of a few images, why not use the hex editor on a PC?


Derek_Stewart
Font of All Knowledge
Posts: 3984
Joined: Mon Dec 20, 2010 11:40 am
Location: Sunny Runcorn, Cheshire, UK

Re: Q68 direct sector access

Post by Derek_Stewart »

Hi,

I use QLWarz ( nowi who wrote that...) to renamd the QWA volume name. I have to use QPC2 to perform the renaming.

But the best way is to use the method that Martyn uses, and put the correct name of QWA when creating it, which can be done in the Q68.

I copy files to the Q68 with Martin Head's excellent Q68 Ethernet QL Net driver, from QPC2 or SMSQmulator.


Regards,

Derek
User avatar
pjw
QL Wafer Drive
Posts: 1320
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway
Contact:

Re: Q68 direct sector access

Post by pjw »

Peter wrote: Sat Apr 20, 2024 8:08 pm
pjw wrote: Sat Apr 20, 2024 7:38 pm Thanks, but its getting to the image file that is the problem. I'll check with Wolfgang when he's back.
I'm all for QL side programming, but if all you want is to change is the volume name of a few images, why not use the hex editor on a PC?
I dont see why Id want to do that considering the routine I just posted (above) which does exactly that. It is safe and just does the job. For users who may not know where to poke, it requires no specialist knowledge.


Per
dont be happy. worry
- ?
User avatar
pjw
QL Wafer Drive
Posts: 1320
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway
Contact:

Re: Q68 direct sector access

Post by pjw »

Hi Derek, that seems rather OTT. Use my routine instead of recreating the WIN drive any time you wish to alter the name.

As you say, on Q68 you get to specify a sensible name when you format the disk, however, there is no (easy) way to change that name once its set - for now.


Per
dont be happy. worry
- ?
Derek_Stewart
Font of All Knowledge
Posts: 3984
Joined: Mon Dec 20, 2010 11:40 am
Location: Sunny Runcorn, Cheshire, UK

Re: Q68 direct sector access

Post by Derek_Stewart »

pjw wrote: Sun Apr 21, 2024 7:13 pm Hi Derek, that seems rather OTT. Use my routine instead of recreating the WIN drive any time you wish to alter the name.

As you say, on Q68 you get to specify a sensible name when you format the disk, however, there is no (easy) way to change that name once its set - for now.
Just trying to use existing solutions to the problems.

I do appreciate all your efforts in trying to find a solution.


Regards,

Derek
User avatar
Peter
Font of All Knowledge
Posts: 2024
Joined: Sat Jan 22, 2011 8:47 am

Re: Q68 direct sector access

Post by Peter »

pjw wrote: Sun Apr 21, 2024 7:12 pm I dont see why Id want to do that considering the routine I just posted (above) which does exactly that. It is safe and just does the job. For users who may not know where to poke, it requires no specialist knowledge.
I wasn't aware that you want a smooth solution for others, not just rename one or two filesystems yourself.
It would be relatively easy for me to provide a low level C Program which bypasses the OS and does the renaming.
But if direct sector access could be added to SMSQ/E, that's obviously the better approach.
Let's see what Wolfgang thinks about it.


User avatar
pjw
QL Wafer Drive
Posts: 1320
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway
Contact:

Re: Q68 direct sector access

Post by pjw »

I think there IS direct sector access, its just that I dont understand the partition table (if thats what Im seeing). It may just be FAT32 and available somewhere on the Internet - or even in the SMSQ/Q68 source code. But I have neither the time nor inclination to hack it if there is an easier option.

It is for Qwirc, my WIN manager software, which is sorely in need of an update as the underlying platform workings it relies on to do its work have changed over the past 20+ years. Qwirc2 is compatible with QPC2 and SMSQmulator (both on Windows and Linux hosts), and apart from the renaming issue in question, also Q68.


Per
dont be happy. worry
- ?
User avatar
Artificer
Over Heated PSU
Posts: 129
Joined: Fri Nov 24, 2017 8:43 am

Re: Q68 direct sector access

Post by Artificer »

Hi,

There is direct sector access in smsq/e ie winX_*d2d if I remember correctly. The QXLwin file format has the win file name embedded 6 bytes from the start. Wolfgang Lenerz WinEd program allows access and editing of the hard drive.

Cheers


Post Reply