floooh / v6502r

visual6502 remixed
297 stars 30 forks source link

Z80 Errata #2

Closed floooh closed 2 years ago

floooh commented 2 years ago

Current theory: the netlist is probably from a Zilog Z8400, not an original Z80.

Triggering an IM1 interrupt during a JR instruction jumps to 0x30, not 0x38:

    ei
    im 1
l0: jr l0   ; triggering INT in this loop...

    org 30h
l1: jr l1   ; ...jumps here

    org 38h
l2: jr l2   ; ...but should jump here

WZH should be set to 0x33 (value of A), but is set to zero at end of LD (nn),A:

    ld a,33h
    ld (1111h),a

Same here: WZH should be 0x33, but is zero.

    ld a,33h
    ld bc,1111h
    ld (bc),a

Note that the differing WZH behaviour could be an indication that the netlist is actually from a Russian (or East German?) Z80 clone, see memptr_eng.txt.

The undocumented XF and YF flags are cleared in BIT instructions: According to z80-documented.pdf the X/Y flags should both be set after the following BIT instruction (because bit 3 and 5 in A are also set):

    ld a,0xFF
    bit 1,A
    nop

After the BIT instruction, only HF and CF are set, XF and YF are unset (these could also be differences between a Z80 clone and an original Z80?).

teeeby commented 2 years ago

IM 1 jumping to 0030 seems to be a bug in Visual Z80 Remix. A real BM1 Z80 clone has been tested and does not have this bug.

redcode commented 2 years ago

@simonowen has also tested it on a SAM Coupé and there is no such bug in the INT mode 1.

teeeby commented 2 years ago

floooh, please look at the following thread for a way to improve Visual Z80 Remix: https://stardot.org.uk/forums/viewtopic.php?p=349760#p349760

floooh commented 2 years ago

I'll try to integrate the required changes in the next few days. Many thanks for the thorough investigation and the nudge @teeeby :)

floooh commented 2 years ago

Ok the fix is up: https://github.com/floooh/v6502r/commit/514a58b5830dc6ba7c65b146e9d67120f8a92c2a

The WASM version is also updated: https://floooh.github.io/visualz80remix/ (if the old version is stuck in the browser cache, try refreshing with Ctrl/Cmd-Shift-R).

Screenshot 2022-02-18 at 14 47 48

I'll close this ticket, and if anything else shows up, I'll open a new ticket :)