# HG changeset patch # User roug # Date 1044056453 0 # Node ID 2ccaf038d1c63ab6bc168028b73b8d69597b24f6 # Parent 425b8a051c58e79a69b64ec385dd2ae1bdc432bd The ded manual as an article. diff -r 425b8a051c58 -r 2ccaf038d1c6 docs/articles/ded.article --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/articles/ded.article Fri Jan 31 23:40:53 2003 +0000 @@ -0,0 +1,400 @@ + + + +
+ +DougDeMartinis +dEd +Disk Editor + + +dEd is a screen-oriented disk editor utility written in +assembly language. It was originally conceived as a floppy +disk editor, so the display is organized around individual +sectors. It performs most of the functions of Patch, from +Computerware, but is faster, more compact, and +screen-oriented rather than line-oriented. Individual files +or the disk itself (hard, floppy, ram) can be examined and +changed, sectors can be written to an output file, and +executable modules can be located, linked to and verified. +With simple changes, it will run on any CoCo Level I OS-9 +and possibly others (CoCo Level II OS-9). + +To use, type: + +dEd <pathlist> + +where <pathlist> is of the form: filename or dirname +or /path/filename +or /D0@ (edits entire disk) + +dEd will read in and display the first 256 bytes in the file +(disk). This is Logical Sector Number (LSN) zero. You move +through the file sector (LSN) by sector using the up and +down arrow keys. The current LSN number is displayed in Hex +and Decimal in the upper left corner of the screen. If the +disk itself was accessed (by appending '@' to it's name when +dEd was called), the LSN is the disk sector number. If an +individual file is being editted, however, the LSN displayed +refers to the file, not to the disk. All numbers requested +by dEd must be in Hex format. All commands are accessed by +simply pressing the desired key. + + +Commands + + + + + + +Up/Down Arrows +Display Next/Previous Sector (LSN) + + +Each keypress moves the display to the next or previous 256 +bytes. Auto-repeat allows skimming quickly through the file. +To halt the key-repeat, type Control-W to pause the display, +then hit any key. The LSN displayed represents the +most-significant byte of the offset of the bytes from the +start of the file (module), so byte number $1457 would be +found in LSN $14 on row 50, column 7. + + +A Command +APPEND Current LSN to Output File + + +This command writes the sector currently displayed to the +file opened with the O command. Append is inactive unless an +Output file has been created. This mode is useful for +recovering files with unreadable sectors in them, as all the +sectors before and after the crashed sector may be accessed +and saved to a new file. Append also increments the display +to the next LSN automatically to speed this process. At the +end of a file, generally fewer than 256 bytes will be +displayed, as the length of most files is not an even +multiple of 256. The Append command will only write out the +bytes that are displayed, and the display will remain on the +same LSN. Pressing 'A' twice on the last LSN of a file +results in it being written to the output file twice. + + +C Command +CLOSE Output File + + +This command closes the file opened with the O command and +removes the file name from the display, making Append +inactive. + + +D Command +Diddle with the File Length + + +This command displays the current file length, in Hex, then +allows you to change it. This is potentially very dangerous +(e.g. if you use it on loadable modules). If you just press +<ENTER> at the prompt, you will be returned to the command +mode (this is useful for just checking the file length). If +you enter a valid length (number of BYTES, not sectors, +in Hex), the file will be expanded or contracted to that +length. This is useful for stripping the Control-Z's ($1A) +off the end of files downloaded with the XModem protocol. +Remember, the LENGTH of a file is 1 greater than the number +of the last byte in the file (remember, counting from 0!) + + +E Command +EDIT the displayed Sector + + +This is the heart of dEd. The cursor will appear over the +first byte or character in the LSN. If it's over the BYTE, +you can change the value by typing 2 new nibbles in Hex, +e.g. 6c. The display will be updated and the cursor will +move to the next BYTE. If the cursor is over the CHARACTER +part of the display, you can change the value by typing a +new ASCII character. Again, the display will be updated and +the cursor will shift to the next character. You switch +between the BYTE and CHAR modes at any time by hitting the +<BREAK> key, as noted at the bottom of the display. You +navigate through the sector to individual BYTEs or CHARs +using the 4 Arrow keys. The Right and Left Arrows wrap the +cursor around to the next or previous row on the display. +The Up and Down Arrows wrap around from top to bottom and +vice-versa. Once you are done Editting, pressing <ENTER> +will exit the Edit mode, as noted at the bottom of the +display. As with Zap, the sector is NOT written back to the +disk unless the Write command is then used (unless in Expert +mode). + + +F Command +FIND + + +This searches the file for a +given character or byte string +You will be prompted with 'Find byte string $'. Enter a +series of up to 16 Hex bytes, without spaces (you MUST +enter leading zeroes for the numbers 00 - $0F) then press +<ENTER>. The search begins at the start of the LSN +currently displayed. If a string is located that EXACTLY +matches the string you input, the LSN in which it is +located will be displayed, with the first byte/character in +the string highlighted. By pressing the <BREAK> key at the +prompt, you can toggle between the BYTE and CHARACTER +search modes. In the character mode, the prompt is 'Find +char string: '. Enter up to 16 ASCII characters, then press +<ENTER>. In this mode, dEd will locate any string that +matches the one you input, regardless of the Upper/Lower +case status of either string. As well, characters with bit +7 set (e.g. file names in directories) are treated as if +bit 7 was clear. If no matching string is found, you are +returned to the command prompt. If you enter an invalid +character or byte string, a beep sounds and the same prompt +is re-issued. If you just press <ENTER> at either prompt, +you will be returned to the command mode. + +If you wish to abort a search in progress, just press the +<BREAK> key. This will simulate a "string not found" and +return you to the CMD: prompt. + +H (or '?') Command +HELP + + +This displays a Help screen. + + +L Command +LINK to a Module/LIST Modules + + +If you are editting a file that consists of various +executable modules merged together (e.g. OS9Boot), this +command allows you to 'Link' to one of the modules. It will +be treated as if it is an individual file, i.e. the start of +the module will be displayed as LSN 0 and only THAT MODULE +will be accessible for display and/or Editting. The LSN +displayed is referenced to the MODULE, not to the main file +or the disk. You will be prompted with 'Link to which +Module? '. You may enter a valid name and press <ENTER>. If +that module can be located AND if it's header information is +correct, it will be 'Linked'. The top row of the display +reflects this by displaying the module name and it's offset, +in bytes, from the beginning of the main file. At the 'Link +to which Module? ' prompt, if you just hit <ENTER>, all the +valid modules and their offsets from the beginning of the +main file as well as their lengths, in bytes Hex, will be +Listed. Hitting any key after this redisplays the current +LSN. The Link mode is useful for changing a given byte in a +module using the offset one would use for Debug. For +example, to permanently change the printer baud rate, you +would call 'dEd /D0/OS9Boot'. Then hit 'L' for Link. At the +prompt 'Link to which Module? ', Type P and hit <ENTER>. If +P is in your OS9Boot file, the top row of the display will +have MODULE: P and give the offset of it from the beginning +of the OS9Boot file. Enter the Edit mode by hitting 'E' +then use the arrows to move the cursor to byte number 27 +(row 20, column 7). Type in the new value for the baud rate +then hit <ENTER> to exit Edit mode. Hit 'W' to write the +sector, then 'V' to verify the modules. If a module is +linked, the 'Find' command only searches for strings in +that module. + + +N Command +Find Next occurrence of String + + +This is used in conjunction with the 'Find' command. Once a +Hex byte or ASCII character string has been located with +'F', the next occurrence may be located by pressing 'N'. +This search starts where the 'Find' search left off, IF the +LSN hasn't changed since the string was initially located. +If the LSN has changed, the search starts at the beginning +of the current LSN. If the search is successful, the string +will be highlighted, as with 'Find', otherwise you are +returned to the command prompt, with a beep. + + +O Command +OPEN an Output File + + +You will be prompted with 'OUTFILE: '. Type in a file name +or path (that does not already exist) and press <ENTER>. A +new file will be created and opened, with the name +displayed on the second row of the screen. Individual +sectors can be written to this file using the Append +command. + +To abort the O Command, just press <ENTER> or <BREAK>. + + + +P Command +Push an LSN onto the Sector Stack + + +This pushes the current LSN onto a funtional Stack of +sectors. The 'R' command then can remove (pull) them from +the Stack in the reverse order (Last In, First Out) that +they were pushed. Up to 16 LSN's can be saved on the Stack. +This is very useful when trying to reconstruct a deleted +file that was fragmented on the disk. By pushing each +sector examined onto the Stack, you can retrace your steps +backwards without having to remember the sector number of +each sector along the way. + + +Q Command +QUIT dEd + + +This exits dEd immediately. You should be sure to Write any +Editted or Zapped sectors back to the disk before Quitting. + + +R Command +Remove an LSN from Sector Stack and Display + + +This removes (pulls), from the Sector Stack, the last LSN +that was pushed (with the 'P' command) and displays it. + + +S Command +SKIP to a given LSN + + +You will be prompted with 'LSN=$ '. Type a sector number (in +Hex) and press <ENTER>. That LSN will then be displayed, if +possible. If the LSN entered is greater than the last LSN in +the file, nothing will happen. + + +U Command +Unlink a Module + + +This 'unlinks' a module that has previously been 'linked' +using the 'L' command. The first sector in the file (LSN 0) +is displayed. Using this command when no module has been +linked has no effect. + + +V Command +VERIFY All Modules + + +This command calculates and writes a new CRC value for EACH +module in a fale. It must be used after Editting executable +modules or they will not be loadable. Verify is terminated +if an error is located in the header of a module, but each +module is verified individually and the CRC is rewritten to +each before moving to the next module in a file, so modules +in front of one with an error will be verified. + + +W Command +WRITE the Sector displayed to the Disk + + +WARNING!!! This command can be very dangerous to the well- +being of your disk data. It writes the sector displayed +back to the disk (at the same location from whence it came, +but not necessarily with the same information, hence the +danger). After Zapping or Editting a sector, you must use +this command to make the changes on the disk (unless you're +in the Expert mode). Because you can effectively maim your +data with this command, you will be prompted with 'Are you +sure (Y/N)? '. If you hit any key other than 'Y' (or 'y') +the Write command will be aborted. Otherwise the sector will +be written, with the display advising you that dEd is +'Writing Sector...'. On a hard disk or RAM disk, this is +very quick. + + +X Command +EXPERT Mode + + +This command is potentially the most dangerous of all. It +should be used only by those who are very brave (fools?) or +those who never make mistakes. In this mode, any sectors +changed by Edit or Zap will be automatically written to the +disk. The Write command is not needed, and is inactivated in +the Expert mode. Any errors made during Edit or Zap WILL be +transferred to the disk, making this mode very good for +crashing directories, etc. Having noted this, there is one +route of escape from errors made in this mode. After +Editting or Zapping a sector, the sector is not actually +written back to the disk until after Edit or Zap is exitted +and the next command is issued (i.e. the next Command Key is +pressed). If you hit Shift-BREAK , before hitting any other +Command Key, the automatic Write will not occur. You must +type Shift-BREAK before any other command or the sector will +be written to the disk. This is a one-time escape, so any +further errors made will require hitting the Shift-BREAK key +again at the appropriate time to avoid writing the bad +sector to the disk. Unless you fully understand the OS-9 +disk structure (or enjoy toying with the life of your data), +this mode should probably be avoided. It is entered after +responding with a 'Y' or 'y' to the 'Are you sure (Y/N)?' +prompt, and the display advises you that you are in this +mode. The 'X' command is a toggle switch, so to exit Expert +mode, just hit 'X' again and the 'Expert Mode' message will +be erased. + + +Z Command +ZAP the displayed Sector + + +You will be prompted with 'Zap Byte: ' or 'Zap Char: '. +Enter either a Hex byte (e.g. 6c) or an ASCII character +(e.g. $) and press <ENTER>. That byte or character will be +written to the ENTIRE SECTOR. You can toggle between the +BYTE/CHAR modes by hitting the <BREAK> key. In the CHAR +mode, hitting ALT-Char then <ENTER> will Zap the sector with +that char with bit 7 set. Unless you're in the Expert mode, +only the buffer will be Zapped with the Zap command. To put +this Zapped sector on the disk, you must use the Write +command. If you decide not to Zap the sector, just hit +<ENTER> without first entering a byte or character. You can +redisplay a sector that has been Zapped, but not Written +back to the disk, by going to the next LSN using the Up +Arrow, then returning to the original LSN with the Down +Arrow (again, provided you're not in the Expert mode). + + +$ Command +Fork a SHELL + + +A new Shell is forked to allow access to OS-9 without +terminating dEd. To return to dEd, press Ctrl-BREAK (ESC). + + +<CR> Command +Clean up screen display + + +Pressing <ENTER> at the CMD: prompt will clear and re-write +the screen which may have been trashed by an error. Current +editing to the displayed sector is not lost or written. This +command only resets the screen display. + + + +
+ +