Home » Personal collection » Acorn ADFS disks » Electron_User_Group » EUG_27.ADF » P/+ADEXT2

P/+ADEXT2

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Personal collection » Acorn ADFS disks » Electron_User_Group » EUG_27.ADF
Filename: P/+ADEXT2
Read OK:
File size: 0919 bytes
Load address: 2B204556
Exec address: 58454441
File contents
The routine 'sfreesecs' is rather complex for calculating the values of T
and S for the co-ords X and Y in order to print the character number 224. 
Line 2220 gives the command VDU5 to join the cursors.  Next the disc space
(dsp) is added to the disc address (dad) and stored in 'dsp' to give the
end address.  

The disc address is stored in T, the bits then shifted right four times to
to divide by 16.  The four low bits of T are rotated into S.  These are
then shifted four times to the right so that S has the value of T MOD 16.

The bits in T are then shifted left three or four times to multiply by 8
or 16 depending on the value of sides to give the X co-ord.  The value of
S is multiplied by 32 by shifting left 5 times and then this value is
subtracted from 768 (&300) to give the value of the Yco-ord.  The routine
'plotpt' is then used to set the print postion for the character 224 and
then it is printed.  

The disc address is then increased and compared with the end address and
if not equal the progran returns to calculate for the next sector.  When
the end address has been reached and comparison is equal, the cursors are
returned to normal by the command VDU4 and the routine ends.

The fs map is shown by the next routine lines 2450 - 2500 by loading 'dad'
with zero and 'dsp' with two and changing the colour to white.

The root directory is shown ina similar way with routine 'cat'.

The routine 'fdfsecs' (lines 2570 - 2710) first sets the colour with
VDU18,3,1 and sets the index Y to zero and stores this in 'count'. 

In the loop 'sflp' the index value in 'count' is loaded into Y register so
that the disc address info is read from W%,Y and the disc space info from
X%,Y.  Each time that this is done, the routine to print the free sectors
is called and when the value of count equals that of size, the routine
ends.

The program then returns to print the final cue at line 380 and pauses at
line 390.  If the key R is pressed (the AND#&DF gives the same value if
the lower case r is uesd) the program goes to 'st', this gives the command
*FX21 to clear the buffers before a jump is made to 'start'.  If any other
key is pressed, MODE 6 is selected and the program returns to BASIC.

**************************************************************************

