* device/lib/gbz80/asm_strings.s,
authorMaartenBrock <MaartenBrock@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Tue, 8 Aug 2006 19:20:11 +0000 (19:20 +0000)
committerMaartenBrock <MaartenBrock@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Tue, 8 Aug 2006 19:20:11 +0000 (19:20 +0000)
* device/lib/gbz80/crt0_rle.s,
* device/lib/gbz80/div.s,
* device/lib/gbz80/mul.s,
* device/lib/gbz80/shift.s,
* device/lib/z80/asm_strings.s,
* device/lib/z80/crt0_rle.s,
* device/lib/z80/div.s,
* device/lib/z80/mul.s,
* device/lib/z80/shift.s: changed to all lower case menmonics except the
  flags which are all upper case

git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@4325 4a8a32a2-be11-0410-ad9d-d568d2c75423

ChangeLog
device/lib/gbz80/asm_strings.s
device/lib/gbz80/crt0_rle.s
device/lib/gbz80/div.s
device/lib/gbz80/mul.s
device/lib/gbz80/shift.s
device/lib/z80/asm_strings.s
device/lib/z80/crt0_rle.s
device/lib/z80/div.s
device/lib/z80/mul.s
device/lib/z80/shift.s

index 37ca3511e5316785bab3dfec0ba20a99cd9ca9b7..b4f927259f170ae2cbc4d1c1538a6150fa0ee593 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2006-08-08 Maarten Brock <sourceforge.brock AT dse.nl>
+
+       * device/lib/gbz80/asm_strings.s,
+       * device/lib/gbz80/crt0_rle.s,
+       * device/lib/gbz80/div.s,
+       * device/lib/gbz80/mul.s,
+       * device/lib/gbz80/shift.s,
+       * device/lib/z80/asm_strings.s,
+       * device/lib/z80/crt0_rle.s,
+       * device/lib/z80/div.s,
+       * device/lib/z80/mul.s,
+       * device/lib/z80/shift.s: changed to all lower case menmonics except the
+         flags which are all upper case
+
 2006-08-07 Maarten Brock <sourceforge.brock AT dse.nl>
 
        * as/z80/asm.h: made CASE_SENSITIVE 1
index 1d9f324140a2968a945cf5681db9dd3d968dea3a..6fceac208f3035f06e60b0f50315267671846aba 100644 (file)
@@ -15,12 +15,12 @@ _strcpy::
        ld      l,a
 
        push    de
-1$:    
+1$:
        ld      a,(hl+)
        ld      (de),a
        inc     de
        or      a,a
-       jr      nz,1$
+       jr      NZ,1$
 
        pop     de
        ret
@@ -52,15 +52,15 @@ _memcpy::
        inc     de
 2$:
        dec     c
-       jr      nz,1$
+       jr      NZ,1$
        dec     b
-       jr      nz,1$   
+       jr      NZ,1$
 
        pop     de
        pop     bc
        ret
 
-; int strcmp(const char *s1, const char *s2) 
+; int strcmp(const char *s1, const char *s2)
 _strcmp::
        lda     hl,2(sp)
        ld      e,(hl)
@@ -72,14 +72,14 @@ _strcmp::
        ld      l,a
 
        jr      1$
-2$:    
+2$:
        ld      a,(de)
        sub     (hl)
-       jr      nz,4$
+       jr      NZ,4$
        ;; A == 0
        cp      (hl)
-       jr      z,3$
-1$:    
+       jr      Z,3$
+1$:
        inc     de
        inc     hl
        jr      2$
@@ -93,4 +93,3 @@ _strcmp::
        ld      de,#-1
 5$:
        ret
-       
\ No newline at end of file
index d5778142da081f3a0b1d616b3e84c19de922f25c..e7deb7d9db439f4cec19988ac7aa3ee1399f580d 100644 (file)
@@ -1,11 +1,11 @@
         .area   _CODE
-        
+
         ;; Special RLE decoder used for initing global data
 __initrleblock::
         ;; Pull the destination address out
         ld      c,l
         ld      b,h
-        
+
         ;; Pop the return address
         pop     hl
 1$:
@@ -14,7 +14,7 @@ __initrleblock::
         inc     hl
         ;; Negative means a run
         bit     7,e
-        jp      z,2$
+        jp      Z,2$
         ;; Code for expanding a run
         ld      a,(hl)
         inc     hl
@@ -22,23 +22,23 @@ __initrleblock::
         ld      (bc),a
         inc     bc
         inc     e
-        jp      nz,3$
+        jp      NZ,3$
         jp      1$
 2$:
         ;; Zero means end of a block
         xor     a
         or      e
-        jp      z,4$
+        jp      Z,4$
         ;; Code for expanding a block
-5$:     
-        ld      a,(hl)        
+5$:
+        ld      a,(hl)
         inc     hl
         ld      (bc),a
         inc     bc
         dec     e
-        jp      nz,5$
+        jp      NZ,5$
         jp      1$
-4$:     
+4$:
         ;; Push the return address back onto the stack
         push    hl
         ret
index 2c5f4bdf5390d646d5d07362c35d655403679a44..eb3cedb7b5c8b411716522adb64459dfca7d2b68 100644 (file)
@@ -1,33 +1,33 @@
        ;; Originally from GBDK by Pascal Felber.
        .area   _CODE
 
-__divschar_rrx_s::       
+__divschar_rrx_s::
         ld      hl,#2+1
         add     hl,sp
