Documentation for MEDIT - Written by: Steve & Joe Maguire MEDIT is an object code or machine language editor as opposed to a text editor such as the EDIT file of PTDOS. MEDIT can be assembled from this disk by placing it in drive 1, and your working disk in drive 0, and typing: ASSM MEDIT:S/1,,MEDIT The file MEDIT will be created on your work disk and can be invoked by typing the following command: MEDIT infile{,{outfile}{,offset}} Infile and outfile conventions conform to those for EDIT (see PTDOS manual) with the following exceptions: 1. Device files cannot be edited until they are RETYPEd to something other than "D". This is a limitation imposed by the way PTDOS handles device files. 2. If MEDIT detects that the designated output file is write or extend protected, it will so inform you. However, since it is anticipated that many users will use MEDIT mostly for veiwing or searching object code files, answering the prompt with "Y" will allow loading a protected file. Attempting to write to the file on exit will produce a PTDOS "FILE PROTECTED" error. 3. The parameter (for ALS8 files) is not supported. 4. The "top of memory" option is not supported. MEDIT will use up to all available memory if required. 5. Offset determines the address which will appear on the left side of the video display. It is a psuedo address for reference only and not the actual address of the file in memory. If no offset is given, the file to be MEDITed will be displayed with 100H as a start address. Examples: MEDIT NEWDOC,OLDDOC,1000 (text file) MEDIT BASIC (image file) MEDIT MYDATA,YOURDATA/1 (data file) MEDIT MEMTEST,,C900 (image file) * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Note: MEDIT may be reentered at any time, with the file being edited kept intact, by EXecuting 100H. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * MEDITor Commands: MEDIT has been written to conform as closely as possible to EDIT but do to the nature of the display and the fact that both text and object files may be edited, some differences will be found. These differences are given below: CTRL/ I or TAB - moves cursor to end of line CTRL/ M RETURN - moves cursor to next line CTRL/ J LINEFEED - " " " " " CTRL/ Q HOME - moves cursor to upper left corner CTRL/ @ MODE - toggle Ascii/Hex display mode CTRL/ T - insert (see CTRL/ V below) CTRL/ H - delete (see CTRL/ V below) CTRL/ Y not implemented CTRL/ B not implemented CTRL/ P not implemented CTRL/ O Enter search mode. The type of string depends on the mode in use. If in Hex mode, an "H:" will be the prompt. A string of up to 126, 8 bit hex values may be entered including "wild cards." A wild card "*" will match any byte. Ex. H:CD * C0 will find all calls to the C0 address area. H:C9 * * * * FE will find all occurrences of C9 and FE separated by five bytes. H:C3 19 C0 will find all jumps to Solos' SOUT. If in Ascii mode, an "A:" is the prompt. A string of up to 126 Ascii characters may be entered. Ex. A:PROTEUS Software Library Note that upper/lower case is significant as well as spaces in the string. Ascii characters with the high bit set can be found in the Ascii mode but by toggling to the hex mode they will be ignored. Since the delete routine (backspace) is always active, the delete or underline character must be searched for in the hex mode. The wild card is not available with Ascii. Once the string has been typed and the C/R pressed, the string remains in the search buffer until another CTRL/ . Toggling Hex/Ascii has no effect on the search other than the Ascii high bit memtioned above. If the "String not found" message is displayed, the end of the file buffer has been reached. Pressing C/R and LOAD will start the search over again from the beginning of the file. Note: CTRL/ L or "LOAD" will continue search. CTRL/ V Invokes the Sub Command table. Typing CTRL/ V will clear the screen and wait for a command to be entered after the "V:" prompt. If CTRL/ V was typed by mistake, just give a carraige return. CL - print the command list on the screen. FL - position cursor to first byte of file. LL - position cursor to last byte of file. ST - make current byte under cursor the first byte of the file. Erase all preceeding bytes. EN - make current byte under cursor the last byte of the file. Erase all following bytes. RE - restore old end of buffer. If the EN command was given by mistake, wiping out the rest of the file, RE will get it back for you. SC - search file for control characters and replace each one with a carraige return. This is used to fix text files which are unEDITable due to embedded control characters. (usually caused by bad memory or disk errors) After giving this command, exit MEDIT then EDIT the file. All unwanted blank lines (caused by the CRs) can then easily be removed. IN E - enable insert mode. After giving this command, the CTRL/ T can be typed to insert one NOP at the current cursor position. The NOP can then be changed to any desired value. The CTRL/ T can be typed as many times as desired until the IN D command below is given. This double command sequence was designed into MEDIT to prevent accidental inserts of bytes into an object code file. One extra byte entered into a machine language program for an 8080 could wreak havoc during execution. It was allowed in order to edit position independent code such as is available for Z80 processors. IN D - disable insert mode. Turns off CTRL/ T DE E - enables delete mode. After giving this command, the CTRL/ H may be used to delete a byte at the current cursor position. All the comments for Insert above apply to Delete also. DE D - disable delete mode. Turns off CTRL/ H FI addr1 addr2 byte - fill from addr1 to addr2 with value of byte. MO addr1 addr2 dest - move the block between addr1 and addr2 to address dest. *** Caution - this command can extend the length of the file. Be sure that is what you want. *** CO addr - change offset address (addr is in hex). JP addr - jump to (offset) address within file. JR addr - jump to address relative to first byte. Ex. JR 2D0 will position cursor to the 720th byte in the file. ASCII DISPLAY Characters displayed in the Ascii mode will appear as they normally do unless the high bit is set in which case the character will be preceeded by a minus sign. All control characters are displayed as periods with the exception of the carraige return and linefeed which are displayed as carets (^). ENTERING DATA - Hex Mode: Only legal hex characters may be entered. Position the cursor over the byte to be changed and enter both digits of the desired value. The cursor will then jump to the next byte. The cursor may be positioned elsewhere by scrolling and the use of the cursor keys. Ascii Mode: Anything except control characters may be entered. After each character entered, the cursor will space automatically to the next byte. Note that the space bar enters a space into the byte and should not be used for moving the cursor. Use the cursor keys for that purpose. An Ascii character with the high bit set may be entered by typing a minus "-" sign first and then the character. ABOUT BUGS MEDIT was tested extensively for several months with different users. Their comments and preferences were considered when designing MEDIT's features. It soon became apparent that error checking and prevention was of major importance. These checks, added into the source code, caused the program to grow from an initial 3K size to over 5K. Not every possible error has been trapped out. For example, it is possible to enter an illegal hex value for an address to the JP, JR, CO commands etc. (however, you will get an error message) Trapping these and other possibilities would cause the program to grow to an uncomfortable size. What we want to know, are bugs which affect the successful operation of the program or ideas which can extend its usefulness. Any comments are appreciated any may be sent to the authors in care of the address given in the source code. Thanks and Happy Editing! Special Note: This entire program is copyrighted even though we are making it available to Proteus members at no charge. The authors specifically reserve the right to market this program, in a modified version, to CP/M, TRS-80 or other type computer users.