Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Help with user input and variables

nastinatornastinator Member Posts: 19
Hello, I need little help for my assignment, please.
I need to get input from user, and assign it to a variable for calculations later on in program.

this is a sample of what i got

.data
first_number db ?
message1 db "Enter number",0

main proc

mov dx, offset message1
call writestring
call Readint
*

*this is where I need to assign the users input into first_number
(I will be multipling two numbers together later on)

Please Help
Tanks alot
Frank

Comments

  • emu8086emu8086 Member Posts: 125
    :
    : .data
    : first_number db ?
    : message1 db "Enter number",0
    :
    : main proc
    :
    : mov dx, offset message1
    : call writestring
    : call Readint
    : *
    :
    : *this is where I need to assign the users input into first_number
    : (I will be multipling two numbers together later on)
    :


    - I think there is something unclear in your question.
    Do you have the code for "Readint" procedure?
    or do you ask us to write it for you?

    if it's the first case you maybe interested in message here:
    http://www.programmersheaven.com/c/MsgBoard/read.asp?Board=1&MsgID=147604&Setting=A9999F0001


  • nastinatornastinator Member Posts: 19
    : :
    : : .data
    : : first_number db ?
    : : message1 db "Enter number",0
    : :
    : : main proc
    : :
    : : mov dx, offset message1
    : : call writestring
    : : call Readint
    : : *
    : :
    : : *this is where I need to assign the users input into first_number
    : : (I will be multipling two numbers together later on)
    : :
    :
    :
    : - I think there is something unclear in your question.
    : Do you have the code for "Readint" procedure?
    : or do you ask us to write it for you?

    everything is there (all procedures), it's just that I get an error when
    I try to multiply the first_number by the second_number. The error is "constant expression expected". What I want to know is, how do I put the users input (number) into the variable First_Number.

    I tried mov first_number, ax (I believe that the input is put into ax) but I still get an error.

    Thanks
    Frank

    :
    : if it's the first case you maybe interested in message here:
    : http://www.programmersheaven.com/c/MsgBoard/read.asp?Board=1&MsgID=147604&Setting=A9999F0001
    :
    :
    :

  • emu8086emu8086 Member Posts: 125
    Just let me see your entire code, this would help
    me to figure out the problem.


    : : :
    : : : .data
    : : : first_number db ?
    : : : message1 db "Enter number",0
    : : :
    : : : main proc
    : : :
    : : : mov dx, offset message1
    : : : call writestring
    : : : call Readint
    : : : *
    : : :
    : : : *this is where I need to assign the users input into first_number
    : : : (I will be multipling two numbers together later on)
    : : :
    : :
    : :
    : : - I think there is something unclear in your question.
    : : Do you have the code for "Readint" procedure?
    : : or do you ask us to write it for you?
    :
    : everything is there (all procedures), it's just that I get an error when
    : I try to multiply the first_number by the second_number. The error is "constant expression expected". What I want to know is, how do I put the users input (number) into the variable First_Number.
    :
    : I tried mov first_number, ax (I believe that the input is put into ax) but I still get an error.
    :
    : Thanks
    : Frank
    :
    : :
    : : if it's the first case you maybe interested in message here:
    : : http://www.programmersheaven.com/c/MsgBoard/read.asp?Board=1&MsgID=147604&Setting=A9999F0001
    : :
    : :
    : :
    :
    :

  • nastinatornastinator Member Posts: 19
    [b][red]This message was edited by nastinator at 2002-10-25 6:56:31[/red][/b][hr]
    Thanks anyway enu8086, I figured it out. After I call Readint, it store the users input into AX, but I had declared my variable as a BYTE. So when I tried to multiply two numbers and tried to store it into a WORD it wouldn't work.

    to store the result into first_number after recieving input is

    call Readint ; get users input
    mov first_number, ax ; store result into variable

    Thanks
    Frank

    : Just let me see your entire code, this would help
    : me to figure out the problem.
    :
    :
    : : : :
    : : : : .data
    : : : : first_number db ?
    : : : : message1 db "Enter number",0
    : : : :
    : : : : main proc
    : : : :
    : : : : mov dx, offset message1
    : : : : call writestring
    : : : : call Readint
    : : : : *
    : : : :
    : : : : *this is where I need to assign the users input into first_number
    : : : : (I will be multipling two numbers together later on)
    : : : :
    : : :
    : : :
    : : : - I think there is something unclear in your question.
    : : : Do you have the code for "Readint" procedure?
    : : : or do you ask us to write it for you?
    : :
    : : everything is there (all procedures), it's just that I get an error when
    : : I try to multiply the first_number by the second_number. The error is "constant expression expected". What I want to know is, how do I put the users input (number) into the variable First_Number.
    : :
    : : I tried mov first_number, ax (I believe that the input is put into ax) but I still get an error.
    : :
    : : Thanks
    : : Frank
    : :
    : : :
    : : : if it's the first case you maybe interested in message here:
    : : : http://www.programmersheaven.com/c/MsgBoard/read.asp?Board=1&MsgID=147604&Setting=A9999F0001
    : : :
    : : :
    : : :
    : :
    : :
    :
    :



  • Andre YoungAndre Young USAMember Posts: 0

    // http://forcoder.org // free video tutorials and ebooks about [ Scratch, Objective-C, R, MATLAB, C++, Visual Basic .NET, Perl, Go, Java, PHP, Swift, Assembly, JavaScript, Python, C, Visual Basic, C#, PL/SQL, Ruby, Delphi Lua, Logo, Scala, Lisp, Ada, D, Awk, Apex, Rust, Erlang, Dart, Prolog, Crystal, F#, Transact-SQL, ML, Scheme, ABAP, Clojure, FoxPro, Alice, VBScript, SAS, Bash, Fortran, Hack, Kotlin, Julia, LabVIEW, COBOL ] ___

Sign In or Register to comment.