inn.s 437 B

1234567891011121314151617181920212223242526272829303132
  1. .sect .text; .sect .rom; .sect .data; .sect .bss
  2. .sect .text
  3. .define .inn
  4. ! #bytes in ecx
  5. ! bit # in eax
  6. .inn:
  7. xor edx,edx
  8. mov ebx,8
  9. div ebx
  10. mov ebx,esp
  11. add ebx,4
  12. add ebx,eax
  13. cmp eax,ecx
  14. jae 1f
  15. movb al,(ebx)
  16. mov ebx,edx
  17. testb al,bits(ebx)
  18. jz 1f
  19. mov eax,1
  20. jmp 2f
  21. 1:
  22. xor eax,eax
  23. 2:
  24. pop ebx
  25. add esp,ecx
  26. ! eax is result
  27. jmp ebx
  28. .sect .rom
  29. bits:
  30. .data1 1,2,4,8,16,32,64,128