Wednesday, February 20, 2013

Shared Program (9)

Iterative Graphics Fractal by Frank:
Here is a fun program that i wrote to explore iterative fractal graphics based on A. K. Dewdney's algorithms in Scientific American magazine. It is a fully interactive program. Tap up / down/ left/ right/ center of screen to adjust view and change patterns. Tap and drag to move patterns around on screen. Left/right tap generates new random patterns. Up/down tap zooms in/out. Center tap resets pattern. Works in portrait mode using iPhone retina mode screen 2 (640x920).

10 REM -- FRACTAL FUN --
20 GOSUB 4000
100 REM -MAIN LOOP-
101 POKE TAP,0
102 IF PEEK(TAP)=1 THEN 1000
103 IF PEEK(TAP)=2 THEN 500
110 X1=(SC*X)+MX
120 IF X1<0 OR X1>WIDTH THEN 160
130 Y1=(SC*Y)+MY
140 IF Y1<0 OR Y1>HEIGHT THEN 160
150 PSET X1,Y1,C1
160 CNT=CNT+1:IF CNT<300 GOTO 200
180 CNT = 0
190 C1=C1+1:IF C1>15 THEN C1=0
200 REM XX=Y-SQR(ABS(B*X-C))
202 XX = Y - SGN(X) * SQR(ABS(B * X - C))
210 YY = A - X
220 X = XX
230 Y = YY
240 GOTO 102
245 REM ---------------
500 REM TAP DRAG
501 MX=FN PK(XT) : MY=FN PK(YT)
503 X=0:Y=0:CNT=0:C1=0
504 RECT 0,0,WIDTH,HEIGHT,4
510 GOTO 100
1000 REM ---------------
1010 REM SCREEN WAS TAPPED
1020 XS=FN PK(XT) : YS=FN PK(YT)
1025 ALERT 2
1040 IF YS<(H2-CTR) THEN 1120
1050 IF YS>(H2+CTR) THEN 1150
1060 IF XS<(W2-CTR) THEN 1180
1070 IF XS>(W2+CTR) THEN 1185
1080 REM IN SCREEN CENTER
1090 A=3.14:B=3.2:C=6.28
1100 SC=15
1105 CIRCLE W2,H2,50,1,0:SLEEP 25
1110 GOTO 1190
1120 REM ZOOM IN
1122 DRAW "BM320,300C1R25U100R50H106G106R50D100R25":SLEEP 30
1125 SC=SC+3
1130 IF SC>100 THEN 1135
1131 GOTO 1190
1135 ALERT 5:SC=100:GOTO 1190
1150 REM ZOOM OUT
1152 DRAW "BM320,700C1R25D100R50G106H106R50U100R25":SLEEP 30
1155 SC=SC-3
1160 IF SC<1 THEN 1175
1170 GOTO 1190
1175 ALERT 5:SC=1:GOTO 1190
1180 REM RANDOM SEEDS
1181 DRAW "BM200,460C1U25L100U50G106F106U50R100U25":SLEEP 30
1182 GOTO 1189
1185 DRAW "BM440,460C1U25R100U50F106G106U50L100U25":SLEEP 30
1189 A=RND(TI)*6:B=RND(TI)*5:C=RND(TI)*6.28
1190 REM CLEAR SCREEN & VARS
1200 RECT 0,0,WIDTH,HEIGHT,4
1210 X=0:Y=0:CNT=0:C1=0
1220 GOTO 100
1230 REM -------------------
4000 REM SET UP SCREEN
4010 SCREEN 2:CLS
4020 TITLE "Fractal Fun"
4030 WIDTH=640:HEIGHT=920
4040 W2=WIDTH/2:H2=HEIGHT/2
4042 MX=W2:MY=H2
4045 CTR =180
4050 RECT 0,0,WIDTH,HEIGHT,4
4060 DEF FN PK(A)=PEEK(A)+PEEK(A+1)*256
4070 XT=1030:YT=1032:TAP=1024
4080 A=3.14:B=3.2:C=6.28
4090 X=0:Y=0:CNT=0:C1=0:SC=15
4100 LSET 3,0 REM PIXEL SIZE
4110 RETURN

Tuesday, February 19, 2013

Shared Program (8)


Game made by Sergio Menegon. Works for iPad in Portrait.

10 SCREEN 1:CLS
20 G=25
30 VX=10:VY=0:X=400:Y=200:DT=0.1:R2=60:R1=10
35 LX=100:HX=600:LY=100:HY=1000:GR=800
40 AT=2.5:WC=15:PC=WC:SP=100:DF=1.5:PU=0:BC=1.2
50 OK=0:VI=3:PV=20:RB=0:RV=2:EV$="":R=R2
1000 REM -----------------------
1010 REM MAIN CICLE
1020 REM -----------------------
1045 REM COLLISION DETECTION
1050 IF Y+R>GR THEN GOSUB 15000
1055 IF Y-R<LY THEN GOSUB 15500
1060 IF (X-R<LX OR X+R>HX) THEN GOSUB 17000
1065 VY=VY+(G-SGN(VY)*AT)*DT
1068 Y=Y+VY*DT:X=X+VX*DT
1070 BEGINFRAME:CLS
1080 LINE LX,GR,HX,GR,9
1082 FRAME LX,LY,HX,HY,1
1085 LINE LX,GR-BC*2*R,HX,GR-BC*2*R,16:REM BONUS
1090 CIRCLE X,Y,R,8,1
1100 IF PC>0 THEN PC=PC-1:GOSUB 13000
1105 GPRINT "Bonus line",LX,GR-BC*2*R-10,1
1110 GPRINT "Good! :"+STR$(OK),LX,GR+R2+30,16
1115 GPRINT "Bad! :"+STR$(RB),LX,GR+R2+60,16
1120 GPRINT "Life :"+STR$(VI),LX,GR+R2+90,16
1130 GPRINT "Score :"+STR$(PU),LX,GR+R2+120,1
1210 ENDFRAME
1990 GOSUB 10000
1999 GOTO 1000
10000 REM -----------------------------
10001 REM TAP DETECT: OUT IN XT E YT
10002 REM ----------------------------
10030 XT=PEEK(1030)+256*PEEK(1031)
10040 YT=PEEK(1032)+256*PEEK(1033)
10045 PK=PEEK(1024)
10050 IF PK=1 THEN POKE 1024,0:PK=0:GOSUB 12000
10999 RETURN
12000 REM ------------------------
12010 REM TAP POSITION ANALISYS
12020 REM ------------------------
12030 DX=XT-X:DY=YT-Y
12040 DS=SQR(DX^2+DY^2)
12050 IF DS<R THEN GOSUB 14000
12999 RETURN
13000 REM ------------------------
13010 REM PRINT EVENT
13020 REM ------------------------
13025 IF Y-R<0 THEN RETURN
13030 GPRINT EV$,X+R,Y-R,1
13100 RETURN
14000 REM ------------------------
14010 REM TAP OK!
14020 REM ------------------------
14030 PC=5:EV$="Good!"
14040 VY=-SP
14050 VX=-DF*DX
14060 OK=OK+1:R=R-2:PU=PU+10
14065 IF R<R1 THEN R=R1:G=G+1
14070 IF OK>PV THEN VI=VI+1:OK=0:EV$="Good! (+1 life)"
14080 IF Y>GR-BC*2*R+R THEN EV$=EV$+" BONUS SCORE (+100)! ":PU=PU+100:PC=25
14999 RETURN
15000 REM ------------------------
15010 REM GROUND
15020 REM ------------------------
15100 VY=-VY+AT:Y=GR-R-1
15105 PC=25:EV$="Very Bad! (-1 life)":OK=0
15110 VI=VI-1
15120 IF VI=0 GOTO 16000: REM GAME OVER
15499 RETURN
15500 REM ------------------------
15510 REM TOP
15520 REM ------------------------
15530 Y=LY+R: VY=-VY
15540 PC=25:EV$="Too high! (-1 life)":OK=0
15550 VI=VI-1
15560 IF VI=0 GOTO 16000: REM GAME OVER
15999 RETURN
16000 REM ------------------------
16010 REM GAME OVER
16020 REM ------------------------
16030 GPRINT "GAME OVER",(HX-LX)/2,(HY-LY)/2,16
16035 GPRINT "Score:"+STR$(PU),(HX-LX)/2,(HY-LY)/2+30,1
16040 SLEEP 2000
16050 SCREEN 0:CLS
16060 INPUT "Play again (y/n)";R$
16070 IF R$="y" OR R$="Y" THEN GOTO 10
16080 CLS: PRINT "Ok, bye!"
16090 PRINT "Written by Sergio Menegon - Italy"
16100 END
17000 REM ------------------------
17001 REM BORDER
17005 REM ------------------------
17010 VX=-VX:RB=RB+1:PC=10:EV$="Bad!":OK=0
17020 IF RB>RV THEN VI=VI-1:RB=0:EV$="Bad (-1 life):pc=25
17030 IF VI=0 GOTO 16000: REM GAME OVER
17999 RETURN


Monday, February 18, 2013

News (2)

Video by FlyingInHD


If you like to share your video, send email containing your video's YouTube link to:
hawwash [dot] soft [at] gmail [dot] com


Sunday, February 17, 2013

Shared Program (7)



Shared by Richard Duncan - works for iPad on Portrait:

10 EV=962
20 DIM M$(EV),P(60),W(60),C1(EV)
30 DIM ZV(EV),ODER(EV)
40 ANG=0
50 NN=960
60 SCREEN 1:CLS
70 N=0
80 D1=-18
90 D2=-10
100 D3=-26
110 D4=-90
120 D5=0
130 D6=0
140 D7=-20
150 D8=-52
160 D9=38
161 DA=-36
162 DB=-52
163 DC=170
170 P1=0
180 P2=-50
190 P3=-30-50
200 P4=-250+110
210 P5=150
220 P6=-80+20-18
230 P7=-100
240 P8=-50
250 P9=-280
251 PA=90
252 PB=200
253 PC=-320
260 FOR I=1 TO NN
270 ODER(I)=I
280 NEXT I
290 SR=64
300 R=320
310 J=0
320 T7=0
330 GOSUB 2710
340 ANG=ANG+1
350 M1 = P1
360 M2= P2
370 M3 = P3
380 XD= D1*3.14159 / 180
390 YD= D2*3.14159 / 180
400 ZD= D3*3.14159 / 180
410 S1=1
420 GOSUB 610
430 REM GOTO 1200
440 M1 = P4
450 M2= P5
460 M3 = P6
470 XD= D4*3.14159 / 180
480 YD= D5*3.14159 / 180
490 ZD= D6*3.14159 / 180
500 S1=2
510 GOSUB 610
520 M1= P7
530 M2= P8
540 M3 = P9
550 XD= D7*3.14159 / 180
560 YD= D8*3.14159 / 180
570 ZD= D9*3.14159 / 180
580 S1=3
590 GOSUB 610
591 M1= PA
592 M2= PB
593 M3 = PC
594 XD= DA*3.14159 / 180
595 YD= DB*3.14159 / 180
596 ZD= DC*3.14159 / 180
597 S1=4
598 GOSUB 610
600 GOTO 1200
610 J=0
620 FOR A = 0 TO 348 STEP 12
630 A2 = A + 12
640 A1 = A
650 A1 = A1 * 3.14159 / 180
660 A2 = A2 * 3.14159 / 180
670 J=J+1
680 FOR AA = 0 TO 315 STEP 45
690 T7=T7+1
700 A3 = AA
710 A4 = AA + 45
720 A3 = A3 * 3.14159 / 180
730 A4 = A4 * 3.14159 / 180
740 X = R * COS(A1) + COS(A1) * SR * COS(A3)+M1
750 Z= R * SIN(A1) + SIN(A1) * SR * COS(A3)+M3
760 Y = SR * SIN(A3)+M2
770 GOSUB 2290
780 X1 = X: Y1 = Y: Z1 = Z
790 X = R * COS(A1) + COS(A1) * SR * COS(A4)+M1
800 Z= R * SIN(A1) + SIN(A1) * SR * COS(A4)+M3
810 Y = SR * SIN(A4)+M2
820 GOSUB 2290
830 X2 = X: Y2 = Y: Z2 = Z
840 X = R * COS(A2) + COS(A2) * SR* COS(A4)+M1
850 Z= R * SIN(A2) + SIN(A2) * SR* COS(A4)+M3
860 Y = SR* SIN(A4)+M2
870 GOSUB 2290
880 X3 = X: Y3 = Y: Z3 = Z
890 X = R * COS(A2) + COS(A2) * SR* COS(A3)+M1
900 Z= R * SIN(A2) + SIN(A2) * SR* COS(A3)+M3
910 Y = SR* SIN(A3)+M2
920 GOSUB 2290
930 N=N+1
940 X4 = X: Y4 = Y: Z4 = Z
950 MX=X1:IF MX>X2 THEN MX=X2:IF MX>X3 THEN MX=X3
960 IF MX>X4 THEN MX=X4
970 MZ=Z1:IF MZ>Z2 THEN MZ=Z2:IF MZ>Z3 THEN MZ=Z3
980 IF MZ>Z4 THEN MZ=Z4
990 MY=Y1:IF MY>Y2 THEN MY=Y2:IF MY>Y3 THEN MY=Y3
1000 IF MY>Y4 THEN MY=Y4
1010 AX=X1:IF AX<X2 THEN AX=X2:IF AX<X3 THEN AX=X3
1020 IF AX<X4 THEN AX=X4
1030 AY=Y1:IF AY<Y2 THEN AY=Y2:IF AY<Y3 THEN AY=Y3
1040 IF AY<Y4 THEN AY=Y4
1050 IF T7=1 THEN SX=MX:IF T7=1 THEN SY=MY
1060 IF T7=1 THEN LX=AX:IF T7=1 THEN LY=AY
1070 IF T7>1 AND SX>MX THEN SX=MX
1080 IF T7>1 AND SY>MY THEN SY=MY
1090 IF T7>1 AND LX<AX THEN LX=AX
1100 IF T7>1 AND LY<AY THEN LY=AY
1110 ZV(N)=(Z1+Z2+Z3+Z4)*250
1120 REM ZV(N)=MZ*500
1130 J2=A
1140 J3=AA
1150 J1=S1
1160 GOSUB 3600
1170 NEXT AA
1180 NEXT A
1190 RETURN
1200 REM SX=SX-15
1210 REM SY=SY-15
1220 REM LX=LX+15
1230 REM LY=LY+15
1240 DV=ABS(LX-SX)
1250 BB=ABS(LY-SY)
1260 YT=900
1270 DX=700/DV
1280 DY=700/BB
1290 GOSUB 2950
1300 REM END
1310 FOR KK=1 TO NN
1320 V=ODER(KK)
1330 V1=VAL(MID$(M$(V),2,3))
1340 V2=VAL(MID$(M$(V),5,3))
1350 J1=VAL(MID$(M$(V),1,1))
1360 REM PRINT J1,V1,V2
1370 IF J1=1 THEN 1400
1380 IF J1=2 THEN 1460
1390 IF J1=3 THEN 1530
1391 IF J1=4 THEN 1582
1400 M1 = P1
1410 M2= P2
1420 M3 = P3
1430 XD= D1*3.14159 / 180
1440 YD= D2* 3.14159 / 180
1450 ZD= D3*3.14159 / 180:GOTO 1590
1460 M1 = P4
1470 M2= P5
1480 M3 = P6
1490 XD= D4*3.14159 / 180
1500 YD= D5* 3.14159 / 180
1510 ZD= D6* 3.14159 / 180
1520 GOTO 1590
1530 M1 = P7
1540 M2= P8
1550 M3 = P9
1560 XD= D7*3.14159 / 180
1570 YD= D8* 3.14159 / 180
1580 ZD= D9*3.14159 / 180
1581 GOTO 1590
1582 M1 = PA
1583 M2= PB
1584 M3 = PC
1585 XD= DA*3.14159 / 180
1586 YD= DB* 3.14159 / 180
1587 ZD= DC*3.14159 / 180
1590 J=V
1600 FOR A = V1 TO V1 +6 STEP 6
1610 A2 = A + 6
1620 A1 = A
1630 A1 = A1 * 3.14159 / 180
1640 A2 = A2 * 3.14159 / 180
1650 FOR AA = V2 TO V2+30 STEP 15
1660 A3 = AA
1670 A4=AA+15
1680 REM PRINT "aa=";AA
1690 REM PRINT "a3=";A3
1700 A3 = A3 * 3.14159 / 180
1710 A4 = A4 * 3.14159 / 180
1720 X = R * COS(A1) + COS(A1) * SR * COS(A3)+M1
1730 Z= R * SIN(A1) + SIN(A1) * SR * COS(A3)+M3
1740 Y = SR * SIN(A3)+M2
1750 REM PRINT "x=";X;A1;A3
1760 GOSUB 2290
1770 X1 = X
1780 Y1=Y
1790 Z1=Z
1800 X = R * COS(A1) + COS(A1) * SR * COS(A4)+M1
1810 Z= R * SIN(A1) + SIN(A1) * SR * COS(A4)+M3
1820 Y = SR * SIN(A4)+M2
1830 GOSUB 2290
1840 X2 = X
1850 Y2=Y
1860 Z2=Z
1870 X = R * COS(A2) + COS(A2) * SR * COS(A4)+M1
1880 Z= R * SIN(A2) + SIN(A2) * SR * COS(A4)+M3
1890 Y = SR* SIN(A4)+M2
1900 GOSUB 2290
1910 X3 = X
1920 Y3=Y
1930 Z3=Z
1940 X = R * COS(A2) + COS(A2) * SR* COS(A3)+M1
1950 Z= R * SIN(A2) + SIN(A2) * SR* COS(A3)+M3
1960 Y = SR* SIN(A3)+M2
1970 GOSUB 2290
1980 X4 = X
1990 Y4=Y
2000 Z4=Z
2010 DF=34
2020 X1=ABS(X1-SX)*DX+DF
2030 X2=ABS(X2-SX)*DX+DF
2040 X3=ABS(X3-SX)*DX+DF
2050 X4=ABS(X4-SX)*DX+DF
2060 Y1=YT-ABS(Y1-SY)*DY
2070 Y2=YT-ABS(Y2-SY)*DY
2080 Y3=YT-ABS(Y3-SY)*DY
2090 Y4=YT-ABS(Y4-SY)*DY
2100 REM PRINT X1;Y1;X2;Y2
2110 REM PRINT X3;Y3;X4;Y4
2120 TRIANGLE X1,Y1,X2,Y2,X3,Y3,C1(J),1
2130 TRIANGLE X1,Y1,X4,Y4,X3,Y3,C1(J),1
2140 LINE X1,Y1,X3,Y3,C1(J)
2150 LINE X1,Y1,X4,Y4,C1(J)
2160 LINE X1,Y1,X2,Y2,C1(J)
2170 LINE X2,Y2,X3,Y3,C1(J)
2180 LINE X3,Y3,X4,Y4,C1(J)
2190 REM LINE X1,Y1,X2,Y2,4
2200 REM LINE X2,Y2,X3,Y3,4
2210 REM LINE X3,Y3,X4,Y4,4
2220 REM LINE X1,Y1,X4,Y4,4
2230 NEXT AA
2240 NEXT A
2250 NEXT KK
2260 SLEEP 5000
2270 GOTO 60
2280 GOTO 2280
2290 XN = X * COS(YD)+ Z * SIN(YD)
2300 ZN = -X * SIN(YD) + Z * COS(YD)
2310 X = XN
2320 Z = ZN
2330 YN = -Z * SIN(XD) + Y * COS(XD)
2340 ZN = Z * COS(XD) + Y * SIN(XD)
2350 Y = YN
2360 Z = ZN
2370 XN = X * COS(ZD) + Y * SIN(ZD)
2380 YN = -X * SIN(ZD)+ Y * COS(ZD)
2390 X = XN
2400 Y = YN
2410 XR=-21+ANG
2420 YR=ANG
2430 ZR=-23+ANG
2440 REM XR=0:YR=0:ZR=0
2450 REM XR=XR*3.14159/180
2460 REM YR=YR*3.14159/180
2470 REM ZR=ZR*3.14159/180
2480 XN = X * COS(YR)+ Z * SIN(YR)
2490 ZN = -X * SIN(YR) + Z * COS(YR)
2500 X = XN
2510 Z = ZN
2520 YN = -Z * SIN(XR) + Y * COS(XR)
2530 ZN = Z * COS(XR)+ Y * SIN(XR)
2540 Y = YN
2550 Z = ZN
2560 XN = X * COS(ZR)+ Y * SIN(ZR)
2570 YN = -X * SIN(ZR)+ Y * COS(ZR)
2580 X = XN
2590 Y = YN
2600 RETURN
2610 CN=15
2620 FOR I=1 TO 200
2630 CN=CN+1:RED=RND(0)*255:GREEN=RND(0)*255:BLUE=RND(0)*255
2640 RED=INT(RED):GREEN=INT(GREEN):BLUE=INT(BLUE)
2650 CSET CN,RED,GREEN,BLUE,255
2660 RD(I)=RED:GR(I)=GREEN:BL(I)=BLUE
2670 REM PRINT CN,RED,GREEN,BLUE
2680 C1(I)=CN
2690 NEXT I
2700 RETURN
2710 U=0
2720 CSET 16,255,181,197,255
2730 T3=0
2740 FOR K=1 TO 4
2750 FOR I=1 TO 30
2760 T3=T3+1
2770 IF T3=1 THEN C2=0
2780 IF T3=2 THEN C2=1
2790 IF T3=2 THEN T3=0
2800 C3=C2
2810 FOR J=1 TO 8
2820 U=U+1
2830 C3=C3+1
2840 IF C3=1 AND K=1 THEN C1(U)=5
2850 IF C3=1 AND K=2 THEN C1(U)=2
2860 IF C3=2 AND K=1 THEN C1(U)=6
2870 IF C3=2 AND K=2 THEN C1(U)=3
2880 IF C3=1 AND K=3 THEN C1(U)=16
2890 IF C3=2 AND K=3 THEN C1(U)=1
2891 IF C3=1 AND K=4 THEN C1(U)=7
2892 IF C3=2 AND K=4 THEN C1(U)=8
2900 IF C3=2 THEN C3=0
2910 NEXT J
2920 NEXT I
2930 NEXT K
2940 RETURN
2950 N=NN
2960 K=1
2970 P(K) = 1
2980 W(K) = 1
2990 L = 1
3000 RR= N
3010 IF (RR- L) < 9 THEN 3030
3020 GOTO 3230
3030 IF (RR- L + 1) = 1 THEN 3050
3040 GOTO 3100
3050 L = P(K)
3060 RR= W(K)
3070 K = K - 1
3080 IF K = 0 THEN 3590
3090 GOTO 3010
3100 FOR I = L + 1 TO RR
3110 FOR J = L TO I - 1
3120 M = I - J + L - 1
3130 IF ZV(M) <= ZV(M + 1) THEN 3210
3140 T = ZV(M)
3150 ZV(M) = ZV(M + 1)
3160 T1 = ODER(M)
3170 ODER(M) = ODER(M + 1)
3180 ODER(M + 1) = T1
3190 ZV(M + 1) = T
3200 NEXT J
3210 NEXT I
3220 GOTO 3050
3230 I = L
3240 J = RR
3250 IF ZV(I) > ZV(J) THEN 3270
3260 GOTO 3440
3270 T = ZV(J)
3280 ZV(J) = ZV(I)
3290 T1 = ODER(J)
3300 ODER(J) = ODER(I)
3310 ODER(I) = T1
3320 ZV(I) = T
3330 I = I + 1
3340 IF J > I THEN 3360
3350 GOTO 3470
3360 IF ZV(J) < ZV(I) THEN 3380
3370 GOTO 3330
3380 T = ZV(J)
3390 ZV(J) = ZV(I)
3400 T1 = ODER(J)
3410 ODER(J) = ODER(I)
3420 ODER(I) = T1
3430 ZV(I) = T
3440 J = J - 1
3450 IF J > I THEN 3250
3460 GOTO 3470
3470 J = J + 1
3480 K=K+1
3490 IF (I - L) < (RR- J) THEN 3510
3500 GOTO 3550
3510 P(K) = J
3520 W(K) = RR
3530 RR= I
3540 GOTO 3010
3550 P(K) = L
3560 W(K) = I
3570 L=J
3580 GOTO 3010
3590 RETURN
3600 JA$ = STR$(J1)
3610 JB$ = MID$(JA$, 2, 1)
3620 JC$ = STR$(J2)
3630 JD$ = MID$(JC$, 2, LEN(JC$) - 1)
3640 JE$ = STR$(J3)
3650 JF$ = MID$(JE$, 2, LEN(JE$) - 1)
3660 IF J2 < 10 THEN JD$ = "00" + JD$
3670 IF J2 > 9 AND J2 < 100 THEN JD$ = "0" + JD$
3680 IF J2 > 100 THEN JD$ = JD$
3690 IF J3 < 10 THEN JF$ = "00" + JF$
3700 IF J3 > 9 AND J3 < 100 THEN JF$ = "0" + JF$
3710 IF J3 > 100 THEN JF$ = JF$
3720 NA$ = JB$ + JD$ + JF$
3730 M$(N)=NA$
3740 RETURN



