Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Assembly Language Programming (ALP) Forum (http://www.go4expert.com/forums/assembly-language-programming-forum/)
-   -   i want to asked to solution this question (http://www.go4expert.com/forums/i-solution-question-t26024/)

atef deeb ahmed 10Jun2011 14:14

i want to asked to solution this question
 
;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)

Code:

.STACK 100H

 .DATA
    PROMPT  DB  'Enter char to count it (Enter to Exit.) : $'

 .CODE
  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
 END MAIN

this corect solution plz help me


All times are GMT +5.5. The time now is 21:15.