
2009 - שאלה 7
By: a guest on
May 7th, 2012 | syntax:
ASM (NASM) | size: 0.89 KB | hits: 11 | expires: Never
; multi-segment executable file template.
data segment
; add your data here!
pkey db "press any key...$"
arr1 DB 36dup (?)
arr2 DB 36dup (?)
ends
stack segment
dw 128 dup(0)
ends
code segment
start:
; set segment registers:
mov ax, data
mov ds, ax
mov es, ax
mov si,0
mov bx,0
mov cx,36
first:
mov ax,arr1[bx]
jmp before check:
a1:
mov arr2[si],ax
inc si
inc bx
loop first
jmp finish
before check:
check:
mov di,0
mov dx,arr2[di]
cmp ax,dx
jz a2
inc di
cmp di,36
jz a1
jmp check
a2:
inc bx
jmp first
finish: nop
lea dx, pkey
mov ah, 9
int 21h ; output string at ds:dx
; wait for any key....
mov ah, 1
int 21h
mov ax, 4c00h ; exit to operating system.
int 21h
ends
end start ; set entry point and stop the assembler.