optimized hellorld
This commit is contained in:
@@ -241,7 +241,7 @@ representation:
|
||||
Examples
|
||||
--------
|
||||
The [examples](examples/) subdirectory contains several MU8A source code file
|
||||
examples for mu808 which are ports from the same 808UL example programs, namely:
|
||||
examples for mu808 which are ports of the same 808UL example programs, namely:
|
||||
|
||||
* [Compound interest calculator](examples/compound.mu8a),
|
||||
* [Linear regression calculator](examples/linreg.mu8a),
|
||||
@@ -342,6 +342,13 @@ of the operand locations to store the result. If you want to fully emulate the
|
||||
808UL's behavior, then you have to copy one of the operands into the target
|
||||
memory location first and then use it as the last parameter to the FMA command.
|
||||
|
||||
### Why is the "Hellorld!" example much shorter than in 808UL?
|
||||
|
||||
Because mu808 unifies the standard and port I/O, thus allowing to specify a
|
||||
range of memory locations to the port output routine as well. Since the example
|
||||
arranges all the message bytes in order, a single call to the output command
|
||||
will suffice.
|
||||
|
||||
Credits
|
||||
-------
|
||||
Created by Luxferre in 2025, released into public domain with no warranties.
|
||||
|
||||
@@ -8,12 +8,4 @@
|
||||
8 5 100 0 8
|
||||
9 5 33 0 9
|
||||
10 5 10 0 10
|
||||
11 5 1 0 50
|
||||
12 5 1 0 10
|
||||
13 5 10 0 11
|
||||
14 5 12 0 12
|
||||
15 6 2 10 12
|
||||
16 3 12 12 1
|
||||
17 8 11 50 11
|
||||
18 7 50 50 10
|
||||
19 1 1 11 14
|
||||
11 3 1 10 1
|
||||
|
||||
@@ -8,12 +8,4 @@ set 108 0 7
|
||||
set 100 0 8
|
||||
set 33 0 9
|
||||
set 10 0 10 ; end the string with an LF character for newline
|
||||
set 1 0 50 ; set the constant 1 to memory loc 50
|
||||
set 1 0 10 ; set the first address to 1 at loc 10
|
||||
set 10 0 11 ; set the counter variable to 10 at loc 11
|
||||
:lp set 12 0 12 ; prepare the loc 12 with its own address
|
||||
cpy 2 10 12 ; load the contents of the current address at loc 10 into loc 12
|
||||
out 12 12 1 ; output the character at the current address to port 1
|
||||
sub 11 50 11 ; decrement the counter at loc 11
|
||||
fma 50 50 10 ; increment the current address at loc 10
|
||||
jmp 1 11 :lp ; jump to the loop start if the counter is over zero
|
||||
out 1 10 1 ; output the range as ASCII to port 1
|
||||
|
||||
Reference in New Issue
Block a user