Routines
 Prev: 09090 Up: Map Next: 09399
09341: THE 'INITIAL PARAMETERS' SUBROUTINE
This subroutine is called by both CIRCLE and DRAW to set their initial parameters. It is called by CIRCLE with X, Y and the radius Z on the top of the stack, reading upwards. It is called by DRAW with its own X, Y, SIN (G/2) and Z, as defined in DRAW i., on the top of the stack. In what follows the stack is only shown from Z upwards.
The subroutine returns in B the arc-count A as explained in both CIRCLE and DRAW, and in mem-0 to mem-5 the quantities G/A, SIN (G/2*A), 0, COS (G/A), SIN (G/A) and G. For a circle, G must be taken to be equal to 2π.
Output
B Arc count
CD_PRMS1 09341 RST 40 Z
09342 DEFB 49 duplicate: Z, Z
09343 DEFB 40 sqr: Z, SQR Z
09344 DEFB 52 stk_data: Z, SQR Z, 2
09345 DEFB 50,0
09347 DEFB 1 exchange: Z, 2, SQR Z
09348 DEFB 5 division: Z, 2/SQR Z
09349 DEFB 229 get_mem_5: Z, 2/SQR Z, G
09350 DEFB 1 exchange: Z, G, 2/SQR Z
09351 DEFB 5 division: Z, G*SQR Z/2
09352 DEFB 42 abs: Z, G'*SQR Z/2 (G'=ABS G)
09353 DEFB 56 end_calc: Z, G'*SQR Z/2=A1, say
09354 CALL FP_TO_A A1 to A from the stack, if possible.
09357 JR C,USE_252 If A1 rounds to 256 or more, use 252.
09359 AND 252 4*INT (A1/4) to A.
09363 JR NC,DRAW_SAVE Jump if still under 256.
USE_252 09365 LD A,252 Here, just use 252.
DRAW_SAVE 09367 PUSH AF Now save the arc-count.
09368 CALL STACK_A Copy it to calculator stack too.
09371 RST 40 Z, A
09372 DEFB 229 get_mem_5: Z, A, G
09373 DEFB 1 exchange: Z, G, A
09374 DEFB 5 division: Z, G/A
09375 DEFB 49 duplicate: Z, G/A, G/A
09376 DEFB 31 sin: Z, G/A, SIN (G/A)
09377 DEFB 196 st_mem_4: (SIN (G/A) is copied to mem-4)
09378 DEFB 2 delete: Z, G/A
09379 DEFB 49 duplicate: Z, G/A, G/A
09380 DEFB 162 stk_half: Z, G/A, G/A, 0.5
09381 DEFB 4 multiply: Z, G/A, G/2*A
09382 DEFB 31 sin: Z, G/A, SIN (G/2*A)
09383 DEFB 193 st_mem_1: (SIN (G/2*A) is copied to mem-1)
09384 DEFB 1 exchange: Z, SIN (G/2*A), G/A
09385 DEFB 192 st_mem_0: (G/A is copied to mem-0)
09386 DEFB 2 delete: Z, SIN (G/2*A)=S
09387 DEFB 49 duplicate: Z, S, S
09388 DEFB 4 multiply: Z, S*S
09389 DEFB 49 duplicate: Z, S*S, S*S
09390 DEFB 15 addition: Z, 2*S*S
09391 DEFB 161 stk_one: Z, 2*S*S, 1
09392 DEFB 3 subtract: Z, 2*S*S-1
09393 DEFB 27 negate: Z, 1-2*S*S=COS (G/A)
09394 DEFB 195 st_mem_3: (COS (G/A) is copied to mem-3)
09395 DEFB 2 delete: Z
09396 DEFB 56 end_calc
09397 POP BC Restore the arc-count to B.
09398 RET Finished.
 Prev: 09090 Up: Map Next: 09399