ack/mach/i80/libem/aar2.s

48 lines
793 B
ArmAsm
Raw Permalink Normal View History

1985-03-18 12:46:51 +00:00
.define .aar2
1987-01-28 18:57:04 +00:00
.sect .text
.sect .rom
.sect .data
.sect .bss
.sect .text
1985-03-18 12:46:51 +00:00
! Load address of array element, decriptor contains 2-bytes integers
! Expects on stack: pointer to array descriptor
! index
! base address
! Yields on stack: address of array element
.aar2:
pop h
shld .retadr1
mov h,b
mov l,c
shld .bcreg
pop h ! hl = pointer to descriptor
pop d ! de = index
mov a,e ! bc = index - lower bound
sub m
inx h
mov c,a
mov a,d
sbb m
inx h
mov b,a
push b ! first operand to multiply
inx h
inx h
mov c,m ! bc = size
inx h
mov b,m
push b ! second operand to multiply
call .mli2 ! de = size * (index - lower bound)
pop h ! hl = base address
dad d ! hl = address of array[index]
push h
lhld .bcreg
mov b,h
mov c,l
lhld .retadr1
pchl