From 4ed07ca38b99abdca750c6612c512f30965f1714 Mon Sep 17 00:00:00 2001 From: mrb0nk500 Date: Sun, 30 Aug 2020 12:44:21 -0400 Subject: - Did some more work on SuBAsm's lexer. - Optimized the memory read, and write functions. - Made the emulator faster, and cleaner in general. --- test/fib.s | 48 +++++++++++++++++++++++------------------------- 1 file changed, 23 insertions(+), 25 deletions(-) (limited to 'test/fib.s') diff --git a/test/fib.s b/test/fib.s index dd8c618..65912ad 100644 --- a/test/fib.s +++ b/test/fib.s @@ -5,45 +5,44 @@ ; by mr b0nk 500 ; Variables for thread 0. -.org $1000 -x: - .qword $0 -y: - .qword $0 -z: - .qword $0 +.org 0 +x1: + .res 8 +y1: + .res 8 +z1: + .res 8 ; Variables for thread 1. -.org $2000 x2: - .qword $0 + .res 8 y2: - .qword $0 + .res 8 z2: - .qword $0 + .res 8 -.org $0 +.org $8000 init: cps ; Clear the Processor Status register. start: lda #$0 ; Clear the accumulator. ldy #$1 ; y=1. - sty.q y ; Store y into memory. + sty.q y1 ; Store y into memory. fib: ldx #$0 ; x=0. - ldx.q x ; Output the value of x. - adc.q y ; Add x with y. - sta.q z ; z=x+y - ldy.q y - sty.q x ; x=y. - sta.q y ; y=z. - lda.q x + ldx.q x1 ; Output the value of x. + adc.q y1 ; Add x with y. + sta.q z1 ; z=x+y + ldy.q y1 + sty.q x1 ; x=y. + sta.q y1 ; y=z. + lda.q x1 bcs start ; Start all over again, if the carry flag was set. - jmp fib ; Otherwise, keep looping. + bra fib ; Otherwise, keep looping. + -.org $8000 init2: cps ; Clear the Processor Status register. @@ -62,12 +61,11 @@ fib2: sta.q y2 ; y2=z2. lda.q x2 bcs start2 ; Start all over again, if the carry flag was set. - jmp fib2 ; Otherwise, keep looping. + bra fib2 ; Otherwise, keep looping. ; Set up the thread vectors. .org $FF50 .qword init2 ; Execute the program. a -done - +d -- cgit v1.2.3-13-gbd6f