Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
1.9 kB
5
Indexable
Never
                  AREA MyData, DATA, align = 2
					  
					  
					GLOBAL StartNumber
					GLOBAL EndNumber
					GLOBAL SieveField  
					 
StartNumber        DCD 	2                    
EndNumber          DCD 	1000                 
SieveField         FILL 1000,0x01             
PrimeField         FILL 200*2,0
                   
;***********************************************
;* Beginn des Programms *
;************************************************
    AREA |.text|, CODE, READONLY, ALIGN = 3
; ----- S t a r t des Hauptprogramms -----
	EXPORT main
    EXTERN Init_TI_Board
main  PROC
      bl    Init_TI_Board                
								
;Sievefunktion 
		ldr r0,=SieveField			
		ldr r1,=StartNumber                    
		ldr r1,[r1]                 
		ldr r2,=EndNumber                      
		ldr r2,[r2]                
		mov r7,#0x00
		strb r7,[r0]
		strb r7,[r0,#1]
for_01
		mov r5,r1                 
until_01
		cmp	r5,r2                 
		bgt enddo_01              
do_01                                               
		mov r4,r5                   
		ldrb r3,[r0,r5]           
		cmp r3,#0x01                
		bne step_01						
do_02				
		mul r6,r5,r4                       
		cmp r6,r2                
		bgt step_01               
		strb r7,[r0,r6]             
		add r4,r4,#1              			
		b  do_02         			
step_01
		add r5,r5,#1              
		b until_01                
enddo_01
                           
		ldr r3, =PrimeField						
		mov r6,r0	               
for_03
		mov r7,#0                   
until_03
		cmp r7,r2                   
		bgt enddo_03                
do_03				
		sub r5,r0,r6   
		ldrb r4,[r0],#1
		cmp r4,#0x01                
		STRHEQ r5,[r3],#2	        
step_03	
		add r7,r7,#1                
		b until_03	                
enddo_03	
forever		b   forever        
		ENDP
		END