1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-07 23:29:39 +00:00

Some style adjustments.

This commit is contained in:
Oliver Schmidt 2020-04-02 10:03:01 +02:00
parent 4cc95a2c6c
commit 65dd931d22
19 changed files with 41 additions and 50 deletions

View File

@ -93,7 +93,7 @@ _get_ostype:
asl a asl a
asl a asl a
and #%00111000 and #%00111000
ora #%11 ora #%00000011
_fin: ldx #0 _fin: ldx #0
disable_rom_save_a disable_rom_save_a
rts rts
@ -117,7 +117,7 @@ _1200_11:
lda #%00010000 lda #%00010000
_1200_fin: _1200_fin:
ora #%010 ora #%00000010
bne _fin bne _fin
; 400/800 ROM ; 400/800 ROM

View File

@ -15,7 +15,7 @@
; ;
_atoi: _atoi:
_atol: sta ptr1 ; Store s _atol: sta ptr1 ; store s
stx ptr1+1 stx ptr1+1
ldy #0 ldy #0
sty ptr2 sty ptr2
@ -71,7 +71,7 @@ L6: lda (ptr1),y ; get next char
lda ptr2+1 lda ptr2+1
pha pha
lda ptr2 lda ptr2
pha ; Save value pha ; save value
jsr mul2 ; * 4 jsr mul2 ; * 4
jsr mul2 ; * 8 jsr mul2 ; * 8
@ -118,7 +118,7 @@ L8: lda ptr2
; Negate the value if necessary, otherwise we're done ; Negate the value if necessary, otherwise we're done
ldy tmp1 ; sign ldy tmp1 ; sign
beq L9 ; Branch if positive beq L9 ; branch if positive
; Negate the 32 bit value in ptr2/sreg ; Negate the 32 bit value in ptr2/sreg
@ -133,5 +133,3 @@ mul2: asl ptr2
rol sreg rol sreg
rol sreg+1 ; * 2 rol sreg+1 ; * 2
L9: rts L9: rts

View File

@ -29,7 +29,7 @@ ctype_preprocessor:
ctype_preprocessor_no_check: ctype_preprocessor_no_check:
lsr a lsr a
tax tax
lda __ctypeIdx, x lda __ctypeIdx,x
bcc @lowerNibble bcc @lowerNibble
@upperNibble: @upperNibble:
lsr a lsr a
@ -38,13 +38,13 @@ ctype_preprocessor_no_check:
lsr a lsr a
clc ; remove out of bounds flag clc ; remove out of bounds flag
@lowerNibble: @lowerNibble:
and #%1111 and #%00001111
tax tax
lda __ctype, x lda __ctype,x
ldx #0 ldx #$00
rts rts
SC: sec SC: sec
lda #0 lda #$00
tax tax
rts rts

View File

@ -15,7 +15,7 @@
.import ctype_preprocessor .import ctype_preprocessor
_isalnum: _isalnum:
jsr ctype_preprocessor ; (clears always x) jsr ctype_preprocessor ; (always clears X)
bcs @L1 ; out of range? (everything already clear -> false) bcs @L1 ; out of range? (everything already clear -> false)
and #CT_ALNUM ; mask character/digit bits and #CT_ALNUM ; mask character/digit bits
@L1: rts @L1: rts

View File

@ -15,7 +15,7 @@
.import ctype_preprocessor .import ctype_preprocessor
_isalpha: _isalpha:
jsr ctype_preprocessor ; (clears always x) jsr ctype_preprocessor ; (always clears X)
bcs @L1 ; out of range? (everything already clear -> false) bcs @L1 ; out of range? (everything already clear -> false)
and #CT_ALPHA ; mask character bits and #CT_ALPHA ; mask character bits
@L1: rts @L1: rts

View File

@ -17,7 +17,7 @@
.import ctype_preprocessor .import ctype_preprocessor
_isblank: _isblank:
jsr ctype_preprocessor ; (clears always x) jsr ctype_preprocessor ; (always clears X)
bcs @L1 ; out of range? (everything already clear -> false) bcs @L1 ; out of range? (everything already clear -> false)
and #CT_SPACE_TAB ; mask blank bit and #CT_SPACE_TAB ; mask blank bit
@L1: rts @L1: rts

View File

@ -15,7 +15,7 @@
.import ctype_preprocessor .import ctype_preprocessor
_iscntrl: _iscntrl:
jsr ctype_preprocessor ; (clears always x) jsr ctype_preprocessor ; (always clears X)
bcs @L1 ; out of range? (everything already clear -> false) bcs @L1 ; out of range? (everything already clear -> false)
and #CT_CTRL ; mask control character bit and #CT_CTRL ; mask control character bit
@L1: rts @L1: rts

