Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- main:
- mov ah, 10h ; get key
- int 16h ; int
- cmp ah, enter ; enter leaves
- jz envset ; so leave
- skip:
- cmp ah, 2Bh ; backslash
- jz invalid
- cmp ah, 33h ; comma
- jz invalid
- cmp ah, 34h ; period
- jz invalid
- cmp ah, 39h ; spacebar
- jz invalid
- cmp ah, 56h ; the | \ key?
- jz invalid
- cmp ah, 50h ; the 311 key. (down)
- jz invalid
- cmp ah, 48h ; Shania Twain (up)
- jz invalid
- cmp ah, 0Eh ; oops! you made a mistake!
- jz bkspc ; (backspace)
- cmp ah, 4Bh ; left arrow
- ;jz arrlef ; on second thought
- jz invalid ; the arrows need more
- cmp ah, 4Dh ; right arrow
- ;jz arrrt ; because backspace after
- jz invalid ; you arrow breaks shit
- cmp cl, 8 ; 8 character maximum
- jz invalid ; and it wasn't special
- cmp al, 5Ah ; lower case?
- jbe writemem ; skip if not
- sub al, 20h ; convert to uppercase
- writemem: ; now you're UPPERCASE!
- mov [ds:si], al ; write memory
- inc si ; it's no longer lodsb
- call screen ; update screen
- inc cl ; increase counter
- jmp main ; loop up
- bkspc: ; you made a mistake? crap.
- cmp cl, 0 ; if we're zero
- jz invalid ; we have nothing to delete
- dec si ; move memory pointer back
- dec dl ; remove one column
- dec cl ; delete a keystroke
- xor al, al ; load a null
- call uppos ; update screen position
- mov [ds:si], al ; null the byte but don't inc si
- call screen ; run screen routine to blank spot
- dec dl ; now back up a column again
- call uppos ; update position again
- jmp main ; go back to main (again)
- invalid:
- mov ah, 0eh ; charcter display
- mov al, 07h ; ring the bell
- int 10h ; DING!
- jmp main ; do nothing and start over!!!
- screen: ; full manual control
- push cx ; push cx/count out (1)
- mov cx, 1 ; move 1 in to cx
- mov bl, 07h ; bl holds attribute
- mov ah, 09h ; bh already set, set func
- int 10h ; call interrupt
- pop cx ; welcome back count (1)
- inc dl ; inc column
- uppos: ; can call from keychk subs!
- mov ah, 02h ; set cursor
- int 10h ; position int
- ret ; bye
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement