Search code examples
assemblymasmdosbox

Cannot use GETDEC for the life of me


Ive been bagging my head against a wall for 2 hours just trying to figure out how to get a int using getdec and Google has been no help to me at all. The book im using only gives a definition of getdec as well as its inputs and output but no examples on how it is used.

I have to get several ints from the user by using get dec and pushing them on the stack. I know getdec is supposed to take a input and store in in AX. Im also not allowed to use any dot operations.

I make the file using ML /Fl p3.asm /link io.lib pause so i know that lib.io is included.

So far ive only got this:

`DOSSEG`

    DATA SEGMENT
    NAM     BYTE    'xxxxx xxxxxxxxxx' ;LEN 19-CHANGE NAME AND LEN
    HEADER  BYTE    'Enter a number' 
    ZEROS WORD 0000
    DATA ENDS
    CODE    SEGMENT 'CODE'
    ASSUME CS:CODE, SS:NOTHING, DS:DATA, ES:NOTHING
    P3: MOV AX,SEG DATA
     MOV DS,AX
    call GETDEC
    PUSH AX
;rest of code goes here


    CODE ENDS
     END P3 

Im good on using the stack and asthmatic but i simply cant get the input using getdec.


Solution

  • I found it! If anyone else is having issues you must include EXTERN GETDEC:FAR at the beginning of the program.