ADFS & DFS Disk Examiners

By Richard Dimond

Originally published in EUG #34

Having now got several DFS disks from Gus, I needed a DFS version of the ADFS disk examine program which I had modified and m/coded earlier. In doing the DFS version, I added a routine to select the drive number and thought that this should also be added to the ADFS versions. I now give the new ADFS versions and the DFS versions.

Each of the programs first asks for the drive number. This is entered simply by pressing the number key. The disk address is then entered to display the sector required. You may then move forward or backward sector by sector or re-run the program to choose another start sector.

The BASIC DFS program was easily converted from the ADFS version as it was only necessary to alter the values in 'block' to those for DFS but the m/code version was not so easy as MOD and DIV divided the variable address and not the contents.

I first used a modified version of my 'decprt' routine to divide by 10 but found a better routine in the book on Assembly Language. The routine 'dvide' (Line 1180 of the Assembler listing) is an amended version of this routine. This only divides a single byte and I realised that I needed to divide a two byte number and I hadn't a clue how to do this at first!

Eventually I realised I needed to shift the nibbles of the address and use the routine 'dvide' twice. This is done by the routine 'split' (line 1000). The value of the disk address 'dadd' is first loaded into the variable 'da' to enable this to be worked on while retaining the value in 'dadd'.

The first loop 'shlp1' shifts the low nibble of 'da+1' and the high nibble of 'da' into 'da+1'. This value is then stored in 'tmp1' and the 'dvide' routine called. This divides by 10 leaving the result in 'tmp1' and the remainder in 'tmp2'. The result is the first digit of track number and is stored in 'trk'. The remainder is returned to 'da+1'.

The loop 'shlp2' then shifts the nibbles back into 'da' and the value then is stored in 'tmp1' for the second call to 'dvide'. This gives the second digit for 'trk' and remainder is the value for 'sec'.

Line 1160 shifts the low nibble in 'trk' into the high nibble and adds the value in 'tmp1' to give the full value of 'trk' store it in 'trk' and 'block+7'.

The remainder in 'tmp2' is then stored in 'sec' and 'block+8'. The values are now correctly entered.

One further amendment was needed to increase and decrease 'dadd+1' when the address moved to the next page. On increasing 'dadd', if it becomes 0 then 'dadd+1' must increase and this can be done by testing the zero flag (line 680). When 'dadd' is decreased, 'dadd+1' must decrease when 'dadd' is equal to &FF. This needs the value of 'dadd+1' to be loaded into register A and compared with &FF (Line 690).

The remainder of the program is much the same as the ADFS program apart from the differences for the two filling systems.

The drive routine tests for the number keys and in the ADFS program the number is added to the string "MOU." and in the DFS the value is stored in 'block'.

Disk errors are reported by testing 'block' for ADFS or 'block+10' for DFS and, if these are not zero, "Disc error" is printed and the program ends.

Richard Dimond

The files are stored on this disk under the following names:

  U.ADFSSrc = a BASIC file, U.ADFSEXM = a BASIC file,
U.ADFSE = a m/c file.  
U.DFSSrc = a BASIC file, U.DFSEXM = a BASIC file,
U.DFSE = a m/c file.  

Gus Donnachaidh, EUG #34