I'd translate this into MIC but I'd have to learn MIC which might take an hr or two (fast learner.. I know..) to get a hang of the syntax.. So I'm posting it in x86 in hopes that you can do that yourself..
Let me know if you guys see any mistakes..
ASM Code:
format PE console
entry main
include 'macro/import32.inc'
section '.idata' import data readable
library msvcrt,'msvcrt.dll'
import msvcrt, printf, 'printf',\
exit,'exit', getchar, 'getchar', scanf, 'scanf'
section '.data' data readable writeable
GetMultiplicand db "Enter A Multiplicand: ", 13, 10, 0
GetMultiplier db "Enter A Multiplier: ", 13, 10, 0
InputFormat db "%d", 0
Multiplicand dd 0
Multiplier dd 0
section '.code' code readable executable
main:
push ebp
mov ebp,esp
push GetMultiplicand
call [printf]
add esp, 4
push Multiplicand
push InputFormat
call [scanf]
add esp, 8
push GetMultiplier
call [printf]
add esp, 4
push Multiplier
push InputFormat
call [scanf]
add esp, 8
mov eax, 0
mov ebx, Multiplicand
mov edx, Multiplier
mov ecx, 20h
TheLoop:
shl eax, 1b
mov edi, edx
and edi, 8000000h
cmp edi, 1b
jne NotOne
add eax, ebx
NotOne:
shl edx, 1b
loop TheLoop
mov esp, ebp
pop ebx
call [getchar]
call [getchar]
mov eax, 0
ret