merge commit

This commit is contained in:
2025-06-17 23:50:16 +01:00
25 changed files with 5387 additions and 102 deletions
+5 -5
View File
@@ -1,13 +1,13 @@
include print "../resources/dsa/print.dsa"
// include print "../resources/dsa/print.dsa"
// Fibonacci sequence calculator in DSA assembly
// Calculates the first 8 Fibonacci numbers: 0, 1, 1, 2, 3, 5, 8, 13
dw fib_count: 6 // How many more numbers to calculate after F(0) and F(1)
init:
// Initialize the first two Fibonacci numbers
lli 0, rg0 // F(0) = 0
lli 1, rg1 // F(1) = 1
lli rg0, 0 // F(0) = 0
lli rg1, 1 // F(1) = 1
push rg0
// Load loop counter
ldw fib_count, zero, rg2 // Load number of iterations remaining
@@ -21,7 +21,7 @@ fibonacci_loop:
// Decrement loop counter
dec rg2 // rg2 = rg2 - 1
// Check if we should continue looping
cmp rg2, zero // Compare counter with 0
jgt fibonacci_loop // Jump back if counter > 0
+2 -2
View File
@@ -10,8 +10,8 @@ init:
start:
ldb length, rg0
lwi string, rg1
lwi display, rg2
lwi rg1, string
lwi rg2, display
loop:
// read from string and write to display