Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; multi-segment executable file template.
- ;preku procedura od golemi vo mali
- data segment
- ; add your data here!
- message1 db "Vnesi stringA:$"
- message2 db "Vnesi stringB:$"
- newLine db 10,13,"$"
- stringA db ?,?,?,?,?,?,?,?
- stringB db ?,?,?,?,?,?,?,?
- modifiedA db ?,?,?,?,?,?,?,?
- modifiedB db ?,?,?,?,?,?,?,?
- counter dw 0
- counter2 dw 0
- transformations db 0
- pok dw 0
- pok2 dw 0
- flag db 0
- messageIsti db "Isti se $"
- messageRazlicni db "Razlicni se $"
- ends
- stack segment
- dw 128 dup(0)
- ends
- code segment
- transform proc
- mov cx,counter
- pop bx
- checking:
- cmp cx,0d
- je forward
- pop ax
- cmp ax,5Bh
- jl isBigNumber
- dec cx
- jmp checking
- isBigNumber:
- add ax,20h
- push ax
- add sp,2
- dec cx
- inc transformations
- jmp checking
- push bx
- ret
- transform endp
- start:
- ; set segment registers:
- mov ax, data
- mov ds, ax
- mov es, ax
- ; add your code here
- lea dx,message1
- mov ah,09h
- int 21h
- insertA:
- mov ah,01h
- int 21h
- cmp al,"$"
- je continue
- mov stringA[si],al
- inc si
- inc counter
- loop insertA
- continue:
- mov ah,09h
- lea dx,newLine
- int 21h
- mov si,0h
- lea dx,message2
- mov ah,09
- int 21h
- insertB:
- mov ah,01h
- int 21h
- cmp al,"$"
- je go
- mov stringB[si],al
- inc si
- inc counter2
- loop insertB
- go:
- ;TRANSFORMING STRING A
- mov si,0h
- mov cx,counter
- pop1:
- mov dl,stringA[si]
- mov dh,0h
- push dx
- inc si
- loop pop1
- call transform
- ;GettingModifiedA
- forward:
- cmp flag,0h
- jg modifyB
- inc flag
- ;;postavuvanje na pokazuvacot
- mov si,counter
- sub si,01d
- mov cx,counter
- mov ax,0d
- mov ax,counter
- mov bl,2d
- mul bl
- mov pok,ax
- sub sp,pok
- get1:
- pop dx
- mov dh,0h
- mov modifiedA[si],dl
- dec si
- loop get1
- ;;GettingModifiedB
- ;TRANSFORMING STRING A
- mov si,0h
- mov cx,counter2
- pop2:
- mov dl,stringB[si]
- mov dh,0h
- push dx
- inc si
- loop pop2
- call transform
- modifyB:
- ;;postavuvanje na pokazuvacot
- mov si,counter2
- sub si,01d
- mov cx,counter2
- mov ax,0d
- mov ax,counter2
- mov bl,2d
- mul bl
- mov pok2,ax
- sub sp,pok2
- get2:
- pop dx
- mov dh,0h
- mov modifiedB[si],dl
- dec si
- loop get2
- ;;Sega final za sporedba dali se ednakvi
- mov cx,counter
- mov si,0d
- putInStack:
- mov dx,0d
- mov dl,modifiedA[si]
- push dx
- inc si
- loop putInStack
- mov cx,counter2
- mov si,counter2
- sub si,01d
- listInB:
- cmp cx, 0d
- je print1
- mov bl,modifiedB[si]
- pop dx
- dec cx
- dec si
- cmp bl,dl
- je listInB
- jmp print2
- print1:
- lea dx,messageIsti
- mov ah,09h
- int 21h
- jmp finishing
- print2:
- lea dx,messageRazlicni
- mov ah,09h
- int 21h
- jmp finishing
- finishing:
- endp
- end start ; set entry point and s
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement