Boing ball BASIC demo

new graphics/music demos - bitshifters, 0xc0de, The Master + others
Kweepa
Posts: 29
Joined: Mon Dec 16, 2013 11:45 pm
Contact:

Boing ball BASIC demo

Post by Kweepa » Sat Jul 25, 2020 10:55 pm

https://www.youtube.com/watch?v=ZuC484vzUHk

Code: Select all

0REM BBC Boing Ball by Steve McCrea with assist by Paul Malin
1MO.2:$@%="6456565611117777":F.I%=0TO15:V.19,I%,@%?I%-48;0;5:N.:F.X%=0TO79:GC.0,6+(1A.X%):MOVE16*X%+8,0:PL.1,0,1024:N.:GC.0,2:F.Y%=0TO31:MOVE0,32*Y%:PL.1,1280,0:N.
2V.23;13,48;0;0;0:GC.0,1:F.Y%=30TO426S.8:H=ABS(230-Y%)/200:W%=200*SQR(1-H*H):MOVE1054+(Y%-230)/2,Y%:PL.1,W%,-W%/2:N.
3F.J%=0TO7:F.X%=0TO27:C=75*COS(X%*PI/28):GC.0,8+(7A.X%+J%*4):F.K%=J%TOJ%+1:Q=K%*PI/8:U=C*SINQ:V=75*COSQ:PL.84+SGNX%,1004+U*3+V,270+V*3-U:N.,,:X%=48:U%=0:T%=0
4A%=&600+X%+80*INT(U%*2.5-U%*U%*.1):*FX19
5P%=6+((1A.X%-4)=0):Q%=6+((1A.X%-5)=0):R%=8+(7A.X%):S%=8+(7A.X%+4):T%=(T%+1)MOD96:X%=ABS(T%-48):U%=T%MOD24:V.23;12,A%/256;0;0;0,23;13,A%;0;0;0,19,6,P%;0;19,7,Q%;0;19,R%,1;0;19,S%,7;0;:G.4

User avatar
BigEd
Posts: 3454
Joined: Sun Jan 24, 2010 10:24 am
Location: West
Contact:

Re: Boing ball BASIC demo

Post by BigEd » Sun Jul 26, 2020 12:13 pm

Most impressive!

User avatar
Diminished
Posts: 523
Joined: Fri Dec 08, 2017 9:47 pm
Contact:

Re: Boing ball BASIC demo

Post by Diminished » Sun Jul 26, 2020 1:09 pm

I remember Beebug magazine published a boing ball listing at some point, which used palette cycling and CRTC shenanigans. I don't know which issue it was in. I'm not sure whether this is derived from that, or how the two programs compare.

Kweepa
Posts: 29
Joined: Mon Dec 16, 2013 11:45 pm
Contact:

Re: Boing ball BASIC demo

Post by Kweepa » Sun Jul 26, 2020 2:55 pm

Interesting. This isn't based on an old listing, but I'd be curious to see the Beebug version.

User avatar
Diminished
Posts: 523
Joined: Fri Dec 08, 2017 9:47 pm
Contact:

Re: Boing ball BASIC demo

Post by Diminished » Sun Jul 26, 2020 3:18 pm

I found it -- it was Volume 6 Issue 5, called Giant Bounce -- part of the Barrie Christie Visuals column.

It seems Christie's version came as two separate listings, and employed assembler.

http://8bs.com/othrdnld/beebug/scans/BeebUGv0605.zip

(page 20)

Frustratingly, the magazine cassette for this issue is one of the few not in the Stairway archive, so I couldn't just save it off the tape.

Kweepa
Posts: 29
Joined: Mon Dec 16, 2013 11:45 pm
Contact:

Re: Boing ball BASIC demo

Post by Kweepa » Sun Jul 26, 2020 3:25 pm

Ah, there's a version in Beebug volume 6 issue 5 page 20-22 by Barry Christie called Giant Bounce. Thank you Paul Collins and 8bs.com for the full index searchable pdf.
It looks like it might be smoother than my version as it uses machine code to shift the ball and animate the colours, so it can work at 50fps instead of 25 and have a larger grid.
It's a bit of a pain to type in though since it's a two parter, one to draw the grid/ball and one to animate everything. Is there an archive of typed in listings anywhere?
[edit - ah, we had the same idea!]

Kweepa
Posts: 29
Joined: Mon Dec 16, 2013 11:45 pm
Contact:

