Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- org 100h
- Start:
- Greeting:
- mov ah, $09
- mov dx, greeting
- int 21h
- Input:
- mov ah, $0A
- mov dx, inputString
- int 21h
- ;go next line
- mov ah, $09
- mov dx, nextLine
- int 21h
- CheckLength:
- cmp [inputString + 1], 4
- jle PrintNo
- CheckEquality:
- mov dh, [inputString + 3] ;dh!
- cmp dh, [inputString + 5] ;dh!
- jne PrintNo
- CheckLetter:
- mov ch, [inputString + 3]
- cmp ch, 'A'
- jb PrintNo
- cmp ch, 'z'
- jg PrintNo
- cmp ch, 'Z'
- jb CheckDigit
- cmp ch, 'a'
- jg CheckDigit
- CheckDigit:
- movsx si, [inputString + 1] ;store length here
- mov ch, [inputString + si]
- cmp ch, '0'
- jb PrintNo
- cmp ch, '9'
- jg PrintNo
- ;if everything was right
- jmp PrintYes
- PrintNo:
- mov ah, $09
- mov dx, ansNo
- int 21h
- jmp Exit
- PrintYes:
- mov ah, $09
- mov dx, ansYes
- int 21h
- jmp Exit
- Exit:
- mov ah, $09
- mov dx, pressAnyKey
- int 21h
- mov ah, $08
- int 21h
- ret
- greeting db "Enter your string:", 13, 10, "$"
- inputString db 11, 0, 10 dup (?)
- nextLine db 13, 10, "$"
- ansYes db "Yes!", 13, 10, "$"
- ansNo db "No!", 13, 10, "$"
- pressAnyKey db 13, 10, "Press any key to exit...$"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement