Hi,
I have started learning Assembler and as a project I want to make a program that will point prime numbers in selected range. I was pretty sure that I have done everything right, but my code doesn't work:
ORG 100H
START:
MOV AH, 1
INT 21H
MOV BX, AX ;I store left range set in BX
MOV AH, 1
INT 21H
MOV DX, AX ;I put right set in DX
MOV CX, DX
SUB CX, BX
INC CX ;CX has a number of numbers to check
MOV DX, 0
JMP CHECK
CHECK:
CMP BX, [PRIME]
JE ADPRIM
CMP BX, [PRIME + 1]
JE ADPRIM
CMP BX, [PRIME + 2]
JE ADPRIM
CMP BX, [PRIME + 3]
JE ADPRIM
INC BX
LOOP CHECK
JMP WRITE
ADPRIM:
INC DX ;DX is a number of prime numbers
PUSH BX ;I want to push all prime numbers on stack and write them later
INC BX
DEC CX
JMP CHECK
PRIME DB 50, 51, 53, 55
The problem is, ADPRIM part is never seems to activate and both DX and stack are empty when arriving at WRITE. What have I done wrong?