Saturday, February 16, 2013

Shared Program (6)



Another shared program from Richard Duncan - works for iPad in Portrait.

10 EV=722
20 DIM C1(EV),CC(EV),P(60),W(60),B(EV)
30 DIM ZV(EV),ODER(EV),F(EV),S(EV)
40 DIM RD(200),GR(200),BL(200)
50 ANG=0
60 NN=720
70 SCREEN 1:CLS
80 N=0
90 FOR I=1 TO NN
100 ODER(I)=I
110 NEXT I
120 SR= 80:R=220
130 J=0
140 T7=0
150 J=0
160 GOSUB 2320
170 ANG=ANG+1
180 M1 = 300
190 M2= -24
200 M3 = -44
210 XD= 12*3.14159 / 180
220 YD= 0*3.14159 / 180
230 ZD= 0*3.14159 / 180
240 GOSUB 340
250 REM GOTO 940
260 M1 = 100
270 M2= 0
280 M3 = 0
290 XD= -90*3.14159 / 180
300 YD= 0*3.14159 / 180
310 ZD= 0*3.14159 / 180
320 GOSUB 340
330 GOTO 940
340 J=0
350 FOR A = 0 TO 348 STEP 12
360 A2 = A + 12
370 A1 = A
380 A1 = A1 * 3.14159 / 180
390 A2 = A2 * 3.14159 / 180
400 J=J+1
410 FOR AA = 0 TO 330 STEP 30
420 T7=T7+1
430 A3 = AA
440 A4 = AA + 30
450 A3 = A3 * 3.14159 / 180
460 A4 = A4 * 3.14159 / 180
470 X = R * COS(A1) + COS(A1) * SR * COS(A3)+M1
480 Z= R * SIN(A1) + SIN(A1) * SR * COS(A3)+M3
490 Y = SR * SIN(A3)+M2
500 GOSUB 1900
510 X1 = X: Y1 = Y: Z1 = Z
520 X = R * COS(A1) + COS(A1) * SR * COS(A4)+M1
530 Z= R * SIN(A1) + SIN(A1) * SR * COS(A4)+M3
540 Y = SR * SIN(A4)+M2
550 GOSUB 1900
560 X2 = X: Y2 = Y: Z2 = Z
570 X = R * COS(A2) + COS(A2) * SR* COS(A4)+M1
580 Z= R * SIN(A2) + SIN(A2) * SR* COS(A4)+M3
590 Y = SR* SIN(A4)+M2
600 GOSUB 1900
610 X3 = X: Y3 = Y: Z3 = Z
620 X = R * COS(A2) + COS(A2) * SR* COS(A3)+M1
630 Z= R * SIN(A2) + SIN(A2) * SR* COS(A3)+M3
640 Y = SR* SIN(A3)+M2
650 GOSUB 1900
660 N=N+1
670 X4 = X: Y4 = Y: Z4 = Z
680 MX=X1:IF MX>X2 THEN MX=X2:IF MX>X3 THEN MX=X3
690 IF MX>X4 THEN MX=X4
700 MZ=Z1:IF MZ>Z2 THEN MZ=Z2:IF MZ>Z3 THEN MZ=Z3
710 IF MZ>Z4 THEN MZ=Z4
720 MY=Y1:IF MY>Y2 THEN MY=Y2:IF MY>Y3 THEN MY=Y3
730 IF MY>Y4 THEN MY=Y4
740 AX=X1:IF AX<X2 THEN AX=X2:IF AX<X3 THEN AX=X3
750 IF AX<X4 THEN AX=X4
760 AY=Y1:IF AY<Y2 THEN AY=Y2:IF AY<Y3 THEN AY=Y3
770 IF AY<Y4 THEN AY=Y4
780 IF T7=1 THEN SX=MX:IF T7=1 THEN SY=MY
790 IF T7=1 THEN LX=AX:IF T7=1 THEN LY=AY
800 IF T7>1 AND SX>MX THEN SX=MX
810 IF T7>1 AND SY>MY THEN SY=MY
820 IF T7>1 AND LX<AX THEN LX=AX
830 IF T7>1 AND LY<AY THEN LY=AY
840 ZV(N)=(Z1+Z2+Z3+Z4)*250
850 REM ZV(N)=MZ*500
860 F(N)=A
870 S(N)=AA
880 CC(N)=J
890 IF XD>0 THEN B(N)=1
900 IF XD<0 THEN B(N)=2
910 NEXT AA
920 NEXT A
930 RETURN
940 REM PRINT SX;LX;SY;LY
950 GOSUB 2530
960 REM END
970 FOR KK=1 TO NN
980 V=ODER(KK)
990 V1=F(V)
1000 V2=S(V)
1010 J=V
1020 IF B(V)=2 THEN 1090
1030 M1 = 300
1040 M2= -24
1050 M3 = -44
1060 XD= 12*3.14159 / 180
1070 YD= 0* 3.14159 / 180
1080 ZD= 0*3.14159 / 180:GOTO 1150
1090 M1 = 100
1100 M2= 0
1110 M3 = 0
1120 XD= -90*3.14159 / 180
1130 YD= 0* 3.14159 / 180
1140 ZD= 0* 3.14159 / 180
1150 FOR A = V1 TO V1
1160 A2 = A + 12
1170 A1 = A
1180 A1 = A1 * 3.14159 / 180
1190 A2 = A2 * 3.14159 / 180
1200 FOR AA = V2 TO V2
1210 A3 = AA
1220 A4=AA+30
1230 REM PRINT "aa=";AA
1240 REM PRINT "a3=";A3
1250 A3 = A3 * 3.14159 / 180
1260 A4 = A4 * 3.14159 / 180
1270 X = R * COS(A1) + COS(A1) * SR * COS(A3)+M1
1280 Z= R * SIN(A1) + SIN(A1) * SR * COS(A3)+M3
1290 Y = SR * SIN(A3)+M2
1300 REM PRINT "x=";X;A1;A3
1310 GOSUB 1900
1320 X1 = X
1330 Y1=Y
1340 Z1=Z
1350 X = R * COS(A1) + COS(A1) * SR * COS(A4)+M1
1360 Z= R * SIN(A1) + SIN(A1) * SR * COS(A4)+M3
1370 Y = SR * SIN(A4)+M2
1380 GOSUB 1900
1390 X2 = X
1400 Y2=Y
1410 Z2=Z
1420 X = R * COS(A2) + COS(A2) * SR * COS(A4)+M1
1430 Z= R * SIN(A2) + SIN(A2) * SR * COS(A4)+M3
1440 Y = SR* SIN(A4)+M2
1450 GOSUB 1900
1460 X3 = X
1470 Y3=Y
1480 Z3=Z
1490 X = R * COS(A2) + COS(A2) * SR* COS(A3)+M1
1500 Z= R * SIN(A2) + SIN(A2) * SR* COS(A3)+M3
1510 Y = SR* SIN(A3)+M2
1520 GOSUB 1900
1530 X4 = X
1540 Y4=Y
1550 Z4=Z
1560 DX1=ABS(LX-SX)
1570 DY1=ABS(LY-SY)
1580 REM PRINT "dx=";DX;"dy=";DY
1590 REM PRINT "x1before=";X1
1600 YT=900
1610 DF=34
1620 DX=700/DX1
1630 DY=700/DY1
1640 X1=ABS(X1-SX)*DX+DF
1650 X2=ABS(X2-SX)*DX+DF
1660 X3=ABS(X3-SX)*DX+DF
1670 X4=ABS(X4-SX)*DX+DF
1680 Y1=YT-ABS(Y1-SY)*DY
1690 Y2=YT-ABS(Y2-SY)*DY
1700 Y3=YT-ABS(Y3-SY)*DY
1710 Y4=YT-ABS(Y4-SY)*DY
1720 REM PRINT X1;Y1;X2;Y2
1730 REM PRINT X3;Y3;X4;Y4
1740 TRIANGLE X1,Y1,X2,Y2,X3,Y3,C1(J),1
1750 TRIANGLE X1,Y1,X4,Y4,X3,Y3,C1(J),1
1760 LINE X1,Y1,X3,Y3,C1(J)
1770 LINE X1,Y1,X4,Y4,C1(J)
1780 LINE X1,Y1,X2,Y2,C1(J)
1790 LINE X2,Y2,X3,Y3,C1(J)
1800 LINE X3,Y3,X4,Y4,C1(J)
1810 LINE X1,Y1,X2,Y2,4
1820 LINE X2,Y2,X3,Y3,4
1830 LINE X3,Y3,X4,Y4,4
1840 LINE X1,Y1,X4,Y4,4
1850 NEXT AA
1860 NEXT A
1870 NEXT KK
1880 SLEEP 5000
1890 GOTO 70
1900 XN = X * COS(YD)+ Z * SIN(YD)
1910 ZN = -X * SIN(YD) + Z * COS(YD)
1920 X = XN
1930 Z = ZN
1940 YN = -Z * SIN(XD) + Y * COS(XD)
1950 ZN = Z * COS(XD) + Y * SIN(XD)
1960 Y = YN
1970 Z = ZN
1980 XN = X * COS(ZD) + Y * SIN(ZD)
1990 YN = -X * SIN(ZD)+ Y * COS(ZD)
2000 X = XN
2010 Y = YN
2020 XR=-21+ANG
2030 YR=ANG
2040 ZR=-23+ANG
2050 REM XR=0:YR=0:ZR=0
2060 REM XR=XR*3.14159/180
2070 REM YR=YR*3.14159/180
2080 REM ZR=ZR*3.14159/180
2090 XN = X * COS(YR)+ Z * SIN(YR)
2100 ZN = -X * SIN(YR) + Z * COS(YR)
2110 X = XN
2120 Z = ZN
2130 YN = -Z * SIN(XR) + Y * COS(XR)
2140 ZN = Z * COS(XR)+ Y * SIN(XR)
2150 Y = YN
2160 Z = ZN
2170 XN = X * COS(ZR)+ Y * SIN(ZR)
2180 YN = -X * SIN(ZR)+ Y * COS(ZR)
2190 X = XN
2200 Y = YN
2210 RETURN
2220 CN=15
2230 FOR I=1 TO 200
2240 CN=CN+1:RED=RND(0)*255:GREEN=RND(0)*255:BLUE=RND(0)*255
2250 RED=INT(RED):GREEN=INT(GREEN):BLUE=INT(BLUE)
2260 CSET CN,RED,GREEN,BLUE,255
2270 RD(I)=RED:GR(I)=GREEN:BL(I)=BLUE
2280 REM PRINT CN,RED,GREEN,BLUE
2290 C1(I)=CN
2300 NEXT I
2310 RETURN
2320 U=0
2330 T3=0
2340 FOR K=1 TO 2
2350 FOR I=1 TO 30
2360 T3=T3+1
2370 IF T3=1 THEN C2=0
2380 IF T3=2 THEN C2=1
2390 IF T3=2 THEN T3=0
2400 C3=C2
2410 FOR J=1 TO 12
2420 U=U+1
2430 C3=C3+1
2440 IF C3=1 THEN C1(U)=5
2450 IF C3=1 AND K=2 THEN C1(U)=2
2460 IF C3=2 THEN C1(U)=6
2470 IF C3=2 AND K=2 THEN C1(U)=3
2480 IF C3=2 THEN C3=0
2490 NEXT J
2500 NEXT I
2510 NEXT K
2520 RETURN
2530 N=NN
2540 K=1
2550 P(K) = 1
2560 W(K) = 1
2570 L = 1
2580 RR= N
2590 IF (RR- L) < 9 THEN 2610
2600 GOTO 2810
2610 IF (RR- L + 1) = 1 THEN 2630
2620 GOTO 2680
2630 L = P(K)
2640 RR= W(K)
2650 K = K - 1
2660 IF K = 0 THEN 3170
2670 GOTO 2590
2680 FOR I = L + 1 TO RR
2690 FOR J = L TO I - 1
2700 M = I - J + L - 1
2710 IF ZV(M) <= ZV(M + 1) THEN 2790
2720 T = ZV(M)
2730 ZV(M) = ZV(M + 1)
2740 T1 = ODER(M)
2750 ODER(M) = ODER(M + 1)
2760 ODER(M + 1) = T1
2770 ZV(M + 1) = T
2780 NEXT J
2790 NEXT I
2800 GOTO 2630
2810 I = L
2820 J = RR
2830 IF ZV(I) > ZV(J) THEN 2850
2840 GOTO 3020
2850 T = ZV(J)
2860 ZV(J) = ZV(I)
2870 T1 = ODER(J)
2880 ODER(J) = ODER(I)
2890 ODER(I) = T1
2900 ZV(I) = T
2910 I = I + 1
2920 IF J > I THEN 2940
2930 GOTO 3050
2940 IF ZV(J) < ZV(I) THEN 2960
2950 GOTO 2910
2960 T = ZV(J)
2970 ZV(J) = ZV(I)
2980 T1 = ODER(J)
2990 ODER(J) = ODER(I)
3000 ODER(I) = T1
3010 ZV(I) = T
3020 J = J - 1
3030 IF J > I THEN 2830
3040 GOTO 3050
3050 J = J + 1
3060 K=K+1
3070 IF (I - L) < (RR- J) THEN 3090
3080 GOTO 3130
3090 P(K) = J
3100 W(K) = RR
3110 RR= I
3120 GOTO 2590
3130 P(K) = L
3140 W(K) = I
3150 L=J
3160 GOTO 2590
3170 RETURN


