assemblyx86dos

How to output a value stored in a variable in assembly 8086?


I am learning assembly programming using "8086 emu" (Its a software program . Emulator .) I am evaluating a basic expression -

a=b+c-d*e

My problem is that when I am using int 21h to take in values , Its taking only single digit (character) as input for each variable .

Also after the evaluation , I am unable to print the value stored in the variable 'a' on the output screen .

Can anyone give a solution for both the problems ?


Solution

  • For the first part (reading in a string until a sentinel key, e.g. the enter key is hit), you'll write a loop to do that.

    A function for parsing the ASCII decimal string into a register value is also needed.

    For printing to screen, you'll need:

    You'll also need an itoa function (http://www.cplusplus.com/reference/clibrary/cstdlib/itoa/) to convert a register value into a multi-digit ASCII string.

    The URLs is part of an assembly programming tutorial called Ralf Brown's Interrupt List (RBIL).