Re: [hatari-devel] Hatari/EmuTOS Conflict

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


On 11/06/2013 01:03, Nicolas Pomarède wrote:
I don't see any problem in this part, acia reset is correctly detected and
emutos-cvs-20130604 boots with functional mouse/keyboard, even without the
patch I added to force acia at 9600 bauds on cold start.

Here're the traces :

acia ikbd write fffc00 cr=0x03 video_cyc=59888 452@117 pc=e06b1a instr_cycle 16
acia ikbd write cr data=0x03 VBL=53 HBL=117
acia ikbd master reset VBL=53 HBL=117
-> reset is made

acia ikbd write fffc00 cr=0x96 video_cyc=59912 476@117 pc=e06b20 instr_cycle 16
acia ikbd write cr data=0x96 VBL=53 HBL=117
acia ikbd start timer divider=64 cpu_cycles=1024 VBL=53 HBL=117
-> acia is initialized at 9600 bauds

Even if it works, this looks like a bug in EmuTOS.
The ACIA speed should be initialized before sending bytes, isn't it?

But there's a problem in Emutos : we can see it still sends 0x1a and 0x12
*during* the reset, which is not correct, it should send them after getting
a 0xf0 or 0xf1 from the ikbd.

I wrote ikbd_readb() especially to avoid this situation.

static UBYTE ikbd_readb(void)
{
#if CONF_WITH_IKBD_ACIA
    unsigned int i;
zz
    /* We have to use a timeout to avoid waiting forever
     * if the keyboard is unplugged. The standard value is 300 ms.
     */
    for (i = 0; i < 300; i++)
    {
        if (ikbd_acia.ctrl & ACIA_RDRF)
            return ikbd_acia.data;

        delay_loop(loopcount_1_msec);
    }

    return 0; /* bogus value when timeout */
#else
    return 0; /* bogus value */
#endif
}

If it returns before the byte is received, either the test of the ACIA status bit is wrong, or the function timeouts. Maybe the timeout value is not adjusted correctly. Also as I told you, in those early stages delay_loop(loopcount_1_msec) is not accurate and will not wait enough time if he CPU is faster than expected.

By looking at the disassembly, the bit 0 of 0xfffffc00 is correctly tested in the loop.

Is this version of Emutos CVS really compiled with CONF_WITH_IKBD_ACIA ?

Yes, proven by the disassembly.

Maybe this line should be enabled :

560    #if DBG_KBD
561        kprintf("ikbd_version = 0x%02x\n", ikbd_version);
562    #endif

To see if emutos really received 0xf1 or 0xf0, or bypassed the test.

I will setup a test environment (latest Hatari, EmuTOS, MIDI debugging...), but I'm currently very busy. Anyway, I will need to find the time to look at that before the next Hatari/EmuTOS release.

--
Vincent Rivière



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/