Skip to content

"invalid expression" for n in SECTION....,BANK[n] #8

@nonchip

Description

@nonchip

having noticed you didn't disallow banks on the "generic z80" target (and no way to set the bank size, so i hoped for something smart along the lines of "one binary file per bank"), i decided to check what it does with some simple code:

  SECTION "a",CODE
  DB $01
  SECTION "b",CODE[5]
  DB $02
  SECTION "c",CODE[10],BANK    ; E0100 [ expected ; (this is expected behaviour)
  DB $03
  SECTION "d",CODE[15],BANK[3] ; E0102 Invalid expression
  DB $04
  SECTION "e",CODE,BANK[3]     ; E0102 Invalid expression
  DB $05

and with motorz80 -mcz -ms0 -mu0 i'm getting the errors i commented above.

the parser seems to be totally fine with the BANK itself (and doesn't complain about banking being unsupported), but my integer is an invalid expression somehow in BANK (but totally fine in CODE).

so it seems to be failing to recognize an integer in parse_ConstantExpression (called by expectBankFixed) if i'm not mistaken.

following the control flow in those functions in my head, specifically this seems to fail:

int32_t
parse_ConstantExpression() {
    SExpression* expr = parse_Expression(4); // <-- this returns NULL??

    if (expr != NULL) {
      // ...
    } else
        err_Error(ERROR_INVALID_EXPRESSION); // <-- pretty sure I'm getting this error
    return 0;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions