Applied patch #2741451 and reorganized mod functions
[fw/sdcc] / device / lib / z80 / mod.s
index 763cf6ce6067e532923c85805e2dac76e56fe2e0..9d3b04808899b6171d7aa898da7d7b99ef654a43 100644 (file)
@@ -10,11 +10,9 @@ __moduchar_rrx_s::
 
         ;; Fall through
 __moduchar_rrx_hds::
-        ld      c,l
         call    __divu8
 
-        ld      l,e
-        ld      h,d
+        ex      de,hl
 
         ret
 
@@ -33,13 +31,9 @@ __moduint_rrx_s::
         ;; Fall through
 
 __moduint_rrx_hds::
-        ld      b,h
-        ld      c,l
-
         call    __divu16
 
-        ld      l,e
-        ld      h,d
+        ex      de,hl
 
         ret
 
@@ -50,17 +44,16 @@ __moduschar_rrx_s::
         ld      e,(hl)
         ld      d, #0
         dec     hl
-        ld      c,(hl)
+        ld      l,(hl)
 
-        ld      a,c             ; Sign extend
+        ld      a,l             ; Sign extend
         rlca
         sbc     a
-        ld      b,a
+        ld      h,a
 
         call    __div16
 
-        ld      l,e
-        ld      h,d
+        ex      de,hl
 
         ret