Results 1 to 5 of 5

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    EmuTalk Member
    Join Date
    Oct 2011
    Posts
    11
    Mentioned
    0 Post(s)

    Intel 8080 emulator: need help finding bug(s)

    As the title says, I think I need some help tracking down a bug in an 8080 emulator that I've been writing in C over the last couple of days. I wrote it from scratch based on Intel documentation. It mostly seems to work, but there is clearly some issue with it. If I run the "8080 instruction exerciser" in the emulator, here are my results:

    Code:
    8080 instruction exerciser (KR580VM80A CPU)
    dad <b,d,h,sp>................  ERROR **** crc expected:14474ba6 found:33b6a681
    aluop nn......................  ERROR **** crc expected:9e922f9e found:284aecbe
    aluop <b,c,d,e,h,l,m,a>.......  ERROR **** crc expected:cf762c86 found:0c2144eb
    <daa,cma,stc,cmc>.............  ERROR **** crc expected:bb3f030c found:797efb2b
    <inr,dcr> a...................  ERROR **** crc expected:adb6460e found:0e5332db
    <inr,dcr> b...................  ERROR **** crc expected:83ed1345 found:9fc94769
    <inx,dcx> b...................  ERROR **** crc expected:f79287cd found:eb7d1a2b
    <inr,dcr> c...................  ERROR **** crc expected:e5f6721b found:1695262e
    <inr,dcr> d...................  ERROR **** crc expected:15b5579a found:d594aa97
    <inx,dcx> d...................  ERROR **** crc expected:7f4e2501 found:63a1b8e7
    <inr,dcr> e...................  ERROR **** crc expected:cf2ab396 found:2b639ce1
    <inr,dcr> h...................  ERROR **** crc expected:12b2952c found:9bee5682
    <inx,dcx> h...................  ERROR **** crc expected:9f2b23c0 found:83c4be26
    <inr,dcr> l...................  ERROR **** crc expected:ff57d356 found:1d476ec3
    <inr,dcr> m...................  ERROR **** crc expected:92e963bd found:28f7092b
    <inx,dcx> sp..................  ERROR **** crc expected:d5702fab found:c99fb24d
    lhld nnnn.....................  ERROR **** crc expected:a9c3d5cb found:6d1eeb35
    shld nnnn.....................  ERROR **** crc expected:e8864f26 found:2c5b71d8
    lxi <b,d,h,sp>,nnnn...........  OK
    ldax <b,d>....................  ERROR **** crc expected:2b821d5f found:06cfc034
    mvi <b,c,d,e,h,l,m,a>,nn......  OK
    mov <bcdehla>,<bcdehla>.......  ERROR **** crc expected:10b58cee found:dfe39de0
    sta nnnn / lda nnnn...........  ERROR **** crc expected:ed57af72 found:c01a7219
    <rlc,rrc,ral,rar>.............  ERROR **** crc expected:e0d89235 found:4bae6af9
    stax <b,d>....................  ERROR **** crc expected:2b0471e9 found:b726a433
    Tests complete
    The fact that there are apparently errors in SO MANY opcodes leads me to believe that the bug has something to do with a common piece of code used by some or many of them. Perhaps something like decoding register fields or the like. Although, I've already tried to find issues there, and I'm not able to see one. Either that, or it's a problem in an opcode that the test software uses to calculate the CRC of the results. Unfortunately, I can't find the source code to this test software. Or maybe it's an issue with flag calculation(s)?? Could be so many things, that's the hard part about writing CPU emulators, the debugging!



    Here is the source code: https://pastebin.com/mweNgfae (Note: It doesn't have cycle timing implemented yet)

    It DOES run Space Invaders, but there is a bug there where rows of enemies don't get cleared from the screen at the top as they move down the play field as you can see below. Maybe this will help someone. Thanks for any help you guys can provide.

    Last edited by miker00lz; April 9th, 2018 at 04:39. Reason: Forgot to link source code.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •