Code:
; PROGRAM TO DIVIDE TWO 8 BIT SIGNED NUMBERS
.MODEL SMALL
.STACK 100
.DATA
REM DB ?
QUO DB ?
.CODE
MOV BL , -4 ; DIVISOR
MOV AX , 20 ; DIVIDEND
IDIV BL
MOV REM , AL ; REMAINDER
MOV QUO , AH ; QUOTIENT
MOV DL , QUO ; PRINTING QUOTIENT
MOV DL , 48
MOV AH , 4CH
INT 21H
MOV DL , REM ; PRINTING REMAINDER
MOV DL , 48
MOV AH , 4CH
INT 21H
MOV AH , 4CH ;EXIT
INT 21H
END
; PROGRAM TO DIVIDE TWO 8 BIT SIGNED NUMBERS
.MODEL SMALL
.STACK 100
.DATA
REM DB ?
QUO DB ?
.CODE
MOV BL , -4 ; DIVISOR
MOV AX , 20 ; DIVIDEND
IDIV BL
MOV REM , AL ; REMAINDER
MOV QUO , AH ; QUOTIENT
MOV DL , QUO ; PRINTING QUOTIENT
MOV DL , 48
MOV AH , 4CH
INT 21H
MOV DL , REM ; PRINTING REMAINDER
MOV DL , 48
MOV AH , 4CH
INT 21H
MOV AH , 4CH ;EXIT
INT 21H
END
Output: