Boing ball BASIC demo
Re: Boing ball BASIC demo
The aliens never move in my AstroBlaster game either
https://youtu.be/-9X8fRGjmJ8 best watched in 720p on a 50Hz monitor.
https://youtu.be/-9X8fRGjmJ8 best watched in 720p on a 50Hz monitor.
Re: Boing ball BASIC demo
It couldn’t be in BASIC but on a Master you could do this at 50Hz with single pixel horizontal & vertical movement in MODE 2 by using vertical rupture to scroll vertically one scanline at a time, plus SHADOW RAM to offset a second copy of the ball by one pixel.
For the background you could make a fixed checkerboard of reasonable resolution using stable raster to twiddle the ULA palette register (or flash bit) as many times as possible on every line. That’d leave 15 colours for the rotation animation to get it nice and smooth, perhaps a couple less if you want the shadow.
EDIT: PS. There’s something lovely about seeing it done in one screenful (or Tweet!) of BASIC though.
For the background you could make a fixed checkerboard of reasonable resolution using stable raster to twiddle the ULA palette register (or flash bit) as many times as possible on every line. That’d leave 15 colours for the rotation animation to get it nice and smooth, perhaps a couple less if you want the shadow.
EDIT: PS. There’s something lovely about seeing it done in one screenful (or Tweet!) of BASIC though.
Bitshifters Collective | Retro Code & Demos for BBC Micro & Acorn computers | https://bitshifters.github.io/
- SimonSideburns
- Posts: 657
- Joined: Mon Aug 26, 2013 9:09 pm
- Location: Purbrook, Hampshire
- Contact:
Re: Boing ball BASIC demo
That program was indeed called SPINNER. It is from The Micro User. Specifically Volume 7, Issue 10, December 1989.steve3000 wrote: ↑Sun Jul 26, 2020 11:46 pm It reminds me of a much simpler but larger (I think?) spinning ball demo, possibly a type-in from Micro User BITD (wasn't the Beebug one above). It took a very long time to render, so I remember 'optimising' it during computer club at school, by dumping the final rendered screen to the econet for instant-load and then went round loading it up on a whole room of Beebs...
If you have a Master or an Archimedes, or the GXR ROM installed you can edit the listing and remove the REM commands from certain lines of the listing in order to speed it up. It draws pretty quickly in those cases. Otherwise it's about five minutes or so of waiting for the various semi-circles to draw, even though you can't see half of them due to the way the palette is set up.
After that it's pretty much palette switching.
Here's the code:
Code: Select all
10REM > Spinner
20REM by Jim Burdus
30REM (c) The Micro User
40MODE2
50REM >> Archimedes series >>
60REM MODE12
70VDU23,1,0;0;0;0;0;
80VDU19,0,4;0;19,1,0;0;19,2,7;0;
90VDU19,3,0;0;19,4,1;0;19,5,1;0;
100VDU19,6,1;0;19,7,1;0;19,8,7;0;
110VDU19,9,7;0;19,10,7;0;19,11,7;0;
120VDU19,12,3;0;
130PROCbackground:PROCstars
140y%=253:GCOL0,1
150PROCell(640,200,y%,162):K%=-11
160VDU29,0;0;24,640;0;1279;1023;
170FOR x%=285 TO 0 STEP-SQR(285-x%)-1
180J%=7-SQR(285-x%)MOD8+4:GCOL 0,J%
190IF J%<>K% IF ABSx%>32 PROCell(640,512,x%-32,y%)
200K%=J%:NEXT
210VDU29,0;0;24,0;0;640;1023;:K%=-1
220FOR x%=285 TO 0 STEP-SQR(285-x%)-1
230J%=SQR(285-x%)MOD8+4:GCOL 0,J%
240IF J%<>K% IF ABSx%>32 PROCell(640,512,x%-32,y%)
250K%=J%:NEXT
260L%=0:B%=4:dir=1:spd%=5
270REPEAT:*FX19
280FOR C%=0 TO 7
290IF C%<4 VDU19,(C%+L%)MOD8+B%,1 ELSE VDU19,(C%+L%)MOD8+B%,7
300NEXT
310T%=TIME+spd%
320REPEAT UNTIL TIME>T%
330IF INKEY-122 dir=1
340IF INKEY-26 dir=-1
350IF INKEY-82 dir=0
360IF INKEY-58 IF spd%>0 spd%=spd%-1
370IF INKEY-42 IF spd%<40 spd%=spd%+1
380L%=(L%+dir)MOD8:IF L%=-1 L%=7
390UNTIL FALSE
400:
410DEFPROCbackground
420VDU 29,640;512;:GCOL0,2
430FOR X=-10000 TO 10000 STEP 400
440MOVE 0,100:MOVEX-100,-512
450PLOT 85,X+100,-512:NEXT:GCOL0,2
460PROCfill(-640,0,1280,512)
470Y=-8:YM=1.2:F=0:GCOL 3,2
480REPEAT F=NOTF
490IF F PROCfill(-640,Y,1280,Y*YM-Y)
500Y=Y*YM:UNTIL Y<-600:GCOL 0,1
510PROCfill(-640,-30,1280,512)
520VDU29,0;0;:ENDPROC
530:
540DEF PROCfill(X%,Y%,x%,y%)
550REM >> Master series >>
560REM MOVE X%,Y%:PLOT101,x%,y%:ENDPROC
570REM >> Archimedes series >>
580REM RECT.FILL X%,Y%,x%-X%,y%-Y%:ENDPROC
590IF Y%>y% t%=y%:y%=Y%:Y%=t%
600FOR Q%=Y% TO y% STEP 4
610MOVE X%,Q%:DRAW x%,Q%:NEXT
620ENDPROC
630:
640DEF PROCstars:LOCAL L%
650GCOL 0,12:FOR L%=1 TO 250
660PLOT69,RND(1280)-1,RND(524)+500
670NEXT:VDU26,29,0;0;:ENDPROC
680:
690DEF PROCell(X%,Y%,M%,N%)
700REM >> Master series >>
710REM MOVE X%,Y%:MOVE X%+M%,Y%
720REM PLOT 205,X%,Y%+N%:ENDPROC
730REM >> Archimedes series >>
740REM ELLIPSE FILL X%,Y%,M%,N%:ENDPROC
750LOCAL CA,SA,Ct,St,Ca,Sa,Cp,Sp
760LOCAL A%,x%,y%,S%,T%:S%=60
770Ct=COSRADT%:St=SINRADT%
780Ca=COSRAD(360/S%):Cp=1
790Sa=SINRAD(360/S%):Sp=0
800MOVE M%*Ct+X%,M%*St+Y%
810FOR A%=1 TO S%
820CA=Cp*Ca-Sp*Sa:SA=Sp*Ca+Cp*Sa
830x%=M%*Ct*CA-N%*St*SA+X%
840y%=M%*St*CA+N%*Ct*SA+Y%
850MOVE X%,Y%:PLOT 85,x%,y%
860Cp=CA:Sp=SA:NEXT:ENDPROC
Just remember kids, Beeb spelled backwards is Beeb!
Re: Boing ball BASIC demo
As was the original Amiga boing ball. I think it is ace to see a boing ball pretty much as good as the Amiga's original CES one on a model B
http://amiga.lychesis.net/special/Color ... Boing.html
Re: Boing ball BASIC demo
I like the keyboard control in SPINNER. That's a nice touch.
The screen tearing as the palette changes could be removed with just a little rearrangement of the code...
The screen tearing as the palette changes could be removed with just a little rearrangement of the code...
Re: Boing ball BASIC demo
So incredible... best basic demo in 5 lines EVERKweepa wrote: ↑Mon Aug 03, 2020 3:06 pm Yeah, the ball is made up of 8 different colours, so the ball rotation is in four steps.
Then, the vertical lines of the background grid are two different colours.
So in total there are 13 used colours (8 for the ball, 1 cyan background, 1 blue shadow, 2 vertical grid lines, 1 horizontal grid line).
And as Big Ed says, the screen base address is updated to move the ball around.
Line 4 calculates the new screen start address A% (actually it's the address divided by 8 ). &600 is the original base address (&600 x 8 = &3000). X% is calculated on line 5 - this just bounces back and forth so it moves the screen horizontally. 80*INT(U%*2.5-U%*U%*.1) moves the screen in a parabola vertically (a parabola has the form Ax^2 + Bx + C).
Then line 5's VDU 23,0,12,A%/256...23,0,13,A%... sets the screen base address.
Yep, 100% BASIC.
Never seen that on C64, ATARI XL, CPC or Spectrum in pure basic !
Re: Boing ball BASIC demo
so it should be easy to shoot them
Re: Boing ball BASIC demo
Looks like the Boing ball also runs in Atom Basic .....
I did have problems with the ball draw code because in the BBC demo it uses the rectangle fill routines and these are very difficult to convert to Atom Basic so that's why I use a screenshot.
This is CLEAR4 monochrome with a 1/60 sec delay: https://www.youtube.com/watch?v=UwUJEG-0MUw
This is CLEAR4 colour with a 1/60 sec delay: https://www.youtube.com/watch?v=-MYNS9XCFvQ
This is CLEAR4 colour without delay: https://www.youtube.com/watch?v=VznaMx9dihI
It only runs on an Atom with a GODIL display ....
Greetings
Kees
I did have problems with the ball draw code because in the BBC demo it uses the rectangle fill routines and these are very difficult to convert to Atom Basic so that's why I use a screenshot.
This is CLEAR4 monochrome with a 1/60 sec delay: https://www.youtube.com/watch?v=UwUJEG-0MUw
This is CLEAR4 colour with a 1/60 sec delay: https://www.youtube.com/watch?v=-MYNS9XCFvQ
This is CLEAR4 colour without delay: https://www.youtube.com/watch?v=VznaMx9dihI
It only runs on an Atom with a GODIL display ....
Greetings
Kees
-
- Posts: 27
- Joined: Wed Oct 26, 2022 3:19 pm
- Contact:
Re: Boing ball BASIC demo
I have say this is absolutely amazing, I wish I had seen this back in the day.