Twenty-four pin printers such as the Epson LQ500 and the NEC P2200 are becoming increasingly more popular among Archimedes owners. Unfortunately though, printer dumps designed for use with conventional 9-pin printers are useless with a 24-pin device, and this includes the built-in Hardcopy module. The program presented here corrects this by providing a dump for sixteen colour modes (modes 2, 9 and 12). In order to reproduce the colours as grey scales, sixteen different dot patterns are used. The dump is compatible with the LQ500, the P2200, and most other 24-pin printers.
Start by typing in and saving the program given in the listing. When run, the program will catalogue the current disc and ask you to enter the filename of a saved screen, which is then loaded. Pressing space will reduce the picture's colours to a series of grey scales and start the dump, while any other key will return you to the catalogue. It takes about two minutes to dump the entire screen, and Escape can be used to abort the dump at the end of the current line.
Before dumping the screen, the program has to convert the colours to grey scales. It does this by assuming that colour 0 will be the darkest (i.e. black), and colour 15 will be the lightest (i.e white). The other colours are assumed to rise in brightness with increasing colour number. You can, if required, change this default mapping by altering the DATA statement in line 600. There are sixteen numbers, one for each logical colour, each of which can take one of sixteen values. These values represent the brightness from 0 (black) up to 15 (white).
To incorporate the dump in your own program, simply include the two procedure definitions (PROCshade and PROCdump), and the two DIM statements from line 80. Then, to produce a dump of the current screen execute PROCdump.
The dump is performed to a resolution of 320 by 256 screen pixels, with each being printed as an array of sixteen dots. This means that some resolution is lost in mode 12, but in practice this is hardly noticeable. The printer is set to print 180 dots per inch in both directions, giving a dump size of 7.11" by 5.6" an overall aspect ratio of 1.27:1, which is very close to the screens aspect ratio of 1.33:1.
The procedure PROCshade sets up the screen colours, and also the grey scales used by the printer. The data in line 610 defines a four by four print pattern for each grey level. Each hex digit represents one row of the pattern, with the most significant digit being the bottom row. The patterns used are designed to reduce fringe effects when the patterns are printed side by side.
10 REM > 24PinPrint
20 REM Program 24-pin printer dump
30 REM Version A1.00
40 REM Author C.W.Murray
50 REM RISC User June 1989
60 REM Program Subject to Copyright
70 :
80 DIM S%(15),grey(15)
90 REPEAT
100 MODE0:*CAT
110 INPUT "Screen filename ";F$
120 OSCLI("SCREENLOAD "+F$)
130 OFF
140 A$=GET$:IF A$=" " THEN PROCdump
150 UNTIL FALSE
160 END
170 :
180 DEFPROCdump
190 IF MODE <>2 AND MODE <>9 AND MODE <>12 THEN ERROR 0,"Not a suitable mode"
200 PROCshade
210 *FX200,1
220 VDU2
230 VDU1,27,1,51,1,1,1,10
240 FOR Y%=1020 TO 36 STEP-24
250 VDU 1,27,1,42,1,39,1,0,1,5
260 FOR X%=0 TO1278 STEP 4
270 A%=POINT(X%,Y%)
280 B%=POINT(X%,Y%-4)
290 C%=POINT(X%,Y%-8)
300 D%=POINT(X%,Y%-12)
310 E%=POINT(X%,Y%-16)
320 F%=POINT(X%,Y%-20)
330 FOR CL%=0 TO 3:L%=16^CL%:K%=15*L%
340 BA%=(((S%(B%))AND K%)/L%)+(16*(((S%(A%))AND K%)/L%))
350 BB%=(((S%(D%))AND K%)/L%)+(16*(((S%(C%))AND K%)/L%))
360 BC%=(((S%(F%))AND K%)/L%)+(16*(((S%(E%))AND K%)/L%))
370 VDU1,BA%,1,BB%,1,BC%
380 NEXT:NEXT
390 IF INKEY(-113) THEN VDU1,27,1,64,3
:OSCLI("FX200,0"):MODE0:PRINT"Escape":ON:END
400 VDU 1,27,1,74,1,23,1,10
410 NEXT
420 VDU1,12,1,27,1,64,3
430 *FX200,0
440 ENDPROC
450 :
460 DEF PROCshade
470 RESTORE
480 FOR F=0 TO 15
490 READ G:grey(F)=G
500 COLOUR F,G*16,G*16,G*16
510 NEXT
520 FOR N%=0 TO 15
530 READ pattern
540 FOR F%=0 TO 15
550 IF grey(F%)=N% THEN S%(F%)=pattern
560 NEXT
570 NEXT
580 ENDPROC
590 :
600 DATA 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
610 DATA &FFFF,&FDBE,&FB3F,&DA7A,&5A7A,&A5A5,&A1A5,&A185,&8185,&8241,&0241,&0660,&0240,&0600,&0200,&0000