loop does not work at all so i replaced it with decreasing CX and JNZ and it worked but when the program reaches the first DIV line it collapses, tested in turbo debugger it says it's dividing by zero!!
.STACK 100h
.DATA
;definig variables and strings
arr DW 1234h,5678h,0ff11h,1111h,2222h,3333h,4444h,5555h,6666h,7777h,8888h
result1 DB 'Max for unsigned array is:00000','$'
result2 DB 'Max for signed array is: 0000','$'
len DW 11
max DW ?
TEN DB 1h
.CODE
progstart:
MOV AX,@DATA ; DS can be written to only through a register
MOV DS,AX ; Set DS to point to data segment
MOV CX,len
XOR SI,SI
MOV AX,arr[0]
MOV max,AX
MOV BX,10
do1:
MOV AX,max
cmp AX,arr[SI]
JB swap1
ADD SI,2
DEC CX
JNZ do1
MOV CX,4
MOV AX,max
MOV SI,31
num2chU:
DIV TEN **THIS IS WHERE IT GETS STUCK**
ADD AH,'0'
MOV result1[SI],AH
MOV AH,0
DEC SI
LOOP num2chU
MOV DX,OFFSET result1 ; Set DS:DX to point to scannum1
JMP print```
///CODE IS CUT///