Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- org 100h
- Start:
- mov si, 0
- mov di, 0
- ;fill res arr with arr1
- ;FillFirst:
- ; movsx bx, [arr1 + si]
- ; mov [res + si], bl
- ;
- ; inc si
- ; cmp si, 4
- ; jne FillFirst
- ; xor si, si
- ;fill res arr with arr2
- ;FillSecond:
- ; movsx bx, [arr2 + si + 1]
- ; mov [res + si], bl;bl
- ;
- ; inc si
- ; cmp si, 4
- ; jne FillSecond
- xor ax, ax
- mov si, 0
- mov di, 0
- ReviewRes:
- movsx bx, [res + si]
- mov di, 0
- WatchFurther:
- movsx cx, [res + di]
- cmp si, di
- je Continue
- cmp bx, cx
- je BreakInnerLoop
- cmp di, 8
- je @F
- jmp Continue
- @@:
- inc ax
- call PrintDigit
- jmp BreakInnerLoop
- Continue:
- inc di
- cmp di, 8
- jbe WatchFurther
- BreakInnerLoop:
- inc si
- cmp si, 8
- jbe ReviewRes
- 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
- 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, 3, 4
- arr2 db 1, 5, 1, 1
- nextLine db ', $'
- line db 13, 10, '$'
- res db 1, 2, 3, 4, 5, 4, 1, 1
- ;res db 8 dup (?)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement