ack/mach/m65oo2/libem/inn.s

33 lines
413 B
ArmAsm
Raw Normal View History

2024-02-22 15:13:52 +00:00
.sect .text; .sect .rom; .sect .data; .sect .bss
.sect .text
.define .inn
! #bytes in cx
! bit # in ax
.inn:
xor dx,dx
mov bx,8
div bx
mov bx,sp
add bx,2
add bx,ax
cmp ax,cx
jae 1f
movb al,(bx)
mov bx,dx
testb al,bits(bx)
jz 1f
mov ax,1
jmp 2f
1:
xor ax,ax
2:
pop bx
add sp,cx
! ax is result
jmp bx
.sect .data
bits:
.data1 1,2,4,8,16,32,64,128