z80 indexed addressing problem

  • Heather

    Heather - 2012-07-13


    I accidentally posted this in the open discussion forum, I'm not sure how to delete it but I will just re post this here with more info…

    I am currently writing a op code test file for an open core z80 processor, but I am having some problem compiling my code using the sdcc. For example, testing ADD A, (IX + 5) I receive an error "missing or improper operators, terminators or delimiters". I have also tried ADD A, (IX + 5H) ADD A, (IX + 0x05) ADD A, (IX + #0x05) and a couple of other variation but have had no luck. Does anybody know how to perform this action? I assume I just have the syntax wrong.

    This is my make file:
    sdcc %1.c -mz80 -code-loc 0x0000 -xram-loc 0x8000 -no-std-crt0
    packihx %1.ihx > %1.hex

    SDCC version 3.2.0 (also tried this with 3.1.0)

    Code snippet:
    LD A, #0x11
    LD IX, #0x8000
    LD HL, #0x8005
    LD (HL), #0x22
    ADD A, (IX + 5)

    Interestingly enough, it does compile without error ADD A, (IX) with the correct opcode (DD 86 00)
    I experience the same problem with all operation involve IX+d or IY+d

    Any help would be greatly appreciated :)

  • Heather

    Heather - 2012-07-13

    ok so apparently the compiler was looking for

    ADD A, 5(IX)

    problem solved.


Log in to post a comment.