Use code points instead of bytes for STRSUB/STRLEN

This commit is contained in:
dbrotz
2019-06-02 16:10:34 -07:00
parent f29d768989
commit 975f85260d
5 changed files with 148 additions and 10 deletions

9
test/asm/strlen.asm Normal file
View File

@@ -0,0 +1,9 @@
SECTION "sec", ROM0
xstrlen: MACRO
PRINTV STRLEN(\1)
PRINTT "\n"
ENDM
xstrlen "ABC"
xstrlen "カタカナ"

2
test/asm/strlen.out Normal file
View File

@@ -0,0 +1,2 @@
$3
$4

22
test/asm/strsub.asm Normal file
View File

@@ -0,0 +1,22 @@
SECTION "sec", ROM0
xstrsub: MACRO
PRINTT STRSUB(\1, \2, \3)
PRINTT "\n"
ENDM
xstrsub "ABC", 1, 1
xstrsub "ABC", 2, 1
xstrsub "ABC", 3, 1
xstrsub "ABC", 1, 2
xstrsub "ABC", 2, 2
xstrsub "ABC", 2, 32
xstrsub "ABC", 2, 300
xstrsub "ABC", 0, 300
xstrsub "ABC", 4, 0
xstrsub "ABC", 4, 1
xstrsub "カタカナ", 1, 2
xstrsub "カタカナ", 3, 2
xstrsub "カタカナ", 3, 10
xstrsub "g̈", 1, 1
xstrsub "g̈", 1, 2

31
test/asm/strsub.out Normal file
View File

@@ -0,0 +1,31 @@
warning: strsub.asm(13) -> xstrsub(1):
STRSUB: Length too big: 32
warning: strsub.asm(14) -> xstrsub(1):
STRSUB: Length too big: 300
warning: strsub.asm(15) -> xstrsub(1):
STRSUB: Position starts at 1
warning: strsub.asm(15) -> xstrsub(1):
STRSUB: Length too big: 300
warning: strsub.asm(16) -> xstrsub(1):
STRSUB: Position 4 is past the end of the string
warning: strsub.asm(17) -> xstrsub(1):
STRSUB: Position 4 is past the end of the string
warning: strsub.asm(17) -> xstrsub(1):
STRSUB: Length too big: 1
warning: strsub.asm(20) -> xstrsub(1):
STRSUB: Length too big: 10
A
B
C
AB
BC
BC
BC
ABC
カタ
カナ
カナ
g