Advertisement
Guest User

Untitled

a guest
Feb 6th, 2025
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. main:
  2.     mov ah, 10h             ; get key
  3.     int 16h                 ; int
  4.     cmp ah, enter           ; enter leaves
  5.     jz envset               ; so leave
  6.     skip:
  7.     cmp ah, 2Bh             ; backslash
  8.     jz invalid
  9.     cmp ah, 33h             ; comma
  10.     jz invalid
  11.     cmp ah, 34h             ; period
  12.     jz invalid              
  13.     cmp ah, 39h             ; spacebar      
  14.     jz invalid  
  15.     cmp ah, 56h             ; the | \ key?
  16.     jz invalid
  17.     cmp ah, 50h             ; the 311 key. (down)
  18.     jz invalid
  19.     cmp ah, 48h             ; Shania Twain (up)
  20.     jz invalid
  21.     cmp ah, 0Eh             ; oops! you made a mistake!
  22.     jz bkspc                ; (backspace)
  23.     cmp ah, 4Bh             ; left arrow
  24.     ;jz arrlef              ; on second thought
  25.     jz invalid              ; the arrows need more
  26.     cmp ah, 4Dh             ; right arrow
  27.     ;jz arrrt               ; because backspace after
  28.     jz invalid              ; you arrow breaks shit
  29.     cmp cl, 8               ; 8 character maximum
  30.     jz invalid              ; and it wasn't special
  31.     cmp al, 5Ah             ; lower case?
  32.     jbe writemem            ; skip if not
  33.     sub al, 20h             ; convert to uppercase
  34. writemem:                   ; now you're UPPERCASE!
  35.     mov [ds:si], al         ; write memory
  36.     inc si                  ; it's no longer lodsb
  37.     call screen             ; update screen
  38.     inc cl                  ; increase counter
  39.     jmp main                ; loop up
  40.  
  41.  
  42. bkspc:                      ; you made a mistake? crap.
  43.     cmp cl, 0               ; if we're zero
  44.     jz invalid              ; we have nothing to delete
  45.     dec si                  ; move memory pointer back
  46.     dec dl                  ; remove one column
  47.     dec cl                  ; delete a keystroke
  48.     xor al, al              ; load a null
  49.     call uppos              ; update screen position
  50.     mov [ds:si], al         ; null the byte but don't inc si
  51.     call screen             ; run screen routine to blank spot
  52.     dec dl                  ; now back up a column again
  53.     call uppos              ; update position again
  54.     jmp main                ; go back to main (again)
  55.  
  56. invalid:
  57.     mov ah, 0eh             ; charcter display
  58.     mov al, 07h             ; ring the bell
  59.     int 10h                 ; DING!
  60.     jmp main                ; do nothing and start over!!!
  61.  
  62. screen:                     ; full manual control
  63.     push cx                 ; push cx/count out (1)
  64.     mov cx, 1               ; move 1 in to cx
  65.     mov bl, 07h             ; bl holds attribute
  66.     mov ah, 09h             ; bh already set, set func
  67.     int 10h                 ; call interrupt
  68.     pop cx                  ; welcome back count (1)
  69.     inc dl                  ; inc column
  70. uppos:                      ; can call from keychk subs!
  71.     mov ah, 02h             ; set cursor
  72.     int 10h                 ; position int
  73.     ret                     ; bye
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement