#176 [z80] Hardcoded "#0xNN"-like numbers elimination

z80 port (10)

There were few hardcoded numbers in "#0xNN" notation in the gen.c
Assemblers other than asxxxx consider them as errors.

Solution: replaced using !immedbyte/!immedword.


  • Alexander Tsidaev

    • summary: [z80] Hardcoded numbers of "#0xNN" type elimination --> [z80] Hardcoded "#0xNN"-like numbers elimination
  • Alexander Tsidaev

    But I have not idea what to do with commands that can use negative numbers like
    int d = (stack < 127 ? -stack : -127);
    emit2 ("add sp, #%d", d);

    both !immedbyte and !immedword are replaced with 32-bit long number when parameter is negative:
    emit2("add sp, !immedbyte", -15) give us "add sp, #0xFFFFFFF1"
    Is this a bug?

  • Philipp Klaus Krause

    • assigned_to: nobody --> spth
    • status: open --> closed-accepted
  • Philipp Klaus Krause

    Implemented for all "#0x" in revision #7917.


  • Philipp Klaus Krause

    Keeping it open for the other #-prefixed stuff.

  • Philipp Klaus Krause

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

    The !immedword substitution was applied in revision #7919. AFAIk there currently is no mechanism like this for negative numbers.


  • Philipp Klaus Krause

    • status: open-accepted --> closed-accepted

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks