Coa Program
Coa Program
FACTORIAL: MUL B
DCR B ; Decrement B by 1
JNZ FACTORIAL ; Repeat loop until B = 0
LOOP: MOV A, B
CMP C ; Compare number with divisor
JZ PRIME ; If equal, it's a prime (no division found)
MOV A, B
MOV D, A ; Copy number into D
MOV A, C ; Load divisor in A
CALL MODULO ; Check if divisible (you'll create a manual routine)
MOV A, D
CPI 00H ; If remainder is 0, number is divisible → not prime
JZ NOT_PRIME
MOV A, E
MOV M, A ; Store second term at 2051H
INX H
MVI B, 03H ; Remaining 3 terms