10 MODE0 30 *KEY10"OLD|M" 32 *FX21,0 40 PRINTTAB(25)"Parallel Data Transfer" 50 PRINTTAB(25)"----------------------"'' 60 PRINT"Here is another User Port project. Simply, if you can get the User Port to" 70 PRINT"behave as if it were a printer then you can transfer text from any computer" 80 PRINT"equipped with a parallel printer port to the beeb."' 90 PRINT"The advantage being that there is no communication protocol associated with" 100 PRINT"serial data transfer to worry about."' 110 PRINT"The program first opens a named file then the text is read from the User" 120 PRINT"Port and sent to the screen which is also being recorded in the file." 130 PRINT"When all the data is passed, pressing escape on the beeb closes the file."' 140 PRINT"Basic programs may be transported in this way but may need some syntax" 150 PRINT"changes in a word processor before attempting to EXEC and RUN it."' 160 PRINT"You need to build the adaptor which can either have a centronics socket" 170 PRINT"into which you can plug the normal printer lead or you can connect direct" 180 PRINT"to the source computer. In either case it is necessary to adapt to a 10 pin" 190 PRINT"DIL socket for the User Port."' 200 210 PRINT''"RETURN to see adaptor diagram" 220 INPUT''"INPUT FILENAME FOR DATA "S$ 230 IF S$="" MODE1:PROCadapter:RUN 240 F%=OPENOUT S$ 250 260 old%=!&204 AND &FFFF 262 270 FOR I%=0 TO 2 STEP 2 280 P%=&600 290 [OPTI% 300 LDA &FC:PHA 310 TXA:PHA 320 TYA:PHA 330 \ check if is CB1 interupt 340 LDA &FE6D:AND #&90:CMP #&90:BNE end 342 LDY #&EE 344 LDA #151:LDX #&6C:JSR &FFF4 350 \ Service routine 352 LDA #&FF:STA &70 \ Set recieve flag 354 \ LDA &FE60 \ Clear CB1 interupt 360 LDY #0 362 LDA #150:LDX #&60::JSR &FFF4 372 STY &80 430 .end 440 PLA:TAY 450 PLA:TAX 460 PLA:STA &FC 470 JMP old% \ Return via normal routine 480 ]NEXT 481 490 !&204=!&204 AND &FFFF0000 OR &600 492 ON ERROR PROCerror 500 501 REM Enable CB1 interupts 502 ?&FE6E=&90 503 510 REPEAT 512 520 IF ?&70=&FF THEN PROCget 522 REM ?&FE6C=&CE 524 *FX151,108,238 526 530 UNTIL FALSE 550 560 END 562 570 DEFPROCget 572 ?&70=0:REM Clear recieve flag 590 C%=?&80:VDUC% 600 IF C%=13 THEN VDU10 610 BPUT#F%,C% 620 *FX151,108,206 670 ENDPROC 680 690 DEFPROCerror 691 REM Disable CB1 interupts 692 ?&FE6E=&10 694 !&204=!&204 AND &FFFF0000 OR old% 700 CLOSE#F% 710 END 1000 1010 DEFPROCadapter 1020 VDU19,0,0,0,0,0 1030 VDU19,1,1,0,0,0 1040 VDU19,2,7,0,0,0 1050 VDU19,3,3,0,0,0 1060 REM This was drawn with the CAD program on JJF-34 1070 1080 OSCLI("LOAD ADAPTOR 3000") 1090 1100 PRINTTAB(0,0); 1110 PRINT"This adaptor in conjunction with the " 1120 PRINT"program makes the user port behave as a" 1130 PRINT"printer. The text receieved is sent to" 1140 PRINT"the screen and to disc." 1150 PRINTTAB(14,30)"Press P to printout" 1160 A=GET 1170 PRINTTAB(14,30)" " 1180 IF A=80 OR A=112 PROCprint 1190 ENDPROC 1200 1210 DEFPROCprint 1220 VDU19,2,7,0,0,0 1230 VDU19,3,1,0,0,0 1240 REM All-mode dump 1250 REM for Epson/Epson compatible printers 1260 REM by George Hill 1270 REM (c) Acorn User Sept. 1983 1280 : 1290 DIM S% &FF 1300 passnumber=S% 1310 pattern0=S%+1 1320 !pattern0=&0300 1330 pattern4=S%+3 1340 !pattern4=&3F00 1350 pattern1=S%+5 1360 !pattern1=&3F260400 1370 pattern2=S%+9 1380 !pattern2=&49841000 1390 !(pattern2+4)=&FF6FB966 1400 S%=S%+17 1410 PROClimits 1420 IF NOT graphics THEN PRINT"Not a graphics MODE. Can't dump.":VDU7:END 1430 PROCassemble 1440 REM enable printer, set linefeed (ESC A B) 1450 VDU2,1,27,1,65,1,8 1460 REM clear paper 1470 VDU1,10,1,10,1,10 1480 FOR Y%=1023 TO 0 STEP -16 1490 REM send bit code (ESC L 192 3 - 960 dots per line, 640 dots for mode 0) 1500 VDU1,27,1,76,1,n1,1,n2 1510 FOR X%=0 TO 1279 STEP stepsize 1520 !Xlo=X%+Y%*&10000 1530 ?pass=0 1540 CALL pixel 1550 NEXT 1560 VDU1,10 1570 NEXT 1580 REM reset linefeed & disable printer 1590 VDU1,27,1,65,1,12,1,12,3 1600 ENDPROC 1610 1620 DEFPROClimits 1630 DIM user 3 1640 A%=&87 1650 !user=USR(&FFF4) 1660 mode=user?2 1670 IF mode>5 OR mode=3 THEN graphics=FALSE ELSE graphics=TRUE 1680 IF mode=0 THEN n1=128:n2=2 ELSE n1=192:n2=3 1690 IF mode=0 THEN stepsize=2:?passnumber=1:?&80=pattern0 MOD 256:?&81=pattern0 DIV 256 1700 IF mode=4 THEN stepsize=4:?passnumber=3:?&80=pattern4 MOD 256:?&81=pattern4 DIV 256 1710 IF mode=1 OR mode=5 THEN stepsize=4:?passnumber=3:?&80=pattern1 MOD 256:?&81=pattern1 DIV 256 1720 IF mode=2 THEN stepsize=8:?passnumber=6:?&80=pattern2 MOD 256:?&81=pattern2 DIV 256 1730 ENDPROC 1740 DEFPROCassemble 1750 osword=&FFF1 1760 oswrch=&FFEE 1770 Xlo=S% 1780 Xhi=S%+1 1790 Ylo=S%+2 1800 Yhi=S%+3 1810 value=S%+4 1820 byte=S%+5 1830 pass=S%+6 1840 count4=S%+7 1850 S%=S%+8 1860 FOR opt=0 TO 2 STEP 2 1870 P%=S% 1880 [OPT opt 1890 \ Subroutines 1900 \ to calculate POINT(X,Y) 1910 .point 1920 LDX #Xlo MOD 256 1930 LDY #Xlo DIV 256 1940 LDA #9 1950 JSR osword 1960 RTS 1970 \ to print a character 1980 .printchar 1990 LDA #1 2000 JSR oswrch 2010 LDA byte 2020 JSR oswrch 2030 RTS 2040 \ to decrement Y by 4 2050 .decy4 2060 SEC 2070 LDA Ylo 2080 SBC #4 2090 STA Ylo 2100 BCC decYhi 2110 RTS 2120 .decYhi 2130 DEC Yhi 2140 RTS 2150 \ increment Y by 16 2160 .incy16 2170 CLC 2180 LDA Ylo 2190 ADC #16 2200 STA Ylo 2210 BCS incYhi 2220 RTS 2230 .incYhi 2240 INC Yhi 2250 RTS 2260 \ to rotate in two bits. Enter with X=pass, Y=colour. 2270 .twobits 2280 LDA (&80),Y 2290 CPX #0 2300 BEQ rotatein 2310 .rotateout 2320 ROR A 2330 ROR A 2340 DEX 2350 BNE rotateout 2360 .rotatein 2370 ROR A 2380 ROL byte 2390 ROR A 2400 ROL byte 2410 RTS 2420 \ to calculate a whole byte 2430 .onebyte 2440 JSR point 2450 LDY value 2460 LDA pass 2470 AND #3 2480 TAX 2490 JSR twobits 2500 JSR decy4 2510 DEC count4 2520 BNE onebyte 2530 JSR printchar 2540 RTS 2550 \ Main program 2560 \ to calculate and print the pattern for one pixel 2570 .pixel 2580 LDA #4 2590 STA count4 2600 JSR onebyte 2610 JSR incy16 2620 INC pass 2630 LDA pass 2640 CMP passnumber 2650 BNE pixel 2660 RTS 2670 ] 2680 NEXT 2690 ENDPROC