Thursday, February 14, 2013

Shared Program (5)


Painting Program - anonymous sharing (as requested) for iPhone/iPod Touch/iPad:

100 SCREEN 1
110 CLS
300 DEF FN PK(A)=PEEK(A)+PEEK(A+1)*256
400 XT=1030
500 YT=1032
600 POKE 1024,0
700 C=5
800 LSET 5,0
1000 P= PEEK(1024) + 1
1005 REM
1010 REM
1020 ON P GOSUB 2000, 3000, 4000, 5000
1030 GOTO 1000
2000 REM NO TOUCH
2999 RETURN
3000 REM TOUCH BEGAN
3010 X1 = FN PK(XT) : Y1 = FN PK(YT)
3020 XT=1030
3030 YT=1032
3035 PSET X1,Y1,C
3040 POKE 1024,0
3050 IF PEEK(1024) = 0 THEN GOTO 3050
3999 RETURN
4000 REM TOUCH MOVED
4010 X2 = FN PK(XT) : Y2 = FN PK(YT)
4020 LINE X1,Y1,X2,Y2,C
4030 X1=X2 : Y1=Y2
4999 RETURN
5000 REM TOUCH RELEASE
5010 X2 = FN PK(XT) : Y2 = FN PK(YT)
5020 LINE X1,Y1,X2,Y2,C
5100 POKE 1024,0
5999 RETURN

Wednesday, February 13, 2013

Shared Program (4)


Another shared program from Richard Duncan - works for iPad in Portrait.

1 SCREEN 1:CLS
2 DIM C1(200)
3 GOSUB 900
5 ZD=0
10 YD=0
15 XD=90
20 XD= XD* 3.14159 / 180
25 YD= YD* 3.14159 / 180
30 ZD= ZD* 3.14159 / 180
35 R = 220
36 SR= 80
37 T=0
40 FOR A = 0 TO 350 STEP 10
45 A2 = A + 10
50 A1 = A
55 A12 = A + 5
60 A1 = A1 * 3.14159 / 180
65 A2 = A2 * 3.14159 / 180
70 A12 = A12 * 3.14159 / 180
72 J=0
73 T=T+1
75 FOR AA = 0 TO 340 STEP 20
80 A3 = AA: A4 = AA + 20
85 A34 = AA + 10
86 J=J+1
90 IF A3 >= 360 THEN A3 = A3 - 360
95 IF A4 >= 360 THEN A4 = A4 - 360
100 A3 = A3 * 3.14159 / 180
105 A4 = A4 * 3.14159 / 180
110 A34 = A34 * 3.14159 / 180
115 X = R * COS(A1) + COS(A1) * SR * COS(A3)
116 Z= R * SIN(A1) + SIN(A1) * SR * COS(A3)
117 REM END
120 Y = SR * SIN(A3)
125 GOSUB 500
130 X1 = X: Y1 = Y: Z1 = Z
135 X = R * COS(A1) + COS(A1) * SR * COS(A4)
136 Z= R * SIN(A1) + SIN(A1) * SR * COS(A4)
140 Y = SR * SIN(A4)
145 GOSUB 500
150 X2 = X: Y2 = Y: Z2 = Z
155 X = R * COS(A2) + COS(A2) * SR* COS(A4)
156 Z= R * SIN(A2) + SIN(A2) * SR* COS(A4)
160 Y = SR* SIN(A4)
165 GOSUB 500
170 X3 = X: Y3 = Y: Z3 = Z
175 X = R * COS(A2) + COS(A2) * SR* COS(A3)
176 Z= R * SIN(A2) + SIN(A2) * SR* COS(A3)
180 Y = SR* SIN(A3)
181 GOSUB 500
183 X4 = X: Y4 = Y: Z4 = Z
184 MX=X1:IF MX>X2 THEN MX=X2:IF MX>X3 THEN MX=X3
185 IF MX>X4 THEN MX=X4
188 MY=Y1:IF MY>Y2 THEN MY=Y2:IF MY>Y3 THEN MY=Y3
189 IF MY>Y4 THEN MY=Y4
190 AX=X1:IF AX<X2 THEN AX=X2:IF AX<X3 THEN AX=X3
191 IF AX<X4 THEN AX=X4
192 AY=Y1:IF AY<Y2 THEN AY=Y2:IF AY<Y3 THEN AY=Y3
193 IF AY<Y4 THEN AY=Y4
194 IF T=1 THEN SX=MX:IF T=1 THEN SY=MY
195 IF T=1 THEN LX=AX:IF T=1 THEN LY=AY
197 IF T>1 AND SX>MX THEN SX=MX
199 IF T>1 AND SY>MY THEN SY=MY
201 IF T>1 AND LX<AX THEN LX=AX
203 IF T>1 AND LY<AY THEN LY=AY
205 NEXT AA
210 NEXT A
211 REM PRINT SX;LX;SY;LY
212 J=0
240 FOR A = 0 TO 350 STEP 10
245 A2 = A + 10
250 A1 = A
260 A1 = A1 * 3.14159 / 180
265 A2 = A2 * 3.14159 / 180
272 J=J+1
275 FOR AA = 0 TO 340 STEP 20
280 A3 = AA
281 A4=AA+20
287 REM PRINT "aa=";AA
296 REM PRINT "a3=";A3
300 A3 = A3 * 3.14159 / 180
305 A4 = A4 * 3.14159 / 180
315 X = R * COS(A1) + COS(A1) * SR * COS(A3)
316 Z= R * SIN(A1) + SIN(A1) * SR * COS(A3)
320 Y = SR * SIN(A3)
321 REM PRINT "x=";X;A1;A3
325 GOSUB 500
330 X1 = X
331 Y1=Y
332 Z1=Z
335 X = R * COS(A1) + COS(A1) * SR * COS(A4)
336 Z= R * SIN(A1) + SIN(A1) * SR * COS(A4)
340 Y = SR * SIN(A4)
345 GOSUB 500
350 X2 = X
351 Y2=Y
352 Z2=Z
355 X = R * COS(A2) + COS(A2) * SR * COS(A4)
356 Z= R * SIN(A2) + SIN(A2) * SR * COS(A4)
360 Y = SR* SIN(A4)
365 GOSUB 500
370 X3 = X
371 Y3=Y
372 Z3=Z
375 X = R * COS(A2) + COS(A2) * SR* COS(A3)
376 Z= R * SIN(A2) + SIN(A2) * SR* COS(A3)
377 Y = SR* SIN(A3)
378 GOSUB 500
379 X4 = X
380 Y4=Y
381 Z4=Z
382 DX1=ABS(LX-SX)
383 DY1=ABS(LY-SY)
384 REM PRINT "dx=";DX;"dy=";DY
385 REM PRINT "x1before=";X1
386 YT=900
387 DF=34
388 DX=700/DX1
389 DY=700/DY1
392 X1=ABS(X1-SX)*DX+DF
393 X2=ABS(X2-SX)*DX+DF
394 X3=ABS(X3-SX)*DX+DF
395 X4=ABS(X4-SX)*DX+DF
404 Y1=YT-ABS(Y1-SY)*DY
405 Y2=YT-ABS(Y2-SY)*DY
406 Y3=YT-ABS(Y3-SY)*DY
407 Y4=YT-ABS(Y4-SY)*DY
408 REM PRINT X1;Y1;X2;Y2
409 REM PRINT X3;Y3;X4;Y4
410 TRIANGLE X1,Y1,X2,Y2,X3,Y3,C1(J),1
411 TRIANGLE X1,Y1,X4,Y4,X3,Y3,C1(J),1
412 LINE X1,Y1,X2,Y2,12
413 LINE X2,Y2,X3,Y3,4
414 LINE X3,Y3,X4,Y4,4
415 LINE X1,Y1,X4,Y4,4
421 NEXT AA
423 NEXT A
424 REM END
425 GOTO 425
500 XN = X * COS(YD)+ Z * SIN(YD)
510 ZN = -X * SIN(YD) + Z * COS(YD)
520 X = XN
521 Z = ZN
525 YN = -Z * SIN(XD) + Y * COS(XD)
530 ZN = Z * COS(XD) + Y * SIN(XD)
535 Y = YN
536 Z = ZN
540 XN = X * COS(ZD) + Y * SIN(ZD)
545 YN = -X * SIN(ZD)+ Y * COS(ZD)
550 X = XN
551 Y = YN
560 RETURN
900 CN=15
901 DIM RD(200),GR(200),BL(200)
903 FOR I=1 TO 200
904 CN=CN+1:RED=RND(0)*255:GREEN=RND(0)*255:BLUE=RND(0)*255
905 RED=INT(RED):GREEN=INT(GREEN):BLUE=INT(BLUE)
906 CSET CN,RED,GREEN,BLUE,255
907 RD(I)=RED:GR(I)=GREEN:BL(I)=BLUE
910 REM PRINT CN,RED,GREEN,BLUE
914 C1(I)=CN
916 NEXT I
920 RETURN


