Minor improvements, code cleanup and license clarification
authorspth <spth@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Fri, 3 Apr 2009 10:41:30 +0000 (10:41 +0000)
committerspth <spth@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Fri, 3 Apr 2009 10:41:30 +0000 (10:41 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@5423 4a8a32a2-be11-0410-ad9d-d568d2c75423

ChangeLog
device/lib/z80/memmove.s
device/lib/z80/mul.s
device/lib/z80/strlen.s

index 9805da8f485cd603854b66e2cf55d86597bff632..94693ba9e87c4c2fded68b2638eddd859b6e0ed3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2009-04-03 Philipp Klaus Krause <pkk AT spth.de>
+
+       * device/lib/z80/mul.s,
+         device/lib/z80/memmove.s,
+         device/lib/z80/strlen.s:
+         Minor improvements, code cleanup and license clarification.
+
 2009-04-01 Philipp Klaus Krause <pkk AT spth.de>
 
        * device/lib/z80/mul.s: 
index 76d21a2ccede241ebc57ef7d6c12bca906f53633..273a1eb55536e489c2281c5d9a89f7162997bb32 100644 (file)
@@ -1,3 +1,31 @@
+; Copyright (C) 2008-2009
+; Philipp Klaus Krause
+
+; This file is part of the sdcc Library.  This library is free
+; software; you can redistribute it and/or modify it under the
+; terms of the GNU General Public License as published by the
+; Free Software Foundation; either version 2, or (at your option)
+; any later version.
+
+; This library is distributed in the hope that it will be useful,
+; but WITHOUT ANY WARRANTY; without even the implied warranty of
+; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+; GNU General Public License for more details.
+
+; You should have received a copy of the GNU General Public License along
+; with this library; see the file COPYING.  If not, write to the Free
+; Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+; USA.
+
+; As a special exception, you may use this file as part of a free software
+; library without restriction.  Specifically, if other files instantiate
+; templates or use macros or inline functions from this file, or you compile
+; this file and link it with other files to produce an executable, this
+; file does not by itself cause the resulting executable to be covered by
+; the GNU General Public License.  This exception does not however
+; invalidate any other reasons why the executable file might be covered by
+; the GNU General Public License.
+
         .area   _CODE
 
        .globl _memmove
index cba10dfe93ce6edd1fadc4b591e91c68f99ac60e..61ff5cf34179e99e6ab25d8ac8c2726725d46555 100644 (file)
@@ -18,30 +18,29 @@ __mulint_rrx_s::
 __muluchar_rrx_hds::
 __mulint_rrx_hds::
        ;; Parameters:
-       ;;      HL, DE (left, right irrelevant)
+       ;;      hl, de (left, right irrelevant)
        ld      b,h
        ld      c,l
 
        ;; 16-bit multiplication
        ;;
        ;; Entry conditions
-       ;;   BC = multiplicand
-       ;;   DE = multiplier
+       ;; bc = multiplicand
+       ;; de = multiplier
        ;;
        ;; Exit conditions
-       ;;   DE = less significant word of product
+       ;; hl = less significant word of product
        ;;
        ;; Register used: AF,BC,DE,HL
 __mul16::
-        ld      l,#0
-        ld      a,b
-        ld      b,#16
+       xor     a,a
+       ld      l,a
+       or      a,b
+       ld      b,#16
 
         ;; Optimise for the case when this side has 8 bits of data or
         ;; less.  This is often the case with support address calls.
-        or      a
         jr      NZ,2$
-
         ld      b,#8
         ld      a,c
 1$:
index 2eccf70d695caf87b016c6d69f06f526e55f683b..583a27add171af4f6e61ad7427f1f2ca420806eb 100644 (file)
@@ -1,3 +1,31 @@
+; Copyright (C) 2008-2009
+; Philipp Klaus Krause
+
+; This file is part of the sdcc Library.  This library is free
+; software; you can redistribute it and/or modify it under the
+; terms of the GNU General Public License as published by the
+; Free Software Foundation; either version 2, or (at your option)
+; any later version.
+
+; This library is distributed in the hope that it will be useful,
+; but WITHOUT ANY WARRANTY; without even the implied warranty of
+; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+; GNU General Public License for more details.
+
+; You should have received a copy of the GNU General Public License along
+; with this library; see the file COPYING.  If not, write to the Free
+; Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+; USA.
+
+; As a special exception, you may use this file as part of a free software
+; library without restriction.  Specifically, if other files instantiate
+; templates or use macros or inline functions from this file, or you compile
+; this file and link it with other files to produce an executable, this
+; file does not by itself cause the resulting executable to be covered by
+; the GNU General Public License.  This exception does not however
+; invalidate any other reasons why the executable file might be covered by
+; the GNU General Public License.
+
         .area   _CODE
 
        .globl _strlen
 ; The Z80 has the cpir instruction, which is perfect for implementing strlen().
 
 _strlen:
-       push    ix
-       ld      ix, #0
-       add     ix, sp
-       ld      l, 4(ix)
-       ld      h, 5(ix)
+       pop     bc
+       pop     hl
+       push    hl
+       push    bc
        xor     a, a
        ld      b, a
        ld      c, a
        cpir
        ld      hl, #-1
        sbc     hl, bc  ; C flag still cleared from xor above.
-       pop     ix
        ret