Routines |
Prev: 2382 | Up: Map | Next: 24B7 |
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.
|
||||||||
CD_PRMS1 | 247D | RST $28 | Z | |||||
247E | DEFB $31 | duplicate: Z, Z | ||||||
247F | DEFB $28 | sqr: Z, SQR Z | ||||||
2480 | DEFB $34 | stk_data: Z, SQR Z, 2 | ||||||
2481 | DEFB $32,$00 | |||||||
2483 | DEFB $01 | exchange: Z, 2, SQR Z | ||||||
2484 | DEFB $05 | division: Z, 2/SQR Z | ||||||
2485 | DEFB $E5 | get_mem_5: Z, 2/SQR Z, G | ||||||
2486 | DEFB $01 | exchange: Z, G, 2/SQR Z | ||||||
2487 | DEFB $05 | division: Z, G*SQR Z/2 | ||||||
2488 | DEFB $2A | abs: Z, G'*SQR Z/2 (G'=ABS G) | ||||||
2489 | DEFB $38 | end_calc: Z, G'*SQR Z/2=A1, say | ||||||
248A | CALL FP_TO_A | A1 to A from the stack, if possible. | ||||||
248D | JR C,USE_252 | If A1 rounds to 256 or more, use 252. | ||||||
248F | AND $FC | 4*INT (A1/4) to A. | ||||||
2491 | ADD A,$04 | Add 4, giving the arc-count A. | ||||||
2493 | JR NC,DRAW_SAVE | Jump if still under 256. | ||||||
USE_252 | 2495 | LD A,$FC | Here, just use 252. | |||||
DRAW_SAVE | 2497 | PUSH AF | Now save the arc-count. | |||||
2498 | CALL STACK_A | Copy it to calculator stack too. | ||||||
249B | RST $28 | Z, A | ||||||
249C | DEFB $E5 | get_mem_5: Z, A, G | ||||||
249D | DEFB $01 | exchange: Z, G, A | ||||||
249E | DEFB $05 | division: Z, G/A | ||||||
249F | DEFB $31 | duplicate: Z, G/A, G/A | ||||||
24A0 | DEFB $1F | sin: Z, G/A, SIN (G/A) | ||||||
24A1 | DEFB $C4 | st_mem_4: (SIN (G/A) is copied to mem-4) | ||||||
24A2 | DEFB $02 | delete: Z, G/A | ||||||
24A3 | DEFB $31 | duplicate: Z, G/A, G/A | ||||||
24A4 | DEFB $A2 | stk_half: Z, G/A, G/A, 0.5 | ||||||
24A5 | DEFB $04 | multiply: Z, G/A, G/2*A | ||||||
24A6 | DEFB $1F | sin: Z, G/A, SIN (G/2*A) | ||||||
24A7 | DEFB $C1 | st_mem_1: (SIN (G/2*A) is copied to mem-1) | ||||||
24A8 | DEFB $01 | exchange: Z, SIN (G/2*A), G/A | ||||||
24A9 | DEFB $C0 | st_mem_0: (G/A is copied to mem-0) | ||||||
24AA | DEFB $02 | delete: Z, SIN (G/2*A)=S | ||||||
24AB | DEFB $31 | duplicate: Z, S, S | ||||||
24AC | DEFB $04 | multiply: Z, S*S | ||||||
24AD | DEFB $31 | duplicate: Z, S*S, S*S | ||||||
24AE | DEFB $0F | addition: Z, 2*S*S | ||||||
24AF | DEFB $A1 | stk_one: Z, 2*S*S, 1 | ||||||
24B0 | DEFB $03 | subtract: Z, 2*S*S-1 | ||||||
24B1 | DEFB $1B | negate: Z, 1-2*S*S=COS (G/A) | ||||||
24B2 | DEFB $C3 | st_mem_3: (COS (G/A) is copied to mem-3) | ||||||
24B3 | DEFB $02 | delete: Z | ||||||
24B4 | DEFB $38 | end_calc | ||||||
24B5 | POP BC | Restore the arc-count to B. | ||||||
24B6 | RET | Finished. |
Prev: 2382 | Up: Map | Next: 24B7 |