DMP 2200 (260-1279) Buffer Operation Faxback Doc. # 4552 BUFFER OPERATION The DMP-2200's ability to temporarily store data is one of its main advantages over a typewriter. Codes sent to a typewriter (i.e. keys press- ed) are transferred immediately to the paper. Codes sent to a Printer are not printed immediately to the paper; they are stored in a separate section of memory in the Printer called the buffer. When the buffer fills, or cer- tain codes are received (e.g., LF or CR), the buffer is emptied and all data is then printed on the paper. What happens after the buffer is emptied and all data is printed depends on the circumstances. In some cases, print- ing continues on the same line; in others, the print head is moved to a different position relative to the paper. In the DP mode, commands for changing print fonts, line feed, etc., can be stored in the buffer to take effect when the data is dumped to paper. Understanding how the buffer works is important for those who wish to gain full control of the DMP-2200. HINTS AND TIPS ON THE DMP-2200 BUFFER: DP, WP, AND GRAPHICS MODES * The buffer allocates a fixed number of dots, depending on the character width selected. The buffer is emptied when the data stored equals that number. Printing resumes at the start of the next line unless DIP switch A-7 is set to ON (CR only). If different character widths have been used on the same line, the last character added may exceed the dot count. the buffer is printed without this last character. * The last character received by the buffer is printed at the beginning of the next print line following an automatic line feed and carriage return. * The form feed code (FF = 12 decimal) automatically activates printing (if the code makes it to the Printer). If LF only has been selected (DIP switch A-8), then the buffer is printed and the print head moves to the next top-of-form line without a carriage return to the beginning of the line. Otherwise, the print head is positioned at the beginning of the next top-of-form line. * The carriage return code (CR = 13 decimal) automatically activates printing (assuming at least one character code is already in the buffer). If carriage return only has been selected by the setting of DIP switch A-7 the print head is moved to the beginning of the current line and the next buffer-full condition will result in printing over the current line. Otherwise, subsequent characters will be printed at the start of the next line. * The line feed code (LF = 1- decimal) automatically activates printing. If LF only has been selected (DIP switch A-8), then the buffer is printed and the print head moves to the next print line without a carriage return to the beginning of the line. Otherwise, the print head is positioned at the start of the next print line. * If the computer delays more than a second before sending the next print code, the buffer is printer. Printing continues from the current position. * The head positioning sequence (27 16 n1 n2) prints the buffer. Printing continues in the current line at the dot address specified by the (27 1) command. DATA AND WORD PROCESSING MODES ONLY * The backspace command activates printing. Printing continues in the current line at the dot address specifies by the command. * Dot graphics printing continues from the current character position. GRAPHICS MODE ONLY * When the end graphics mode command is received the Printer returns to the previous print mode and printing continues in the same line from the current print position. NOTE 1: In the description, next line means the new line performed by a line feed operation. In data processing mode, if a reverse line feed has been set in the memory, the line feed operation will cause the paper to move in the reverse direction. NOTE 2: Repeat data can cause a buffer-full condition, as well as an overflow by single characters. HEX PRINT MODE The DMP-2200 is capable of printing hexadecimal values for data that is transmitted to it. This hex print mode is useful for checking exactly what information is being received by the Printer. To implement this function, turn on the power to the Printer while simultaneously holding down the FORM FEED and LINE FEED switches. And then RUN the program that you want to check. For example, the BASIC program line: 10 LPRINT "NOW IS THE TIME FOR" will normally print out as NOW IS THE TIME FOR If you enter hex print modem the printout will look like this: 4E 4F 57 20 49 53 20 54 48 45 20 54 49 4D 45 20 NOW IS THE TIME 46 4F 52 0D FOR. (4E=N,4F=O,57=W,20=SPACE,ETC.) To exit hex print mode, turn the printer OFF and then ON again. WORD AND DATA PROCESSING MODES REPEAT PRINTING The DMP-2200 provides a built-in repeat capability. You can use it to repeat a single character code up to 255 times. It's great for repeating graphics codes, underlining, block graphics, etc. The repeat feature uses a three-code sequence: * CHR$(28) * The number of repetitions * The code to be repeated Type in this new program: 20 LPRINT CHR$(27);CHR$(28);" "; 30 LPRINT CHR$(28);CHR$(9);CHR$(241); 40 LPRINT " ";REM 1 BLANK SPACE 50 LPRINT CHR$(8);CHR$(7); 60 LPRINT CHR$(92);"/(X";CHR$(27);"S";CHR$(0);"2";CHR$(27);"X"; 70 LPRINT "+2X+1)" 80 END Code 241 is from the graphics character set. Now RUN the program. With a little fancy footwork, you were able to line up the two slashes and came up with a rough approximation of a square root sign. Brings back bad memories, doesn't it? NOTE: Depending on the computer, the second parameter (number of repetit- ions) is interpreted differently. For example, CHR$(9) may be interpreted as the TAB command, causing the print head to move to the next TAB position instead of printing characters 9 times. Refer to the owner's manual of your computer for details. UNDERLINE PRINTING If you need to underline any text in either DP or WP mode, send the DMP- 2200 a CHR$(15). All text that follows this code will be underlined until you send a CHR$(14) which stops underlining. If a print head positioning code is received while the Printer is in an underline-selected condition, the underline is not printed between the home position (leftmost printing position) and the dot column position de- signated by the print head positioning code. If you enter graphics mode while the Printer is in an underline-selected condition, when you return to the former character printing mode, the designation of underline is the same as it was before entering graphics mode. TABLE 22. UNDERLINE PRINTING ────────────────────────────────────────────────────────────────────────────── SEND CHR$( ): (DEC) (HEX) TO: ────────────────────────────────────────────────────────────────────────────── 15 0F Start Underline 14 0E Stop Underline ───────────────────────────────────────────────────────────────────────────── For example, type in this short program; 10 LPRINT CHR$(20);:REM WORD PROCESSING 20 LPRINT CHR$(15);:REM START UNDERLINE 30 LPRINT "LEEWAY BUSINESS PRODUCTS" 40 LPRINT CHR$(14);:REM STOP UNDERLINE 50 LPRINT "GIVES GOOD SERVICE" 60 END In this example, line 20 turns on the underline and the first line of text (LEEWAY BUSINESS PRODUCTS) is underlined. Line 40 turns the underline off and GIVES GOOD SERVICE is not underlined. PRINT HEAD POSITIONING In either DP or WP mode, you can position the print head to a specific dot position. Every other print head position is accessible through the positioning sequence. Using the Standard character sets (10 CPI), there are 1632 dot positions per line, but only half (816) are accessible by you. Standard 10 CPI characters use the same dot columns, even though the characters are printed twice as wide. Even if underline is designated, underline does not appear between the home position (the leftmost printing position) and the position designated by the print head position code. To position the print head to a specific position, send a (27 16), then two numbers (we'll call the n1 and n2) that specify the desired position. In other words, just follow this general procedure: 1. Send a control code which specifies the character set (normal, condensed, compressed). 2. Send a CHR$(27);CHR$(16) to tell the Printer you want to position the print head to print a specific dot column. 3. Tell the Printer which dot column you want to print. This is a little more complicated and will be explained shortly. For now, just understand that you simply tell the Printer which dot column you want. 4. Tell the Printer what you want to print. When you want to specify a dot column where printing is to begin, you must first use CHR$ to send the 27 code. Follow this with another two-code sequence which specifies the position. For instance: LPRINT CHR$(27);CHR$(16);CHR$(N1);CHR$(N2) where n1 is a value between 0-9 and n2 is a value between 0-255. TABLE 24. PRINT HEAD POSITIONING ────────────────────────────────────────────────────────────────────────────── IF YOU WISH TO SPECIFY DOT COLUMN 1 MUST BE: n2 MUST BE: ────────────────────────────────────────────────────────────────────────────── 0-255 0 0-255 256-511 1 0-255 512-767 2 0-255 768-1023 3 0-255 1024-1279 4 0-255 1280-1535 5 0-255 1536-1791 6 0-255 1792-1958 7 0-166 ────────────────────────────────────────────────────────────────────────────── REMEMBER!! Standard 10 CPI printing allows you to access dot columns up to 815 (n1 = 3, n2 = 47); standard 12 CPI printing allows you to access dot columns up to 978 (n1 = 3, n2 = 210); standard 17.1 CPI printing allows you to access dot columns up to 1397 (n1 = 5, n2 = 117); proportional or correspondence 10 CPI printing allows you to access up to 1631 (n1 = 6, n2 = 95); compressed proportional or correspondence 12 CPI allows you to access dot columns up to 1957 (n1 = 7, n2 = 165). Why two numbers (n1 and n2)? The maximum value you can send to the DMP-2200 with one number is 255, and clearly you have more that 255 dot positions available. Those of you who are fans of binary math will recognize that the DMP-2200 is interpreting these two numbers as a single 11-bit (b(0)-b(10)) value. The three lower bits on n1 are used as b(8), b(9), and b(10). NOTE: Use 15-inch wide paper for this next example. See if you can print a character starting in position 816 in normal density. n1 = 3 gives 768 of those dots, and 816 - 768 = 48 is the difference to be sent as n2. Type: LPRINT CHR$(27);CHR$(16);CHR$(3);CHR$(47);"*" and RUN the program. Whoops! The asterisk printed at the left edge of the paper. Hmmm! Maybe you need to leave enough room for the asterisk to fit on the end of the line. Try: 10 LPRINT CHR$(27);CHR$(16);CHR$(3);CHR$(42);"*" and RUN the program. That's better. It fits nicely at the end of the line. Try this program with the different character densities. Position is a little like a TAB, but it gets right down to the dot level, giving you much finer control. Although it is available in all three print modes, its potential is greatest in graphics mode. If you want to make a real mess on your paper, try: 10 LPRINT CHR$(27);CHR$(28); 20 FOR I = 1 TO 100 30 LPRINT CHR$(27);CHR$(16);CHR$(1);CHR$(150+I*SIN(1/5)); 40 LPRINT "*" 50 NEXT I Get out of the double-width mode and the RUN the program. LEFT AND RIGHT MARGIN You can position the left/right margin to a specific character position designated by the current font pitch. When you want to change the left margin to a new position, you must first send a CHR$(27);CHR$(81) to tell the Printer to change the left margin. Follow this with another code which specifies the number of characters from the leftmost position. When you want to change the right margin to a new position you must first send a CHR$(27)CHR$(82) to tell the Printer to change the right margin. Follow this with another code which specifies the number of characters from the leftmost position. TABLE 25. LEFT/RIGHT MARGIN SET ────────────────────────────────────────────────────────────────────────────── SEND CHR$( ): (DEC) (HEX) TO: ────────────────────────────────────────────────────────────────────────────── 27 81 n 1B 51 n Left Margin Set 27 81 n 1B 52 n Right Margin Set ────────────────────────────────────────────────────────────────────────────── The value n indicates the number of characters counted by the current font pitch from the leftmost margin. * The minimum distance between the left and right margins is 1/5" (2-character space on 10 CPI). If you give n a value that results in less than 1/5", the Printer sets to minimum 1/5". * These commands, left or right margin setting, are print start commands. When receiving one of these commands, the Printer prints out the current buffer contents and subsequent data will be printed from the designated left margin. SKIP PERFORATION You can set a skip zone for a perforation at the bottom of the form. TABLE 26. SKIP PERFORATION SET ────────────────────────────────────────────────────────────────────────────── SEND CHR$( ): (DEC) (HEX) TO: ────────────────────────────────────────────────────────────────────────────── 27 72 n 1B 48 n Set Skip Perforation ────────────────────────────────────────────────────────────────────────────── The skip zone is determined by the number of n times 1/6". n equals the number of full lines to leave blank at the bottom of the form. * If the value is already set, the Printer automatically skips the designated area when printing. * If n extends the form length, this sequence will be ignored. * At power-on, n is set to 0 to 1 automatically by the selection of DIP switch B-3. * If the form length is changed, the skip area will become zero. BIDIRECTIONAL AND UNIDIRECTIONAL PRINTING In all modes, either bidirectional or unidirectional, printing is selectable. TABLE 27. BIDIRECTIONAL/UNIDIRECTIONAL PRINTING ────────────────────────────────────────────────────────────────────────────── SEND CHR$( ): (DEC) (HEX) TO: ────────────────────────────────────────────────────────────────────────────── 27 85 0 1B 55 0 Start Bidirectional Printing 27 85 1 1B 55 1 Start Unidirectional Printing ────────────────────────────────────────────────────────────────────────────── If you need to select unidirectional printing, send a CHR$(27);CHR$(85);CHR$(1); and, to return to bidirectional printing, send a CHR$(27);CHR$(85);CHR$(0). At power-up, bidirectional printing is selected. (dtc-07/26/93)