******************************************************************************* * * * STRING WRITER v4.4 * * By J.Y Avenard * * (c) January 1995 GHERKIN Productions * * * ******************************************************************************* I- Description STRING-WRITER is a fast, complete text editor written almost completely in SATURN assembly (5% in sys-RPL, 10% data (graphics, character tables, error messages, etc.), 85% machine language for a total of 23 Kbytes). Notice! This version is shareware, if yous use it please send 50FF (or 10$) to the author.. To make comments, questions, or suggestions for new functions, you may write to me at 3615-3614 STORM bal GHERKIN or: Avenard Jean-Yves 16 rue de Savigny 91390 Morsang Sur ORGE or email to : avenar_j@epita.fr Telephone : 33-1-69051236 33-09168953 (GSM) II- General Overview: String-Writer v4.4 is a library object. It will appear on the stack as: "Library 1303 : STR..." 1- Installation To use it, you must store it in a port. - Put the library in level 1 of the stack. - type DUP then BYTES. You must have on stack : Level 2 : # E5ACh Level 1 : 24027.5 Else, don't use this program. - type 0, 1, or 2 [..32], then STO according to whether you have a plug-in card. Then press [ON]-[C]. (Press and hold [ON], then press [C] and release them both). The calculator will perform a warm start. String Writer is now installed and ready for use. 2- Using it for the first time. Go to the library menu. Press the white soft-key underneath the name STRW. If STRW does not appear in the menu, press [NXT] until it appears. 3- Different functions. Once you're in the String Writer menu, you will see these names: -EDIT -VISIT -Edit -Visit -NEW -Info -PUTFONT -SWINIT -XMIT2 -SRECV2 -CUT Here is a description of each of these programs: -EDIT : Edit the object in level 1 of the stack. -VISIT : Take a 'GLOBAL NAME' and edit the contents of the variable -Edit : Same as EDIT, only if the object is an algebraic object, then the Equation Writer is used. If it's a matrix, then the Matrix Writer is used. If it's a graphics object, then the GRAPH menu is used. Strings are edited directly without adding quotes "". I advise that you use Edit for strings, because it uses much less RAM than EDIT. -Visit : Like VISIT, only this works in the same fashion as Edit. -NEW : To create a new object. -Info : Give the version number and information about the library. -PUTFONT : Get the font used by STRING-WRITER and put it on the stack. -SWINIT : Activate USER mode, and assign the following functions to keys: HP48s(x): LS +/- : EDIT RS +/- : VISIT DOWN : Edit RS DOWN : Visit DEL : NEW CLVAR : Place the contents of the command line into STRING-WRITER v4.4. If there is no command line, place the contents of LASTARG into STRING-WRITER v4.4. HP48g(x): LS +/- : EDIT/VISIT DOWN : Edit LS DOWN : Visit DEL : NEW LASTARG : Place the contents of the command line into STRING_WRITER v4.4. XMIT2 : Equivalent to the command XMIT, but you can transfer at speeds as fast as 7500 baud for the IR port, and 15,000 baud for the wire serial port. (The average time is calculated compared to the time taken by the XMIT function). XMIT2 takes two arguments: in stack level 2 a string, and in level 1, a real number for the transfer speed. XMIT2 returns a 1 if the transfer was successful, or a 0 if it was interrupted. 0: 1200 baud 1: 1900 baud 2: 2400 baud 3: 3800 baud 4: 4800 baud 5: 7500 baud (maximum speed for the IR port) 6: 9600 baud 7: 15000 baud (maximum speed for the RS-232c port) Here are a few example times for transferring a 5000 character text with the XMIT2 function. Speed : time (in seconds). 0 : 46.73 1 : 29.34 2 : 23.50 (transfer speed for the IR using the function XMIT) 3 : 14.81 4 : 11.91 5 : 7.55 6 : 6.13 (maximum possible transfer speed with the XMIT function) 7 : 3.93 (maximum possible transfer speed with the XMIT2 function) -SRECV2: This function is equivalent to SRECV, but also permits transfers at very high speeds. Also, it will receive texts with more than 256 bytes. SRECV2 takes two arguments from the stack: in level 2, the number of characters to receive, and in level 1 a real number for the transfer speed. A string is returned in level 2 (the received string) and in level 1, a 1 is returned if the reception was successful, and a 0 if there was an interruption or other errors. -CUT : Insert CR after 22 characters long. III- Description of the STRING-WRITER commands. In edit mode: -Direction keys for moving around in the text DEL :erase the character underneath the cursor <= :erase the character to the left of the cursor MTH :List all lines beginning with *. To see all the labels, press MTH as many times as is necessary. To go to a specific label, press the number key shown next to it. PRG :Toggle insert/type-over mode. When in ALPHA type mode, press RS ALPHA instead. CST :Tab. VAR :Toggle fast/slow mode. This influences movement keys as well as deleting characters. ENTER :Save the text, return to RPL. ON :Exit STRING-WRITER v4.4 losing all changes made to text. NXT :Next menu page LEFT SHIFT ( LS ) +: MTH :Send the seletion out the Infra-red or wire serial port. PRG :Show End-Of-Line characters. CST :Automatically give a carriage-return when the cursor reaches the 22 column. VAR :(followed by a digit 0-9) set a mark at this cursor position. (See RS VAR for more info). UP :PAGE-UP DOWN :PAGE-DOWN LEFT :PAGE-LEFT RIGHT :PAGE-RIGHT NXT :Next menu page. +/- :Show the EDIT menu ( <-SKIP,SKIP->,etc.. ) 1 :Type a ; RIGHT SHIFT ( RS ) +: MTH :Allow configuration of the serial port parameters. The delay between each line during the transmission is in 1/16ths of a second. PRG :Toggle AUTO-INDENT mode. CST :Change the TAB value VAR :(followed by a digit 0-9) go to a previously set mark. (see LS VAR for more info). UP :MAX-UP NXT :Toggle menu bar (visible/invisible) DOWN :MAX-DOWN LEFT :MAX-LEFT RIGHT :MAX-RIGHT DEL :HP48G(X) : erase from cursor to end of line. HP48S(X) : same as the DEL L function (see below). <= :HP48G(X) : erase all characters from the start of the line to the left of the cursor. ON :Turn off the HP48. MENU KEYS: Each key is found underneath its function name (ex: ASCII) which allows you to execute one of the different STRING-WRITER 4.3 commands. *1st menu. ASCII :Enter any ASCII number (from 0 to 255) to get the corresponding character. LS ASCII :A table of all the ASCII characters in the font. GOTO :GOTO a specific line in the text. LS GOTO :GOTO a specific character number in the text. ->BEG :Place the cursor at the beginning of the selection. ->END :Place the cursor at the end of the selection. DEL L :Erase the current line if it contains characters, otherwise erase the Carriage Return. LS DEL L :Erase all the characters on the current line to the left of the cursor. RS DEL L :Erase all the characters from the cursor to the end of the line. INFOS :Display various information about the text and the state of the memory. Hold the key down to see the information. *2nd menu : Block commands. BEGIN :mark the beginning of the selection END :mark the end of the selection Pressing SL BEGIN, or SL END selects the word at the current cursor position. CUT :Cut the selection to the clipboard COPY :Copy the selection to the clipboard PASTE :Paste the clipboard to the current cursor position. DEL :erase the text selection *3rd menu : Search and Replace commands. FIND :Prompt for a string to be found. This string is limited to 21 characters. LS FIND :Place the current selection into the FIND prompt, then enter FIND. REPL :Prompt for a search string, and a replace string. LS REPL :Same function as LS FIND only with REPL. RS REPL :Place the selection into the 'Replace with' prompt, then enter REPL. NEXT :Search again for the pattern in FIND. If found, the occurence becomes the current selection. R :Replace the selection by the 'Replace with' string in REPL LS R :Same funtion, but use a special replace. (See chapter on the use of Find/Replace) R/N :Replace the selection, then search for the next occurance. (Just like pressing R, then NEXT). LS R/N :Same as LS R, then NEXT. ALL :Replace all the occurances of the search string in the text. Display each occurance as it goes. Press [ON] to stop. LS ALL :Replace all occurences without the display. This is more rapid. It is impossible to interrupt this operation. RS ALL :Same as above, only turn off the display first. This increases the speed by another 12%. NOTES FOR WHEN THESE COMMANDS NEED ARGUMENTS: When an argument is needed for the commands: ASCII, GOTO, FIND, etc., pressing [ON] will do the following: -If no character has yet been typed, then you are returned to edit mode. -If characters are present, these are erased from the command line. The functions PRG, CST, VAR, MAX-LEFT, MAX-RIGHT are still actives. The others are not operational. -In the FIND and REPLACE menus you can use the ASCII command, as well as displaying the entire font. *4th menu (EDIT Menu) <-SKIP :Place the cursor at the first of the previous word. LS <-SKIP:Execute <-SKIP, and select the current word. SKIP-> :Place the cursor at the beginning of the next word. LS SKIP->:Execute SKIP-> and select the current word. <-DEL :Erase all characters from the left of the cursor to the beginning of the previous word. RS <-DEL :Erase all characters from the left of the cursor to the beginning of the current line. DEL-> :Erase all characters from the cursor to the beginning of the next word. RS DEL-> :Erase from the cursor to the end of the current line. DEL L :Erase the current line if it contains characters, otherwise remove the carriage return. LS DEL L :Erase all the characters on the current line to the left of the cursor. RS DEL L :Erase all the characters from the cursor to the end of the line. INFOS :Display various information about the text and the state of the memory. Hold the key down to see the information. IV- Manipulating the selection and moving blocks. When a section of text is selected (with BEGIN and END), the text is displayed in inverse. BEGIN must be placed before END. You can now cut and paste like any other text editor. V-Using the search and replace commands. *Searching for characters. To search for a sequence of characters, go the the FIND menu, enter the search string, and press ENTER. Then, choose a search mode: case-sensitive, or non case-sensitive, then press ENTER. Pressing ON will allow you to exit the FIND (or REPL) menu at any time. If the search string is empty, you will see the error message: "Nonexistent Pattern". If no occurance of the string is found, you will see the message: "Can't Find Pattern" Otherwise, the first string it finds is selected. If you press NEXT, STRING WRITER will search for the next occurance. Note: The ASCII code 0 is a wild-card. It allows you to search for any character. For example, searching for T*TO (where * is the ASCII code 0) allows you to find all words like TaTO, TATO, TZTO, etc. *Search and replace. After having entered all the necessary arguments in the REPL menu, the first search string found is selected. - R replaces the selection with the 'Replace with' string. - R/N replaces the selection, then searches for the next string. - ALL replaces all occurances of the search string, starting with the current cursor position. 1-Replacing the selection. It is possible to replace an entire segment of text with a string. To do this, select the text to be replaced. Go to the REPL menu and erase the search string (press [ON] if it isn't empty), then press ENTER. Enter the replace string and press ENTER. The message "Nonexistent Pattern" appears. Press R : The selection is replaced. 2-Using macros with REPLACE. It is possible to mainipulate a string using the REPLACE command. For example, you can add a space every 5 characters, or search for any 5 characters and reverse them. Examples. a) How to add a space every five characters. -Go to the REPL menu -Place 5 ASCII code 0 characters as the search string (all wild-cards). -ENTER -Place 5 ASCII code 0 characters as the replace string -Add a SPACE (press SPC or ASCII code 32) -ENTER The next 5 characters are selected. -To replace only these 5 characters, press LS, then R. -To replace these 5 characters and then search for the next 5, press LS, then R/N -To replace all characters : press ALL. The message "Use Special Replace ?" will appear. -Press Y : All the characters are replaced. b) Search for 5 characters, then reverse them (ex: HELLO becomes OLLEH) -Go to the REPL menu -Place 5 ASCII code 0 characters in the search string. -ENTER -Enter the ASCII code 15, then 14, then 13, 12, 11. -ENTER -To replace only the next 5 characters, press LS, then R. -To replace the next 5 characters, then search for 5 more, press LS, then R/N. -To replace all characters : Press ALL. The message "Use Special Replace ?" will appear. -Press Y : All the characters are replaced. *Explanation of the special REPLACE function. When REPLACE finds the ASCII code 15 in the replace string, it will replace it by the 5th character in the selection. For a more general application, to replace with the nth character of the selection, use the ASCII code (10+n). The ASCII code 0 character is used as a counter. The first ASCII code 0 character represents the 1st character of the selection; the second ASCII code 0 represents the second character of the selection, etc. Example: How to find 6 characters, then replace them with: "The 1st is x1,6th is x6" , where x1 is the first character and x6 is the sixth. Example : "COUCOU" would be replaced with "The 1st is C,6th is U" -Type 6 characters of ASCII code 0 in the search string. -ENTER -Type : "The 1st is" , type the ASCII code 11 or the ASCII code 0. -Type : ",6th is " , type ASCII code 16 (for the sixth char) -ENTER -To replace only the first 6 characters found, press LS, then R. -To replace these 6 characters, then search for the next 6, press LS, then R/N. -To replace all characters : Press ALL. The message "Use Special Replace ?" will appear. -Press Y : All the characters are replaced. VI-Notes when using the ASCII menu or displaying the entire font. In the ASCII menu, after having entered the ASCII code to insert into the text, press ENTER without releasing it. The ASCII code will be entered into the text many times, until the ENTER key is released. The insertion speed depends on the FAST or SLOW mode. VII- Changing the font. In normal mode, STRING-WRITER edits text using the font found in the HP48 ROM, using a screen with 8 lines by 22 characters (without the menu). It is possible to change this font and have a screen with 10 lines by 22 characters. a) Changing the font. Store any font that you choose in the global name 'FONT'. STRING-WRITER will search for 'FONT' first in the current directory. then in port 0, 1, and 2 etc... If 'FONT' is not found, then the font in ROM will be used. 'FONT' can also be used as a path in a list like { HOME FONT.DIR F7.0 } or { :0: { BACKUP FONT.DIR F6.1 } } 'FONT' can also be a program which make a font-object. If font is an empty list then STRINGWRITER will edit text with ROM's font. b) Increase the number of lines in edit mode. A font can be represented as a 6 x 2048 GROB, a 7 x 2048 GROB, or an 8 x 2048 GROB. If 'FONT' contains : -A GROB 6 x 2048, STRING-WRITER will edit text with bitmap characters 6x6, which allows 10 lines on the screen. -A GROB 7 x 2048, STRING-WRITER will edit text with bitmap characters 6x7, which allows 9 lines on the screen. -A GROB 8 x 2048, STRING-WRITER will edit the text with bitmap characters 6x8, which allows 8 lines on the screen. VIII- Configuring STRING-WRITER Normally, STRING-WRITER edits text with the menu bar showing, in slow mode, and in insert mode. Using the variable 'SWPAR' it is possible to change these settings. 'SWPAR' contains a binary integer (ex: # 5h ). This binary integer must be from #0d to #15d (decimal) or from #0h and #Fh (hexadecimal). Check the following table for the function of SWPAR : --------------------------------------------- |SWPAR | MENU | SPEED | INSERTION | ALPHA | --------------------------------------------| | # 0h | yes | slow | yes | no | --------------------------------------------| | # 1h | no | slow | yes | no | --------------------------------------------| | # 2h | yes | fast | yes | no | --------------------------------------------| | # 3h | no | fast | yes | no | --------------------------------------------| | # 4h | yes | slow | no | no | --------------------------------------------| | # 5h | no | slow | no | no | --------------------------------------------| | # 6h | yes | fast | no | no | --------------------------------------------| | # 7h | no | fast | no | no | --------------------------------------------| | # 8h | yes | slow | yes | yes | --------------------------------------------| | # 9h | no | slow | yes | yes | --------------------------------------------| | # Ah | yes | fast | yes | yes | --------------------------------------------| | # Bh | no | fast | yes | yes | --------------------------------------------| | # Ch | yes | slow | no | yes | --------------------------------------------| | # Dh | no | slow | no | yes | --------------------------------------------| | # Eh | yes | fast | no | yes | --------------------------------------------| | # Fh | no | fast | no | yes | --------------------------------------------| IX-To get further... It is possible to use Sring-Writer as a sophisticated tool to be included in various programs (Assemblers, DataBases, Kernel, Utilities, etc...) For example, it is possible to re-create the Error-Message-Edition-Program in ASMFLASH : ER So, in error case it would be possible to acces directly to the line to be corrected in the source-code. To do this, we may use the XLIB 1303 12. This particular object is STRINGWRITER's main program. It takes 3 arguments : 3: GROB 6*2048 ( A font ) 2: "string" 1: #Binary Integer Where "string" is the string to be edited. The Binary integer is to be decomposed like # aaaaabbbbbccccc0h with aaaaa : the selected zone's beginning position in hexadecimal notation. bbbbb : the selected zone's ending position. ccccc : the cursor's position when starting editing the selected zone. Ex: The binary integer looks like # 000020003F000010h Then, we'll edit the text with selected zone from 2nd character to 63rth character the cursor will be positionned at the 1st character. X-Thanks. Beta-testers : Douglas R. Cannon, Christophe Nguyen, Francois-Xavier Leroy, Stephane Doat, Christian Bourgeois, Mohamed Fatri, Etienne de Foras, Cyrille de Brebisson, Gerald Squelart. Special Thanks to : - Christian Bourgeois for his involvement in STRING-WRITER 2.0 and without whom this editor would have never seen the light of day. - Douglas R. Cannon for the translation of this document. - Christophe Nguyen for last traductions... - Mohamed Fatri for his suggestions and the Sys-RPL environment. - Detlef Mueller f Raymond Hellstern for RPL.LIB. - Maubert Electronic for their help and support. In case of any problems, contact them : 49 bvd St Germain 75005 Paris ( FRANCE ) X- Other products for the HP48 (in the public domain). -Font-Writer : A font editor compatible with String-Writer (all versions) -HP ASM : A Saturn assembler. -TERMHP : VT100 Emulator. -LABY : Generate 3D mazes. -ZAPPER : An IR control And many more... Coming soon on your HP48GX : METHA-KERNEL : A 128ko applications card with : -A Kernel -A symbolic Saturn Assembler -An Equation Writer -A graphic environment -A file manager -A text editor wich can use many fonts, and text attributs (bold,underline,italic,inverse)