set.s 565 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. .sect .text; .sect .rom; .sect .data; .sect .bss
  2. .sect .text
  3. .define .set
  4. ! #bytes in cx
  5. ! bit # in ax
  6. .set:
  7. pop bx ! return address
  8. xor dx,dx
  9. !ifdef create set
  10. sub sp,cx
  11. push bx
  12. push di
  13. mov bx,sp
  14. xor di,di
  15. sar cx,1
  16. 1:
  17. mov 4(bx)(di),dx
  18. add di,2
  19. loop 1b
  20. !endif
  21. mov bx,8
  22. div bx
  23. cmp ax,di
  24. jae 2f
  25. mov di,dx
  26. movb dl,bits(di)
  27. mov di,sp
  28. add di,ax
  29. orb 4(di),dl
  30. pop di
  31. ret
  32. 2:
  33. .extern ESET
  34. .extern .trp
  35. pop di
  36. mov ax,ESET
  37. jmp .trp
  38. .sect .data
  39. bits:
  40. .data1 1,2,4,8,16,32,64,128