1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

i want to asked to solution this question

Discussion in 'Assembly Language Programming (ALP) Forum' started by atef deeb ahmed, Jun 10, 2011.

  1. atef deeb ahmed

    atef deeb ahmed New Member

    Jun 10, 2011
    Likes Received:
    Trophy Points:
    ;2- Write an assembly language program (write a complete program) that count the key presses from the user until he press enter (Carriage return 0DH)

    .STACK 100H
        PROMPT  DB  'Enter char to count it (Enter to Exit.) : $'
       MAIN PROC
         MOV AX, @DATA                ; initialize DS
         MOV DS, AX
         LEA DX, PROMPT               ; load and print PROMPT
         MOV AH, 9
         INT 21H
         Mov ah,1
         Int 21h
         MOV CX, 10                   ; initialize CX
         MOV AH, 2                    ; set output function
         MOV DL, 41H                  ; set DL=A
         @DO_WHILE_LOOP:              ; loop label
           INT 21H                    ; print character
           INC DL                     ; increment DL to next ASCII character
           DEC CX                     ; decrement CX
         JNZ @DO_WHILE_LOOP           ; jmp to label @DO_WHILE_LOOP
         MOV AH, 4CH                  ; return control to DOS
         INT 21H
       MAIN ENDP
    this corect solution plz help me
    Last edited by a moderator: Jun 10, 2011

Share This Page