Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions library-asm/array.asm
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ __ARRAY:
inc hl ; Ready
exx

ld hl, 0 ; BC = Offset "accumulator"
ld hl, 0 ; HL = Offset "accumulator"

LOOP:
#ifdef __CHECK_ARRAY_BOUNDARY__
Expand Down Expand Up @@ -75,26 +75,24 @@ LOOP:

call __FNMUL
jp LOOP

ARRAY_END:
ld e, (hl)
ld a, (hl)
inc hl
ld d, c ; C = 0 => DE = E = Element size
push hl
push de
exx

#ifdef __BIG_ARRAY__
pop de
ld d, 0
ld e, a
call __FNMUL
#else
LOCAL ARRAY_SIZE_LOOP

ex de, hl
ld hl, 0
pop bc
ld b, c
ARRAY_SIZE_LOOP:
ld b, a
ARRAY_SIZE_LOOP:
add hl, de
djnz ARRAY_SIZE_LOOP

Expand All @@ -111,8 +109,10 @@ RET_ADDRESS:

__FNMUL:
xor a
or d
or h
jp nz, __MUL16_FAST
or l
ret z

cp 33
jp nc, __MUL16_FAST
Expand Down
23 changes: 11 additions & 12 deletions tests/functional/46.asm
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ __MUL16NOADD:

#line 20 "array.asm"

#line 24 "/zxbasic/library-asm/array.asm"
#line 24 "/home/boriel/src/zxbasic/zxbasic/library-asm/array.asm"

__ARRAY:
PROC
Expand All @@ -117,13 +117,13 @@ __ARRAY:
inc hl ; Ready
exx

ld hl, 0 ; BC = Offset "accumulator"
ld hl, 0 ; HL = Offset "accumulator"

LOOP:
#line 49 "/zxbasic/library-asm/array.asm"
#line 49 "/home/boriel/src/zxbasic/zxbasic/library-asm/array.asm"
pop bc ; Get next index (Ai) from the stack

#line 59 "/zxbasic/library-asm/array.asm"
#line 59 "/home/boriel/src/zxbasic/zxbasic/library-asm/array.asm"

add hl, bc ; Adds current index

Expand All @@ -145,25 +145,22 @@ LOOP:
jp LOOP

ARRAY_END:
ld e, (hl)
ld a, (hl)
inc hl
ld d, c ; C = 0 => DE = E = Element size
push hl
push de
exx

#line 91 "/zxbasic/library-asm/array.asm"
#line 90 "/home/boriel/src/zxbasic/zxbasic/library-asm/array.asm"
LOCAL ARRAY_SIZE_LOOP

ex de, hl
ld hl, 0
pop bc
ld b, c
ld b, a
ARRAY_SIZE_LOOP:
add hl, de
djnz ARRAY_SIZE_LOOP

#line 102 "/zxbasic/library-asm/array.asm"
#line 100 "/home/boriel/src/zxbasic/zxbasic/library-asm/array.asm"

pop de
add hl, de ; Adds element start
Expand All @@ -176,8 +173,10 @@ RET_ADDRESS:

__FNMUL:
xor a
or d
or h
jp nz, __MUL16_FAST
or l
ret z

cp 33
jp nc, __MUL16_FAST
Expand Down
17 changes: 8 additions & 9 deletions tests/functional/47.asm
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ __ARRAY:
inc hl ; Ready
exx

ld hl, 0 ; BC = Offset "accumulator"
ld hl, 0 ; HL = Offset "accumulator"

LOOP:
#line 49 "/zxbasic/library-asm/array.asm"
Expand Down Expand Up @@ -172,25 +172,22 @@ LOOP:
jp LOOP

ARRAY_END:
ld e, (hl)
ld a, (hl)
inc hl
ld d, c ; C = 0 => DE = E = Element size
push hl
push de
exx

#line 91 "/zxbasic/library-asm/array.asm"
#line 90 "/zxbasic/library-asm/array.asm"
LOCAL ARRAY_SIZE_LOOP

ex de, hl
ld hl, 0
pop bc
ld b, c
ld b, a
ARRAY_SIZE_LOOP:
add hl, de
djnz ARRAY_SIZE_LOOP

#line 102 "/zxbasic/library-asm/array.asm"
#line 100 "/zxbasic/library-asm/array.asm"

pop de
add hl, de ; Adds element start
Expand All @@ -203,8 +200,10 @@ RET_ADDRESS:

__FNMUL:
xor a
or d
or h
jp nz, __MUL16_FAST
or l
ret z

cp 33
jp nc, __MUL16_FAST
Expand Down
23 changes: 11 additions & 12 deletions tests/functional/55.asm
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ __MUL16NOADD:

#line 20 "array.asm"

#line 24 "/zxbasic/library-asm/array.asm"
#line 24 "/home/boriel/src/zxbasic/zxbasic/library-asm/array.asm"

__ARRAY:
PROC
Expand All @@ -112,13 +112,13 @@ __ARRAY:
inc hl ; Ready
exx

ld hl, 0 ; BC = Offset "accumulator"
ld hl, 0 ; HL = Offset "accumulator"

LOOP:
#line 49 "/zxbasic/library-asm/array.asm"
#line 49 "/home/boriel/src/zxbasic/zxbasic/library-asm/array.asm"
pop bc ; Get next index (Ai) from the stack

#line 59 "/zxbasic/library-asm/array.asm"
#line 59 "/home/boriel/src/zxbasic/zxbasic/library-asm/array.asm"

add hl, bc ; Adds current index

Expand All @@ -140,25 +140,22 @@ LOOP:
jp LOOP

