C Compiler working

A project log for MARK-II

Simple SoC written in VHDL.

Vladislav MlejneckýVladislav Mlejnecký 08/22/2017 at 20:500 Comments

Today, I compiled simple C program with vbbc and then ran it on MARK-II successfully. So I finally have C compiler for my CPU!

Of course, there are a lot of bugs and there is plenty of work left, but, it simply works!

Next goals are:

Code that I ran is really simple:

#define TIME 0x2FFFF
static void delay(int time);
static unsigned int* DDRA = 0x101;
static unsigned int* PORTA = 0x100;
int main(){
    *DDRA = 0xFF;
        *PORTA = 0xAA;
        *PORTA = 0x55;
    return 0;
static void delay(int time){
    unsigned int i;
    for(i = 0; i < time; i = i + 1);

It is hello world with LED. And I had a lot of problems with it. I discovered few bugs in emitting comparison code, I found out that loader isn't working correctly, and I spent a lot of time before I noticed I accidentally swap DDRA and PORTA registers addresses.

There is also link to commit that add vbcc into my project repository at github.