From 3dfde833082fc66cededd0206ae5fc76162867b6 Mon Sep 17 00:00:00 2001 From: mrb0nk500 Date: Sun, 8 Dec 2019 20:45:55 -0500 Subject: Added support for resolving fixup labels. AKA, referencing a label before it has been declared yet. --- test/fib.s | 68 +++++++++++++++++++++++++++++++------------------------------- 1 file changed, 34 insertions(+), 34 deletions(-) (limited to 'test/fib.s') diff --git a/test/fib.s b/test/fib.s index 9188a3c..40489ec 100644 --- a/test/fib.s +++ b/test/fib.s @@ -7,62 +7,62 @@ ; Variables for thread 0. .org $1000 x: -.qword $0 + .qword $0 y: -.qword $0 + .qword $0 z: -.qword $0 + .qword $0 ; Variables for thread 1. .org $2000 x2: -.qword $0 + .qword $0 y2: -.qword $0 + .qword $0 z2: -.qword $0 + .qword $0 .org $0 init: -cps ; Clear the Processor Status register. + cps ; Clear the Processor Status register. start: -lda #$0 ; Clear the accumulator. -ldy #$1 ; y=1. -sty.q y ; Store y into memory. + lda #$0 ; Clear the accumulator. + ldy #$1 ; y=1. + sty.q y ; 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 -bcs start ; Start all over again, if the carry flag was set. -jmp fib ; Otherwise, keep looping. + 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 + bcs start ; Start all over again, if the carry flag was set. + jmp fib ; Otherwise, keep looping. .org $8000 init2: -cps ; Clear the Processor Status register. + cps ; Clear the Processor Status register. start2: -lda #$0 ; Clear the accumulator. -ldy #$1 ; y2=1. -sty.q y2 ; Store y into memory. + lda #$0 ; Clear the accumulator. + ldy #$1 ; y2=1. + sty.q y2 ; Store y into memory. fib2: -ldx #$0 ; x2=0. -ldx.q x2 ; Output the value of x2. -adc.q y2 ; Add x2 with y2. -sta.q z2 ; z2=x2+y2 -ldy.q y2 -sty.q x2 ; x2=y2. -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. + ldx #$0 ; x2=0. + ldx.q x2 ; Output the value of x2. + adc.q y2 ; Add x2 with y2. + sta.q z2 ; z2=x2+y2 + ldy.q y2 + sty.q x2 ; x2=y2. + 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. ; Set up the thread vectors. .org $FF50 -- cgit v1.2.3-13-gbd6f