1

I'd like to ask you why in emu8086 I have some problems with the MOV and LEA instructions.

This is the code:

    format MZ   
    
    entry code_seg:start ; set entry point
    
    stack 256  

    segment data_seg
    
     STR1 DB "INSERT NUMBER: ",10,13,'$'
     STR2 DB "DIGITED NUMBER: " 
     NUM DB 0 
    
segment code_seg
start:
; set segment registers:
    mov ax, data_seg
    mov ds, ax
    
    ;input number
    MOV ah, 09h
    MOV DX, STR1
    INT 21H
    
 
    MOV AH,01H
    INT 21H
    SUB AL,30H ;CONVERSIONE
    MOV NUM,AL ;SAVING VALUE IN NUM VARIABLE
    
     ;PRINT NUMBER INSERTED IN INPUT 
    
    MOV AH, 09H
    LEA DX, STR2
    INT 21H    
    MOV AH,02H
    MOV DL, NUM
    ADD DL,30H
    INT 21H 
    
    
    mov ax, 4c00h ; exit to operating system.
    int 21h    

Precisely, I have the "invalid operand" error with these 2 instructions: MOV NUM,AL and all LEA instructions. How can I solve it?

Sep Roland
  • 33,889
  • 7
  • 43
  • 76

1 Answers1

3

If you use the built-in assembler then both MOV NUM,AL and LEA DX, STR2 are correct. emu8086 uses MASM-style.

However, if you use FASM (you have tagged your question for it), then you would need to use the square brackets because FASM is NASM-style.

MOV [NUM], AL
LEA DX, [STR2]

Instead of LEA use MOV DX, STR2. It has a shorter encoding.

Sep Roland
  • 33,889
  • 7
  • 43
  • 76