Question: Please use Assembly program; I want to find a number that can be divided by a specific number in assembly program. ( with x86 )
Please use Assembly program;
I want to find a number that can be divided by a specific number in assembly program. (with x86 )
Example: Enter 8 1,2,4,8
I wrote code below, but there is an error.
How can I fix it?
segment .data Message db "Find primes up to: ", 0
segment .bss Limit resd 1 ; find primes up to this limit Guess resd 1 ; the current guess for prime
segment .text global asm_main asm_main: enter 0,0 ; setup routine pusha
mov eax, Message call print_string call read_int ; scanf("%u", & limit ); mov [Limit], eax
mov eax, 2 ; printf("2 "); call print_int call print_nl mov eax, 3 ; printf("3 "); call print_int call print_nl
mov dword [Guess], 5 ; Guess = 5;
loop_start: mov eax,[Limit] mov ecx,eax add eax,ecx je eax,0 movabs ecx,eax call print_int call print_nl loop loop_start leave ret
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