Re: Boing ball BASIC demo

Post by Kweepa » Sun Jul 26, 2020 3:46 pm

Part one:

Code: Select all

10 REM Program Beach Ball
20 REM Version B 0.2
30 REM Author  Barry Christie
40 REM Beebug  October 1987
50 REM Program subject to copyright
60 :
100 MODE 1
110 PROCinitialize
120 PROCbackground
130 PROCdrawball
140 MODE 7:END
150 :
160 DEF PROCdrawball
170 c%=1:radstp=1
180 radius=158:angstp=PI/14.5
190 REPEAT
200 PROCdrawface
210 radstp=2*radstp
220 radius=radius-radstp
230 UNTIL radius<=0
240 radius=0:radstp=32
250 PROCdrawface
260 *SAVE Bscrn 3000 8000 0000 3000
270 ENDPROC
280 :
290 DEF PROCdrawface
300 FOR angle=0 TO 2*PI STEP angstp
310 GCOL 0,c%:c%=(c% MOD 2)+1
320 PLOT 4,640+radius*SIN(angle),512+158*COS(angle)
330 PLOT 4,640+(radius+radstp)*SIN(angle),512+158*COS(angle)
340 PLOT 85,640+radius*SIN(angle+angstp),512+158*COS(angle+angstp)
350 PLOT 85,640+(radius+radstp)*SIN(angle+angstp),512+158*COS(angle+angstp)
360 NEXT angle
370 ENDPROC
380 :
390 DEF PROCinitialize
400 VDU 23,1,0;0;0;0;
410 *FX 9,0
420 *FX 10,0
430 VDU 19,1,11;0;
440 VDU 19,2,12;0;
450 VDU 19,3,2;0;
460 ENDPROC
470 :
480 DEF PROCbackground
490 FOR pass%=0 TO 2 STEP 2
500 P%=&900
510 [ OPT pass%
520 .clearscreen
530 LDY #&00
540 .loop1
550 LDX #&0F
560 .loop2:DEY:LDA screendata,X:
570 .inc:STA &3000,Y:DEX:BPL loop2
580 CPY #&00
590 BNE loop1
600 INC inc+&02
610 BPL clearscreen
620 RTS
630 .screendata EQUD &888888FF:EQUD &FF888888:EQUD &111111FF:EQUD &FF111111
640 ]:NEXT pass%
650 CALL clearscreen
660 ENDPROC

User avatar
Diminished
Posts: 523
Joined: Fri Dec 08, 2017 9:47 pm
Contact:

Re: Boing ball BASIC demo

Post by Diminished » Sun Jul 26, 2020 4:02 pm

Good work. I'm glad I didn't start typing it in now!

Kweepa
Posts: 29
Joined: Mon Dec 16, 2013 11:45 pm
Contact:

Re: Boing ball BASIC demo

Post by Kweepa » Sun Jul 26, 2020 4:11 pm

Part 2:

Code: Select all

10 REM Program Bounce
20 REM Version B 0.2
30 REM Author  Barry Christie
40 REM Beebug  October 1987
50 REM Program subject to copyright
60 :
100 MODE 1
110 ON ERROR GOTO 1040
120 VDU 19,1,11;0;
130 VDU 19,2,12;0;
140 VDU 19,3,2;0;
150 VDU 23,1,0;0;0;0;
160 *FX 9,0
170 *FX 10,0
180 startL=&80:startH=&81
190 stepsX=&82:stepsY=&83
200 coordX=&84:coordY=&85
210 incdec=&86
220 FOR pass%=0 TO 2 STEP 2
230 P%=&900
240 [ OPT pass%
250 :
260 LDA #&00:STA startL:LDA #&06
270 STA startH:LDA #&0F:STA coordX
280 LDA #&0B:STA coordY:LDA #&00
290 STA stepsX:LDA #&00:STA stepsY
300 :
310 .scrollball
320 LDA #&02:STA incdec
330 LDA stepsX:BMI subX
340 INC coordX:JSR increment:JMP skipX
350 :
360 .subX:DEC coordX:JSR decrement
370 :
380 .skipX:LDA #&50:STA incdec
390 LDA stepsY:BMI subY:INC coordY
400 JSR increment:JMP skipY
410 :
420 .subY:DEC coordY:JSR decrement
430 :
440 .skipY:LDA coordX:CMP #&1E
450 BNE Xokay1:LDA #&FF:STA stepsX
460 JSR blip
470 :
480 .Xokay1:LDA coordX:CMP #&00
490 BNE Xokay2:LDA #&00:STA stepsX
500 JSR blip
510 :
520 .Xokay2:LDA coordY:CMP #&16
530 BNE Yokay1:LDA #&FF:STA stepsY
540 JSR blip
550 :
560 .Yokay1:LDA coordY:CMP #&00
570 BNE Yokay2:LDA #&00:STA stepsY
580 JSR blip
590 :
600 .Yokay2:LDA startH:CMP #&05
610 BNE okays1:CLC:ADC #&0A
620 :
630 .okays1:STA startH
640 LDA startH:CMP #&10:BNE okays2
650 SEC:SBC #&0A:.okays2:STA startH
660 :
670 LDA #&13:JSR &FFF4
680 :
690 LDA #&0D:STA &FE00:LDA startL
700 STA &FE01:LDA #&0C:STA &FE00
710 LDA startH:STA &FE01
720 BIT &FF:BMI escapekey
730 JMP scrollball
740 .escapekey:RTS
750 :
760 .decrement
770 SEC:LDA startL:SBC incdec
780 STA startL:LDA startH:SBC #&00
790 STA startH:RTS
800 :
810 .increment
820 CLC:LDA startL:ADC incdec
830 STA startL:LDA startH:ADC #&00
840 STA startH:RTS
850 :
860 .blip
870 LDA #7:LDX # sound MOD 256
880 LDY #sound DIV 256
890 JSR &FFF1:RTS
900 :
910 .sound
920 EQUB &01:EQUB &00    \ Channel
930 EQUB &F7:EQUB &FF    \ Volume
940 EQUB &01:EQUB &00    \ Pitch
950 EQUB &01:EQUB &00    \ Duration
960 :
970 ]:NEXT pass%
980 *LOAD Bscrn
990 *FX 9,1
1000 *FX 10,1
1010 CALL &900
1020 END
1030 :
1040 ON ERROR OFF
1050 *FX4,0
1060 MODE7:REPORT:PRINT" at line ";ERL
1070 END

User avatar
Diminished
Posts: 523
Joined: Fri Dec 08, 2017 9:47 pm
Contact:

Re: Boing ball BASIC demo

Post by Diminished » Sun Jul 26, 2020 4:52 pm

Good job.

Here's an SSD:
giant-bounce-beebug-v6i5-barrie-christie.ssd
(24 KiB) Downloaded 23 times

You can just go ahead and CHAIN "BOUNCE2", since I've already run BOUNCE1 and got the picture saved out to disc in this image.

Kweepa
Posts: 29
Joined: Mon Dec 16, 2013 11:45 pm
Contact:

Re: Boing ball BASIC demo

Post by Kweepa » Sun Jul 26, 2020 5:02 pm

Here's a video of it in action:
https://www.youtube.com/watch?v=N7znhqt4ZdM

And a one-filer, since I am not a fan of multiloads:

Code: Select all

10 REM Program Beach Ball
20 REM Version B 0.2
30 REM Author  Barry Christie
40 REM Beebug  October 1987
50 REM Program subject to copyright
60 REM Minimal mods to make one-file version
70 REM   by Steve McCrea July 2020
80 :
90 MODE 1
100 PROCinitialize
110 PROCbackground
120 PROCdrawball
130 PROCanimate
140 END
150 :
160 DEF PROCdrawball
170 c%=1:radstp=1
180 radius=158:angstp=PI/14.5
190 REPEAT
200 PROCdrawface
210 radstp=2*radstp
220 radius=radius-radstp
230 UNTIL radius<=0
240 radius=0:radstp=32
250 PROCdrawface
270 ENDPROC
280 :
290 DEF PROCdrawface
300 FOR angle=0 TO 2*PI STEP angstp
310 GCOL 0,c%:c%=(c% MOD 2)+1
320 PLOT 4,640+radius*SIN(angle),512+158*COS(angle)
330 PLOT 4,640+(radius+radstp)*SIN(angle),512+158*COS(angle)
340 PLOT 85,640+radius*SIN(angle+angstp),512+158*COS(angle+angstp)
350 PLOT 85,640+(radius+radstp)*SIN(angle+angstp),512+158*COS(angle+angstp)
360 NEXT angle
370 ENDPROC
380 :
390 DEF PROCinitialize
400 VDU 23,1,0;0;0;0;
410 *FX 9,0
420 *FX 10,0
430 VDU 19,1,11;0;
440 VDU 19,2,12;0;
450 VDU 19,3,2;0;
460 ENDPROC
470 :
480 DEF PROCbackground
490 FOR pass%=0 TO 2 STEP 2
500 P%=&C00
510 [ OPT pass%
520 .clearscreen
530 LDY #&00
540 .loop1
550 LDX #&0F
560 .loop2:DEY:LDA screendata,X:
570 .inc:STA &3000,Y:DEX:BPL loop2
580 CPY #&00
590 BNE loop1
600 INC inc+&02
610 BPL clearscreen
620 RTS
630 .screendata EQUD &888888FF:EQUD &FF888888:EQUD &111111FF:EQUD &FF111111
640 ]:NEXT pass%
650 CALL clearscreen
660 ENDPROC
670 :
1170 DEF PROCanimate
1180 startL=&80:startH=&81
1190 stepsX=&82:stepsY=&83
1200 coordX=&84:coordY=&85
1210 incdec=&86
1220 FOR pass%=0 TO 2 STEP 2
1230 P%=&900
1240 [ OPT pass%
1250 :
1260 LDA #&00:STA startL:LDA #&06
1270 STA startH:LDA #&0F:STA coordX
1280 LDA #&0B:STA coordY:LDA #&00
1290 STA stepsX:LDA #&00:STA stepsY
1300 :
1310 .scrollball
1320 LDA #&02:STA incdec
1330 LDA stepsX:BMI subX
1340 INC coordX:JSR increment:JMP skipX
1350 :
1360 .subX:DEC coordX:JSR decrement
1370 :
1380 .skipX:LDA #&50:STA incdec
1390 LDA stepsY:BMI subY:INC coordY
1400 JSR increment:JMP skipY
1410 :
1420 .subY:DEC coordY:JSR decrement
1430 :
1440 .skipY:LDA coordX:CMP #&1E
1450 BNE Xokay1:LDA #&FF:STA stepsX
1460 JSR blip
1470 :
1480 .Xokay1:LDA coordX:CMP #&00
1490 BNE Xokay2:LDA #&00:STA stepsX
1500 JSR blip
1510 :
1520 .Xokay2:LDA coordY:CMP #&16
1530 BNE Yokay1:LDA #&FF:STA stepsY
1540 JSR blip
1550 :
1560 .Yokay1:LDA coordY:CMP #&00
1570 BNE Yokay2:LDA #&00:STA stepsY
1580 JSR blip
1590 :
1600 .Yokay2:LDA startH:CMP #&05
1610 BNE okays1:CLC:ADC #&0A
1620 :
1630 .okays1:STA startH
1640 LDA startH:CMP #&10:BNE okays2
1650 SEC:SBC #&0A:.okays2:STA startH
1660 :
1670 LDA #&13:JSR &FFF4
1680 :
1690 LDA #&0D:STA &FE00:LDA startL
1700 STA &FE01:LDA #&0C:STA &FE00
1710 LDA startH:STA &FE01
1720 BIT &FF:BMI escapekey
1730 JMP scrollball
1740 .escapekey:RTS
1750 :
1760 .decrement
1770 SEC:LDA startL:SBC incdec
1780 STA startL:LDA startH:SBC #&00
1790 STA startH:RTS
1800 :
1810 .increment
1820 CLC:LDA startL:ADC incdec
1830 STA startL:LDA startH:ADC #&00
1840 STA startH:RTS
1850 :
1860 .blip
1870 LDA #7:LDX # sound MOD 256
1880 LDY #sound DIV 256
1890 JSR &FFF1:RTS
1900 :
1910 .sound
1920 EQUB &01:EQUB &00    \ Channel
1930 EQUB &F7:EQUB &FF    \ Volume
1940 EQUB &01:EQUB &00    \ Pitch
1950 EQUB &01:EQUB &00    \ Duration
1960 :
1970 ]:NEXT pass%
1980 *FX 9,1
1990 *FX 10,1
2000 CALL &900
2010 ENDPROC

Kweepa
Posts: 29
Joined: Mon Dec 16, 2013 11:45 pm
Contact:

Re: Boing ball BASIC demo

Post by Kweepa » Sun Jul 26, 2020 5:05 pm

Teamwork!

User avatar
Diminished
Posts: 523
Joined: Fri Dec 08, 2017 9:47 pm
Contact:

Re: Boing ball BASIC demo

Post by Diminished » Sun Jul 26, 2020 11:11 pm

Your version was certainly a lot more compact!

steve3000
Posts: 2284
Joined: Sun Nov 25, 2012 12:43 am
Contact:

Re: Boing ball BASIC demo

Post by steve3000 » Sun Jul 26, 2020 11:46 pm

Wow, that is impressive and from such a compact piece of BASIC - a nice little demo effect!

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...

User avatar
ChrisB
Posts: 78
Joined: Wed Oct 05, 2011 10:37 pm
Location: Surrey
Contact:

Re: Boing ball BASIC demo

Post by ChrisB » Mon Jul 27, 2020 9:05 am

I have vague memories is a version that went round the network at school that did the effect to the tune of sweet dreams. More like the original demo in look than the beebug version. No idea where it came from though.

User avatar
Diminished
Posts: 523
Joined: Fri Dec 08, 2017 9:47 pm
Contact:

Re: Boing ball BASIC demo

Post by Diminished » Mon Jul 27, 2020 9:40 am

ChrisB wrote:
Mon Jul 27, 2020 9:05 am
I have vague memories is a version that went round the network at school that did the effect to the tune of sweet dreams. More like the original demo in look than the beebug version. No idea where it came from though.
I remember that, too, now you mention it.

AJW
Posts: 907
Joined: Sun Feb 15, 2004 2:01 pm
Contact:

Re: Boing ball BASIC demo

Post by AJW » Mon Jul 27, 2020 5:17 pm

Who created that?

RobC
Posts: 3001
Joined: Sat Sep 01, 2007 10:41 pm
Contact:

Re: Boing ball BASIC demo

Post by RobC » Mon Jul 27, 2020 5:53 pm

Orlando did a version on 3D Pool (along with various other demos). It's in the "final" version on the STH Lost & Found page.

User avatar
Diminished
Posts: 523
Joined: Fri Dec 08, 2017 9:47 pm
Contact:

Re: Boing ball BASIC demo

Post by Diminished » Mon Jul 27, 2020 7:12 pm

RobC wrote:
Mon Jul 27, 2020 5:53 pm
Orlando did a version on 3D Pool (along with various other demos). It's in the "final" version on the STH Lost & Found page.
If anyone can't be bothered to go and find it:
3DPool.ssd
(47 KiB) Downloaded 21 times
*RUN "BBOING!" to run it.

Still not the version with the Eurythmics, though!

User avatar
Diminished
Posts: 523
Joined: Fri Dec 08, 2017 9:47 pm
Contact:

Re: Boing ball BASIC demo

Post by Diminished » Mon Jul 27, 2020 9:20 pm

A bit of YouTubing later I've found the Eurythmics one on PD-68, from 8bs.com. Weirdly the uploaded video of it has completely mangled music, but it worked OK for me in jsbeeb.

CHAIN "DREAM"
Bbc68.dsd
(400 KiB) Downloaded 23 times

Kweepa
Posts: 29
Joined: Mon Dec 16, 2013 11:45 pm
Contact:

Re: Boing ball BASIC demo

Post by Kweepa » Mon Jul 27, 2020 11:08 pm

Nice.
Orlando's actually blits the ball, and it has a nice grid and the sound effects are close to the original.
The Sweet Dreams version (by Ian Hutt, according to the endscreen) does just about everything except a smooth bounce curve. I can see a pixel at the top of the screen where the grid colours are updated to prevent it scrolling left and right. (I had to rearrange the order of the calculations quite a bit to keep the grid colour switch in the borders.)

Ian Hutt is probably the author of this
http://www.computinghistory.org.uk/det/ ... BBC-Micro/
and co-author of this
http://www.computinghistory.org.uk/det/ ... BBC-Micro/
I couldn't find a download of the first one :(

AJW
Posts: 907
Joined: Sun Feb 15, 2004 2:01 pm
Contact:

Re: Boing ball BASIC demo

Post by AJW » Tue Jul 28, 2020 9:42 am

How does updating the colours "stop" it scrolling?


The game book is on bbcmicro.co.uk , not sure where the machine code book is.

Kweepa
Posts: 29
Joined: Mon Dec 16, 2013 11:45 pm
Contact:

Re: Boing ball BASIC demo

Post by Kweepa » Tue Jul 28, 2020 7:35 pm

In my implementation the vertical grid lines are drawn 2 pixels apart in two different colours, so the left to right ball movement can be 4 pixel resolution rather than 8. Then when the screen scrolls, one of the sets of grid lines is recoloured cyan and the other set purple.

In Sweet Dreams, there are four different colours for the vertical grid lines and only one of the four sets is visible at a time.

AJW
Posts: 907
Joined: Sun Feb 15, 2004 2:01 pm
Contact:

Re: Boing ball BASIC demo

Post by AJW » Tue Jul 28, 2020 10:30 pm

Strange, I can see 3 pixels between the magenta lines and 1 pixel width for the magenta line itself.

Kweepa
Posts: 29
Joined: Mon Dec 16, 2013 11:45 pm
Contact:

Re: Boing ball BASIC demo

Post by Kweepa » Tue Jul 28, 2020 11:35 pm

Yes, when I draw the screen I have already set the second line colour to cyan to hide the second set of lines.

AJW
Posts: 907
Joined: Sun Feb 15, 2004 2:01 pm
Contact:

Re: Boing ball BASIC demo

Post by AJW » Wed Jul 29, 2020 9:41 am

I see, nice piece of work. Subdividing circles and spheres too I wouldnt know where to start.

drfloyd
Posts: 381
Joined: Tue Jun 09, 2020 3:36 pm
Contact:

Re: Boing ball BASIC demo

Post by drfloyd » Mon Aug 03, 2020 10:54 am

Kweepa wrote:
Sat Jul 25, 2020 10:55 pm
https://www.youtube.com/watch?v=ZuC484vzUHk

Code: Select all

0REM BBC Boing Ball by Steve McCrea with assist by Paul Malin
1MO.2:$@%="6456565611117777":F.I%=0TO15:V.19,I%,@%?I%-48;0;5:N.:F.X%=0TO79:GC.0,6+(1A.X%):MOVE16*X%+8,0:PL.1,0,1024:N.:GC.0,2:F.Y%=0TO31:MOVE0,32*Y%:PL.1,1280,0:N.
2V.23;13,48;0;0;0:GC.0,1:F.Y%=30TO426S.8:H=ABS(230-Y%)/200:W%=200*SQR(1-H*H):MOVE1054+(Y%-230)/2,Y%:PL.1,W%,-W%/2:N.
3F.J%=0TO7:F.X%=0TO27:C=75*COS(X%*PI/28):GC.0,8+(7A.X%+J%*4):F.K%=J%TOJ%+1:Q=K%*PI/8:U=C*SINQ:V=75*COSQ:PL.84+SGNX%,1004+U*3+V,270+V*3-U:N.,,:X%=48:U%=0:T%=0
4A%=&600+X%+80*INT(U%*2.5-U%*U%*.1):*FX19
5P%=6+((1A.X%-4)=0):Q%=6+((1A.X%-5)=0):R%=8+(7A.X%):S%=8+(7A.X%+4):T%=(T%+1)MOD96:X%=ABS(T%-48):U%=T%MOD24:V.23;12,A%/256;0;0;0,23;13,A%;0;0;0,19,6,P%;0;19,7,Q%;0;19,R%,1;0;19,S%,7;0;:G.4

How is it possible to move the ball like this in basic !!!!?????????

User avatar
BigEd
Posts: 3454
Joined: Sun Jan 24, 2010 10:24 am
Location: West
Contact:

Re: Boing ball BASIC demo

Post by BigEd » Mon Aug 03, 2020 11:20 am

It's not possible to move the ball so fast, but in fact the ball isn't moving in memory. I think what's happening is that the screen base address is being updated, with the consequence that the image moves around the screen. The colour palette is animated too, to give the impression of the ball rotating. You can see pixels with 5 different colours, but there are more than 5 pixel values in play - maybe 8 - so there are 4 frames of animation packed into the apparently 2 colour ball, and similarly for the apparently 2 colour background. Or maybe even more...

drfloyd
Posts: 381
Joined: Tue Jun 09, 2020 3:36 pm
Contact:

Re: Boing ball BASIC demo

Post by drfloyd » Mon Aug 03, 2020 2:08 pm

fascinating !!!!

can't believe the ball don't move !!!!!!

it's PURE basic, even when the screen adress move ?

Kweepa
Posts: 29
Joined: Mon Dec 16, 2013 11:45 pm
Contact:

Re: Boing ball BASIC demo

Post by Kweepa » 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.

Post Reply

Return to “new projects and releases: demoscene”