View File

@ -15,7 +15,7 @@
.import ctype_preprocessor .import ctype_preprocessor
_isdigit: _isdigit:
jsr ctype_preprocessor ; (clears always x) jsr ctype_preprocessor ; (always clears X)
bcs @L1 ; out of range? (everything already clear -> false) bcs @L1 ; out of range? (everything already clear -> false)
and #CT_DIGIT ; mask digit bit and #CT_DIGIT ; mask digit bit
@L1: rts @L1: rts

View File

@ -15,11 +15,10 @@
.import ctype_preprocessor .import ctype_preprocessor
_isgraph: _isgraph:
jsr ctype_preprocessor ; (clears always x) jsr ctype_preprocessor ; (always clears X)
bcs @L1 ; out of range? (everything already clear -> false) bcs @L1 ; out of range? (everything already clear -> false)
and #CT_CTRL_SPACE ; mask character bits and #CT_CTRL_SPACE ; mask character bits
cmp #1 ; if false, then set "borrow" flag cmp #1 ; if false, then set "borrow" flag
lda #0 lda #0
sbc #0 ; invert logic (return NOT control and NOT space) sbc #0 ; invert logic (return NOT control and NOT space)
@L1: rts @L1: rts

View File

@ -15,7 +15,7 @@
.import ctype_preprocessor .import ctype_preprocessor
_islower: _islower:
jsr ctype_preprocessor ; (clears always x) jsr ctype_preprocessor ; (always clears X)
bcs @L1 ; out of range? (everything already clear -> false) bcs @L1 ; out of range? (everything already clear -> false)
and #CT_LOWER ; mask lower char bit and #CT_LOWER ; mask lower char bit
@L1: rts @L1: rts

View File

@ -15,7 +15,7 @@
.import ctype_preprocessor .import ctype_preprocessor
_isprint: _isprint:
jsr ctype_preprocessor ; (clears always x) jsr ctype_preprocessor ; (always clears X)
bcs @L1 ; out of range? (everything already clear -> false) bcs @L1 ; out of range? (everything already clear -> false)
eor #CT_CTRL ; NOT a control char eor #CT_CTRL ; NOT a control char
and #CT_CTRL ; mask control char bit and #CT_CTRL ; mask control char bit

View File

@ -15,7 +15,7 @@
.import ctype_preprocessor .import ctype_preprocessor
_ispunct: _ispunct:
jsr ctype_preprocessor ; (clears always x) jsr ctype_preprocessor ; (always clears X)
bcs @L1 ; out of range? (everything already clear -> false) bcs @L1 ; out of range? (everything already clear -> false)
and #CT_NOT_PUNCT ; mask relevant bits and #CT_NOT_PUNCT ; mask relevant bits
cmp #1 ; if false, then set "borrow" flag cmp #1 ; if false, then set "borrow" flag

View File

@ -15,7 +15,7 @@
.import ctype_preprocessor .import ctype_preprocessor
_isspace: _isspace:
jsr ctype_preprocessor ; (clears always x) jsr ctype_preprocessor ; (always clears X)
bcs @L1 ; out of range? (everything already clear -> false) bcs @L1 ; out of range? (everything already clear -> false)
and #(CT_SPACE | CT_OTHER_WS) ; mask space bits and #(CT_SPACE | CT_OTHER_WS) ; mask space bits
@L1: rts @L1: rts

View File

@ -15,7 +15,7 @@
.import ctype_preprocessor .import ctype_preprocessor
_isupper: _isupper:
jsr ctype_preprocessor ; (clears always x) jsr ctype_preprocessor ; (always clears X)
bcs @L1 ; out of range? (everything already clear -> false) bcs @L1 ; out of range? (everything already clear -> false)
and #CT_UPPER ; mask upper char bit and #CT_UPPER ; mask upper char bit
@L1: rts @L1: rts

View File

@ -15,7 +15,7 @@
.import ctype_preprocessor .import ctype_preprocessor
_isxdigit: _isxdigit:
jsr ctype_preprocessor ; (clears always x) jsr ctype_preprocessor ; (always clears X)
bcs @L1 ; out of range? (everything already clear -> false) bcs @L1 ; out of range? (everything already clear -> false)
and #CT_XDIGIT ; mask xdigit bit and #CT_XDIGIT ; mask xdigit bit
@L1: rts @L1: rts

View File

