aar2.s 451 B

12345678910111213141516171819202122232425262728
  1. .define .aar2
  2. .sect .text
  3. .sect .rom
  4. .sect .data
  5. .sect .bss
  6. .sect .text
  7. ! special case aar: element size = 2 (statically known)
  8. ! parameters:
  9. ! on stack
  10. ! execution time: 124 states
  11. .aar2:
  12. pop ix ! save return address
  13. pop hl ! pointer to descriptor
  14. ld c,(hl) ! bc := lower bound
  15. inc hl
  16. ld b,(hl)
  17. pop hl ! index
  18. xor a
  19. sbc hl,bc ! index - lwb
  20. add hl,hl ! size*(index-lwb)
  21. pop de ! base address of array
  22. add hl,de
  23. push hl
  24. jp (ix)