1k bouncing ball

Anything Sinclair ZX Basic related; history, development, tips - differences between BASIC on the ZX80 and ZX81
Post Reply
Shaun_B
Posts: 474
Joined: Wed Apr 22, 2009 10:22 am

1k bouncing ball

Post by Shaun_B »

Here's a 1k bouncing ball demo using some useful memory saving techniques.

Code: Select all

   2 SAVE "B"
   3 CLS
   4 PLOT X,Y
   5 LET X=X+A
   6 LET Y=Y+B
   7 IF Y>=CODE "F" OR NOT Y THEN LET B=-B
   8 IF X>=CODE "Z" OR NOT X THEN LET A=-A
   9 GOTO PI
In direct mode, enter

Code: Select all

LET X=NOT PI
LET Y=X
LET A=NOT X
LET B=NOT Y
GOTO 2
Regards,

Shaun.
Attachments
bouncev2.p
Slight amend to see if I could save more bytes
(267 Bytes) Downloaded 236 times
1kbounce.p
(261 Bytes) Downloaded 260 times
Last edited by Shaun_B on Sat Jan 05, 2019 1:56 pm, edited 1 time in total.
User avatar
Dim_75
Posts: 80
Joined: Fri Sep 01, 2017 11:04 pm
Location: Paris, FR

Re: 1k bouncing ball

Post by Dim_75 »

Small, simple, cool ! ;) :P
dr beep
Posts: 2060
Joined: Thu Jun 16, 2011 8:35 am
Location: Boxmeer

Re: 1k bouncing ball

Post by dr beep »

Crayon21
Posts: 346
Joined: Sun Nov 04, 2018 2:33 am

Re: 1k bouncing ball

Post by Crayon21 »

Very well done. what are the Not statements for though?
In Heck, there are two options for perpetual torment:

Eat the Puckerberry and suffer for eternity:
drink nothing but a cocktail of The Last Dab and Mexican Cake blended and served with
habanero slices
:twisted:
dr beep
Posts: 2060
Joined: Thu Jun 16, 2011 8:35 am
Location: Boxmeer

Re: 1k bouncing ball

Post by dr beep »

NOT A will test if A=0

NOT 0 will give 1 as result
When A<>0 then NOT A will return 0 (false)

NOT A is 2 bytes, the shortest (bytesaving) test.
thedevworks
Posts: 15
Joined: Mon Mar 04, 2019 5:33 pm

Re: 1k bouncing ball

Post by thedevworks »

https://youtu.be/EJCFu95eAxI


Nice :) Fun.. Thanks!
Post Reply