00000000  0d 54 68 65 1a 20 72 6f  75 74 69 6e 65 20 27 73  |.The. routine 's|
00000010  66 72 65 65 73 65 63 73  27 20 69 73 20 72 61 74  |freesecs' is rat|
00000020  68 65 72 20 63 6f 6d 70  6c 65 78 20 66 6f 72 20  |her complex for |
00000030  63 61 6c 63 75 6c 61 74  69 6e 67 20 74 68 65 20  |calculating the |
00000040  76 61 6c 75 65 73 20 6f  66 20 54 0d 61 6e 64 20  |values of T.and |
00000050  53 1a 20 66 6f 72 20 74  68 65 20 63 6f 2d 6f 72  |S. for the co-or|
00000060  64 73 20 58 20 61 6e 64  20 59 20 69 6e 20 6f 72  |ds X and Y in or|
00000070  64 65 72 20 74 6f 20 70  72 69 6e 74 20 74 68 65  |der to print the|
00000080  20 63 68 61 72 61 63 74  65 72 20 6e 75 6d 62 65  | character numbe|
00000090  72 20 32 32 34 2e 20 0d  4c 69 6e 65 20 32 32 32  |r 224. .Line 222|
000000a0  30 20 67 69 76 65 73 20  74 68 65 20 63 6f 6d 6d  |0 gives the comm|
000000b0  61 6e 64 20 56 44 55 35  20 74 6f 20 6a 6f 69 6e  |and VDU5 to join|
000000c0  20 74 68 65 20 63 75 72  73 6f 72 73 2e 20 20 4e  | the cursors.  N|
000000d0  65 78 74 20 74 68 65 20  64 69 73 63 20 73 70 61  |ext the disc spa|
000000e0  63 65 0d 28 64 73 70 29  20 69 73 20 61 64 64 65  |ce.(dsp) is adde|
000000f0  64 1a 20 74 6f 1a 20 74  68 65 20 64 69 73 63 20  |d. to. the disc |
00000100  61 64 64 72 65 73 73 20  28 64 61 64 29 20 61 6e  |address (dad) an|
00000110  64 20 73 74 6f 72 65 64  20 69 6e 20 27 64 73 70  |d stored in 'dsp|
00000120  27 20 74 6f 20 67 69 76  65 20 74 68 65 0d 65 6e  |' to give the.en|
00000130  64 20 61 64 64 72 65 73  73 2e 20 20 0d 0d 54 68  |d address.  ..Th|
00000140  65 20 64 69 73 63 20 61  64 64 72 65 73 73 20 69  |e disc address i|
00000150  73 20 73 74 6f 72 65 64  20 69 6e 20 54 2c 20 74  |s stored in T, t|
00000160  68 65 20 62 69 74 73 20  74 68 65 6e 20 73 68 69  |he bits then shi|
00000170  66 74 65 64 20 72 69 67  68 74 20 66 6f 75 72 20  |fted right four |
00000180  74 69 6d 65 73 20 74 6f  0d 74 6f 20 64 69 76 69  |times to.to divi|
00000190  64 65 20 62 79 20 31 36  2e 20 20 54 68 65 1a 20  |de by 16.  The. |
000001a0  66 6f 75 72 1a 20 6c 6f  77 1a 20 62 69 74 73 20  |four. low. bits |
000001b0  6f 66 20 54 20 61 72 65  20 72 6f 74 61 74 65 64  |of T are rotated|
000001c0  20 69 6e 74 6f 20 53 2e  20 20 54 68 65 73 65 20  | into S.  These |
000001d0  61 72 65 0d 74 68 65 6e  20 73 68 69 66 74 65 64  |are.then shifted|
000001e0  20 66 6f 75 72 20 74 69  6d 65 73 20 74 6f 20 74  | four times to t|
000001f0  68 65 20 72 69 67 68 74  20 73 6f 20 74 68 61 74  |he right so that|
00000200  20 53 20 68 61 73 20 74  68 65 20 76 61 6c 75 65  | S has the value|
00000210  20 6f 66 20 54 20 4d 4f  44 20 31 36 2e 0d 0d 54  | of T MOD 16...T|
00000220  68 65 20 62 69 74 73 1a  20 69 6e 1a 20 54 20 61  |he bits. in. T a|
00000230  72 65 20 74 68 65 6e 20  73 68 69 66 74 65 64 20  |re then shifted |
00000240  6c 65 66 74 20 74 68 72  65 65 20 6f 72 20 66 6f  |left three or fo|
00000250  75 72 20 74 69 6d 65 73  20 74 6f 20 6d 75 6c 74  |ur times to mult|
00000260  69 70 6c 79 20 62 79 20  38 0d 6f 72 20 31 36 20  |iply by 8.or 16 |
00000270  64 65 70 65 6e 64 69 6e  67 20 6f 6e 1a 20 74 68  |depending on. th|
00000280  65 20 76 61 6c 75 65 20  6f 66 20 73 69 64 65 73  |e value of sides|
00000290  20 74 6f 20 67 69 76 65  20 74 68 65 20 58 20 63  | to give the X c|
000002a0  6f 2d 6f 72 64 2e 20 20  54 68 65 20 76 61 6c 75  |o-ord.  The valu|
000002b0  65 20 6f 66 0d 53 20 69  73 20 6d 75 6c 74 69 70  |e of.S is multip|
000002c0  6c 69 65 64 20 62 79 20  33 32 1a 20 62 79 1a 20  |lied by 32. by. |
000002d0  73 68 69 66 74 69 6e 67  1a 20 6c 65 66 74 1a 20  |shifting. left. |
000002e0  35 1a 20 74 69 6d 65 73  20 61 6e 64 20 74 68 65  |5. times and the|
000002f0  6e 20 74 68 69 73 20 76  61 6c 75 65 20 69 73 0d  |n this value is.|
00000300  73 75 62 74 72 61 63 74  65 64 20 66 72 6f 6d 20  |subtracted from |
00000310  37 36 38 20 28 26 33 30  30 29 20 74 6f 20 67 69  |768 (&300) to gi|
00000320  76 65 20 74 68 65 20 76  61 6c 75 65 20 6f 66 20  |ve the value of |
00000330  74 68 65 1a 20 59 63 6f  2d 6f 72 64 2e 20 20 54  |the. Yco-ord.  T|
00000340  68 65 20 72 6f 75 74 69  6e 65 0d 27 70 6c 6f 74  |he routine.'plot|
00000350  70 74 27 20 69 73 20 74  68 65 6e 20 75 73 65 64  |pt' is then used|
00000360  20 74 6f 20 73 65 74 20  74 68 65 20 70 72 69 6e  | to set the prin|
00000370  74 20 70 6f 73 74 69 6f  6e 20 66 6f 72 20 74 68  |t postion for th|
00000380  65 1a 20 63 68 61 72 61  63 74 65 72 1a 20 32 32  |e. character. 22|
00000390  34 20 61 6e 64 0d 74 68  65 6e 1a 20 69 74 20 69  |4 and.then. it i|
000003a0  73 20 70 72 69 6e 74 65  64 2e 20 20 0d 0d 54 68  |s printed.  ..Th|
000003b0  65 20 64 69 73 63 20 61  64 64 72 65 73 73 20 69  |e disc address i|
000003c0  73 20 74 68 65 6e 1a 20  69 6e 63 72 65 61 73 65  |s then. increase|
000003d0  64 1a 20 61 6e 64 20 63  6f 6d 70 61 72 65 64 20  |d. and compared |
000003e0  77 69 74 68 20 74 68 65  20 65 6e 64 20 61 64 64  |with the end add|
000003f0  72 65 73 73 20 61 6e 64  0d 69 66 20 6e 6f 74 20  |ress and.if not |
00000400  65 71 75 61 6c 20 74 68  65 20 70 72 6f 67 72 61  |equal the progra|
00000410  6e 20 72 65 74 75 72 6e  73 20 74 6f 1a 20 63 61  |n returns to. ca|
00000420  6c 63 75 6c 61 74 65 1a  20 66 6f 72 20 74 68 65  |lculate. for the|
00000430  20 6e 65 78 74 20 73 65  63 74 6f 72 2e 20 20 57  | next sector.  W|
00000440  68 65 6e 0d 74 68 65 20  65 6e 64 20 61 64 64 72  |hen.the end addr|
00000450  65 73 73 20 68 61 73 20  62 65 65 6e 20 72 65 61  |ess has been rea|
00000460  63 68 65 64 20 61 6e 64  20 63 6f 6d 70 61 72 69  |ched and compari|
00000470  73 6f 6e 20 69 73 1a 20  65 71 75 61 6c 2c 20 74  |son is. equal, t|
00000480  68 65 20 63 75 72 73 6f  72 73 20 61 72 65 0d 72  |he cursors are.r|
00000490  65 74 75 72 6e 65 64 20  74 6f 20 6e 6f 72 6d 61  |eturned to norma|
000004a0  6c 20 62 79 20 74 68 65  20 63 6f 6d 6d 61 6e 64  |l by the command|
000004b0  20 56 44 55 34 20 61 6e  64 20 74 68 65 20 72 6f  | VDU4 and the ro|
000004c0  75 74 69 6e 65 20 65 6e  64 73 2e 0d 0d 54 68 65  |utine ends...The|
000004d0  20 66 73 20 6d 61 70 20  69 73 20 73 68 6f 77 6e  | fs map is shown|
000004e0  20 62 79 20 74 68 65 20  6e 65 78 74 20 72 6f 75  | by the next rou|
000004f0  74 69 6e 65 20 6c 69 6e  65 73 20 32 34 35 30 20  |tine lines 2450 |
00000500  2d 20 32 35 30 30 20 62  79 20 6c 6f 61 64 69 6e  |- 2500 by loadin|
00000510  67 20 27 64 61 64 27 0d  77 69 74 68 20 7a 65 72  |g 'dad'.with zer|
00000520  6f 20 61 6e 64 20 27 64  73 70 27 20 77 69 74 68  |o and 'dsp' with|
00000530  20 74 77 6f 20 61 6e 64  20 63 68 61 6e 67 69 6e  | two and changin|
00000540  67 20 74 68 65 20 63 6f  6c 6f 75 72 20 74 6f 20  |g the colour to |
00000550  77 68 69 74 65 2e 0d 0d  54 68 65 20 72 6f 6f 74  |white...The root|
00000560  20 64 69 72 65 63 74 6f  72 79 20 69 73 20 73 68  | directory is sh|
00000570  6f 77 6e 20 69 6e 61 20  73 69 6d 69 6c 61 72 20  |own ina similar |
00000580  77 61 79 20 77 69 74 68  20 72 6f 75 74 69 6e 65  |way with routine|
00000590  20 27 63 61 74 27 2e 0d  0d 54 68 65 1a 20 72 6f  | 'cat'...The. ro|
000005a0  75 74 69 6e 65 1a 20 27  66 64 66 73 65 63 73 27  |utine. 'fdfsecs'|
000005b0  1a 20 28 6c 69 6e 65 73  1a 20 32 35 37 30 1a 20  |. (lines. 2570. |
000005c0  2d 1a 20 32 37 31 30 29  20 66 69 72 73 74 20 73  |-. 2710) first s|
000005d0  65 74 73 20 74 68 65 20  63 6f 6c 6f 75 72 20 77  |ets the colour w|
000005e0  69 74 68 0d 56 44 55 31  38 2c 33 2c 31 20 61 6e  |ith.VDU18,3,1 an|
000005f0  64 20 73 65 74 73 20 74  68 65 20 69 6e 64 65 78  |d sets the index|
00000600  20 59 20 74 6f 20 7a 65  72 6f 20 61 6e 64 20 73  | Y to zero and s|
00000610  74 6f 72 65 73 20 74 68  69 73 20 69 6e 20 27 63  |tores this in 'c|
00000620  6f 75 6e 74 27 2e 20 0d  0d 49 6e 20 74 68 65 20  |ount'. ..In the |
00000630  6c 6f 6f 70 20 27 73 66  6c 70 27 20 74 68 65 20  |loop 'sflp' the |
00000640  69 6e 64 65 78 20 76 61  6c 75 65 20 69 6e 20 27  |index value in '|
00000650  63 6f 75 6e 74 27 20 69  73 20 6c 6f 61 64 65 64  |count' is loaded|
00000660  20 69 6e 74 6f 20 59 20  72 65 67 69 73 74 65 72  | into Y register|
00000670  20 73 6f 0d 74 68 61 74  20 74 68 65 20 64 69 73  | so.that the dis|
00000680  63 20 61 64 64 72 65 73  73 20 69 6e 66 6f 20 69  |c address info i|
00000690  73 20 72 65 61 64 1a 20  66 72 6f 6d 20 57 25 2c  |s read. from W%,|
000006a0  59 20 61 6e 64 20 74 68  65 20 64 69 73 63 20 73  |Y and the disc s|
000006b0  70 61 63 65 20 69 6e 66  6f 20 66 72 6f 6d 0d 58  |pace info from.X|
000006c0  25 2c 59 2e 20 20 45 61  63 68 20 74 69 6d 65 20  |%,Y.  Each time |
000006d0  74 68 61 74 20 74 68 69  73 20 69 73 20 64 6f 6e  |that this is don|
000006e0  65 2c 20 74 68 65 1a 20  72 6f 75 74 69 6e 65 20  |e, the. routine |
000006f0  74 6f 20 70 72 69 6e 74  20 74 68 65 20 66 72 65  |to print the fre|
00000700  65 20 73 65 63 74 6f 72  73 0d 69 73 20 63 61 6c  |e sectors.is cal|
00000710  6c 65 64 20 61 6e 64 20  77 68 65 6e 20 74 68 65  |led and when the|
00000720  20 76 61 6c 75 65 20 6f  66 20 63 6f 75 6e 74 20  | value of count |
00000730  65 71 75 61 6c 73 20 74  68 61 74 1a 20 6f 66 1a  |equals that. of.|
00000740  20 73 69 7a 65 2c 1a 20  74 68 65 1a 20 72 6f 75  | size,. the. rou|
00000750  74 69 6e 65 0d 65 6e 64  73 2e 0d 0d 54 68 65 20  |tine.ends...The |
00000760  70 72 6f 67 72 61 6d 20  74 68 65 6e 20 72 65 74  |program then ret|
00000770  75 72 6e 73 20 74 6f 20  70 72 69 6e 74 20 74 68  |urns to print th|
00000780  65 20 66 69 6e 61 6c 20  63 75 65 20 61 74 20 6c  |e final cue at l|
00000790  69 6e 65 20 33 38 30 1a  20 61 6e 64 20 70 61 75  |ine 380. and pau|
000007a0  73 65 73 20 61 74 0d 6c  69 6e 65 1a 20 33 39 30  |ses at.line. 390|
000007b0  2e 20 20 49 66 20 74 68  65 20 6b 65 79 20 52 20  |.  If the key R |
000007c0  69 73 20 70 72 65 73 73  65 64 20 28 74 68 65 20  |is pressed (the |
000007d0  41 4e 44 23 26 44 46 20  67 69 76 65 73 20 74 68  |AND#&DF gives th|
000007e0  65 20 73 61 6d 65 20 76  61 6c 75 65 1a 20 69 66  |e same value. if|
000007f0  0d 74 68 65 20 6c 6f 77  65 72 20 63 61 73 65 20  |.the lower case |
00000800  72 20 69 73 20 75 65 73  64 29 20 74 68 65 20 70  |r is uesd) the p|
00000810  72 6f 67 72 61 6d 20 67  6f 65 73 20 74 6f 20 27  |rogram goes to '|
00000820  73 74 27 2c 20 74 68 69  73 20 67 69 76 65 73 20  |st', this gives |
00000830  74 68 65 20 63 6f 6d 6d  61 6e 64 0d 2a 46 58 32  |the command.*FX2|
00000840  31 20 74 6f 20 63 6c 65  61 72 20 74 68 65 20 62  |1 to clear the b|
00000850  75 66 66 65 72 73 20 62  65 66 6f 72 65 20 61 20  |uffers before a |
00000860  6a 75 6d 70 20 69 73 20  6d 61 64 65 20 74 6f 20  |jump is made to |
00000870  27 73 74 61 72 74 27 2e  20 20 49 66 20 61 6e 79  |'start'.  If any|
00000880  20 6f 74 68 65 72 0d 6b  65 79 20 69 73 20 70 72  | other.key is pr|
00000890  65 73 73 65 64 2c 20 4d  4f 44 45 20 36 20 69 73  |essed, MODE 6 is|
000008a0  20 73 65 6c 65 63 74 65  64 20 61 6e 64 20 74 68  | selected and th|
000008b0  65 20 70 72 6f 67 72 61  6d 20 72 65 74 75 72 6e  |e program return|
000008c0  73 20 74 6f 20 42 41 53  49 43 2e 0d 0d 2a 2a 2a  |s to BASIC...***|
000008d0  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |****************|
*
00000910  2a 2a 2a 2a 2a 2a 2a 0d  0d                       |*******..|
00000919
P/+ADEXT2.m0
P/+ADEXT2.m1
P/+ADEXT2.m2
P/+ADEXT2.m4
P/+ADEXT2.m5