home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / enterprs / c128 / text / examples.arc / GETKEY.A < prev    next >
Encoding:
Text File  |  1989-12-01  |  1.3 KB  |  36 lines

  1. ; getkey.asm
  2. ;==========================================
  3. ; Wait for keyboard input during exec file
  4. ;==========================================
  5. ; Returns ASCII value of key pressed as the errorlevel
  6.                                   
  7. ndx         = $00d0               
  8. getin       = $ffe4               
  9. int0e       = $170e               
  10. rdila       = $1bfa               
  11.                                   
  12. star        = $0b00               
  13.             .wor star             
  14.             * = star              
  15.  
  16.             jmp getkey
  17.             dw  Date
  18.                       
  19. getkey      lda rdila             ; save exec status
  20.             sta saveit            
  21.             lda #0                ; and turn it off
  22.             sta rdila             
  23.             sta ndx               ; clear keyboard buffer
  24. wait        jsr getin             
  25.             cmp #0                
  26.             beq wait              
  27.             pha                   ; save keypress and return it as the errorlevel
  28.             lda saveit            ; and restore exec status
  29.             sta rdila             
  30.             pla                   
  31.             jmp int0e             
  32.                                   
  33. saveit      *=*+1                 
  34.                                   
  35.             .end                  
  36.