Assign value to a variable in assembly 8086

1

I have the variable:

simbolo db "0 $"

and I also have the following function:

  read_keyboard:
  mov ah, 1
  int 21h
  ret

What is a simple interrupt that reads from the screen, and saves what was read in AH .

My problem is: how do I load the content of AH (read from the keyboard) into my symbol ?

I've already tried:

mov simbolo, [AH]

and also

lea simbolo, AH

And I did not succeed.

    
asked by anonymous 03.12.2016 / 06:34

1 answer

3

The function int 21,1 returns the character read in register AL (not AH ).

To load the value of the AL register into the simbolo memory location, use the command:

mov     [simbolo],al
  • The bracket indicates that simbolo is a memory location.

  • The source (register al ) is to the right of the comma, and the destination ( simbolo ) on the left, according to syntax Intel .

NOTE: The syntax of this command may change depending on the assembler you are using.

    
03.12.2016 / 08:06