[DM15] [15C] Brainf█k Programming Language

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] [15C] Brainf█k Programming Language

Post by michaelzinn »

I wrote an interpreter that you can use to run Brainf█k programs directly on your calculator. For example, if you wanted to calculate Fibonacci numbers with the +>+[[->+>+<<]<[->>>+<<<]>>>.] program you could enter it like this:

SF 0
3137741313 STO 3
2282741113 STO 4
2228111580 STO 5

...and then run it with "B". (The flag is for "compact mode". Without it it would run in "fast mode" with one instruction per register).

Full post including source is here: https://steemit.com/programming/@michae ... calculator
michaelzinn
Posts: 41
Joined: Tue Apr 10, 2018 11:34 pm

Re: [DM15] [15C] Brainf█k Programming Language

Post by michaelzinn »

Here's a memory dump:

Code: Select all

DM15_M1B
04  000000fffff000  00000000000008  0000000000000c  00000000000eae
08  00000000000000  2faf8befbe2280  00000000000000  00000000000000
14  00000000000000  1b2d2d2d2d2d2d  000000000006e7  00000000000000
18  00000000000000  0000000000007f  00000000a00000  00000000000000
e4  00000000000000  00000000000000  00000000000000  00b2ebfcf0f1a3
e8  fdc586ccfbc5b1  fcf0f1a397fdf0  f10eb286971e50  ff3000ff1980df
ec  c351fff1b2ec32  a2df75f1fbf720  ff82df75f1fbf6  20ff0931ff42f0
f0  b2ec8697310819  41ff42f0b27086  973107b29649ff  c239ffa2973106
f4  b2dc86973105b2  bddff1973104b2  9ddff1973103b2  81dff102b2a1df
f8  f101c2b400b212  ff9596a251ff31  ffec8602ff97f9  f1f0c0f341ff0c
fc  11ff80dff18997  20ff01ff42f041  f9f140fc50fff3  c1f0f12c60ff0b
A: 000000fffff000  B: 000000fffffeae  C: 00000000000eae
S: 00000000000000
M: 395033178ff000  N: 00000000000000  G: 04
Or if you prefer to enter it:

Code: Select all

001  LBL B        | 42,21,12
002  FIX 0        | 42, 7, 0
003  GSB C        |   32  13
004  1            |        1
005  0            |        0
006  ENTER        |       36
007  3            |        3
008  F? 0         | 43, 6, 0
009  *            |       20
010  STO 0        |    44  0
011  1            |        1
012  9            |        9
013  STO 1        |    44  1
014  0            |        0
015  STO 2        |    44  2
016  LBL .1       | 42,21,.1
017  GSB .0       |    32 .0
018  STO I        |   44  25
019  GSB I        |   32  25
020  1            |        1
021  STO+0        | 44,40, 0
022  GTO .1       |    22 .1
023  LBL C        | 42,21,13
024  CF 1         | 43, 5, 1
025  3            |        3
026  .            |       48
027  0            |        0
028  1            |        1
029  9            |        9
030  STO I        |   44  25
031  LBL .2       | 42,21,.2
032  RCL (i)      |   45  24
033  x=0          |   43  20
034  SF 1         | 43, 4, 1
035  F? 1         | 43, 6, 1
036  CLx          |   43  35
037  STO (i)      |   44  24
038  ISG I        | 42, 6,25
039  GTO .2       |    22 .2
040  RTN          |   43  32
041  LBL 0        | 42,21, 0
042  R_up         |   43  33
043  R/S          |       31
044  LBL 1        | 42,21, 1
045  1            |        1
046  STO-1        | 44,30, 1
047  RTN          |   43  32
048  LBL 2        | 42,21, 2
049  1            |        1
050  STO+1        | 44,40, 1
051  RTN          |   43  32
052  LBL 3        | 42,21, 3
053  RCL 1        |    45  1
054  STO I        |   44  25
055  1            |        1
056  STO+(i)      | 44,40,24
057  RTN          |   43  32
058  LBL 4        | 42,21, 4
059  RCL 1        |    45  1
060  STO I        |   44  25
061  1            |        1
062  STO-(i)      | 44,30,24
063  RTN          |   43  32
064  LBL 5        | 42,21, 5
065  RCL 1        |    45  1
066  STO I        |   44  25
067  RCL (i)      |   45  24
068  PSE          |   42  31
069  RTN          |   43  32
070  LBL 6        | 42,21, 6
071  RCL 1        |    45  1
072  STO I        |   44  25
073  CLx          |   43  35
074  SF 9         | 43, 4, 9
075  R/S          |       31
076  CF 9         | 43, 5, 9
077  STO (i)      |   44  24
078  RTN          |   43  32
079  LBL 7        | 42,21, 7
080  RCL 1        |    45  1
081  STO I        |   44  25
082  RCL (i)      |   45  24
083  TEST 0       | 43,30, 0
084  RTN          |   43  32
085  0            |        0
086  STO 2        |    44  2
087  CF 1         | 43, 5, 1
088  GTO 9        |    22  9
089  LBL 8        | 42,21, 8
090  RCL 1        |    45  1
091  STO I        |   44  25
092  RCL (i)      |   45  24
093  x=0          |   43  20
094  RTN          |   43  32
095  0            |        0
096  STO 2        |    44  2
097  SF 1         | 43, 4, 1
098  LBL 9        | 42,21, 9
099  GSB .0       |    32 .0
100  6            |        6
101  -            |       30
102  1            |        1
103  TEST 5       | 43,30, 5
104  STO+2        | 44,40, 2
105  GSB .0       |    32 .0
106  7            |        7
107  -            |       30
108  1            |        1
109  TEST 5       | 43,30, 5
110  STO-2        | 44,30, 2
111  RCL 2        |    45  2
112  x=0          |   43  20
113  RTN          |   43  32
114  1            |        1
115  F? 1         | 43, 6, 1
116  CHS          |       16
117  STO+0        | 44,40, 0
118  GTO 9        |    22  9
119  LBL .0       | 42,21,.0
120  RCL 0        |    45  0
121  F? 0         | 43, 6, 0
122  GTO E        |   22  15
123  STO I        |   44  25
124  RCL (i)      |   45  24
125  RTN          |   43  32
126  LBL E        | 42,21,15
127  1            |        1
128  0            |        0
129  /            |       10
130  STO I        |   44  25
131  FRAC         |   42  44
132  1            |        1
133  0            |        0
134  *            |       20
135  LSTx         |   43  36
136  x<>y         |       34
137  -            |       30
138  10^x         |       13
139  RCL (i)      |   45  24
140  x<>y         |       34
141  /            |       10
142  FRAC         |   42  44
143  1            |        1
144  0            |        0
145  *            |       20
146  INT          |   43  44
147  RTN          |   43  32
ecsfang
Posts: 51
Joined: Sun Jan 26, 2020 5:21 pm
Location: Lund/Sweden

Re: [DM15] [15C] Brainf█k Programming Language

Post by ecsfang »

Amazing ;)

I must try this on my 32sII, 35s or even the 48GX, I guess your DM15 is a "lot" faster than the original HP15C .. :lol:
Maybe go15c is a better option on my Android phone!

/Thomas
[35/45/55/65/67/97/21/25/29C/31E/33E/38E/41C|CV|CX/71B/10C/11C/15C/16C/32SII/42S/28S/48GX/49G/35S/DM41X(#00456)]
(7397)[134]
Post Reply