Howdy, Stranger!

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

Categories

assembly language

I am haveing some trouble with a code
what i want to do is input a charater from the keyboard and print it on the next line with a "?" as the input so the user knows a input is required

Comments

  • little_coderlittle_coder Member Posts: 29
    [code]

    ; USE Emu8086
    #make_COM# ; tag for Emu8086 only, remove for other assemblers.
    ORG 100h

    ; press ESC to exit the program.

    JMP start

    char db ?

    start:

    ; read character from standard input,
    ; with echo, result is stored in AL.
    MOV AH, 01h
    INT 21h

    CMP AL,1Bh ; escape?
    JE exit ; exit!

    MOV char, AL

    ; write character to standard output,
    ; DL = character to write, after execution AL = DL.
    MOV DL, 13
    MOV AH, 02h
    INT 21h

    MOV DL, 10
    MOV AH, 02h
    INT 21h


    MOV DL, char
    MOV AH, 02h
    INT 21h


    MOV DL, '?'
    MOV AH, 02h
    INT 21h



    JMP start

    exit:

    RET

    [/code]

    I'm not sure if that's what you want, but at least it matches your description of the problem :)

Sign In or Register to comment.