.model small
.data
nizA db 1,2,3,4,5,6,7,8
nizB db 8 dup(?)
len equ 8
.code
main proc
mov si,0
mov di,0
mov cx,len
program:
mov al,nizA[si] ;problem is here it always stores CDh in AL
cbw ;convert AL to AX so i can divide
mov bl,2 ;The number I want to divide so I test if its even or not
div bl ;Overflow message
cmp ah,0
je next:
input:
mov dl,nizA[si]
mov nizB[di],dl
inc di
next:
add si,2
loop program
endp
end
I have this code here, for my finals that I need to make, very simple. Find odd numbers from even indexes of given array. So naturally it means I increase SI by 2 and I put that array element in AL. But no matter what number is in array, what gets stores in AL is always hex number CD, which then, if it was stored as it was supposed to, I want to do CBW to convert to AX and be able do divide with BL
I now just have error message from EMU 8086 saying
divide error - overflow. to manually process this error, change address of INT 0 in interrupt vector table.
Which surely is related to CD number, I only have two problems here
- CD being stored instead of 1
- Overflow (most likely because CD is way too high, but still I divide the numbers they only go less so it wont make sense kinda)