Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- org 100h
- ;output task
- mov ah, 9h
- mov dx, str1
- int 21h
- ;output task
- mov ah,9h
- mov dx, str2
- int 21h
- ;output task
- mov ah,9h
- mov dx, str3
- int 21h
- ;input string
- mov ah,0Ah
- mov dx, my_str
- int 21h
- ;new line break
- mov ah,9h
- mov dx, new_line
- int 21h
- ;swap 4 and 6
- mov bp, my_str+2 ;address 1st
- mov cl,[bp+3] ;4th element
- mov ch, [bp+5] ;6th element
- xchg ch,cl ;swap
- mov [bp+5],ch
- mov [bp+3],cl
- ;9rd - 1th
- mov ch, [bp+8]
- sub ch, [bp]
- ;3rd - (9rd - 1th)
- mov cl, [bp+2]
- sub cl, ch
- mov [bp+4], cl
- ;output result
- mov ah,9h
- mov dx, bp
- int 21h
- ;waiting to press
- mov ah, 8h
- int 21h
- ret
- str1 db "This program swaps the 4s and 6s characters of the string. ",$0d,$0a, "$"
- str2 db "Performs arithmetic operations: S3 - (S9 - S1). Result is written to S5. ",$0d,$0a, "$"
- str3 db "Input string (max. 10 elements)", $0d, $0a, "$"
- my_str db 11,0,11 dup('$')
- new_line db $0d, $0A, "$"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement