Forum Announcement
23/02/2018 - The Online Chat isn't working via the normal link.
You can connect via IRC, or using another web client - https://kiwiirc.com/client/chat.qlforum.co.uk/#qlforum

win_extender_bas

Discussion and advice about emulating the QL on other machines.
simon629
Chuggy Microdrive
Posts: 62
Joined: Sat Apr 20, 2013 3:26 pm

win_extender_bas

Postby simon629 » Wed Jan 04, 2017 7:52 pm

Hi can you help me when I use the extender to make my WIN File Bigger I get an Error Message some think about Copy in use can any one help me OK thank you Simon Foster


RWAP
RWAP Master
Posts: 2293
Joined: Sun Nov 28, 2010 4:51 pm
Location: Stone, United Kingdom
Contact:

Re: win_extender_bas

Postby RWAP » Thu Jan 05, 2017 10:59 am

This is the program written by Per in : http://www.qlforum.co.uk/viewtopic.php? ... 767#p15586

The full listing I provided to Simon is:

Code: Select all

1 drive% = 8         : REMark Drive number 1..8
2 name$ = 'BigQLE'  : REMark New name
3 driveSize% = 200   : REMark Size of new Drive in MB
4 existingDrive% = 1 : REMark Drive number to be extended
100 WIN_DRIVE drive%, "C:\New.win"
110 WIN_FORMAT drive%, 1
120 FORMAT 'win'&drive%&'_'&driveSize%
130 :
140 REMark QLone a drive - Use at own risk!
150 :
160 source$ = 'win'&existingDrive%&'_': dir$ = ''
170 target$ = 'win'&drive%&'_'
180 :
190 CLS
200 PRINT 'Press <ENTER> to clone'! source$; dir$! 'to'! target$!: INPUT r$
210 IF r$ <> '': STOP
220 :
230 dcount = 0: fcount = 0: ttaken = DATE
240 ERT QLone(source$, dir$, target$)
250 PRINT\ 'Done!'
260 PRINT dcount! 'directories created'\ fcount! 'files copied'
270 PRINT 'Time taken'! (DATE - ttaken);'s'
275 RenameWin drive%, name$
280 :
290 DEFine FuNction QLone(sdv$, dir$, tdv$)
300 LOCal ch, lp, fl, ps, er, dt, ty%, nm$
310 REMark GLObal counts
320 REMark Scan source directory tree and
330 REMark Create correponding structure under target
340 REMark Backup files, maintaining date
350 REMark V0.00, pjwitte, January 30th 2015
360 :
370 ch = FOP_DIR(sdv$ & dir$): IF ch < 0: RETurn ch
380 :
390 ps = 0: er = 0: fl = FLEN(#ch)
400 REPeat lp
410  IF ps >= fl: EXIT lp
420  GET#ch\ ps + 14; nm$: l% = LEN(nm$)
430  IF l% > 0 THEN
440   BGET#ch\ ps + 5, ty%
450   IF ty% = 255 THEN
460    PRINT 'Creating: >'! tdv$; nm$
470    er = FMAKE_DIR(tdv$ & nm$): IF er = -8: er = 0
480    IF er < 0: RETurn er
490    dcount = dcount + 1
500    er = QLone(sdv$, nm$, tdv$)
510   ELSE
520    PRINT 'Copying:'! sdv$; nm$! '..'
530    LGET#ch\ ps + 52; dt
540    COPY_O sdv$ & nm$ TO tdv$ & nm$
550    SET_FUPDT \tdv$ & nm$, dt
560    fcount = fcount + 1
570   END IF
580  END IF
590  IF er < 0: EXIT lp
600  ps = ps + 64
610 END REPeat lp
620 CLOSE#ch
630 RETurn er
640 END DEFine QLone
650 :
660 REMark Rename QLWA Hard drive
670 REMark V0.00, pjw
680 REMark No channels must be open on hard drive!
690 :
700 DEFine PROCedure RenameWin(drive%,name$)
720 maxnl% = 10        : REMark MAX name length = 10
730 :
740 name$ = name$ & FILL$(' ', maxnl%)
750 cw = FOPEN("win" & drive% & '_*D2d'): ERT cw
760 GET#cw\ 0; sec$
770 IF sec$(1 TO 4) <> 'QLWA': CLOSE#cw: ERT -12
780 :
790 sec$ = sec$(1 TO 6) & name$(1 TO maxnl%) & sec$(17 TO LEN(sec$))
800 PUT#cw\ 0; sec$
810 CLOSE#cw
815 END DEFine
820 :


The error code is Line 540:1 Is In Use

This seems to occur when copying the QDT.log file which I assume is open in QDT.

Simon could try right click on the green QDT icon and then click on Quit before running the program (I assume that will release the log file).

However, suggestions are invited as to the best way to overcome this error on other possible files which are left open :)


