FU.COM A File Utility File Utility is a full screen binary file editor. The editor screen and cursor functions are patterned after Wordstar. The display is identical to DDT. FU also includes a windowed full function calculator for binary, hex, and decimal integer. FU.COM 1984 (c) Copyright by Roger Donais Grafton Cole 7506 Republic Court #201 5332 Anchor Court Alexandria VA 22306 Fairfax VA 22032 703-765-0615 703-425-6329 Released for non-commercial, private use only. If you find this program useful and include it in your library, a donation of $10.00, sent to one of the above address would be appreciated. User response will determine if future updates and similar programs will be released to public domain. In any event, those persons that support us will be notified of all updates, which will be made available for the cost of media and shipping. Future enhancements to FU will include: Code size reduction. Improved full screen editing. Expanding the ^K file manipulation functions. Split screen viewing of a second file. The second file will be read only but a toggle will allow all cursor and scroll commands to operate on the second file. An additional command will allow locking the two files together A new program that will allow direct disk manipulation is in the works. It will be a merger of FU and the public domain DU (Disk Utility). FU.COM is written in TURBO PASCAL. The source is available for $20.00 plus media and shipping. Any comments, positive or negative, and bugs reports will be appreciated --- enjoy. CONVENTIONS USED IN THIS DOCUMENT page 2 of 8\ [xxx] xxx is an optional. Example: [drive] filename. Carriage return. ^ Indicates the following character is a control character. Example: ^C [h] Indicates that the display is affected by terminal high-lighting, i.e. inverse video, dim, etc. LOADING A FILE A>FU B:FOO.BAR Will invoke FU and load the file FOO.BAR from drive B. A>B:FU Will invoke FU on drive B. You will be prompted for an input file spec. This is the pre-edit screen. A>FU - Will invoke FU and bring up the calculator only. If the input file does not exist, a FILE DOES NOT EXIST error message will be displayed and you will be prompted for a new file spec. The entire input file is read into memory, thus input file size is limited to available memory size. If the input file is too large, a FILE TO LARGE error is displayed and you are left in the pre-edit screen. A will exit from the pre-edit mode to the system. THE FU SCREEN DISPLAY page 3 of 8\ The first line of the screen is FU's status line. The second line contains a 'ruler' line. The remainder of the screen is divided into three fields in the same manner as DDT. The first field shows the address of the first byte on the line. The second field displays 16 bytes of the input file in hex. The last field displays the same 16 bytes in ASCII. The ASCII field has the seventh bit set to zero for all bytes. Thus both a 41h and a C1h will be displayed a 'A'. Status line: The status line displays the following information. address The logical hex address of the cursor position. BC:xxxx (Byte Count) The total decimal byte count from the beginning of the file to the current cursor position. SP:xxxx (Sector Position) The decimal byte count from the beginning of the current sector to the current cursor position. SN:xxxx (Sector Number) The decimal sector number currently containing the cursor. Sector numbers begin with zero. SZ:xxxx (SiZe) The last decimal sector number in the input file. Sector numbers begin with zero. **EDIT** [h] Indicates that all commands that can physically change the file are active. Default is OFF. Whenever a valid command is entered it is echoed in the first three columns of the status line. All commands which accept an execution speed will echo the current rate as 1 thru 10 (10=keyboard 0) directly following the command. Default is 7. The speed may be continuously changed while the command is operating with 1 as the fastest speed and 0 the slowest speed. If a command requires addition input, the status line is cleared except for the command. The prompt will appear after the command and the input will be echoed after the prompt. If additional input is required, the status line is again cleared for the new prompt and input. THE FU SCREEN DISPLAY page 4 of 8\ Ruler line [h]: In both the hex and ASCII fields the low nibble of the address (displayed at the beginning of the line) is displayed over the appropriate byte. Address Column: Addresses are alternately high-lighted to indicate one sector blocks. This allows visual determination of sector boundaries. High-lighting is based on the physical sector count from the top of the file. Entry conventions: Hex number entry is case independent. Incorrect hex numbers can be keyed in, but will give an error when entered. A terminates all command entry. COMMANDS page 5 of 8\ The commands are patterned after Wordstar and in many instances are identical. Program control commands: TAB/^I Toggles the cursor between the hex and ASCII fields. The cursor remains on the current byte. The cursor remains in the current field for all commands until changed by TAB. ^V Toggles between the edit and non-edit modes. The status line indicates when in the edit mode. ^O Prompts for an offset. The offset (in hex) is added to the first byte of the file and reflected in the address field. ^P Prompts for an offset. The offset (in hex) becomes the byte at the current cursor position and is reflected in the address field. The ruler line is not changed. All entries on the status line, with the exception of the hexidecimal cursor address contiue to reflect physical positioning within the file. Cursor and scroll commands: ^S (^H) Cursor left one character ^A Cursor left one byte in hex field, else same as ^S (^H) ^D Cursor right one character ^F Cursor right one byte in hex field, else same as ^D ^E Cursor up one line ^X Cursor down one line ^QE Cursor to top of screen ^QX Cursor to bottom of screen ^QS Cursor to left margin of field ^QD Cursor to right margin of field ^QR Cursor to the beginning of the file ^QC Cursor to the end of the file ^Z Scroll up one line ^C Scroll up one screen ^QZ Continuous upward scroll with speed control ^W Scroll down one line ^R Scroll down one screen ^QW Continuous downward scroll with speed control ^G Prompts for a hex address. When executed with a valid hex address the display is updated to the new address, and the cursor is placed on the appropriate byte. The address is the logical address as modified by an offset established with the ^O or ^P commnads. COMMANDS page 6 of 8\ File manipulation: Since FU logs off all drives before saving a file, you may freely change disks without incurring a disk change error. A previous BAK file having the same name as the edit file will be erased and the edited file saved as type $$$. If operation was successfull, the original input file is renamed to BAK and the temporary $$$ file is renamed to the original file type. FU will ask for your confirmation before it will abandon a dirty file (one that was changed during edit). ^KA Abort to system, do not save file ^KQ Quit to pre-edit, do not save file ^KS Save file, cursor and display remain unchanged ^KD Save file, exit to pre-edit ^KX Save file, exit to system Find command: ^QF Searches the file for the input string. Unless otherwise directed, the search begins at the cursor position and proceeds to the end of the file. The cursor will stop on the first byte of the first string that matches the input string. The input string can be either hex, ASCII, or a combination of both. When invoked you will be prompted for a search string. After string entry, you will be prompted for options entry. If no string is entered, a will abort the find command. The search is done in the background (no screen update), however, two hex numbers following the command on the status line give the following information. The first hex number is the logical beginning or end of the file, depending on whether the search is backward or forward. The second hex number is the logical byte address which is being compared for a match. String Entry: Each hex byte must be proceeded a '$'. ASCII is taken as is. Space is a character. An ASCII '$' is entered as $24. EXAMPLE: $1B$65THIS IS INVERSE VIDEO$0D Options: case and order independent B Search from cursor position to beginning of file. U Ignore case in both input and target string. $hh Byte wide bit mask where hh is a hex number. The mask is logically andded with both the input string and the target. EXAMPLE: $7F would mask the 7th bit ^L Continue search for next match. ^U Abort the search. THE CALCULATOR page 7 of 8\ Invoking the calculator opens a window at the bottom of the display. If the cursor is in the window when the calculator is invoked, the display will scroll so that the cursor line is in view. When the calculator window is closed, the original display is restored. The calculator is comprised of an input register (x) and three stack registers (y, z, and t). Entry and operation is in RPN. If you are familiar with Hewlett-Packard calculators, the operation is identical. The display shows all four registers for three differed number bases. The left is hex, center is decimal, and right is binary. All three number base displays are keep current regardless of which number base you are working with. The cursor will be displayed to the right of the x register of the current number base. Number entry is right justified, and appears in the x register. Number entry and display format: Maximum number size: Decimal 65535 Hex FFFF Binary 1111 1111 1111 1111 All overflow or underflow is ignored The decimal display has two columns, one for signed numbers and one for unsigned decimal. Only unsigned decimal entry is allowed, but results of all calculations will be displayed in both columns. A minus entry can be made by subtracting an unsigned number from zero. A special mode of entry allows direct entry of the value of any key on the key board. When the ESC key is pressed, the cursor is replaced by 'Ascii'. The next key pressed will enter the eight bit value the the key. This includes shifted, alt, and control keys. Register actions: |t register| stack lift: x>y y>z z>t and t is discarded |z register| |y register| stack drop: the result of an operation on |x register| x and y is placed in x. zero>t t>z z>y Number entry is terminated and appropriate stack operations performed by all calculator commands except DEL. THE CALCULATOR page 8 of 8\ Commands: ^T Opens the calculator window. Once open ^T toggles between the full screen edit mode and the calculator. When in the full screen edit mode all full screen commands are in effect. When returning to the calculator, it is in the same state as before toggleing to the full screen edit. ^C Closes the calculator window. The window can only be closed while in the calculator mode, since ^C is a scroll command in the full screen edit mode. When the calculator is reopened, it is in the same state it was left in when the window was previously closed. ^D (^F) Circular move right between number base displays to select the current working number base. ^S (^H,^A) Circular move left between number base displays to select the current working number base. Stack operations: ^E Circular roll up of the registers. x>y y>z z>t t>x ^X Circular roll down of the registers. x>t y>x z>y t>z ^V Swaps x and y registers DELete During number entry, the DEL will delete one digit, i.e. it performs a shift right. After an entry has been terminated, the DEL will clear the x register to zero. ENTER terminates number entry, x>y and the remaining stack is lifted. Operations: + (=) arithmetic add, x is added to y, stack is dropped - (_) arithmetic subtract, x is subtracted from y, stack drops * arithmetic multiply, y is multiplied by x, stack drops / (?,`,~) arithmetic divide, x divided into y, stack drops < (,) binary shift left one position, only the x register is affected > (.) binary shift right one position, only the x register is affected Unfortunately the structure of the program does not allow for table key definitions. The keys for all the calculator functions were designed for ease of use on the DIMENSION 68000 keyboard (IBM PC). In order to redefine the keyboard functions, you will need to change the source and recompile.