10 MODE0
30 *KEY10"OLD|M"
32 *FX21,0
40 PRINTTAB(25)"Parallel Data Transfe
r"
50 PRINTTAB(25)"---------------------
-"''
60 PRINT"Here is another User Port pr
oject. Simply, if you can get the User
Port to"
70 PRINT"behave as if it were a print
er then you can transfer text from any c
omputer"
80 PRINT"equipped with a parallel pri
nter port to the beeb."'
90 PRINT"The advantage being that the
re is no communication protocol associat
ed with"
100 PRINT"serial data transfer to worr
y about."'
110 PRINT"The program first opens a na
med 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 transp
orted in this way but may need some synt
ax"
150 PRINT"changes in a word processor
before attempting to EXEC and RUN it."'
160 PRINT"You need to build the adapto
r which can either have a centronics soc
ket"
170 PRINT"into which you can plug the
normal printer lead or you can connect d
irect"
180 PRINT"to the source computer. In e
ither 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 diag
ram"
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 en
d
342 LDY #&EE
344 LDA #151:LDX #&6C:JSR &FFF4
350 ½ Service routine
352 LDA #&FF:STA &70 ½ Set recieve fla
g
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 rou
tine
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 pr
ogram 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 printou
t"
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
1240REM All-mode dump
1250REM for Epson/Epson compatible prin
ters
1260REM by George Hill
1270REM (c) Acorn User Sept. 1983
1280:
1290DIM S% &FF
1300passnumber=S%
1310pattern0=S%+1
1320!pattern0=&0300
1330pattern4=S%+3
1340!pattern4=&3F00
1350pattern1=S%+5
1360!pattern1=&3F260400
1370pattern2=S%+9
1380!pattern2=&49841000
1390!(pattern2+4)=&FF6FB966
1400S%=S%+17
1410PROClimits
1420IF NOT graphics THEN PRINT"Not a gr
aphics MODE. Can't dump.":VDU7:END
1430PROCassemble
1440REM enable printer, set linefeed (E
SC A B)
1450VDU2,1,27,1,65,1,8
1460REM clear paper
1470VDU1,10,1,10,1,10
1480FOR Y%=1023 TO 0 STEP -16
1490REM send bit code (ESC L 192 3 - 96
0 dots per line, 640 dots for mode 0)
1500VDU1,27,1,76,1,n1,1,n2
1510FOR X%=0 TO 1279 STEP stepsize
1520!Xlo=X%+Y%*&10000
1530?pass=0
1540CALL pixel
1550NEXT
1560VDU1,10
1570NEXT
1580REM reset linefeed & disable printe
r
1590VDU1,27,1,65,1,12,1,12,3
1600ENDPROC
1610
1620DEFPROClimits
1630DIM user 3
1640A%=&87
1650!user=USR(&FFF4)
1660mode=user?2
1670IF mode>5 OR mode=3 THEN graphics=F
ALSE ELSE graphics=TRUE
1680IF mode=0 THEN n1=128:n2=2 ELSE n1=
192:n2=3
1690IF mode=0 THEN stepsize=2:?passnumb
er=1:?&80=pattern0 MOD 256:?&81=pattern0
DIV 256
1700IF mode=4 THEN stepsize=4:?passnumb
er=3:?&80=pattern4 MOD 256:?&81=pattern4
DIV 256
1710IF mode=1 OR mode=5 THEN stepsize=4
:?passnumber=3:?&80=pattern1 MOD 256:?&8
1=pattern1 DIV 256
1720IF mode=2 THEN stepsize=8:?passnumb
er=6:?&80=pattern2 MOD 256:?&81=pattern2
DIV 256
1730ENDPROC
1740DEFPROCassemble
1750osword=&FFF1
1760oswrch=&FFEE
1770Xlo=S%
1780Xhi=S%+1
1790Ylo=S%+2
1800Yhi=S%+3
1810value=S%+4
1820byte=S%+5
1830pass=S%+6
1840count4=S%+7
1850S%=S%+8
1860FOR opt=0 TO 2 STEP 2
1870P%=S%
1880[OPT opt
1890½ Subroutines
1900½ to calculate POINT(X,Y)
1910.point
1920LDX #Xlo MOD 256
1930LDY #Xlo DIV 256
1940LDA #9
1950JSR osword
1960RTS
1970½ to print a character
1980.printchar
1990LDA #1
2000JSR oswrch
2010LDA byte
2020JSR oswrch
2030RTS
2040½ to decrement Y by 4
2050.decy4
2060SEC
2070LDA Ylo
2080SBC #4
2090STA Ylo
2100BCC decYhi
2110RTS
2120.decYhi
2130DEC Yhi
2140RTS
2150½ increment Y by 16
2160.incy16
2170CLC
2180LDA Ylo
2190ADC #16
2200STA Ylo
2210BCS incYhi
2220RTS
2230.incYhi
2240INC Yhi
2250RTS
2260½ to rotate in two bits. Enter wit
h X=pass, Y=colour.
2270.twobits
2280LDA (&80),Y
2290CPX #0
2300BEQ rotatein
2310.rotateout
2320ROR A
2330ROR A
2340DEX
2350BNE rotateout
2360.rotatein
2370ROR A
2380ROL byte
2390ROR A
2400ROL byte
2410RTS
2420½ to calculate a whole byte
2430.onebyte
2440JSR point
2450LDY value
2460LDA pass
2470AND #3
2480TAX
2490JSR twobits
2500JSR decy4
2510DEC count4
2520BNE onebyte
2530JSR printchar
2540RTS
2550½ Main program
2560½ to calculate and print the patter
n for one pixel
2570.pixel
2580LDA #4
2590STA count4
2600JSR onebyte
2610JSR incy16
2620INC pass
2630LDA pass
2640CMP passnumber
2650BNE pixel
2660RTS
2670]
2680NEXT
2690ENDPROC