@@ -99,17 +99,30 @@ _c.__DATA__:
9999 DEFB 6Ch
100100 DEFB 64h
101101 ;; --- end of user code ---
102- #line 1 "/zxbasic/src/lib/arch/zx48k/runtime/storestr.asm"
103- ; vim:ts=4:et:sw=4
104- ; Stores value of current string pointed by DE register into address pointed by HL
105- ; Returns DE = Address pointer (&a$)
106- ; Returns HL = HL (b$ => might be needed later to free it from the heap)
107- ;
108- ; e.g. => HL = _variableName (DIM _variableName$)
109- ; DE = Address into the HEAP
110- ;
111- ; This function will resize (REALLOC) the space pointed by HL
112- ; before copying the content of b$ into a$
102+ #line 1 "/zxbasic/src/lib/arch/zx48k/runtime/array/strarraycpy.asm"
103+ ; (K)opyleft - by Jose M. Rodriguez de la Rosa (a.k.a. Boriel)
104+ ; 2009 - This is Free OpenSource BSD code
105+ ; vim: et:ts=4:sw=4
106+ ; Copies a vector of strings from one place to another
107+ ; reallocating strings of the destiny vector to hold source strings.
108+ ; This is used in the following code:
109+ ; DIM a$(20) : DIM b$(20): a$ = b$
110+ #line 1 "/zxbasic/src/lib/arch/zx48k/runtime/lddede.asm"
111+ ; Loads DE into DE
112+ ; Modifies C register
113+ ; There is a routine similar to this one
114+ ; at ROM address L2AEE
115+ push namespace core
116+ __LOAD_DE_DE:
117+ ex de , hl
118+ ld c , (hl)
119+ inc hl
120+ ld h , (hl)
121+ ld l , c
122+ ex de , hl
123+ ret
124+ pop namespace
125+ #line 11 "/zxbasic/src/lib/arch/zx48k/runtime/array/strarraycpy.asm"
113126#line 1 "/zxbasic/src/lib/arch/zx48k/runtime/strcpy.asm"
114127#line 1 "/zxbasic/src/lib/arch/zx48k/runtime/realloc.asm"
115128; vim: ts=4:et:sw=4:
@@ -780,58 +793,7 @@ __NOTHING_TO_COPY:
780793 ret
781794 ENDP
782795 pop namespace
783- #line 14 "/zxbasic/src/lib/arch/zx48k/runtime/storestr.asm"
784- push namespace core
785- __PISTORE_STR: ; Indirect assignment at (IX + BC)
786- push ix
787- pop hl
788- add hl , bc
789- __ISTORE_STR: ; Indirect assignment, hl point to a pointer to a pointer to the heap!
790- ld c , (hl)
791- inc hl
792- ld h , (hl)
793- ld l , c ; HL = (HL)
794- __STORE_STR:
795- push de ; Pointer to b$
796- push hl ; Pointer to a$
797- ld c , (hl)
798- inc hl
799- ld h , (hl)
800- ld l , c ; HL = (HL)
801- call __STRASSIGN ; HL (a$) = DE (b$); HL changed to a new dynamic memory allocation
802- ex de , hl ; DE = new address of a$
803- pop hl ; Recover variable memory address pointer
804- ld (hl) , e
805- inc hl
806- ld (hl) , d ; Stores a$ ptr into element ptr
807- pop hl ; Returns ptr to b$ in HL (Caller might needed to free it from memory)
808- ret
809- pop namespace
810- #line 40 "arch/zx48k/arraycopy5.bas"
811- #line 1 "/zxbasic/src/lib/arch/zx48k/runtime/strarraycpy.asm"
812- ; (K)opyleft - by Jose M. Rodriguez de la Rosa (a.k.a. Boriel)
813- ; 2009 - This is Free OpenSource BSD code
814- ; vim: et:ts=4:sw=4
815- ; Copies a vector of strings from one place to another
816- ; reallocating strings of the destiny vector to hold source strings.
817- ; This is used in the following code:
818- ; DIM a$(20) : DIM b$(20): a$ = b$
819- #line 1 "/zxbasic/src/lib/arch/zx48k/runtime/lddede.asm"
820- ; Loads DE into DE
821- ; Modifies C register
822- ; There is a routine similar to this one
823- ; at ROM address L2AEE
824- push namespace core
825- __LOAD_DE_DE:
826- ex de , hl
827- ld c , (hl)
828- inc hl
829- ld h , (hl)
830- ld l , c
831- ex de , hl
832- ret
833- pop namespace
834- #line 11 "/zxbasic/src/lib/arch/zx48k/runtime/strarraycpy.asm"
796+ #line 12 "/zxbasic/src/lib/arch/zx48k/runtime/array/strarraycpy.asm"
835797 push namespace core
836798STR_ARRAYCOPY:
837799 ; Copies an array of string a$ = b$
@@ -877,5 +839,43 @@ LOOP:
877839 jp LOOP
878840 ENDP
879841 pop namespace
842+ #line 40 "arch/zx48k/arraycopy5.bas"
843+ #line 1 "/zxbasic/src/lib/arch/zx48k/runtime/storestr.asm"
844+ ; vim:ts=4:et:sw=4
845+ ; Stores value of current string pointed by DE register into address pointed by HL
846+ ; Returns DE = Address pointer (&a$)
847+ ; Returns HL = HL (b$ => might be needed later to free it from the heap)
848+ ;
849+ ; e.g. => HL = _variableName (DIM _variableName$)
850+ ; DE = Address into the HEAP
851+ ;
852+ ; This function will resize (REALLOC) the space pointed by HL
853+ ; before copying the content of b$ into a$
854+ push namespace core
855+ __PISTORE_STR: ; Indirect assignment at (IX + BC)
856+ push ix
857+ pop hl
858+ add hl , bc
859+ __ISTORE_STR: ; Indirect assignment, hl point to a pointer to a pointer to the heap!
860+ ld c , (hl)
861+ inc hl
862+ ld h , (hl)
863+ ld l , c ; HL = (HL)
864+ __STORE_STR:
865+ push de ; Pointer to b$
866+ push hl ; Pointer to a$
867+ ld c , (hl)
868+ inc hl
869+ ld h , (hl)
870+ ld l , c ; HL = (HL)
871+ call __STRASSIGN ; HL (a$) = DE (b$); HL changed to a new dynamic memory allocation
872+ ex de , hl ; DE = new address of a$
873+ pop hl ; Recover variable memory address pointer
874+ ld (hl) , e
875+ inc hl
876+ ld (hl) , d ; Stores a$ ptr into element ptr
877+ pop hl ; Returns ptr to b$ in HL (Caller might needed to free it from memory)
878+ ret
879+ pop namespace
880880#line 41 "arch/zx48k/arraycopy5.bas"
881881 END
0 commit comments