GMgKe586q6suSQnyqZLlGCooeWM

Pages

Search

Tuesday, December 21, 2010

Assembly Reading Keyboard Input

To read a keyboard input, here's a code to do it:

MOV AH,08    ; Function to read a char from keyboard
INT 21h      ; the char saved in AL
MOV AH,02    ; Function to display a char  
MOV DL,AL    ; Copy a saved char in AL to DL to output it
INT 21h

MOV AH,4Ch   ; Function to exit
MOV AL,00    ; Return 00
INT 21h


Share/Bookmark

3 comments:

  1. very good, but if "mov ah,01"
    what is the difference

    ReplyDelete
    Replies
    1. i think the (ah,01) reads one character from keyboard

      Delete
  2. how can i read a number from keyboard (assume that the number can be from 0 to 8) and find its factorial

    ReplyDelete