ack/mach/z80/libem/lar.s

55 lines
693 B
ArmAsm
Raw Normal View History

1985-03-29 21:44:50 +00:00
.define .lar
1987-02-02 13:30:20 +00:00
.sect .text
.sect .rom
.sect .data
.sect .bss
.sect .text
1985-03-29 21:44:50 +00:00
! use .mli2
! 2-byte descriptor elements
! any size array elements
! parameters:
! on stack
! uses .mli2
! no range checking
! adapted from .aar and .los
.lar:
pop hl
pop ix
ex (sp),hl
ld c,(ix+0)
ld b,(ix+1)
xor a
sbc hl,bc
ld c,(ix+4)
ld b,(ix+5)
ex de,hl
call .mli2
pop ix
pop de
add hl,de ! address of array element
add hl,bc
dec hl ! pointer to highest byte of element
srl b
rr c
jr nc,1f
ld a,c ! skip check to save runtime
or b
jr nz,.trp.z ! size was odd but <> 1
ld c,(hl)
push bc
jp (ix)
1: ld d,(hl)
dec hl
ld e,(hl)
dec hl
push de
dec bc
ld a,b
or c
jr nz,1b
jp (ix)