Home
EXCHANGING BYTE DATA VIA THE EINSTEIN`s USER PORT AND
Contents
1. n imput_byte CALL getbyte IF n 13 PRINT IF n gt 32 AND n lt 126 PRINT CHR n UNTIL D A OR n 27 STOP REPORT PRINT AT LINE ERL STOP U_IN_EN BBC Einstein listing continued XP_OUT BBC for the PC OUT_XP BBC is just small enough to run in Ithe trial BBC4W demo version If aditionl basic lines are added delete comments before running in demo version la NO ROOM error could mean rebooting before WINIO will install again XP OUT large BBC IPC WINDOWS PROGRAM TO RUN IN BBCBASIC FOR WINDOWS Transfers bytes from the PC printer port to Einsteins USER PORT Requires WINIO support files WINIO VXD WINIOV1 DLL land WINIOVISYS in the same folder as this program Windows BBC4W program OUT_XP_large BBC works with 13 TATUNG EINSTEIN XP_OUT BBC PC listing continued U IN EN BBC running in the Einstein to send bytes from the PC printer port to the Einstein s user port WIRING EINSTEIN USER PORT PC data lines DO to D7 to Einstein DO to D7 IPC strobe to Einstein STB IPC acknowledge to Eistein RDY Plus one or more ground lines This BBC4W Prog will work for win95 98 AND XP The program is intended to poll acknowlede for a pulse as output by RDY pin 5 of the Einstein s Z80 PIO user port j WHEN Linked To The Einstein User Port All handshaking lines work as expected and data can be received by U_IN_EN BBC when run on the Einstein
2. datap amp 378 PRINTER LPTI PORTS status amp 378 1 ml controll amp 378 2 i eccport amp 378 amp 402 a DIM dataport 1 IMEMORY LOCATIONS TO STORE DIM eccp 1 PRINTER PORT READ AND WRITE BYTES DIM statusp 1 IFOR WINIO SYSTEM CALLS DIM controllp 1 ISEE HELP INDEX Input output using WINIO a INEXT LINES CHECK TO SEE IF WINIO FILES ARE IN THE SAME DIRECTORY SYS GetFileAttributesA winio vxd TO ret IF ret 1 PRINT ERROR winio vxd not in directory dir STOP ELSE PRINT winio vxd ok SYS GetFileAttributesA winiovl sys TO ret IF ret 1 PRINT ERROR winiol sys not in directory dir STOP ELSE PRINT winiov1 sys ok SYS GetFileAttributesA winiov1 dll TO ret IF ret 1 PRINT ERROR winiol dll not in directory dir STOP ELSE PRINT winiov1 dll ok INEXT TWO LINES TO SHUT DOWN WINIO ON PROGRAM ERRORS AND AT CLOSE IIF WINIO IS NOT CLOSED IT WILL NOT ALLWAYS INSTALL AGAIN WITHOUT A REBOOT ON CLOSE SYS ShutdownWinlo STOP ON ERROR SYS ShutdownWinlo STOP SE se sk se sk se sk oeste oeste sj ke sj ke sk a sk oe sk ak sk oeste okk ak kK keske se sk se sk se sk se st oe st oe ke sk oe sk oe sk oeste oe ke RE ao RE a EEE EEE oK K po REE TOADS THIRD PARTY WINIO LIBRARY FILES WINIO DLL WINIO SYS and WINIO V XD must be in the same directory folder as the executable program using them Note to install WINIO IN 2000 and XP administrative privileges ARE NEEDED 14 TATU
3. 0 280 intrrpt interupt routine 290 PUSHHL 300 PUSHDE save registers 310 PUSH BC 320 PUSH AF 330 LD HL flag 340 RES 1 HL at an interrupt byte at address flag has bit 1 set to zero 350 POP AF 360 POPBC retrieve registers 370 POPDE 380 POPHL 390 EI enables interuppts 400 RETI returns from interrupt routine 420 configpio ROUTINE TO CONFIGER USER PORT FOR MODE 1 and INTERRUPS ENABLED 430 LD A amp 12 sets low byte of interrupt address 440 OUT usrcon A writes to user port CONTROL reg amp 12 00001100 450 sets low byte of interupt vector address 460 high byte of interupt vector address in Z80 I reg 470 setby Einstein at boot up to amp FB 480 LD A amp 4F sets PIO to mode 1 490 OUT usrcon A writes to Einstein user port reg amp 4F 01001111 500 LD A amp 87 enables interrupts 510 OUT usrcon A writes to parallel user port control reg amp 87 9610000111 520 PUSH HL 11 TATUNG EINSTEIN U_IN_EN BBC Einstein listing continued 530 LD HL intrrpt CASE reg HL address of interupt routine 540 550 560 570 580 590 600 610 620 630 640 650 660 670 680 690 700 710 720 730 740 750 760 770 780 790 800 810 820 830 840 850 860 870 880 890 900 910 920 930 940 950 960 970 980 990 1000 1010 1020 1030 1040 LD amp FB12 HL CASE interupt address into interupt vector at amp FB12 POPHL IM 2 ENABLE INTERRUPT 2 MODE RET getbyte ROUTINE TO IMPO
4. OR 00000001 set bit O to 1 Inverted 1 sets STROBE line to low SYS SetPortVal controll ctrl 1 ENDPROC kpe FUNCTION PRINTS OUT BINARY STRING OF VAR eee EG VAR NUMERIC VALUE 7 WOULD RETURN STRING VAR 00000111 DEF FN_BIN A LOCAL A REPEAT A STR A AND 1 A A A gt gt gt 1 UNTIL LEN A 8 A A A ao 2 2 A kak kakak kak kak 2 I kakak akak kakak akak k ak ak ak k ak alk ak ak ke ak alk ok ak oke ak akk akk akak akk oke ok okk 17 TATUNG EINSTEIN WIRING LINK USER PORT PC PRINTER PORT PIN PIN 2 DO to 2 DO 4 DI to 3 DI 5 RDY to 10 ACK 6 D2 to 4 D2 8 D3 to 5 D3 10 D4 to 6 D4 11 STB to 1 STB 12 D5 to 7 D5 14 D6 to 8 D6 16 D7 to 9 D7 One or more pins pins 379 or 13 GROUND to 18 25 GROUND USER PORT PIN OUT 15 1 1 5V 3 0V 4 DI 5 RDY 16 2 6 D2 7 0V PC PRINTER PORT 8 D3 Einstein User Port PIN OUT 9 0V 10 D4 11 STB 1 STB 12 D5 2 D0 13 0V 3 DI 14 D6 4 D2 15 5V 5 D3 16 D7 6 D4 7 D5 8 D6 9 D7 10 ACK 11 BSY 12 PAPER 13 SEL 14 AF 15 ERROR 16 MN 17 DSL PC Printer Port 18 25 GROUND
5. Rea MAIN PROGRAM FOR EXPORTING Bytes TO THE PRINTER PORT KKK KKK K K KK K K K K K K K K pollbyte 0 REM var to latch an acknowledge pulse PRINT MAIN PROGRAM FOR EXPORTING BYTES TO THE PRINTER PORT PRINT PRESS ANY KEY TO CONTINUE MAIN PROGRAM H GET PRINT RUN U_IN_EN BBC on the Einstein TO CANCEL PRESS ESCAPE ON THE EINSTEIN KEY BOARD FIST THEN ESCAPE ON THE PC KEYBOARD IREPEAT and FOR NEXT loop create an example program REPEAT FOR i 32 TO 126 D INKEY 0 The next four lines get a single byte from the printer port and set handshaking PROC_strobe_low REPEAT PROC_poll_ack UNTIL pollbyte 1 SYS SetPortVal datap 1 1 pollbyte 0 PROC_strobe_high NEXT i UNTIL D A SYS ShutdownWinlo STOP ao 2 2A 2 2A 22 2 2 2A 2 akk ak kakak akak akak kak alk ak ak ak akk oke ak alk ak alk akak akk ak alk kakak akk ke akak ak alk oke akk akak alk ke ak oke ak oke akak ke alk ok okk okk RE ee PROC_set_byte_mode DOES WHAT IS SAYS 2222 2 2 2 k k kkk 15 TATUNG EINSTEIN XP_OUT BBC PC listing continued DEF PROC_set_byte_mode SYS GetPortVal eccport Neccp 1 byte eccp byte byte AND 00111111 byte byte OR 00100000 SYS SetPortVal eccport byte 1 SYS GetPortVal eccport Neccp 1 byte eccp D FN_BIN byte PRINT ENHANCED PARALLEL PORT PRINT BIT PATTEN D PRINT Needed to set ECP port to byte mode 906001 XXXXX IF byte AND 11100000 00100000 PRINT BYTE MODE SET ELS
6. in directory dir STOP ELSE PRINT winio vxd ok SYS GetFileAttributesA winiovl sys TO ret IF ret 1 PRINT ERROR winiol sys not in directory dir STOP ELSE PRINT winiov1 sys ok SYS GetFileAttributesA Winiov1 dll TO ret IF ret 1 PRINT ERROR winiol dll not in directory dir STOP ELSE PRINT winiov1 dll ok INEXT TWO LINES TO SHUT DOWN WINIO ON PROGRAM ERRORS AND AT CLOSE IIF WINIO IS NOT CLOSED IT WILL NOT ALLWAYS INSTALL AGAIN WITHOUT A REBOOT ON CLOSE SYS ShutdownWinlo PRINT REPORT STOP ON ERROR SYS ShutdownWinlo PRINT REPORT STOP datap amp 378 PRINTER LPT1 PORTS status amp 378 1 control amp 378 2 eccport amp 378 amp 402 A DIM dataport 1 IMEMORY LOCATIONS TO STORE DIM eccp 1 IPRINTER PORT READ AND WRITE BYTES DIM statusp 1 IFOR WINIO SYSTEM CALLS DIM controllp 1 ISEE HELP Input output using WINIO 7 TATUNG EINSTEIN XP_IN BBC PC listing continued ks se sk se ke she ke she ke zh ke sj ke sk hes ke sk oe bec ke she EEK ak k sls lese a ke zh ke zh ke zh ke sk a ke she ke zh ke zh ke zh ke sk ak 2 ak a 2k oe ak a ak okk kK xe ee TOADS THIRD PARTY WINIO LIBRARY FILES WINIO DLL WINIO SYS and WINIO V XD must be in the same directory folder as the executable program using them Note to install WINIO IN 2000 and XP administrative privileges ARE NEEDED Se Pa SE rien SEHE SE UR SECOS TEEN SESS EE SEE SIS UE PLE SECOS EH UN SIUS HIS UI BE SE OR SECHS DICAS B
7. no attempt to take advantage of BBCBASIC FOR WINDOWS ability to use windows features such dialogue boxes or drop down menus that can be used with BBCBASIC FOR WINDOWS An an exception to simple programming in the listings are system calls to third party WINIO support files to access computer ports directly when using XP and WIN2000 The WINIO files must be present in the same folder that the bbcbasic for windows files are saved to The intention of simple programming is to show a basic guide which can be followed and understood by others who have a preference to use other programming for writing windows software The two programs given are just small enough to run in the free Demo version of BBCBASIC FOR WINDOWS The required third party WINIO support files come with the BBC4W installation package See BBC4W HELP index Input output using WINIO Download BBCBASIC FOR WINDOWS http www rtrussell co uk It might be possible for the two BBC4W programs given to exchange data by bytes between two windows PC s via their ECCP printer ports This has not been tried Download XP_IN BBC and XP_OUT BBC in a zip archive from The Tatung Einstein Computer Website http tatungeinstein cedhost com mirror pio html Einstein Programming for the Z80 PIO and interrupt handshaking eBasic principles for mode 0 output and mode 1 input Programming the Z80 PIO for mode 0 eight bit output or mode 1 eight bit input with hardware handshaking requires an inte
8. 1 TATUNG EINSTEIN EXCHANGING BYTE DATA VIA THE EINSTEIN s USER PORT AND THE PC S PRINTER PORT By Chris Coxall This page shows two programming examples using the built in assembler of BBCBASIC for the Einstein to input and output bytes via its USER PORT Programming requires configuring the Einstein s internal Z80 PIO IC Two programming listing examples are given for BBCBASIC FOR WINDOWS to run in aMS WINDOWS PC to transmit and receive bytes which run in conjunction with the BBCBASIC programs given for the Einstein Contents Programming on the PC PAGE 2 BBCBASIC FOR WINDOWS using Programming on the Einstein PAGE 2 Z80 PIO and interrupt handshaking described Writing to the z80 pio control port PAGE 3 Set up for Mode 0 output and Mode 1 input More About The Einstein s Z80 PIO PAGE 4 eEinstein s printer port using Program Listings U OUT EN BBC Einstein User Port Output PAGE 4 XP IN BBC BBC4W s PC printer port Input PAGE 6 U IN EN BBC Einstein User Port Inport PAGE 10 XP_OUT BBC BBCAW s PC printer port Output PAGE 12 Wiring amp pinouts PAGE 17 2 TATUNG EINSTEIN Programming on The PC using BBCBASIC FOR WINDOWS The programming for BBCBASIC FOR WINDOWS has been kept to basic basic so to run in a window as would be expected to run in a full screen DOS version of basic or as would be expected to be how the Einstein or other vintage computers would display running programs There has been
9. E GS PCS SES GE UN SIE SIS UR BERI R E SEES GR ON SICH DIS Se S RENTEN SYS LoadLibrary WINIO DLL TO winio IF winio 0 ERROR 0 Could not load WINIO SYS GetProcAddress winio InitializeWinlo TO InitializeWinlo SYS GetProcAddress winio ShutdownWinlo TO ShutdownWinlo SYS GetProcAddress winio GetPortVal TO GetPortVal SYS GetProcAddress winio SetPortVal TO SetPortVal SYS InitializeWinlo TO ok IF ok AND 1 0 ERROR 0 Could not initialise WINIO l Se a SE aks SECUS SE SS S PE Ss Bg se SS SIEHE PL SP R PS VN ey OS ss RIS E Sy GI UN Ses UN SUIS PU SION GEI SIE r Se hy io sp Ps PROC set byte mode ISETS UP ECCP PARALLEL FOR BYTE MODE PRINT PROC controll input ISETS PRINTER PORT FOR OUT PUT PRINT RUN U OUT EN BBC ON THE EINSTEIN THEN PRINT PRESS ANY KEY TO RECEIVE INPUT FROM PRINTER PORT H GET PRINT TO CANCEL PRESS ESCAPE ON THE EINSTEIN KEY BOARD FIST V THEN ESCAPE ON THE PC KEYBOARD SESE se sk ke SR SOR a ok ok k ok ok sese sk ke se sk kok kok ok oe kak akak ak k ok oK KERLE ok she oke oe sj obe seb desk ke EEEE EEE k oK PEPEPEPE ke est de sje ok ole sje kaka kaka sje ke EEK ok ole sj ode SRR de sje ke ACR obese ok ole sj ke cest b
10. E PRINT BYTE MODE NOT SET ENDPROC eee PROC controll output 9904354923442 SETS LPT1 PRINTER PORT FOR OUTPUT Seer TISABLES INTERRUPTS FARRARKARKA SETS STROBE LINE LOW strobe hardware inverted DEF PROC_controll_output SYS GetPortVal controll controllp 1 REM PROC ctrl etrl ctrl OR 00000001 set bits 0 to 1 inverted 1 sets STROBE line to low etrl ctrl AND 11001111 bit 5 set to 0 for output bit 4 set to O no interrupts set SYS SetPortV al46 controll46 ctrl 1 SYS GetPortVal controll controllp 1 ctrl controllp D FN_BIN ctrl PRINT CONTROLL PORT BIT PATTEN D PRINT Needed bit 5 set to 0 for data outport XXOXXXXX PRINT Needed bit 4 set to 0 for NO interrupts XXXOXXXX PRINT To set bit 0 to 1 Sets STROBE line to low PXXXXXXX1 PRINT STROBE line hardware inverted ENDPROC DEF PROC poll ack SYS GetPortVal status statusp 1 stat statusp ack stat AND 9601000000 IF ack lt gt 0 pollbyte 1 ENDPROC DEF PROC_strobe_high SYS GetPortVal controll controllp 1 ctrl controllp ctrl ctrl AND 11111110 set bit O to 0 Inverted O sets STROBE line to high 16 TATUNG EINSTEIN XP_OUT BBC PC listing continued SYS SetPortV al controll ctrl 1 ENDPROC DEF PROC_strobe_low SYS GetPortVal controll controllp 1 ctrl controllp ctrl ctrl
11. IT 0 OF flag TO 0 390 POP AF Note RST ops SHOULD NOT BE 400 POP BC USED IN AN INTERRUPT ROUTINE 410 POP DE RESTORE REGISTERS 420 POPHL 2 430 EI ENABLE INTERRUPTS 440 RETI RETURN FROM INTERRUPT 450 configpio 460 LD A amp l2 sets low byte of interrupt address 470 OUT amp 33 A writes to USER port reg amp 12 9600010010 480 LD A amp OF sets PIO to mode 0 output 490 OUT amp 33 A writes to USER port reg amp OF 9000001111 500 LD A amp 87 enables interrupts 510 OUT amp 33 A writes to USER port reg amp 87 9610000111 5 TATUNG EINSTEIN U_OUT_EN BBC Einstein listing continued 520 PUSH HL 530 LD HL intrrpt CASE HL INTERRUPT START ADDRESS 540 LD amp FB12 HL CASE USER PORT SCRATCH PAD INTERRUPT ADDRESS 550 POP HL 560 IM 2 ENABLE INTERRUPT 2 MODE 570 RET 580 PAOUT CODE TO OUTPUT BYTE ENDWHILE IN MEMORY LOCATION outbyte TO USER PORT 590 PUSH HL 600 PUSH DE ENDIF REGISTERS 610 PUSH BC 620 PUSH AF 630 LD HL flag FLAG BYTE ADDRESS FOR USER PORT INTERRUPT 640 POLL 650 BIT 0 HL 660 JR NZ POLL 670 LD A outbyte 680 OUT amp 32 A outport Parallel port data reg 690 SET 0 HL 700 POP AF 710 POP BC 720 POP DE RESTORE REGISTERS 730 POP HL 740 RET 750 outbyte DEFB 0 USER CASES BYTE FOR OUTPUT 760 end RET 770 780 NEXT pass 790 CALL configpio 800 PRINT CODE BEGINS AT ADDRESS amp start_code 810 PRINT END CODE ADDRESS amp end 820 PRINT configpio star
12. NG EINSTEIN XP_OUT BBC PC listing continued ak jette A 22 ak 2A 22 2 kakak akak skak akak kakak akak kak okk oke k akk ok k SYS LoadLibrary WINIO DLL TO winio IF winio 0 ERROR 0 Could not load WINIO SYS GetProcAddress winio InitializeWinlo TO InitializeWinlo SYS GetProcAddress winio ShutdownWinlo TO ShutdownWinlo SYS GetProcAddress winio GetPortVal TO GetPortVal SYS GetProcAddress winio SetPortVal TO SetPortVal SYS InitializeWinlo TO ok IF ok AND 1 0 ERROR 0 Could not initialise WINIO Sk sessi se s sieh e soe opo esie s sic de e sp sese beoe sie ole soo qe slo lese s ejes scole sies sie beste sie e le se sce defessi esie le se de este pole oeste esie eo coles sk ke le sl 3 oe he beste o ze ole che oe lebe sje che che ole deze ae che oe che ole lakka che oe bebe 2 zh che oe desde cde ak fe ak ok bebe ak ak ok ak ak k PROC set byte mode ISETS UP ECCP PARALLEL FOR BYTE MODE PRINT PROC controll output ISETS PRINTER PORT FOR OUT PUT FI USB RR do TOR dee oe sea ko aR sk oto sese oe pss ae sie sai hoi o oes ss Role uo dede sk sk se sk se sk sje ke sk ke sk ke sk oe sk kao ak kk sk sk le se se sk se sk oeste oe st oe ke oe ke she ke a oeste oe sk oe ke oe ke ko ak oe ak oe ak ok ok ak ok ak ok esse sk se sk se sk se st oe st oe st oe oes oe sk oes oeste oe st oe sk ce ke ce oes OK oeste oe st oe ke oe ke ce ke che oeste oeste oe sk oe ke ce ke che ke ao a ka a oK
13. RT A SINGLE BYTE FROM THE USER PORT PUSHHL PUSH DE save registers on the stack PUSH BC PUSH AF LD HL flag POLL LOOP to poll bit 1 of flag set by interrupt routine LD HL flag BIT 1 HL JRNZ POLL IF flag bit 1 not zero loop back IN A usrdata IF flag bit 1 zero get byte from user port into A register LD imput byte A Put byte value of imported byte now in A register into memory location imput byte SET L HL resets bit 1 of byte at memory location flag to 1 POP AF POP BC retrieve registers from stack POP DE POPHL RET imput byte DEFB 0 end NEXT pass CALL configpio PRINT CODE BEGINS AT ADDRESS amp start code PRINT END CODE ADDRESS amp end PRINT flag start_code amp flag start_code PRINT configpio start_code amp configpio start_code PRINT getbyte start_code amp getbyte start_code PRINT imput_byte start_code amp imput_byte start_code PRINT CODE SIZE end start code PRINT PRESS ANY KEY TO START REM USER PROGRAMING CAN BE ADDED HERE REM RECEIVED IMPORT BYTES FROM USER PORT REM ARE FOUND BY CALLING getbyte THEN REM PEEKING THE ADDRESS imput byte REM n imput byte IN BBCBASIC REM REM IN THE EXAMPLE PROGRAM BELOW REM BYTE VALUES 32 to 126 TO BE PRINTED REM TO SCREEN AS ASCII CHARACTERS IN THE PC REM WITH BBC4W RUNNING P IN WIN BBC REM PRINT PRESS ANY KEY TO RUN EXAMPLE PROGRAM H GET REPEAT D INKEY 0 1050 1060 1070 1080 1090 1100 1110 12 TATUNG EINSTEIN
14. TEN D PRINT Needed to set ECP port to byte mode POOIXXXXX IF byte AND 11100000 00100000 PRINT BYTE MODE SET ELSE PRINT BYTE MODE NOT SET ENDPROC eee PROC_controll_input 188k FFRRERRRSER SETS LPT1 PRINTER PORT FOR INPUT em DISABLES INTERRUPTS eeeeeeeeees SETS STROBE LINE LOW strobe hardware inverted DEF PROC controll input SYS GetPortVal controll controllp 1 etrl ctrl OR 9600100001 set bits 0 to 1 inverted 1 sets STROBE line to low ctrl ctrl AND 92611101111 bit 5 set to 1 for output bit 4 set to O no interrupts set SYS SetPortVal controll ctrl 1 SYS GetPortVal controll controllp 1 cetrl controllp D FN_BIN ctrl PRINT CONTROLL PORT BIT PATTEN D PRINT Needed bit 5 set to 1 for data outport XXIXXXXX PRINT To set bit 0 to 1 Sets STROBE line to low oXXXXXXXI PRINT STROBE line hardware inverted PRINT Bit 4 set to O for no interrupts set XXXOXXXX 9 TATUNG EINSTEIN XP_IN BBC PC listing continued IF ctrl AND 00100000 32 PRINT SET UP FOR IMPORT INSTALLED ELSE PRINT ERROR PRINT ENDPROC DEF PROC_poll_ack SYS GetPortVal status statusp 1 stat statusp ack stat AND 01000000 IF ack lt gt 0 pollbyte 1 ENDPROC DEF PROC_strobe_high SYS GetPortVal controll controllp 1 ctrl controllp ctrl ctrl AND 11111110 set bit 0 to 0 Inverted O sets STROBE line to high SYS SetPortVal cont
15. e loaded into the vector register 0 in DO Signifies This Control Word is an Interrupt Vector 00001100 interrupt vector low byte set to Hex 12 HEX 12 is the low byte of a scratch pad address given by the Einstein s Machine Operating System at bootup The high byte needs to be in the Z80 s I register This is fixed to HEX FB by the Einstein at bootup VVVVVI11 Bits 0 1 and 2 set to 111 This Signifies Control Word is to set interrupt 2610000111 Bit 7 set to 1 enables interrupts A pdf user manual for the Z80 PIO can be downloaded here http www z80 info zip z80piomn pdf More About The Einstein s Z80 PIO The Z80 PIO has two ports for 8Bit input and output Port A and B On the Einstein port A is configured to be compatible as a centronic s printer port at power up Electronically this is set as mode 0 output but has a hardware adaptor of a monostable which sets ARDY high as a lus pulse With the User Port the BRDY is held high until a high is received by PIO s BSTB pin Physically the Einstein s printer port pin out in the manual describes STROBE which is connected to the PIO s ASTB and ACKNOWLEDGE which connects to the PIO s ARDY The printer port s BUSY PE and ERROR connect to the Einstein s command status register If the Einstein s printer port is used instead of the user port any of the Einstein s software applications print commands will transfer output data but Additional programming would be needed for i
16. e sje ke ak ok ole sj akak ak ak ak ak ok ok ok K Ka MAIN PROGRAM FOR EXPORTING Bytes TO THE PRINTER PORT KKK KKK K K K K K K K K K K K K M pollbyte 0 var to latch an acknowledge pulse REPEAT key INKEY 0 PROC_get data dataport IF data 13 PRINT CHR data IF data gt 32 AND data lt 126 PRINT CHR data UNTIL key A OR key a SYS ShutdownWinlo STOP seketeteeterelereeteletelelerelereieleeiees END OF TO RECEIVE DATA Seo ookko kkk 3k 2 se sk se sk se st oe ke sk ke sk ak sk EEE kk k 8 TATUNG EINSTEIN XP_IN BBC PC listing continued se ok 2k ok ok ak kkk DY EE PROG WHEN THE LPTI PORT HAS BEEN INITIATED AND WINIO INSTALLED IPROC get IS THE ONLY PROCEDURE NEEDED FOR THE USER TO IMPORT A BYTE IFROM THE pc PRINTER PORT data dataport PUTS IMPORTED BYTE IN data VAR DEF PROC get REPEAT PROC poll ack UNTIL pollbyte lt gt 0 PROC strobe low SYS GetPortVal datap dataport o6 1 pollbyte 0 PROC_strobe_high ENDPROC APR SA 2 2 2 2 2 kak akak kk kakak kak kakak skak 2 kakak akak kkk akk oke akk ok k KOK K K KK K K K K K K K PROC_set_byte_mode DOES WHAT IS SAYS KKK K K K K KKK K K K K K DEF PROC_set_byte_mode SYS GetPortVal eccport eccp 1 byte eccp byte byte AND 00111111 byte byte OR 9600100000 SYS SetPortVal eccport byte 1 SYS GetPortVal eccport Neccp 1 byte eccp D FN_BIN byte PRINT ENHANCED PARALLEL PORT PRINT BIT PAT
17. nput 4 TATUNG EINSTEIN U_OUT_EN BBC for the Einstein 10 REM U_OUT_EN BBC EINSTEIN BBCBASIC PROGRAM 20 REM TEST PROGRAM TO OUTPUT DATA BYTES 30 REM TO THE USER PORT USING INTERRUPT HANDSHAKING 40 REM OUTPUT CAN BE RECEIVED BY A PC ECCP PRINTER PORT 50 REM USING BYTE MODE SET FOR IMPORT 60 REM RECIEVED ASCII DATA BYTES CAN BE READ TO SCREEN BY 70 REM XP_IN_WIN BBC PROGRAM RUN BY BBCBASIC FOR WINDOWS 80 REM 90 REM WIRING EINSTEIN USER PORT PC PRINTER PORT 100 REM IPC data lines DO to D7 to Einstein DO to D7 110 REM IPC strobe to Einstein STB 120 REM IPC acknowledge to Eistein RDY 130 REM PLUS ONE OR MORE GROUND 140 REM 150 ON ERROR GOTO 1030 160 HIMEM HIMEM 80 REM CREATES SAFE MEMORY AREA ABOVE BBCBASIC 180 DIM code 80 190 code HIMEM I1 200 REM configpio start code amp 11 REM THESE VALUES ARE TO GIVE 210 REM outbyte start_code amp 3F REM REFERENCE FOR OTHER ASSEMBLERS 220 REM PAOUT start_code amp 28 REM IF ASSEMBLE CODE IS ALTERED 230 REM CODE SIZE 64 REM NEW VALUES WILL BE PRINTED OUT 240 REM BY BASIC LINES 800 to 850 250 PRINT Assembling code at amp code 260 PRINT PRESS ANY KEY TO CONTINUE H GET 270 FOR pass 0 TO 1 280 P code 290 OPT pass 3 300 start code 310 flag DEFB 0 LATCH BYTE FOR INTERRUPT 320 ntrrpt INTERUPT ROUTINE 330 PUSHHL 340 PUSHDE ENDIF REGISTERS 350 PUSH BC 360 PUSH AF 370 LDHL flag GET ADDRESS OF flag BYTE INTO HL 380 RES 0 HL SET B
18. roll ctrl 1 ENDPROC DEF PROC_strobe_low SYS GetPortVal controll controllp 1 ctrl controllp ctrl ctrl OR 00000001 set bit O to 1 Inverted 1 sets STROBE line to low SYS SetPortVal controll ctrl 1 ENDPROC kpo FUNCTION PRINTS OUT BINARY STRING OF VAR Webbook EG VAR NUMERIC VALUE 7 WOULD RETURN STRING VAR 00000111 DEF FN_BIN A LOCAL A REPEAT A STR A AND 1 A A A gt gt gt 1 UNTIL LEN A 8 A A A SE ASR AS A dos SE DE A oe E DE E AE spes AE A Os op DEE s E as SE E PE hs SE he ape ie qoi IE AE AE AE ee eee 10 TATUNG EINSTEIN U_IN EN BBC for the Einstein 10 REM U_IN_EN BBC EINSTEIN BBCBASIC PROGRAM 20 REM TEST PROGRAM TO IMPORT DATA BYTES 30 REM FROM THE USER PORT USING INTERRUPT HANDSHAKING 40 REM IMPORT CAN BE RECEIVED FROM A PC ECCP PRINTER PORT 50 REM RUNNING OUT_XP_large IN BBCBASIC FOR WINDOWS 60 REM ECCP SET TO BYTE MODE AND FOR IMPORT 70 REM 80 REM WIRING EINSTEIN USER PORT PC PRINTER PORT 90 REM IPC data lines DO to D7 to Einstein DO to D7 100 REM IPC strobe to Einstein STB 110 REM IPC acknowledge to Eistein RDY 120 REM PLUS ONE OR MORE GROUND 130 REM 140 ON ERROR GOTO 1110 150 HIMEM HIMEM 80 170 usrcon amp 33 180 usrdata amp 32 190 DIM code 80 200 code HIMEM 1 210 PRINT Assembling code at amp HIMEM 1 220 PRINT PRESS ANY KEY TO CONTINUE H GET 230 FOR pass 0 TO 1 240 P code 250 OPT pass 3 260 start code 270 flag DEFB
19. rrupt routine The interrupt is generated by a high or pulse high received on the STB pin of the Einstein s user port set by strobe from the PC s printer port An output of a byte to the PIO s data port will set the RDY pin on the user port high to be received by Acknowledge on the PC s printer port for mode 0 output For input mode 1 the RDY signal is active when the input register is empty and is ready to accept data from the peripheral device The BBCBASIC programs for the Einstein s user port U_IN_EN BBC and U OUT EN BBC have been put into an Einstein Disk Image Download from this web page http tatungeinstein cedhost com mirror pio html A 3 5 inch Einstein floppy can be made from the image in a PC floppy 31 drive with CPCDiskXP software DOWNLOAD HERE http www cpcmania com Files in the disk image can be extracted from the image into PC folder using EDIP SEE PAGE http tatungeinstein cedhost com mirror edip edip html 3 TATUNG EINSTEIN WRITING TO THE Z80 PIO CONTROL PORT FOR MODE 0 and MODE 1 WITH INTERRUPTS ENABLED VVXX1111 Bits D3 DO indicate Set Mode Last 4 bits set to 1111 Signifies This Control Word is to set mode Bits D5 and D4 are ignored Bits D7 and D6 set to 01 sets PIO to mode 1 input Bits D7 and D6 set to 00 sets PIO to mode 0 output VVVVVVVO Bit 0 set to 0 sets the low byte interrupt vector set by remaining bits DO is used in this case as a flag bit which when low causes V7 through V1 to b
20. t_code amp configpio start_code 830 PRINT outbyte start_code amp outbyte start_code 840 PRINT PAOUT start_code amp PAOUT start_code 850 PRINT CODE SIZE end start_code 860 PRINT PRESS ANY KEY TO START 870 H GET 880 REM THE EXAMPLE CODE CODE BELOW CAN BE CHANGED 890 REM THE INSTALLED MACHINE CODE CAN BE USED TO 900 REM SEND ANY BYTE OUT TO THE USER PORT 910 REM BY LOADING outbyte ADDRESS WITH THE 920 REM BYTE TO BE SENT AND CALLING PAOUT 930 REPEAT 940 D INKEY 0 950 FOR 1 32 TO 126 960 outbyte I 970 CALL PAOUT 980 PRINT I 990 NEXTI 6 TATUNG EINSTEIN U_OUT_EN BBC Einstein listing continued 1000 UNTIL D A 1010 PRINT END END END END 1020 STOP 1030 REM 1040 REPORT PRINT AT LINE ERL STOP XP_IN BBC for the PC XP_IN BBC IPC WINDOWS PROGRAM TO RUN IN BBCBASIC FOR WINDOWS Windows BBC4W program XP IN large BBC works with U OUT EN BBC running in the Einstein 1 It works in conjunction with the Einstein with linked PC ECCP printer port with the user port on the Einstein It will output data bytes to the program U IN EN BBC running on the Einstein WIRING EINSTEIN USER PORT PC data lines DO to D7 to Einstein DO to D7 PC strobe to Einstein STB PC acknowledge to Eistein RDY Plus one or more ground lines 2 a INEXT LINES CHECK TO SEE IF WINIO FILES ARE IN THE SAME DIRECTORY SYS GetFileAttributesA winio vxd TO ret IF ret 1 PRINT ERROR winio vxd not
Download Pdf Manuals
Related Search
Related Contents
B '3 - ii Fl Operating instructions, Sept. 2009 Cobianchi Liftteile AG Manuale istruzioni Boletim Mensal Suzuka fevereiro 2012 MANUAL DE OPERAÇÃO THF . 0902 instruction manual mode d`emploi manual de instrucciones Indicazioni importanti Télécharger - BrewLock System Product Manual - Drive Medical Wiley Windows Phone 7 Secrets Copyright © All rights reserved.
Failed to retrieve file