Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .MODEL SMALL
- .STACK 200H
- .DATA
- Text db "He is painting. She was waiting. They will be coming.$"
- PunctuationMarks db ' ', '.', ',', ';', ':', ')', '!', '?', '$'
- ResultText db "$"
- .CODE
- START:
- mov ax, @DATA
- mov ds, ax
- lea dx, Text
- xor ax, ax
- mov ah, 09
- int 21h
- xor dx, dx
- xor si, si
- ; Text[0...2] --> ResultText[]
- FIRST_THREE_CHARS:
- mov al, [Text + si]
- mov [ResultText + si], al
- cmp al, '$'
- je End_Parse_text_loop
- inc si
- cmp si, 2
- jne FIRST_THREE_CHARS
- ; ---------------------------
- PARSE_TEXT_LOOP:
- mov al, [Text + si]
- mov di, si
- sub di, dx
- mov [ResultText + di], al
- cmp al, '$'
- je END_PARSE_TEXT_LOOP
- cmp al, 'g'
- jne CONTINUE_PARSE_TEXT_LOOP
- mov al, [Text + si + 1]
- cmp al, '$'
- je Cmp_al_n
- xor bx, bx
- PUNCTUATION_MARKS_CHECK_LOOP:
- mov ah, [PunctuationMarks + bx]
- cmp ah, '$' ; $ - PunctuationMarks is end
- je CONTINUE_PARSE_TEXT_LOOP
- cmp al, ah
- je CMP_AL_N
- inc bx
- jmp PUNCTUATION_MARKS_CHECK_LOOP
- CMP_AL_N:
- mov al, [Text + si - 1]
- cmp al, 'n'
- jne CONTINUE_PARSE_TEXT_LOOP
- mov al, [Text + si - 2]
- cmp al, 'i'
- jne CONTINUE_PARSE_TEXT_LOOP
- mov [ResultText + di - 1], 'd'
- mov [ResultText + di - 2], 'e'
- inc dx
- CONTINUE_PARSE_TEXT_LOOP:
- inc si
- jmp PARSE_TEXT_LOOP
- END_PARSE_TEXT_LOOP:
- ; ------ new line
- mov dl, 0dh
- mov ah, 02h
- int 21h
- mov dl, 0ah
- mov ah, 02h
- int 21h
- ; ------
- lea dx, ResultText
- xor ax, ax
- mov ah, 09
- int 21h
- mov ah, 4ch
- mov al, 00h
- int 21h
- END START
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement