[DM15] voyc: Compile CommodoreBASIC for HP 15-C

Contributed software for the DM10, DM11, DM12, DM15 and DM16 goes here.

Please prefix the subject of your post with the model of the calculator that your program is for.
Post Reply
michaelzinn
Posts: 41
Joined: Tue Apr 10, 2018 11:34 pm

[DM15] voyc: Compile CommodoreBASIC for HP 15-C

Post by michaelzinn »

First public release of the compiler! https://gitlab.com/michaelzinn/voyc

This allows you to compile CommodoreBASIC programs to the HP 15-C programming language. The compiler outputs both human-friendly annotated output as well as plain output to be used with the SwissMicros assembler.

Example output:

Code: Select all

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
You should also print out the strings table if you want to use your programs on the go (the calculator outputs complex numbers when it wants you to look up a string):

Image

Code is a mess, so looking at it is not yet recommended ;)
cdmackay
Posts: 281
Joined: Fri Oct 05, 2018 8:33 pm
Location: Cambridge, UK
Contact:

Re: [DM15] voyc: Compile CommodoreBASIC for HP 15-C

Post by cdmackay »

very nice, well done!

and delighted to see I'm not the only person to put logx(y) on C :)
Cambridge, UK
41CL/DM41X 12/15C/16C DM15/16 17B/II/II+ 28S 42S/DM42 32SII 48GX 50g 35s WP34S PrimeG2 WP43S/pilot
Casio, Rockwell 18R
michaelzinn
Posts: 41
Joined: Tue Apr 10, 2018 11:34 pm

Re: [DM15] voyc: Compile CommodoreBASIC for HP 15-C

Post by michaelzinn »

cdmackay wrote:
Wed Jun 12, 2019 1:18 am
very nice, well done!

and delighted to see I'm not the only person to put logx(y) on C :)
Thanks! I always have rootx(y), logx(y) and y mod x on my calculator, but I'm not sure what to do with the other two free buttons so I usually have random fun stuff there. What's on your calc?

Also, there's a new release of voyc, it supports ON now, e.g. this:

Code: Select all

10 PRINT 123
20 INPUT X
30 ON X GOSUB 111, 222, 333
40 GOTO 10
111 PRINT 111
112 RETURN
222 PRINT 222
223 RETURN
333 PRINT 333
334 RETURN
...gets compiled to this (very bloated, optimizations will come later):

Code: Select all

                             1 LBL 0
                             2 R/S
                             3 CF 8
                             4 RTN
                             5 LBL 1
                             6 CHS
                             7 STO I
                             8 LBL 2
                             9 GTO I
                             10 LBL 3
                             11 CHS
                             12 x<>y
                             13 1
                             14 -
                             15 TEST 0
                             16 RTN
                             17 R_down
                             18 STO I
                             19 R_up
                             20 RTN
                             21 LBL B
10 PRINT 123.................22 1
                             23 2
                             24 3
                             25 GSB 0
20 INPUT X...................26 SF 9
                             27 R/S
                             28 CF 9
                             29 STO 0
30 ON X GOSUB 111, 222, 333..30 0
                             31 STO I
                             32 RCL 0
                             33 INT
                             34 0
                             35 5
                             36 3
                             37 GSB 3
                             38 0
                             39 5
                             40 8
                             41 GSB 3
                             42 0
                             43 6
                             44 3
                             45 GSB 3
                             46 RCL_I
                             47 TEST 0
                             48 GSB 2
40 GOTO 10...................49 0
                             50 2
                             51 2
                             52 GTO 1
111 PRINT 111................53 1
                             54 1
                             55 1
                             56 GSB 0
112 RETURN...................57 RTN
222 PRINT 222................58 2
                             59 2
                             60 2
                             61 GSB 0
223 RETURN...................62 RTN
333 PRINT 333................63 3
                             64 3
                             65 3
                             66 GSB 0
334 RETURN...................67 RTN
cdmackay
Posts: 281
Joined: Fri Oct 05, 2018 8:33 pm
Location: Cambridge, UK
Contact:

Re: [DM15] voyc: Compile CommodoreBASIC for HP 15-C

Post by cdmackay »

michaelzinn wrote:
Sun Jun 16, 2019 8:34 pm
Thanks! I always have rootx(y), logx(y) and y mod x on my calculator, but I'm not sure what to do with the other two free buttons so I usually have random fun stuff there. What's on your calc?
Nothing very exciting, I'm afraid: just logx(y) on D, and %T on E, on my DM15. Think I need to add Nth root too, thanks for the idea.

On my DM16, I have a few progs I wrote, e.g. to show what bits are set in a number, a tiny wrapper to allow use of B? from the keys, and the extractbits prog from HP Journal, May 1983, pp. 38
Cambridge, UK
41CL/DM41X 12/15C/16C DM15/16 17B/II/II+ 28S 42S/DM42 32SII 48GX 50g 35s WP34S PrimeG2 WP43S/pilot
Casio, Rockwell 18R
Boub65
Posts: 231
Joined: Tue Sep 12, 2017 4:34 pm
Location: Rabat, Morocco

Re: [DM15] voyc: Compile CommodoreBASIC for HP 15-C

Post by Boub65 »

michaelzinn wrote:
Tue Jun 11, 2019 5:34 pm

Image
Always interesting to see how each one of us custmizes his Voyager calculator...

Here is my take :D

0_IMG-20190910-WA0007.jpg
0_IMG-20190910-WA0007.jpg (150.37 KiB) Viewed 9050 times

May be, it would be interesting that the face plate of the Voyagers include from factory these (important) informations found at the back of the calculator... may be with a different color "a la" WP43S...

Boubker.
Sincèrement, Sincerely, 73,
Boubker

DM15L, DM41L, DM42 #00855 (domes upgraded), DM41X #00707
HP48SX (with dark screen), HP42s, HP32SII (1990 with fraction bug), HP41C/CV
TI-89 titanium, CASIO fx-cg50 and Numworks (to play with micropython)
Post Reply