smunaut / fire16-vbcc

VBCC for the fire16 architecture
1 stars 0 forks source link

Documentation / learning ? #1

Open Johnlon opened 2 years ago

Johnlon commented 2 years ago

Hi did you document any of your learning on how VBCC works? I'm considering basing my backend on yours as it's one of the cleanest one in the dist.

My cpu is a homebrew 8bit : https://github.com/Johnlon/spam-1

I'm using the source code dist provided by VBCC not the one here and fire16 is in there. ie http://sun.hasenbraten.de/vbcc/

Which source is most up to date? I see a bunch of todo's in the code - I get that most impls will be partial - but What state did you get it to? What problems or relevations did you have? What did you wish you'd known earlier?

Do you have doco for the underlying CPU and it's architecture and instruction set as this would help with translation.

I find the vbcc pdf hard going and loads of gaps and assumptions.

Thanks in advance.

smunaut commented 2 years ago

The version here is based on "vbcc 0.9f patch 1". I haven't worked on it in a while due to lack of time really ... the state was "simple programs worked" AFAIR, but pretty sure there was some bugs (although I can't exclude some of those where hw bugs in the cpu ...).

https://gist.github.com/smunaut/dac7a096add6bcdb5b70f0e205e4d16d is the target architecture (although I'm not 100% sure that doc is 100% up to date so beware).

It was mostly written from the PDF and yes, not always clear. Although since it's been 3 years and I haven't touched it since, that's unfortunately all I remember sorry :/

This port for sure has weird things because it only supports 16 bits and not 8 bits char and has 3 different address space (IO / Data / Program), which doesn't make things easy. And also a bunch of HW restrictions just to make the HW smaller/faster at the expense of a more complex software toolchain.

Johnlon commented 2 years ago

Spam-1 is a Harvard with no means to access program data other than immediate operand.

I wrote my own c-like Lang called SpamCC and it only supported 16 bit ints but I wanted the challenge and achievement of being able to use c. I used spamcc to write a Chip8 emulator for some old games and the hw works fine now.

16 bit ints is therefore a start for me with VBCC. My interest was really the code structure rather than detailed impl as the "code quality" on the other backends is interesting - it's just a bunch of side effects. I felt yours was cleaner as at least the side effects seem restricted to a context object - conceivably one might write a unit test with that kind of structure. But I will probably just write functional tests. C in Asm out.

Did you mess with the linker and machine code gen? I was just thinking of stopping with the ASM and using my own existing assembler for now.

On Mon, 23 May 2022, 3:11 pm smunaut, @.***> wrote:

The version here is based on "vbcc 0.9f patch 1". I haven't worked on it in a while due to lack of time really ... the state was "simple programs worked" AFAIR, but pretty sure there was some bugs (although I can't exclude some of those where hw bugs in the cpu ...).

https://gist.github.com/smunaut/dac7a096add6bcdb5b70f0e205e4d16d is the target architecture (although I'm not 100% sure that doc is 100% up to date so beware).

It was mostly written from the PDF and yes, not always clear. Although since it's been 3 years and I haven't touched it since, that's unfortunately all I remember sorry :/

This port for sure has weird things because it only supports 16 bits and not 8 bits char and has 3 different address space (IO / Data / Program), which doesn't make things easy. And also a bunch of HW restrictions just to make the HW smaller/faster at the expense of a more complex software toolchain.

— Reply to this email directly, view it on GitHub https://github.com/smunaut/fire16-vbcc/issues/1#issuecomment-1134729944, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGMFGCC6DOQ5LFMHMJMVKTVLOGYNANCNFSM5WR3ZFHA . You are receiving this because you authored the thread.Message ID: @.***>