BEAV Binary Editor And Viewer Manual Copyright 1991 Version 1.20 March 13, 1991 By Peter Reilley 19 Heritage Cir. Hudson, N.H. 03051 pvr@wang.com BEAV source and executable can be freely distributed for non-commercial purposes. BEAV User Manual Table of Contents 1. Introduction 2. Overview 2.1 Terms and Definitions 2.2 The Screen Format 2.3 Display Modes 2.4 Commands 2.5 Buffers 2.6 Files 2.7 Key Binding 2.8 Configuration 3. Command Description 3.1 Help 3.2 Cursor Movement 3.3 Buffer Management 3.4 File Management 3.5 Window Management 3.6 Inserting and deleting 3.7 Search and Replace Commands 3.8 Exiting BEAV 3.9 Printing 3.10 Keyboard Macros 3.11 Key Binding 3.12 Special Functions 4. Alphabetical list of commands by name 5. Alphabetical list of commands by default key binding 6. Release notes - 2 - BEAV User Manual 1.0 Introduction BEAV is an editor that brings the features of a powerful full screen editor to the editing of binary files. It is the only editor that I know of that does that. When you need to edit a non-text file you generally have two choices; a text editor or a file zap type editor. Each choice has significant disadvantages. Text editors expect the file to be formatted in a certain way. At a minimum they expect that all lines be terminated by a carriage return or line feed and be limited in length. There is no line length limit with BEAV. Most text editors get confused by bytes that are outside of the normal range (20 to 7E HEX). In BEAV no special characters such as carriage return or line feed affect the display aside from producing their numeric value. BEAV can edit any file no matter the format. The other choice is to use a file zap type editor which can edit a binary file without difficulty. These editors are often very limited in their features and capabilities. Most file zap programs can edit a file only in HEX or ASCII. They generally operate on a sector basis and because of this they cannot insert or delete data in the middle of the file. All these limits are eliminated in BEAV. You can edit a file in HEX, ASCII, EBCDIC, OCTAL, DECIMAL, and BINARY. You can search or search and replace in any of these modes. Data can be displayed in BYTE, WORD, or DOUBLE WORD formats. While displaying WORDS or DOUBLE WORDS the data can be displayed in INTEL's or MOTOROLA's byte swap format. Data of any length can be inserted at any point in the file. The source of this data can be the keyboard, another buffer, or a file. Any data that is being displayed can be sent to a printer in the displayed format. Files that are bigger than memory can be handled. Some users may recognize the similarity to the EMACS text editor that was written by Richard Stallman at MIT. This is not a coincidence. I attempted to keep as much of the user interface and functionality as possible given the very different tasks of EMACS and BEAV. - 3 - BEAV User Manual 2. Overview 2.1 Terms and Definitions Throughout this manual certain terms will be used to describe the operation and structure of BEAV. The data that BEAV is editing is held in a buffer that is structured as a byte stream. There are many commands that affect the way that this byte stream is displayed on to the screen. Whatever display mode is chosen the data in the buffer is not effected, only the presentation. One such choice is to display the data as bytes, words, or double words. That is; 8 bit values, 16 bit values, or 32 bit values. Whatever choice is made the value of the selected size will be displayed. These values are referred to as units in this manual. Thus the 'delete-forw-unit' command deletes the unit under the cursor. If 32 bit units are being displayed then 4 bytes will be deleted. Many commands in BEAV start by pressing the 'ESCAPE' key. When this manual refers to a command that requires that the 'ESCAPE' key be pressed it will be abbreviated with 'Esc'. Another frequently used key stroke to start commands is 'CONTROL X'. This in done by pressing the 'CONTROL' key then pressing the 'X' key at the same time. In this manual this will be abbreviated by 'Ctl-X'. Many commands contain other control characters and these will be abbreviates similarly. Thus the 'insert-unit' command will be listed as 'Ctl-X I'. This will be entered by pressing the CONTROL key and while holding it hitting the 'X' key, release the CONTROL key then hit the 'I' key. 2.2 The Screen Format BEAV presents information to the user in a number of areas. The first is the window. There will be at least one window displayed on the screen at all times. The window consists of two areas. The first is the display area. This is where the data that is in the buffer is displayed. Most of the time the cursor will be in this area, as this is where most editing is done. Each line in the display area will start with a number that indicates the offset into the buffer for this line of data. At the bottom of the display area for each window is the status line. - 4 - BEAV User Manual The status line presents the user with a number of specific pieces of information. The first is the program name which is "BEAV". Next there are some flags indicating the status of this particular buffer. The first flag indicates if the buffer has been damaged by a memory allocation failure. If there is a '?' then the buffer is bad, otherwise there will be a space. Bad buffers are set to read only. The next flag indicates if the buffer has been changed and will need to be written out if the changes are to be saved. This flag is a '*' if the buffer has been changed, otherwise there will be a space. The next flag indicates insert/overstrike mode; 'I' for insert, 'O' for overstrike. This is only meaningful in ascii or ebcdic mode. Then the buffer name followed by the file name. A window can be in read only, read/write, or read/write with size lock. These will be displayed as [RO], [RW], or [WL] respectively. If auto-update is enabled then [AU] will be displayed. Next the cursor position in bytes and the character position within the unit. The next piece of information gives the format that the data is being displayed in; HEX, OCTAL, DECIMAL, BINARY, ASCII, EBCDIC. If a data mode is selected then the size in bytes (1, 2, 4) is displayed. If the data is being displayed in Intel mode then the swapped flag is displayed, 'S'. Lastly the byte shift is displayed; 0 only for 8 bit data, 0 or 1 for 16 bit data, or 0, 1, 2 or 3 for 32 bit data. There can be multiple windows on the screen at the same time but each window will have a status line at the bottom. The very bottom line on the screen is the prompt line. This is where you enter data that BEAV requests. If you want to edit a new file you would type 'Ctl-X Ctl-V', BEAV would respond with "Visit file:" on the prompt line. The cursor would be positioned after the prompt. You would then enter the name of the file that you wished to edit. - 5 - BEAV User Manual If you entered the command by mistake, you can abort the operation by typing a 'Ctl-G'. 'Control G' is a universal abort command and can be used anywhere. If you want to perform a search you will enter the search string on this line. When you have entered the information that BEAV has requested hit 'Return' and the cursor will return to it's original position in the window display area. The prompt line is also where error messages are displayed. - 6 - BEAV User Manual 2.3 Display Modes The data in the buffer can be displayed in a number of formats. First there is the display mode. This can be either; HEXADECIMAL, DECIMAL, OCTAL, BINARY, ASCII, or EBCDIC. If ASCII or EBCDIC mode is chosen then each byte in the buffer will be converted to it's ASCII or EBCDIC character and displayed. Bytes that are outside of the standard character set will be displayed as a dot. Each line will be 64 characters long. The byte value for "carriage return" and "line feed" will be displayed as a dot as any other non-printable characters. Within HEXADECIMAL, DECIMAL, OCTAL, or BINARY format the data can be displayed in 8, 16 or 32 bit values. If 16 or 32 bit values are displayed the user can choose to view these values in either the Intel format or the Motorola format. If Intel format is chosen then the first byte in each unit is the least significant byte when the value is calculated. Thus in hex 32 bit mode a byte string of "32 7A 9F 10" would be displayed as "109F7A32". If Motorola format is chosen this value would be displayed as "327A9F10". There is another display format choice that affects the 16 or 32 bit formats. This is called shift. The shift can be 0 or 1 for 16 bit modes, or 0, 1, 2, 3 for 32 bit modes. Shift moves the zero point reference for the buffer up by the selected value. The default is zero shift. If a buffer is displaying the following 32 bit hex data; "12345678 2F4792AF 673DFEA1 88551199" with the shift at 0. Changing shift to 1 will produce; "3456782F 4792AF67 3DFEA188 55119955" The data has been slid down toward the beginning of the buffer by one byte. This has not changed the data in the buffer at all, it has only affected the way that the data is presented on the screen. This is useful when looking at WORD or DOUBLE WORD data that is not aligned on two or four byte boundaries. When BEAV is first started or a new window is opened the default format is HEXADECIMAL BYTES. - 7 - BEAV User Manual 2.4 Commands Commands are the means that the user controls the operation of BEAV. A command can be given by using one of two methods. The first is to use the key binding. A command can have one or more associated key bindings. It can also have no key binding. There are a set of default key bindings that BEAV comes configured with. The current set of key bindings can be seen by using the 'help' command. The 'help' command is 'Esc ?' or Function Key 1 'F1' on the IBM PC. The help buffer can be scrolled by using the up and down arrow keys. A printed copy may be obtained by going to the bottom of the help buffer using the 'move-to-end' command ('Esc >' or the 'End' key). Then issue the 'print-mark-to-cursor' command ('Esc P' or 'Ctl-Print') and enter 'PRN' or a file name when prompted with "Print to:". This will output the entire help buffer to a printer connected to the parallel interface or the specified file. The second method of issuing a command is to use the 'extended-command' command (Esc X). You are prompted for a command name that you want to execute. This method is useful for executing commands that have no key binding. 2.5 Buffers Buffers are the in memory storage for all data editing and viewing. Each buffer has a name that appears in the mode line. Buffers generally have a file name that is associated with them. The file name also appears in the mode line. The buffer name and the file name are independent but the buffer name defaults to the file name. The buffer name is used to refer to a specific buffer. The 'change-buffer' ('Ctl-X B') command will prompt you for a buffer name. After you enter a buffer name that buffer will be displayed in the current window. If there is no such buffer, one will be created and displayed (it will be empty). When BEAV is run with a file name as a command line parameter, the file is read into a new buffer. The buffer name will be made the same as the file name. The file name is only used when the buffer is saved. If the file name is changed using the 'buffer-set-file-name' ('Ctl-X Ctl-F') command then when the buffer is saved it will be saved to the new file. - 8 - BEAV User Manual Buffers are dynamically allocated. They grow or shrink as the size of the data they contain changes. The buffer size can be frozen using the 'buffer-size-lock' ('Ctl-X Ctl-L') command. This prevents inserting or deleting data from the buffer but data can be modified. Buffers continue to exist even if they are not being displayed. Buffers are saved in a linked list that can be stepped through using the 'change-to-next-buffer' ('Esc +') or 'change-to-prev-buffer' ('Esc -') commands. If the 'change-to-next-buffer' command is given then the next buffer in the list is displayed in the current window. 2.6 Files Files are the means of storing data on disk. Files or segments of files can be loaded into BEAV for editing or viewing. The file on the disk has not been changed until BEAV does a save to that file. When a save to a file is performed the original file contents in saved in a ".bak" file. - 9 - BEAV User Manual 2.7 Key Binding All commands in BEAV have a command name and a default key binding. The bindings may be changed to suit personal preference by using the 'bind-to-key' ('Esc K') command. The current binding of a key sequence can be displayed by using the 'binding-for-key' ('Ctl-X ?') command. Key bindings can be loaded automatically from a file named "beavrc". This file must be in a directory specified by the PATH environment variable. When BEAV is started this file is read and the bindings are loaded. This file is a simple text file and can be edited to make changes. The beavrc file contains three columns. The first is the function name to be bound. The second is the key sequence that is bound to that function. The third is a number that defines the key code. Then the beavrc file is read in only the first and third columns are used. The simplest way to create a valid beavrc file is to first bind the key codes to the desired functions using the bind-to-key command. Next display the current bindings in a window using the help command (Esc ?). Now save that buffer to a file with the file-write command (Ctl-X Ctl-W). You will be prompted for a file name. This is a valid beavrc file. You may want to edit the beavrc file to remove the commented lines, those beginning with #, to make it load faster. On unix systems there can be multiple beavrc files, one for each terminal type. This is accomplished by appending the TERM variable to beavrc. Thus if you use both a vt100 and a wyse60 terminal, you could have a beavrc.wy60 and a beavrc.vt100 bindings file. When your TERM variable is TERM=wy60 then the beavrc.wy60 bindings file will be used. If there is no beavrc.wy60 file then the beavrc file will be used. 2.8 Configuration When the MSDOS version of BEAV run it detects whether the system is an IBM PC or a clone. If a PC is detected then a set of key bindings that use the 10 function keys and the relevant keypad keys are loaded. If the system is not recognized then only the standard bindings are loaded. - 10 - BEAV User Manual If a PC is detected the screen is managed by making BIOS level calls that enhance performance. Otherwise, the screen is controlled by making ANSI compatible calls to the operating system. This is much slower but is not sensitive to hardware configuration. This requires that non-standard MSDOS systems support ANSI display controls. The following ANSI escape sequences are used; Position cursor ESC [ ; H Erase to end of line ESC [ 0 K Erase to end of page ESC [ 0 J Normal video ESC [ 0 m Reverse video ESC [ 7 m On unix systems the termcap library is used. This requires that the TERM environment variable be set correctly. - 11 - BEAV User Manual 3. Command Description This section describes all BEAV commands as to their function and any side effects that they may have. The first line of each description of a command will begin with the default key binding then the command name and follows with the key binding for a PC for the MSDOS version. 3.1 Help This command returns information that will aid in the use of BEAV. Esc ? help F1 A new window is opened by splitting the current window then all current key bindings are displayed. This buffer is larger than can be shown at one time and must be scrolled up and down to see all entries. All commands that do not alter data can be used to move around and search the help buffer. To leave the help buffer use the 'window-delete' command ('Ctl-X 0'). Lines that begin with the comment character (#) are commands that have the default bindings. Lines without the comment character have been bound by the user or by processing a beavrc file. The comment character helps in creating a beavrc file by identifying only those bindings that have changed. - 12 - BEAV User Manual 3.2 Cursor Movement There are a number of commands that move the cursor around the current window. If the cursor bumps the top or the bottom of the window the position of the window will be adjusted so as to keep the cursor within the bounds. When the window is moved in response to cursor movements it is moved by about one third of the window size. This improves performance by reducing the number of window moves. Ctl-P move-back-line North (up arrow) Ctl-N move-forw-line South (down arrow) These commands move the cursor up one line or down one line. If the cursor is on the top line in the buffer and a 'move-back-line' command is given the cursor will jump to the beginning of the first unit in the buffer. If the cursor is on the last line of the buffer and a 'move-forw-line' is given the cursor will move to the last unit in the buffer. Ctl-F move-forw-char East (right arrow) Ctl-B Move-back-char West (left arrow) These commands move the cursor forward or backward in the current line. If the cursor is at the first character in the first unit of the line and the 'move-back-char' command is given then the cursor will wrap to the last character of the previous line. If the cursor is at the last character of the last unit in the current line then it will wrap to the first character of the next line. Esc F move-forw-unit Ctl-East Esc B move-back-unit Ctl-West These commands are similar to the above set but they move the cursor by units rather than characters. The command 'move-forw-unit' will position the cursor to the first character of the next unit. The command 'move-back-unit' will move the cursor to the first character of the previous unit. Ctl-V move-forw-page PageUp Esc V move-back-page PageDown These commands move the move the data in the window by the number of lines in the window less one. The cursor will stay in the same position relative to the window as the data is moved. - 13 - BEAV User Manual Esc < move-to-beginning Home Esc > move-to-end End Move the cursor to the beginning or the end of the buffer. Ctl-X G move-to-byte F9 Prompt for a byte offset, then go to that position in the current buffer. Ctl-X Ctl-N move-window-down Ctl-Z Ctl-X Ctl-P move-window-up Esc Z Move the buffer in the window up or down by one line. This does not effect the cursor until it hits the top or bottom of the window. Esc . mark-set F2 Set the mark position to the current cursor position. The mark position is remembered even for nonactive windows and buffers. Ctl-X Ctl-X swap-cursor-and-mark The position of the cursor and the position of the mark are swapped. Esc L window-link This command causes all windows that are displaying the contents of the current buffer to have the same cursor position. Thus if one window is scrolled then all other windows that display that buffer are scrolled so as to keep the cursor in the window. Ctl-X = show-position The current position of the cursor and the mark are displayed. The buffer size, file size and file name are also shown. - 14 - BEAV User Manual 3.3 Buffer Management Buffers store all data that is being edited. The only limit to the number of buffers is the size of available memory. If a file is loaded into a buffer and there is insufficient memory to hold the entire file, then it will be loaded until memory is exhausted. The buffer will then be set to read only mode. Ctl-X Ctl-B buffers-display Ctl-F1 A new window is opened and a list of all buffers in BEAV is displayed. The list contains the buffer name, the file name (if it exists), the buffer size, and a state flag. If the list is too large for the window, you can go to that window and scroll the list. Ctl-X B change-buffer Ctl-F2 This command prompts you for a buffer name. If you enter the name of an existing buffer, that buffer will be displayed in the current window. If the name does not match an existing buffer, a new buffer will be created and displayed. This buffer will be empty and will have no file name. Esc + change-to-next-buffer Ctl-F4 Esc - change-to-prev-buffer Ctl-F5 The next or the previous buffer in the buffer list is displayed in the current window. This does not effect buffers that are displayed in other windows. Esc G move-to-buffer-split Prompt for a buffer name. Then split the current window and display that buffer, creating it if necessary. Esc Ctl-N buffer-set-name Esc Ctl-N The current buffer name is changed to the name that you enter. This does not effect the file name. Ctl-X Ctl-F buffer-set-file-name Ctl-F7 The file name of the current buffer is changed to the name that you enter. This does not affect the buffer name. - 15 - BEAV User Manual Ctl-X K kill-buffer Ctl-F3 This command prompts you for a buffer name. This buffer is then deleted. If the buffer is currently being displayed you are prompted for conformation. If the buffer has been changed you are again prompted for conformation. Ctl-X Ctl-L buffer-size-lock The buffer size is prevented from being changed. Data can be edited but only by changing the existing data. If a buffer is copied into a size-locked buffer the operation well be successful but will overwrite existing data. This command toggles between locked and unlocked. Esc Y yank-buffer Ctl-F6 Data from one buffer is inserted into the current buffer at the cursor position. You are prompted for the name of the buffer to copy from. Esc O save-mark-to-cursor Prompt for a buffer name. Create a new buffer with that name and write the data from the mark to the cursor into that buffer. - 16 - BEAV User Manual 3.4 File Management These commands control BEAV's access to files. Files are loaded into buffers or are written from buffers. Commands that prompt for a file name also accept range parameters. Range parameters are always given in the numeric base of the current window. Thus if you are displaying data in decimal format then the range parameters must be entered in decimal. The size of a file read or write can be limited by specifying a range. The range parameter specifies the offset into the file, not the buffer. Range parameters can be specified in these forms; + The first form causes the read or write to begin from the value until the end of the buffer on write or the end of the file on read. The second form reads or writes from until non-inclusive. The third form reads or writes from for bytes. Thus, if the command 'file-read' is given and you enter at the prompt; main.obj 1000 +100. If the current display mode is hex, the file "main.obj" will be read from hex byte address 1000 to 10FF into the buffer. Ctl-X Ctl-R file-read Sh-F2 Prompt for a file name and read that file into the current buffer. This overwrites the current contents of the buffer. The buffer name is not changed but the buffer file name is set to the new file name. Ctl-X Ctl-S file-save Sh-F3 Write the current buffer out to the file if it has been changed. If the buffer has not been changed then do nothing. - 17 - BEAV User Manual Ctl-X V file-view Prompt for a file name and read file into a new buffer and display in current window. Set to read-only mode. Ctl-X Ctl-V file-visit Sh-F4 Prompt for a file name. If the buffer already exists then display it in the current window. Otherwise, read file into a new buffer and display in current window. If there is no such file then create it. Esc U file-visit-split Same as above but split current window and display new buffer. This displays the new buffer as well as the old buffer. Ctl-X Ctl-W file-write Sh-F5 Prompt for a file name, then write the current buffer to that file. Ctl-X Tab insert-file Sh-F8 Prompt for a file name and insert that file into the current buffer at the cursor position. Ctl-X Return save-all-buffers Sh-F6 Write all buffers that have been changed to their respective files. - 18 - BEAV User Manual 3.5 Window Management BEAV presents information to the user in one or more windows. Each window is a view into a buffer where the data is actually stored. The window controls how this data is formatted for display to the user. Data can be displayed as HEX bytes, OCTAL bytes, ASCII characters, plus many others. The display format is associated with the window. Thus if a new buffer is displayed in the current window that new data will be displayed in the current windows format. The only limit to the number of windows is the screen size. A window can be no smaller than two lines. This along with the mode line associated with each window limits to eight the number of windows on an IBM PC 25 line screen. Any window can view any buffer including having many windows on the same buffer. For example, two windows can display the same buffer but present the data in two different modes. One window could display HEX bytes and the other could display ASCII characters. Ctl-P change-window-back Ctl-PageUp Ctl-N change-window-forw Ctl-PageDown These commands move the cursor to the next or previous window on the screen, making it the current window. Ctl-X Z window-enlarge Ctl-X Ctl-Z window-shrink Enlarge or shrink the current window size by one line. Esc ! window-reposition Move window position so that the cursor is centered in the window. The cursor position in the buffer does not change. Ctl-X 2 window-split Split the current window into equal parts. Both haves have the same display mode and view the save buffer. Ctl-X 1 window-single Expand the current window to fill the entire display, all other windows are removed. Make the current window the only window displayed. This has no effect on the underlying buffers except that they may not be displayed any more. - 19 - BEAV User Manual Ctl-X 0 window-delete Delete the current window and expand the upper window to fill the space. This has no effect on the underlying buffer except that it may not be displayed any more. Esc Ctl-A display-ascii Esc Ctl-E display-ebcdic Esc Ctl-H display-hex Esc Ctl-O display-octal Esc Ctl-D display-decimal Esc Ctl-B display-binary These commands set the window display mode. Text buffers can be displayed as ASCII or EBCDIC characters. Buffers that are not human readable can also be displayed in hexadecimal, octal, decimal, or binary format. Esc 1 display-bytes Esc 2 display-words Esc 4 display-double-words As a further option on the non-text display modes, data can be displayed as 8, 16, or 32 bit values. Ctl-E display-swap-order When data is displayed as words or double words the order of significance can be changed. In Intel microprocessors the least significant byte of a word is stored at the lowest address. Thus if the word 5892 (HEX) were stored at memory address 10, then 92 (HEX) would be stored at address 10 and 58 (HEX) would be stored at address 11. In Motorola microprocessors the reverse is true. This command toggles between the Intel and Motorola schemes of assembling bytes into words and double words. This command has no effect on byte display or on the text display modes. The data in the buffer is not changed. Ctl-A display-byte-shift This command changes the offset from the beginning of the buffer used to assemble words and double words. The default shift is 0. For example, a double word at address 10 is made up of the bytes at address 10, 11, 12, and 13. With a shift of 1 that double word would be made of bytes 11, 12, 13, and 14. With a shift of 2 then bytes 12, 13, 14, and 15 would be used. The maximum shift in word display mode is one and the maximum shift in double word mode is three. - 20 - BEAV User Manual The buffer is in effect shifted toward the beginning of the buffer with 1, 2, or 3 bytes becoming not visible. These bytes are not lost, they become visible when the shift is set to zero. This command cycles through all possible shift values. There is no effect in any byte display mode or any text display mode. - 21 - BEAV User Manual 3.6 Inserting and deleting These commands are the core of BEAV. These commands allow the buffer to be edited in a similar fashion to a text editor. BEAV has an insert mode much the same as text editors but it only works when displaying data in one of the text modes, either ASCII or EBCDIC. In other modes it doesn't make any sense to insert characters as they are typed when there is more than one characters per unit. In the data modes there is a command that inserts a unit of zeros into the buffer. Similarly the delete commands always delete a unit rather than a character. In a text mode the delete commands work as in a text editor because a unit is a character. Ctl-X I insert-unit Insert a zero at the cursor position. The rest of the data moves down one place. Thus, if double words are being displayed, four bytes are inserted before the cursor position. These bytes are initialized to zero. This command works in all display modes. Ctl-X Ctl-A insert-toggle Insert In either of the two text modes this command toggles between insert mode and overwrite mode. In insert mode each character that is typed is inserted in front of the cursor and the rest of the buffer is moved down. In overwrite mode the typed characters replace the character that is at the cursor. This command has no effect in a non-text display mode. Ctl-Q insert-literally Esc Q This command sets a special temporary mode where the next typed character is inserted in the buffer no matter what the character is. This allows control codes to be inserted in the buffer when in a text display mode. Alternatively the same byte could be inserted into the buffer by using one of the data display modes. It might be faster to use this command on some occasions. Ctl-T unit-twiddle The unit at the cursor is swapped with the previous unit. - 22 - BEAV User Manual Rubout delete-back-char Backspace This command deletes the character before the cursor and pulls the rest of the buffer back. The cursor remains on the same character as it moves back. It only works in the text and byte display modes. Ctl-D delete-forw-char Delete The character at the cursor is deleted and the buffer is pulled back. The cursor remains at the same position. It only works in the text and byte display modes. Esc Rubout delete-back-unit Esc Ctl-K This command deletes the unit before the cursor and pulls the rest of the buffer back. The cursor remains on the same unit as it moves back. Esc D delete-forw-unit The unit at the cursor is deleted and the buffer is pulled back. The cursor remains at the same position. Esc W copy-mark-to-cursor F7 The area in the buffer from the mark to the current cursor position is copied into the kill buffer. If the mark is not set before this command is given an error is reported. Ctl-W delete-mark-to-cursor F8 The area in the buffer from the mark to the current cursor position is deleted and placed into the kill buffer. If the mark is not set before this command is given an error is reported. Ctl-Y yank F6 The contents of the kill buffer is inserted into the buffer at the cursor position. The kill buffer itself is not changed. - 23 - BEAV User Manual 3.7 Search and Replace Commands BEAV has very powerful search and replace commands. The search and replace string can be entered in any of the display modes. The search and replace strings can each be up to 256 bytes long. The display mode can be changed at any time while entering the string. Wild cards can be placed down to the bit level on both the search and replace strings. The wild card character, '?', will match any value that it is compared with. When a wild card is placed in the replace string it leaves the destination data unchanged at that position. Thus, if the destination contains the ASCII string '41 42 43 44' and the replace string contains '66 67 ?? 69' the result would be '66 67 43 69'. Wild cards can be placed in any position that makes sense. If you want to use wild cards in an ASCII string then you must switch to another mode to enter them. You can then switch back to ASCII mode. In this case a '?' will appear in the position where the wild card has been placed but it appears exactly the same as a standard question mark. In fact if you type a '?' over the wild card there will be no apparent change. However, the character will no longer be a wild card but a standard question mark. To see the true wild cards you must use a data display mode. In fact if the wild card has been set on the bit level then you must go to binary display mode to see its actual position. The commands to change the display mode in search and replace are the same as for the window display mode. The search and replace strings can be scrolled back an forth and the cursor moved using the same commands as for the window. While performing a replace command you can switch between the search string and replace string by using the 'move-back-page' or 'move-forw-page' commands. Esc S search-forw F3 Prompts for a search string then searches from the current cursor position for the first match. The cursor is positioned at the first unit of the match. Esc R search-back This command is the same as the previous one except that it searches backward. - 24 - BEAV User Manual Esc T search-again F4 This command repeats the previous search command, forward or backward. The cursor is first moved one byte in the appropriate direction before the search is repeated. Esc % replace F5 Prompt for search string. After entering the search string hit return and you will be prompted for the replace string. After entering the replace string hit return. BEAV will then search for the first match with the search string. If a match is found you will be prompted with '(R)eplace, (S)kip, (A)ll, (O)ne, (Q)uit' If you type a 'R' the replace will be done at this location and the search will continue. If you type a 'S' the replace will not be done and search will continue. If you type an 'A' the replace will be done and will be done at all future matches without pausing for conformation. If you type an 'O' the replace will be done at this location and the search will stop. If you type a 'Q' then the search will be terminated. Ctl-R recall-srch-string If you enter search or replace previously used strings can be recalled with this command. - 25 - BEAV User Manual 3.8 Exiting BEAV While using BEAV individual buffers may be saved to disk during the editing session. When quitting BEAV you must save all buffers or delete all buffers. There are two commands that that do this. Ctl-C quit-no-save Sh-F10 If there are any unsaved buffers you will be prompted for conformation before proceeding. All buffers will be deleted then you will exit. Ctl-X Ctl-E quit-save-all Sh-F9 All buffers are saved before exiting. - 26 - BEAV User Manual 3.9 Printing The data that is being displayed in BEAV can be printed or sent to a file in the same format as displayed. If the current window is displaying octal words and a print command is given the format of the print will be in the format of the window; that is, octal words. Esc P print-mark-to-cursor Ctl-Print To use this command you must set the mark and the cursor to define the region that you want printed. If the mark is not set it as assumed to be at the first unit. The position of the mark and cursor are rounded to include the entire specified line unlike the other mark-to-cursor commands. After you enter the command you will be prompted with 'Print to:'. You can enter a file name or a device name to send the print image to. If you enter 'PRN' most systems will print a hard copy. This is useful for getting a print out of the current key bindings. To do this give the 'help' command 'F1'. Go to the bottom of the help window using the 'move-to-end' command 'End', the mark will be assumed to be at the beginning of the buffer. Issue the 'print-mark-to-cursor' command. Enter 'PRN' at the prompt. This should print the complete help buffer and will reflect any changes that you have made to the key bindings. - 27 - BEAV User Manual 3.10 Keyboard Macros BEAV has the capability of recording key strokes as they are entered and playing them back later. This is useful for repeating multi-keystroke operations. Ctl-X ( macro-start Start recording key strokes. There is no effect on the operation of the key strokes. Any previous recorded key strokes are cleared. Ctl-X ) macro-end Stop recording key strokes. The key strokes are available for play back. Ctl-X E macro-execute Play back the recorded key strokes. The key strokes that were recorded are played back as if they were typed at the keyboard. 3.11 Key Binding BEAV provides a user configurable interface. The interface is controlled by a set of key bindings. This relates the command that will be executed when a particular key stroke is entered. There are a set of default key bindings as described in this manual. These can be changed to reflect your preferences. When a change is made it is reflected in the help screen. Ctl-X ? binding-for-key Sh-F1 This command will tell you what function a certain key sequence is bound to. When this command is given you will be prompted for a key stroke or key stroke sequence. BEAV will report back with the function name. Esc K bind-to-key First you will prompted for a function name. Enter the name of the function that you wish to create a new binding for. Function names are the names listed in this manual that are of the form of 'move-forw-unit' or 'display-hex'. After you enter the name hit return. You will be prompted for a key. This can be in the form of a single standard key such as 'Z'. Standard key sequences can be entered such as 'Ctl-X Z' - 28 - BEAV User Manual or 'Esc Z'. Special keys can be entered such as 'F1' (function key 1) or 'Page Down'. It is probably a good idea to not use keys that are needed for editing. If you bound 'Z' to a function then you would not be able to enter it as a keystroke when using ASCII display mode. You could still enter it using the 'insert-literally' command or doing it in one of the data display modes but this would be more cumbersome. Ctl-X L bindings-load You are prompted for a file name that contains the key binding that you wish to set. This file is read in and the appropriate bindings are set. The text in the binding file should be of the form; For example; Ctl-X Ctl-P move-back-char 0550 F1 move-forw-char 04bb Ctl-A move-forw-unit 0141 Esc Ctl-T move-back-unit 0354 The easiest way of producing a valid key binding file is to set the desired bindings in BEAV. Next issue the 'help' command (ESC ?), then write the buffer out with the file-write command (Ctl-X Ctl-W). The file created will be a valid format for loading and can be edited as desired. It is the only way to reliably get the number. - 29 - BEAV User Manual 3.12 Special Functions These are the commands that do not logically fit under one of the previous headings Ctl-G abort-cmd F10 This command aborts the current command. It can even abort a partially entered command. Thus, if you have typed an 'Esc' as that start of a command you can type Ctl-G to return to the normal command entry mode. Esc A auto-save BEAV can be set to automatically save the current buffer after a specified number of buffer editing commands are given. This command first prompts for the number of operations before the save is made. If a zero is entered at the prompt, this feature is disabled. The default condition of this command is disabled. Esc C compare This is a powerful feature of BEAV. The contents of two windows are compared byte for byte from the current cursor position in each window. There must be exactly two windows to use this command. These windows can be displaying the same or different buffers. When a difference is found the cursor in each window is moved to that position and both windows are moved accordingly. The display mode does not affect the operation of this command except in restricting the cursor position to whole units. Esc X extended-command If any command loses its binding, this command allows the unbound command to be used. A command can lose its binding because the binding was assigned to another command. When this command is given you will be prompted for a command name. Enter the command name that you wish to execute, it will be executed as if you had typed its key binding. Ctl-L refresh-screen The screen is reprinted from BEAV's internal buffer. This is useful if the display is messed up due to transmission errors. On a PC this is unlikely to happen. - 30 - BEAV User Manual Esc Ctl-V show-version The version and date of BEAV is displayed in the command line. Ctl-X C spawn-shell A new shell is created. You can return to BEAV by typing 'exit'. Ctl-U repeat count This command prompts for a number to be entered. This causes the next command given to be repeated by that number of times. This command cannot have it's binding changed and cannot be issued using the 'extended-command' function. - 31 - BEAV User Manual 4. Alphabetical list of commands by name abort-cmd Ctl-G 3.12 abort-cmd Ctl-X,Ctl-G 3.12 abort-cmd Esc,Ctl-G 3.12 abort-cmd F10 3.12 auto-save Esc,A 3.12 bind-to-key Esc,K 3.11 binding-for-key Ctl-X,? 3.11 binding-for-key Sh-F1 3.11 bindings-load Ctl-X,L 3.11 buffer-set-file-name Ctl-F7 3.3 buffer-set-file-name Ctl-X,Ctl-F 3.3 buffer-set-file-name Sh-F7 3.3 buffer-set-name Esc,Ctl-N 3.3 buffer-size-lock Ctl-X,Ctl-L 3.3 buffers-display Ctl-F1 3.3 buffers-display Ctl-X,Ctl-B 3.3 change-buffer Ctl-F2 3.3 change-buffer Ctl-X,B 3.3 change-to-next-buffer Ctl-F4 3.3 change-to-next-buffer Esc,+ 3.3 change-to-prev-buffer Ctl-F5 3.3 change-to-prev-buffer Esc,- 3.3 change-window-back Ctl-PageUp 3.5 change-window-back Ctl-X,P 3.5 change-window-forw Ctl-PageDown 3.5 change-window-forw Ctl-X,N 3.5 compare Esc,C 3.12 copy-mark-to-cursor Esc,W 3.6 copy-mark-to-cursor F7 3.6 delete-back-char Backspace 3.6 delete-back-char Rubout 3.6 delete-back-unit Esc,Ctl-K 3.6 delete-back-unit Esc,Rubout 3.6 delete-forw-char Ctl-D 3.6 delete-forw-char Delete 3.6 delete-forw-unit Esc,D 3.6 delete-mark-to-cursor Ctl-W 3.6 delete-mark-to-cursor F8 3.6 display-ascii Esc,Ctl-A 3.5 display-binary Esc,Ctl-B 3.5 display-byte-shift Ctl-A 3.5 display-bytes Esc,1 3.5 display-decimal Esc,Ctl-D 3.5 display-double-words Esc,4 3.5 display-ebcdic Esc,Ctl-E 3.5 display-hex Esc,Backspace 3.5 display-octal Esc,Ctl-O 3.5 display-swap-order Ctl-E 3.5 - 32 - BEAV User Manual display-words Esc,2 3.5 extended-command Esc,X 3.12 file-read Ctl-X,Ctl-R 3.4 file-read Sh-F2 3.4 file-save Ctl-X,Ctl-S 3.4 file-save Sh-F3 3.4 file-view Ctl-X,V 3.4 file-visit Ctl-X,Ctl-V 3.4 file-visit Sh-F4 3.4 file-visit-split Esc,U 3.4 file-write Ctl-X,Ctl-W 3.4 file-write Sh-F5 3.4 help Esc,? 3.1 help F1 3.1 insert-file Ctl-F8 3.4 insert-file Ctl-X,Tab 3.4 insert-file Sh-F8 3.4 insert-literally Ctl-Q 3.6 insert-literally Esc,Q 3.6 insert-toggle Ctl-X,Ctl-A 3.6 insert-toggle Insert 3.6 insert-unit Ctl-X,I 3.6 kill-buffer Ctl-F3 3.3 kill-buffer Ctl-X,K 3.3 macro-end Ctl-X,) 3.10 macro-execute Ctl-X,E 3.10 macro-start Ctl-X,( 3.10 mark-set Esc,. 3.2 mark-set F2 3.2 move-back-char Ctl-B 3.2 move-back-char West 3.2 move-back-line Ctl-P 3.2 move-back-line North 3.2 move-back-page Esc,V 3.2 move-back-page PageDown 3.2 move-back-unit Ctl-West 3.2 move-back-unit Esc,B 3.2 move-forw-char Ctl-F 3.2 move-forw-char East 3.2 move-forw-line Ctl-N 3.2 move-forw-line South 3.2 move-forw-page Ctl-V 3.2 move-forw-page PageUp 3.2 move-forw-unit Ctl-East 3.2 move-forw-unit Esc,F 3.2 move-forw-unit Sh-Tab 3.2 move-to-beginning Esc,< 3.2 move-to-beginning Home 3.2 move-to-buffer-split Esc,G 3.2 move-to-byte Ctl-X,G 3.2 - 33 - BEAV User Manual move-to-byte F9 3.2 move-to-end End 3.2 move-to-end Esc,> 3.2 move-window-down Ctl-X,Ctl-N 3.2 move-window-down Ctl-Z 3.2 move-window-up Ctl-X,Ctl-P 3.2 move-window-up Esc,Z 3.2 print-mark-to-cursor Ctl-Print 3.9 print-mark-to-cursor Esc,P 3.9 quit-no-save Ctl-C 3.8 quit-no-save Ctl-F10 3.8 quit-no-save Ctl-X,Ctl-C 3.8 quit-no-save Sh-F10 3.8 quit-save-all Ctl-F9 3.8 quit-save-all Ctl-X,Ctl-E 3.8 quit-save-all Sh-F9 3.8 recall-srch-string Ctl-R 3.7 refresh-screen Ctl-L 3.12 replace Esc,% 3.7 replace F5 3.7 save-all-buffers Ctl-X,Return 3.4 save-all-buffers Sh-F6 3.4 save-mark-to-cursor Esc,O 3.3 search-again Esc,T 3.7 search-again F4 3.7 search-back Esc,R 3.7 search-forw Esc,S 3.7 search-forw F3 3.7 show-position Ctl-X,= 3.2 show-version Esc,Ctl-V 3.12 spawn-shell Ctl-X,C 3.12 swap-cursor-and-mark Ctl-X,Ctl-X, 3.2 unit-twiddle Ctl-T 3.6 window-delete Ctl-X,0 3.5 window-enlarge Ctl-X,Z 3.5 window-link Esc,L 3.2 window-reposition Esc,! 3.5 window-shrink Ctl-X,Ctl-Z 3.5 window-single Ctl-X,1 3.5 window-split Ctl-X,2 3.5 yank Ctl-Y 3.6 yank F6 3.6 yank-buffer Ctl-F6 3.3 yank-buffer Esc,Y 3.3 - 34 - BEAV User Manual 5. Alphabetical list of commands by default key binding delete-back-char Backspace 3.6 display-byte-shift Ctl-A 3.5 move-back-char Ctl-B 3.2 quit-no-save Ctl-C 3.8 delete-forw-char Ctl-D 3.6 display-swap-order Ctl-E 3.5 move-forw-unit Ctl-East 3.2 move-forw-char Ctl-F 3.2 buffers-display Ctl-F1 3.3 quit-no-save Ctl-F10 3.8 change-buffer Ctl-F2 3.3 kill-buffer Ctl-F3 3.3 change-to-next-buffer Ctl-F4 3.3 change-to-prev-buffer Ctl-F5 3.3 yank-buffer Ctl-F6 3.3 buffer-set-file-name Ctl-F7 3.3 insert-file Ctl-F8 3.4 quit-save-all Ctl-F9 3.8 abort-cmd Ctl-G 3.12 refresh-screen Ctl-L 3.12 move-forw-line Ctl-N 3.2 move-back-line Ctl-P 3.2 change-window-forw Ctl-PageDown 3.5 change-window-back Ctl-PageUp 3.5 print-mark-to-cursor Ctl-Print 3.9 insert-literally Ctl-Q 3.6 recall-srch-string Ctl-R 3.7 unit-twiddle Ctl-T 3.6 move-forw-page Ctl-V 3.2 delete-mark-to-cursor Ctl-W 3.6 move-back-unit Ctl-West 3.2 macro-start Ctl-X,( 3.10 macro-end Ctl-X,) 3.10 window-delete Ctl-X,0 3.5 window-single Ctl-X,1 3.5 window-split Ctl-X,2 3.5 show-position Ctl-X,= 3.2 binding-for-key Ctl-X,? 3.11 change-buffer Ctl-X,B 3.3 spawn-shell Ctl-X,C 3.12 insert-toggle Ctl-X,Ctl-A 3.6 buffers-display Ctl-X,Ctl-B 3.3 quit-no-save Ctl-X,Ctl-C 3.8 quit-save-all Ctl-X,Ctl-E 3.8 buffer-set-file-name Ctl-X,Ctl-F 3.3 abort-cmd Ctl-X,Ctl-G 3.12 buffer-size-lock Ctl-X,Ctl-L 3.3 move-window-down Ctl-X,Ctl-N 3.2 - 35 - BEAV User Manual move-window-up Ctl-X,Ctl-P 3.2 file-read Ctl-X,Ctl-R 3.4 file-save Ctl-X,Ctl-S 3.4 file-visit Ctl-X,Ctl-V 3.4 file-write Ctl-X,Ctl-W 3.4 swap-cursor-and-mark Ctl-X,Ctl-X, 3.2 window-shrink Ctl-X,Ctl-Z 3.5 macro-execute Ctl-X,E 3.10 move-to-byte Ctl-X,G 3.2 insert-unit Ctl-X,I 3.6 kill-buffer Ctl-X,K 3.3 bindings-load Ctl-X,L 3.11 change-window-forw Ctl-X,N 3.5 change-window-back Ctl-X,P 3.5 save-all-buffers Ctl-X,Return 3.4 insert-file Ctl-X,Tab 3.4 file-view Ctl-X,V 3.4 window-enlarge Ctl-X,Z 3.5 yank Ctl-Y 3.6 move-window-down Ctl-Z 3.2 delete-forw-char Delete 3.6 move-forw-char East 3.2 move-to-end End 3.2 window-reposition Esc,! 3.5 replace Esc,% 3.7 change-to-next-buffer Esc,+ 3.3 change-to-prev-buffer Esc,- 3.3 mark-set Esc,. 3.2 display-bytes Esc,1 3.5 display-words Esc,2 3.5 display-double-words Esc,4 3.5 move-to-beginning Esc,< 3.2 move-to-end Esc,> 3.2 help Esc,? 3.1 auto-save Esc,A 3.12 move-back-unit Esc,B 3.2 display-hex Esc,Backspace 3.5 Compare Esc,C 3.12 display-ascii Esc,Ctl-A 3.5 display-binary Esc,Ctl-B 3.5 display-decimal Esc,Ctl-D 3.5 display-ebcdic Esc,Ctl-E 3.5 abort-cmd Esc,Ctl-G 3.12 delete-back-unit Esc,Ctl-K 3.6 buffer-set-name Esc,Ctl-N 3.3 display-octal Esc,Ctl-O 3.5 show-version Esc,Ctl-V 3.12 delete-forw-unit Esc,D 3.6 move-forw-unit Esc,F 3.2 move-to-buffer-split Esc,G 3.2 - 36 - BEAV User Manual bind-to-key Esc,K 3.11 window-link Esc,L 3.2 save-mark-to-cursor Esc,O 3.3 print-mark-to-cursor Esc,P 3.9 insert-literally Esc,Q 3.6 search-back Esc,R 3.7 delete-back-unit Esc,Rubout 3.6 search-forw Esc,S 3.7 search-again Esc,T 3.7 file-visit-split Esc,U 3.4 move-back-page Esc,V 3.2 copy-mark-to-cursor Esc,W 3.6 extended-command Esc,X 3.12 yank-buffer Esc,Y 3.3 move-window-up Esc,Z 3.2 help F1 3.1 abort-cmd F10 3.12 mark-set F2 3.2 search-forw F3 3.7 search-again F4 3.7 replace F5 3.7 yank F6 3.6 copy-mark-to-cursor F7 3.6 delete-mark-to-cursor F8 3.6 move-to-byte F9 3.2 move-to-beginning Home 3.2 insert-toggle Insert 3.6 move-back-line North 3.2 move-back-page PageDown 3.2 move-forw-page PageUp 3.2 delete-back-char Rubout 3.6 binding-for-key Sh-F1 3.11 quit-no-save Sh-F10 3.8 file-read Sh-F2 3.4 file-save Sh-F3 3.4 file-visit Sh-F4 3.4 file-write Sh-F5 3.4 save-all-buffers Sh-F6 3.4 buffer-set-file-name Sh-F7 3.3 insert-file Sh-F8 3.4 quit-save-all Sh-F9 3.8 move-forw-unit Sh-Tab 3.2 move-forw-line South 3.2 move-back-char West 3.2 - 37 - BEAV User Manual 6. Release notes Version 1.20 (3/10/91) of beav contains the following fixes and enhancements; * Under unix files are created with read/write permissions. * Fixed the bug in the terminal I/O routine that caused beav to spin rather than give up control when waiting for a character. * Added the ANSI #define that was missing for MSDOS. * Changed the D16 #define to a unsigned short. * Called ttclose on error exit. * Check and limit ncol and nrow to the actual screen array size. * Add the ability to load key bindings from a file automatically under MSDOS and unix. * Add delete current window command. * Support VT100 type function keys. - 38 -