Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.sys.sinclair > #4887

Re: RS232 - built-in versus Interface 1

From Volker Bartheld <news2020@bartheld.net>
Newsgroups comp.sys.sinclair
Subject Re: RS232 - built-in versus Interface 1
Date 2020-11-19 14:26 +0100
Organization bartheld.net
Message-ID <10gh91uncbmkk.dlg@news.bartheld.net> (permalink)
References <3af4e4ae-3587-400c-8358-e1e38a83bcae@googlegroups.com> <E_htH.49936$zz79.40162@usenetxs.com>

Show all headers | View raw


On Wed, 18 Nov 2020 23:20:04 GMT, Russell Marks wrote:
> Lee Osborne <losborne74@gmail.com> wrote:
>> I'm the owner of a (grey case) Spectrum +2, and I'm keen to try
>> communication with other devices via RS232. Obviously, the +2 has a
>> built-in RS232 port, but as far as I can tell, it's not much good for
>> two-way comms with other machines, and is of course hampered by the
>> completely non-standard plug.
> It can be vaguely tolerable if you make sure you use RTS/CTS
> handshaking, and your serial lead is properly wired. It's still pretty
> bad though. I think I got my best results at 2400 baud.

Interesting. So the IF-1 hard/software is that much different to what Sir
Clive and his folks have used for the +2 later? Hard to believe. For my
Microdrive transfers, I have used the IF-1 against an IBM Thinkpad T30
(with a _real_ RS232 port, not the USB-emulation) up to 19'200 baud, no
problem.

Details here: https://worldofspectrum.net/pub/sinclair/tools/pc/mdv2img.zip
, also includes how to fabricate a cable supporting RTS/CTS.

>> If I want to play with sending data to and from a PC, and also other
>> old crap I have lying around like my Amstrad NC100, is it best to use
>> the built-in port or the IF1?

Whatever works.

> I seem to remember the IF1 port was very slow

Well. The Z80 CPU runs at 3.5 MHz, there is no SIO available and the 16550
UART (with FIFO) was born years after the Spectrum. In that light, serial
communication via software...


0C5A	BCHAN-OUT	LD	B,+0B	Counts '11' bits.
0C5C		CPL		Invert the eight data bits.
0C5D		LD	C,A	C holds the byte to be sent.
0C5E		LD	A,(IOBORD)	Fetch new border colour.
0C61		OUT	(+FE),A	Change border colour.
0C63		LD	A,+EF	Reset CTS and select RS232.
0C65		OUT	(+EF),A
0C67		CPL
0C68		OUT	(+F7),A	Make RXdata have a low signal level.
0C6A		LD	HL,(BAUD)	Fetch timing constant.
0C6D		LD	D,H	Copy into DE register pair.
0C6E		LD	E,L
0C6F	BD-DEL-1	DEC	DE	Firstly wait (26*(BAUD)) T cycles.
0C70		LD	A,D
0C7l		OR	E
0C72		JR	NZ,0C6F,BD-DEL-1
0C74	TEST-DTR	LD	A,+7F	Read port +7FFE (SPACE key).
0C76		IN	A,(+FE)
0C78		OR	+FE	Read port +FEFE (CAPS SHIFT key) only
0C7A		IN	A,(+FE)	if SPACE is being pressed.
0C7C		RRA		Test bit 0.
0C7D		JP	NC,0CB4,BRK-INOUT	Give an error if BREAK is pressed.
0C80		IN	A,(+EF)	Read DTR line.
0C82		AND	+08	Only bit 3.
0C84		JR	Z,0C74,TEST-DTR	Jump back until DTR is found high.
0C86		SCF		Set carry flag (start bit).
0C87		DI		Disable interrupts.
0C88	SER-OUT-L	ADC	A+00	In fact, shift carry into bit 0 of
				accumulator.
0C8A		OUT	(+F7),A	Send this bit over RS232 link.
0C8C		LD	D,H	Copy timing constant into DE.
0C8D		LD	E,L
0C8E	BD-DEL-2	DEC	DE	Wait 26*(BAUD) T cycles after having
0C8F		LD	A,D	sent each bit.
0C90		OR	E
0C9l		JR	NZ,0C8E,BD-DEL-2
0C93		DEC	DE	Wait 6 T cycles.
0C94		XOR	A	Clear A for next pass.
0C95		SRL	C	Shift the bit to be sent into carry.
0C97		DJNZ	0C88,SER-OUT-L	Loop for all 11 bits.
0C99		DI		Enable interrupts.
0C9A		LD	A,+01
0C9C		LD	C,+EF
0C9E		LD	B,+EE
0CA0		OUT	(+F7),A	Make RXdata having a high level.
0CA2		OUT	(C),B	Turn off RS232.
0CA4	BD-DEL-3	DEC	HL	Insert a final delay before returning
0CA5		LD	A,L	via the border-restore routine
0CA6		OR	H	below.
0CA7		JR	NZ,0CA4,BD-DEL-3

... is as good as it probably gets (source code quote and comments courtesy
of Gianluca Carri's "Spectrum Shadow ROM Disassembly") up to 19'200 Baud.

>> Also, as I have the IF1 printer cable, which ends in a 25-pin male
>> plug, is it possible to just get hold of one other cable that will let
>> me connect direct to a PC?

Sure.

You'll have to download spxfr at
http://www.angelfire.com/games6/atari2600/spxfr/index.html
and solder the connection cable mentioned there. Basically you'll need a
female RS232 9-pin connector (PC) and a male RS232 9-pin connector
(Speccy) connected with a shielded 5-pin round cable as follows:

		PC    Speccy
	2 - RD	3 - TD
	3 - TD	2 - RD
	5 - GND	7 - GND (Shield)
	7 - RTS	4 - CTS
	8 - CTS	5 - RTS
	1 - DCD	9 - DTR
 
>> Am I insane for wondering if it's possible to convert text from the PC
>> to Tasword files???

I would rather do it the other way round (ZX->PC) but my Microdrive
cartridges are all rotten and it's quite hard to forensically
restructure/realign the errorneous sectors. Tasword accepts plain text with
hard formatting. IIRC it's not CR/LF but LF only. Just try it out.

> I think Tasword Two files (at least) were pretty much just a straight
> dump of the 64-column ASCII text with no line breaks. So 64 chars for
> one line, 64 for the next, and so on. I still have a few old Tasword
> files from the 80s (originally from microdrive) and they all seem to
> be like that.

Jup. The files on my tapes (still intact, sortof) were like that.

Volker

Back to comp.sys.sinclair | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

RS232 - built-in versus Interface 1 Lee Osborne <losborne74@gmail.com> - 2020-05-28 13:07 -0700
  Re: RS232 - built-in versus Interface 1 Russell Marks <zgedneil@spam^H^H^H^Hgmail.com> - 2020-11-18 23:20 +0000
    Re: RS232 - built-in versus Interface 1 Volker Bartheld <news2020@bartheld.net> - 2020-11-19 14:26 +0100
      Re: RS232 - built-in versus Interface 1 Russell Marks <zgedneil@spam^H^H^H^Hgmail.com> - 2020-11-19 15:38 +0000
        Re: RS232 - built-in versus Interface 1 Volker Bartheld <news2020@bartheld.net> - 2020-11-19 16:47 +0100
          Re: RS232 - built-in versus Interface 1 Russell Marks <zgedneil@spam^H^H^H^Hgmail.com> - 2020-11-19 16:27 +0000

csiph-web