Hi, I'm pretty new to writing stuff in Assembler . Now I'm trying to run some code that puts the odd numbers from an array to a second one, and the even numbers to a third one.
I don't really know how to make the transfer. I tried with MOVSB and STOSB but it didn't work out. This is what I've done so far...
array db 8,2,3,4,5,6,7,9,12,15
odd db "Odd $ "
even db "Even $ "
Modd db 6 dup(?)
Meven db 6 dup(?)
.code
.startup
lea si,array
lea di,even
mov cx,0Ah
loops:
lodsb
mov bl,al
and bl,0001b
cmp bl,0001b
jne yes
je no
jcxz leave
dec cx
loop loops
yes:
mov ah,2
lea dx,even
;movsb
mov ah,9
int 21h
loop loops
no:
mov ah,2
lea dx,odd
mov ah,9
int 21h
loop loops
leave:
mov ah,0
int 16h
int 20h