@ -16,7 +16,7 @@
_strlower: _strlower:
_strlwr: _strlwr:
sta ptr1 ; Save s (working copy) sta ptr1 ; save s (working copy)
stx ptr1+1 stx ptr1+1
sta ptr2 sta ptr2
stx ptr2+1 ; save function result stx ptr2+1 ; save function result
@ -25,10 +25,10 @@ _strlwr:
loop: lda (ptr1),y ; get character loop: lda (ptr1),y ; get character
beq L9 ; jump if done beq L9 ; jump if done
; get character classification ; get character classification
jsr ctype_preprocessor_no_check jsr ctype_preprocessor_no_check
and #CT_UPPER ; upper case char? and #CT_UPPER ; upper case char?
beq L1 ; jump if no 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) adc #<('a'-'A') ; make lower case char (ctype_preprocessor_no_check ensures carry clear)
sta (ptr1),y ; store back sta (ptr1),y ; store back
L1: iny ; next char L1: iny ; next char
@ -41,6 +41,3 @@ L1: iny ; next char
L9: lda ptr2 L9: lda ptr2
ldx ptr2+1 ldx ptr2+1
rts rts

View File

@ -41,7 +41,7 @@ _strncasecmp:
; Start of compare loop. Check the counter. ; Start of compare loop. Check the counter.
Loop: inc ptr3 Loop: inc ptr3
beq IncHi ; Increment high byte beq IncHi ; increment high byte
; Compare a byte from the strings ; Compare a byte from the strings
@ -58,18 +58,18 @@ Comp: lda (ptr2),y
L1: lda (ptr1),y ; get character from first string L1: lda (ptr1),y ; get character from first string
sta tmp1 ; remember original char sta tmp1 ; remember original char
; get character classification ; get character classification
jsr ctype_preprocessor_no_check jsr ctype_preprocessor_no_check
and #CT_LOWER ; lower case char? and #CT_LOWER ; lower case char?
beq L2 ; jump if no beq L2 ; jump if no
lda #<('A'-'a') ; make upper case char lda #<('A'-'a') ; make upper case char
adc tmp1 ; ctype_preprocessor_no_check ensures carry clear! adc tmp1 ; ctype_preprocessor_no_check ensures carry clear!
sta tmp1 ; remember upper case equivalent sta tmp1 ; remember upper case equivalent
L2: ldx tmp1 L2: ldx tmp1
cpx tmp2 ; compare characters cpx tmp2 ; compare characters
bne NotEqual ; Jump if strings different bne NotEqual ; jump if strings different
txa ; End of strings? txa ; end of strings?
beq Equal1 ; Jump if EOS reached, a/x == 0 beq Equal1 ; jump if EOS reached, a/x == 0
; Increment the pointers ; Increment the pointers
@ -77,12 +77,12 @@ L2: ldx tmp1
bne Loop bne Loop
inc ptr1+1 inc ptr1+1
inc ptr2+1 inc ptr2+1
bne Loop ; Branch always bne Loop ; branch always
; Increment hi byte ; Increment hi byte
IncHi: inc ptr3+1 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 ; Exit code if strings are equal. a/x not set
@ -94,8 +94,8 @@ Equal1: rts
NotEqual: NotEqual:
bcs L3 bcs L3
ldx #$FF ; Make result negative ldx #$FF ; make result negative
rts rts
L3: ldx #$01 ; Make result positive L3: ldx #$01 ; make result positive
rts rts

View File

@ -16,7 +16,7 @@
_strupper: _strupper:
_strupr: _strupr:
sta ptr1 ; Save s (working copy) sta ptr1 ; save s (working copy)
stx ptr1+1 stx ptr1+1
sta ptr2 sta ptr2
stx ptr2+1 ; save function result stx ptr2+1 ; save function result
@ -24,7 +24,7 @@ _strupr:
loop: lda (ptr1),y ; get character loop: lda (ptr1),y ; get character
beq L9 ; jump if done beq L9 ; jump if done
jsr ctype_preprocessor_no_check jsr ctype_preprocessor_no_check
and #CT_LOWER ; lower case char? and #CT_LOWER ; lower case char?
beq L1 ; jump if no beq L1 ; jump if no
lda (ptr1),y ; fetch character again lda (ptr1),y ; fetch character again
@ -40,6 +40,3 @@ L1: iny ; next char
L9: lda ptr2 L9: lda ptr2
ldx ptr2+1 ldx ptr2+1
rts rts

View File

@ -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. ; Disable the TX/RX IRQ; set to 8E1.
lda #%11101 lda #%00011101
sta SERCTL sta SERCTL
; Clear all pending interrupts. ; Clear all pending interrupts.