Previous Thread
Next Thread
Print Thread
Has anyone tested the amstrad amsrs232 interface? #114191
11/07/18 02:49 AM
11/07/18 02:49 AM
Joined: Jul 2011
Posts: 102
T
TSCHAK Offline OP
Senior Member
TSCHAK  Offline OP
Senior Member
T
Joined: Jul 2011
Posts: 102
I am attempting to use the amsrs232 interface with cpc464, like so:

Code
./mame64.exe -window -resolution 1024x768 cpc464 -exp amsrs232 -exp:amsrs232:rs232 null_modem -bitb socket.localhost:25232


and running tcpser like this:
Code
tcpser -t sSiI -v 25232 -s 1200 -i "&K0"


And I start the terminal from BASIC, like so:

Code
|TERMINAL


The terminal starts, and I can type on the emulated CPC, and see stuff comes across to TCPSER:
Code
2018-11-06 20:43:47:01312::RS->|0000|61                                             |a               |
2018-11-06 20:43:47:01312::IP->|0000|61                                             |a               |
2018-11-06 20:43:47:01312::RS<-|0000|74                                             |t               |
2018-11-06 20:43:47:01312::RS->|0000|74                                             |t               |
2018-11-06 20:43:47:01312::IP->|0000|74                                             |t               |
2018-11-06 20:43:48:01312::RS<-|0000|0d                                             |.               |
2018-11-06 20:43:48:01312::RS->|0000|0d                                             |.               |
2018-11-06 20:43:48:01312::IP->|0000|0d                                             |.               |
2018-11-06 20:43:48:01312::RS->|0000|0d 0a                                          |..              |
2018-11-06 20:43:48:01312::IP->|0000|0d 0a                                          |..              |
2018-11-06 20:43:48:01312::RS->|0000|4f 4b                                          |OK              |
2018-11-06 20:43:48:01312::IP->|0000|4f 4b                                          |OK              |
2018-11-06 20:43:48:01312::RS->|0000|0d 0a                                          |..              |
2018-11-06 20:43:48:01312::IP->|0000|0d 0a                                          |..              |


But I am not seeing ANYTHING comes back to the terminal:

[Linked Image]

What gives???

-Thom

Re: Has anyone tested the amstrad amsrs232 interface? [Re: TSCHAK] #114199
11/07/18 09:01 PM
11/07/18 09:01 PM
Joined: Dec 2006
Posts: 525
New Zealand
M
mahlemiut Offline
Senior Member
mahlemiut  Offline
Senior Member
M
Joined: Dec 2006
Posts: 525
New Zealand
I think the terminal application might expect to use hardware flow control, which is not something that can be transferred via a socket at this time.


- Barry Rodewald
Re: Has anyone tested the amstrad amsrs232 interface? [Re: TSCHAK] #114200
11/07/18 09:43 PM
11/07/18 09:43 PM
Joined: Mar 2001
Posts: 16,070
USA
R
R. Belmont Offline
Very Senior Member
R. Belmont  Offline
Very Senior Member
R
Joined: Mar 2001
Posts: 16,070
USA
It should be possible to set the flow control lines permanently so that data flows though.

Re: Has anyone tested the amstrad amsrs232 interface? [Re: TSCHAK] #114201
11/07/18 11:08 PM
11/07/18 11:08 PM
Joined: Dec 2015
Posts: 86
A
AJR Offline
Member
AJR  Offline
Member
A
Joined: Dec 2015
Posts: 86
At first I suspected that the monitor code was expecting IM 2 vectored interrupts from the Z80 DART. While Amstrad's hardware would seem to allow for that (though MAME does not, and the Pace version requires hardware modifications), I took a look with the MAME debugger and the code isn't doing that.

What it does instead is spams the DART's WR5, rapidly toggling the DTR bit. MAME's DART emulation calls the z80dart_channel::update_serial method whenever the value of WR3, WR4 or WR5 changes. A comment in this method reads: "if stop bits is changed from 0, receive register has to be reset." What's stupid about this is that the emulation doesn't actually check whether the number of stop bits is being changed, and so it always resets the receiver. What's doubly stupid is that WR5 does not contain any receiver-related parameters. What's triply stupid is that update_serial ignores the WR5 value completely, making the transmitter uses the number of received data bits instead.