ARRAY_END:
ld e, (hl)
ld a, (hl)
inc hl
ld d, c ; C = 0 => DE = E = Element size
push hl
push de
exx

#line 91 "/zxbasic/library-asm/array.asm"
#line 90 "/home/boriel/src/zxbasic/zxbasic/library-asm/array.asm"
LOCAL ARRAY_SIZE_LOOP

ex de, hl
ld hl, 0
pop bc
ld b, c
ld b, a
ARRAY_SIZE_LOOP:
add hl, de
djnz ARRAY_SIZE_LOOP

#line 102 "/zxbasic/library-asm/array.asm"
#line 100 "/home/boriel/src/zxbasic/zxbasic/library-asm/array.asm"

pop de
add hl, de ; Adds element start
Expand All @@ -171,8 +168,10 @@ RET_ADDRESS:

__FNMUL:
xor a
or d
or h
jp nz, __MUL16_FAST
or l
ret z

cp 33
jp nc, __MUL16_FAST
Expand Down
27 changes: 13 additions & 14 deletions tests/functional/aloadstr1.asm
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ __MUL16NOADD:

#line 20 "array.asm"

#line 24 "/zxbasic/library-asm/array.asm"
#line 24 "/home/boriel/src/zxbasic/zxbasic/library-asm/array.asm"

__ARRAY:
PROC
Expand All @@ -115,13 +115,13 @@ __ARRAY:
inc hl ; Ready
exx

ld hl, 0 ; BC = Offset "accumulator"
ld hl, 0 ; HL = Offset "accumulator"

LOOP:
#line 49 "/zxbasic/library-asm/array.asm"
#line 49 "/home/boriel/src/zxbasic/zxbasic/library-asm/array.asm"
pop bc ; Get next index (Ai) from the stack

#line 59 "/zxbasic/library-asm/array.asm"
#line 59 "/home/boriel/src/zxbasic/zxbasic/library-asm/array.asm"

add hl, bc ; Adds current index

Expand All @@ -143,25 +143,22 @@ LOOP:
jp LOOP

ARRAY_END:
ld e, (hl)
ld a, (hl)
inc hl
ld d, c ; C = 0 => DE = E = Element size
push hl
push de
exx

#line 91 "/zxbasic/library-asm/array.asm"
#line 90 "/home/boriel/src/zxbasic/zxbasic/library-asm/array.asm"
LOCAL ARRAY_SIZE_LOOP

ex de, hl
ld hl, 0
pop bc
ld b, c
ld b, a
ARRAY_SIZE_LOOP:
add hl, de
djnz ARRAY_SIZE_LOOP

#line 102 "/zxbasic/library-asm/array.asm"
#line 100 "/home/boriel/src/zxbasic/zxbasic/library-asm/array.asm"

pop de
add hl, de ; Adds element start
Expand All @@ -174,8 +171,10 @@ RET_ADDRESS:

__FNMUL:
xor a
or d
or h
jp nz, __MUL16_FAST
or l
ret z

cp 33
jp nc, __MUL16_FAST
Expand Down Expand Up @@ -470,9 +469,9 @@ __MEM_START:
__MEM_LOOP: ; Loads lengh at (HL, HL+). If Lenght >= BC, jump to __MEM_DONE
ld a, h ; HL = NULL (No memory available?)
or l
#line 111 "/zxbasic/library-asm/alloc.asm"
#line 111 "/home/boriel/src/zxbasic/zxbasic/library-asm/alloc.asm"
ret z ; NULL
#line 113 "/zxbasic/library-asm/alloc.asm"
#line 113 "/home/boriel/src/zxbasic/zxbasic/library-asm/alloc.asm"
; HL = Pointer to Free block
ld e, (hl)
inc hl
Expand Down
23 changes: 11 additions & 12 deletions tests/functional/array03.asm
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ __MUL16NOADD:

#line 20 "array.asm"

#line 24 "/zxbasic/library-asm/array.asm"
#line 24 "/home/boriel/src/zxbasic/zxbasic/library-asm/array.asm"

__ARRAY:
PROC
Expand All @@ -110,13 +110,13 @@ __ARRAY:
inc hl ; Ready
exx

ld hl, 0 ; BC = Offset "accumulator"
ld hl, 0 ; HL = Offset "accumulator"

LOOP:
#line 49 "/zxbasic/library-asm/array.asm"
#line 49 "/home/boriel/src/zxbasic/zxbasic/library-asm/array.asm"
pop bc ; Get next index (Ai) from the stack

#line 59 "/zxbasic/library-asm/array.asm"
#line 59 "/home/boriel/src/zxbasic/zxbasic/library-asm/array.asm"

add hl, bc ; Adds current index

Expand All @@ -138,25 +138,22 @@ LOOP:
jp LOOP

ARRAY_END:
ld e, (hl)
ld a, (hl)
inc hl
ld d, c ; C = 0 => DE = E = Element size
push hl
push de
exx

#line 91 "/zxbasic/library-asm/array.asm"
#line 90 "/home/boriel/src/zxbasic/zxbasic/library-asm/array.asm"
LOCAL ARRAY_SIZE_LOOP

ex de, hl
ld hl, 0
pop bc
ld b, c
ld b, a
ARRAY_SIZE_LOOP:
add hl, de
djnz ARRAY_SIZE_LOOP

#line 102 "/zxbasic/library-asm/array.asm"
#line 100 "/home/boriel/src/zxbasic/zxbasic/library-asm/array.asm"

pop de
add hl, de ; Adds element start
Expand All @@ -169,8 +166,10 @@ RET_ADDRESS:

__FNMUL:
xor a
or d
or h
jp nz, __MUL16_FAST
or l
ret z

cp 33
jp nc, __MUL16_FAST
Expand Down
Loading