Skip to content

Instantly share code, notes, and snippets.

View pmalin's full-sized avatar

Paul Malin pmalin

View GitHub Profile
@pmalin
pmalin / DeathStar.bas
Last active April 8, 2020 12:41
BBC Micro Bot - Death Star
1MO.0:h=512:x=640:F.S=0TOh:?(13E3+RND(2E4))=1:N.:GC.0,0:MOV.x,h:PL.153,h,0
2F.J=0TO9:F.X=12TO21:C=COS(X*.14):S=INT(X*.5-J*.3-7+RND(3)):L=S<4:GC.S*16*-L,1+L:F.K=J TOJ+1:H=COS(K/3.5):PL.84-(X>12),x+h*C*SQR(1-H*H),h+h*H:N.,,
3F.J=0TO16:S=1-ABS(J DIV2-4):L=S>-4:GC.S*16*L,1+L:MOV.610,680:PL.85+(J=0),600+COS(J*.4)*140,710-SIN(J*.4)*140:GC.3,1:N.:MOV.h+h,h:PL.21,160,h
@pmalin
pmalin / BoingBall.bas
Created April 8, 2020 12:40
BBC Micro Bot - Boing Ball
1MO.2:C.134:CLS:GC.0,0:MOV.1029,250:PL.153,250,0:F.J=0TO6:F.X=1TO19:C=COS(X*PI/21):F.K=J TOJ+1:GC.0,8+(X+J*4)MOD8:H=COS(K*PI/7):U=25*C*SQR(1-H*H):V=25*H:PL.84-(X>1),990+U*9+V*4,290+V*9-U*4:N.,,:V=1
5P=-512:U=J MOD25:X=X+V:J=J+1:A=&600+X+INT(U*2.5-U*U*.1)*80:IF X<3ORX>44V=-V
6*FX19
7?P=12:P?1=A/256:?P=13:P?1=A:C=8+(X+V*2)MOD8:V.19,C,1;0;19,8+(C+4)MOD8,7;0;:G.5
@pmalin
pmalin / TargetingComputer.bas
Created April 8, 2020 12:42
BBC Micro Bot - Targeting Computer
1MO.2:k=640:V.24,0;256;1279;1023;29,k;k;23;8202;0;0;0;:F.I=1TO49:GC.0,4+(3A.I):F.J=0TO3:Z=100-I*2:PL.5+(J=0),SGN(J-1.5)*3E3/Z,(1-(J+1A.2))*4E3/Z:N.,
2GC.0,3:F.I=0TO7:V=853*(I*2/7-1):MOV.k,V:DR.-k,-V:V.19,I+8,1;0;:N.:CO.1:GC.4,1
5F.F=1TO1E5:P.TAB(7,28);"032";1E3-F:V.19,(3A.(F+1))+4,3;0;19,(3A.F)+4,0;0;:X=(1E3-F)*((1A.F)*2-1):MOV.X,-k:DR.X,k:N.
@pmalin
pmalin / Sinclair.bas
Created April 23, 2020 15:41
BBC Micro Bot - Sinclair ZX Spectrum Happy Birthday
1D.1,3,2,6,0,0,0,1,5,9,18,84,32,140,32,9,98,32,1,73,176,1,5,9,16,98,32,140,9,32
2MO.2:V.5:GC.0,135:CLG:X=32:D=0:F.I=0TO45:IF I>15REA.D
3IF I<23 GC.0,D:MOV.I*64-160,448:PL.0,112,224:PL.113,64,0:GC.0,7:N.
4W=32+(1A.D)*140:MOV.X+(D/2A.1)*140,512+(D/4A.3)*40:PL.97,W,(D/16A.3)*40+24:X=X+(D/64A.1)*188+(D/128A.1)*48:N.:GC.3,7:P.''''" ZX Spectrum"'''" <Happy Birthday";
@pmalin
pmalin / DontPanic.bas
Created May 25, 2020 10:05
BBC Micro Bot - Don't Panic - Towel Day
1$@%=");+;+4)3)U3;5;533T1*2(/H&,(,(+(*&)&I$>+>.<.3+1&0%;#[1>8>:<:3802002/\;>??D6D>I>H0F0?8@1<PJ>M>M<L;K<J\O=_>^;X;W2S1U;N[ .+/---)+'%'%! #, K0/3/8""3 3$/%,!)A8/</B%A/F/E @ ;)= 9@G,K,J G@G/L/L-GMU,Q+R#U#U&Y&Y""W O L""N-Q/W0Z.Z*UI"
2MO.1:F=1:F.I=0TO218ST.2:A=@%?I*10:B=@%?(I+1):C=300+(31A.B)*20:PL.5+(F>0),A,C:IFF=1X=A:Y=C
3F=0:IF(32A.B)=0DR.X,Y:F=1
4N.
5V.5:G.5
@pmalin
pmalin / DontPanicFilled.bas
Created May 25, 2020 10:11
BBC Micro Basic - Don't Panic - Too big for BBC Micro Bot
1$@%=");+;+4)3)U3;5;533T1*2(/H&,(,(+(*&)&I$>+>.<.3+1&0%;#[1>8>:<:3802002/\;>??D6D>I>H0F0?8@1<PJ>M>M<L;K<J\O=_>^;X;W2S1U;N[ .+/---)+'%'%! #, K0/3/8""3 3$/%,!)A8/</B%A/F/E @ ;)= 9@G,K,J G@G/L/L-GMU,Q+R#U#U&Y&Y""W O L""N-Q/W0Z.Z*UI"
2MO.1:F=1:F.I=0TO218ST.2:A=@%?I*10:B=@%?(I+1):C=300+(31A.B)*20:GC.0,1:PL.5+(F>0),A,C:IFF=1X=A:Y=C
3F=0:IF(32A.B)=0DR.X,Y:GC.0,2:F=1:IFI>36PL.&85,X+4,Y-4
4N.
5V.5,19,0,7;0;19,1,0;0;19,2,5;0;:G.5
@pmalin
pmalin / BlackLivesMatter.bas
Created June 4, 2020 16:46
BBC Micro Bot - Black Lives Matter
1D=@%:$D="$=E5H9HAI=E// 32 G.UBOBJ7I1M3I.H8EE5A3D3B / ,D F3J3;D?DIAP=YBW8S2P0P""D &1V9^;_A[AZ;S1V'=RCYEYMTMSDKCP=R&@ENSPSVNVMIB@E&JBWLYL_H^FP>JB":MO.0:V.19;3;0;19,1,0;0;5
2F.I=1TO7:V=?D:D=D+1:F.J=32TOV:X=?D*8+128:Y=D?1*12-288:D=D+2:PL.5+(J<33),X,Y:N.:PL.&85,X-8*(I>1),Y+4:N.:F.I=0TO32:MOV.640,512:PL.145,416+I*2,0:N.:GC.0,0:F.I=0TO900:PL.69,RND(1279),RND(1023):N.
@pmalin
pmalin / Raytracer.bas
Created November 2, 2020 13:15
BBC Micro Bot - Raytracer
1MO.2:V.5:F.V=0TO255:F.U=0TO159:x=U/64-1:y=V/128-1.4:z=1/SQR(x*x+y*y+1):x=x*z:y=y*z:X=0:Y=.4:Z=-2:I=6:R=RND(1):P=-Y*y-Z*z:i=x*P:j=Y+y*P:k=Z+z*P:C=i*i+j*j+k*k
2IFC<1w=P-SQR(1-C):X=w*x:Y=Y+w*y:Z=Z+w*z:D=X*x+Y*y+Z*z:x=x-2*X*D:y=y-2*Y*D:z=z-2*Z*D
3IFy<0t=(Y+1)/-y:u=X+x*t:v=Z+z*t:L=u*u+v*v:IF9/L>R I=3+SIN(u*7)+SIN(v*7)
4IFC<1A.R>.9ORL<R I=0
5IFR<y*y*y I=7
6GC.0,I:PL.69,U*8,V*4:N.,
@pmalin
pmalin / Shaded.bas
Created November 16, 2020 23:51
BBC Micro Bot - Shaded Sphere
1MO.1:V.5:F.U=0TO319:F.V=0TO255:x=U/128-1:y=V/128-1.4:z=1/SQR(x*x+y*y+1):x=x*z:y=y*z:X=0:Y=.4:Z=-2:a=0:b=y*2:c=0:S=9:P=-Y*y-Z*z:i=x*P:j=Y+y*P:k=Z+z*P:C=i*i+j*j+k*k
2IFC<1w=P-SQR(1-C):X=w*x:Y=Y+w*y:Z=Z+w*z:a=X:b=Y:c=Z EL.IFy<0t=(Y+1)/-y:X=X+x*t:Y=Y+y*t:Z=Z+z*t:b=1:S=Z-.6:S=X*X+S*S
3Y=Y+2:Z=Z-2:I=(X*a+Y*b+Z*c)*4/SQR(X*X+Y*Y+Z*Z)-?-412/192:GC.0,I*(S>1.5)*(I>0):PL.69,U*4,V*4:N.,
@pmalin
pmalin / ImGui_Party_3D_001.inl
Last active November 29, 2020 18:46
3D Spinning Glass
#define V ImVec2
#define F float
void R(F&x,F&y,F r){F s=sin(r),c=cos(r),t=c*x-s*y;y=s*x+c*y;x=t;}
F c,e,f,g,l,x,y,z;
F L(F a){l*=l>0;return sqrt(1-exp(-a*(l+.1)-l*l*l));}
void T(F u){R(x,z,c/3+6.28*u);R(x,y,c);R(y,z,c/5);}
void FX(ImDrawList*d,V a,V b,V S,ImVec4,F t){
int i,j,k,n=0,u,v,K=7,J=16;
char P[]="GZHXITGPBMBCGA",*X=P;
struct Q{F d,l;V o[4];}q[99];