On Sat, Jan 21, 2006 at 05:09:51AM +0000, Stuart Brady wrote:

> It seems to work, but needs more testing.  There was one snapshot that
> I couldn't get working, but I've no idea why... perhaps a timing issue?

No, it turned out to be my buggy handling of the im and iff1/2.  It now
works on everything I've tested so far, but I still need help testing.

>         pop af
>         ld r,a     ; restore r
>         jp po,0933 ; check bit 2 of f, skip if zero
>         ei

I thought I'd got this wrong at first, but it seems I was right.  PV is
reset iff parity is odd.

> +  /* Byte 18 not used */
> +  i = regs[19];
> +  if (i == 00 || i == 0x3f) {
> +    libspectrum_snap_set_im   ( snap, 0 );

I think this should have been IM1, not IM0.  Sound right?

> +  } else {
> +    libspectrum_snap_set_im   ( snap, 2 );
> +  }
> +  libspectrum_snap_set_i      ( snap, i );
> +
> +  sp = (regs[20] + regs[21] * 0x100) & 0xffff;
> +  libspectrum_snap_set_sp     ( snap, (sp + 6) & 0xffff );
> +
> +  libspectrum_snap_set_iff1   ( snap, buffer[sp + 0] & 0x02 ? 0 : 1 );

0x04 for the PV flag, not 0x02.  I got the semantics reversed here, as
interrupts should be enabled iff PV is set.

> +  libspectrum_snap_set_iff2   ( snap, 0 );

I think this should be set equal to iff1?

Is there anything that's wrong?

BTW, if anyone can understand this jump, I'd love to know:

        out (fa),a ; lmpr
        jp 0928    ; ???
0928:   ld a,05    ; bcd 5

(I just realised, I got the jp and ld instructions the wrong way wround
in the disassembly.  Sorry about that.)

Cheers,
-- 
Stuart Brady

Reply via email to