-        
+
         ld      e,(hl)
         dec     hl
         ld      l,(hl)
-        
+
         ;; Fall through
 __divschar_rrx_hds::
         ld      c,l
-        
+
         call    .div8
 
        ld      e,c
         ld      d,b
-               
+
        ret
-       
-__modschar_rrx_s::       
+
+__modschar_rrx_s::
         ld      hl,#2+1
         add     hl,sp
-        
+
         ld      e,(hl)
         dec     hl
         ld      l,(hl)
-        
+
         ;; Fall through
 __modschar_rrx_hds::
         ld      c,l
@@ -35,13 +35,13 @@ __modschar_rrx_hds::
                call    .div8
 
         ;; Already in DE
-        
+
        ret
 
-__divsint_rrx_s::        
+__divsint_rrx_s::
         ld      hl,#2+3
         add     hl,sp
-        
+
         ld      d,(hl)
         dec     hl
         ld      e,(hl)
@@ -50,7 +50,7 @@ __divsint_rrx_s::
         dec     hl
         ld      l,(hl)
         ld      h,a
-        
+
         ;; Fall through
 __divsint_rrx_hds::
        ld      b,h
@@ -60,13 +60,13 @@ __divsint_rrx_hds::
 
        ld      e,c
        ld      d,b
-       
+
        ret
-       
+
 __modsint_rrx_s::
         ld      hl,#2+3
         add     hl,sp
-        
+
         ld      d,(hl)
         dec     hl
         ld      e,(hl)
@@ -84,18 +84,18 @@ __modsint_rrx_hds::
        call    .div16
 
         ;; Already in DE
-       
+
        ret
 
        ;; Unsigned
-__divuchar_rrx_s::       
+__divuchar_rrx_s::
         ld      hl,#2+1
         add     hl,sp
-        
+
         ld      e,(hl)
         dec     hl
         ld      l,(hl)
-        
+
         ;; Fall through
 __divuchar_rrx_hds::
         ld      c,l
@@ -103,17 +103,17 @@ __divuchar_rrx_hds::
 
        ld      e,c
         ld      d,b
-        
+
        ret
-       
-__moduchar_rrx_s::       
+
+__moduchar_rrx_s::
         ld      hl,#2+1
         add     hl,sp
-        
+
         ld      e,(hl)
         dec     hl
         ld      l,(hl)
-        
+
         ;; Fall through
 __moduchar_rrx_hds::
         ld      c,l
@@ -123,10 +123,10 @@ __moduchar_rrx_hds::
 
         ret
 
-__divuint_rrx_s::                
+__divuint_rrx_s::
         ld      hl,#2+3
         add     hl,sp
-        
+
         ld      d,(hl)
         dec     hl
         ld      e,(hl)
@@ -144,13 +144,13 @@ __divuint_rrx_hds::
 
        ld      e,c
        ld      d,b
-       
+
        ret
-       
-__moduint_rrx_s::                
+
+__moduint_rrx_s::
         ld      hl,#2+3
         add     hl,sp
-        
+
         ld      d,(hl)
         dec     hl
         ld      e,(hl)
@@ -160,7 +160,7 @@ __moduint_rrx_s::
         ld      l,(hl)
         ld      h,a
         ;; Fall through
-        
+
 __moduint_rrx_hds::
        ld      b,h
        ld      c,l
@@ -168,28 +168,28 @@ __moduint_rrx_hds::
        call    .divu16
 
         ;; Already in DE
-       
+
        ret
-       
+
 .div8::
 .mod8::
-       LD      A,C             ; Sign extend
-       RLCA
-       SBC     A
-       LD      B,A
-       LD      A,E             ; Sign extend
-       RLCA
-       SBC     A
-       LD      D,A
+       ld      a,c             ; Sign extend
+       rlca
+       sbc     a
+       ld      b,a
+       ld      a,e             ; Sign extend
+       rlca
+       sbc     a
+       ld      d,a
 
        ; Fall through to .div16
-       
+
        ;; 16-bit division
-       ;; 
+       ;;
        ;; Entry conditions
        ;;   BC = dividend
        ;;   DE = divisor
-       ;; 
+       ;;
        ;; Exit conditions
        ;;   BC = quotient
        ;;   DE = remainder
@@ -203,79 +203,79 @@ __moduint_rrx_hds::
        ;;  and divisor. Quotient is positive if signs are the same, negative
        ;;  if signs are different
        ;; Remainder has same sign as dividend
-       LD      A,B             ; Get high byte of dividend
-       LD      (.srem),A       ; Save as sign of remainder
-       XOR     D               ; Xor with high byte of divisor
-       LD      (.squot),A      ; Save sign of quotient
+       ld      a,b             ; Get high byte of dividend
+       ld      (.srem),a       ; Save as sign of remainder
+       xor     d               ; Xor with high byte of divisor
+       ld      (.squot),a      ; Save sign of quotient
        ;; Take absolute value of divisor
-       BIT     7,D
-       JR      Z,.chkde        ; Jump if divisor is positive
-       SUB     A               ; Substract divisor from 0
-       SUB     E
-       LD      E,A
-       SBC     A               ; Propagate borrow (A=0xFF if borrow)
-       SUB     D
-       LD      D,A
+       bit     7,d
+       jr      Z,.chkde        ; Jump if divisor is positive
+       sub     a               ; Substract divisor from 0
+       sub     e
+       ld      e,a
+       sbc     a               ; Propagate borrow (A=0xFF if borrow)
+       sub     d
+       ld      d,a
        ;; Take absolute value of dividend
 .chkde:
