From b4f547ecb600729e0e1b980c27c154b2a99bbca1 Mon Sep 17 00:00:00 2001 From: mrb0nk500 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 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 test/fib.s (limited to 'test/fib.s') 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 + + +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 + -- cgit v1.2.3-13-gbd6f