I was supposed to write code in Assembly (.COM) that computes the given data according to the formula (b * b - 4 * a) / d. The program works fine, but I got 2 questions that I need to answer, but unfortunately I don't know the exact solution.
- Why would this program without
xor dx, dxnot work? - Why the result of the division is not necessarily in the AL register?
.MODEL TINY Code SEGMENT ORG 100h ASSUME CS:Code, DS:Code, SS:Code Start: jmp Begin a EQU 20 b EQU 10 d EQU 3 Result DB ? Begin: mov al, b mov bl, b mul bl mov bx, ax mov al, a mov ah, 4 mul ah sub bx, ax mov ax, bx xor dx, dx mov bx, d div bx mov Result, al mov ax, 4C00h int 21h Code ENDS END Start
Please help me with answering these 2 questions. Thank you!