home *** CD-ROM | disk | FTP | other *** search
/ Turbo Toolbox / Turbo_Toolbox.iso / 1989 / 07 / tricks / taste.asm < prev    next >
Encoding:
Assembly Source File  |  1988-11-29  |  1.9 KB  |  57 lines

  1. ;* ------------------------------------------------------ *;
  2. ;*                    TASTE.ASM                           *;
  3. ;*    Umwandlung von Tastatureingaben nach Errorlevel     *;
  4. ;*          (c) 1988 Georg Mutschler & TOOLBOX            *;
  5. ;*                    -- MASM > 4.0 --                    *;
  6. ;* ------------------------------------------------------ *;
  7. title  Taste.asm
  8. page 62,132
  9.                            ; Taste 0...9 und a..z in 0...35
  10.  
  11. code  segment para 'code'
  12.       assume cs:code, ds:code
  13.       org 100h
  14.  
  15. start: jmp marke
  16. text db ' Bitte wählen -----> ',"$"
  17.  
  18. tabe  dw 3000h, 3100h, 3200h, 3300h, 3400h, 3500h, 3600h
  19.       dw 3700h, 3800h, 3900h                         ; 0...9
  20.       dw 3031h, 3131h, 3231h, 3331h, 3431h, 3531h, 3631h
  21.       dw 3731h, 3831h, 3931h                         ; a...j
  22.       dw 3032h, 3132h, 3232h, 3332h, 3432h, 3532h, 3632h
  23.       dw 3732h, 3832h, 3932h                         ; k...t
  24.       dw 3033h, 3133h, 3233h, 3333h, 3433h, 3533h    ; u...z
  25.  
  26. marke: mov dx,offset text
  27.        mov ah,09
  28.        int 21h
  29. mar:   mov ah,0
  30.        int 16h
  31.        cmp al,48          ; ASCII-Code für 0
  32.        jb mar             ; kleiner ?, zurück
  33.        cmp al,122         ; ASCII-Code für z
  34.        jg mar             ; größer ?, zurück
  35.        cmp al,57          ; ASCII 9, subtrahiere 48
  36.        jbe mar2           ;           = mar2
  37.        cmp al,96          ; ASCII a
  38.        jae mar1           ; subtrahiere die Differenz
  39.                           ; von 9..a = 39
  40.        jmp mar3           ; ASCII : bis ' = 58..95 sperren
  41. mar1:  sub al,39
  42. mar2:  sub al,48
  43.        mov ah,0
  44.        mov di,ax
  45.        sal di,1
  46.        mov dx,tabe[di]    ; Schreibe Zahl in Bildspeicher
  47.        jmp ende
  48. mar3:  jmp mar
  49. ende:  mov ah,4ch         ; Programm-Ende
  50.        int 21h
  51.  
  52. code ends
  53.      end start
  54.  
  55. ;* ------------------------------------------------------ *;
  56. ;*                 Ende von TASTE.ASM                     *;
  57.