-       BIT     7,B
-       JR      Z,.dodiv        ; Jump if dividend is positive
-       SUB     A               ; Substract dividend from 0
-       SUB     C
-       LD      C,A
-       SBC     A               ; Propagate borrow (A=0xFF if borrow)
-       SUB     B
-       LD      B,A
+       bit     7,b
+       jr      Z,.dodiv        ; Jump if dividend is positive
+       sub     a               ; Substract dividend from 0
+       sub     c
+       ld      c,a
+       sbc     a               ; Propagate borrow (A=0xFF if borrow)
+       sub     b
+       ld      b,a
        ;; Divide absolute values
 .dodiv:
-       CALL    .divu16
-       RET     C               ; Exit if divide by zero
+       call    .divu16
+       ret     C               ; Exit if divide by zero
        ;; Negate quotient if it is negative
-       LD      A,(.squot)
-       AND     #0x80
-       JR      Z,.dorem        ; Jump if quotient is positive
-       SUB     A               ; Substract quotient from 0
-       SUB     C
-       LD      C,A
-       SBC     A               ; Propagate borrow (A=0xFF if borrow)
-       SUB     B
-       LD      B,A
+       ld      a,(.squot)
+       and     #0x80
+       jr      Z,.dorem        ; Jump if quotient is positive
+       sub     a               ; Substract quotient from 0
+       sub     c
+       ld      c,a
+       sbc     a               ; Propagate borrow (A=0xFF if borrow)
+       sub     b
+       ld      b,a
 .dorem:
        ;; Negate remainder if it is negative
-       LD      A,(.srem)
-       AND     #0x80
-       RET     Z               ; Return if remainder is positive
-       SUB     A               ; Substract remainder from 0
-       SUB     E
-       LD      E,A
-       SBC     A               ; Propagate remainder (A=0xFF if borrow)
-       SUB     D
-       LD      D,A
-       RET
+       ld      a,(.srem)
+       and     #0x80
+       ret     Z               ; Return if remainder is positive
+       sub     a               ; Substract remainder from 0
+       sub     e
+       ld      e,a
+       sbc     a               ; Propagate remainder (A=0xFF if borrow)
+       sub     d
+       ld      d,a
+       ret
 
 .divu8::
 .modu8::
-       LD      B,#0x00
-       LD      D,B
+       ld      b,#0x00
+       ld      d,b
        ; Fall through to divu16
 
 .divu16::
 .modu16::
        ;; Check for division by zero
-       LD      A,E
-       OR      D
-       JR      NZ,.divide      ; Branch if divisor is non-zero
-       LD      BC,#0x00        ; Divide by zero error
-       LD      D,B
-       LD      E,C
-       SCF                     ; Set carry, invalid result
-       RET
+       ld      a,e
+       or      d
+       jr      NZ,.divide      ; Branch if divisor is non-zero
+       ld      bc,#0x00        ; Divide by zero error
+       ld      d,b
+       ld      e,c
+       scf                     ; Set carry, invalid result
+       ret
 .divide:
-       LD      L,C             ; L = low byte of dividend/quotient
-       LD      H,B             ; H = high byte of dividend/quotient
-       LD      BC,#0x00        ; BC = remainder
-       OR      A               ; Clear carry to start
-       LD      A,#16           ; 16 bits in dividend
+       ld      l,c             ; L = low byte of dividend/quotient
+       ld      h,b             ; H = high byte of dividend/quotient
+       ld      bc,#0x00        ; BC = remainder
+       or      a               ; Clear carry to start
+       ld      a,#16           ; 16 bits in dividend
 .dvloop:
        ;; Shift next bit of quotient into bit 0 of dividend
        ;; Shift next MSB of dividend into LSB of remainder
@@ -284,42 +284,42 @@ __moduint_rrx_hds::
        ;; HL holds remainder
        ;; Do a 32-bit left shift, shifting carry to L, L to H,
        ;;  H to C, C to B
-       LD      (.dcnt),A
-       RL      L               ; Carry (next bit of quotient) to bit 0
-       RL      H               ; Shift remaining bytes
-       RL      C
-       RL      B               ; Clears carry since BC was 0
+       ld      (.dcnt),a
+       rl      l               ; Carry (next bit of quotient) to bit 0
+       rl      h               ; Shift remaining bytes
+       rl      c
+       rl      b               ; Clears carry since BC was 0
        ;; If remainder is >= divisor, next bit of quotient is 1. This
        ;;  bit goes to carry
-       PUSH    BC              ; Save current remainder
-       LD      A,C             ; Substract divisor from remainder
-       SBC     E
-       LD      C,A
-       LD      A,B
-       SBC     D
-       LD      B,A
-       CCF                     ; Complement borrow so 1 indicates a
+       push    bc              ; Save current remainder
+       ld      a,c             ; Substract divisor from remainder
+       sbc     e
+       ld      c,a
+       ld      a,b
+       sbc     d
+       ld      b,a
+       ccf                     ; Complement borrow so 1 indicates a
                                ;  successful substraction (this is the
                                ;  next bit of quotient)
