Andrew Pennell discusses multiple copies of files in his book Master Your ZX Microdrive (Chapter 2 page 24) - the pertinent bit being:jpnz wrote: ↑Sun Oct 01, 2023 5:17 am You can speed up the seek times by having more than one copy on the cart and this technique applies to other files as well
The system variable 0x5cef (COPIES) supports this, e.g to save two copies of run
Saying that, having the two copies of run interspersed on the cartridge would be even better...Code: Select all
POKE 23791,2: SAVE *"m";1;"run" LINE 0
One caveat of using COPIES is that erasing a file does exactly that - it's only the copy that turns up first
And that got me thinking, if you don't know how many copies of a file there are (and a CAT won't tell you) how do you get rid of them?...If you make x copies of a file, to completely delete it you must do the ERASE command x times
Well, the ERASE routine - documented here - leaves a breadcrumb
The system variable SECTOR (0x5cc9/23753) is initially set at 0x04fb - that being 1275 sectors (5*255) to visit - or 5 revolutions of the cartridge
The ERASE routine will decrement the SECTOR count while looking for a matching filename - and when it finds the first match it will rewrite the headers, tidy up, then stop and leave SECTOR just where it is
If there's no match, i.e. the file does not exist, the search will continue and SECTOR decremented until hitting 0
And that's the breadcrumb - if SECTOR is not 0 after issuing the ERASE command then try again - for example:
Code: Select all
1 DEF FN P(A)=PEEK A+256*PEEK (A+1)
2 ERASE "M";1;"SOMEFILE": IF FN P(23753)<>0 THEN GOTO 2
3 STOP
Warning, code above may also fry any egg(s) inadvertently placed on top of a real microdrive