APPLICATION NOTE #186 REDUCING PRINTER FILE MEMORY REQUIREMENTS IN XYWRITE III PLUS Rev. 01 This application note is intended to give you some tips on how to save memory in a printer file even as you add default commands and create new PT (Print Type) tables. When a printer file is loaded into memory in XyWrite, its data is put into one 64K buffer in the computer's working memory (called RAM). Since 1K=1024 bytes, the actual number of available bytes is 65,536. This buffer is broken down into the following three sections: * A bookkeeping section for font, attribute, and width table names. * A code section for fonts and attributes. * Space for width tables. If you exceed the 64K limit, the message "Out of Memory" appears. A second memory constraint is mode entries, of which the maximum allowable is 750. The message "Too Many Mode Entries" indicates that you have gone over that amount. The printer files provided with XyWrite are well within these limits. However, if you customize your printer file heavily, or if you just want to reduce the amount of memory it uses, you can try one or more of the memory saving techniques described below. COMMENTING OUT The size of a printer file on disk is not directly related to its size when loaded into memory. To reduce the amount of memory required by the printer file while retaining all the information it contains, you can "comment out" sections of the file which you don't often use by placing a semicolon at the start of each line in the section. Note #1 The comment lines in the printer file do not take up any space in the memory buffer. Therefore, deleting comment lines does not increase the available memory. REDUCING THE BOOKKEEPING SECTION Another way of reducing the amount of memory the printer file uses is to decrease the amount of space in its bookkeeping section. You can accomplish this by abbreviating the attribute, font, and width table names in the printer file. For example, change COURIER to CO, or MED-COURIER to M-C. Each letter deleted reduces the bookkeeping section by one byte. Therefore, you save five bytes every time you use CO instead of COURIER. REDLINING CAPABILITY If you have INSERT and DELETE attributes defined in the printer file for redlining, you may get the "Too Many Mode Entries" message even though you have only defined 250 or so modes in PT tables. That is because XyWrite automatically creates redlining modes--INSERT and DELETE equivalents--for each mode definition in your printer file. Thus, XyWrite actually triples the number of mode statements you add to your printer file. You can free up memory while retaining the redlining features for a limited number of PT tables by changing the names of the INSERT and DELETE modes (e.g., to INS and DEL respectively). XyWrite does not automatically create redlining modes unless it finds INSERT and DELETE attributes specifically named. Follow the procedure outlined below: 1. Call the printer file to the screen. 2. Shorten the names of the INSERT and DELETE attribute tables to INS and DEL. 3. Add the INS and DEL mode statements to those PT tables for which you want to retain redlining modes, using the new attribute names you selected in step 2. For example: MD IN+PICA+INS MD DN+PICA+DEL MD IB+PICA+BOLD+INS MD DB+PICA+BOLD+DEL See the conversion table for redlining modes in Chapter 5 of the XyWrite III Plus Reference Guide. Note #2 Be sure to add mode statements for all modes in the PT table which are to have redlining capability. By defining redlining for only specific modes and PT tables, you can increase the number of mode entries available to you. Of course, if you never use redlining at all, you can remove the INSERT and DELETE attribute tables from the printer file entirely, or comment them out with semicolons. DELETING UNNECESSARY ELEMENTS Another way to save on the memory required by a printer file is to eliminate any fonts, attributes, or width tables for which you have no need. For example, if you never use Helvetica-Bold, you may as well delete all the font and width tables that support it. Note #3 When deleting tables, it is a good idea to leave one semicolon between the tables that remain. Caution: Do not delete the Mode Micro line (MD + MM + Micro) that the PT tables in your printer file may contain. This line is essential for some printers to microjustify properly. For each of the fonts and attributes you delete, you must also adjust the corresponding PT table. Instead of deleting the entire PT table, you should only delete the individual line in each PT table which contains that attribute or font (or change that line to access an available font/attribute). Note #4 Be careful that you do not delete mode normal. Width tables in a printer file begin with the letters "WD" and end with "ET." Width tables list the width of each character (in width units) of each available font for that particular printer file. The name of the width table that a font uses is specified after the "UW:" in the font table. Still another way to conserve memory is to adjust the width tables for the fonts you are keeping. Each width table lists a standard width, an example of which is shown below: SW=90 If you see that any characters list the standard width as their width (for example: /\ijlt=90), you can delete that entire line from the width table. Any characters not listed in the width table automatically take the standard setting. MONITORING MEMORY USAGE The only way to determine whether or not you have exceeded the 64K buffer or the 750 mode statement limit is to load the printer file into memory, and then watch for error messages (i.e., "Out of Memory" or "Too Many Mode Entries"). As you adjust your printer file(s), you can check to see how much memory you have saved by pressing Ctrl_M. This brings up the Memory Usage screen, on which you can see the amount of memory the printer file is using and how much you have left. On the Memory Usage screen, next to "Printing" in the "Feature" column you will see a value of 17K under the "Program" column. This is the space that is required to give XyWrite printer capability, and it will not change. The K value in the column under "File" is the amount of memory being used by the particular printer file that you have loaded. It is here that any savings of memory as a result of trimming the size of, or commenting out sections from, your printer file(s) will be reflected. The total available memory is listed in K at the bottom left of the screen. It's a good idea to copy the printer file under a different name before you begin to customize it to ensure that you will always have a fresh copy to look at if anything goes wrong. You should also save and load the file several times while you're customizing it. This helps you to debug the printer file and determine its memory requirements. Tip: Using the LP command rather than LOAD when loading a newly customized printer file allows any error messages that may appear to remain longer on the prompt line. ###