Menu

#3933 sdasrab treats xor hl, de as if it was in .r4k_11 mode

closed-fixed
nobody
None
other
5
2026-02-13
2026-02-12
No

sdasrab always assembles xor de, hl as Rabbit 4000 instruction mode 11 instruction, no matter if the instruction is valid for the target, or has a different encoding for the current mode:

void f(void)
{
__asm
.r3ka
xor hl, de
.r4k_10
xor hl, de
__endasm;
}

results in

      000000                         58 _f::
                                     59 ;test.c:8: __endasm;
                                     60     .r3ka
      000000 54                      61     xor hl, de
                                     62     .r4k_10
      000001 54                      63     xor hl, de
                                     64 ;test.c:9: }
      000002 C9                      65     ret

The first one should have been rejected, the second one assembled to 7f 54.

Discussion

  • Janko Stamenović

    Note it should be .r4k10 for mode 10.

    The commit #16200 should fix that.

    For .r2k and .r3ka:

    ?ASxxxx-Error-<a> in line 2 of a.asm
                  <a> Invalid Addressing Mode.
    ?ASxxxx-Error-<a> in line 4 of a.asm
                  <a> Invalid Addressing Mode.
    

    And the generated bytes:

                                          1         .r2k
    a     000000                          2         xor hl, de
                                          3         .r3ka
    a     000000                          4         xor hl, de
                                          5         .r4k10
          000000 7F 54                    6         xor hl, de
                                          7         .r4k
          000002 54                       8         xor hl, de
                                          9         .r4k11
          000003 54                      10         xor hl, de
                                         11 
    

    (After commit #16200 , from your list, only ldf instructions are to be implemented)

     

    Last edit: Janko Stamenović 2026-02-12
    • Philipp Klaus Krause

      Yes, this is fixed now, and the ticket can be closed.

       
      👍
      1
  • Janko Stamenović

    • status: open --> closed-fixed
     

Log in to post a comment.

MongoDB Logo MongoDB