Trying to teach myself Assembly (masm win32), specifically doing multivariable math with user inputs. I've got the inputs done I believe, but my DOSBox32 will crash after inputs. My guess is it's due to my math section, posted below. Any help would be much appreciated, especially if you can provide insight on how to code a similar equation, as I'm trying to teach myself and I'd rather see patterns and methods over direct answers. Thank you!!
;Math ....... A = ((B * 3) + 6) / (X + D)
mov ax,numB
mov bx,3
imul bx ;Multiply bx (3) by ax (B)
add ax,6 ;Add 6 to the above
mov bx,numX
add bx,numD ;Add X + D
idiv bx ;Divide bx (X + D) by ax ((B * 3) + 6)
mov res,ax ;Set ax as result
int 21h
;Display Result
mov ax,@data
mov ds,ax ;set DS to point to the data segment
lea dx,ResPrompt ;get ResPrompt
mov ah,09h ;display string function
int 21h ;display "A = "
mov ax,@data
mov ds,ax ;set DS to point to the data segment
lea dx,res ;get result
mov ah,09h ;display string function
int 21h ;display result
I can post my code before this in case nothing here should cause a crash.