1 2; half __hypot_callee (half left, half right) 3 4SECTION code_fp_math16 5 6PUBLIC cm16_sccz80_hypot_callee 7 8EXTERN asm_f24_f16 9EXTERN asm_f16_f24 10 11EXTERN asm_f24_mul_f24 12EXTERN asm_f24_add_f24 13 14EXTERN asm_f24_sqrt 15 16.cm16_sccz80_hypot_callee 17 18 ; hypotenuse of two two sccz80 halfs 19 ; 20 ; enter : stack = sccz80_half left, sccz80_half right, ret 21 ; 22 ; exit : HL = sccz80_half(left*right) 23 ; 24 ; uses : af, bc, de, hl, af', bc', de', hl' 25 26 pop bc ; pop return address 27 pop hl ; get right operand off of the stack 28 pop de ; get left operand off the stack 29 push bc ; push return 30 push de ; left operand on the stack 31 32 call asm_f24_f16 ; expand y to dehl 33 push de ; y d = eeeeeeee e = s------- 34 push hl ; hl = 1mmmmmmm mmmmmmmm 35 exx 36 37 pop hl 38 pop de 39 call asm_f24_mul_f24 ; y * y 40 41 ex (sp),hl ; get left operand off of the stack 42 push de ; y^2 on stack (backwards) 43 call asm_f24_f16 ; expand x to dehl 44 push de ; x d = eeeeeeee e = s------- 45 push hl ; hl = 1mmmmmmm mmmmmmmm 46 exx 47 48 pop hl 49 pop de 50 call asm_f24_mul_f24 ; x * x 51 exx 52 53 pop de ; y^2 54 pop hl 55 call asm_f24_add_f24 56 call asm_f24_sqrt 57 jp asm_f16_f24 ; return HL = sccz80_half 58 59