mirror of
https://github.com/byteworksinc/ORCALib.git
synced 2025-01-29 04:32:04 +00:00
Make strcat and strncat work properly when first string crosses a bank boundary.
Previously, the pointer was not properly updated to account for the bank crossing, so the characters from the second string would be written to the wrong bank. Here is an example that illustrates this: #include <memory.h> #include <string.h> #include <orca.h> #include <stdio.h> int main(void) { Handle hndl = NewHandle(0x1000f, userid(), 0xC000, 0); if (toolerror()) return 0; char *s = *hndl; s = (void*)((unsigned long)s | 0xffff); strcpy(s, "foo"); strcat(s, "bar"); strncat(s, "baz", 5); puts(s); }
This commit is contained in:
parent
bf3a4d7ceb
commit
b60c307ee6
@ -616,7 +616,9 @@ lb2 long M
|
||||
clc
|
||||
adc s1
|
||||
sta s1
|
||||
short M copy characters 'til the null is found
|
||||
bcc lb2a
|
||||
inc s1+2
|
||||
lb2a short M copy characters 'til the null is found
|
||||
ldy #0
|
||||
lb3 lda [s2],Y
|
||||
sta [s1],Y
|
||||
@ -1013,7 +1015,9 @@ lb2 long M
|
||||
clc
|
||||
adc s1
|
||||
sta s1
|
||||
short M copy characters 'til the null is found
|
||||
bcc lb2a
|
||||
inc s1+2
|
||||
lb2a short M copy characters 'til the null is found
|
||||
ldy #0
|
||||
ldx n
|
||||
beq lb4
|
||||
|
Loading…
x
Reference in New Issue
Block a user