Tuesday, February 12, 2013

Shared Program (3)

    This shared program is from Sergio Menegon. It is a Paint Brush program, where you can select the color and the size of the brush and you have the ability to clear the painting. works for iPad in Landscape orientation.

4 REM ---------------------------
5 REM INIZIALIZZAZIONI E PRIMO DISEGNO MENU
6 REM ---------------------------
10 C=1:D=5:LM=50:AM=40:TP=50
20 SCREEN 1:CLS
30 GOSUB 30000
10000 REM -----------------------------
10001 REM ATTESA TAP: OUT IN XT E YT
10002 REM ----------------------------
10010 LX=1030:LY=1032
10020 POKE 1024,0
10030 IF PEEK(1024)=0 GOTO 10030
10040 XT=PEEK(LX)+256*PEEK(1031)
10050 YT=PEEK(1032)+256*PEEK(1033)
11000 REM ------------------------
11010 REM VERIFICA TAP SU MENU
11020 REM ------------------------
11025 REM TAP FUORI MENU SUP MANDA A DISEGNO
11030 IF YT>TP+2*AM+D THEN GOTO 15000
11050 REM TAP SU MENU: DETERMINO RIGA E COL
11060 CO=INT(XT/LM)+1
11065 IF CO>17 THEN GOTO 21000
11070 RI=INT((YT-TP)/AM)+1
11100 REM SETTO NUOVI VALORI E RICORDO VECCHI
11280 IF RI=1 THEN C=CO-1
11290 IF RI=2 THEN D=CO
11300 GOSUB 30000
14900 GOTO 10000
15000 REM ----------------------------
15010 REM PLOT NEL PUNTO TAPPATO
15020 REM ----------------------------
15040 CIRCLE XT,YT,D,C,1
15050 GOTO 10000
21000 REM -----------------------
21010 REM CANCELLA DISEGNO
21020 REM -----------------------
21030 CLS
21040 GOTO 20
30000 REM -----------------------
30005 REM DISEGNA MENU
30010 REM -----------------------
30015 RECT 0,0,19*LM,TP+2*AM,0
30020 FOR CL=0 TO 16
30030 RECT CL*LM,TP,(CL+1)*LM,TP+AM,CL
30035 FRAME CL*LM,TP,(CL+1)*LM,TP+AM,16
30040 FRAME CL*LM,AM+TP,(CL+1)*LM,TP+2*AM,16
30100 NEXT
30110 FOR P=0 TO 16
30120 CIRCLE INT(LM/2)+LM*P,TP+AM+INT(AM/2),P+1,16,1
30130 NEXT
30140 FRAME 17*LM+5,TP,19*LM,TP+2*AM,16
30150 GPRINT "cls",18*LM,TP+AM,16
30160 CIRCLE INT(LM/2)+LM*C,TP+INT(AM/2),AM/4,16,0
30170 CIRCLE INT(LM/2)+LM*(D-1),TP+AM+INT(AM/2),D+3,16,0
31000 RETURN


Monday, February 11, 2013

