BED the Binary EDitor program. Apologies This is a preliminary version of the documentation for BED. The program has grown haphazardly over a number of years and I tend to add options as I need them for various tasks, therefor, not all of the options available are described here as yet. Introduction This program allows the user to examine or edit either disk sectors, files, or memory. The user may switch between these types of editing at any time by either pressing or selecting the appropriate option in the file menu. The program reads information in 512 byte blocks which may be examined and modified. The program will also disassemble from a file, memory, or directly from disk. Additional facilities are available depending on the type of editing currently being performed. BED will run in either HIGH or MEDIUM resolution. LOW resolution is not supported. Getting started On first loading BED displays a blank desktop with a menu bar at the top of the screen. You can now open an edit window by selecting OPEN in the file menu. A dialog box will now be displayed from which you should select the type of editing to be performed. Once a window has been opened a number of icons will be displayed at the bottom of the screen. On the bottom left of the screen is a data entry box where commands are entered. The icons on the right of the screen contain two arrows, clicking on the left hand arrow will display the previous block the right hand arrow displays the next block. To print any information currently displayed click on the printer icon (this works with most of the INFO dialogs as well). The EDITING windows BED can display either a full screen of 512 bytes of data in either HEX or ASCII, or a combined screen of 256 byes of data in both HEX and ASCII. Toggling display modes between HEX/ASCII and 'combined' is accomplished by pressing . When in HEX/ASCII mode pressing switches between the HEX and ASCII displays. When in 'combined' mode the data displayed is selected by moving the vertical scroll bar. Clicking with the mouse on the grey area above the scroll bar, displays bytes 0 to 255, and clicking below the scroll bar, displays bytes 256 to 512 of the current block. The highlighted byte in the window is the 'hot-spot' where any modification will be performed. This 'hot-spot' may be selected by either clicking the mouse over the relevant byte or by using the arrow keys. Moving from block to block within the editors domain. By pressing the <+> or <-> keys, or by clicking on the arrow pointer icons on the desktop BED will read & displayed the next or previous block respectively. Normally these actions will read and display the next or previous 512 bytes. However, the number of 512 byte blocks moved by these actions can be changed in the Options menu. Pressing displays the first block and pressing displays the last block. You may move to a random block by pressing and entering the block number you wish to move to. Alternatively, by pressing and entering a number BED will display the block that contains the relative byte number entered. Numeric Input. Numbers may be entered as either decimal, hexadecimal or octal. Numbers of the type 0x12ef or $12ef are assumed to be hex, and of the type 01277 octal, otherwise the number is assumed to be decimal. If you want to work in hexadecimal you may 'force' hex input by selecting that base in the Set Options Menu, after which the 0x or $ prefix should be omitted. Any number entered may be preceded by +, -, *, /, |, &, or ^, and if so, the entered number will be relative to the current context: EXAMPLES If the currently displayed block is 100 entering +6 will display block 106 and entering -0x10 will display block 84. Assuming that the 'hot-spot' is byte 22 of block 2 then by entering +615, the 'hot-spot' becomes byte 125 of block 3. When editing a block with the 'hot-spot' positioned over a byte of value 16, then by entering -010 the byte's value is changed to 8. Assuming that the 'hot-spot' is over byte of value 31 then: |32 changes the value to 63. &67 changes the value to 3. ^125 changes the value to 97. +3 changes the value to 34. -3 changes the value to 28. *2 changes the value to 62. /2 changes the value to 15. Editing. The currently displayed block may be edited in either NUMERIC or ASCII by selecting the appropriate item in the Edit menu (the default is numeric). After selecting numeric, modifications are performed by entering new numeric data for the highlighted byte. ASCII modifications are performed by direct typing from the keyboard ( or inserts a LF/CR pair). If you make a mistake whilst entering data pressing will restore the last byte changed to it's previous value. Should you wish to undo the effect of a number of changes press . This will re-read the currently displayed block. Saving changes Pressing will write the current block back to disk, file, or memory. If you attempt to move to a different block without saving any modifications BED will offer you chance to save the current block before reading the new block. Hardcopy. Clicking on the printer icon on the desktop will send a listing of the currently displayed block to the printer. In addition, the data presented in most of the INFO dialogs can also be printed by clicking on the printer icon. Printing may be terminated by pressing Disassembly. The disassembler can be used to disassemble a file, memory, or directly from disk. It is entered by pressing . A new location to disassemble from may be specified by entering the address to disassemble from. Clicking on the arrow icons displays the previous or next 16 instructions. By clicking on the address value of a jump statement BED will start disassembly from that address. If you also hold down the key when you close the disassemble window the edit/display window will move to the highlighted instruction. The MENUS The File Menu OPEN - Keyboard shortcut Open a new editing window - You can have a maximum of two editing windows open at the same time. Run ... Run another program from within BED. Disk - keyboard shortcut Reopens top window for disk editing. File - keyboard shortcut Reopens top window for file editing. Memory - keyboard shortcut Reopens top window for memory editing. Format Format a floppy disk. Quit - keyboard shortcut Terminate program. The Edit menu Numeric - Edit in numeric mode. ASCII - Edit in ASCII mode. Searching. Selecting FIND in the Search menu allows you to search memory, disk or file for a HEX or ASCII string. Hex searches are always case sensitive. However, uppercase and lowercase distinctions will be ignored in ASCII searches if the ignore case flag is set. A search in progress may be terminated by pressing . The INFO dialogs. Once an edit window has been opened, additional information concerning the FILE, DISK or MEMORY is available by selecting Info in the Options drop-down menu. In the upper left corner of some of the dialog boxes a small drawing pin graphic is displayed. This indicates that further information is available from the dialog. Clicking on it will change its shape and active status. When the pin is active, dialogs, disassembly windows, and tree structure windows become nested. Closing a window or clicking on exit in a dialog box will return you to the dialog box you started out from. When editing a file the INFO dialog will show you the file's name, size, last modification time, and whether the file is read-only and/or hidden from normal directory searches. Using this dialog it is possible to rename the file and/or change its attributes. The disk editing INFO dialog displays the disk's volume name, the BIOS parameter block for the disk, and the amount of free space available on the disk. Addition options are available from this dialog. If you hold down the key when closing the disk structure window the editor moves to the sector of directory highlighted. The memory editing INFO dialog displays a number of parameters associated with your ST. From this dialog you can examine a number of the internal addresses and the state of most of the hardware chips. If an address displayed is an address of a subroutine double clicking on it will enter the disassembler at that address. KEYBOARD COMMANDS File: Alt-E Change edit type for window. Alt-O Open a new edit window. Alt-Q Quit program. Ctrl-W Save changes to the current block. Movement: Alt-R n Read logical block. Alt-B n Go to logical byte. Numeric input: [+,-]n Add/subtract n to current value. [*,/]n Multiply/divide current value by n. [|,&,^]n Or/And/Xor current value by n. Searching: Alt-F Bring up the search dialog. Alt-N Search for next occurance. Disassembly: Ctrl-D Start disassembly.