But to the point: To the best of my knowledge there may be a bug in the combination/interaction of crt_section.asm and asm_memcpy.asm where the latter is located in libsrc\_DEVELOPMENT (indicating it belongs to new_lib?). When initialization of data (i.e. c defined variables with an initial value) shall execute, the crt_section assigns pointers to hl and de, and length in bc. But the call to asm_memcopy appears to do nothing.
Code: Select all
ld hl,__ROMABLE_END_tail
ld de,__DATA_head
ld bc,__DATA_END_tail - __DATA_head
EXTERN asm_memcpy
call asm_memcpy
My workaround in crt_section.asm (skips the call to asm_memcpy and does the work itself):
Code: Select all
IF ( __crt_model = 1 )
; Just copy the DATA section
EXTERN __ROMABLE_END_tail
EXTERN __DATA_head
EXTERN __DATA_END_tail
; ## BUG Calling asm_memcpy in _DEVELOPMENT (new_lib) renders ##
; ## faulty code for Intel CPU, hence conditional replacement ##
IF !__CPU_INTEL__
ld hl,__ROMABLE_END_tail
ld de,__DATA_head
ld bc,__DATA_END_tail - __DATA_head
EXTERN asm_memcpy
call asm_memcpy
ELSE
ld hl,__ROMABLE_END_tail + 1
ld de,__DATA_head + 1
ld bc,__DATA_END_tail - __DATA_head - 1
datacpy:
ld a,b
or c
ret z
ld a,(hl)
ld (de),a
inc hl
inc de
dec bc
jp datacpy
ENDIF
ELIF ( __crt_model >= 2 )
...etc...
My best regards to all contributors to the z88dk /A.