File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2222#include once <error.asm>
2323#endif
2424
25+ __ARRAY_PTR: ;; computes an array offset from a pointer
26+ ld c , (hl)
27+ inc hl
28+ ld h , (hl)
29+ ld l , c
30+
2531__ARRAY:
2632 PROC
2733
2834 LOCAL LOOP
2935 LOCAL ARRAY_END
3036 LOCAL RET_ADDRESS ; Stores return address
37+ LOCAL TMP_ARR_PTR ; Stores pointer temporarily
3138
39+ ld e , (hl)
40+ inc hl
41+ ld d , (hl)
42+ inc hl
43+ ld (TMP_ARR_PTR) , hl
44+ ex de , hl
3245 ex ( sp ) , hl ; Return address in HL, array address in the stack
3346 ld (RET_ADDRESS + 1 ) , hl ; Stores it for later
3447
7891
7992ARRAY_END:
8093 ld a , (hl)
81- inc hl
82- push hl
8394 exx
8495
8596#ifdef __BIG_ARRAY__
@@ -98,7 +109,12 @@ ARRAY_SIZE_LOOP:
98109
99110#endif
100111
101- pop de
112+ ex de , hl
113+ ld hl , (TMP_ARR_PTR)
114+ ld a , (hl)
115+ inc hl
116+ ld h , (hl)
117+ ld l , a
102118 add hl , de ; Adds element start
103119
104120RET_ADDRESS:
@@ -125,5 +141,8 @@ __FNMUL2:
125141 djnz __FNMUL2
126142 ret
127143
144+ TMP_ARR_PTR:
145+ DW 0 ; temporary storage for pointer to tables
146+
128147 ENDP
129148
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ __ARRAY_FREE:
1313 pop hl ; (ret address)
1414 ex ( sp ) , hl ; Callee -> HL = Number of elements
1515
16- ex de , hl
16+ ex de , hl
1717
1818__ARRAY_FREE_FAST: ; Fastcall entry: DE = Number of elements
1919 ld a , h
@@ -23,15 +23,6 @@ __ARRAY_FREE_FAST: ; Fastcall entry: DE = Number of elements
2323 ld b , d
2424 ld c , e
2525
26- ld e , (hl)
27- inc hl
28- ld d , (hl)
29- inc hl ; DE = Number of dimensions
30- ex de , hl
31- add hl , hl ; HL = HL * 2
32- add hl , de
33- inc hl ; HL now points to the element start
34-
3526__ARRAY_LOOP:
3627 ld e , (hl)
3728 inc hl
You can’t perform that action at this time.
0 commit comments