EtchedPixels / CC6303

A C compiler for the 6800 series processors
Other
37 stars 7 forks source link

[bug] Arrays seem to return their index #5

Closed Fabrizio-Caruso closed 3 years ago

Fabrizio-Caruso commented 3 years ago

If I compile:

#if defined(__MC10__)
    #define SCREEN 0x4000
    #define YSize 16
    #define XSize 32
#elif defined(__C64__)
    #define SCREEN 0x0400
    #define YSize 25
    #define XSize 40
#elif defined(__VIC20__)
    #define SCREEN 7680
    #define YSize 23
    #define XSize 22
#endif

#define POKE(addr,val) (*(unsigned char*) (addr) = (val))
#include <stdint.h>

static const char foo[5] = {'H','E','L','L','O'};

int main(void)
{
    uint8_t i;

    for(i=0;i<5;++i)
    {
        POKE((uint16_t) SCREEN+i,foo[i]);
    }
    while(1){};
    return 0;
}

I get reversed @ABCD instead of reversed HELLO on the left top corner of the screen as I do on the Vic 20 and C64. image

I have attached the binary and C10 file: build.zip

EtchedPixels commented 3 years ago

Fixed: we were still defaulting to 6303 CPU on an MC10. Using --cpu 6803 generates the right code but shouldn't also be needed. Fix applied to the frontend cc command.