home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / assemblr / library / nor_asm / kbd_io19.asm < prev    next >
Assembly Source File  |  1989-05-17  |  821b  |  32 lines

  1. .MODEL    SMALL
  2.  
  3. .CODE
  4.  
  5.     PUBLIC    READ_BYTE
  6. ;-----------------------------------------------------------------------;
  7. ; This procedure reads a single ASCII character.  This is just        ;
  8. ; a test version of READ_BYTE.                        ;
  9. ;                                    ;
  10. ; Returns:    AL    Character code (unless AH = 1)            ;
  11. ;        AH    0 if read ASCII char                ;
  12. ;            1 if read a special key                ;
  13. ;-----------------------------------------------------------------------;
  14. READ_BYTE    PROC
  15.     XOR    AH,AH            ;Ask for keyboard read function
  16.     INT    16h            ;Read character/scan code from keyboard
  17.     OR    AL,AL            ;Is it an extended code?
  18.     JZ    EXTENDED_CODE        ;Yes
  19. NOT_EXTENDED:
  20.     XOR    AH,AH            ;Return just the ASCII code
  21. DONE_READING:
  22.     RET
  23.  
  24. EXTENDED_CODE:
  25.     MOV    AL,AH            ;Put scan code into AL
  26.     MOV    AH,1            ;Signal extended code
  27.     JMP    DONE_READING
  28. READ_BYTE    ENDP
  29.  
  30.  
  31.     END
  32.