Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- section .text
- org 100h
- start:
- mov cx, 0h
- mov ah, 09h
- mov dx, v_give_a_string ;shows "give me a string"
- int 21h
- giveagain:
- call p_giving_a_string ;reads a given letter and counts how many letters a user gave
- cmp al, 65
- jb j_error_or_ending ;if the user hits enter, program will end
- jae j_check_whether_its_a_letter ;if the user types something what is no a letter, program shows an error
- ending:
- 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_tu
- 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_tu:
- mov ax, 2
- mul cx
- mov si, 0
- j_change_cases: ;i think that is the segment, where i got a problem
- mov ax, [bp + si]
- add si, 2
- cmp ax, 0
- je ending
- cmp ax, 95
- jb j_uppercase
- ja j_lowercase
- j_uppercase:
- sub ax, 32
- 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