Skip to content

Commit 9cd6648

Browse files
committed
use 0xFB0000-0xFFFFFF for zero filling in calloc
1 parent 194187f commit 9cd6648

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/libc/calloc.src

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,12 @@ _calloc:
3434
jr c, .L.zero_size
3535
inc bc
3636
ex de, hl ; DE = dst
37-
; uses the all zeros address range $E40000-$EFFFFF on the Ti84CE
38-
ld hl, $EFFFFF ; HL = src
37+
; uses an all zeros address range $FB0000-$FFFFFF on the Ti84CE (327680 bytes)
38+
; $FF0000-$FFFFFF (65536 bytes) has 1 wait state.
39+
; $FB0000-$FEFFFF has 2 wait states, but a calloc larger than 65536 bytes is basically never.
40+
; Since we are only reading zeros, writing to this address range should not interfere with CEmu.
41+
scf
42+
sbc hl, hl ; HL = src
3943
lddr
4044
ex de, hl
4145
.L.zero_size:

0 commit comments

Comments
 (0)