voyc: Compile CommodoreBASIC to HP 15-C
|
06-11-2019, 03:28 PM
Post: #1
|
|||
|
|||
voyc: Compile CommodoreBASIC to HP 15-C
I wrote a compiler that compiles programs written in CommodoreBASIC (C64 BASIC) to HP 15-C without changes. See https://gitlab.com/michaelzinn/voyc
The compiler is incomplete (no support for arrays or functions yet), but it's enough to compile some games or other programs. Output is meant to be user friendly, so it outputs the program both in a plain format that works well with the SwissMicros assembler (to produce an image to send to the calculator over serial) as well as a (slightly buggy) side by side view of the BASIC program and the calculator code, like this: Code:
So far, I managed to play this game on my calculator: http://vintage-basic.net/bcg/hammurabi.bas Using the compiler is currently a bit tricky (you need to install Idris and run it from the command line), the long term plan is to have it in JavaScript so that you can just download an HTML file with a text input box where you paste your basic code and click a "compile" button or something like that. |
|||
06-16-2019, 06:23 PM
Post: #2
|
|||
|
|||
RE: voyc: Compile CommodoreBASIC to HP 15-C
New Release! The compiler now supports the ON statement, which allows you to GOTO/GOSUB to different lines depending on what's in a variable (1 goes to the first line number, 2 to the second and so on).
Example: This program displays 123 and then allows the user to enter 1, 2 or 3 to get 111, 222 or 333 in response. Code:
Compiled this looks like this (It's very bloated, compiler optimizations will come later): Code:
Here's the annotated version that shows how it gets compiled in more detail: Code:
The ON code is very tricky and I'm not sure if it's optimal. Feel free to suggest improvements! |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: