mirror of
https://github.com/irmen/prog8.git
synced 2024-12-24 16:29:21 +00:00
lower() and upper() now also return the lenght of the processed string.
This commit is contained in:
parent
dd379430d9
commit
1c2e6f9e4c
@ -190,8 +190,8 @@ _found sty P8ZP_SCRATCH_B1
|
||||
}}
|
||||
}
|
||||
|
||||
asmsub lower(uword st @AY) {
|
||||
; Lowercases the petscii string in-place.
|
||||
asmsub lower(uword st @AY) -> ubyte @Y {
|
||||
; Lowercases the petscii string in-place. Returns length of the string.
|
||||
; (for efficiency, non-letter characters > 128 will also not be left intact,
|
||||
; but regular text doesn't usually contain those characters anyway.)
|
||||
%asm {{
|
||||
@ -213,8 +213,8 @@ _done rts
|
||||
}}
|
||||
}
|
||||
|
||||
asmsub upper(uword st @AY) {
|
||||
; Uppercases the petscii string in-place.
|
||||
asmsub upper(uword st @AY) -> ubyte @Y {
|
||||
; Uppercases the petscii string in-place. Returns length of the string.
|
||||
%asm {{
|
||||
sta P8ZP_SCRATCH_W1
|
||||
sty P8ZP_SCRATCH_W1+1
|
||||
|
@ -91,7 +91,7 @@ main {
|
||||
txt.print("is it a ")
|
||||
txt.print(animals[animal_number])
|
||||
txt.print("? ")
|
||||
txt.input_chars(userinput)
|
||||
void txt.input_chars(userinput)
|
||||
if userinput[0] == 'y' {
|
||||
txt.print("\n\nsee, i knew it!\n")
|
||||
return
|
||||
@ -99,18 +99,18 @@ main {
|
||||
|
||||
str name = "x"*30
|
||||
txt.print("\n\ni give up. what is it? ")
|
||||
txt.input_chars(name)
|
||||
void txt.input_chars(name)
|
||||
txt.print("\nwhat yes-no question would best articulate the difference\nbetween a ")
|
||||
txt.print(animals[animal_number])
|
||||
txt.print(" and a ")
|
||||
txt.print(name)
|
||||
txt.print("? ")
|
||||
txt.input_chars(userinput)
|
||||
void txt.input_chars(userinput)
|
||||
txt.print("\nfor a ")
|
||||
txt.print(name)
|
||||
txt.print(", what is the answer to that; yes or no? ")
|
||||
str answer = "x"*10
|
||||
txt.input_chars(answer)
|
||||
void txt.input_chars(answer)
|
||||
|
||||
animals[new_animal_number] = animal_names_ptr
|
||||
questions[new_question_number] = questions_ptr
|
||||
|
@ -1,11 +1,22 @@
|
||||
%import textio
|
||||
%import string
|
||||
%zeropage basicsafe
|
||||
%import test_stack
|
||||
%option no_sysinit
|
||||
|
||||
main {
|
||||
|
||||
sub start() {
|
||||
txt.print("♠♥♣♦π▚●○╳")
|
||||
ubyte xx=existing_entry(1,2)
|
||||
}
|
||||
|
||||
; TODO FIX COMPILER ERROR ABOUT MISSING RETURN
|
||||
|
||||
sub existing_entry(ubyte hash, uword symbol) -> ubyte {
|
||||
if hash>10
|
||||
return 44
|
||||
else
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user