-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #457 from paulscottrobson/case
Case conversion added to BASIC
- Loading branch information
Showing
8 changed files
with
85 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
; ************************************************************************************************ | ||
; ************************************************************************************************ | ||
; | ||
; Name: upperlower.asm | ||
; Purpose: Convert string to upper/lower case | ||
; Created: 15th April 2024 | ||
; Reviewed: No | ||
; Author: Paul Robson ([email protected]) | ||
; | ||
; ************************************************************************************************ | ||
; ************************************************************************************************ | ||
|
||
.section code | ||
|
||
; ************************************************************************************************ | ||
; | ||
; UPPER$() and LOWER$() function | ||
; | ||
; ************************************************************************************************ | ||
|
||
UnaryUpper: ;; [upper$(] | ||
clc | ||
bra CaseConversion | ||
UnaryLower: ;; [lower$(] | ||
sec | ||
CaseConversion: | ||
php ; carry flag set lower, clear upper. | ||
jsr EXPEvalString ; string to zTemp0 | ||
jsr ERRCheckRParen | ||
|
||
lda (zTemp0) ; allocate space for whole string | ||
jsr StringTempAllocate | ||
|
||
plp ; save position, put the conversion flag on TOS though | ||
phy | ||
php | ||
ldy #0 ; start of string pre decrement | ||
_CCLoop: | ||
cmp (zTemp0) ; exit if reached length. | ||
beq _CCDone | ||
iny ; increment as length prefixed. | ||
|
||
lda (zTemp0),y ; first make it upper case anyway. | ||
cmp #"a" | ||
bcc _CCNotLower | ||
cmp #"z"+1 | ||
bcs _CCNotLower | ||
eor #$20 | ||
_CCNotLower: | ||
plp ; test flag. | ||
php | ||
bcc _CCOutput ; if going to upper, already done. | ||
|
||
cmp #"A" ; test if upper case | ||
bcc _CCOutput | ||
cmp #"Z"+1 | ||
bcs _CCOutput | ||
eor #$20 ; if so make lower case. | ||
|
||
_CCOutput: | ||
jsr StringTempWrite ; write to string. | ||
bra _CCLoop | ||
|
||
_CCDone: | ||
ply ; throw conversion flag. | ||
ply ; restore Y and exit | ||
rts | ||
|
||
.send code | ||
|
||
; ************************************************************************************************ | ||
; | ||
; Changes and Updates | ||
; | ||
; ************************************************************************************************ | ||
; | ||
; Date Notes | ||
; ==== ===== | ||
; | ||
; ************************************************************************************************ |
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,3 @@ | ||
' | ||
' BASIC Mouse cursor manipulation | ||
' | ||
mouse show | ||
mouse cursor 2 | ||
cls:line 0,0 ink 3 to 100,100 | ||
mouse to 260,180 | ||
repeat | ||
b = mouse(x,y,s) | ||
print chr$(20);x;" ";y;" ";b;" ";s;" " | ||
until false | ||
end | ||
' | ||
proc send.message(g,f) | ||
while peek($FF00):wend | ||
poke $FF01,f:poke $FF00,g | ||
while peek($FF00):wend | ||
endproc | ||
a$ = "Hello world" | ||
print "[";upper$(a$);"]" | ||
print "[";lower$(a$);"]" |
Binary file not shown.
Binary file not shown.