Hello, EEVBlog peoples. always thanks for your help.
Now, I trying understand one assembly code of 8086 that do judge positive or negative about number.
but, example code doesn't work. always code give 045 value to result.
i already tried 4 hours but, couldn't solve.
not yet didn't find which line is a problem.
if you wouldn't mind, i want request help.
please, let me know...
something i missed ?
i use emu8086 compiler.
-----------------------------------------------------------
data segment
x db '-120' ; number for judge. -123 ~ +127
data ends
stack segment
dw 100 dup(0)
stack ends
code segment
assume cs:code, ss:stack, ds:data
main proc
mov ax, data
mov ds, ax
test x, 80h
jz positive
mov dl, '-'
mov ah, 2
int 21h
neg x
positive: mov al, x
mov ah, 0
mov bl, 100
div bl ; ax / bl = ah
mov bh, ah
mov dl, al
add dl, 30h
mov ah, 2
int 21h ; hundred
mov al, bh ; remainder
mov ah, 0
mov bl, 10
div bl ; ax / bl
mov bh, ah
mov dl, al
add dl, 30h
mov ah, 2
int 21h
mov dl, bh
add dl, 30h
mov ah, 2
int 21h ; unit
mov ah, 4ch
int 21h
main endp
code ends
end main
-----------------------------------------------------------