Menu

#2 Incorrect arithmetic ops & addressing

open
nobody
None
5
2003-02-16
2003-02-16
No

16 bit arithmetic operations are coded with 8 bit data
types, so results are completely incorrect.

Sign extension in JR and DJNZ is.... maybe not
incorrect, but coded in an excessively complicated way;
it should be enough to cast from 'byte' to 'char', and
then to 'int'.

Indexed addressing offsets are not correctly
calculated: addresses are 16 bit wide, UNSIGNED, and
offsets are 8 bit wide, SIGNED. As sign extension is
not being done in those cases, negative offsets are
incorrectly calculated.

Mmmm.... are you sure this library has ever been useful???

Discussion

  • Gabriel Gambetta

    Logged In: YES
    user_id=517400

    > Mmmm.... are you sure this library has ever been
    useful???

    Not exactly this code, but most if it comes from fairly solid
    and working code. I'll check your reports, thanks!

     
  • Philip Kendall

    Philip Kendall - 2004-07-21

    Logged In: YES
    user_id=29214

    The original poster is basically correct; a significant
    proportion of the opcodes are emulated incorrectly.

    Attached is a small test program which runs the test suite
    as supplied with Fuse
    <http://sourceforge.net/projects/fuse-emulator/>; you'll
    need the z80/tests directory from there.

    Currently, 645 out of 1307 tests.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.