aar.s 796 B

123456789101112131415161718192021222324252627282930313233343536
  1. .define .aar
  2. .sect .text
  3. .sect .rom
  4. .sect .data
  5. .sect .bss
  6. .sect .text
  7. ! (on entry d0 contains the integer size in the descriptor)
  8. .aar:
  9. cmp.l #4, d0
  10. beq 9f
  11. move.l #EILLINS, -(sp)
  12. jmp .fatal
  13. 9:
  14. ! register usage:
  15. ! a0: descriptor address
  16. ! a1: base address
  17. ! d0: index
  18. ! The address is calculated by taking the relative index
  19. ! (index - lower bound), multiplying that with the element
  20. ! size and adding the result to the array base address.
  21. move.l (sp)+,a1 ! return address
  22. move.l (sp)+, a0 ! descriptor address
  23. move.l (sp)+, d0 ! index
  24. sub.l (a0), d0 ! relative index
  25. move.l a1,-(sp)
  26. move.l d0, -(sp)
  27. move.l 8(a0), -(sp) ! # bytes / element
  28. jsr .mlu
  29. move.l (sp)+,a1
  30. move.l (sp)+, a0 ! array base address
  31. lea 0(a0, d1.l), a0 ! address of array element
  32. jmp (a1)
  33. .align 2