Vamiga: Test CPU/C/CLR2.l fails

Created on 26 Jul 2020  路  3Comments  路  Source: dirkwhoffmann/vAmiga

A500 8A: 馃グ

CLR2l_A500_8A

vAmiga: 馃檳

Bildschirmfoto 2020-07-26 um 17 47 21

In the first line, this test runs instructionCLR.L ($10,a5) with a5 = COLOR00 - $10. The red arrow marks the point where the CLR instruction reads COLOR00, and the yellow arrow marks the point where CLR writes $0.

I think this test reveals that the CLR.L instruction writes the target operand in reversed order, i.e., $DFF182 is cleared before $DFF180. The total cycle counts are all OK (which was expected, because I already checked the instruction with cputester).

Bug CPU

Most helpful comment

This is the timing signature of ANDI, his twin brother:

AND3l_A500_8A

As you can clearly see: Yes

vAmiga already reverses the order:

template<Instr I, Mode M, Size S> void
Moira::execAndiEa(u16 opcode)
{
    u32 ea, data, result;

    u32 src = readI<S>();
    int dst = _____________xxx(opcode);

    if (!readOp<M,S, STD_AE_FRAME>(dst, ea, data)) return;

    result = logic<I,S>(src, data);
    prefetch();

    writeOp <M,S, POLLIPL | REVERSE> (dst, ea, result);
}

Bildschirmfoto 2020-07-27 um 10 14 26

All 3 comments

Fixed.

Bildschirmfoto 2020-07-27 um 08 57 05

Old code:

template<Instr I, Mode M, Size S> void
Moira::execClr(u16 opcode)
{
    int dst = _____________xxx(opcode);

    u32 ea, data;
    if (!readOp<M,S, STD_AE_FRAME>(dst, ea, data)) return;

    isMemMode(M) ? prefetch() : prefetch<POLLIPL>();

    if (S == Long && isRegMode(M)) sync(2);
    writeOp <M,S, POLLIPL> (dst, ea, 0);

    reg.sr.n = 0;
    reg.sr.z = 1;
    reg.sr.v = 0;
    reg.sr.c = 0;
}

To fix the issue, line

    writeOp <M,S, POLLIPL> (dst, ea, 0);

had to be replaced by:

    writeOp <M,S, REVERSE | POLLIPL> (dst, ea, 0);

What about ORI.L

1EC80C46-32C6-4A18-B505-E6FA23F22EE4

Does he maybe need ReverseOrder treatment too?

This is the timing signature of ANDI, his twin brother:

AND3l_A500_8A

As you can clearly see: Yes

vAmiga already reverses the order:

template<Instr I, Mode M, Size S> void
Moira::execAndiEa(u16 opcode)
{
    u32 ea, data, result;

    u32 src = readI<S>();
    int dst = _____________xxx(opcode);

    if (!readOp<M,S, STD_AE_FRAME>(dst, ea, data)) return;

    result = logic<I,S>(src, data);
    prefetch();

    writeOp <M,S, POLLIPL | REVERSE> (dst, ea, result);
}

Bildschirmfoto 2020-07-27 um 10 14 26

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bnice picture bnice  路  4Comments

dirkwhoffmann picture dirkwhoffmann  路  3Comments

dirkwhoffmann picture dirkwhoffmann  路  3Comments

dirkwhoffmann picture dirkwhoffmann  路  3Comments

mithrendal picture mithrendal  路  3Comments