User avatar
pjw
Gold Card
Posts: 296
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway

Re: win_extender_bas

Postby pjw » Thu Jan 05, 2017 12:18 pm

RWAP wrote:The error code is Line 540:1 Is In Use

This seems to occur when copying the QDT.log file which I assume is open in QDT.

Simon could try right click on the green QDT icon and then click on Quit before running the program (I assume that will release the log file).

However, suggestions are invited as to the best way to overcome this error on other possible files which are left open :)

This was but a hack, but Im preparing a more comprehensive solution right now, and this issue is warned against in the documentation. (I mentioned to Jim (of QDT fame), that the issue was problematic. The same for a certain flp device driver that needs a channel to remain open at all times.) Anyway, the solution is to exit QDT (or avoid booting it) for this operation. If you have QPAC2 loaded you could EXEP 'Channels' to se if any other files are open and close those channels. After the operation you can then exit and re-start QPC2.


Per
Assumptions should only be a first resort when the cost of being wrong is less than the trouble of finding out the facts! - pjw, 2016
User avatar
pjw
Gold Card
Posts: 296
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway

Re: win_extender_bas

Postby pjw » Thu Jan 05, 2017 12:43 pm

pjw wrote:Im preparing a more comprehensive solution right now

Would anyone be prepared to help by testing it? (QPC2 only at present)


Per
Assumptions should only be a first resort when the cost of being wrong is less than the trouble of finding out the facts! - pjw, 2016
Ralf R.

Re: win_extender_bas

Postby Ralf R. » Thu Jan 05, 2017 6:49 pm

Does COPY_O preserve the file version? When Arvid Borretzen once has written his harddisk copy program, I suggested to take SG's GETHEAD an SETHEAD extensions to patch the file header after copying to preserve all extra Information. That was a good workaround.

I am not sure about FUPDT increasing the version...?


User avatar
pjw
Gold Card
Posts: 296
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway

Re: win_extender_bas

Postby pjw » Thu Jan 05, 2017 9:02 pm

Ralf R. wrote:Does COPY_O preserve the file version? When Arvid Borretzen once has written his harddisk copy program, I suggested to take SG's GETHEAD an SETHEAD extensions to patch the file header after copying to preserve all extra Information. That was a good workaround.

I am not sure about FUPDT increasing the version...?

Why dont you try it and see?


Per
Assumptions should only be a first resort when the cost of being wrong is less than the trouble of finding out the facts! - pjw, 2016
User avatar
janbredenbeek
Trump Card
Posts: 221
Joined: Wed Jan 21, 2015 4:54 pm
Location: Hilversum, The Netherlands

Re: win_extender_bas

Postby janbredenbeek » Thu Jan 05, 2017 11:43 pm

pjw wrote:
Ralf R. wrote:Does COPY_O preserve the file version? When Arvid Borretzen once has written his harddisk copy program, I suggested to take SG's GETHEAD an SETHEAD extensions to patch the file header after copying to preserve all extra Information. That was a good workaround.

I am not sure about FUPDT increasing the version...?

Why dont you try it and see?

The QDOS/SMS traps to set the version and update date were introduced in V2 drivers, after TK2 was written. I'm not sure about SG's utilities, but if they use the original FS.HEADS call they won't set the update date since this call only sets the first 14 bytes of the header (the update date will be set to the current time on TT's MDV and FLP drivers though).
I've never seen the various flavours of the TK2 COPY command preserving the original update date, even not on a Gold Card which supports V2 drivers.
The version number is increased every time you modify a file by writing to it. AFAIK setting the update date does not change the version count.

Jan.


Ralf R.

Re: win_extender_bas

Postby Ralf R. » Fri Jan 06, 2017 6:15 am

janbredenbeek wrote:The QDOS/SMS traps to set the version and update date were introduced in V2 drivers, after TK2 was written. I'm not sure about SG's utilities, but if they use the original FS.HEADS call they won't set the update date since this call only sets the first 14 bytes of the header (the update date will be set to the current time on TT's MDV and FLP drivers though).
I've never seen the various flavours of the TK2 COPY command preserving the original update date, even not on a Gold Card which supports V2 drivers.
The version number is increased every time you modify a file by writing to it. AFAIK setting the update date does not change the version count.


