Post Reply 
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:

270 IF Z=11 THEN 860.....................................................154 6
                                                                         155 6
                                                                         156 5
                                                                         157 CHS
                                                                         158 STO I
                                                                         159 1
                                                                         160 1
                                                                         161 RCL .4
                                                                         162 TEST 5
                                                                         163 GTO I
310 C=INT(10*RND(1)): Y=C+17.............................................164 1
                                                                         165 0
                                                                         166 RAN#
                                                                         167 *
                                                                         168 INT
                                                                         169 STO 1
                                                                         170 RCL 1
                                                                         171 1
                                                                         172 7
                                                                         173 +
                                                                         174 STO .3

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.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
voyc: Compile CommodoreBASIC to HP 15-C - Michael Zinn - 06-11-2019 03:28 PM



User(s) browsing this thread: 1 Guest(s)