Menu

#3574 [z80] Error: <a> machine specific addressing or addressing mode error

closed-fixed
None
Z80
5
2023-04-14
2023-03-21
sverx
No

Using inline asm I can use certain istructions with iyh/iyl/ixh/ixl registers but I can't use some others.

For instance no problems with

  __asm
    ld iyl,iyh
    ld iyh,iyl
    dec iyl
    dec ixl
__endasm;

but this would break (example):

  __asm
    ld  a,iyh
    ld  ixl,a
__endasm;

I suspect this is just a bug.

Thanks for fixing it!

Related

Wiki: z80

Discussion

  • sverx

    sverx - 2023-04-13

    I realized now I have filed this under 'Support Requests'.

    Should I file this again under 'Bugs' or can you move that?

    Thanks! (Sorry!)

     
  • Philipp Klaus Krause

    Ticket moved from /p/sdcc/support-requests/186/

    Can't be converted:

    • _milestone:
     
  • Philipp Klaus Krause

    The bug here is that the instructions ld iyl,iyh, ld iyh,iyl, dec iyl and dec ixl do not give such an error.

     
    • sverx

      sverx - 2023-04-13

      What would be the correct equivalent of these instructions?

       
      • Philipp Klaus Krause

        None. The syntax is correct, the undocumented instructions are just not valid instructions for the z80 target by default.

        To enable them, a target that has them enabled by default has to be used (-mez80_z80 or -mzxn), or for -mz80, the option --allow-undocumented-instructions.
        Note however, that doing so will not just enable them for inline assembly, it will also allow the compiler to use them.

        To enable them for inline assembly only, but still disallow their use by the compiler (e.g. to ensure that only some of them are used - AFAIK on some early NMOS Z80, some of the undocumented instructions don't work ), one could use -mz80 without --allow-undocumented-instructions and enable the undocumented instructions for the assembler only via the assembler directive:

        __asm
        .allow_undocumented
            ld iyl,iyh
            ld iyh,iyl
            dec iyl
            dec ixl
        __endasm;
        
         

        Last edit: Philipp Klaus Krause 2023-04-13
        • sverx

          sverx - 2023-04-13

          OK so I see I should be able to use the .allow_undocumented instruction and then assemble ld a,iyh and/or ld ixl,a?
          I will try.

          AFAIK on some early NMOS Z80, some of the undocumented instructions don't work

          Not these ones, AFAIK...

           
        • sverx

          sverx - 2023-04-14

          .allow_undocumented is broken until Commit: [r13287]
          (just a note to myself for later)

           

          Related

          Commit: [r13287]


          Last edit: sverx 2023-04-14
  • Philipp Klaus Krause

    • status: open --> closed-fixed
    • assigned_to: Philipp Klaus Krause
    • Category: --> Z80
     
  • Philipp Klaus Krause

    Fixed in [r14011],

     

    Related

    Commit: [r14011]


Log in to post a comment.

MongoDB Logo MongoDB