home *** CD-ROM | disk | FTP | other *** search
/ C!T ROM 5 / ctrom5b.zip / ctrom5b / PROGRAM / ASM / ALIB30B / MKEY08.ASM < prev    next >
Assembly Source File  |  1994-10-15  |  2KB  |  55 lines

  1.     page    66,132
  2. ;******************************** MKEY08.ASM *********************************
  3.  
  4. LIBSEG           segment byte public "LIB"
  5.         assume cs:LIBSEG , ds:nothing
  6.  
  7. ;----------------------------------------------------------------------------
  8. .xlist
  9.     include  mac.inc
  10.     include  common.inc
  11. .list
  12. ;----------------------------------------------------------------------------
  13.     extrn    key_read:far
  14.     extrn    to_upper:far
  15. comment 
  16. ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -(MOUSE/KEY)
  17. YES_OR_NO - wait for yes or no user response
  18. ;
  19. ;  inputs: al - 0=wait for Yes/NO/abort key, and ignore all others
  20. ;               1=wait for Yes/No/abort key, and return others also
  21. ;               
  22. ;  outputs: no carry - al = Yes/No ascii character in upper case
  23. ;              carry - al = 03 if abort, and others also if requested
  24. ;* * * * * * * * * * * * * *
  25. 
  26. ;-----------------
  27. yesno_flag    db    0    ;0=ignore illegal keys  1=return illegal keys
  28. ;-----------------
  29.     public    yes_or_no
  30. YES_OR_NO    PROC    FAR
  31.     mov    yesno_flag,al
  32. yn_loop:    
  33.     call    KEY_READ
  34.     cmp    al,03        ;check for ctrl-c
  35.     je    yn_bad2        ; jmp if abort request    
  36.     cmp    al,1bh        ;check for escape
  37.     je    yn_bad2        ; jmp if escape
  38.     shr    ah,1        ;check if extended key
  39.     jc    yn_bad1        ; jmp if bad key
  40.     call    TO_UPPER
  41.     cmp    al,'Y'
  42.     je    yn_got        ;jmp if ok
  43.     cmp    al,'N'
  44.     je    yn_got        ;jmp if ok
  45. yn_bad1:cmp    yesno_flag,0
  46.     je    yn_loop    
  47. yn_bad2:stc
  48.     jmp    yn_exit
  49. yn_got:    clc
  50. yn_exit:retf        
  51. YES_OR_NO    ENDP
  52.  
  53. LIBSEG    ENDS
  54.     end
  55.