Shared Program (2)


    Another shared program from Richard Duncan - Chesapeake, USA and works for iPad in Portrait orientation.

1 DIM C1(200)
12 NM = 1.1:WW=15
13 S6=-40:N=62:MIN=768
14 GOSUB 900
15 H = 0:SCREEN 1:CLS
16 ROWS = INT(1004/ (N)) - 1:PRINT "rows1=";ROWS
17 R1 = INT(768/ (N * NM))
18 IF R1 < ROWS THEN ROWS = R1
19 IF N < 12 THEN ROWS = ROWS - 1
20 IF MIN < 3100 THEN ROWS = ROWS - 2
21 S5ARTS= 768- INT(ROWS * N * NM + 0.5)
22 S5ARTS= INT(S5ART* 0.5 + 0.5) + INT(N * 1.2 + 0.5)
23 S5ARTS=S5ARTS- 37
25 IF N < 30 THEN ROWS = ROWS - 1
26 HH = INT(0.866 * N * NR + 0.5)
27 NR = 0.44
28 HH = INT(0.866 * N * NR + 0.5): H = HH
29 H = H * 1.5 + 45:PRINT "s5art=";S5ART
30 REM FOR E=1 TO 1004:CSET C1(20),RD(20),GR(20),BL(20),255
32 FOR K = 1 TO ROWS-1
34 NO = ROWS - K
35 Q=768-(NO-1)*88
36 S5ART = Q/2:OS5=S5ART
37 LOWER = INT(0.866 * N + 0.5)
41 GOSUB 400
43 H = H - HH
44 GOSUB 450
47 H = H + LOWER
48 NN = N
49 N = INT(N * 0.4 + 0.5)
50 LOWER = INT(0.866 * N + 0.5)
52 GOSUB 480
58 N = NN
59 H = H + LOWER+2
60 NEXT K
62 GOTO 500
200 TPS= INT(N * 0.866 + 0.5)
205 FOR I = 0 TO TPS
210 L= INT(I * 0.5 * NM + 0.5)
213 C=C1(W)
214 CSET C,RD(W),GR(W),BL(W),255
215 LINE G-L,I+70,G+L,I+70,C
216 LINE G-L,I+71,G+L,I+71,C
217 NEXT I
221 REM GOSUB 600
225 FOR I = TPS TO 1004-H - LOWER-300
231 X= INT(N * 0.5 * NM + 0.5)
232 Y=INT(N * 0.866 + 0.5) + I
233 CSET C,RD(W),GR(W),BL(W),255
234 LINE G-1,I+1,G+X,Y+1,C
235 LINE G-1,I+1,G-X,Y+1,C
238 LINE G-X,Y+1,G+X,Y+1,C
239 LINE G-1,I,G-X,Y,0
240 LINE G-1,I,G+X,Y,0
242 LINE G-1,I-1,G+X+1,Y-1,0
248 LINE G-1,I-1,G-X-1,Y-1,0
260 NEXT I
285 RETURN
300 TPS= INT(N * 0.866 + 0.5)
302 COUNTERT = COUNTERT + 1
305 FOR I = 0 TO TPS
310 LN = INT((TPS- I) * 0.5 * NM + 0.5)
311 CSET C1(W),RD(W),GR(W),BL(W),255
312 REM PRINT S5,LN,I
315 LINE G+ LN - 2, I+70,G- LN - 1 - 1, I+70, C1(W)
320 NEXT I
322 REM GOTO 322
323 V=1004-H-INT(.866*N+.5)-300
330 FOR I = TPS TO V
340 X = INT(N * 0.5 * NM + 0.5)
342 Y = INT(N * 0.866 + 0.5)
344 S5V3 = -1
345 CSET C1(W),RD(W),GR(W),BL(W),255
346 REM PRINT S5,X,Y,I
350 LINE G- X + S5V3, I,G+ 1, Y + I, C1(W)
355 LINE G+ X + S5V3, I,G- 1, Y + I, C1(W)
365 LINE G- X + S5V3, I,G+ X + 4, I,0
366 LINE G- X + S5V3 - 1, I,G+ X + 4, I, 0
367 LINE G- X + S5V3 - 1, I-1,G+ X + 4, I-1,0
370 LINE G+ X + S5V3, 0,G+ X + S5V3, I, 0
372 LINE G+ X + S5V3 + 1, 0,G+ X + S5V3 + 1, I, 0
387 NEXT I
397 RETURN
400 SP = 64
403 G=S5ART-88
405 FOR J = 1 TO NO
407 W = W + 1
408 G= G+88
420 GOSUB 200
430 NEXT J
435 W=W-NO
440 RETURN
450 G=S5ART-88
452 FOR J= 1 TO NO
455 W = W + 1
456 G=G+88
465 GOSUB 300
468 NEXT J
469 W=W-NO
470 RETURN
480 Z=Q/2-88
481 FOR J = 1 TO NO
482 W = W + 1
485 Z= Z+88
488 GOSUB 700
492 NEXT J
496 RETURN
500 N = N
501 SLEEP 200
510 GOTO 510
700 TPS= INT(N * 0.866 + 0.5)
705 FOR I = 0 TO TPS
710 L= INT(I * 0.5 * NM + 0.5)
713 C=C1(W)
714 CSET C,RD(W),GR(W),BL(W),255
715 LINE Z-L,I+70,Z+L,I+70,C
716 LINE Z-L,I+71,Z+L,I+71,C
717 LINE Z-L,I+69,Z+L,I+69,C
720 NEXT I
725 FOR I = TPS TO 1004-H - LOWER-300
731 X= INT(N * 0.5 * NM + 0.5)
732 Y=INT(N * 0.866 + 0.5) + I
733 CSET C,RD(W),GR(W),BL(W),255
734 LINE Z-1,I+1,Z+X,Y+1,C
735 LINE Z-1,I+2,Z+X,Y+2,C
736 LINE Z-1,I+1,Z-X,Y+1,C
737 LINE Z-1,I+2,Z-X,Y+2,C
738 LINE Z-X,Y+1,Z+X,Y+1,C
739 LINE Z-X,Y+2,Z+X,Y+2,C
740 LINE Z-1,I,Z+X,Y,0
741 LINE Z-1,I,Z-X,Y,0
742 LINE Z-1,I-1,Z+X+1,Y-1,0
743 LINE Z-1,I,Z+X,Y,0
745 LINE Z-1,I-1,Z+X+1,Y-1,0
748 LINE Z-1,I-1,Z-X-1,Y-1,0
750 NEXT I
760 RETURN
900 CN=15
901 DIM RD(200),GR(200),BL(200)
903 FOR I=1 TO 200
904 CN=CN+1:RED=RND(0)*255:GREEN=RND(0)*255:BLUE=RND(0)*255
905 RED=INT(RED):GREEN=INT(GREEN):BLUE=INT(BLUE)
906 CSET CN,RED,GREEN,BLUE,255
907 RD(I)=RED:GR(I)=GREEN:BL(I)=BLUE
910 REM PRINT CN,RED,GREEN,BLUE
914 C1(I)=CN
916 NEXT I920 RETURN


Sunday, February 10, 2013

Shared Program (1)


    This is the first shared program. It was from Richard Duncan - Chesapeake, USA and works for iPad in Portrait.

