From 6d8cdae722f1cddabb5ff72f554d0d3e772c2cc1 Mon Sep 17 00:00:00 2001 From: cuz Date: Tue, 28 Oct 2003 08:47:47 +0000 Subject: [PATCH] Runtime function improvements by Piotr Fusik git-svn-id: svn://svn.cc65.org/cc65/trunk@2577 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- libsrc/runtime/asrax3.s | 25 ++++++++++++------------- libsrc/runtime/asrax4.s | 36 +++++++++++++++++------------------- libsrc/runtime/mulax10.s | 20 ++++++++++---------- libsrc/runtime/mulax6.s | 22 +++++++++++----------- libsrc/runtime/mulax7.s | 23 ++++++++++++----------- libsrc/runtime/mulax9.s | 30 +++++++++++++++--------------- libsrc/runtime/subysp.s | 20 +++++++++----------- 7 files changed, 86 insertions(+), 90 deletions(-) diff --git a/libsrc/runtime/asrax3.s b/libsrc/runtime/asrax3.s index e3286d431..ee3e9f091 100644 --- a/libsrc/runtime/asrax3.s +++ b/libsrc/runtime/asrax3.s @@ -1,5 +1,6 @@ ; -; Ullrich von Bassewitz, 06.08.1998 +; Piotr Fusik, 24.10.2003 +; originally by Ullrich von Bassewitz ; ; CC65 runtime: Scale the primary register by 8 ; @@ -8,17 +9,15 @@ .importzp tmp1 asrax3: stx tmp1 - cpx #$80 ; Put bit 7 into carry - ror tmp1 - ror a + cpx #$80 ; Put bit 7 into carry + ror tmp1 + ror a + cpx #$80 + ror tmp1 + ror a + cpx #$80 + ror tmp1 + ror a ldx tmp1 - cpx #$80 - ror tmp1 - ror a - ldx tmp1 - cpx #$80 - ror tmp1 - ror a - ldx tmp1 - rts + rts diff --git a/libsrc/runtime/asrax4.s b/libsrc/runtime/asrax4.s index 6365f3b39..61b6645b6 100644 --- a/libsrc/runtime/asrax4.s +++ b/libsrc/runtime/asrax4.s @@ -1,28 +1,26 @@ ; -; Ullrich von Bassewitz, 25.07.2001 +; Piotr Fusik, 24.10.2003 +; originally by Ullrich von Bassewitz ; ; CC65 runtime: Scale the primary register by 16 ; - .export asrax4 - .importzp tmp1 + .export asrax4 + .importzp tmp1 asrax4: stx tmp1 - cpx #$80 ; Put bit 7 into carry - ror tmp1 - ror a + cpx #$80 ; Put bit 7 into carry + ror tmp1 + ror a + cpx #$80 + ror tmp1 + ror a + cpx #$80 + ror tmp1 + ror a + cpx #$80 + ror tmp1 + ror a ldx tmp1 - cpx #$80 - ror tmp1 - ror a - ldx tmp1 - cpx #$80 - ror tmp1 - ror a - ldx tmp1 - cpx #$80 - ror tmp1 - ror a - ldx tmp1 - rts + rts diff --git a/libsrc/runtime/mulax10.s b/libsrc/runtime/mulax10.s index 18a17a450..3fe250c4a 100644 --- a/libsrc/runtime/mulax10.s +++ b/libsrc/runtime/mulax10.s @@ -1,15 +1,16 @@ ; -; Ullrich von Bassewitz, 04.10.2001 +; Piotr Fusik, 24.10.2003 +; originally by Ullrich von Bassewitz ; -; CC65 runtime: Multiply the primary register +; CC65 runtime: Multiply the primary register by 10 ; - .export mulax10 + .export mulax10 .importzp ptr1 .proc mulax10 - sta ptr1 + sta ptr1 stx ptr1+1 asl a rol ptr1+1 @@ -17,14 +18,13 @@ rol ptr1+1 clc adc ptr1 - pha + sta ptr1 txa adc ptr1+1 - sta ptr1+1 - pla - asl a - rol ptr1+1 - ldx ptr1+1 + asl ptr1 + rol a + tax + lda ptr1 rts .endproc diff --git a/libsrc/runtime/mulax6.s b/libsrc/runtime/mulax6.s index e5e350385..78aa85bda 100644 --- a/libsrc/runtime/mulax6.s +++ b/libsrc/runtime/mulax6.s @@ -1,28 +1,28 @@ ; -; Ullrich von Bassewitz, 16.03.2002 +; Piotr Fusik, 24.10.2003 +; originally by Ullrich von Bassewitz ; -; CC65 runtime: Multiply the primary register +; CC65 runtime: Multiply the primary register by 6 ; - .export mulax6 - .importzp ptr1 + .export mulax6 + .importzp ptr1 .proc mulax6 - sta ptr1 + sta ptr1 stx ptr1+1 asl a rol ptr1+1 clc adc ptr1 - pha + sta ptr1 txa adc ptr1+1 - sta ptr1+1 - pla - asl a - rol ptr1+1 - ldx ptr1+1 + asl ptr1 + rol a + tax + lda ptr1 rts .endproc diff --git a/libsrc/runtime/mulax7.s b/libsrc/runtime/mulax7.s index b7ce28cff..c9f7e4715 100644 --- a/libsrc/runtime/mulax7.s +++ b/libsrc/runtime/mulax7.s @@ -1,28 +1,29 @@ ; -; Ullrich von Bassewitz, 16.03.2002 +; Piotr Fusik, 24.10.2003 +; originally by Ullrich von Bassewitz ; -; CC65 runtime: Multiply the primary register +; CC65 runtime: Multiply the primary register by 7 ; - .export mulax7 - .importzp ptr1, tmp1 + .export mulax7 + .importzp ptr1 .proc mulax7 sta ptr1 stx ptr1+1 - stx tmp1 - asl a - rol tmp1 ; * 2 asl a - rol tmp1 ; * 4 + rol ptr1+1 ; * 2 asl a - rol tmp1 ; * 8 + rol ptr1+1 ; * 4 + asl a + rol ptr1+1 ; * 8 sec sbc ptr1 pha - lda tmp1 - sbc ptr1+1 ; * (8 - 1) + txa + eor #$ff + adc ptr1+1 ; * (8 - 1) tax pla rts diff --git a/libsrc/runtime/mulax9.s b/libsrc/runtime/mulax9.s index 037f5e76e..67a07b4d6 100644 --- a/libsrc/runtime/mulax9.s +++ b/libsrc/runtime/mulax9.s @@ -1,27 +1,27 @@ ; -; Ullrich von Bassewitz, 16.03.2002 +; Piotr Fusik, 24.10.2003 +; originally by Ullrich von Bassewitz ; -; CC65 runtime: Multiply the primary register +; CC65 runtime: Multiply the primary register by 9 ; - .export mulax9 - .importzp ptr1, tmp1 + .export mulax9 + .importzp ptr1 .proc mulax9 - sta ptr1 - stx ptr1+1 - stx tmp1 - asl a - rol tmp1 ; * 2 - asl a - rol tmp1 ; * 4 - asl a - rol tmp1 ; * 8 + sta ptr1 + stx ptr1+1 + asl a + rol ptr1+1 ; * 2 + asl a + rol ptr1+1 ; * 4 + asl a + rol ptr1+1 ; * 8 clc - adc ptr1 ; * (8+1) + adc ptr1 ; * (8+1) pha - lda tmp1 + txa adc ptr1+1 tax pla diff --git a/libsrc/runtime/subysp.s b/libsrc/runtime/subysp.s index e2bbd5fc6..9d1a2c691 100644 --- a/libsrc/runtime/subysp.s +++ b/libsrc/runtime/subysp.s @@ -1,26 +1,24 @@ ; -; Ullrich von Bassewitz, 25.10.2000 +; Piotr Fusik, 24.10.2003 +; originally by Ullrich von Bassewitz ; ; CC65 runtime: Decrement the stackpointer by value in y ; - .export subysp - .importzp sp, tmp1 + .export subysp + .importzp sp .proc subysp - sty tmp1 ; Save the value - lda sp ; Get lo byte + tya + eor #$ff sec - sbc tmp1 ; Subtract y value - sta sp ; Put result back + adc sp + sta sp bcs @L1 dec sp+1 -@L1: rts ; Done +@L1: rts .endproc - - - -- 2.39.5