inn.s 413 B

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