4 CN=15
5 K=4
10 SCREEN 1
18 NN=1.1
19 NN=1
20 N=80
21 CLS
22 SCREEN 1: CLS
23 CC=384:HH=100:RT=4
24 P3$="12345":P4$="67891":P5$="1011121314"
25 RT=4
26 GOSUB 129
27 T=T
28 CC=384+T:HH=100-S:RT=3
30 GOSUB 152
34 P3$="54123":P4$="17896":P5$="141213101115"
35 CC=384:HH=100+N:RT=3:P3$="28953":P4$="17346"
36 GOSUB 129
38 CC=384+T:HH=100+N-S:RT=2:P3$="68972":P4$="13254"
40 GOSUB 152
42 P5$="1310151214"
45 CC=384:HH=100+2*N:RT=2:P4$="86921":P3$="34215":GOSUB 129
48 CC=384+T:HH=100+2*N-S:RT=1:GOSUB 152
49 P5$="10141312"
50 CC=384:HH=100+3*N:RT=1:P3$="1439":P4$="2678":GOSUB 129
52 CC=384+T:HH=100+3*N-S:RT=0:GOSUB 152
56 C=384:H=100+4*N:P3=2:P4=14:P5=15:GOSUB 230
100 GOTO 280
129 FOR R=0 TO RT
130 GOSUB 281:P5=CN:GOSUB 281:P3=CN
131 GOSUB 281: P4=CN
132 C=CC-R*T:H=HH-R*N/2
133 OC=C+T
136 GOSUB 230
137 IF R=0 THEN 148
138 GOSUB 281:P6=CN
142 FOR I=0 TO N
143 T3=INT(I*.8660+.5)*NN:S3=INT(I/2+.5)
144 LINE OC+T3,KY-S3,OC+T3-T,KY-S3-S,P6
145 LINE OC+T3,KY-S3-1,OC+T3-T,KY-S3-S-1,P6
146 NEXT I
148 NEXT R
149 RETURN
150 L=6
152 FOR R=0 TO RT
153 GOSUB 281:P3=CN
154 GOSUB 281:P4=CN
155 GOSUB 281:P5=CN
156 C=CC+R*T:H=HH-R*N/2
157 OC=C-T
159 GOSUB 230
160 IF R=0 THEN 162
161 P6=VAL(MID$(P3$,R,1))
162 IF R=0 THEN P6=6
163 FOR I=0 TO N
165 T3=INT(I*.8660+.5)*NN:S3=INT(I/2+.5)
166 LINE OC+T3,KY-S3,OC+T3-T,KY-S3-S,P6
167 LINE OC+T3,KY-S3-1,OC+T3-T,KY-S3-S-1,P6
168 NEXT I
170 NEXT R
171 RETURN
230 FOR I = 0 TO N
232 S=INT(N/2+.5):T=INT(S*1.732+.5)*NN
233 S5=2*N+2
235 LINE C,S5-I,C-T,S5-I-S,P3
237 LINE C,S5-I,C+T,S5-I-S,P5
238 T1=INT(I*.8660+.5)*NN:S1=INT(I/2+.5)
239 LINE C+T1,S5-N-S1,C+T1-T,S5-N-S-S1,P4
240 NEXT I
245 I=I-1
247 BOT=726-2*N-H
250 FOR J = 0 TO BOT
255 LINE C,S5+J,C-T,S5-S+J,P3
256 LINE C,S5+J-1,C-T,S5-S+J-1,P3
260 LINE C,S5-N+J,C-T,S5-S-N+J,P4
261 LINE C,S5-N+J-1,C-T,S5-S-N+J-1,P4
265 LINE C,S5+J,C+T,S5-S+J,P5
266 LINE C,S5+J-1,C+T,S5-S+J-1,P5
268 LINE C,S5-N+J,C+T,S5-S-N+J,P4
269 LINE C,S5-N+J-1,C+T,S5-S-N+J-1,P4
271 T2=INT(J*.8660+.5)*NN:S2=INT(J/2+.5)
272 LINE C+T1,S5-N-S1+J-1,C+T1-T,S5-N-S1-S+J-1,0
273 LINE C+T1-T,S5-N-S1+J-S-1,C-T,S5-N-S1+J-1,0
274 KY=KY
275 LINE C+T1,S5-N-S1+J-2,C+T1-T,S5-N-S1-S+J-2,0
276 LINE C+T1-T,S5-N-S1+J-S-2,C-T,S5-N-S1+J-2,0
277 KY=S5-S-N+J
278 NEXT J
279 RETURN
280 GOTO 300
281 CN=CN+1:RED=RND(0)*255:GREEN=RND(0)*255:BLUE=RND(0)*255
282 CSET CN,RED,GREEN,BLUE,255
283 RETURN
290 END
300 MIDE=384:YV=568:S0=N/2+.5:T0=(S0*1.732+.5)*1
305 NX=MIDE:NY=YV-2*N:GOSUB 400
310 NX=MIDE-T0:NY=YV+S0-N:GOSUB 400
315 NX=MIDE-T0*2:NY=YV+N:GOSUB 400
320 NX=MIDE-T0*3:NY=YV+2*N+S0:GOSUB 400
325 NX=MIDE+T0:NY=YV+S0-N:GOSUB 400
330 NX=MIDE+2*T0:NY=YV+N:GOSUB 400
335 NX=MIDE+T0*3:NY=YV+2*N+S0:GOSUB 400
340 NX=MIDE:NY=YV:GOSUB 400
345 NX=MIDE-T0:NY=YV+S0+N:GOSUB 400
350 NX=MIDE+T0:NY=YV+S0+N:GOSUB 400
355 NX=MIDE-2*T0:NY=YV+3*N:GOSUB 400
360 NX=MIDE+2*T0:NY=YV+3*N:GOSUB 400
365 NX=MIDE:NY=YV+2*N:GOSUB 400
370 NX=MIDE-T0:NY=YV+3*N+S0:GOSUB 400
375 NX=MIDE+T0:NY=YV+3*N+S0:GOSUB 400
380 NX=MIDE:NY=YV+4*N:GOSUB 400
390 SLEEP 200:GOTO 390
400 GOSUB 281:A1=CN
402 GOSUB 281:B1=CN
403 GOSUB 281:C1=CN
405 TY=1212
410 FOR I=0 TO N
415 S=N/2:T=(S*1.732+.5)*1:S5=2*N+2
420 LINE NX,TY-S5-I,NX-T,TY-S5-I-S,A1
425 LINE NX,TY-S5-I,NX+T,TY-S5-I-S,C1
430 T1=(I*.8660+.5)*1:S1=(I/2+.5)
435 LINE NX+T1,TY-S5-N-S1,NX+T1-T,TY-S5-N-S-S1,B1
440 NEXT I
441 N=N
445 I=I-1
446 H=NY
450 BOT=TY-H-N-62
455 FOR J=0 TO BOT
460 NT=-1
465 LINE NX,TY-S5-J-NT,NX-T-1,TY-S5-S-J-NT,A1
466 LINE NX,TY-S5-J-NT-1,NX-T-1,TY-S5-S-J-NT-1,A1
470 LINE NX,TY-S5-J-NT-N,NX-T-1,TY-S5-S-J-NT,B1
471 LINE NX,TY-S5-J-NT-N-1,NX-T-1,TY-S5-S-J-NT-1,B1
475 LINE NX,TY-S5-J-NT,NX+T,TY-S5-S-J-NT,C1
476 LINE NX,TY-S5-J-NT-1,NX+T,TY-S5-S-J-NT-1,C1
480 LINE NX,TY-S5-J-N-NT,NX+T,TY-S5-S-J-NT,B1
481 LINE NX,TY-S5-J-N-NT-1,NX+T,TY-S5-S-J-NT-1,B1
485 LINE NX+T1+2,TY-S5-J+S+1,NX-T+T1-1,TY-S5+S+S-J+1,0
486 LINE NX+T1+2,TY-S5-J+S+1-1,NX-T+T1-1,TY-S5+S+S-J,0
490 LINE NX+T1-T+1,TY-S5+S+S-J+1,NX-T-3,TY-S5+S-J+1,0
491 LINE NX+T1-T+1,TY-S5+S+S-J,NX-T-3,TY-S5+S-J,0
492 NEXT J
500 RETURN
510 END


Saturday, February 9, 2013

App Description

https://itunes.apple.com/app/hand-basic-cbm-flavor/id394924289?mt=8   https://itunes.apple.com/app/hand-basic-cbm-flavor/id394924289?mt=8





Learn and Program BASIC Language on your iPhone, iPod Touch or iPad! 

Hand BASIC - CBM Flavor is a compatible version of Commodore's version of Microsoft BASIC 6502 as found on the Commodore 64. 

Released for Educational purposes. 

BASIC (Beginner's All-purpose Symbolic Instruction Code) is a computer language designed so that it can be learned very easily. It teaches programming and thinking logically in very simple way.

Hand BASIC is basically useful for writing relatively small sized programs for repeatable calculations and/or logic. For instance it is better than using calculator and repeating same formula and logic for different numbers again and again to get results. Hand BASIC users could be students, scientists, or any productivity workers. 

Official webpage for the App is here. It is strongly recommend to read FAQ's page.
Follow this link to download this free app. Inside App type HELP to get started using it.




Thursday, February 7, 2013

Blog Launch


    This blog is all about CBM Hand BASIC App: a standalone BASIC Language of Commodore 64 that runs on iPhone Platform (iPhone/iPad/iPod Devices). In this Blog you’ll find:
 - News & Announcements
 - Sample & Shared Programs
 - Tips & Tricks using and programming CBM Hand BASIC

To contact me send email to:
hawwash [dot] soft [at] gmail [dot] com


https://itunes.apple.com/us/app/hand-basic-cbm-flavor/id394924289?mt=8