LINK-ED DISC EDITOR
							BY N.D.PAWSON

This program was written using the HIGHSOFT GENS3 assembler adapted for the Opus Discovery 1, the documentation was done using the TASMAN TASWORD3 word processor.

REMEMBER IT IS ILLEGAL TO MAKE PIRATE COPIES OF THIS PROGRAM !

On the standard Discovery disc there are 40 tracks which form concentric circles, each track contains 18 blocks of 256 bytes each. The last track only appears to have 17 blocks but the missing block is actually the first block on the disc and holds information on disc size etc. The disc could easily be destroyed if this block was altered so I have ignored it on the disc map.
The catalog blocks are usually (but not always) at the start of the disc. A catalog block consists of a 16 byte entry for all the files on the disc, this information gives where the file is and how blocks long it is. The first 7 bytes of the actual file data gives the file type, length, start etc. Consult your Discovery manual or write for more information.
This program can be used for several things, for example renaming files, renaming the disc, repairing a corrupted catalog, checking file data, altering text in your programs (or commercial programs), altering code and checking program positions. It should be an especially useful utility to anyone writing software for the Discovery.
If the program finds a disc error or if break is pressed during disc access then it will display an error messgage and wait for a key to be pressed. It then restarts the program and tries to read in the catalog track again, this is to prevent an errored, or broken, block being written back to the disc.
Because of the problem of displaying Sinclair (Amstrad?) keywords on a neat display, if a character code is over 127 then the program subtracts 128 and inverts it. This means, for example, that 'CODE' will be displayed as an inverted '/'. Any Character code below 32 will be displayed as an inverted '?' and most numbers are displayed in HEX.
The first screen that appears consists of a disc map, a scrolling list of the file names and four status lines at the top. The easiest way to learn how to use LINK-ED is to load the program and try things out as you read about them (the program asks you to verify any command that could cause damage, but write protect your disc for now just in case).

DESCRIPTION

DISC MAP:  The disc map shows where all the files on the disc are positioned and how much space they take up. The numbers at the top of the map are the track numbers and the numbers at the left are the blocks within that track. To find out a block number from the start of the disc multiply its track number by 18 and add the number of blocks into that track you wish. Each of the files has a letter assigned to it, this is shown beside the filenames in the scroller and beside the name at the top of the screen (this is updated as you move the pointer  around). Blocks with no file on them are displayed with '-' as their symbol. If lock mode is on then the scroller will point to the filename of the current block as the pointer is moved around.
SCROLLER:  The scroller displays the names of all the files on the disc and the letter assigned to it on the disc map. This includes the catalog file which is always assigned the letter 'A'. The scroller cannot usually display all the filenames at once but can be moved up or down to display more names. If lock mode is on then the pointer on the disc map will move to point to the first block of the file as the scroller is altered.
STATUS  LINES:  	The top of the screen shows the following	informations about the disc and the curent 	modes:
DRIVE:  	The current drive (1 or 2).
LOCK:  	This shows whether or not the program is in 	lock mode (if it is on then the scroller and 	disc map move together to point to the same 	file). 
NAME:  	This gives the letter (disc map) and the name 	of the file that the pointer is on. It is 	automatically updated as the pointer is 	moved.
POINTER:  	This gives the track and block of the block 	that the pointer is on, this is shown in the 	format TT:BB in HEX. )
DISC NAME: 	The name of the current disc, it is updated 	at the same time as the map is updated.
The blank line is used for error messages and other temporary text.

KEYS:  
The commands are executed by pressing a single key, these keys are:-
H:  HELP
	The program has a help screen which list the the keys and 	the connected commands (the editor itself has a different 	help screen). 
l:  HEX > DEC
	The program has a HEX to DEC conveter. Press this key then 	type in your HEX number and press <ENTER>. The program 	will not accept invalid numbers. 
2:  DEC > HEX
	This is the same as above but in the opposite direction. N,Z,A,M or 5,6,7,8:  MOVE POINTER
	These keys are used to move the pointer on the disc map, 	the status lines and, if lock is in, the scroller will be 	updated automaticly.
0,0:MOVE SCROLLER
	Use these keys to move the filenames in the scroller up 	and down. If lock mode is on then the pointer will point 	to the first block of the marked file.
E:EDIT BLOCK
	This loads the block at the pointer and enters the editor. <ENTER>:ENTER EDITOR
	This will enter the editor without loading the current 	block, the editor will still contain the last block 	loaded. 
L:LOCK ON/OFF
	The lock mode is toggled on and off by this key. 
J:JUMP
	Type in the new pointer position (on the status lines) to 	move the pointer to a new block, input the new position in 	the format TT:BB (the ':' can be any character). 
D:DRIVE 1<>2
	Press this to switch the drive number, you will have to 	update the map to change the display. 
U:UPDATE MAP
	This will re-read the catalog blocks from the disc and 	rebuild the display.
Q:QUIT
	Before this command is executed it will ask if you are 	sure, press 'Y' if you are or any other key to abort.

	EDITOR
The editor part of the program allows any block on the disc to be loaded and examined or altered. In any of the modes if you quit or leave the current block and it has been changed then the program will ask if you wish to save the block, you must reply 'Y' or 'N' to this question.
When you go into the editor (using 'E' or <ENTER>) the program will add an extra line to the status lines and display the current block. The new display line shows:-
MODE:	There are two parts to this, the first part shows 	whether the main display is HEX or characters (ASCII). 	The second part shows whether you are in overwrite mode 	and writing to the block buffer or in examine mode.
BYTE: This displays how many bytes into the file you are. 	Remember that the first seven bytes of the file are used 	for header information. If you are on a block of the 	disc with no file then it will display #0000.
The rest of the display is a 16*16 block which displays the contents of the block, and a magnified display of the bytes around the cursor in HEX. The numbers to the left of the block show the high byte and the numbers at the top show the low byte. Any changes in the block number will move the main disc map pointer.
The editor uses the following keys:-
H:  HELP
	The editor has a help screen which lists the keys and 	connected commands. 
l:  HEX > DEC
	The program has a HEX to DEC converter, Press this key 	then type in your HEX number and press <ENTER>, The 	program will not accept invalid numbers. 
2:  DEC > HEX
	The same as above but in the opposite direction.
N,Z,A,M or 5,6,7,8:  M0VE CURSOR
	These keys are used to move around the screen, in 	overwrite mode use CAPS 5,6,7,8,0 to move around. If you 	go off the top or bottom at any time, and the block has 	been altered, then the program will ask if you wish to 	save the block.
9,0: CROSS TRACK
	Use these keys to move across the disc from track to 	track. The program will do a SAVE? check if any changes 	have been made.
J:  JUMP
	To jump to another block on the disc press this and type 	in the new block position. If you have made any changes 	then the program will first do a SAVE? check.
S:  SWITCH MODE
	Switches the display between HEX an ASCII. It also changes 	whether characters or HEX numbers are entered in overwrite 	mode.
F:  FILL
	First the program will ask if you are sure then it will 	fill the buffer with the character at the cursor. If you 	want to fill with a specific value then write it to the 	buffer, move the cursor back over it and fill. 
U:  UNDO
	If you have made a mistake in the buffer then this will 	restore it to the original values from when it was first 	loaded. It does a SURE? check first to prevent accidenta1 	destruction of alterations. The command will work if no
	not changes have been made. 
Q:  QUIT
	This returns back to the main screen, it doesn't do a 	SURE? check since nothing is destroyed and the editor can 	be re-entered using <ENTER>. The program will do a SAVE? 	check if you have made any changes. 
O:  OVERWRITE
	When you enter this mode it takes any following keypresses 	and writes them to the buffer. This can then be written to 	the disc when you leave the current block or quit. If you 	are in HEX mode then use the magnified display to type in 	the numbers, if you type an illegal number then it will 	ignore it and go onto the next position. If you are in 	CHAR mode then type in the character on the main display. 	To exit overwrite mode press <ENTER>. If you wish to move 	to another part of the block or one of the adjacent blocks 	then use CAPS 5,6,7,8,0 to move without changing the mode.
###