set.s 597 B

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