Last edited by AJR; 11/07/18 11:45 PM.
Re: Has anyone tested the amstrad amsrs232 interface? [Re: TSCHAK] #114202
11/08/18 12:17 AM
11/08/18 12:17 AM
Joined: Mar 2001
Posts: 16,070
USA
R
R. Belmont Offline
Very Senior Member
R. Belmont  Offline
Very Senior Member
R
Joined: Mar 2001
Posts: 16,070
USA
Rapidly toggling DTR has to be a workaround for some piece of weird hardware. But regardless the DART emulation's definitely broken there.

Re: Has anyone tested the amstrad amsrs232 interface? [Re: TSCHAK] #114289
11/14/18 03:52 AM
11/14/18 03:52 AM
Joined: Jul 2011
Posts: 102
T
TSCHAK Offline OP
Senior Member
TSCHAK  Offline OP
Senior Member
T
Joined: Jul 2011
Posts: 102
uh oh, did I stumble on a landmine? wink

-Thom

Re: Has anyone tested the amstrad amsrs232 interface? [Re: TSCHAK] #114295
11/14/18 11:21 AM
11/14/18 11:21 AM
Joined: Feb 2004
Posts: 2,012
Sydney, Australia
Vas Crabb Offline
Very Senior Member
Vas Crabb  Offline
Very Senior Member
Joined: Feb 2004
Posts: 2,012
Sydney, Australia
Oh we know a lot of our UART-type chips are in terrible shape. There are just too many of them for us to fix them all at a reasonable rate.

Re: Has anyone tested the amstrad amsrs232 interface? [Re: TSCHAK] #114296
11/14/18 01:37 PM
11/14/18 01:37 PM
Joined: Mar 2001
Posts: 16,070
USA
R
R. Belmont Offline
Very Senior Member
R. Belmont  Offline
Very Senior Member
R
Joined: Mar 2001
Posts: 16,070
USA
This particular case should be fixed now, though.

Re: Has anyone tested the amstrad amsrs232 interface? [Re: TSCHAK] #114302
11/14/18 09:41 PM
11/14/18 09:41 PM
Joined: Dec 2015
Posts: 86
A
AJR Offline
Member
AJR  Offline
Member
A
Joined: Dec 2015
Posts: 86
I don't think it's fixed yet. I tested it the other day, and the characters the DART was receiving were mostly garbage.

The Z80 DART emulation is based on MAME's device_serial_interface, which tries to emulate a generic UART with no synchronous modes or other frills and still doesn't do very well at that: it assumes that external clocks are 1x the bit rate even though 16x is the standard, and receiver parity is half-implemented and never signals an error.

The on-chip UARTs and serial interfaces provided by various MCUs are in even sorrier shape overall, and a common obstacle to emulating these is that they can send and receive bits faster than the execution of one instruction can take. A few MCU cores have proper serial emulation of the on-chip UARTs, but others simply fake them using parallel write handlers (MCS-51 being the most lamentable example) and many more don't even begin to emulate them. Coming up with actual use cases for the UARTs of some of the more obscure MCUs would be tricky, though.

Re: Has anyone tested the amstrad amsrs232 interface? [Re: TSCHAK] #114303
11/15/18 04:19 AM
11/15/18 04:19 AM
Joined: Jul 2011
Posts: 102
T
TSCHAK Offline OP
Senior Member
TSCHAK  Offline OP
Senior Member
T
Joined: Jul 2011
Posts: 102
Well, I just tried the 8250 emulation as part of the SVI-328, and it isn't working at all (with Kermit)

-Thom


Who's Online Now
2 registered members (xinyingho, 1 invisible), 130 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Shout Box
Forum Statistics
Forums9
Topics8,606
Posts112,516
Members4,827
Most Online296
Dec 5th, 2018
Powered by UBB.threads™ PHP Forum Software 7.6.1.1
(Release build 20180111)
Page Time: 0.026s Queries: 14 (0.008s) Memory: 5.6646 MB (Peak: 5.8833 MB) Zlib enabled. Server Time: 2018-12-16 10:24:35 UTC