updated the compound interest example

This commit is contained in:
Luxferre
2025-04-30 11:23:16 +03:00
parent a35163c433
commit e2c881cd2e
3 changed files with 18 additions and 21 deletions
+7 -8
View File
@@ -416,14 +416,13 @@ calculator from the official mu808 examples will transform into:
5000 DATA 0,0
5001 DATA 50100,1
5002 DATA 40002,30000
5003 DATA 90002,10004
5004 DATA 50001,5
5005 DATA 70005,40005
5006 DATA 130001,50005
5007 DATA 70000,30005
5008 DATA 130000,50005
5009 DATA 30005,50000
5010 DATA -1,0
5003 DATA 90002,10005
5004 DATA 70127,1270005
5005 DATA 130001,50005
5006 DATA 70000,30005
5007 DATA 130000,50005
5008 DATA 30005,50000
5009 DATA -1,0
```
To make the conversion easier, the official mu808 assembler, `mu808asm.py`, now
supports the `t74` mode that accepts a plain MU8 machine code file and outputs
+6 -7
View File
@@ -1,9 +1,8 @@
1 5 100 0 1
2 4 2 3 0
3 9 2 1 4
4 5 1 0 5
5 7 5 4 5
6 13 1 5 5
7 7 0 3 5
8 13 0 5 5
9 3 5 5 0
3 9 2 1 5
4 7 127 127 5
5 13 1 5 5
6 7 0 3 5
7 13 0 5 5
8 3 5 5 0
+5 -6
View File
@@ -4,10 +4,9 @@
set 100 0 1 ; store the constant 100 at loc 1
inp 2 3 0 ; prompt for the percentage into loc 2 and the period into loc 3
div 2 1 4 ; divide the percentage value at loc 2 by the constant at loc 1 into loc 4
set 1 0 5 ; set the loc 5 to 1
fma 5 4 5 ; add the constant at loc 5 to the value at loc 4 into loc 5
nel 1 5 5 ; replace loc 5 with its ln
fma 0 3 5 ; replace loc 5 with loc 3 * ln loc 5
nel 0 5 5 ; replace loc 4 with its nexp
div 2 1 5 ; divide the percentage value at loc 2 by the constant at loc 1 into loc 5
inc 5 ; increment loc 5
log 5 5 ; replace loc 5 with its ln
mul 3 5 ; replace loc 5 with loc 3 * ln loc 5
exp 5 5 ; replace loc 5 with its nexp
out 5 5 0 ; output the resulting value