Tape in/out
ZXNet echo conference «code.zx»
From Kirill Frolov → To Sergei Chikalev 26 November 2001
Press RESET immediately, Sergei!
25 Nov 01 00:54, Sergei Chikalev wrote to Kirill Frolov:
KF>> Serial software emulation actually worked
KF>> port (rs232) on 38400. Transmission mode is half-duplex.
SC> ... and more details here please?? And with the priests...
There is a bug here that allows, under certain conditions,
circumstances (not present during normal operation)
the receive buffer overflows. The error lies in
that I forgot to check for the maximum number
accepted characters. And turning off the RTS signal when full
there are buffers - because if hardware control is used
nothing is disrupting the flow, but there is a danger.
The use of hardware flow control is MANDATORY.
Either bytes will be lost (half-duplex!), or a special
software protocol. For example, X-modem will work.
If hardware flow control is used, then it is better to connect
2 computers such that one of them has a HARDWARE PORT.
For example, spec and pc. If you connect two specs through such an “emulator”,
then competition will be observed (half duplex!) - data transfer
will only be possible if one wants to transmit and the other listens,
otherwise everything slows down. When transmitting a large number of small blocks
the speed will drop significantly.Thus, to connect 2 speck-type computers you need
5 wires, even better 7 (GND, RTS, CTS, TXD, RXD, DTE, DTR).
In general, you can use 3 wires so that the letters are not lost,
but it will no longer be rs232. It's better to install a hardware port.
ps: for those who don’t understand, the Vicomm modem also has half-duplex and bytes are also lost.
Those. For use with MMD, 3 wires are sufficient.
;---------------------------------------
; RS232 EMULATOR ZX-LINK
;
TXPORT EQU #CFF7
RXMAX EQU 270
ZXL_INI LD A,1
JR ZXL_CTL
ZXL_OFF XOR A
ZXL_CTL ;LD (ZXL_DCD),A
AND #01
RLCA
RLCA
LD (TXMASK),A
IN A,(#1F)
RLCA
RLCA
RLCA
AND #01
RET
; LINE SCAN BC=SIZE D=SPEED CY=NOTHING
LSCAN DI
PUSH IX
PUSH IY
LD HL,RXMAX
LD DE,RXBYTE
PUSH DE
LD IX,(M_BUFF)
LD IY,TXMASK
LD BC,TXPORT
LD A,(TXMASK)
OR#20
OUT(C),A
RXNEXT LD D,#9F ; TIME
RXWAIT IN A,(#FE)
R.L.A.
RET C
IN A,(#FE) ; 25..34 ~40
R.L.A.
RET C
IN A,(#FE)
R.L.A.
RET C
IN A,(#FE)
R.L.A.
RET C
IN A,(#FE)
R.L.A.
RET C
IN A,(#FE)
R.L.A.
RET C
IN A,(#FE)
R.L.A.
RET C
IN A,(#FE)
R.L.A.
RET C DEC D
JP NZ,RXWAIT ; +14
IN A,(#FE)
RLA
RET C
LD A,(TXMASK)
LD E,A ; +17
IN A,(#FE)
RLA
RET C
OUT (C),E ; +12
IN A,(#FE)
RLA
RET C
LD D,#7 ; +7
IN A,(#FE)
RLA
RET C
RXWAIT1 IN A,(#FE)
RLA
RET C
IN A,(#FE)
RLA
RET C
IN A,(#FE)
RLA
RET C
IN A,(#FE)
RLA
RET C
IN A,(#FE)
RLA
RET C
IN A,(#FE)
RLA
RET C
IN A,(#FE)
RLA
RET C
IN A,(#FE)
RLA
RET C
DEC D
JP NZ,RXWAIT1
RXEND POP BC
EX DE,HL
LD HL,RXMAX
OR A
SBC HL,DE
POP IY
POP IX
JR NZ,RXOK
LD BC,#0101
XOR A
INC A
SCF
RET
RXOK LD D,LINKSPEED
LD B,H
LD C,L
XOR A
INC A
RET
RXBYTE IN A,(#FE)
RLA
JR C,RXBYTE1
DEC SP
DEC SP
JP RXWAIT
RXBYTE1 JR $+2
JR $+2
JR $+2
JR $+2
NOP
IN A,(#FE) ; B0
RLA
RR E
DEC HL
LD A,H
OR L
CP 1
SBC A,A
CPL
AND #20
OR (IY)
OUT (C), A
IN A,(#FE) ; B1
RLA
RR E
LD BC,RXBYTE
PUSH BC
LD BC,TXPORT
JR $+2
JR $+2
JR $+2
IN A,(#FE) ; B2
RLA
RR E
JR $+2
JR $+2
JR $+2
JR $+2
JR $+2
NOP
NOP
IN A,(#FE) ; B3
RLA
RR E
JR $+2
JR $+2
JR $+2
JR $+2
JR $+2
NOP
NOP
IN A,(#FE) ; B4
RLA
RR E
JR $+2
JR $+2
JR $+2
JR $+2
JR $+2
NOP
NOP
IN A,(#FE) ; B5
RLA
RR E
JR $+2
JR $+2
JR $+2
JR $+2
JR $+2
NOP
NOP
IN A,(#FE) ; B6
RLA
RR E
JR $+2
JR $+2
JR $+2
JR $+2
JR $+2
NOP
NOP
IN A,(#FE) ; B7
RLA
RR E
JR $+2
JR $+2
JR $+2
JR $+2
JR $+2
NOP
NOP
IN A,(#FE) ; B STOP
RLA
JR C,RXERR
LD A,E
CPL
LD (IX),A
INC IX
JP RXNEXT
RXERR LD A,(TXMASK)
OUT (C),A
JP RXEND
; SEND BLOCK IN MDMBUFF BC=SIZE
LTRANS DI
PUSH IX
LD E,C
LD D,B
LD IX,(M_BUFF)
LD BC,TXPORT
TXBYTE LD A,(TXMASK)
OR #08
OUT (C),A
LD A,(IX)
CPL
LD L,A
LD H,8
JR $+2
LD A,0
TXBIT RR L
SBC A,A
AND #08
OR 0
TXMASK EQU $-1
OUT (C),A
JP $+3
JP $+3
JP $+3
LD A,0
DEC H
JR NZ,TXBIT
JR $+2
LD A,0
LD A,(TXMASK)
OUT (C),A
JR $+2
JR $+2
JR $+2
INC IX
DEC DE
LD A,D
OR E
JR NZ,TXBYTE
LD B,4
DJNZ $
POP IX
RET