-       JR      C,.drop         ; Jump if remainder is >= dividend
-       POP     BC              ; Otherwise, restore remainder
-       JR      .nodrop
+       jr      C,.drop         ; Jump if remainder is >= dividend
+       pop     bc              ; Otherwise, restore remainder
+       jr      .nodrop
 .drop:
-       INC     SP
-       INC     SP
+       inc     sp
+       inc     sp
 .nodrop:
-       LD      A,(.dcnt)
-       DEC     A               ; DEC does not affect carry flag
-       JR      NZ,.dvloop
+       ld      a,(.dcnt)
+       dec     a               ; DEC does not affect carry flag
+       jr      NZ,.dvloop
        ;; Shift last carry bit into quotient
-       LD      D,B             ; DE = remainder
-       LD      E,C
-       RL      L               ; Carry to L
-       LD      C,L             ; C = low byte of quotient
-       RL      H
-       LD      B,H             ; B = high byte of quotient
-       OR      A               ; Clear carry, valid result
-       RET
+       ld      d,b             ; DE = remainder
+       ld      e,c
+       rl      l               ; Carry to L
+       ld      c,l             ; C = low byte of quotient
+       rl      h
+       ld      b,h             ; B = high byte of quotient
+       or      a               ; Clear carry, valid result
+       ret
 
        .area   _BSS
 
index 69484a175b9fa3097a90751051fc2731436f0927..3fed7062e25e381715736f9d72f4099b2db93628 100644 (file)
@@ -1,5 +1,5 @@
        ;; Originally from GBDK by Pascal Felber.
-       
+
        .area   _CODE
 
 __mulschar_rrx_s::
@@ -8,13 +8,13 @@ __mulschar_rrx_s::
 
         ld      e,(hl)
         inc     hl
-        ld      l,(hl)                
+        ld      l,(hl)
 
         ;; Fall through
 __mulschar_rrx_hds::
         ;; Need to sign extend before going in.
         ld      c,l
-        
+
         ld      a,l
         rla
         sbc     a,a
@@ -34,13 +34,13 @@ __muluchar_rrx_s::
         ld      e,(hl)
 
         inc     hl
-        ld      c,(hl)                
+        ld      c,(hl)
 
         ;; Clear the top
         xor     a
         ld      d,a
         ld      b,a
-        
+
         jp      .mul16
 
 __mulint_rrx_s::
@@ -84,7 +84,7 @@ __mulint_rrx_hds::
         ;; 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
-        jp      nz,1$
+        jp      NZ,1$
 
         ld      b,#8
         ld      a,c
@@ -94,11 +94,11 @@ __mulint_rrx_hds::
         add     hl,hl
         rl      c
         rla                     ;DLE 27/11/98
-        jr      nc,2$
+        jr      NZ,2$
         add     hl,de
 2$:
         dec     b
-        jr      nz,1$
+        jr      NZ,1$
 
         ;; Return in DE
         ld      e,l
index b6f012e4055e4ace29145e7cde6a6037bb82e616..ab1110883472c68c1fabd9f25c7aa7cf69042945 100644 (file)
@@ -1,5 +1,5 @@
         ;;
-__rrulong_rrx_s::                
+__rrulong_rrx_s::
         ld      hl,#2
         add     hl,sp
 
@@ -17,7 +17,7 @@ __rrulong_rrx_s::
         ld      h,b
 1$:
         or      a,a
-        ret     z
+        ret     Z
 
         rr      h
         rr      l
@@ -27,10 +27,10 @@ __rrulong_rrx_s::
         dec     a
         jp      1$
 
-__rrslong_rrx_s::        
+__rrslong_rrx_s::
         ld      hl,#2
         add     hl,sp
-                
+
         ld      e,(hl)
         inc     hl
         ld      d,(hl)
@@ -45,7 +45,7 @@ __rrslong_rrx_s::
         ld      h,b
 1$:
         or      a,a
-        ret     z
+        ret     Z
 
         sra     h
         rr      l
@@ -54,12 +54,12 @@ __rrslong_rrx_s::
 
         dec     a
         jp      1$
-        
-__rlslong_rrx_s::                
-__rlulong_rrx_s::                
+__rlslong_rrx_s::
+__rlulong_rrx_s::
         ld      hl,#2
         add     hl,sp
-        
+
         ld      e,(hl)
         inc     hl
         ld      d,(hl)
@@ -74,12 +74,12 @@ __rlulong_rrx_s::
         ld      h,b
 1$:
         or      a,a
-        ret     z
+        ret     Z
 
         rl      e
         rl      d
         rl      l
         rl      h
 
-        dec     a        
+        dec     a
         jp      1$
index 1796b4a57017f580289701ea007a989c4517baae..177d523bbdcebeca249ccd15b3b4f031d005d230 100644 (file)
@@ -29,7 +29,7 @@ __strcpy_rrx_s::
         ld      a,(bc)
         ld      (de),a
         or      a
-        jp      nz,1$
+        jp      NZ,1$
 
         ret
         ;; Notes on strcpy styles:
@@ -39,17 +39,17 @@ __strcpy_rrx_s::
         ;; Can't use LDI as need to check for end of string.
         ;; Above also matches the z88dk version.
         .endif
-                
+
 ; void *memcpy(void *dest, const void *source, int count)
-_memcpy::       
+_memcpy::
         ;; Fall through to correct type
-__memcpy_rrf_s::                
+__memcpy_rrf_s::
         ld      a,#5
         rst     0x08
