Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- section .text
- org 100h
- start:
- mov si, 0h
- mov cx, 0h
- mov ah, 09h
- mov dx, v_give_a_string
- int 21h
- giveagain:
- call p_giving_a_string
- cmp al, 65
- jb j_error_or_ending
- jae j_check_whether_its_a_letter
- koniec:
- mov ax, 4c00h
- int 21h
- j_deleting_stack:
- pop bx
- cmp bx, 0
- je start
- jne j_deleting_stack
- j_error_or_ending:
- cmp al, 13
- je j_change_cases
- jne j_error
- j_check_whether_its_a_letter:
- cmp al, 90
- jbe j_its_a_letter
- cmp al, 122
- ja j_error
- cmp al, 97
- jb j_error
- j_its_a_letter:
- push ax
- jmp giveagain
- j_error:
- mov ah, 09h
- mov dx, v_thats_an_error_dude
- int 21h
- jmp j_deleting_stack
- j_change_cases:
- xor ax, ax
- mov ax, 2
- mul cx
- ;mov bx, ax
- mov ax, [bp + si]
- add si, 2
- cmp si, cx
- jae koniec
- cmp ax, 0
- je koniec
- ;mov bl, al
- cmp ax, 95
- jb j_uppercase
- ja j_lowercase
- ;je j_error
- j_uppercase:
- sub ax, 5
- mov ah, 02h
- mov dx, ax
- int 21h
- jmp j_change_cases
- j_lowercase:
- sub ax, 32
- mov ah, 02h
- mov dx, ax
- int 21h
- jmp j_change_cases
- p_giving_a_string:
- mov ah, 01h
- int 21h
- inc cx
- ret
- section .data
- v_give_a_string db 10, "give me a string: $", 10
- v_thats_an_error_dude db 10, "thats not what we wanted. try again sweetie $", 10
Advertisement
Add Comment
Please, Sign In to add comment