Question
org 400h
START MOV AL, 1
OP: OUT 0, AL
ROL AL, 1
CALL DELAY
DELAY: MOV CX, $000H
loop$
RET
I'm trying to convert asm to hex using the code above on NASM using this line:
nasm -f ith test.asm -o test.hex
But I'm getting this error:
test.asm:9: error: expression syntax error
test.asm:10: warning: label alone on a line without a colon might be in error [-w+label-orphan]
START MOV AL, 1
OP: OUT 0, AL
ROL AL, 1
CALL DELAY
DELAY: MOV CX, $000H
loop$
RET
I'm trying to convert asm to hex using the code above on NASM using this line:
nasm -f ith test.asm -o test.hex
But I'm getting this error:
test.asm:9: error: expression syntax error
test.asm:10: warning: label alone on a line without a colon might be in error [-w+label-orphan]
Answers
GPT 3.5
The error you are encountering is due to the incorrect syntax in your code. The NASM assembler is expecting a valid expression after the `CX` register name in the `MOV` instruction.
To fix the error, you need to provide a valid expression. In this case, you can replace `$000H` with `0` to represent the hexadecimal value of zero. Here's the updated code:
```
org 400h
START:
MOV AL, 1
OP:
OUT 0, AL
ROL AL, 1
CALL DELAY
DELAY:
MOV CX, 0
loop$:
RET
```
After making these changes, you can try running the NASM command again:
```
nasm -f ith test.asm -o test.hex
```
This should convert your assembly code into a hexadecimal file named `test.hex` without any errors.
To fix the error, you need to provide a valid expression. In this case, you can replace `$000H` with `0` to represent the hexadecimal value of zero. Here's the updated code:
```
org 400h
START:
MOV AL, 1
OP:
OUT 0, AL
ROL AL, 1
CALL DELAY
DELAY:
MOV CX, 0
loop$:
RET
```
After making these changes, you can try running the NASM command again:
```
nasm -f ith test.asm -o test.hex
```
This should convert your assembly code into a hexadecimal file named `test.hex` without any errors.