Page 1 of 1

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

Posted: Tue Jun 11, 2019 5:34 pm
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 ;)

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

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

and delighted to see I'm not the only person to put logx(y) on C :)

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

Posted: Sun Jun 16, 2019 8:34 pm
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

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

Posted: Sun Jun 16, 2019 8:47 pm
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

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

Posted: Tue Sep 10, 2019 5:00 pm
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 9044 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.