view docs/articles/ded.article @ 3051:d0ec54ac8b94

Added help files for sdir and sdrive
author tlindner
date Sun, 25 Jan 2015 12:05:20 -0800
parents 1e04ad1dfdce
children
line wrap: on
line source

<!--
    The author has not been contacted about adding this article to the
    documentation set.
-->
<article>
<articleinfo>
<author><firstname>Doug</firstname><surname>DeMartinis</surname></author>
<title>dEd</title>
<subtitle>Disk Editor</subtitle>
</articleinfo>
<para>
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).
</para><para>
To use, type:
<screen>
dEd &lt;pathlist&gt;
</screen>
where &lt;pathlist&gt; is of the form:  filename or dirname
or  /path/filename
or  /D0@  (edits entire disk) 
</para><para>
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.
</para>
<table frame="none" pgwide="1">
<title>Commands</title>
<tgroup cols="2">
<colspec colwidth="1.9in" colname="c1" />
<colspec colwidth="4.0in" colname="c2" align="right"/>
<spanspec spanname="all" namest="c1" nameend="c2"/>
<tbody>
<row>
<entry>Up/Down Arrows</entry>
<entry>Display Next/Previous Sector (LSN)</entry>

</row><row>
<entry spanname="all">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.</entry>

</row><row>
<entry>A Command</entry>
<entry>APPEND Current LSN to Output File</entry>

</row><row>
<entry spanname="all">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. </entry>

</row><row>
<entry>C Command</entry>
<entry>CLOSE Output File</entry>

</row><row>
<entry spanname="all">This  command closes the file opened with the O command and 
removes  the  file  name  from   the display, making Append 
inactive.</entry>

</row><row>
<entry>D Command</entry>
<entry>Diddle with the File Length</entry>

</row><row>
<entry spanname="all">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
&lt;ENTER&gt;  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!)</entry>

</row><row>
<entry>E Command</entry>
<entry>EDIT the displayed Sector</entry>

</row><row>
<entry spanname="all">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 
&lt;BREAK&gt; 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 &lt;ENTER&gt; 
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). </entry>

</row><row>
<entry>F Command</entry>
<entry>FIND</entry>

</row><row>
<entry spanname="all"><para>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
&lt;ENTER&gt;.  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 &lt;BREAK&gt; 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
&lt;ENTER&gt;.  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 &lt;ENTER&gt; at either  prompt,
you will be returned to the command mode.
</para><para>
If you wish to abort a search in progress,  just press the
&lt;BREAK&gt; key.  This will simulate a "string not found"  and
return you to the CMD: prompt.</para></entry>
</row><row>
<entry>H (or '?') Command</entry>
<entry>HELP</entry>

</row><row>
<entry spanname="all">This displays a Help screen. </entry>

</row><row>
<entry>L Command</entry>
<entry>LINK to a Module/LIST Modules</entry>

</row><row>
<entry spanname="all">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 &lt;ENTER&gt;. 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 &lt;ENTER&gt;, 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 &lt;ENTER&gt;. 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  &lt;ENTER&gt; 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.</entry>

</row><row>
<entry>N Command</entry>
<entry>Find Next occurrence of String</entry>

</row><row>
<entry spanname="all">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.</entry>

</row><row>
<entry>O Command</entry>
<entry>OPEN an Output File</entry>

</row><row>
<entry spanname="all"><para>You  will be prompted with 'OUTFILE: '. Type in a file name
or  path (that does not already exist) and press &lt;ENTER&gt;. 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. 
</para><para>
To abort the O Command, just press &lt;ENTER&gt; or &lt;BREAK&gt;.</para></entry>


</row><row>
<entry>P  Command</entry>
<entry>Push an LSN onto the Sector Stack</entry>

</row><row>
<entry spanname="all">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.</entry>

</row><row>
<entry>Q Command</entry>
<entry>QUIT dEd</entry>

</row><row>
<entry spanname="all">This exits dEd immediately. You should be sure to Write any
Editted or Zapped sectors back to the disk before Quitting.</entry>

</row><row>
<entry>R Command</entry>
<entry>Remove an LSN from Sector Stack and Display</entry>

</row><row>
<entry spanname="all">This  removes (pulls), from the Sector Stack, the last  LSN
that was pushed (with the 'P' command) and displays it.</entry>

</row><row>
<entry>S Command</entry>
<entry>SKIP to a given LSN</entry>

</row><row>
<entry spanname="all">You will be prompted with 'LSN=$ '. Type a sector number (in
Hex) and press &lt;ENTER&gt;. That LSN will then be displayed, if 
possible. If the LSN entered is greater than the last LSN in
the file, nothing will happen.</entry>

</row><row>
<entry>U Command</entry>
<entry>Unlink a Module</entry>

</row><row>
<entry spanname="all">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.</entry>

</row><row>
<entry>V Command</entry>
<entry>VERIFY All Modules</entry>

</row><row>
<entry spanname="all">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.</entry>

</row><row>
<entry>W Command</entry>
<entry>WRITE the Sector displayed to the Disk</entry>

</row><row>
<entry spanname="all">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.</entry>

</row><row>
<entry>X Command</entry>
<entry>EXPERT Mode</entry>

</row><row>
<entry spanname="all">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.</entry>

</row><row>
<entry>Z Command</entry>
<entry>ZAP the displayed Sector</entry>

</row><row>
<entry spanname="all">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 &lt;ENTER&gt;. That byte or character will be 
written  to   the ENTIRE SECTOR. You can toggle between the 
BYTE/CHAR  modes  by   hitting the &lt;BREAK&gt; key. In the CHAR 
mode, hitting ALT-Char then &lt;ENTER&gt; 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 
&lt;ENTER&gt; 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). </entry>

</row><row>
<entry>$ Command</entry>
<entry>Fork a SHELL</entry>

</row><row>
<entry spanname="all">A  new  Shell  is  forked   to allow access to OS-9 without 
terminating dEd.  To return to dEd, press Ctrl-BREAK  (ESC).</entry>

</row><row>
<entry>&lt;CR&gt; Command</entry>
<entry>Clean up screen display</entry>

</row><row>
<entry spanname="all">Pressing &lt;ENTER&gt; 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.</entry>
</row>
</tbody>
</tgroup>
</table>

</article>