sd:tinyc_developer_diary
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| sd:tinyc_developer_diary [2026/04/19 09:09] – appledog | sd:tinyc_developer_diary [2026/04/20 04:58] (current) – appledog | ||
|---|---|---|---|
| Line 808: | Line 808: | ||
| </ | </ | ||
| - | == Digging a very deep hole | ||
| - | This isn't working. I have to increase the number of symbols. If this doesn' | ||
| - | Every place which touches | + | == A classic clobbering bug |
| + | To do forward declarations, | ||
| - | cc_sym_clear: | + | Now I know this sounds simple when I lay it out, but this took me 10 hours to fix. It's just a classic clobber-bug but it's a sign this code is starting to weigh me down. I just want to write some games. I don't understand why this has to be so hard. But even after all this I am pretty sure it is easier than writing a GCC or LLVM back end. |
| - | LDA #0 | + | |
| - | STA [@CC_SYM_COUNT] | + | |
| - | RET | + | |
| - | ... for every _sym function. And any time CC_SYM_COUNT or CC_SYM_SCOPE is used. | + | == Everything in bank 0! |
| + | I was such a fool to make the symbol table 16 bit. Now everything has to be in bank 0. But there' | ||
| + | I have a plan. What if we put the output ~2k before the source code? The tokenizer and other things seem to output less bytes than source code, so it should work. | ||
| + | |||
| + | So if HERE grows into the source area as source gets consumed, we can theoretically use up to 48KB for source code AND compiled code. This requires HERE to stay behind SRC at all times. It destroys the code as it compiles, but that's okay. The two pointers march through the memory, with HERE chasing SRC. The only problem is if the emitter somehow catches up with the source code pointer. | ||
| + | |||
| + | At this point I am very close to just rewriting the symbol table to be 32 bit. I mean this is already an insane asylum as it is, but, how hard could rewriting the emitters possibly be? :) | ||
| + | |||
| + | == Rewriting the symbol table | ||
| + | I guess I'm about to find out how hard it can be. | ||
sd/tinyc_developer_diary.1776589747.txt.gz · Last modified: by appledog
