home *** CD-ROM | disk | FTP | other *** search
/ World of Shareware - Software Farm 2 / wosw_2.zip / wosw_2 / CPROG / TASMSWAN.ZIP / KEYS.ASM < prev    next >
Assembly Source File  |  1989-07-15  |  965b  |  63 lines

  1. %TITLE  "Display KEY values"
  2.  
  3.     IDEAL
  4.     DOSSEG
  5.     MODEL    small
  6.     STACK    256
  7.  
  8. cr    EQU    13
  9. lf      EQU    10
  10.  
  11.     DATASEG
  12.  
  13. exitCode    db    0
  14. charKey        db    'Character key : ', 0
  15. funcKey        db    'Function key  : ', 0
  16. numString    db    7 DUP (0)
  17. welcome        db    cr,lf,'Display key values--by Tom Swan'
  18.         db    cr,lf,'Press any key or press <ESC> to quit.'
  19.         db    cr,lf,lf,0
  20.  
  21.     CODESEG
  22.  
  23. ;----- from BINASC.obj
  24.     EXTRN    BinToAscDec:proc
  25.  
  26. ;----- from STRIO.obj
  27.     EXTRN    StrWrite:proc, NewLine:proc
  28.  
  29. ;----- from KEYBOARD.obj
  30.     EXTRN    Keywaiting:proc, Getch:proc
  31.  
  32. Start:
  33.     mov    ax,@data
  34.     mov    ds,ax
  35.     mov    es,ax
  36.  
  37.     mov    di,offset welcome
  38.     call    StrWrite
  39. Repeat:
  40.     call    KeyWaiting
  41.     jz    Repeat
  42.     call    GetCh
  43.     mov    di, offset charKey
  44.     jnz    @@10
  45.     cmp    al,27
  46.     je    Exit
  47.     mov    di, offset funcKey
  48. @@10:
  49.     call    StrWrite
  50.     xor    ah,ah
  51.     mov    cx,1
  52.     mov    di, offset numString
  53.     call    BinToAscDec
  54.     call    StrWrite
  55.     call    NewLine
  56.     jmp    Repeat
  57. Exit:
  58.     mov    ah,04Ch
  59.     mov    al,[exitCode]
  60.     int    21h
  61.  
  62.     END    Start
  63.