Menu

#3935 uCsim r4k neg hl carry flag

open
uCsim (3) R4K (1)
other
5
3 days ago
4 days ago
No

Some r4k regression tests currently fail in the rabbit branch. I tracked the issue down to the simulation of the carry flag for neg hl:

Stop at 0x00140d: (109) stepped 5 ticks
A= 0x01   1 .  F= 00000000 0x00   0 .  Mode:10
                  SZxxxVxC
XPC= 0x000 IP= 0xff IIR= 0x02 EIR= 0x01
BC= 0xffff 00 .
DE= 0xffff 00 .
HL= 0xffce 00 00 00 00 00 00 00 00 ........
IX= 0xdfec f8 df b6 09 19 00 00 00 ........
IY= 0x0000 3e 80 d3 32 20 04 3e 02 >..2 .>.
JK= 0x0000 3e 80 d3 32 20 04 3e 02 >..2 .>.
SP= 0xdfe6 01 64 00 00 00 01 f8 df .d......
aAF= 0x00-00  aBC= 0x00-00  aDE= 0x00-00  aHL= 0x00-00  aJK= 0x00-00  
 PW= 0x0000-0000   PX= 0x0000-0000   PY= 0x0000-0000   PZ= 0x0000-0000  
aPW= 0x0000-0000  aPX= 0x0000-0000  aPY= 0x0000-0000  aPZ= 0x0000-0000  
0x140d  ? 7f 4d             NEG    HL
F 0x00140d
0> 

Stop at 0x00140f: (109) stepped 2 ticks
A= 0x01   1 .  F= 00000000 0x00   0 .  Mode:10
                  SZxxxVxC
XPC= 0x000 IP= 0xff IIR= 0x02 EIR= 0x01
BC= 0xffff 00 .
DE= 0xffff 00 .
HL= 0x0032 00 00 00 00 00 00 00 00 ........
IX= 0xdfec f8 df b6 09 19 00 00 00 ........
IY= 0x0000 3e 80 d3 32 20 04 3e 02 >..2 .>.
JK= 0x0000 3e 80 d3 32 20 04 3e 02 >..2 .>.
SP= 0xdfe6 01 64 00 00 00 01 f8 df .d......
aAF= 0x00-00  aBC= 0x00-00  aDE= 0x00-00  aHL= 0x00-00  aJK= 0x00-00  
 PW= 0x0000-0000   PX= 0x0000-0000   PY= 0x0000-0000   PZ= 0x0000-0000  
aPW= 0x0000-0000  aPX= 0x0000-0000  aPY= 0x0000-0000  aPZ= 0x0000-0000  
0x140f  ? 3e 00             LD     A,0x00
F 0x00140f
0>

Discussion

  • Daniel Drotos

    Daniel Drotos - 3 days ago
    • status: open --> closed-fixed
    • assigned_to: Daniel Drotos
     
  • Daniel Drotos

    Daniel Drotos - 3 days ago
     

    Related

    Commit: [r16221]

  • Philipp Klaus Krause

    • status: closed-fixed --> open
     
  • Philipp Klaus Krause

    Looks like the fix for the carry on neg hl broke the carry on sbc a, #n (maybe other instructions are affected - sbc a, #n is the first I found); lots of regression tests are failing:

    Stop at 0x0005d2: (109) stepped 2 ticks
    A= 0x80 128 .  F= 10000001 0x81 129 .  Mode:10
                      SZxxxVxC
    XPC= 0x000 IP= 0xff IIR= 0x02 EIR= 0x01
    BC= 0x0064 00 00 00 00 00 00 00 00 ........
    DE= 0xa010 00 00 00 00 00 00 00 00 ........
    HL= 0x060d 00 21 14 06 c9 01 00 62 .!.....b
    IX= 0x0000 3e 80 d3 32 20 04 3e 02 >..2 .>.
    IY= 0x0000 3e 80 d3 32 20 04 3e 02 >..2 .>.
    JK= 0x0000 3e 80 d3 32 20 04 3e 02 >..2 .>.
    SP= 0xdffc bc 04 2e 00 00 00 00 00 ........
    aAF= 0x00-00  aBC= 0x00-00  aDE= 0x00-00  aHL= 0x00-00  aJK= 0x00-00  
     PW= 0x0000-0000   PX= 0x0000-0000   PY= 0x0000-0000   PZ= 0x0000-0000  
    aPW= 0x0000-0000  aPX= 0x0000-0000  aPY= 0x0000-0000  aPZ= 0x0000-0000  
    0x05d2  ? de 80             SBC    A,0x80
    F 0x0005d2
    0> 
    
    Stop at 0x0005d4: (109) stepped 4 ticks
    A= 0xff 255 .  F= 10000000 0x80 128 .  Mode:10
                      SZxxxVxC
    XPC= 0x000 IP= 0xff IIR= 0x02 EIR= 0x01
    BC= 0x0064 00 00 00 00 00 00 00 00 ........
    DE= 0xa010 00 00 00 00 00 00 00 00 ........
    HL= 0x060d 00 21 14 06 c9 01 00 62 .!.....b
    IX= 0x0000 3e 80 d3 32 20 04 3e 02 >..2 .>.
    IY= 0x0000 3e 80 d3 32 20 04 3e 02 >..2 .>.
    JK= 0x0000 3e 80 d3 32 20 04 3e 02 >..2 .>.
    SP= 0xdffc bc 04 2e 00 00 00 00 00 ........
    aAF= 0x00-00  aBC= 0x00-00  aDE= 0x00-00  aHL= 0x00-00  aJK= 0x00-00  
     PW= 0x0000-0000   PX= 0x0000-0000   PY= 0x0000-0000   PZ= 0x0000-0000  
    aPW= 0x0000-0000  aPX= 0x0000-0000  aPY= 0x0000-0000  aPZ= 0x0000-0000  
    0x05d4  ? 30 03             JR     NC,0x05d9
    F 0x0005d4
    
     
  • Daniel Drotos

    Daniel Drotos - 3 days ago

    Sorry of the bug, reverted in [r16223].

     

    Related

    Commit: [r16223]


Log in to post a comment.