I need help with my task in assembly (Intel 8086 CPU). The task is:
A program to try reading from the terminal line by line: Read input from the terminal line by line with INT 21h AH=0x0a and find the minimum line length in bytes. The length does not include characters ending the line, i.e. you use the length passed by the service AH=0x0a in the second byte as an unsigned number. Attention, you are comparing unsigned numbers.
You put the resulting minimum length in the byte variable rsltbe in the data segment as an unsigned number.
Assume that at least one row will always be loaded.
Since the length is an unsigned byte number, a line up to a total length of 255 bytes may be processed.
I tried many times rewriting the code. Last time I tried this one, but it too doesn't work correctly:
cpu 8086
segment code
..start mov bx,data
mov ds,bx
mov bx,stack
mov ss,bx
mov sp,dno
mov al,0
lop mov bl,[loaded+1]
cmp al,bl
jb change
back mov AH, 0x0a
mov DX, loaded
int 21h
jnz lop
mov [rsltbe],al
hlt
change mov al,bl
jmp back
segment data
rsltbe db 0
loaded db 255,0
resb 255
segment stack
resb 16
dno: db ?