Time for an 2014 update…
This commit is contained in:
parent
372c577f83
commit
09687c4926
2520 changed files with 34227 additions and 7318 deletions
|
|
@ -15,37 +15,37 @@
|
|||
;------------------------------------------------------
|
||||
; Constant Section
|
||||
;
|
||||
StrPtr = $6 0-page temp pointer (2 bytes)
|
||||
Low = $8 0-page temp low bound
|
||||
High = $9 0-page temp high bound
|
||||
CharOut = $fded Specific to the Apple II
|
||||
BigA = "A" 'A' for normal ascii
|
||||
BigZ = "Z" 'Z' " " "
|
||||
LittleA = "a" 'a' " " "
|
||||
LittleZ = "z" 'z' " " "
|
||||
StrPtr = $6 ;0-page temp pointer (2 bytes)
|
||||
Low = $8 ;0-page temp low bound
|
||||
High = $9 ;0-page temp high bound
|
||||
CharOut = $fded ;Specific to the Apple II
|
||||
BigA = "A" ;'A' for normal ascii
|
||||
BigZ = "Z" ;'Z' " " "
|
||||
LittleA = "a" ;'a' " " "
|
||||
LittleZ = "z" ;'z' " " "
|
||||
;======================================================
|
||||
.or $0f00
|
||||
;------------------------------------------------------
|
||||
; The main program
|
||||
;
|
||||
main ldx #sTest Point to the test string
|
||||
main ldx #sTest ;Point to the test string
|
||||
lda /sTest
|
||||
jsr puts print it to stdout
|
||||
jsr toUpper convert to UPPER-case
|
||||
jsr puts print it
|
||||
jsr toLower convert to lower-case
|
||||
jmp puts print it and return to caller
|
||||
jsr puts ;print it to stdout
|
||||
jsr toUpper ;convert to UPPER-case
|
||||
jsr puts ;print it
|
||||
jsr toLower ;convert to lower-case
|
||||
jmp puts ;print it and return to caller
|
||||
;------------------------------------------------------
|
||||
toUpper ldy #LittleA
|
||||
sty Low set up the flip range
|
||||
sty Low ;set up the flip range
|
||||
ldy #LittleZ
|
||||
bne toLow2 return via toLower's tail
|
||||
bne toLow2 ;return via toLower's tail
|
||||
;------------------------------------------------------
|
||||
toLower ldy #BigA
|
||||
sty Low set up the flip range
|
||||
sty Low ;set up the flip range
|
||||
ldy #BigZ
|
||||
toLow2 sty High
|
||||
; return via fall-thru to flip
|
||||
; ;return via fall-thru to flip
|
||||
;------------------------------------------------------
|
||||
; Given a NUL-terminated string at A:X, flip the case
|
||||
; of any chars in the range [Low..High], inclusive;
|
||||
|
|
@ -54,23 +54,23 @@ toLow2 sty High
|
|||
; Preserves: A, X
|
||||
; Trashes: Y
|
||||
;
|
||||
flip stx StrPtr init string pointer
|
||||
flip stx StrPtr ;init string pointer
|
||||
sta StrPtr+1
|
||||
ldy #0
|
||||
pha save A
|
||||
flip2 lda (StrPtr),y get string char
|
||||
beq flip5 done if NUL
|
||||
pha ;save A
|
||||
flip2 lda (StrPtr),y ;get string char
|
||||
beq flip5 ;done if NUL
|
||||
cmp Low
|
||||
bcc flip4 if Low <= char <= High
|
||||
bcc flip4 ;if Low <= char <= High
|
||||
cmp High
|
||||
beq flip3
|
||||
bcs flip4
|
||||
flip3 eor #$20 then flip the case
|
||||
flip3 eor #$20 ; then flip the case
|
||||
sta (StrPtr),y
|
||||
flip4 iny point to next char
|
||||
bne flip2 loop up to 255 times
|
||||
flip5 pla restore A
|
||||
rts return
|
||||
flip4 iny ;point to next char
|
||||
bne flip2 ;loop up to 255 times
|
||||
flip5 pla ;restore A
|
||||
rts ;return
|
||||
;------------------------------------------------------
|
||||
; Output NUL-terminated string @ A:X; strings longer
|
||||
; than 256 bytes are truncated there
|
||||
|
|
@ -78,17 +78,17 @@ flip5 pla restore A
|
|||
; Preserves: A, X
|
||||
; Trashes: Y
|
||||
;
|
||||
puts stx StrPtr init string pointer
|
||||
puts stx StrPtr ;init string pointer
|
||||
sta StrPtr+1
|
||||
ldy #0
|
||||
pha save A
|
||||
puts2 lda (StrPtr),y get string char
|
||||
beq puts3 done if NUL
|
||||
jsr CharOut output the char
|
||||
iny point to next char
|
||||
bne puts2 loop up to 255 times
|
||||
puts3 pla restore A
|
||||
rts return
|
||||
pha ;save A
|
||||
puts2 lda (StrPtr),y ;get string char
|
||||
beq puts3 ;done if NUL
|
||||
jsr CharOut ;output the char
|
||||
iny ;point to next char
|
||||
bne puts2 ;loop up to 255 times
|
||||
puts3 pla ;restore A
|
||||
rts ;return
|
||||
;------------------------------------------------------
|
||||
; Test String (in '+128' ascii, Apple II style)
|
||||
;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue