1987-01-08 10:13:48 +00:00
|
|
|
.sect .text; .sect .rom; .sect .data; .sect .bss
|
|
|
|
.sect .text
|
1985-02-07 15:33:13 +00:00
|
|
|
.define .inn
|
|
|
|
|
|
|
|
! #bytes in cx
|
|
|
|
! bit # in ax
|
|
|
|
.inn:
|
|
|
|
pop bx ! return address
|
|
|
|
xor dx,dx
|
|
|
|
xor si,si
|
|
|
|
mov di,8
|
|
|
|
div di
|
|
|
|
mov di,sp
|
|
|
|
add di,ax
|
|
|
|
cmp ax,cx
|
|
|
|
xchg ax,dx
|
|
|
|
xchg ax,si ! ax:=si,si:=dx,does not change carry
|
|
|
|
jae 1f
|
|
|
|
movb dl,bits(si)
|
|
|
|
testb (di),dl
|
|
|
|
jz 1f
|
|
|
|
inc ax
|
|
|
|
1:
|
|
|
|
add sp,cx
|
|
|
|
! ax is result
|
|
|
|
jmp bx
|
|
|
|
|
1987-01-08 10:13:48 +00:00
|
|
|
.sect .data
|
1985-02-07 15:33:13 +00:00
|
|
|
bits:
|
1987-01-08 10:13:48 +00:00
|
|
|
.data1 1,2,4,8,16,32,64,128
|