trp.s 260 B

123456789101112131415161718
  1. .sect .text; .sect .rom; .sect .data; .sect .bss
  2. .sect .text
  3. .define .trp
  4. .extern .trppc, EXIT
  5. ! eax is trap number
  6. .trp:
  7. xor ebx,ebx
  8. xchg ebx,(.trppc)
  9. test ebx,ebx
  10. jz 2f
  11. push eax
  12. call ebx
  13. pop eax
  14. ret
  15. 2:
  16. push eax
  17. jmp EXIT