home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Antic Magazine 1982 August
/
Antic_August_1982_Vol_1_No_3.atr
/
fort0882.txt
< prev
next >
Wrap
Text File
|
2021-02-19
|
4KB
|
1 lines
( Turtle Graphics I, screen 1 )¢¢DECIMAL¢¢TABLE SINES¢0000 , 0175 , 0349 , 0523 , 0698 ,¢0872 , 1045 , 1219 , 1392 , 1564 ,¢1736 , 1908 , 2079 , 2250 , 2419 ,¢2588 , 2756 , 2924 , 3090 , 3256 ,¢3420 , 3584 , 3746 , 3907 , 4067 ,¢4226 , 4384 , 4540 , 4695 , 4848 ,¢5000 , 5150 , 5299 , 5446 , 5592 ,¢5736 , 5878 , 6018 , 6157 , 6293 ,¢6428 , 6561 , 6691 , 6820 , 6947 ,¢7071 , 7193 , 7314 , 7431 , 7547 ,¢7660 , 7771 , 7880 , 7986 , 8090 ,¢8192 , 8290 , 8387 , 8480 , 8572 ,¢8660 , 8746 , 8829 , 8910 , 8988 ,¢9063 , 9135 , 9205 , 9272 , 9336 ,¢9397 , 9455 , 9511 , 9563 , 9613 ,¢9659 , 9703 , 9744 , 9781 , 9816 ,¢9848 , 9877 , 9903 , 9925 , 9945 ,¢9962 , 9976 , 9986 , 9994 , 9998 ,¢10000 , -->¢¢¢( Turtle Graphics I, screen 2 )¢¢: (SIN) ( n1 --- n2 )¢ DUP 90 > IF¢ 180 SWAP - THEN¢ SINES ;¢¢: SIN ( n1 --- n2 )¢ ( Returns 10000 times the sine )¢ ( of n1 degrees. )¢ 360 MOD¢ DUP 0< IF¢ 360 + THEN¢ DUP 180 > IF¢ 180 - (SIN) MINUS ELSE¢ (SIN) THEN ;¢¢: COS ( n1 --- n2 )¢ ( Returns 10000 times the cosine )¢ ( of n1 degrees. )¢ 360 MOD 90 + SIN ;¢¢-->¢¢¢( 32 Turtle Graphics I, screen 3 )¢: SIN* ( n1 n2 --- n3 )¢ ( Returns n1 times the sine of )¢ ( n2 degrees. )¢ SIN 10000 */ ;¢¢: COS* ( n1 n2 --- n3 )¢ ( Returns n1 times the cosine of )¢ ( n2 degrees. )¢ COS 10000 */ ;¢¢-->¢¢¢( 33 Turtle Graphics I, screen 4a )¢¢0 VARIABLE TO-FLAG¢¢CODE TO ( --- )¢ 1 # LDA, TO-FLAG STA,¢ NEXT JMP, END-CODE¢¢: VALUE¢ 0 CONSTANT¢ ;CODE¢ TO-FLAG LDA, 0= IF,¢ 2 # LDY, W )Y LDA, PHA,¢ INY, W )Y LDA, PUSH JMP, ELSE,¢ 0 # LDA, TO-FLAG STA,¢ BOT LDA, 2 # LDA, W )Y STA,¢ BOT 1+ LDA, INY, W )Y STA,¢ POP JMP, THEN,¢ END-CODE¢¢-->¢¢¢( 34 Turtle Graphics I, screen 4b )¢¢0 VARIABLE TO-FLAG¢¢: TO¢ 1 TO-FLAG ! ;¢¢: VALUE¢ <BUILDS 0 ,¢ DOES> TO-FLAG @ IF¢ 0 TO-FLAG !¢ ! ELSE¢ @ THEN ;¢¢¢-->¢¢¢( Turtle Graphics I, screen 5 )¢¢VOCABULARY CLIPPING IMMEDIATE¢¢CLIPPING DEFINITIONS¢¢VALUE LEFT VALUE TOP¢VALUE RIGHT VALUE BOTTOM¢¢2 BASE !¢¢: CODE ( p --- n )¢ 0¢ OVER TOP < IF¢ 1000 + SWAP DROP ELSE¢ SWAP BOTTOM > IF¢ 0100 + THEN¢ THEN¢ OVER LEFT < IF¢ 0001 + SWAP DROP ELSE¢ SWAP RIGHT > IF¢ 0010 + THEN¢ THEN ;¢-->¢¢( Turtle Graphics I, screen 6 )¢¢VALUE X1¢VALUE Y1¢VALUE C1¢VALUE X2¢VALUE Y2¢VALUE C2¢VALUE C¢¢: CLIP_X ( n1 --- n2 )¢ Y1 _¢ X2 X1 _¢ Y2 Y1 _¢ */ X1 +;¢¢: CLIP_y ( n1 --- n2 )¢ X1 _¢ Y2 Y1 _¢ X2 X1 _¢ */ Y1 +;¢¢-->¢¢¢( 37 Turtle Graphics I, screen 7 )¢¢2 BASE !¢¢: WHERE? ( --- p )¢ C 0001 AND IF¢ LEFT LEFT CLIP_Y ELSE¢ C 0010 AND IF¢ RIGHT RIGHT CLIP_Y ELSE¢ C 0100 AND IF¢ BOTTOM CLIP_X BOTTOM ELSE¢ C 1000 AND IF¢ TOP CLIP_X TOP THEN¢ THEN¢ THEN¢ THEN ;¢DECIMAL¢¢: HERE! ( p --- )¢ C C1 = IF¢ TO Y1 TO X1 X1 Y1 CODE TO C1 ELSE¢ TO Y2 TO X2 X2 Y2 CODE TO C2 THEN ;¢¢-->¢¢¢( 38 Turtle Graphics I, screen 8 )¢¢FORTH DEFINITIONS¢¢: CLIP ( p1 p2 --- p1' p2' t )¢ ( or )¢ ( p1 p2 --- f )¢ CLIPPING¢ TO Y2 TO X2 X2 Y2 CODE TO C2¢ TO Y1 TO X1 X1 Y1 CODE TO C1¢ BEGIN¢ C1 C2 OR WHILE¢ C1 C2 AND IF¢ 0 ;S THEN¢ C1 IF¢ C1 TO C ELSE¢ C2 TO C THEN¢ WHERE? HERE! REPEAT¢ X1 Y1 X2 Y2 1 ;¢¢-->¢¢¢( 39 Turtle Graphics I, screen 9 )¢¢: GRAPHICS ( n --- )¢ ( Clears the screen and sets it up )¢ ( for graphics mode n with a text )¢ ( window. )¢ >R SETUP S CLOSE S¢ SPLIT-SCREEN R> GR. ;¢¢: LINE ( p1 p2 --- )¢ ( Displays whatever piece of the )¢ ( line from p1 to p2 is within )¢ ( the clipping window. )¢ CL# @ COLOR¢ CLIP IF¢ PLOT DRAWTO THEN ;¢¢;S¢