comparison docs/articles/ded.article @ 972:2ccaf038d1c6

The ded manual as an article.
author roug
date Fri, 31 Jan 2003 23:40:53 +0000
parents
children 1e04ad1dfdce
comparison
equal deleted inserted replaced
971:425b8a051c58 972:2ccaf038d1c6
1 <?xml version="1.0" ?>
2 <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
4 <!--
5 The author has not been contacted about adding this article to the
6 documentation set.
7 -->
8 <article>
9 <articleinfo>
10 <author><firstname>Doug</firstname><surname>DeMartinis</surname></author>
11 <title>dEd</title>
12 <subtitle>Disk Editor</subtitle>
13 </articleinfo>
14 <para>
15 dEd is a screen-oriented disk editor utility written in
16 assembly language. It was originally conceived as a floppy
17 disk editor, so the display is organized around individual
18 sectors. It performs most of the functions of Patch, from
19 Computerware, but is faster, more compact, and
20 screen-oriented rather than line-oriented. Individual files
21 or the disk itself (hard, floppy, ram) can be examined and
22 changed, sectors can be written to an output file, and
23 executable modules can be located, linked to and verified.
24 With simple changes, it will run on any CoCo Level I OS-9
25 and possibly others (CoCo Level II OS-9).
26 </para><para>
27 To use, type:
28 <screen>
29 dEd &lt;pathlist&gt;
30 </screen>
31 where &lt;pathlist&gt; is of the form: filename or dirname
32 or /path/filename
33 or /D0@ (edits entire disk)
34 </para><para>
35 dEd will read in and display the first 256 bytes in the file
36 (disk). This is Logical Sector Number (LSN) zero. You move
37 through the file sector (LSN) by sector using the up and
38 down arrow keys. The current LSN number is displayed in Hex
39 and Decimal in the upper left corner of the screen. If the
40 disk itself was accessed (by appending '@' to it's name when
41 dEd was called), the LSN is the disk sector number. If an
42 individual file is being editted, however, the LSN displayed
43 refers to the file, not to the disk. All numbers requested
44 by dEd must be in Hex format. All commands are accessed by
45 simply pressing the desired key.
46 </para>
47 <table frame="none" pgwide="1">
48 <title>Commands</title>
49 <tgroup cols="2">
50 <colspec colwidth="1.9in" colname="c1" />
51 <colspec colwidth="4.0in" colname="c2" align="right"/>
52 <spanspec spanname="all" namest="c1" nameend="c2"/>
53 <tbody>
54 <row>
55 <entry>Up/Down Arrows</entry>
56 <entry>Display Next/Previous Sector (LSN)</entry>
57
58 </row><row>
59 <entry spanname="all">Each keypress moves the display to the next or previous 256
60 bytes. Auto-repeat allows skimming quickly through the file.
61 To halt the key-repeat, type Control-W to pause the display,
62 then hit any key. The LSN displayed represents the
63 most-significant byte of the offset of the bytes from the
64 start of the file (module), so byte number $1457 would be
65 found in LSN $14 on row 50, column 7.</entry>
66
67 </row><row>
68 <entry>A Command</entry>
69 <entry>APPEND Current LSN to Output File</entry>
70
71 </row><row>
72 <entry spanname="all">This command writes the sector currently displayed to the
73 file opened with the O command. Append is inactive unless an
74 Output file has been created. This mode is useful for
75 recovering files with unreadable sectors in them, as all the
76 sectors before and after the crashed sector may be accessed
77 and saved to a new file. Append also increments the display
78 to the next LSN automatically to speed this process. At the
79 end of a file, generally fewer than 256 bytes will be
80 displayed, as the length of most files is not an even
81 multiple of 256. The Append command will only write out the
82 bytes that are displayed, and the display will remain on the
83 same LSN. Pressing 'A' twice on the last LSN of a file
84 results in it being written to the output file twice. </entry>
85
86 </row><row>
87 <entry>C Command</entry>
88 <entry>CLOSE Output File</entry>
89
90 </row><row>
91 <entry spanname="all">This command closes the file opened with the O command and
92 removes the file name from the display, making Append
93 inactive.</entry>
94
95 </row><row>
96 <entry>D Command</entry>
97 <entry>Diddle with the File Length</entry>
98
99 </row><row>
100 <entry spanname="all">This command displays the current file length, in Hex, then
101 allows you to change it. This is potentially very dangerous
102 (e.g. if you use it on loadable modules). If you just press
103 &lt;ENTER&gt; at the prompt, you will be returned to the command
104 mode (this is useful for just checking the file length). If
105 you enter a valid length (number of BYTES, not sectors,
106 in Hex), the file will be expanded or contracted to that
107 length. This is useful for stripping the Control-Z's ($1A)
108 off the end of files downloaded with the XModem protocol.
109 Remember, the LENGTH of a file is 1 greater than the number
110 of the last byte in the file (remember, counting from 0!)</entry>
111
112 </row><row>
113 <entry>E Command</entry>
114 <entry>EDIT the displayed Sector</entry>
115
116 </row><row>
117 <entry spanname="all">This is the heart of dEd. The cursor will appear over the
118 first byte or character in the LSN. If it's over the BYTE,
119 you can change the value by typing 2 new nibbles in Hex,
120 e.g. 6c. The display will be updated and the cursor will
121 move to the next BYTE. If the cursor is over the CHARACTER
122 part of the display, you can change the value by typing a
123 new ASCII character. Again, the display will be updated and
124 the cursor will shift to the next character. You switch
125 between the BYTE and CHAR modes at any time by hitting the
126 &lt;BREAK&gt; key, as noted at the bottom of the display. You
127 navigate through the sector to individual BYTEs or CHARs
128 using the 4 Arrow keys. The Right and Left Arrows wrap the
129 cursor around to the next or previous row on the display.
130 The Up and Down Arrows wrap around from top to bottom and
131 vice-versa. Once you are done Editting, pressing &lt;ENTER&gt;
132 will exit the Edit mode, as noted at the bottom of the
133 display. As with Zap, the sector is NOT written back to the
134 disk unless the Write command is then used (unless in Expert
135 mode). </entry>
136
137 </row><row>
138 <entry>F Command</entry>
139 <entry>FIND</entry>
140
141 </row><row>
142 <entry spanname="all"><para>This searches the file for a
143 given character or byte string
144 You will be prompted with 'Find byte string $'. Enter a
145 series of up to 16 Hex bytes, without spaces (you MUST
146 enter leading zeroes for the numbers 00 - $0F) then press
147 &lt;ENTER&gt;. The search begins at the start of the LSN
148 currently displayed. If a string is located that EXACTLY
149 matches the string you input, the LSN in which it is
150 located will be displayed, with the first byte/character in
151 the string highlighted. By pressing the &lt;BREAK&gt; key at the
152 prompt, you can toggle between the BYTE and CHARACTER
153 search modes. In the character mode, the prompt is 'Find
154 char string: '. Enter up to 16 ASCII characters, then press
155 &lt;ENTER&gt;. In this mode, dEd will locate any string that
156 matches the one you input, regardless of the Upper/Lower
157 case status of either string. As well, characters with bit
158 7 set (e.g. file names in directories) are treated as if
159 bit 7 was clear. If no matching string is found, you are
160 returned to the command prompt. If you enter an invalid
161 character or byte string, a beep sounds and the same prompt
162 is re-issued. If you just press &lt;ENTER&gt; at either prompt,
163 you will be returned to the command mode.
164 </para><para>
165 If you wish to abort a search in progress, just press the
166 &lt;BREAK&gt; key. This will simulate a "string not found" and
167 return you to the CMD: prompt.</para></entry>
168 </row><row>
169 <entry>H (or '?') Command</entry>
170 <entry>HELP</entry>
171
172 </row><row>
173 <entry spanname="all">This displays a Help screen. </entry>
174
175 </row><row>
176 <entry>L Command</entry>
177 <entry>LINK to a Module/LIST Modules</entry>
178
179 </row><row>
180 <entry spanname="all">If you are editting a file that consists of various
181 executable modules merged together (e.g. OS9Boot), this
182 command allows you to 'Link' to one of the modules. It will
183 be treated as if it is an individual file, i.e. the start of
184 the module will be displayed as LSN 0 and only THAT MODULE
185 will be accessible for display and/or Editting. The LSN
186 displayed is referenced to the MODULE, not to the main file
187 or the disk. You will be prompted with 'Link to which
188 Module? '. You may enter a valid name and press &lt;ENTER&gt;. If
189 that module can be located AND if it's header information is
190 correct, it will be 'Linked'. The top row of the display
191 reflects this by displaying the module name and it's offset,
192 in bytes, from the beginning of the main file. At the 'Link
193 to which Module? ' prompt, if you just hit &lt;ENTER&gt;, all the
194 valid modules and their offsets from the beginning of the
195 main file as well as their lengths, in bytes Hex, will be
196 Listed. Hitting any key after this redisplays the current
197 LSN. The Link mode is useful for changing a given byte in a
198 module using the offset one would use for Debug. For
199 example, to permanently change the printer baud rate, you
200 would call 'dEd /D0/OS9Boot'. Then hit 'L' for Link. At the
201 prompt 'Link to which Module? ', Type P and hit &lt;ENTER&gt;. If
202 P is in your OS9Boot file, the top row of the display will
203 have MODULE: P and give the offset of it from the beginning
204 of the OS9Boot file. Enter the Edit mode by hitting 'E'
205 then use the arrows to move the cursor to byte number 27
206 (row 20, column 7). Type in the new value for the baud rate
207 then hit &lt;ENTER&gt; to exit Edit mode. Hit 'W' to write the
208 sector, then 'V' to verify the modules. If a module is
209 linked, the 'Find' command only searches for strings in
210 that module.</entry>
211
212 </row><row>
213 <entry>N Command</entry>
214 <entry>Find Next occurrence of String</entry>
215
216 </row><row>
217 <entry spanname="all">This is used in conjunction with the 'Find' command. Once a
218 Hex byte or ASCII character string has been located with
219 'F', the next occurrence may be located by pressing 'N'.
220 This search starts where the 'Find' search left off, IF the
221 LSN hasn't changed since the string was initially located.
222 If the LSN has changed, the search starts at the beginning
223 of the current LSN. If the search is successful, the string
224 will be highlighted, as with 'Find', otherwise you are
225 returned to the command prompt, with a beep.</entry>
226
227 </row><row>
228 <entry>O Command</entry>
229 <entry>OPEN an Output File</entry>
230
231 </row><row>
232 <entry spanname="all"><para>You will be prompted with 'OUTFILE: '. Type in a file name
233 or path (that does not already exist) and press &lt;ENTER&gt;. A
234 new file will be created and opened, with the name
235 displayed on the second row of the screen. Individual
236 sectors can be written to this file using the Append
237 command.
238 </para><para>
239 To abort the O Command, just press &lt;ENTER&gt; or &lt;BREAK&gt;.</para></entry>
240
241
242 </row><row>
243 <entry>P Command</entry>
244 <entry>Push an LSN onto the Sector Stack</entry>
245
246 </row><row>
247 <entry spanname="all">This pushes the current LSN onto a funtional Stack of
248 sectors. The 'R' command then can remove (pull) them from
249 the Stack in the reverse order (Last In, First Out) that
250 they were pushed. Up to 16 LSN's can be saved on the Stack.
251 This is very useful when trying to reconstruct a deleted
252 file that was fragmented on the disk. By pushing each
253 sector examined onto the Stack, you can retrace your steps
254 backwards without having to remember the sector number of
255 each sector along the way.</entry>
256
257 </row><row>
258 <entry>Q Command</entry>
259 <entry>QUIT dEd</entry>
260
261 </row><row>
262 <entry spanname="all">This exits dEd immediately. You should be sure to Write any
263 Editted or Zapped sectors back to the disk before Quitting.</entry>
264
265 </row><row>
266 <entry>R Command</entry>
267 <entry>Remove an LSN from Sector Stack and Display</entry>
268
269 </row><row>
270 <entry spanname="all">This removes (pulls), from the Sector Stack, the last LSN
271 that was pushed (with the 'P' command) and displays it.</entry>
272
273 </row><row>
274 <entry>S Command</entry>
275 <entry>SKIP to a given LSN</entry>
276
277 </row><row>
278 <entry spanname="all">You will be prompted with 'LSN=$ '. Type a sector number (in
279 Hex) and press &lt;ENTER&gt;. That LSN will then be displayed, if
280 possible. If the LSN entered is greater than the last LSN in
281 the file, nothing will happen.</entry>
282
283 </row><row>
284 <entry>U Command</entry>
285 <entry>Unlink a Module</entry>
286
287 </row><row>
288 <entry spanname="all">This 'unlinks' a module that has previously been 'linked'
289 using the 'L' command. The first sector in the file (LSN 0)
290 is displayed. Using this command when no module has been
291 linked has no effect.</entry>
292
293 </row><row>
294 <entry>V Command</entry>
295 <entry>VERIFY All Modules</entry>
296
297 </row><row>
298 <entry spanname="all">This command calculates and writes a new CRC value for EACH
299 module in a fale. It must be used after Editting executable
300 modules or they will not be loadable. Verify is terminated
301 if an error is located in the header of a module, but each
302 module is verified individually and the CRC is rewritten to
303 each before moving to the next module in a file, so modules
304 in front of one with an error will be verified.</entry>
305
306 </row><row>
307 <entry>W Command</entry>
308 <entry>WRITE the Sector displayed to the Disk</entry>
309
310 </row><row>
311 <entry spanname="all">WARNING!!! This command can be very dangerous to the well-
312 being of your disk data. It writes the sector displayed
313 back to the disk (at the same location from whence it came,
314 but not necessarily with the same information, hence the
315 danger). After Zapping or Editting a sector, you must use
316 this command to make the changes on the disk (unless you're
317 in the Expert mode). Because you can effectively maim your
318 data with this command, you will be prompted with 'Are you
319 sure (Y/N)? '. If you hit any key other than 'Y' (or 'y')
320 the Write command will be aborted. Otherwise the sector will
321 be written, with the display advising you that dEd is
322 'Writing Sector...'. On a hard disk or RAM disk, this is
323 very quick.</entry>
324
325 </row><row>
326 <entry>X Command</entry>
327 <entry>EXPERT Mode</entry>
328
329 </row><row>
330 <entry spanname="all">This command is potentially the most dangerous of all. It
331 should be used only by those who are very brave (fools?) or
332 those who never make mistakes. In this mode, any sectors
333 changed by Edit or Zap will be automatically written to the
334 disk. The Write command is not needed, and is inactivated in
335 the Expert mode. Any errors made during Edit or Zap WILL be
336 transferred to the disk, making this mode very good for
337 crashing directories, etc. Having noted this, there is one
338 route of escape from errors made in this mode. After
339 Editting or Zapping a sector, the sector is not actually
340 written back to the disk until after Edit or Zap is exitted
341 and the next command is issued (i.e. the next Command Key is
342 pressed). If you hit Shift-BREAK , before hitting any other
343 Command Key, the automatic Write will not occur. You must
344 type Shift-BREAK before any other command or the sector will
345 be written to the disk. This is a one-time escape, so any
346 further errors made will require hitting the Shift-BREAK key
347 again at the appropriate time to avoid writing the bad
348 sector to the disk. Unless you fully understand the OS-9
349 disk structure (or enjoy toying with the life of your data),
350 this mode should probably be avoided. It is entered after
351 responding with a 'Y' or 'y' to the 'Are you sure (Y/N)?'
352 prompt, and the display advises you that you are in this
353 mode. The 'X' command is a toggle switch, so to exit Expert
354 mode, just hit 'X' again and the 'Expert Mode' message will
355 be erased.</entry>
356
357 </row><row>
358 <entry>Z Command</entry>
359 <entry>ZAP the displayed Sector</entry>
360
361 </row><row>
362 <entry spanname="all">You will be prompted with 'Zap Byte: ' or 'Zap Char: '.
363 Enter either a Hex byte (e.g. 6c) or an ASCII character
364 (e.g. $) and press &lt;ENTER&gt;. That byte or character will be
365 written to the ENTIRE SECTOR. You can toggle between the
366 BYTE/CHAR modes by hitting the &lt;BREAK&gt; key. In the CHAR
367 mode, hitting ALT-Char then &lt;ENTER&gt; will Zap the sector with
368 that char with bit 7 set. Unless you're in the Expert mode,
369 only the buffer will be Zapped with the Zap command. To put
370 this Zapped sector on the disk, you must use the Write
371 command. If you decide not to Zap the sector, just hit
372 &lt;ENTER&gt; without first entering a byte or character. You can
373 redisplay a sector that has been Zapped, but not Written
374 back to the disk, by going to the next LSN using the Up
375 Arrow, then returning to the original LSN with the Down
376 Arrow (again, provided you're not in the Expert mode). </entry>
377
378 </row><row>
379 <entry>$ Command</entry>
380 <entry>Fork a SHELL</entry>
381
382 </row><row>
383 <entry spanname="all">A new Shell is forked to allow access to OS-9 without
384 terminating dEd. To return to dEd, press Ctrl-BREAK (ESC).</entry>
385
386 </row><row>
387 <entry>&lt;CR&gt; Command</entry>
388 <entry>Clean up screen display</entry>
389
390 </row><row>
391 <entry spanname="all">Pressing &lt;ENTER&gt; at the CMD: prompt will clear and re-write
392 the screen which may have been trashed by an error. Current
393 editing to the displayed sector is not lost or written. This
394 command only resets the screen display.</entry>
395 </row>
396 </tbody>
397 </tgroup>
398 </table>
399
400 </article>