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-new.s | 45 ++++++++++++++++++++++----------------------- 1 file changed, 22 insertions(+), 23 deletions(-) (limited to 'test/fib-new.s') diff --git a/test/fib-new.s b/test/fib-new.s index 5a8ae83..6b0b717 100644 --- a/test/fib-new.s +++ b/test/fib-new.s @@ -5,21 +5,21 @@ ; by mr b0nk 500 ; Variables for thread 0. -.org $0 -x: - .byte $0 -y: - .byte $0 -z: - .byte $0 +.org 0 +x1: + .res 1 +y1: + .res 1 +z1: + .res 1 ; Variables for thread 1. x2: - .byte $0 + .res 1 y2: - .byte $0 + .res 1 z2: - .byte $0 + .res 1 .org $1000 init: @@ -27,21 +27,21 @@ init: start: lda #$0 ; Clear the accumulator. ldy #$1 ; y=1. - sty y ; Store y into memory. + sty y1 ; Store y into memory. fib: ldx #$0 ; x=0. - ldx x ; Output the value of x. - adc y ; Add x with y. - sta z ; z=x+y - ldy y - sty x ; x=y. - sta y ; y=z. - lda x + ldx x1 ; Output the value of x. + adc y1 ; Add x with y. + sta z1 ; z=x+y + ldy y1 + sty x1 ; x=y. + sta y1 ; y=z. + lda x1 bcs start ; Start all over again, if the carry flag was set. - jmp fib ; Otherwise, keep looping. + bra fib ; Otherwise, keep looping. + -.org $2000 init2: cps ; Clear the Processor Status register. start2: @@ -59,7 +59,7 @@ fib2: sta y2 ; y2=z2. lda x2 bcs start2 ; Start all over again, if the carry flag was set. - jmp fib2 ; Otherwise, keep looping. + bra fib2 ; Otherwise, keep looping. .org $FFC0 .qword init @@ -68,5 +68,4 @@ fib2: .qword init2 ; Execute the program. a -done - +d -- cgit v1.2.3-13-gbd6f