Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- org 100h
- Start:
- xor ax, ax
- mov si, 0
- mov di, 0
- xor bx, bx
- loop_first:
- movsx ax, [arr2 + si]
- xor di, di
- loop_second:
- movsx dx, [arr1 + di]
- cmp ax, dx
- je BreakLoop
- inc di
- cmp di, 4
- je AddToRes
- jmp EndLoop
- AddToRes:
- push si
- mov si, bx
- mov [res + si], al
- pop si
- inc bx
- call PrintDigit
- EndLoop:
- cmp di, 4
- jne loop_second
- BreakLoop:
- inc si
- cmp si, 4
- jne loop_first
- PrintRes:
- push ax
- mov ah, $09
- mov dx, line
- int 21h
- pop ax
- ;print ax
- ;mov bx, ax
- add bx, '0'
- mov ah, $02
- mov dx, bx
- int 21h
- mov ah, $09
- mov dx, pak
- int 21h
- mov ah, $08
- int 21h
- ret
- PrintDigit:
- ;digit in bx
- push ax
- push bx
- push dx
- mov bx, ax
- add bx, '0'
- mov ah, $02
- mov dx, bx
- int 21h
- mov ah, $09
- mov dx, nextLine
- int 21h
- pop dx
- pop bx
- pop ax
- ret
- pak db 13, 10, 'Press any key to exit...$'
- arr1 db 1, 2, 1, 4
- arr2 db 5, 1, 7, 7 ; 2, 4, 5, 7
- nextLine db ', $'
- line db 13, 10, '$'
- res db 8 dup (?)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement