Cleared the top bytes for use in arrays.
[fw/sdcc] / device / lib / z80 / mul.s
index 92e0ceba34f13775946193b327f8f1ef5d7a4a5d..f0817aefdc99d8f3aab992c3d0ba4f1ab2db6e8e 100644 (file)
@@ -28,6 +28,21 @@ __mulschar_rr_hds::
         jp      .mul16
 
 __muluchar_rr_s::
+        ld      hl,#2
+        add     hl,sp
+
+        ld      e,(hl)
+
+        inc     hl
+        ld      c,(hl)                
+
+        ;; Clear the top
+        xor     a
+        ld      d,a
+        ld      b,a
+        
+        jp      .mulu16
+        
 __mulsint_rr_s::
 __muluint_rr_s::
         ld      hl,#2
@@ -49,7 +64,6 @@ __mulsint_rr_hds::
 __muluint_rr_hds::
        ;; Parameters:
        ;;      HL, DE (left, right irrelivent)
-       ;; Must preserve BC
        ld      b,h
        ld      c,l