Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- org 100h
- ESC_ equ 01bh ;ascii code escape
- COLON_ equ 58 ;ascii code :
- AT_ equ 64 ;ascii code @ (< > ? ; - are between : and @)
- BELL_ equ 7 ;ascii codering
- start_:
- mov ah, 09h ;output - helloStr_
- mov dx, helloStr_
- int 21h
- main_:
- mov ah, 08h ;no echo input with waiting, output al - ascii code of pressed button
- int 21h
- cmp al, ESC_ ;was it escape?
- jne other_ ;if no go to other_
- jmp exit_ ;if yes exit
- other_:
- cmp al, COLON_ ;if letter is less than : it's incorrect, go to err_
- jb err_ ;jump if below
- cmp al, AT_ ;if letter is greater than @ it's incorrect, go to err_
- ja err_ ;jump if above
- mov dl, al ;else just display that letter
- mov ah, 02h
- int 21h
- jmp main_ ;go back to start
- err_:
- mov ah, 02h ;play ring
- mov dl, BELL_
- int 21h
- jmp main_ ;go back to start
- exit_:
- mov ah, 09h ;output - byeStr
- mov dx, byeStr
- int 21h
- mov ah, 07h ;wait for input
- int 21h
- ret
- helloStr_ db "This program filters input text according to", $0d, $0a, ":, ;, <, =, >, ?, @", $0d, $0a, "You can exit on ESC", $0d, $0a, "Try to input something:", $0d, $0a, "$"
- byeStr db 0dh, 0ah, "The program has now terminated. Press anything to continue...$"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement