Blob Blame History Raw
From 65dd931d22b7196a0b6a4de8d6d441e15acfdab1 Mon Sep 17 00:00:00 2001
From: Oliver Schmidt <ol.sc@web.de>
Date: Thu, 2 Apr 2020 10:03:01 +0200
Subject: [PATCH 167/170] Some style adjustments.

---
 libsrc/atari/ostype.s              |  4 ++--
 libsrc/common/atoi.s               |  8 +++-----
 libsrc/common/ctype_preprocessor.s | 10 +++++-----
 libsrc/common/isalnum.s            |  2 +-
 libsrc/common/isalpha.s            |  2 +-
 libsrc/common/isblank.s            |  4 ++--
 libsrc/common/iscntrl.s            |  2 +-
 libsrc/common/isdigit.s            |  4 ++--
 libsrc/common/isgraph.s            |  3 +--
 libsrc/common/islower.s            |  2 +-
 libsrc/common/isprint.s            |  2 +-
 libsrc/common/ispunct.s            |  2 +-
 libsrc/common/isspace.s            |  4 ++--
 libsrc/common/isupper.s            |  2 +-
 libsrc/common/isxdigit.s           |  2 +-
 libsrc/common/strlower.s           |  9 +++------
 libsrc/common/strnicmp.s           | 20 ++++++++++----------
 libsrc/common/strupper.s           |  7 ++-----
 libsrc/lynx/crt0.s                 |  2 +-
 19 files changed, 41 insertions(+), 50 deletions(-)

diff --git a/libsrc/atari/ostype.s b/libsrc/atari/ostype.s
index 7248582a..876e8749 100644
--- a/libsrc/atari/ostype.s
+++ b/libsrc/atari/ostype.s
@@ -93,7 +93,7 @@ _get_ostype:
         asl     a
         asl     a
         and     #%00111000
-        ora     #%11
+        ora     #%00000011
 _fin:   ldx     #0
         disable_rom_save_a
         rts
@@ -117,7 +117,7 @@ _1200_11:
         lda     #%00010000
 
 _1200_fin:
-        ora     #%010
+        ora     #%00000010
         bne     _fin
 
 ; 400/800 ROM
diff --git a/libsrc/common/atoi.s b/libsrc/common/atoi.s
index b63fcb20..10f917f8 100644
--- a/libsrc/common/atoi.s
+++ b/libsrc/common/atoi.s
@@ -15,7 +15,7 @@
 ;
 
 _atoi:
-_atol:  sta     ptr1            ; Store s
+_atol:  sta     ptr1            ; store s
         stx     ptr1+1
         ldy     #0
         sty     ptr2
@@ -71,7 +71,7 @@ L6:     lda     (ptr1),y        ; get next char
         lda     ptr2+1
         pha
         lda     ptr2
-        pha                     ; Save value
+        pha                     ; save value
 
         jsr     mul2            ; * 4
         jsr     mul2            ; * 8
@@ -118,7 +118,7 @@ L8:     lda     ptr2
 ; Negate the value if necessary, otherwise we're done
 
         ldy     tmp1            ; sign
-        beq     L9              ; Branch if positive
+        beq     L9              ; branch if positive
 
 ; Negate the 32 bit value in ptr2/sreg
 
@@ -133,5 +133,3 @@ mul2:   asl     ptr2
         rol     sreg
         rol     sreg+1          ; * 2
 L9:     rts
-
-
diff --git a/libsrc/common/ctype_preprocessor.s b/libsrc/common/ctype_preprocessor.s
index efa001e6..79d93860 100644
--- a/libsrc/common/ctype_preprocessor.s
+++ b/libsrc/common/ctype_preprocessor.s
@@ -29,7 +29,7 @@ ctype_preprocessor:
 ctype_preprocessor_no_check:
         lsr     a
         tax
-        lda     __ctypeIdx, x
+        lda     __ctypeIdx,x
         bcc     @lowerNibble
 @upperNibble:
         lsr     a
@@ -38,13 +38,13 @@ ctype_preprocessor_no_check:
         lsr     a
         clc                     ; remove out of bounds flag
 @lowerNibble:
-        and     #%1111
+        and     #%00001111
         tax
-        lda     __ctype, x
-        ldx     #0
+        lda     __ctype,x
+        ldx     #$00
         rts
 
 SC:     sec
-        lda     #0
+        lda     #$00
         tax
         rts
diff --git a/libsrc/common/isalnum.s b/libsrc/common/isalnum.s
index 141949c0..2a05e32e 100644
--- a/libsrc/common/isalnum.s
+++ b/libsrc/common/isalnum.s
@@ -15,7 +15,7 @@
         .import         ctype_preprocessor
 
 _isalnum:
-        jsr     ctype_preprocessor      ; (clears always x)
+        jsr     ctype_preprocessor      ; (always clears X)
         bcs     @L1                     ; out of range? (everything already clear -> false)
         and     #CT_ALNUM               ; mask character/digit bits
 @L1:    rts
diff --git a/libsrc/common/isalpha.s b/libsrc/common/isalpha.s
index 95e79916..7a1f79d2 100644
--- a/libsrc/common/isalpha.s
+++ b/libsrc/common/isalpha.s
@@ -15,7 +15,7 @@
         .import         ctype_preprocessor
 
 _isalpha:
-        jsr     ctype_preprocessor      ; (clears always x)
+        jsr     ctype_preprocessor      ; (always clears X)
         bcs     @L1                     ; out of range? (everything already clear -> false)
         and     #CT_ALPHA               ; mask character bits
 @L1:    rts
diff --git a/libsrc/common/isblank.s b/libsrc/common/isblank.s
index 3d0a02f3..cc5b9e5a 100644
--- a/libsrc/common/isblank.s
+++ b/libsrc/common/isblank.s
@@ -17,7 +17,7 @@
         .import         ctype_preprocessor
 
 _isblank:
-        jsr     ctype_preprocessor      ; (clears always x)
+        jsr     ctype_preprocessor      ; (always clears X)
         bcs     @L1                     ; out of range? (everything already clear -> false)
         and     #CT_SPACE_TAB           ; mask blank bit
- @L1:   rts
+@L1:    rts
diff --git a/libsrc/common/iscntrl.s b/libsrc/common/iscntrl.s
index f2b95042..65e2111b 100644
--- a/libsrc/common/iscntrl.s
+++ b/libsrc/common/iscntrl.s
@@ -15,7 +15,7 @@
         .import         ctype_preprocessor
 
 _iscntrl:
-        jsr     ctype_preprocessor      ; (clears always x)
+        jsr     ctype_preprocessor      ; (always clears X)
         bcs     @L1                     ; out of range? (everything already clear -> false)
         and     #CT_CTRL                ; mask control character bit
 @L1:    rts
diff --git a/libsrc/common/isdigit.s b/libsrc/common/isdigit.s
index 36acd73b..76b2d1b2 100644
--- a/libsrc/common/isdigit.s
+++ b/libsrc/common/isdigit.s
@@ -15,7 +15,7 @@
         .import         ctype_preprocessor
 
 _isdigit:
-        jsr     ctype_preprocessor      ; (clears always x)
+        jsr     ctype_preprocessor      ; (always clears X)
         bcs     @L1                     ; out of range? (everything already clear -> false)
         and     #CT_DIGIT               ; mask digit bit
- @L1:   rts
+@L1:    rts
diff --git a/libsrc/common/isgraph.s b/libsrc/common/isgraph.s
index 4e317db5..6dd91ed3 100644
--- a/libsrc/common/isgraph.s
+++ b/libsrc/common/isgraph.s
@@ -15,11 +15,10 @@
         .import         ctype_preprocessor
 
 _isgraph:
-        jsr     ctype_preprocessor      ; (clears always x)
+        jsr     ctype_preprocessor      ; (always clears X)
         bcs     @L1                     ; out of range? (everything already clear -> false)
         and     #CT_CTRL_SPACE          ; mask character bits
         cmp     #1                      ; if false, then set "borrow" flag
         lda     #0
         sbc     #0                      ; invert logic (return NOT control and NOT space)
 @L1:    rts
-
diff --git a/libsrc/common/islower.s b/libsrc/common/islower.s
index 608d0ccf..a11ee129 100644
--- a/libsrc/common/islower.s
+++ b/libsrc/common/islower.s
@@ -15,7 +15,7 @@
         .import         ctype_preprocessor
 
 _islower:
-        jsr     ctype_preprocessor      ; (clears always x)
+        jsr     ctype_preprocessor      ; (always clears X)
         bcs     @L1                     ; out of range? (everything already clear -> false)
         and     #CT_LOWER               ; mask lower char bit
 @L1:    rts
diff --git a/libsrc/common/isprint.s b/libsrc/common/isprint.s
index 0d135f24..e1d63bc6 100644
--- a/libsrc/common/isprint.s
+++ b/libsrc/common/isprint.s
@@ -15,7 +15,7 @@
         .import         ctype_preprocessor
 
 _isprint:
-        jsr     ctype_preprocessor      ; (clears always x)
+        jsr     ctype_preprocessor      ; (always clears X)
         bcs     @L1                     ; out of range? (everything already clear -> false)
         eor     #CT_CTRL                ; NOT a control char
         and     #CT_CTRL                ; mask control char bit
diff --git a/libsrc/common/ispunct.s b/libsrc/common/ispunct.s
index a532399f..ac4ab7f1 100644
--- a/libsrc/common/ispunct.s
+++ b/libsrc/common/ispunct.s
@@ -15,7 +15,7 @@
         .import         ctype_preprocessor
 
 _ispunct:
-        jsr     ctype_preprocessor      ; (clears always x)
+        jsr     ctype_preprocessor      ; (always clears X)
         bcs     @L1                     ; out of range? (everything already clear -> false)
         and     #CT_NOT_PUNCT           ; mask relevant bits
         cmp     #1                      ; if false, then set "borrow" flag
diff --git a/libsrc/common/isspace.s b/libsrc/common/isspace.s
index 1f70786c..c3702344 100644
--- a/libsrc/common/isspace.s
+++ b/libsrc/common/isspace.s
@@ -15,7 +15,7 @@
         .import         ctype_preprocessor
 
 _isspace:
-        jsr     ctype_preprocessor              ; (clears always x)
+        jsr     ctype_preprocessor              ; (always clears X)
         bcs     @L1                             ; out of range? (everything already clear -> false)
         and     #(CT_SPACE | CT_OTHER_WS)       ; mask space bits
- @L1:   rts
+@L1:    rts
diff --git a/libsrc/common/isupper.s b/libsrc/common/isupper.s
index 0dd2a6ea..175fb872 100644
--- a/libsrc/common/isupper.s
+++ b/libsrc/common/isupper.s
@@ -15,7 +15,7 @@
         .import         ctype_preprocessor
 
 _isupper:
-        jsr     ctype_preprocessor      ; (clears always x)
+        jsr     ctype_preprocessor      ; (always clears X)
         bcs     @L1                     ; out of range? (everything already clear -> false)
         and     #CT_UPPER               ; mask upper char bit
 @L1:    rts
diff --git a/libsrc/common/isxdigit.s b/libsrc/common/isxdigit.s
index 3f36ede0..e8a12a10 100644
--- a/libsrc/common/isxdigit.s
+++ b/libsrc/common/isxdigit.s
@@ -15,7 +15,7 @@
         .import         ctype_preprocessor
 
 _isxdigit:
-        jsr     ctype_preprocessor      ; (clears always x)
+        jsr     ctype_preprocessor      ; (always clears X)
         bcs     @L1                     ; out of range? (everything already clear -> false)
         and     #CT_XDIGIT              ; mask xdigit bit
 @L1:    rts
diff --git a/libsrc/common/strlower.s b/libsrc/common/strlower.s
index d4e48138..479d852e 100644
--- a/libsrc/common/strlower.s
+++ b/libsrc/common/strlower.s
@@ -16,7 +16,7 @@
 
 _strlower:
 _strlwr:
-        sta     ptr1            ; Save s (working copy)
+        sta     ptr1            ; save s (working copy)
         stx     ptr1+1
         sta     ptr2
         stx     ptr2+1          ; save function result
@@ -25,10 +25,10 @@ _strlwr:
 loop:   lda     (ptr1),y        ; get character
         beq     L9              ; jump if done
                                 ; get character classification
-        jsr     ctype_preprocessor_no_check        
+        jsr     ctype_preprocessor_no_check
         and     #CT_UPPER       ; upper case char?
         beq     L1              ; jump if no
-        lda     (ptr1),y        ; fetch character again      
+        lda     (ptr1),y        ; fetch character again
         adc     #<('a'-'A')     ; make lower case char (ctype_preprocessor_no_check ensures carry clear)
         sta     (ptr1),y        ; store back
 L1:     iny                     ; next char
@@ -41,6 +41,3 @@ L1:     iny                     ; next char
 L9:     lda     ptr2
         ldx     ptr2+1
         rts
-
-
-
diff --git a/libsrc/common/strnicmp.s b/libsrc/common/strnicmp.s
index 54aef2bb..c4cc272d 100644
--- a/libsrc/common/strnicmp.s
+++ b/libsrc/common/strnicmp.s
@@ -41,7 +41,7 @@ _strncasecmp:
 ; Start of compare loop. Check the counter.
 
 Loop:   inc     ptr3
-        beq     IncHi           ; Increment high byte
+        beq     IncHi           ; increment high byte
 
 ; Compare a byte from the strings
 
@@ -58,18 +58,18 @@ Comp:   lda     (ptr2),y
 L1:     lda     (ptr1),y        ; get character from first string
         sta     tmp1            ; remember original char
                                 ; get character classification
-        jsr     ctype_preprocessor_no_check 
+        jsr     ctype_preprocessor_no_check
         and     #CT_LOWER       ; lower case char?
         beq     L2              ; jump if no
         lda     #<('A'-'a')     ; make upper case char
         adc     tmp1            ; ctype_preprocessor_no_check ensures carry clear!
-        sta     tmp1            ; remember upper case equivalent 
+        sta     tmp1            ; remember upper case equivalent
 
 L2:     ldx     tmp1
         cpx     tmp2            ; compare characters
-        bne     NotEqual        ; Jump if strings different
-        txa                     ; End of strings?
-        beq     Equal1          ; Jump if EOS reached, a/x == 0
+        bne     NotEqual        ; jump if strings different
+        txa                     ; end of strings?
+        beq     Equal1          ; jump if EOS reached, a/x == 0
 
 ; Increment the pointers
 
@@ -77,12 +77,12 @@ L2:     ldx     tmp1
         bne     Loop
         inc     ptr1+1
         inc     ptr2+1
-        bne     Loop            ; Branch always
+        bne     Loop            ; branch always
 
 ; Increment hi byte
 
 IncHi:  inc     ptr3+1
-        bne     Comp            ; Jump if counter not zero
+        bne     Comp            ; jump if counter not zero
 
 ; Exit code if strings are equal. a/x not set
 
@@ -94,8 +94,8 @@ Equal1: rts
 
 NotEqual:
         bcs     L3
-        ldx     #$FF            ; Make result negative
+        ldx     #$FF            ; make result negative
         rts
 
-L3:     ldx     #$01            ; Make result positive
+L3:     ldx     #$01            ; make result positive
         rts
diff --git a/libsrc/common/strupper.s b/libsrc/common/strupper.s
index dd6c1c25..e2160d4d 100644
--- a/libsrc/common/strupper.s
+++ b/libsrc/common/strupper.s
@@ -16,7 +16,7 @@
 
 _strupper:
 _strupr:
-        sta     ptr1            ; Save s (working copy)
+        sta     ptr1            ; save s (working copy)
         stx     ptr1+1
         sta     ptr2
         stx     ptr2+1          ; save function result
@@ -24,7 +24,7 @@ _strupr:
 
 loop:   lda     (ptr1),y        ; get character
         beq     L9              ; jump if done
-        jsr     ctype_preprocessor_no_check 
+        jsr     ctype_preprocessor_no_check
         and     #CT_LOWER       ; lower case char?
         beq     L1              ; jump if no
         lda     (ptr1),y        ; fetch character again
@@ -40,6 +40,3 @@ L1:     iny                     ; next char
 L9:     lda     ptr2
         ldx     ptr2+1
         rts
-
-
-
diff --git a/libsrc/lynx/crt0.s b/libsrc/lynx/crt0.s
index da2162b4..238a2c99 100644
--- a/libsrc/lynx/crt0.s
+++ b/libsrc/lynx/crt0.s
@@ -68,7 +68,7 @@ MikeyInitData:  .byte $9e,$18,$68,$1f,$00,$00,$00,$00,$00,$ff,$1a,$1b,$04,$0d,$2
 
 ; Disable the TX/RX IRQ; set to 8E1.
 
-        lda     #%11101
+        lda     #%00011101
         sta     SERCTL
 
 ; Clear all pending interrupts.
-- 
2.26.0