-__memcpy_rrx_s::       
+__memcpy_rrx_s::
         ;; Using LDIR
         ;; LDIR:        do; *DE = *HL; HL++; BC--; while BC != 0
-        
+
         ;; All registers are already saved.
        pop     iy      ; iy = return address
        pop     de      ; de = destination pointer
@@ -60,7 +60,7 @@ __memcpy_rrx_s::
        push    de
        ld      a,b
        or      c
-       jr      z,1$
+       jr      Z,1$
        ldir
 1$:
        pop     hl      ; return hl = original destination pointer
@@ -68,17 +68,17 @@ __memcpy_rrx_s::
        jp      (iy)
         ret
 
-; int strcmp(const char *s1, const char *s2) 
+; int strcmp(const char *s1, const char *s2)
 _strcmp::
         ;; Fall through to the correct style
         ;; Fall through to correct type
-__strcmp_rrf_s::                
+__strcmp_rrf_s::
         ld      a,#5
         rst     0x08
-__strcmp_rrx_s::       
+__strcmp_rrx_s::
         ld      hl,#2
         add     hl,sp
-        
+
         ld      e,(hl)
         inc     hl
         ld      d,(hl)
@@ -87,13 +87,13 @@ __strcmp_rrx_s::
         inc     hl
         ld      h,(hl)
         ld      l,a
-        
-1$:     
+
+1$:
         ld      a,(de)
         sub     (hl)
 
         ;; Normally not taken, so use a jr (12/7) instead of jp (10)
-        jr      nz,2$
+        jr      NZ,2$
 
         ;; A == 0
         cp      (hl)
@@ -102,11 +102,11 @@ __strcmp_rrx_s::
         inc     hl
         ;; Normally taken.  Flag from the cp above.
         jp      nz,1$
-2$:     
+2$:
         ;; Sign extend
         ld      l,a
         rla
         sbc     a
         ld      h,a
         ret
-        
+
index d5778142da081f3a0b1d616b3e84c19de922f25c..e7deb7d9db439f4cec19988ac7aa3ee1399f580d 100644 (file)
@@ -1,11 +1,11 @@
         .area   _CODE
-        
+
         ;; Special RLE decoder used for initing global data
 __initrleblock::
         ;; Pull the destination address out
         ld      c,l
         ld      b,h
-        
+
         ;; Pop the return address
         pop     hl
 1$:
@@ -14,7 +14,7 @@ __initrleblock::
         inc     hl
         ;; Negative means a run
         bit     7,e
-        jp      z,2$
+        jp      Z,2$
         ;; Code for expanding a run
         ld      a,(hl)
         inc     hl
@@ -22,23 +22,23 @@ __initrleblock::
         ld      (bc),a
         inc     bc
         inc     e
-        jp      nz,3$
+        jp      NZ,3$
         jp      1$
 2$:
         ;; Zero means end of a block
         xor     a
         or      e
-        jp      z,4$
+        jp      Z,4$
         ;; Code for expanding a block
-5$:     
-        ld      a,(hl)        
+5$:
+        ld      a,(hl)
         inc     hl
         ld      (bc),a
         inc     bc
         dec     e
-        jp      nz,5$
+        jp      NZ,5$
         jp      1$
-4$:     
+4$:
         ;; Push the return address back onto the stack
         push    hl
         ret
index c66aca33718fd085a52814c72ba19fb4f3f7c9bd..19e47457d03f9f1d4499065f89e909a351328fdc 100644 (file)
@@ -1,48 +1,48 @@
-       ;; Originally from GBDK by Pascal Felber.
-       .area   _CODE
+        ;; Originally from GBDK by Pascal Felber.
+        .area   _CODE
 
-__divschar_rrx_s::       
+__divschar_rrx_s::
         ld      hl,#2+1
         add     hl,sp
-        
+
         ld      e,(hl)
         dec     hl
         ld      l,(hl)
-        
+
         ;; Fall through
 __divschar_rrx_hds::
         ld      c,l
-        
+
         call    .div8
 
-       ld      l,c
+        ld      l,c
         ld      h,b
-               
-       ret
-       
-__modschar_rrx_s::       
+
+        ret
+
+__modschar_rrx_s::
         ld      hl,#2+1
         add     hl,sp
-        
+
         ld      e,(hl)
         dec     hl
         ld      l,(hl)
-        
+
         ;; Fall through
 __modschar_rrx_hds::
         ld      c,l
 
-               call    .div8
+        call    .div8
 
-       ld      l,e
+        ld      l,e
         ld      h,d
-               
-       ret
 
-__divsint_rrx_s::        
+        ret
+
+__divsint_rrx_s::
         ld      hl,#2+3
         add     hl,sp
-        
+
         ld      d,(hl)
         dec     hl
         ld      e,(hl)
@@ -51,23 +51,23 @@ __divsint_rrx_s::
         dec     hl
         ld      l,(hl)
         ld      h,a
-        
+
         ;; Fall through
 __divsint_rrx_hds::
-       ld      b,h
-       ld      c,l
+        ld      b,h
+        ld      c,l
+
+        call    .div16
 
-       call    .div16
+        ld      l,c
+        ld      h,b
+
+        ret
 
-       ld      l,c
-       ld      h,b
-       
-       ret
-       
 __modsint_rrx_s::
         ld      hl,#2+3
         add     hl,sp
