0
section .text

global _start

;DATA SEGMENT
     A DB 9H
     B DB 7H
     C DB 5H
     D DB 0
 
;CODE SEGMENT  
    ;ASSUME DS:DATA CS:CODE
_START:
      MOV AX,DS
      MOV DS,AX
 
      MOV AL,A
      ADD AL,B
      ADD AL,C
 
      MOV D, AL  

      MOV AH,4CH
      INT 21H  

getting an error where its says MOV D, AL. says error: invalid combination of opcode and operands. Hoping to get some clarity on where I'm going wrong.

Michael Petch
  • 46,082
  • 8
  • 107
  • 198
  • 2
    Tagged #nasm. `mov al, A` and your two `add` instructions access the addresses of the variables, not their content. `mov D, al` is invalid because an address (an immediate) cannot be a destination. Try using brackets `[...]` around the label names if you want to access memory. – ecm Oct 10 '20 at 19:42
  • 2
    @ecm Just a heads up: I am the one who tagged it NASM, not the OP. The syntax and the exact error message are from NASM. I probably should remove DOS since it in unclear what environment they are targeting. – Michael Petch Oct 10 '20 at 20:00

0 Answers0