x86 Assembly DIV Prime Factorization
I'm fairly new to assembly, and I'm trying to print out the prime factorization of a given number. After hours of scouring the net, I've found some useful tidbits about the DIV instruction, but I can't get my code to do what I want.

I've done something terribly wrong, but I can't spot it. Can some kind person spot it for me, please?

    .data
    myMessage BYTE "Please enter a number to be evaluated:",0dh,0ah,0
    factor DWORD 2
    hold DWORD ?
    .code
    main PROC
    	call Clrscr  
    
    	mov	 edx,offset myMessage
    	call WriteString			;Displays myMessage
    	call ReadDec				;Puts value into EAX register
    	mov edi, factor
    	call prime
    
    
    	exit
    main ENDP
    
    prime PROC
    
    step1:	xor edx, edx
    		div edi
    		cmp edx, 1
    		jz step2
    		add factor, 1
    		mov edi, factor
    		jmp step1
    
    step2:	mov hold, eax
    		mov eax, edi
    		call WriteDec
    		mov eax, hold
    		CMP eax, 1
    		jz step3
    		jmp step1
    
    step3:	
    		exit
    prime ENDP
    		
    
    END main


x86 Assembly DIV Prime Factorization
===

I'm fairly new to assembly, and I'm trying to print out the prime factorization of a given number. After hours of scouring the net, I've found some useful tidbits about the DIV instruction, but I can't get my code to do what I want.

I've done something terribly wrong, but I can't spot it. Can some kind person spot it for me, please?

    .data
    myMessage BYTE "Please enter a number to be evaluated:",0dh,0ah,0
    factor DWORD 2
    hold DWORD ?
    .code
    main PROC
    	call Clrscr  
    
    	mov	 edx,offset myMessage
    	call WriteString			;Displays myMessage
    	call ReadDec				;Puts value into EAX register
    	mov edi, factor
    	call prime
    
    
    	exit
    main ENDP
    
    prime PROC
    
    step1:	xor edx, edx
    		div edi
    		cmp edx, 1
    		jz step2
    		add factor, 1
    		mov edi, factor
    		jmp step1
    
    step2:	mov hold, eax
    		mov eax, edi
    		call WriteDec
    		mov eax, hold
    		CMP eax, 1
    		jz step3
    		jmp step1
    
    step3:	
    		exit
    prime ENDP
    		
    
    END main

