GithubHelp home page GithubHelp logo

What is FD 18 testing? about jsmoo HOT 1 CLOSED

raddad772 avatar raddad772 commented on May 17, 2024
What is FD 18 testing?

from jsmoo.

Comments (1)

raddad772 avatar raddad772 commented on May 17, 2024

Hey,

Thanks for using the tests! Remember if you find a mistake, it may be my fault; do look up the docs. I made these because my original Z80 core was trash, and I had really benefited from similar tests by someone else.

There's definitely some documentation for how X,Y and WZ work that isn't easy to find. The Undocumented Z80 Documented is a good start.

The source for the tests is available in this repository under misc/code_generation/z80_test_generator.js, and my Z80 core is available in the component/cpu/z80 sub-directory.

As to what FD 18 is testing...I guess this may or may not be a bug. Regular opcode 0x18 is defined as "JR_c_e", which is an unconditional relative jump. If you read Z80 Undocumented, you'll see (in reference to DD and FD):

In general, after a DD prefix the instruction is executed as if the DD
weren't there. There are some exceptions:

* Any access to HL is treated as an access to IX (except EX DE,HL and EXX
  and the ED prefixed instructions that use HL).
* Any access to (HL) is changed to (IX+d), where d is a signed displacement
  byte placed after the main opcode (except JP (HL), which isn't indirect
  anyways.
* Any access to H is treated as an access to IXh (the high byte of IX)
  Except if (IX+d) is accessed.
* Any access to L is treated as an access to IXl (the low byte of IX)
  Except if (IX+d) is accessed.
* A DD prefix before a CB selects a completely different instruction 
  set (see 1.5).

Anyway, none of those is fulfilled, so it's just treated as a regular 0x18. I know it doesn't show up in opcode tables like that, but it's the behavior the Z80 exhibits. The tests are generated by running through 0xFD00 to 0xFDFF and generating any possibly legal opcodes by running them on a Z80 core ported from Ares (and patched up in the meantime; I've submitted several upstream Z80 issues).

I also asked on the ZX Spectrum Emulator Discord, where there's a lot of people more knowledgeable about the Z80 than I am there, and this behavior was confirmed.

Thanks a bunch again!

Thanks again for using the tests! I'll post back here when I get a response

from jsmoo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.