EtchedPixels / CC6303

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

[bug] Broken Conditional or assignment #6

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>

#define FOO 10
#define BAR 1
uint8_t bar;

int main(void)
{
    bar = BAR;
    POKE(SCREEN,65);
    while(1 && (bar < FOO + 1))
    {
        POKE(SCREEN+1,66);
    }
    POKE(SCREEN+2,67);

    while(1){};
    return 0;
}

I expect to see "AB" (as I do if I compile with CC65) but if I compile with CC6303 for the mc10 I get: "A C" on the top left corner of the screen. image

I have attached the binary and c10 file. build.zip

EtchedPixels commented 3 years ago

I messed up the crt0 change a bit. With that fixed it works as expected. Compiler output itself was fine just @one wasn't one but 256.

Fabrizio-Caruso commented 3 years ago

@EtchedPixels Thanks a lot! It seems that my games may be (sort of) working now! I still need to implement input and text prints but it looks like the game is running!