csb.s 551 B

123456789101112131415161718192021222324252627282930313233
  1. .define .csb
  2. .sect .text
  3. .sect .rom
  4. .sect .data
  5. .sect .bss
  6. .sect .text
  7. .sect .text
  8. !r0 contains index
  9. !r1 contains pointer to csb descriptor
  10. .csb:
  11. movd 4(r1), r2 !number of entries
  12. cmpqd 0, r2
  13. beq 3f
  14. movd r1, r3
  15. 1:
  16. addd 8, r3 !find addres of next index
  17. cmpd 0(r3), r0 !compare indices
  18. beq 2f
  19. acbd -1, r2, 1b
  20. 3: !r1 now contains right pointer
  21. cmpqd 0, 0(r1) !test destination addres
  22. beq 4f
  23. movd 0(r1), tos !jump to destination
  24. ret 4
  25. 2:
  26. addr 4(r3), r1 !put destination pointer in r1
  27. br 3b
  28. 4:
  29. movd ECASE, tos
  30. jsr @.trp
  31. ret 0