set.s 549 B

123456789101112131415161718192021222324252627282930313233343536
  1. .define .set
  2. .sect .text
  3. .sect .rom
  4. .sect .data
  5. .sect .bss
  6. .sect .text
  7. ESET=2
  8. .set: ! d0 bitnumber
  9. ! d1 setsize in bytes
  10. ! a1 saved d2
  11. ! a0 return address
  12. move.l (sp)+, a0
  13. move.l d2, a1
  14. move.l d1, d2
  15. asr.l #2, d2
  16. 1:
  17. clr.l -(sp)
  18. sub.l #1, d2
  19. bne 1b
  20. move.l d0, d2
  21. asr.l #3, d2 ! offset from sp in bytes
  22. eor.l #3, d2 ! longs are stored in high-to-low order
  23. cmp.l d1, d2
  24. blt 2f
  25. move.l #ESET, -(sp) ! bitnumber too large
  26. move.l a1, d2
  27. move.l a0, -(sp)
  28. jmp (.trp)
  29. 2:
  30. bset d0, (sp, d2.l)
  31. move.l a1, d2
  32. jmp (a0) ! return
  33. .align 2