Anything Sinclair ZX Basic related; history, development, tips - differences between BASIC on the ZX80 and ZX81
-
Shaun_B
- Posts: 474
- Joined: Wed Apr 22, 2009 10:22 am
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 245 times
-
- 1kbounce.p
- (261 Bytes) Downloaded 267 times
Last edited by
Shaun_B on Sat Jan 05, 2019 1:56 pm, edited 1 time in total.
-
Dim_75
- Posts: 80
- Joined: Fri Sep 01, 2017 11:04 pm
- Location: Paris, FR
Post
by Dim_75 »
Small, simple, cool !
-
dr beep
- Posts: 2079
- Joined: Thu Jun 16, 2011 8:35 am
- Location: Boxmeer
Post
by dr beep »
-
Crayon21
- Posts: 357
- Joined: Sun Nov 04, 2018 2:33 am
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
-
dr beep
- Posts: 2079
- Joined: Thu Jun 16, 2011 8:35 am
- Location: Boxmeer
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.