Question
/* ASSEMBLY LANGUAGE : Need NASM Assembly help. I just need help getting this code to compile. Please post working code. Not sure what Im
/*ASSEMBLY LANGUAGE: Need NASM Assembly help. I just need help getting this code to compile. Please post working code. Not sure what I"m doing wrong here. I also attached my compiler errors. The code is supposed to be a calculate take inputs and a symbol +,-,*,%, and then with the '=' perform the calculation and spit out the answer. 6 + 5 = 11*/
segment .data line byte "Enter Integer: " num1 byte num2 byte
button byte segment .bss
segment .text global asm_main
asm_main: push ebp mov ebp, esp ; ********** CODE STARTS HERE ********** mov edx, offset line call write_string
start:
call read_int mov num1, eax
call read_char mov button, eax
call read_int mov num2, eax
cmp button, '+' JE addition
cmp button, '-' JE subtraction
cmp button, '*' JE multiplication
cmp button, '/' JE division
cmp button, '%' JE modulus
addition: JMP start subtraction: JMP start multiplication: JMP start division: JMP start modulus: JMP start
stop: exit main end end main
; *********** CODE ENDS HERE *********** mov eax, 0 mov esp, ebp pop ebp ret
nasm -f elf -F dwarf -g calc.asm calc.asm:23: error: invalid combination of opcode and operands calc.asm:26: error: invalid combination of opcode and operands calc.asm:29: error: invalid combination of opcode and operands calc.asm: 31: error: invalid combination of opcode and operands calc.asm: 34: error: invalid combination of opcode and operands calc.asm: 37: error: invalid combination of opcode and operands calc.asm: 40 error: invalid combination of opcode and operands calc.asm: 43 error: invalid combination of opcode and operands Makefile:9: recipe for target calc' failed make : [calc] Error 1 nasm -f elf -F dwarf -g calc.asm calc.asm:23: error: invalid combination of opcode and operands calc.asm:26: error: invalid combination of opcode and operands calc.asm:29: error: invalid combination of opcode and operands calc.asm: 31: error: invalid combination of opcode and operands calc.asm: 34: error: invalid combination of opcode and operands calc.asm: 37: error: invalid combination of opcode and operands calc.asm: 40 error: invalid combination of opcode and operands calc.asm: 43 error: invalid combination of opcode and operands Makefile:9: recipe for target calc' failed make : [calc] Error 1Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started