.proc pythagoras
                                
                ; Pythagoras c = (a*a + b*b)^0,5
		; a=var1
		; b=var2
		; c=var3
		
		; a^2 ausrechnen
		;............... var1 * var1 = temp1/temp1+1 .......
		;.... Multiplikation 8 Bit * 8 Bit auf 16 Bit ....
		lda var1
		sta temp1
		lda #0
		ldx #8
		lsr temp1
lp1

		bcc lp2
		clc
		adc var1
lp2

		ror
		ror temp1
		dex
		bne lp1
		sta temp1+1
		
		; b^2 ausrechnen
		;............... var2 * var2 = temp2/temp2+1 .......
		;.... Multiplikation 8 Bit * 8 Bit auf 16 Bit ....
		lda var2
		sta temp2
		lda #0
		ldx #8
		lsr temp2
lp3

		bcc lp4
		clc
		adc var2
lp4

		ror
		ror temp2
		dex
		bne lp3
		sta temp2+1
		
		; 16 Bit Addition
		; temp1/temp1+1  +  temp2/temp2+1  =  temp3/temp3+1
		clc
		lda temp1
		adc temp2
		sta temp3
		lda temp1+1
		adc temp2+1
		adc #0
		sta temp3+1
		
		; Quadratwurzel 16 Bit
		; nach Lee Davison
		; Quadratwurzel temp3/temp3+1 ---> Ergebnis in var3
		ldx #8
lp5

		sec
		lda temp3+1
		sbc #64
		tay
		lda temp4
		sbc var3
		bcc lp6
		sty temp3+1
		sta temp4
lp6

		rol var3
		asl temp3
		rol temp3+1
		rol temp4
		asl temp3
		rol temp3+1
		rol temp4
		dex
		bne lp5
		rts
		.endp