summaryrefslogtreecommitdiff
path: root/TASK2_VER2.asm
diff options
context:
space:
mode:
Diffstat (limited to 'TASK2_VER2.asm')
-rw-r--r--TASK2_VER2.asm16
1 files changed, 16 insertions, 0 deletions
diff --git a/TASK2_VER2.asm b/TASK2_VER2.asm
new file mode 100644
index 0000000..d83a1eb
--- /dev/null
+++ b/TASK2_VER2.asm
@@ -0,0 +1,16 @@
+; MULTIPLY TWO NUMBERS TOGETHER, STORE IN MEMORY AT 00H
+; MULTIPLICATION IS NOTHING MORE THAN REPEATED ADDITION
+
+JMP START
+N1: EQU 05H ; MULTIPLICAND
+N2: EQU 03H ; MULTIPLIER
+N3: EQU 00H ; MEMORY LOCATION TO STORE RESULT
+START: LXI H,N3 ; H AS MEMORY POINTER TO OUTPUT LOCATION 00H
+ MVI C,0 ; CLEAR C
+ MOV A,C ; CLEAR A
+ MVI C,N2 ; MOVE N2 INTO C, THIS IS OUR COUNTER
+ADD: ADI N1 ; ADD N1 TO A
+ DCR C ; DECREMENT C
+ JNZ ADD ; IF C == 0 JUMP TO END
+ STA N3 ; STORE A IN MEMORY AT N3
+ HLT ; HALT \ No newline at end of file