From b4f547ecb600729e0e1b980c27c154b2a99bbca1 Mon Sep 17 00:00:00 2001
From: mrb0nk500 <b0nk@b0nk.xyz>
Date: Fri, 6 Dec 2019 11:21:12 -0500
Subject: Finally got multithreading support working!!

I have also added a program that computes the
Fibonacci sequence that I wrote in Sux assembly.
---
 test/fib.s            | 45 +++++++++++++++++++++++++++++++++++++++++++++
 test/test-the-tests.s | 25 +++++++++++++++++++++++--
 2 files changed, 68 insertions(+), 2 deletions(-)
 create mode 100644 test/fib.s

(limited to 'test')

diff --git a/test/fib.s b/test/fib.s
new file mode 100644
index 0000000..0d3ee03
--- /dev/null
+++ b/test/fib.s
@@ -0,0 +1,45 @@
+; Name: fib.s
+; Description: Computes the Fibbonacci sequence.
+;
+; Written in Sux Assembly
+; by mr b0nk 500 <b0nk@b0nk.xyz>
+
+
+cps		; Clear the Processor Status register.
+lda #$0		; Clear the accumulator.
+ldy #$1		; y=1.
+sty.q $1008	; Store y into memory.
+ldx #$0		; x=0.
+ldx.q $1000	; Output the value of x.
+adc.q $1008	; Add x with y.
+sta.q $1010	; z=x+y
+ldy.q $1008
+sty.q $1000	; x=y.
+sta.q $1008	; y=z.
+lda.q $1000
+bcs $1		; Start all over again, if the carry flag was set.
+jmp $D		; Otherwise, keep looping.
+
+.org $8000
+
+cps		; Clear the Processor Status register.
+lda #$0		; Clear the accumulator.
+ldy #$1		; y=1.
+sty.q $2008	; Store y into memory.
+ldx #$0		; x=0.
+ldx.q $2000	; Output the value of x.
+adc.q $2008	; Add x with y.
+sta.q $2010	; z=x+y
+ldy.q $2008
+sty.q $2000	; x=y.
+sta.q $2008	; y=z.
+lda.q $2000
+bcs $8001	; Start all over again, if the carry flag was set.
+jmp $800D	; Otherwise, keep looping.
+
+; Set up the thread vectors.
+.org $FF50
+.qword $8000
+; Execute the program.
+done
+
diff --git a/test/test-the-tests.s b/test/test-the-tests.s
index 47f7576..8471fab 100644
--- a/test/test-the-tests.s
+++ b/test/test-the-tests.s
@@ -1,5 +1,26 @@
+.org $0000
 cps
-inc
-jmp $1
+lda #$01
+lsl #$1
+bcs $13
+jmp $3
+lda.q #$8000000000000000
+lsr #$1
+bcs $1
+jmp $1D
+.org $8000
+cps
+lda #$01
+lsl #$1
+bcs $8013
+jmp $8003
+lda.q #$8000000000000000
+lsr #$1
+bcs $8001
+jmp $801D
+
+.org $FF50
+.qword $8000
+.org $0
 done
 
-- 
cgit v1.2.3-13-gbd6f