-        
+
         ld      d,(hl)
         dec     hl
         ld      e,(hl)
@@ -79,57 +79,57 @@ __modsint_rrx_s::
 
         ;; Fall through
 __modsint_rrx_hds::
-       ld      b,h
-       ld      c,l
+        ld      b,h
+        ld      c,l
 
-       call    .div16
+        call    .div16
 
-       ld      l,e
-       ld      h,d
-       
-       ret
+        ld      l,e
+        ld      h,d
+
+        ret
 
-       ;; Unsigned
-__divuchar_rrx_s::       
+        ;; Unsigned
+__divuchar_rrx_s::
         ld      hl,#2+1
         add     hl,sp
-        
+
         ld      e,(hl)
         dec     hl
         ld      l,(hl)
-        
+
         ;; Fall through
 __divuchar_rrx_hds::
         ld      c,l
-       call    .divu8
+        call    .divu8
 
-       ld      l,c
+        ld      l,c
         ld      h,b
-        
-       ret
-       
-__moduchar_rrx_s::       
+
+        ret
+
+__moduchar_rrx_s::
         ld      hl,#2+1
         add     hl,sp
-        
+
         ld      e,(hl)
         dec     hl
         ld      l,(hl)
-        
+
         ;; Fall through
 __moduchar_rrx_hds::
         ld      c,l
-       call    .divu8
+        call    .divu8
 
-       ld      l,e
+        ld      l,e
         ld      h,d
 
         ret
 
-__divuint_rrx_s::                
+__divuint_rrx_s::
         ld      hl,#2+3
         add     hl,sp
-        
+
         ld      d,(hl)
         dec     hl
         ld      e,(hl)
@@ -141,19 +141,19 @@ __divuint_rrx_s::
 
         ;; Fall through
 __divuint_rrx_hds::
-       ld      b,h
-       ld      c,l
-       call    .divu16
-
-       ld      l,c
-       ld      h,b
-       
-       ret
-       
-__moduint_rrx_s::                
+        ld      b,h
+        ld      c,l
+        call    .divu16
+
+        ld      l,c
+        ld      h,b
+
+        ret
+
+__moduint_rrx_s::
         ld      hl,#2+3
         add     hl,sp
-        
+
         ld      d,(hl)
         dec     hl
         ld      e,(hl)
@@ -163,177 +163,177 @@ __moduint_rrx_s::
         ld      l,(hl)
         ld      h,a
         ;; Fall through
-        
+
 __moduint_rrx_hds::
-       ld      b,h
-       ld      c,l
+        ld      b,h
+        ld      c,l
+
+        call    .divu16
+
+        ld      l,e
+        ld      h,d
 
-       call    .divu16
+        ret
 
-       ld      l,e
-       ld      h,d
-       
-       ret
-       
 .div8::
 .mod8::
-       LD      A,C             ; Sign extend
-       RLCA
-       SBC     A
-       LD      B,A
-       LD      A,E             ; Sign extend
-       RLCA
-       SBC     A
-       LD      D,A
-
-       ; Fall through to .div16
-       
-       ;; 16-bit division
-       ;; 
-       ;; Entry conditions
-       ;;   BC = dividend
-       ;;   DE = divisor
-       ;; 
-       ;; Exit conditions
-       ;;   BC = quotient
-       ;;   DE = remainder
-       ;;   If divisor is non-zero, carry=0
-       ;;   If divisor is 0, carry=1 and both quotient and remainder are 0
-       ;;
-       ;; Register used: AF,BC,DE,HL
+        ld      a,c             ; Sign extend
+        rlca
+        sbc     a
+        ld      b,a
+        ld      a,e             ; Sign extend
+        rlca
+        sbc     a
+        ld      d,a
+
+        ; Fall through to .div16
+
+        ;; 16-bit division
+        ;;
+        ;; Entry conditions
+        ;;   BC = dividend
+        ;;   DE = divisor
+        ;;
+        ;; Exit conditions
+        ;;   BC = quotient
+        ;;   DE = remainder
+        ;;   If divisor is non-zero, carry=0
+        ;;   If divisor is 0, carry=1 and both quotient and remainder are 0
+        ;;
+        ;; Register used: AF,BC,DE,HL
 .div16::
 .mod16::
-       ;; Determine sign of quotient by xor-ing high bytes of dividend
-       ;;  and divisor. Quotient is positive if signs are the same, negative
-       ;;  if signs are different
-       ;; Remainder has same sign as dividend
-       LD      A,B             ; Get high byte of dividend
-       LD      (.srem),A       ; Save as sign of remainder
-       XOR     D               ; Xor with high byte of divisor
-       LD      (.squot),A      ; Save sign of quotient
-       ;; Take absolute value of divisor
-       BIT     7,D
-       jp      Z,.chkde        ; Jump if divisor is positive
-       SUB     A               ; Substract divisor from 0
-       SUB     E
-       LD      E,A
-       SBC     A               ; Propagate borrow (A=0xFF if borrow)
-       SUB     D
-       LD      D,A
-       ;; Take absolute value of dividend
+        ;; Determine sign of quotient by xor-ing high bytes of dividend
+        ;;  and divisor. Quotient is positive if signs are the same, negative
+        ;;  if signs are different
+        ;; Remainder has same sign as dividend
+        ld      a,b             ; Get high byte of dividend
+        ld      (.srem),a       ; Save as sign of remainder
+        xor     d               ; Xor with high byte of divisor
+        ld      (.squot),a      ; Save sign of quotient
+        ;; Take absolute value of divisor
+        bit     7,d
+        jp      Z,.chkde        ; Jump if divisor is positive
+        sub     a               ; Substract divisor from 0
+        sub     e
+        ld      e,a
+        sbc     a               ; Propagate borrow (A=0xFF if borrow)
+        sub     d
+        ld      d,a
+        ;; Take absolute value of dividend
 .chkde:
-       BIT     7,B
-       jp      Z,.dodiv        ; Jump if dividend is positive
-       SUB     A               ; Substract dividend from 0
-       SUB     C
-       LD      C,A
-       SBC     A               ; Propagate borrow (A=0xFF if borrow)
-       SUB     B
-       LD      B,A
-       ;; Divide absolute values
+        bit     7,b
+        jp      Z,.dodiv        ; Jump if dividend is positive
+        sub     a               ; Substract dividend from 0
+        sub     c
+        ld      c,a
+        sbc     a               ; Propagate borrow (A=0xFF if borrow)
+        sub     b
+        ld      b,a
+        ;; Divide absolute values
 .dodiv:
-       CALL    .divu16
-       RET     C               ; Exit if divide by zero
-       ;; Negate quotient if it is negative
-       LD      A,(.squot)
-       AND     #0x80
-       jp      Z,.dorem        ; Jump if quotient is positive
-       SUB     A               ; Substract quotient from 0
-       SUB     C
-       LD      C,A
-       SBC     A               ; Propagate borrow (A=0xFF if borrow)
-       SUB     B
-       LD      B,A
+        call    .divu16
+        ret     C               ; Exit if divide by zero
+        ;; Negate quotient if it is negative
+        ld      a,(.squot)
+        and     #0x80
+        jp      Z,.dorem        ; Jump if quotient is positive
+        sub     a               ; Substract quotient from 0
+        sub     c
+        ld      c,a
+        sbc     a               ; Propagate borrow (A=0xFF if borrow)
+        sub     b
+        ld      b,a
 .dorem:
-       ;; Negate remainder if it is negative
-       LD      A,(.srem)
-       AND     #0x80
-       RET     Z               ; Return if remainder is positive
-       SUB     A               ; Substract remainder from 0
-       SUB     E
-       LD      E,A
-       SBC     A               ; Propagate remainder (A=0xFF if borrow)
-       SUB     D
-       LD      D,A
-       RET
+        ;; Negate remainder if it is negative
+        ld      a,(.srem)
+        and     #0x80
+        ret     Z               ; Return if remainder is positive
+        sub     a               ; Substract remainder from 0
+        sub     e
+        ld      e,a
+        sbc     a               ; Propagate remainder (A=0xFF if borrow)
+        sub     d
+        ld      d,a
+        ret
 
 .divu8::
 .modu8::
-       LD      B,#0x00
-       LD      D,B
-       ; Fall through to divu16
+        ld      b,#0x00
+        ld      d,b
+        ; Fall through to divu16
 
 .divu16::
 .modu16::
-       ;; Check for division by zero
-       LD      A,E
-       OR      D
-       jp      NZ,.divide      ; Branch if divisor is non-zero
-       LD      BC,#0x00        ; Divide by zero error
-       LD      D,B
-       LD      E,C
-       SCF                     ; Set carry, invalid result
-       RET
+        ;; Check for division by zero
+        ld      a,e
+        or      d
+        jp      NZ,.divide      ; Branch if divisor is non-zero
+        ld      bc,#0x00        ; Divide by zero error
+        ld      d,b
+        ld      e,c
+        scf                     ; Set carry, invalid result
+        ret
 .divide:
-       ld      hl,#0
-;      LD      L,C             ; L = low byte of dividend/quotient
-;      LD      H,B             ; H = high byte of dividend/quotient
-;      LD      BC,#0x00        ; BC = remainder
-       OR      A               ; Clear carry to start
-       ex      af,af
-       LD      A,#16           ; 16 bits in dividend
+        ld      hl,#0
+;       ld      l,c             ; L = low byte of dividend/quotient
+;       ld      h,b             ; H = high byte of dividend/quotient
+;       ld      bc,#0x00        ; BC = remainder
+        or      a               ; Clear carry to start
+        ex      af,af
+        ld      a,#16           ; 16 bits in dividend
 .dvloop:
-       ;; Shift next bit of quotient into bit 0 of dividend
-       ;; Shift next MSB of dividend into LSB of remainder
-       ;; BC holds both dividend and quotient. While we shift a bit from
-       ;;  MSB of dividend, we shift next bit of quotient in from carry
-       ;; HL holds remainder
-       ;; Do a 32-bit left shift, shifting carry to L, L to H,
-       ;;  H to C, C to B
-       ex      af,af'
-       RL      C               ; Carry (next bit of quotient) to bit 0
-       RL      B               ; Clears carry since BC was 0
-       adc     hl,hl           
-
-       ;; If remainder is >= divisor, next bit of quotient is 1. This
-       ;;  bit goes to carry
-       PUSH    HL              ; Save current remainder
-       sbc     hl,de
-;      LD      A,C             ; Substract divisor from remainder
-;      SBC     E
-;      LD      C,A
-;      LD      A,B
-;      SBC     D
-;      LD      B,A
-       CCF                     ; Complement borrow so 1 indicates a
-                               ;  successful substraction (this is the
-                               ;  next bit of quotient)
-       jp      C,.drop         ; Jump if remainder is >= dividend
-       POP     HL              ; Otherwise, restore remainder
-       jp      .nodrop
+        ;; Shift next bit of quotient into bit 0 of dividend
+        ;; Shift next MSB of dividend into LSB of remainder
+        ;; BC holds both dividend and quotient. While we shift a bit from
+        ;;  MSB of dividend, we shift next bit of quotient in from carry
+        ;; HL holds remainder
+        ;; Do a 32-bit left shift, shifting carry to L, L to H,
+        ;;  H to C, C to B
+        ex      af,af'
+        rl      c               ; Carry (next bit of quotient) to bit 0
+        rl      b               ; Clears carry since BC was 0
+        adc     hl,hl
+
+        ;; If remainder is >= divisor, next bit of quotient is 1. This
+        ;;  bit goes to carry
+        push    hl              ; Save current remainder
+        sbc     hl,de
+;       ld      a,c             ; Substract divisor from remainder
+;       sbc     e
+;       ld      c,a
+;       ld      a,b
+;       sbc     d
+;       ld      b,a
+        ccf                     ; Complement borrow so 1 indicates a
+                                ;  successful substraction (this is the
+                                ;  next bit of quotient)
+        jp      C,.drop         ; Jump if remainder is >= dividend
+        pop     hl              ; Otherwise, restore remainder
+        jp      .nodrop
 .drop:
-       INC     SP
-       INC     SP
+        inc     sp
+        inc     sp
 .nodrop:
-       ex      af,af'
-       DEC     A               ; DEC does not affect carry flag
-       jp      NZ,.dvloop
-       ex      af,af'
-       ;; Shift last carry bit into quotient
-       LD      D,H             ; DE = remainder
-       LD      E,L
-       RL      C               ; Carry to L
-;      LD      C,L             ; C = low byte of quotient
-       RL      B
-;      LD      B,H             ; B = high byte of quotient
-       OR      A               ; Clear carry, valid result
-       RET
-
-       .area   _BSS
+        ex      af,af'
+        dec     a               ; DEC does not affect carry flag
+        jp      NZ,.dvloop
+        ex      af,af'
+        ;; Shift last carry bit into quotient
+        ld      d,h             ; DE = remainder
+        ld      e,l
+        rl      c               ; Carry to L
+;       ld      c,l             ; C = low byte of quotient
+        rl      b
+;       ld      b,h             ; B = high byte of quotient
+        or      a               ; Clear carry, valid result
+        ret
+
+        .area   _BSS
 
 .srem:
-       .ds 0x01                ; Sign of quotient
+        .ds 0x01                ; Sign of quotient
 .squot:
-       .ds 0x01                ; Sign of remainder
+        .ds 0x01                ; Sign of remainder
 .dcnt:
-       .ds 0x01                ; Counter for division
+        .ds 0x01                ; Counter for division
index 8462a0a0ce73abc16e2879350de86ccc76f715b4..00e6ce9ee2e9747a980aab13522a1c7a3d74b102 100644 (file)
@@ -84,7 +84,7 @@ __mulint_rrx_hds::
         ;; 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
-        jp      nz,1$
+        jp      NZ,1$
 
         ld      b,#8
         ld      a,c
@@ -94,7 +94,7 @@ __mulint_rrx_hds::
         add     hl,hl
         rl      c
         rla                     ;DLE 27/11/98
-        jr      nc,2$
+        jr      NC,2$
         add     hl,de
 2$:
         djnz    1$
index f09de38279fce11e097f5be6a7d459217888004a..a9ae6bfe7b15f90a11767566ce88bc54f09a5ea4 100644 (file)
@@ -1,8 +1,8 @@
         ;;
-__rrulong_rrx_s::                
+__rrulong_rrx_s::
         ld      hl,#2+4
         add     hl,sp
-                
+
         ld      c,(hl)
         dec     hl
         ld      d,(hl)
@@ -17,7 +17,7 @@ __rrulong_rrx_s::
         ld      a,c
 1$:
         or      a,a
-        ret     z
+        ret     Z
 
         rr      d
         rr      e
@@ -27,10 +27,10 @@ __rrulong_rrx_s::
         dec     a
         jp      1$
 
-__rrslong_rrx_s::        
+__rrslong_rrx_s::
         ld      hl,#2+4
         add     hl,sp
-                
+
         ld      c,(hl)
         dec     hl
         ld      d,(hl)
@@ -45,7 +45,7 @@ __rrslong_rrx_s::
         ld      a,c
 1$:
         or      a,a
-        ret     z
+        ret     Z
 
         sra     d
         rr      e
@@ -54,12 +54,12 @@ __rrslong_rrx_s::
 
         dec     a
         jp      1$
-        
-__rlslong_rrx_s::                
-__rlulong_rrx_s::                
+
+__rlslong_rrx_s::
+__rlulong_rrx_s::
         ld      hl,#2+4
         add     hl,sp
-        
+
         ld      c,(hl)
         dec     hl
         ld      d,(hl)
@@ -74,12 +74,12 @@ __rlulong_rrx_s::
         ld      a,c
 1$:
         or      a,a
-        ret     z
+        ret     Z
 
         rl      l
         rl      h
         rl      e
         rl      d
 
-        dec     a        
+        dec     a
         jp      1$