Re: [hatari-devel] IKBD regression with EmuTOS |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/hatari-devel Archives
]
- To: hatari-devel@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [hatari-devel] IKBD regression with EmuTOS
- From: Vincent Rivière <vincent.riviere@xxxxxxxxxxx>
- Date: Tue, 12 Feb 2013 00:23:17 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:message-id:date:from:user-agent:mime-version:to :subject:references:in-reply-to:content-type :content-transfer-encoding; bh=P//Ogj2qWB8hJ/39tNTmpYHLuprdNEssgDZgmH/L+D8=; b=PKq9KLE4ZBrPOqOEIB01dwmhUh5mixbxAq0svoeWX0Mrg0oy+3qZsSyKgV2A3YeO27 y5cRU1Nb2YIrQasjBEyGFt83pbguh0ev2seP4/okzfeEck0nxlhkAwccOkCzJR+Ksp5R geOpCRt2Hat5t3dfFyg7sBqCrIuY5NdviQ6dTtw91GF3x0HQ32KYEWIdtnY2MQH2obBN 92d+2H7/CdkIN3+Y/ZwvhxrbkNZMe1WPc7szrsnJXy5+J2K4pG3CjEZnDj8wnnB69IKe QxMn+1U4yy5Fb0khb8xdZ+WPCE74N1jWAyubC1h6zXZZ+COCSD2Ie5h6R5i4x/9XtF6/ yVcg==
On 10/02/2013 19:56, Nicolas Pomarède wrote:
In Hatari, after the first start, the acia's clock is started only when
writing $96 to $fffc00.
First, EmuTOS issues an ACIA Master Reset.
Then it configures the control register correctly.
After that, it sends $80 $01.
And you are right, it does not wait enough before sending additional
commands. This is wrong.
But it does not explain what happens.
If you receive byte from the ikbd before the acia is
set, this will create the observed error under emutos (due to the overrun).
No, nothing is received before the ACIA is initialized.
I also can't understand how a buffer overrun could prevent next bytes to be
received.
If you then reset Hatari, the acia's clock remains initialized, so the ikbd
will work correctly this time.
Since EmuTOS properly initializes the ACIA in the same way on cold and warm
boot, I can't understand why Hatari's behaviour is different in both cases.
From what you say, if it works on real hardware, then it would mean
that the acia processes serial data after the first start
If you mean that data can be received before the ACIA initialization, I
don't know, since EmuTOS does not do that.
but still you should read $fffc02 after a reset when RDRF is set, else
you might get problem in other cases.
Sure. I have added that to EmuTOS, with a timeout to avoid hangs when the
keyboard is unplugged. Unfortunately, in that early initialization routine,
no timer is available, so I did that with an ugly CPU loop. Not a big
problem, since it matters only with Hatari, where the CPU speed is limited.
However, I have studied the TOS 1.02 and 1.62 keyboard initialization
routines. There is timeout management (again, with CPU loop) in the IKBD
write routine to avoid hangs.
After the IKBD reset, there is again a big delay, but that's all. I didn't
see any IKBD read for that $f1 byte. I believe it is read later, by the
keyboard interrupt routine, just as it was in EmuTOS.
So, as you said, the solution in Hatari is to wait for the IKBD reset to
complete before sending additional command bytes (otherwise, we enable those
undocumented modes). But I still wonder how that can prevent further data to
be received from the IKBD, and only on cold boot on Hatari. Jean-François
Del Nero tested EmuTOS as ROM replacement on his STe, and he never reported
such problems on cold boot.
Also, I saw strange code in Hatari's src/acia.c.
That's about pACIA->FirstMasterReset and RTS line.
I wonder if that could explain the odd behaviour on cold boot only.
Anyway, my biggest concern is the upcoming EmuTOS 0.9.0 release. Even if we
have to put a few workarounds inside, it must work fine on all the supported
platforms.
--
Vincent Rivière