summaryrefslogtreecommitdiff
path: root/TASK1.asm
diff options
context:
space:
mode:
Diffstat (limited to 'TASK1.asm')
-rw-r--r--TASK1.asm20
1 files changed, 20 insertions, 0 deletions
diff --git a/TASK1.asm b/TASK1.asm
new file mode 100644
index 0000000..164e0db
--- /dev/null
+++ b/TASK1.asm
@@ -0,0 +1,20 @@
+; ADD NUMBERS IN MEMORY 00H -> NEXT 00H BYTE, STORE RESULT IN C
+
+JMP START
+START: LXI H,00H ; HL AS MEMORY POINTER
+ MVI C,00H ; CLEAR C
+ MOV B,C ; CLEAR B
+NEXT: MOV A,M ; SET ACCUMULATOR TO VALUE AT MEMORY ADDRESS
+ CPI 00H ; COMPARE ACCUMULATOR WITH 00H
+ JZ END ; JUMP IF ZERO
+ INX H ; INCREASE POINTER
+ JMP SAVE ; JUMP TO SAVE
+SAVE: MOV B,A ; STORE ACCUMULATOR IN B
+ MOV A,C ; MOVE C INTO ACCUMULATOR
+ ADD B ; ADD B
+ MOV C,A ; STORE NEW ADDED VALUED IN B
+ MVI A,00H ; CLEAR ACCUMULATOR
+ MOV B,A ; CLEAR B
+ JMP NEXT ; NEXT BYTE
+ END: HLT ; HALT
+