Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- org 100h
- ;output task
- mov ah, 9h
- mov dx, task1
- int 21h
- ;output task
- mov ah, 9h
- mov dx, task2
- int 21h
- ;output task
- mov ah, 9h
- mov dx, task3
- int 21h
- ;output task
- mov ah, 9h
- mov dx, task4
- int 21h
- ;input line
- mov ah,0Ah
- mov dx, my_str
- int 21h
- ;new line
- mov ah,9h
- mov dx, new_line
- int 21h
- mov bp, my_str+2 ; address of 1st char
- mov cl,[bp+3] ; 4th char
- mov ch, [bp+5] ; 6th char
- ;swap
- xchg ch,cl
- mov [bp+5],ch
- mov [bp+3],cl
- ;3rd - (9th - 1st)
- mov ch, [bp+8]
- sub ch, [bp]
- mov cl, [bp+2]
- sub cl, ch
- mov [bp+4], cl
- ;output
- mov ah,9h
- mov dx, res_str
- int 21h
- ;output res
- mov ah,9h
- mov dx, bp
- int 21h
- ;waiting
- mov ah, 8h
- int 21h
- ret
- task1 db "This program swaps fourth and sixth elements of the string" ,$0d,$0a, "$"
- task2 db "and performs arithmetic operations with ASKI codes of symbols" ,$0d,$0a, "$"
- task3 db "numbered 1, 3, 9 and writes the result to symbol 5" ,$0d,$0a, "$"
- task4 db "Input string (max. 10 elements)" ,$0d,$0a, "$"
- res_str db "Result:" ,$0d,$0a, "$"
- my_str db 11,0,11 dup('$')
- new_line db $0d, $0A, "$"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement