]> git.sur5r.net Git - cc65/commitdiff
Changes due to code review.
authorIrgendwerA8 <c.krueger.b@web.de>
Thu, 21 Mar 2019 19:43:07 +0000 (20:43 +0100)
committerOliver Schmidt <ol.sc@web.de>
Fri, 29 Mar 2019 21:53:04 +0000 (22:53 +0100)
14 files changed:
doc/specialmath.sgml
include/specialmath.h
libsrc/Makefile
libsrc/atari/cputc.s
libsrc/atari/mcbtxtchar.s
libsrc/atari/scroll.s
libsrc/atari/setcursor.s
libsrc/atari5200/cputc.s
libsrc/common/_mul20.s [new file with mode: 0644]
libsrc/common/_mul40.s [new file with mode: 0644]
libsrc/specialmath/mul20.s [deleted file]
libsrc/specialmath/mul40.s [deleted file]
test/val/lib_common_mulxx.c [new file with mode: 0644]
test/val/lib_specialmath_mulxx.c [deleted file]

index 18de970eba028d7a59491b13204541625f3acb44..5e2fd90a75d0a948d7f60abb5d289302d7540d84 100644 (file)
@@ -20,7 +20,7 @@ the target address. A quite common horizontal span for 8-bit systems is 20 or 40
 
 <p>
 <tscreen><verb>
-    unsigned int __fastcall__ mul20(unsigned char value);
+    unsigned int __fastcall__ _mul20(unsigned char value);
 </verb></tscreen>
 
 The 8 bit <tt>value</tt> is multiplied by 20 and returned as 16 bit value.
@@ -28,7 +28,7 @@ The 8 bit <tt>value</tt> is multiplied by 20 and returned as 16 bit value.
 
 <p>
 <tscreen><verb>
-    unsigned int __fastcall__ mul40(unsigned char value);
+    unsigned int __fastcall__ _mul40(unsigned char value);
 </verb></tscreen>
 
 The 8 bit <tt>value</tt> is multiplied by 40 and returned as 16 bit value.
index fa2f6573604023bea976de7a49cf17d034b864ab..6b6776914a4ff3dcd665e9c95e4498ae0797be85 100644 (file)
 
 /* Multiply an 8 bit unsigned value by 20 and return the 16 bit unsigned result */
 
-unsigned int __fastcall__ mul20(unsigned char value);
+unsigned int __fastcall__ _mul20(unsigned char value);
 
 
 /* Multiply an 8 bit unsigned value by 40 and return the 16 bit unsigned result */
 
-unsigned int __fastcall__ mul40(unsigned char value);
+unsigned int __fastcall__ _mul40(unsigned char value);
 
 
 
index 4e1a3520d992e880e25b9a03617d2f63342f24eb..0ebec46b159a9d41d2990b33be6bed56552ee880 100644 (file)
@@ -181,7 +181,6 @@ SRCDIRS += common   \
            mouse    \
            runtime  \
            serial   \
-           specialmath \
            tgi      \
            zlib
 
index cf66fdacf02af2f2c66852098f3181cf42b74828..5de39573c33181e2a637e9aa1cd4ad706beb55c3 100644 (file)
@@ -7,7 +7,7 @@
 
         .export         _cputcxy, _cputc
         .export         plot, cputdirect, putchar
-        .import         gotoxy, _mul40
+        .import         gotoxy, __mul40
         .importzp       tmp4,ptr4
         .import         _revflag,setcursor
 
@@ -71,7 +71,7 @@ putchar:
         sta     (OLDADR),y
 
         lda     ROWCRS
-        jsr     _mul40          ; destroys tmp4, carry is cleared
+        jsr     __mul40         ; destroys tmp4, carry is cleared
         adc     SAVMSC          ; add start of screen memory
         sta     ptr4
         txa
index 4ff79c651d9e0985bd4b1b9116d6e2a128934738..3c992000c5f96fd12a5d4dd193dd8981f608534f 100644 (file)
@@ -12,7 +12,7 @@
 
         .export         _mouse_txt_callbacks
         .importzp       tmp4
-        .import         _mul40
+        .import         __mul40
         .importzp       mouse_txt_char          ; screen code of mouse cursor
 
         .include        "atari.inc"
@@ -108,7 +108,7 @@ movey:
         lsr     a               ; convert y position to character line
         lsr     a
         lsr     a
-        jsr     _mul40          ; carry is cleared by _mul40
+        jsr     __mul40          ; carry is cleared by _mul40
         adc     SAVMSC
         sta     scrptr
         txa
index 4bc0d72edc61a9404ea41e2b431b238b4047a030..7c839cd481ff4b4dc4f5a8bd11cadcad0bbe5e5c 100644 (file)
@@ -8,7 +8,7 @@
 
         .include        "atari.inc"
         .importzp       tmp1,tmp4,ptr1,ptr2
-        .import         _mul40,_clrscr
+        .import         __mul40,_clrscr
         .export         __scroll
 
 .proc   __scroll
