aar.s 676 B

123456789101112131415161718192021222324252627282930313233343536
  1. .define Aar
  2. .sect .text
  3. .sect .rom
  4. .sect .data
  5. .sect .bss
  6. .sect .text
  7. ! This subroutine gets the address of the array element
  8. Aar:
  9. stx ADDR ! address of descriptor (lowbyte)
  10. sta ADDR+1 ! address of descriptor (highbyte)
  11. ldy #0
  12. lda (ADDR),y ! lowerbound (lowbyte)
  13. tax
  14. iny
  15. lda (ADDR),y ! lowerbound (highbyte)
  16. jsr Sbi2 ! index - lowerbound
  17. jsr Push
  18. 2: ldy #4
  19. lda (ADDR),y ! objectsize (lowbyte)
  20. sta NBYTES
  21. tax
  22. iny
  23. lda (ADDR),y ! objectsize (highbyte)
  24. sta NBYTES+1
  25. bne 5f
  26. cpx #1 ! objectsize = 1 then return
  27. bne 5f ! arrayaddress + index
  28. jsr Pop
  29. jmp Adi2
  30. 5: jsr Mli2 ! objectsize > 1 then return
  31. jmp Adi2 ! arrayaddress + index * objectsize