fix string.isupper()

This commit is contained in:
Irmen de Jong 2023-12-05 23:52:43 +01:00
parent 745d192563
commit 3844bf1f72
2 changed files with 17 additions and 8 deletions

View File

@ -399,15 +399,21 @@ fail clc ; yes, no match found, return with c=0
}
asmsub isupper(ubyte character @A) -> bool @Pc {
; shifted petscii has 2 ranges that contain the upper case letters...
%asm {{
cmp #'A'
cmp #97
bcs +
rts
+ cmp #'Z'+1
bcc +
+ cmp #122+1
bcc _yes
cmp #193
bcs +
rts
+ cmp #218+1
bcc _yes
clc
rts
+ sec
_yes sec
rts
}}
}

View File

@ -261,13 +261,16 @@ Provides string manipulation routines.
Uppercases the PETSCII-string in place.
``lowerchar (char)``
Returns lowercased character.
Returns lowercased PETSCII character.
``upperchar (char)``
Returns uppercased character.
Returns uppercased PETSCII character.
``isdigit (char)``, ``islower (char)``, ``isupper (char)``, ``isletter (char)``
Returns boolean if the character is a numerical digit 0-0, lowercase letter, uppercase letter, or any letter.
``isdigit (char)``
Returns boolean if the character is a numerical digit 0-9
``islower (char)``, ``isupper (char)``, ``isletter (char)``
Returns boolean if the character is a shifted-PETSCII lowercase letter, uppercase letter, or any letter.
``startswith (string, prefix) -> bool``
Returns true if string starts with prefix, otherwise false