2019-10-08 19:54:39 +02:00
|
|
|
; Calculate dual logarithm (int)
|
|
|
|
; IN AX number
|
|
|
|
; OUT AX dual logarithm
|
|
|
|
log2:
|
|
|
|
push cx
|
2019-10-19 14:51:11 +02:00
|
|
|
mov cx, 15
|
2019-10-08 19:54:39 +02:00
|
|
|
.loop:
|
2019-10-19 14:51:11 +02:00
|
|
|
rcl ax, 1
|
|
|
|
jc .ret
|
|
|
|
loop .loop
|
|
|
|
.ret:
|
|
|
|
cmc
|
|
|
|
mov ax, cx
|
2019-10-08 19:54:39 +02:00
|
|
|
pop cx
|
|
|
|
ret
|