8-Bit Software Online Conversion

              D6G (Sprow) ADFS catalogue ============== Last month K2Q (John Nicholson) asked about the ADFS and DFS. He wanted to know where the directory listing is kept, and how to get accesss to the alphasort part of the *CAT command. Here's my answer to him (it was too long for the message editor to handle so it became an article). The ADFS does keep a copy of the current directory in memory which is why you can catalogue a disk without needing to start the disk drive up. However it would be unwise to read this from memory, since its position cannot be guaranteed between versions.eg. there is an ADFS upgrade available for the BBC B but the directory listing will not be in the same place on other machines as any filing system claims memory from &E00 upwards, whereas on the Master (which I assume he has) the filing system RAM is hidden away behind the operating system ROM (usually referred to as 'hidden RAM' as it can only be accessed by other ROMs). The following BASIC program will read the files present in the currently selected directory on ANY Acorn including all the 8 bit ones,and it will also apply to any of the Acorn range (including the marvellous Risc PC) as it is written in BASIC and uses a 'legal' Acorn call: 10REM Read the current directory's catalogue into memory using a modified version of the block used for OSFSC 20REM 0,WRADDR,NOF,0,0,0,0 30REM WRADDR=address at which catalogue is to be written (4 bytes) 40REM NOF=no. of files to read catalogue for ie.32 max for DFS (4 bytes) 50REM Set up block to CAT at block % and use code% as block area 60DIM code% &40 70DIM block% 512 80P%=code% 90[ 100EQUB0 110EQUD&FFFF0000+block% 120EQUW&0000:EQUW&0080 130EQUW&0000:EQUW&0000 140.docat 150LDA#8 160LDX#code% MOD256:LDY#code% DIV256 170JMP&FFD1 180] 190REM On exit the first byte in the block is the Disk's cycle number,followed by the number of file's catalogues that were not read (if NOF was too small) 200REM At the address block% data is returned as LON1,NAME1,LON2,NAME2 etc and does not include the directory name 210OSCLI"MEM."+STR$÷(code%) 220CALL docat 230PRINT:PRINT"Cycle number:"÷?code% 240OSCLI"MEM."+STR$÷(block%) 245REM Or replace the above line with your memory dumper's command name,for example *MZAP for Disc Doctor 250PRINT:PRINT"Proof:" 260*. 270A=GET:RUN For interest's sake,if you do have a BBC B with ADFS 1.50 upgrade then the catalogue is stored thus: PAGE &1200 Master sequence # &1201... Text to identify DIR ...&1204 &1205+26 First entry &121F+26 Second entry &1nnn Zero byte if not a full catalogue (Garbage to pack empty space) &16CB Always zero as this is where a full dir would end &16CC Directory name &16D6... Parent point LSB ...&16D8 MSB &16D9 Directory title &16FA Master sequence # &16FB... Text to identify DIR ...&16FE &16FF Reserved byte The 26 byte blocks are made up as: 00 to 09 10 letter name 10 to 13 Load addr 14 to 17 Exec addr 18 to 21 Length 22 to 24 Start sector on drive 25 Sequence # The top bits of offset 00=R 01=W 02=L 03=D hence filenames cannot have teletext control codes in them as they could in DFS Note how important it is to use legal Acorn calls wherever possible to allow for future compatibility. Your second point,whether there is access to the alpha sorter that DFS uses before printing a catalogue,well,no it's not available to the user. 1. As it is not an OS call the DFS chip would have to be paged in manually. 2. The DFS does not use a true string sort. On the BBC B at page &E and &F there is a list of all filenames (for DFS 1.20). It compares the first letter of each with A, printing if it does start with A. Then again for B,C,D and so on. Each time a filename is written to the screen its name has a flag character put in to stop it being checked again (speeding the cycle up) 3. If you get an Archimedes/Risc PC there IS a string sort available there. It is not the fastest of routines that Acorn has written as size was more important - it only requires the memory of the original array, so is very lean, and works by shuffling the strings around one at a time. Hope this has helped, Robert Sprowson. Write to 6 Bollinbrook road, MACCLESFIELD, Cheshire. SK10 3DJ. Telephone (01625) 430167 8BSmail me on D6G.                   