I noticed this HUGE mistake while trying to integrate SDCC into my build pipeline, where src/z80/mappings.i is incorrectly using what appears to be ASXXXX mappings for GNU Assembler.

static const ASM_MAPPING _gas_z80_mapping[] = {
    {"immed", "#"},
    {"zero", "#0x00"},
    {"one", "#0x01"},
    {"area", ".area\t%s"},
    {"areacode", ".area\t%s"},
    {"areadata", ".area\t%s"},
    {"areahome", ".area\t%s"},
...

I am unable to build the latest version from the git mirror for testing as it generates a bogus Bash script, but 4.1.0 (shipped on Fedora) produces the following assembly:

...
;--------------------------------------------------------
; ram data
;--------------------------------------------------------
        .area   INITIALIZED
;--------------------------------------------------------
; absolute external ram data
;--------------------------------------------------------
        .area   DABS (ABS)
;--------------------------------------------------------
; global & static initialisations
;--------------------------------------------------------
        .area   HOME
        .area   GSINIT
        .area   GSFINAL
        .area   GSINIT
...

I am unable to test my fixes, so I can't PR actual working codes in. It also seems strange that the mapping is duplicated, one in mappings.i and the other in SDCCasm.c. The one in SDCCasm.c seems to be correct.

EDIT NOTE: Removed edit from my attempt and verifying the cause of this bug.

 

Last edit: Atirut Wattanamongkol 2024-07-05