ack/mach/z80/libem/aar.s

36 lines
696 B
ArmAsm
Raw Normal View History

1985-03-29 21:44:50 +00:00
.define .aar
! use .mli2
! 2-byte descriptor elements
! any size array elements
! no range checking
! parameters:
! stack: pointer to descriptor
! index
! base address of array
! stack: result (out)
! uses .mli2 routine
! side-effect: size of array elements in bc
.aar:
pop hl ! return address
pop ix ! pointer to descr.
ex (sp),hl ! save ret. addr.
! hl := index
ld c,(ix+0) ! bc := lower bound
ld b,(ix+1)
xor a
sbc hl,bc ! hl := index-lwb
ld c,(ix+4) ! bc := size
ld b,(ix+5)
ex de,hl ! de := index-lwb
call .mli2 ! hl := bc*de =
! size*(index-lwb)
pop ix ! return address
pop de ! base
add hl,de ! addr. of element
push hl
jp (ix) ! return