A pair of Tiny BASICs
A pair of Tiny BASICs
Hello everyone, below are a couple of Tiny and Small integer BASICs ive been working on.
https://github.com/VinCBR900/65c02-Tiny-BASIC
Enjoy!
https://github.com/VinCBR900/65c02-Tiny-BASIC
Enjoy!
Re: A pair of Tiny BASICs
Looks great - a very thorough README. And I like the inclusion of two c emulators. Thanks!
A couple of points from me:
- Hans Otten is the correct spelling
- any of the standard open source licenses would be a huge improvement: even CC0 if you really don't mind.
- how might I decide where in RAM is fairly safe to put something, like some machine code, or a PEEK/POKE array of bytes?
A couple of points from me:
- Hans Otten is the correct spelling
- any of the standard open source licenses would be a huge improvement: even CC0 if you really don't mind.
- how might I decide where in RAM is fairly safe to put something, like some machine code, or a PEEK/POKE array of bytes?
Re: A pair of Tiny BASICs
Evening,
The assembly has a directive for available ram, currently set to 4kbyte. So anywhere outside that works with kowalski simulator and my toy simulators.
Oops typo on Han’s, I’ll fix tomorrow.
Re license, chatgpt recommends MIT but even then there’s nothing to force people to comply. I’ll toggle the flag and maybe update the headers on the next update.
The assembly has a directive for available ram, currently set to 4kbyte. So anywhere outside that works with kowalski simulator and my toy simulators.
Oops typo on Han’s, I’ll fix tomorrow.
Re license, chatgpt recommends MIT but even then there’s nothing to force people to comply. I’ll toggle the flag and maybe update the headers on the next update.
Re: A pair of Tiny BASICs
Thanks, MIT is a fine choice - visual6502 uses it, for example.
For memory allocation, I was thinking of TOP, LOMEM and HIMEM kinds of pseudo-variables. In some cases users are expected to PEEK the respective zero page locations to figure out where things are. In some cases one might use a string constant for machine code, in some cases a REM statement. It certainly a problem the user can figure out, even if there's no guidance, so it's not a huge problem. As you describe it, we could consider HIMEM to be absolute address 0x1000 and could freely use RAM above that.
For memory allocation, I was thinking of TOP, LOMEM and HIMEM kinds of pseudo-variables. In some cases users are expected to PEEK the respective zero page locations to figure out where things are. In some cases one might use a string constant for machine code, in some cases a REM statement. It certainly a problem the user can figure out, even if there's no guidance, so it's not a huge problem. As you describe it, we could consider HIMEM to be absolute address 0x1000 and could freely use RAM above that.
-
teamtempest
- Posts: 443
- Joined: 08 Nov 2009
- Location: Minnesota
- Contact:
Re: A pair of Tiny BASICs
Neat! Thanks for contributing it.
I notice that at one point you use an instruction that is technically not part of the original 65C02 instruction set. It is one of those Rockwell extensions that is included in the W65C02S instruction set, though. It would only be an issue if the processor in use happened not to be a Rockwell or W65C02S chip.
I notice that at one point you use an instruction that is technically not part of the original 65C02 instruction set. It is one of those Rockwell extensions that is included in the W65C02S instruction set, though. It would only be an issue if the processor in use happened not to be a Rockwell or W65C02S chip.
Re: A pair of Tiny BASICs
teamtempest wrote:
I notice that at one point you use an instruction that is technically not part of the original 65C02 instruction set. It is one of those Rockwell extensions that is included in the W65C02S instruction set, though.
Re: A pair of Tiny BASICs
Interesting project.
I followed your link and see that you used Claude AI and read about your development process. It's an interesting process and that it was able to produce something usable. My experience with Gemini's coding ability is that it's lackluster.
Update: I tried Claude AI and had it output some 65816 assembly to do 32-bit addition, subtraction, and multiplication. It was much better than ChatGPT or Gemini, but its multiplication code had minor bugs. For example, it had inefficient code where it dropped into an 8-bit accumulator. But it was overall much better.
Also, the claim that Claude AI generated a C compiler is considered controversial because Claude had access to the GNU C compiler source as part of its training data. The project also relied on a test harness where the human operator used GCC as an "oracle" to validate the AI's output.
I followed your link and see that you used Claude AI and read about your development process. It's an interesting process and that it was able to produce something usable. My experience with Gemini's coding ability is that it's lackluster.
Update: I tried Claude AI and had it output some 65816 assembly to do 32-bit addition, subtraction, and multiplication. It was much better than ChatGPT or Gemini, but its multiplication code had minor bugs. For example, it had inefficient code where it dropped into an 8-bit accumulator. But it was overall much better.
Also, the claim that Claude AI generated a C compiler is considered controversial because Claude had access to the GNU C compiler source as part of its training data. The project also relied on a test harness where the human operator used GCC as an "oracle" to validate the AI's output.
Re: A pair of Tiny BASICs
I am getting good results with using Claude for debugging. I have huge trace files from my emulator and it is very tedious to look through them to determine where the code path goes wrong. This is an excellent use for AI.
In general I find AI very useful, but you have to work closely with it and check everything.
In general I find AI very useful, but you have to work closely with it and check everything.
Re: A pair of Tiny BASICs
In my case I tried Gemini but it gave incorrect code eg non existent opcodes.
Claude was much better, but the real breakthrough came with the c based simulator and debugger is it could iterate without me in a tight loop, until my free account time was consumed, then wait 4hrs and continue.
Claude was much better, but the real breakthrough came with the c based simulator and debugger is it could iterate without me in a tight loop, until my free account time was consumed, then wait 4hrs and continue.
Re: A pair of Tiny BASICs
VinCBR900 wrote:
Claude was much better, but the real breakthrough came with the c based simulator and debugger is it could iterate without me in a tight loop, until my free account time was consumed, then wait 4hrs and continue.
Last night I became curious and tried Claude again with a project prompt. I was impressed because it asked good clarifying questions and reacted appropriately to my stated constraints (e.g. use ca65 syntax, ROM ready code). Eventually it produced about 4,000 lines of source, a build script, and a README.md. But it wouldn't assemble as it used illegal addressing modes in several places, and duplicate labels. But the basic ideas were correct, and this was the first time an LLM produced code I didn't find completely bonkers.
This makes me wonder if I can rescue the code with a line-by-line review. Would that be faster than writing 4,000 lines from scratch? I'm not sure.
Last edited by Martin_H on Thu Mar 26, 2026 11:12 am, edited 1 time in total.
Re: A pair of Tiny BASICs
Does the included emulator pass Klaus Dorman's test suite? That's always a good thing to try, especially for new code.
https://github.com/Klaus2m5/6502_65C02_functional_tests
https://github.com/Klaus2m5/6502_65C02_functional_tests
Re: A pair of Tiny BASICs
Probably not, as I only just heard of it and I don't know if all opcodes are implemented, only those needed to compile the Tiny BASICs
Last edited by VinCBR900 on Fri Mar 13, 2026 2:13 pm, edited 2 times in total.
Re: A pair of Tiny BASICs
It's worth trying - if an emulator can run a Basic, it's probably pretty good, so you'll just be needing to fix some corner cases. It might be that LLM tools can help with that.
-
teamtempest
- Posts: 443
- Joined: 08 Nov 2009
- Location: Minnesota
- Contact:
Re: A pair of Tiny BASICs
Quote:
Oops, my mistake - which one?
Re: A pair of Tiny BASICs
VinCBR900 wrote:
Claude was much better, but the real breakthrough came with the c based simulator and debugger is it could iterate without me in a tight loop
With the emulator and test suite available, Claude can work without my intervention for extended periods of time enhancing the assembler, troubleshooting and fixing issues along the way. With Claude I added modern syntax support, basic expressions, conditional compilation, macro capabilities and more.
I think another big factor is the new models that came out in December - What I described above was with Claude Opus 4.6 and it's proved significantly more capable than any of the earlier versions I tried.