summaryrefslogtreecommitdiff
path: root/TASK2_VER2.asm
blob: d83a1eb5f51d93dc240f710fb07f4cb5b065067d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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