U.K. EINSTEIN USER GROUP
second page
A typical page from journal
A SERIAL INPUT TO SCREEN PROGRAM By Chris Coxall
If a null modem link between the Einstein TC01 and a PC has been established the short BBC basic programme below will assemble a machine code program that will display output from a PC's terminal program to Einstein's screen. When CTRL & D keys are pressed on the PC the Einstein will revert back to the program it was running. The BBC program line numbers 10 to 120 need to be run twice with GOTO 10 and GOTO 20. To run the code program use BBCBASIC COMMAND 'CALL &8000'. The code program is relocatable so it can be saved as a COM file by the BBCBASIC Command- *SAVE 'SERIN.COM' 8000 8059. The program can then be run from Albert's DOS prompt. To load the code back into basic i.e. BBCBASIC use the Command *LOAD 'SERIN.COM' 8000 this locates the code into a free area of memory within basic.
If line numbers 1 to 5 & line 130 are added it will automatically create the SERIN.COM file and run the machine code programme for serial input to the Screen.
The machine code program was put together using DOS functions 2&3 listed in the Einstein's DOS/MOS manual on page 53.
1 GOSUB 10
2 GOSUB 20
3 *SAVE"SERIN.COM" 8000 8014
4 CALL &8000
5 STOP
10 START=&8000
20 CODE=&8000
30 P%=CODE
50 [OPT 1
60 .START LD C,&03 ; initialise the C register for serial input
70 CALL &05 ; call DOS routine to put port's ASCII value into A
71 CP
&04 ; compare value in A reg.
72 JR Z,FINISH ; If A =04 (CTRL & D) from other computer jump to finish
80 LD E,A ; place the value of A reg. into E register
90 LD C,&02 ; initialise C reg. for ASCII output of E reg. to console
100 CALL &05 ; call DOS routine to put E reg ASCII value on screen
110 JR START ; loop back for next serial character
111 .FINISH RET
112 RET
120 ]
130 RETURN
The above program should be able to be selected by the mouse and copied onto the clipboard. After pasteing into a Word Processor it be saved as a text file.
I have used Windows 3.1 Terminal, Windows 95 Hyper Terminal and the MS DOS Qbasic program below to send text to the SERIN.COM program. Using the BBCBASIC commands �*OPT 1' then �LIST' will send BBCBASIC program listings to the PC terminals. From the Window's terminals listings can be copied to clipboard, pasted into Write or Notepad then saved as text files.
20 OPEN "COM1:9600,N,8,1" FOR RANDOM AS #1
30 ON COM(1) GOSUB 90
40 COM(1) ON
60 A$ = INKEY$:
61 IF A$ = CHR$(4) THEN PRINT #1,A$: STOP
62 IF A$ = "" THEN 60
70 PRINT #1, A$; : GOTO 60
90 ALL = LOC(1): IF ALL < 1 THEN RETURN
100 B$ = INPUT$(ALL, #1):
110 IF B$ = CHR$(4) THEN STOP
120 PRINT B$; : RETURN
SENDING BBCBASIC TEXT PROGRAMME FILES FROM WIN/95 TO ALBERT
To transfer BBCBASIC programs as text files via the win/95 Hyper Terminal to the Einstein I have found that <EOF> needs to be to added as the last line after a basic program. e.g.
10 rem first line of basic program
20 rem middle lines of program
30 rem last line of basic program
<EOF>
To prepare the TC01 to receive an inported file use the copy command from XTAL DOS �COPY SRL TO 0: filename.TXT'. From PC's Hyper Terminal click Transfer on on the menu bar then click Send Text File >from the drop down menu. Select the file for transfer by clicking with the mouse or type its name into the text box. Click Open. The Hyper Terminal will then indicate that the file is being transfered or that it has been transfered but the Einstein will not respond untill CTRL & Z is pressed on the PC's keyboard. After pressing CTRL & Z the selected drive in the Einstein should record the file.
The BBC text basic program can then be loaded into Bbcbasic
by