Using GETHEAD an SETHEAD does preserve all extra information. One exception is, if you copy an old pre-V2 file with version "0", it is set to version *1*. But that is a minor thing.


User avatar
pjw
Gold Card
Posts: 296
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway

Re: win_extender_bas

Postby pjw » Fri Jan 06, 2017 10:38 am

Ralf R. wrote:Using GETHEAD an SETHEAD does preserve all extra information. One exception is, if you copy an old pre-V2 file with version "0", it is set to version *1*. But that is a minor thing.

I dont have GET/SETHEAD, but you might want to see if it keeps incrementing the version number beyond 1, as SMSQ/E's HPUT/GET does. SET_FUPDT and SET_FBKDT dont affect the version number.

Cursory tests under SMSQ/E V3.27 show that COPY(-O) maintains the: file length, file type, *file access key and *file type-dependent info (* provided file type <> 0 ! (only 0..3 tested)), name, and version number. The update date is set to current and the backup date is lost (set to zero).

I dont know about the "reserved word" at $3A. Anyone?

As Ive never seen any program that uses the backup date (though there was a DP program, cant remember which, that supposedly used it) my Qlone routine (somewhere above) omitted to maintain it. As it may be important in some settings, let me therefore rectify that by dumping an updated version in my next post. Id rather only use keywords available in SMSQ/E, and not any external toolkits for this routine.

I suppose that to be allowed to allude to "c lone", my routine should also maintain the access and file type-dependent information if it exists, even when the file type is zero? It seems an awful fiddle merely to pander to an undocumented poke. Anyone using this could simply mark the file as special by using one of the remaining 252 unused file types. Does anyone have an opinion on this?


Per
Assumptions should only be a first resort when the cost of being wrong is less than the trouble of finding out the facts! - pjw, 2016
User avatar
pjw
Gold Card
Posts: 296
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway

Re: win_extender_bas

Postby pjw » Fri Jan 06, 2017 10:53 am

Code: Select all

10 REMark QLone a drive
11 :
12 source$ = 'ram1_': dir$ = ''
13 target$ = 'ram2_'
14 :
15 CLS
16 PRINT 'Press <ENTER> to clone'! source$; dir$! 'to'! target$!: INPUT r$
17 IF r$ <> '': STOP
18 :
19 dcount = 0: fcount = 0: ttaken = DATE
20 ERT QLone(source$, dir$, target$)
21 PRINT\ 'Done!'
22 PRINT dcount! 'directories created'\ fcount! 'files copied'
23 PRINT 'Time taken'! (DATE - ttaken);'s'
24 :
25 DEFine FuNction QLone(sdv$, dir$, tdv$)
26 LOCal ch, lp, fl, ps, er, dt, bd, ty%, nm$
27 REMark GLObal counts
28 REMark Scan source directory tree and
29 REMark Create correponding structure under target
30 REMark Backup files, maintaining date
31 REMark V0.00, pjwitte, January 30th 2015
32 REMark V0.01, pjw, January 6th 2017, Sans FUPDT(), maintain FBKDT
33 :
34 ch = FOP_DIR(sdv$ & dir$): IF ch < 0: RETurn ch
35 :
36 ps = 0: er = 0: fl = FLEN(#ch)
37 REPeat lp
38  IF ps >= fl: EXIT lp
39  GET#ch\ ps + 14; nm$: l% = LEN(nm$)
40  IF l% > 0 THEN
41   BGET#ch\ ps + 5, ty%
42   IF ty% = 255 THEN
43    PRINT 'Creating: >'! tdv$; nm$
44    er = FMAKE_DIR(tdv$ & nm$): IF er = -8: er = 0
45    IF er < 0: RETurn er
46    dcount = dcount + 1
47    er = QLone(sdv$, nm$, tdv$)
48   ELSE
49    PRINT 'Copying:'! sdv$; nm$! '..'
50    LGET#ch\ ps + 52; dt
51    LGET#ch\ ps + 60; bd
52    COPY_O sdv$ & nm$ TO tdv$ & nm$
53    SET_FUPDT \tdv$ & nm$, dt
54    IF bd: SET_FBKDT \tdv$ & nm$, bd
55    fcount = fcount + 1
56   END IF
57  END IF
58  IF er < 0: EXIT lp
59  ps = ps + 64
60 END REPeat lp
61 CLOSE#ch
62 RETurn er
63 END DEFine QLone
64 :


Per
Assumptions should only be a first resort when the cost of being wrong is less than the trouble of finding out the facts! - pjw, 2016

Return to “QL Emulation”

Who is online

Users browsing this forum: No registered users and 1 guest