'Command Line Optimization Level in NASM
I have written an assembly code to add ten numbers using byte variables, and code is error free.
Assembly code:
; a program to add ten numbers using byte variables
[org 0x0100]
jmp start
num1: dw 10, 20, 30, 40, 50, 10, 20, 30, 40, 50
result: dw 0
start:
; initialize stuff
mov ax, 0 ; reset the accumulator
mov bx, 0 ; set the counter
outerloop:
add ax, [num1 + bx]
add bx, 2
cmp bx, 20 ; sets ZF=1 when they are equal,
;un set ZF=0, if they are not equal
jne outerloop
mov [result], ax
mov ax, 0x4c00
int 0x21
While assembling this code in NASM facing this error.
Solution 1:[1]
NASM's command line options are case sensitive. It looks like you wanted to use the -o option (lower case o) to specify the output file name, so that -o C02-06.COM would write the output to a file named C02-06.COM. Instead you used upper-case -O, which requests optimization and (with your version) requires an additional flag, as the message says.
So change your command to -o C02-06.COM and it should work.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Nate Eldredge |

