Spectrofon #09
30 сентября 1994 |
|
System - details the work with your printer. Article Starter users and programmers.
SYSTEM SERGEY Savoshchenko. Performer for "ZX-SPECTRUM". ------------------------- INTRODUCTION Printer - a peripheral device, which want to have before most users "ZX-SPECTRUM". Immediately, we note that this Computer literacy can connect virtually any printer, but This may occur one or other difficulties. Joint efforts we will try to overcome these difficulties. Interface type. This point is very important because depends on it way to connect the printer to computer. There are two main methods of information exchange between computers and periferynymi devices - Parallel and serial. In parallel connection all the bits that make up the bytes parcels are sent at the same time on parallel data buses. When a sequence of bytes transmitted bit by bit at a time. Historically, over interfaces implementing a parallel method transmission stuck title "CENTRONICS", but for consistent - "RS 232". METHODS OF INTERFACE. For "SPECTRUMa" there Several ways of organizing interfaces for connecting printer. We consider the two most popular ways to organize: 1. Realization using chips KR580VV55A; 2. Interface ZX-PRINT (MK III). INTERFACE KR580VV55A. To implement an interface type "CENTRONICS" useful KR580VV55A chip, which is a programmable interface adapter (PIA). The structure consists of three PIA 8-bit parallel I / O ports A, B, C. In our In the scheme of the port used for output data DATA 0-7 on printer, the LSB Port C - RS0 transmitted signal GATE, a senior level - RS7 to enter a busy signal printer. Port A is reserved a joystick. The program interface support inserts in the control register PIA number 136, which corresponds to the setting PIA in output mode for port B and 4-m LSB port, and enter the 4 th highest-Port S. Note that after switching supply or after resetting all PIA ports configured in Mode input. In addition, Addressing port A is chosen such that it allows the use of it as an interface joystick. The joystick will be chosen at zero on the tires A5 , RD, IORQ, which corresponds to the address Kempston interface. The printer is connected to the interface with the cable length 1,5-2m. To increase the load the ability to output interface You can include a buffer element in which we can use any TTL chips without inversion, eg 155LP4, 155LP10, 155LP11, 555AP5, 555AP6, 589AP16 etc. Some printers use a parallel interface IRPR different from CENTRONICS as the polarity of the signals, and exchange protocol. Despite the differences in communication protocols, circuit and program support interface CENTRONICS may well work with printers equipped with the interface IRPR. To do this, invert the information line DATA 0-7 and buffer the signal SC, as in IRPR required currents load of about 40mA. Signal AC is used instead of a busy signal and the signal SC instead of the signal GATE. As inverters and buffers can be used chip "XOR" - 155LP5. In this case, feeding on the second inputs of the elements chips "1" or "0", you get the output inverted or non-inverted signal, so your Parallel to universal. ZX LPRINT (MK III). Your attention is invited description of the next interface model: ZX-LPRINT (MK III). This interface can be configured and support equipment as a "CENTRONICS", and with the RS232. Mk III - printer interface can be used with version 16K, 48K and 128 K and different Other brand and amateur ZX-SPECTRUM for printing messages, graphics and text printers that use parallel (type CENTRONICS) or serial (such as RS232-5v) interfaces. When power ZX-SPECTRUM beyond the normal Input Menu (Intro), while All functions are preserved. Initialization. After switching on the Mk III has be initialized by the command "Carriage return" (CARRIGE RETURN (CHR $ 13). This is a team of "LPRINT + ENTER" or "LPRINT + line" in the program for BASIC. During initialization, Mk III automatically goes to the regime to print the text (TEXT MODE) and sets the printer to print 80 characters per line. The choice of different types of graphics printers by following commands: LPRINT CHR $ 0; CHR $ 0 - Call "MENU" LPRINT CHR $ 0; CHR $ 1 - SEIKOSHA GP 250 X LPRINT CHR $ 0; CHR $ 2 - SEIKOSHA GP 100 A LPRINT CHR $ 0; CHR $ 3 - EPSON (Models with high resolution) START DP 510, GEMENI I STX 80 LPRINT CHR $ 0; CHR $ 4 - WALTERS WM80, SHINWA and CTI CP 1980 LPRINT CHR $ 0; CHR $ 5 - for CHR $ 3, but the copy is reduced LPRINT CHR $ 0; CHR $ 6 - MIKROLINE 80 and 82, or the like CG115 and 'MCP40 in 4 colors Selectable command is displayed on the bottom line. Bust by pressing "SPACE" (SPACE). Confirmation selection by pressing "ENTER". Interface commands. LPRINT CHR $ 3 - carriage return with a linefeed (CR + LF) LPRINT CHR $ 2 - only to return carriage LPRINT CHR $ 1; "A" - where "A" can be from 1 to 8. This tells machine how many digits after the command will be interpreted as printer commands LPRINT CHR $ 4 - just one sign of interpreted as a command Printer LPRINT CHR $ 5 - decoder machine is turned off, that is all plates issued by this command will be interpreted as a codes of ASCII. Return to the decoder "ZX-SPECTRUM" occurs command "COPY". LPRINT CHR $ 0; S - switch with the interface "CENTRONICS" to "RS 232 " LPRINT CHR $ 0; P - Return of "RS 232" K "CENTRONICS" POKE 23697, n - where "n" specifies the number of characters per line printera.Pri initialize printer ustanavlivlen to 80 characters per line POKE 23728, n - speed via RS 232. When initializing 1200 baud. n rate n rate n rate ------------------------------- 1 75 4 300 7 2400 2 110 5 600 8 4800 3 150 6 1200 9600 9 BASIC COMMANDS Printer output LPRINT - print to the printer LLIST - print to a printer listing COPY - screen output to printer graphical form. Initializes the printer enough to make one time after turn on the computer or after command "NEW". Software compatibility Printer driver. As you can see, the implementation of interfaces for the printer chip and KR580VV55A ZX-LPRINT schematically different from each other and, therefore, software support (printer driver), will also vary from each other. There are many software tools for working with printer as a single driver and with others. They are incompatible. Below we will try to show you how you can combine tools with different printer drivers. Printer Driver AT IMS KR580VV55A. IC is a programmable KR580VV55A Interface Adapter (PIA). In PIA consists of three 8-bit parallel I / O port (see above description). Below we provide a standard program of the printer driver on IC KR580VV55A. This driver can occur in many programs that work with a printer connected via KR580VV55A. N! Mnemonic! Comment ------------------------------- 10! LD A, # 98! Configuring PIA: 20! LD C, # 7F! Channel A input 30! OUT (C), A! Channel B / O ! ! C1-channel output ! ! Channel C2-entry 40! LD C, # 5F! Clear signal 50! OUT (C), C! GATE 60! LD C, # 3F! Issue bytes 70! OUT (C), A! In the printer 80! LD C, # 5F! Poll 90! M1 IN A, (C)! Signal 100! RLA! BUSY 110! JR C, M1! 120! LD D, # FE! A signal 130! OUT (C), D! GATE 140! M2 DEC D! Delay 150! JR NZ, M2! GATE 160! OUT (C), C! Clear signal 170! RET! GATE. EXIT. The driver consists of two parts: 1. Rows 10 - 50 - Setting PIA; 2. Rows 60 - 160 - Issue bytes to the printer, which is contained in register A. As you can see from the above program listing, the addresses of external devices with respect to Z80 are as follows: # 7F - control register PIA; # 5F - Port C (C1-output gate, C2-input BUSY); # 3F - Port B (the output data byte on the printer). Port A, having an address # 1F, reserved in many schemes a Kempston joystick. Printer Driver ZX-LPRINT (MK III). The driver comes in two forms: resident and non-resident. Resident driver stored in ROM (see Figure 2) and called it only from 48K mode teams LLIST, LPRINT, COPY. Many programs can also access this drayveru.Kak work with such a driver, see above. It should be noted that This driver runs only Working from BASIC through the stream # 3. For example, the command: LLIST and LIST # 3 are identical. Non-resident driver is inserted into the body of some programs (also as driver ICs KR580VV55A) and upralyaet printer "Bypassing" ROM resident driver. Below we provide a standard printer driver ZX-LPRINT, which is used in many programs, both in the 48K mode, and a 128K-mode (ie it does not uses the system variables operating system). N! Mnemonic! Comment ------------------------------- 10! M1 IN A, (# 7B)! Poll 20! AND # 80! Signal 30! JR Z, M1! BUSY 40! PUSH BC! Delay 50! LD B, # 40! GATE 60! OUT (# FB), A! Issue bytes 70! M2 OUT (# 7B), A! Issue GATE 80! DJNZ M2! Delay 90! OUT (# FB), A! Hide GATE 100! POP BC! 110! RET! Output As you can see from the above program listing, the addresses of external devices with respect to Z80 are as follows: # FB - input / output data without Strobe # 7B - data input / output from the gate. Many drivers line 40,50,80,100 programs often No, because there is no need to introduce a delay for signal GATE. But if your Printer signal GATE is critical on time parameters, it is best to introduce zaderzhku.Nominalnoe number of delays is selected in line 50. You can start with maximum # FF, and reducing the pick up to par. (For example, Printer ROBOTRON 6329 Par is # 40.) The above drivers printer may vary slightly in some programs, but the basic organization of the software support is as well as in the above listings. Now that we have in front of him standard printer drivers, You can embed them in one way or another program, knowing how you implemented in a computer printer interface, ie achieve compatibility of programs with your computer. Below, an example program "ARTSTUDIO", we show how You can achieve compatibility printer driver. Program Settings "ARTSTUDIO". The program "ARTSTUDIO" is the most powerful and flexible among the currently existing graphical editors for computer class "SPECTRUM". The program was created in the calculation to any user - both beginners and artists engaged in creating professional graphic designs. The program is istallyatsionnoy (install programm) is with means it can be installed (A) a working copy of the program, which will focus a specific configuration for your external devices (printer, keyboard, joystick, user interface, driver, etc.). To create a working copy you need to have the original disk (original disk), which written Installs program, and assigned to disk (destination disk), in which you want to create (install) working copy. The program "ARTSTUDIO" exists in two versions: 48K and 128K. All configuration steps program, described below, valid for the two options. In order to competently configure "ARTSTUDIO", to work with a particular printer in graphics mode, you know the basic commands to your printer. These commands are in the operating instructions for your printer. If you do not instructions to the printer, then lower The basic command codes EPSON-compatible printers. So, we proceed to set up program. After downloading the program "ART S128 ", you will see a message" ART STUDIO 128K install programm ", which says that the program is installation. Next, the program asks you where you will install program - on tape or on disc. You will need to choose specific external support. After selecting a media program displays the following table and the question: 1 .... User-defined keys 2 .... Interfase 2 joystisk 3 .... Kempston joystick 4 .... Cursor keys / joystick 5 .... AMX mouse 6 .... Kempston mouse Select input device? This table and the question requires you to select a specific input device that allows you to manage the program. You need to press specific figures. To select a keyboard, we introduce the number 1. Next, the program will require identify certain key directions and selection commands. The program then asks: Are you using an 80-column dot matrix printer (y or n)? ie Will you use 80-column (narrow), the matrix printer. If you have a printer with other characteristics, then you meet 'n'. Next, the program will print the following table, the question: 1. Kempston 'S' Centronics 2. Kempston 'E' Centronics 3. Tasman type A Centronics 4. Tasman type B / 1 Centronics 5. Tasman type B / 2 Centronics 6. Tasman serial RS232 7. Hilderbay Centronics 8. Morex Centronics 9. Morex RS232 10. ZX Interfase 1 RS232 11. ZX Lprint II / III Centronics 12. ZX Lprint II / III RS232 13. Micro Peripherals Centronics 14. Direco Centronics 15. Dk'tronics Centronics 16. AMX Centronics 17. Indescomp Centronics 18. Indescomp RS232 19. Spectrum +2 255. User-own driver The table shows that from You need to select the controller and the type of interface through which connected to your computer to your printer. This choice is necessary in order program to be established specific driver in the program. If the table you will not find way to connect your printer (eg via IMS KR580VV55A), you can choose 255 - User-own driver. After such a selection program will sozdavt control codes for the printer, but a driver you will need to insert themselves into created a program (as done will be discussed below). For example, we will install the software for the printer ML 6312, which is the EPSON Compatible. Our printer is connected via ZX-LPRINT interface CENTRONICS, ie choose the table number 11. Next, it asks: Enter number of wires in print heard (7 or 8)? Here we are asked to choose how many needles (7 or 8) could be used printer the derivation of the picture. To the question: Is the top wire the mb (y or n)? Need to answer 'y'. Here you set the line numbers of needles and number of bits output bytes. Next, it asks: Enter control codes to be sent to the printer before a screen dump, separated by commas? The program asks you to enter control codes with which your printer should be prepared for printing, as well as any other preparatory codes (carriage return, etc.). For our printer, we introduce: 27,65,8 - in this case, this chain code corresponds to the command 'set the interval at 8 / 72 of an inch. " Numbers are entered in decimal the form of a comma. To the question: Enter number of dots in single denisty mode? You must enter the number of points printed in single density. We will introduce 480. Next, it asks: "Enter control codes ....", on we must introduce control codes by which the printer is switched graphics mode single density with a given number of points. We introduce: 27,75,224,1. Next, follow the same two question, but for the double print density. Answers will respectively: 960 and 27.76, 192.3. To the question: Enter control code for carriage return? Need enter the code that corresponds to carriage return - 13. To the question: Enter control code for line feed? , Enter code corresponding to the translation line - 10. After answering all questions the program displays the resulting table of all the values you entered. If this table you are satisfied, then the question: Is this correct? Need answer 'y'. Otherwise, all questions repeated. After the answer the last question utanovka work program will be completed on selected external media. The name of the new program will be assigned to "STUDIO 128". SELECT MODE GRAPHICS Images on the printer. At EPSON-compatible printer You can display a graphic representation of different scales and density. When you configure the program "ARTSTUDIO" We asked the two modes of graphic images on Printer: normal density and double density, with set of control codes. These modes, we asked following codes: - The normal density (480 points) - 27,75,224,1 - Double density (960 points) - 27,76,192,3 The table below: You can see that the graphic printer mode can be changed and, hence, output to a printer in various formats. Mode Density Code Contents -------------------------------------------------- --------! 0! Single! ESC K! 60 points per inch! ! ! ! ! 480tochek/8-dyuymovaya line! ! ! ! ! 816tochek/13 ,6-inch line! -------------------------------------------------- --------! 1! Double with! ESC L! 120 dots per inch! ! ! Low! ! 960 tochek/8-dyuymovaya line! ! ! Speed! ! 1632tochek/13 ,6-inch page! -------------------------------------------------- --------! 2! Double with! ESC Y! the same density as in the re-! ! ! Low! ! regime 1, but faster. ! ! ! Speed! ! ! -------------------------------------------------- --------! 4! CRT 1! No! 80tochek/dyuym! ! ! ! ! 640tochek/8-dyuymovaya line! ! ! ! ! 1088tochek/13 ,6-inch page! ! ! ! ! Coincides with the density-screen! ! ! ! ! Tew, 10 (this makes it easier once-! ! ! ! ! load screen)! Mode Density Code Contents -------------------------------------------------- --------! 5! One by No! 72 pixels / inch! ! ! Other! ! 576 tochek/8-dyuymovaya line! ! ! (Grafopos-!! 979 tochek/13 ,6-inch page! ! ! Troitel)! ! Horizontal density! ! ! ! ! identical with the vertical that! ! ! ! ! allows to depict the circle! ! ! ! ! sequence without distortion. ! -------------------------------------------------- --------! 6! CRT 11! No! 1990 dpi! ! ! ! ! 720tochek/8-dyuymovaya line! ! ! ! ! 1224 tochki/13 ,6-inch page! -------------------------------------------------- --------! 7! Grafopost-No! 144tochki/dyuym! ! ! Roitel with! ! 1152 tochki/8-dyuymovaya line! ! ! 4-fold! ! 1958 tochek/13 ,6-inch page! ! ! Density! "Well, very small images! ! ! ! ! You can display! ! -------------------------------------------------- -------- This table shows for Printer ML 6312. Others EPSON compatible printers can be some deviations. Selecting a graphics mode for printer control codes defined by the following: code ASCII ESC * (m) (n1) (n2) Decimal 27 42 (m) (n1) (n2) sixteen. 1B 2A (m) (n1) (n2) where: m = 0 - 7 - graphics mode (see table above) n1, n2 = 0 - 255 - the number of points. Number of points calculated by the following formula: N = number of points n1 = N MOD 256 n2 = INT (N/256) For example: N = 480 points n1 = 480 MOD 256 = 224 decimal. or E0 hex. n2 = INT (486/256) = 1 decimal. or 01 hex. You can be sure that the same codes we introduced in setup program "ARTSTUDIO" When you configure the program "ARSTUDIO" you can ask any of the 7 graphics. For example, on a matter in which need to specify the behavior of single print density, the printer, you enter the following parameters: 640 and 27.2 A, 04,128,2 you ask 4 graphics mode and get pictures on a printer without any distortion. Program Settings "ARTSTUDIO" Under any printer driver. In this section, for example, program "ARTSTUDIO", we describe how to configure one or another program under a certain printer driver. Ie Our goal is to to find where in the program is a printer driver and if it does not suit us, then competently replace it with another. Location driver printer in the body of the program can be determined using various disc or cassette program monitors. We use program "DOCTOR V4". With this program, "DOCTOR" We find a printer driver file "studio_m". It has the form: 00 00 00 00 08 00 00 00 00 1B 41 08 E0 January 2000 00 00 1B 4B E0 01 C0 00 March 2000 00 1B 4C C0 03 0D 0A 64 87 6E 87 6E 87 73 87 16 00 DB 7B E6 80 C9 D3 FB D3 7B D3 FB C9 00 At first glance, nothing understandable. But if you carefully consider this dump, you understand what is presented here table settings that we asked when setting up "ARTSTUDIO" and followed it - software printer driver. We analyze this dump in order: 08 - given the number of needles Printer 1B 41 08 - command 'set interval ' E0 01 - number of points under single density = 480 1B 4B E0 01 - Team inc. graph. single-mode density C0 03 - number of points under double density = 960 1B 4C C0 03 - Team inc. graph. mode of double-density 0D - code carriage return 0A - linefeed code. This first part of the dump contains options to enable various modes of the printer. The second part of the dump contain address challenges of the driver prints pa and the program itself 'driver Printer. Consider these codes: 64 87 - Starting Address 6E 87 - Address Call 6E 87 - Address Call 73 87 - Address Call 16 00 - Number of bytes used in the second part of the dump. Call is located at the addresses the program itself is "a printer driver ZX-LPRINT ": DB 7B E6 80 C9 - poll signal BUSY D3 FB D3 7B D3 FB C9 - Conclusion bytes to the printer Now, knowing the value of the above codes, you can not resorting to installs-program set up a working copy of the program "ARTSTUDIO" at will. Ie You can insert themselves into the program different settings for the printer: number of needles, number of dots, a graphic image. And so are you can insert into your program printer driver. For example, a printer driver for IMS KR580VV55A second part of the dump will be as follows: 64 87 6E 87 92 87 94 87 4F 00 98 3E 0E 7F ED 79 0E 5F ED 49 3E 1B CD 94 87 3E 40 CD 94 87 3E 1B CD 94 87 3E 55 CD 94 87 3E 00 CD 94 87 C9 AF C9 0E 3F ED 79 0E 5F ED 78 17 38 FB 16 FE ED 51 15 20 FD ED 49 C9 00 The program "ARTSTUDIO" configured to work with the printer driver for IMS KR580VV55A. Now you have the skills to configure any program under a specific printer driver. WARNING! In order to avoid spoil the program-originals All changes to the programs it is desirable to produce duplicate diskettes! RECEPTION PICTURES From any program. In this section, we describe as a "pull" your favorite picture from any program. The easiest way - is use the "magic button" - MAGIC. Pictures "pulled out" as follows: you load the desired game. After appears on the screen the desired image, you press the "magic button and the entire program from the computer memory along with a screen area can be rewritten to a floppy disk that you previously insert into the drive. The recorded files to a floppy disk automatically assigned a name "@". Now, in order to "Pull" only a picture of This magic-file, use the following short program. 10 INPUT "NAME"; N $ 20 RANDOMIZE USR 15619: REM: LOAD "@" CODE 16384,6912 30 RANDOMIZE USR 15619: REM: SAVE N $ CODE 16384,6912 The pictures you can handle any graphics editor: ARTSTUDIO, ARTIST and etc. Command codes for Printers Special command codes transmitted to the printer series ESCAPE sequences. ESCAPE - sequence consists of a package (27) and the subsequent alphanumeric signs or symbols. The table below is a list of control programs. In parentheses is indicated decimal code functions. In the angular brackets indicate the characters that can be typed on the keyboard. Symbols N, N1, N2 - this number in the range from 0 to 256. -------------------------------------------------- ----! FUNCTION! CONTENT! -------------------------------------------------- ----! BEL (7)! Audible alarm! ! BS (8)! Return to step! ! HT (9)! Horizontal tab! ! LF (10)! Newline! ! FF (12)! Translation format! ! CR (13)! Carriage return! ! SO (14)! The inclusion of the Russian font! ! SI (15)! The inclusion of Latin letters! ! DC1 (17)! The choice of printer! ! DC3 (19)! Cancel printer! ! CAN (24)! Cancel a string! ! DEL (127)! Removing the sign! ! ESC <*> N, N1, N2! Mode Selection graphic! ! ESC <-> 1! Enabling the underscore! ! ESC <-> 0! Disable underline! ! ESC <0>! The choice of 1/8-inch intervals! ! ESC <1>! Choosing 7/96-dyuymovogo interval! ! ESC <2>! The choice of 1/6-inch intervals! ! ESC <3> N! Choosing n/288-dyuymovogo interval! ! ESC <8>! Lock the sensor end of the paper! ! ESC <9>! Inclusion of the sensor end of the paper! -------------------------------------------------- ----! FUNCTION! CONTENT! -------------------------------------------------- ----! ESC <@>! Initiating the printer! ! ESC N! Choosing n/96-dyuymovogo interval! ! ESCN! Selecting page length to n lines! ! ESC 0N! Selecting page length to n inches! ! ESC ! Setting horizontal tab! ! ESC <E>! Selecting an underlined the regime! ! ESC <F>! Cancel underlined the regime! ! ESC <G>! Selecting the mode double whammy! ! ESC <H>! Canceling the double whammy! ! ESC <J> N! Submission of papers on n/288 inches forward! ! ESC <j> N! Back Feeding on n/288 inches! ! ESC <K> N1, N2! Mode single, graphic-! ! ! density! ! ESC <L> N1, N2! Mode graphic double! ! ! density! ! ESC <M>! Step selection "ELITE", compacted mode! ! ESC <N> N! Choosing pass through the perforations! ! ESC <O>! Cancel passes through the perforations! ! ESC <R>! Choice of characters! ! ESC 0! Select to print a superscript! ! ESC SI! Inclusion of compressed mode! -------------------------------------------------- ----! FUNCTION! CONTENT! -------------------------------------------------- ----! ESC1! Select to print the lowercase! ! ESC <T>! Cancel print top. and the subscript! ! ESC <W> 1! Selecting Advanced mode! ! ESC <W> 0! Cancel extended mode! ! ESC <Y> N1, N2! Selecting a graphics mode dual density! ! ! surface at high speed! -------------------------------------------------- ---- This table command codes refer to the printer ML 6312. Others EPSON - compatible printers may be some deviations or additions, but they are insignificant. LITERATURE. 1. USERS GUIDE "SPECTRUM" - FIRM "VA PRINT". 2. A. Larchenko, N. Rodionov "ZX-SPECTRUM FOR USERS AND Programmer ". 3. A. Larchenko, N. Rodionov "dialect BASIC. *
Other articles:
Similar articles:
В этот день... 21 November