Input: R0 and R1
Output: R0 ? R0 * R1
.ORIG x3000
LD R0, N1
LD R1, N2
AND R2, R2, #0
AGAIN ADD R2, R2, R0
ADD R1, R1, #-1
BRp AGAIN
HALT
ADD R0, R2, #0
N1 .FILL x0005
N2 .FILL x0002
.END
2. Subroutine Div
Input : R0 ? dividend, R1 ? divisor
Output: R0 ? the quotient , R1 ? the remainder
(Note) R0 ? R0 / R1, R1 ? R0 % R1
.ORIG x3000
LD R0, N1
LD R1, N2
AND R2, R2, #0
AND R3, R3, #0
NOT R1, R1
ADD R1, R1, #1
AGAIN ADD R2, R2, #1
ADD R0, R0, R1
ADD R3, R0, R1
BRzp AGAIN
HALT
AND R1, R1, #0
ADD R1, R1, R0
AND R0, R0, #0
ADD R0, R0, R2
N1 .FILL x000A
N2 .FILL x0002
.END
3. Subroutine PrintInt (Div È°¿ë) ? 2ÀÚ¸®¼ö Á¤¼ö ó¸®
Input: R0 ? the integer
Print as a decimal integer string
4. Subroutine ReadInt (Mult È°¿ë) ? 2ÀÚ¸®¼ö Á¤¼ö ó¸®
Read a decimal integer string from keyboard (until enter key)
Output: R0 ? the integer
5. Program Calculator (ReadInt, Mult, PrintInt È°¿ë)
Read 2 integers
Multiply them
Print the result
AX ·¹Áö½ºÅÍ »ç¿ë¹ý¿¡ Àͼ÷ÇØÁö½Ã¸é µÇ¿ä..ÀÌ°Ç ±âº»Áß¿¡ ±âº»Àε¥...Çã°Å°Æ..
ÀÌ·±°Ç ¹°¾îº¸¸é ¾ÈµÇ¿ä Ã¥º¸°íÇϼžßÁÒ 8086¾î¼ÀÀº ¸ÅÅ©·Î ¾î¼Àºí¸® º¸¸é Àß³ª¿Í ÀÖ¾î¿ä Çѹø º¸°í Çغ¸¼¼¿ä.
¾Æ°ø ã¾ÆºÃ´Âµ¥ ¸øã°Ú³×¿ä .±×³É add , mul div ¸í·ÉÀÇ »ç¿ë¹ý ãÀ¸½Ã¸é ´ä³ª¿É´Ï´Ù.