@@ -40,7 +40,7 @@ down_ok:lda     SAVMSC
         sta     ptr2+1
 
         lda     tmp1
-        jsr     _mul40
+        jsr     __mul40
         sta     tmp4
         lda     ptr2
         sec
@@ -103,7 +103,7 @@ up:     sta     tmp1            ; # of lines to scroll
         jmp     _clrscr
 
         ;multiply by 40 (xsize)
-up_ok:  jsr     _mul40          ; carry is cleared by _mul40
+up_ok:  jsr     __mul40         ; carry is cleared by __mul40
         adc     SAVMSC          ; add start of screen mem
         sta     ptr2
         txa
index c6d844047fa4ce176e414bb56ac8c40608118d30..33b93ae16cd1bcc736ff4bbe575b1b732386688b 100644 (file)
@@ -4,7 +4,7 @@
 ; cursor handling, internal function
 
         .include "atari.inc"
-        .import cursor,_mul40
+        .import cursor,__mul40
         .export setcursor
 
 .proc   setcursor
@@ -14,7 +14,7 @@
         sta     (OLDADR),y
 
         lda     ROWCRS
-        jsr     _mul40          ; function leaves with carry clear!
+        jsr     __mul40         ; function leaves with carry clear!
         adc     SAVMSC          ; add start of screen memory
         sta     OLDADR
         txa
index 185ad8da8ecb7fde1ce52818a3da55e9c2981f49..cac66699a9b9c433a1a90dad6c76443a5ce62a72 100644 (file)
@@ -10,7 +10,7 @@
 
         .export         _cputcxy, _cputc
         .export         plot, cputdirect, putchar
-        .import         gotoxy, _mul20
+        .import         gotoxy, __mul20
         .importzp       ptr4
         .import         setcursor
 
@@ -75,7 +75,7 @@ putchar:
         pha                     ; save char
 
         lda     ROWCRS_5200
-        jsr     _mul20          ; destroys tmp4, carry is cleared
+        jsr     __mul20         ; destroys tmp4, carry is cleared
         adc     SAVMSC          ; add start of screen memory
         sta     ptr4
         txa
diff --git a/libsrc/common/_mul20.s b/libsrc/common/_mul20.s
new file mode 100644 (file)
index 0000000..42ab420
--- /dev/null
@@ -0,0 +1,47 @@
+; mul20.s
+;
+; This file is part of
+; cc65 - a freeware C compiler for 6502 based systems
+;
+; https://github.com/cc65/cc65
+;
+; See "LICENSE" file for legal information.
+;
+;
+; unsigned int __fastcall__ _mul20(unsigned char value);
+; 
+; REMARKS: Function is defined to return with carry-flag cleared
+
+
+        .importzp       tmp4
+        .export         __mul20
+
+.proc   __mul20                 ; = 30 bytes, 41/46 cycles
+
+        sta     tmp4            ; remember value for later addition...
+        ldx     #0              ; clear high-byte
+        asl     a               ; * 2
+        bcc     mul4            ; high-byte affected?
+        ldx     #2              ; this will be the 1st high-bit soon...
+
+mul4:   asl     a               ; * 4                  
+        bcc     mul5            ; high-byte affected?
+        inx                     ; => yes, apply to 0 high-bit
+        clc                     ; prepare addition
+
+mul5:   adc     tmp4            ; * 5
+        bcc     mul10           ; high-byte affected?
+        inx                     ; yes, correct...
+
+mul10:  stx     tmp4            ; continue with classic shifting...
+        
+        asl     a               ; * 10
+        rol     tmp4                                    
+
+        asl     a               ; * 20 
+        rol     tmp4
+
+        ldx     tmp4            ; deliver high-byte in X
+        rts
+
+.endproc
diff --git a/libsrc/common/_mul40.s b/libsrc/common/_mul40.s
new file mode 100644 (file)
index 0000000..d68a9f7
--- /dev/null
@@ -0,0 +1,50 @@
+; mul40.s
+;
+; This file is part of
+; cc65 - a freeware C compiler for 6502 based systems
+;
+; https://github.com/cc65/cc65
+;
+; See "LICENSE" file for legal information.
+;
+;
+; unsigned int __fastcall__ _mul40(unsigned char value);
+; 
+; REMARKS: Function is defined to return with carry-flag cleared
+
+
+        .importzp       tmp4
+        .export         __mul40
+
+.proc   __mul40                 ; = 33 bytes, 48/53 cycles
+
+        sta     tmp4            ; remember value for later addition...
+        ldx     #0              ; clear high-byte
+        asl     a               ; * 2
+        bcc     mul4            ; high-byte affected?
+        ldx     #2              ; this will be the 1st high-bit soon...
+
+mul4:   asl     a               ; * 4                  
+        bcc     mul5            ; high-byte affected?
+        inx                     ; => yes, apply to 0 high-bit
+        clc                     ; prepare addition
+
+mul5:   adc     tmp4            ; * 5
+        bcc     mul10           ; high-byte affected?
+        inx                     ; yes, correct...
+
+mul10:  stx     tmp4            ; continue with classic shifting...
+        
+        asl     a               ; * 10
+        rol     tmp4                                    
+
+        asl     a               ; * 20 
+        rol     tmp4
+
+        asl     a               ; * 40
+        rol     tmp4
+
+        ldx     tmp4            ; deliver high-byte in X
+        rts
+
+.endproc
diff --git a/libsrc/specialmath/mul20.s b/libsrc/specialmath/mul20.s
deleted file mode 100644 (file)
index 3339f7d..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-; mul20.s
-;
-; This file is part of
-; cc65 - a freeware C compiler for 6502 based systems
-;
-; https://github.com/cc65/cc65
-;
-; See "LICENSE" file for legal information.
-;
-;
-; unsigned int __fastcall__ mul20(unsigned char value);
-; 
-; REMARKS: Function is defined to return with carry-flag cleared
-
-
-        .importzp       tmp4
-        .export         _mul20
-
-.proc   _mul20                  ; = 30 bytes, 41/46 cycles
-
-        sta     tmp4            ; remember value for later addition...
-        ldx     #0              ; clear high-byte
-        asl     a               ; * 2
-        bcc     mul4            ; high-byte affected?
-        ldx     #2              ; this will be the 1st high-bit soon...
-
-mul4:   asl     a               ; * 4                  
-        bcc     mul5            ; high-byte affected?
-        inx                     ; => yes, apply to 0 high-bit
-        clc                     ; prepare addition
-
-mul5:   adc     tmp4            ; * 5
-        bcc     mul10           ; high-byte affected?
-        inx                     ; yes, correct...
-
-mul10:  stx     tmp4            ; continue with classic shifting...
-        
-        asl     a               ; * 10
-        rol     tmp4                                    
-
-        asl     a               ; * 20 
-        rol     tmp4
-
-        ldx     tmp4            ; deliver high-byte in X
-        rts
-
-.endproc
diff --git a/libsrc/specialmath/mul40.s b/libsrc/specialmath/mul40.s
deleted file mode 100644 (file)
index 1103519..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-; mul40.s
-;
-; This file is part of
-; cc65 - a freeware C compiler for 6502 based systems
-;
-; https://github.com/cc65/cc65
-;
-; See "LICENSE" file for legal information.
-;
-;
-; unsigned int __fastcall__ mul40(unsigned char value);
-; 
-; REMARKS: Function is defined to return with carry-flag cleared
-
-
-        .importzp       tmp4
-        .export         _mul40
-
-.proc   _mul40                  ; = 33 bytes, 48/53 cycles
-
-        sta     tmp4            ; remember value for later addition...
-        ldx     #0              ; clear high-byte
-        asl     a               ; * 2
-        bcc     mul4            ; high-byte affected?
-        ldx     #2              ; this will be the 1st high-bit soon...
-
-mul4:   asl     a               ; * 4                  
-        bcc     mul5            ; high-byte affected?
-        inx                     ; => yes, apply to 0 high-bit
-        clc                     ; prepare addition
-
-mul5:   adc     tmp4            ; * 5
-        bcc     mul10           ; high-byte affected?
-        inx                     ; yes, correct...
-
-mul10:  stx     tmp4            ; continue with classic shifting...
-        
-        asl     a               ; * 10
-        rol     tmp4                                    
-
-        asl     a               ; * 20 
-        rol     tmp4
-
-        asl     a               ; * 40
-        rol     tmp4
-
-        ldx     tmp4            ; deliver high-byte in X
-        rts
-
-.endproc
diff --git a/test/val/lib_common_mulxx.c b/test/val/lib_common_mulxx.c
new file mode 100644 (file)
index 0000000..340838a
--- /dev/null
@@ -0,0 +1,18 @@
+#include <specialmath.h>
+#include "unittest.h"
+
+TEST
+{
+    unsigned i;
+    
+    for (i=0; i < 256; ++i)
+    {
+        ASSERT_AreEqual(i*20, _mul20(i), "%u", "Invalid 'mul20(%u)' calculation!" COMMA i);
+    }
+
+    for (i=0; i < 256; ++i)
+    {
+        ASSERT_AreEqual(i*40, _mul40(i), "%u", "Invalid 'mul40(%u)' calculation!" COMMA i);
+    }
+}
+ENDTEST
diff --git a/test/val/lib_specialmath_mulxx.c b/test/val/lib_specialmath_mulxx.c
deleted file mode 100644 (file)
index de7cc1e..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-#include <specialmath.h>
-#include "unittest.h"
-
-TEST
-{
-    unsigned i;
-    
-    for (i=0; i < 256; ++i)
-    {
-        ASSERT_AreEqual(i*20, mul20(i), "%u", "Invalid 'mul20(%u)' calculation!" COMMA i);
-    }
-
-    for (i=0; i < 256; ++i)
-    {
-        ASSERT_AreEqual(i*40, mul40(i), "%u", "Invalid 'mul40(%u)' calculation!" COMMA i);
-    }
-}
-ENDTEST