View difference between Paste ID: TsgWeJd5 and 4mmA4p7x
SHOW: | | - or go back to the newest paste.
1
; multi-segment executable file template.
2
3
data segment
4
    ; add your data here!
5
    arr1 DB 1,2,2,4,1,6,6,6
6
    arr2 DB 8 dup (0)
7
ends
8
9
stack segment
10
    dw   128  dup(0)
11
ends
12
13
code segment
14
start:
15
; set segment registers:
16
    mov ax, data
17
    mov ds, ax
18
    mov es, ax
19
20
mov si,0 
21
mov bx,0 
22
mov cx,7
23
24
first: 
25
mov al,arr1[bx]
26
jmp before_check:
27
a1:
28
  mov arr2[si],al
29
  inc si
30
  inc bx
31
  
32
  cmp bx, 8
33
  jne first
34
  jmp finish
35
36
before_check:
37
mov di,0 
38
check: 
39
mov dl,arr2[di]
40
cmp al,dl
41
jz a2 
42
inc di
43-
cmp di,7 
43+
cmp di,8 
44
jz a1 
45
jmp check
46
47
a2:      
48
inc bx
49
cmp bx,8
50
je finish 
51
jmp first
52
53
54
55
finish: nop
56
57
ends
58
59
end start ; set entry point and stop the assembler.