From 0a7a2a7a8f95730811117bd2aa904f1843f65071 Mon Sep 17 00:00:00 2001 From: mrb0nk500 Date: Fri, 17 Apr 2020 22:07:14 -0400 Subject: Made both the assembly language monitor, and the emulator smaller, and faster. I am also starting to make SuBEditor's source code more readable. --- test/fib2.s | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) (limited to 'test/fib2.s') diff --git a/test/fib2.s b/test/fib2.s index d8c0d42..59830a2 100644 --- a/test/fib2.s +++ b/test/fib2.s @@ -1,26 +1,33 @@ ; Variables for thread 0. .org $1000 x: - .qword $0 + .qword 0 y: - .qword $1 + .qword 1 z: - .qword $0 + .qword 0 +zero: + .qword 0 -.org $0 +.org 0 init: cps ; Clear the Processor Status register. - start: - lda #0 ; Clear the accumulator. - ldb.q y ; b=1. + lsr #63 ; Reset the accumulator. + tab ; + tax ; + tay ; + inb ; + clc ; fib: - aab ; Add x with y. - ldb.q y - stb.q x ; x=y. - sta.q y ; y=z. - tab - lda.q x - bcs start ; Start all over again, if the carry flag was set. - jmp fib ; Otherwise, keep looping. + tya ; + aab ; Add x with y. But did we also carry over? + bcs start ; Yes, so restart. + tax ; + tya ; + tab ; + txa ; + tay ; + jmp fib ; No, so keep looping. +a done -- cgit v1.2.3-13-gbd6f