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
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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

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.
lda #%11101
lda #%00011101
sta SERCTL
; Clear all pending interrupts.