.REPEAT
.UNTIL
.REPEAT statements .UNTIL condition
i mod j = i - (i div j) × j
10 mod 3 = 1 -10 mod -3 = -1 -10 mod 3 = -1 10 mod -3 = 1
INCLUDE Irvine32.inc .data prompt1 BYTE "Dividend = ", 0 prompt2 BYTE "Divisor = ", 0 prompt3 BYTE "Remainder = ", 0 dividend SWORD ? divisor SWORD ? .code main PROC call Clrscr mov edx, OFFSET prompt1 call WriteString call ReadInt mov dividend, ax mov edx, OFFSET prompt2 call WriteString call ReadInt mov divisor, ax ; Check 0 for either operand. .IF (dividend==0 || divisor==0) mov dividend, 0 jmp L1 .ENDIF .REPEAT mov bx, divisor .IF (dividend>0 && divisor>0)