Uploaded August 2023 | Updated November 2026, 3 hours ago
In this video, I tested a couple of different solutions for joining two conditions in IF statements on a Commodore 64. The idea for this video came from a Facebook post to use arithmetic instead of logical operators in if statements. The goal was to compare those solutions and see which one is the fastest one.
â If You like this video you can buy me a coffee: ko-fi.com/josipretrobits â
METHODS:
==============
1 if a=0 and b=0 then
2 if a=0 then if b=0 then
3 if (a=0)*(b=0)=1 then
4 if a*a+b*b=0 then
5 if abs(a)+abs(b)=0 then
TEST CASES:
==============
1 A is equal to 0, B is equal to 0
2 A is not equal to 0, B is not equal to 0
3 A is equal to 0, B is not equal to 0
4 A is not equal to 0, B is equal to 0
TEST CODES:
==============
0 rem arithmetic check
10 s=ti:a=5:b=5
20 fori=1to200
30 if a*a+b*b=0 then c=c+1
40 next
50 df=ti-s
60 print df,c
0 rem abs sum check
10 s=ti:a=5:b=5
20 fori=1to200
30 if abs(a)+abs(b)=0 then c=c+1
40 next
50 df=ti-s
60 print df,c
0 rem equal to, operators
10 s=ti:a=5:b=5
20 fori=1to200
30 if (a=0)*(b=0)=1 then c=c+1
40 next
50 df=ti-s
60 print df,c
0 rem nested if's
10 s=ti:a=5:b=5
20 fori=1to200
30 if a=0 then if b=0 then c=c+1
40 next
50 df=ti-s
60 print df,c
0 rem classic if and
10 s=ti:a=5:b=5
20 fori=1to200
30 if a=0 and b=0 then c=c+1
40 next
50 df=ti-s
60 print df,c
CHECK OUT:
==========
8Bit Retro ReFix @8BitRetroReFix
Captain Commodore @CaptainCommodore
Retro4u @Retro4u
YARC - Yet Another Retro Channel @YARC-1981
8bitsinthebasement @8bitsinthebasement
CHECK OUT MY OTHER COMMODORE/ACORN VIDEOS:
==========================================
đšī¸ Commodore 64 Programming: youtube.com/playlist?list=PLT0ijfj8mLN7G_Et0DGaVxcVK3N2EpnYk
đšī¸ Commodore 64 Hardware Videos: youtube.com/playlist?list=PLT0ijfj8mLN6JTkWianAanzEgLCaA0zFE
đšī¸ Commodore 64 Plus/4 Videos: youtube.com/playlist?list=PLT0ijfj8mLN7ioE3wBPYsu32V6Vs9goib
đšī¸ Acorn Electron Videos: youtube.com/playlist?list=PLT0ijfj8mLN5n1GNlJPZn3CW7o3hRf7Jv
đšī¸ Commodore 64 Games and Demos: youtube.com/playlist?list=PLT0ijfj8mLN6yuzbYo6MnQifgUEM08t83
đšī¸ The Pong Game Projects: youtube.com/playlist?list=PLT0ijfj8mLN6QqB1wxCWv7ERaw0fo44kB
#c64 #commodore #basic #programming #ifs #8bit #retrocomputing #arithmetic
In this video, I tested a couple of different solutions for joining two conditions in IF statements on a Commodore 64. The idea for this video came from a Facebook post to use arithmetic instead of logical operators in if statements. The goal was to compare those solutions and see which one is the fastest one.
â If You like this video you can buy me a coffee: ko-fi.com/josipretrobits â
METHODS:
==============
1 if a=0 and b=0 then
2 if a=0 then if b=0 then
3 if (a=0)*(b=0)=1 then
4 if a*a+b*b=0 then
5 if abs(a)+abs(b)=0 then
TEST CASES:
==============
1 A is equal to 0, B is equal to 0
2 A is not equal to 0, B is not equal to 0
3 A is equal to 0, B is not equal to 0
4 A is not equal to 0, B is equal to 0
TEST CODES:
==============
0 rem arithmetic check
10 s=ti:a=5:b=5
20 fori=1to200
30 if a*a+b*b=0 then c=c+1
40 next
50 df=ti-s
60 print df,c
0 rem abs sum check
10 s=ti:a=5:b=5
20 fori=1to200
30 if abs(a)+abs(b)=0 then c=c+1
40 next
50 df=ti-s
60 print df,c
0 rem equal to, operators
10 s=ti:a=5:b=5
20 fori=1to200
30 if (a=0)*(b=0)=1 then c=c+1
40 next
50 df=ti-s
60 print df,c
0 rem nested if's
10 s=ti:a=5:b=5
20 fori=1to200
30 if a=0 then if b=0 then c=c+1
40 next
50 df=ti-s
60 print df,c
0 rem classic if and
10 s=ti:a=5:b=5
20 fori=1to200
30 if a=0 and b=0 then c=c+1
40 next
50 df=ti-s
60 print df,c
CHECK OUT:
==========
8Bit Retro ReFix @8BitRetroReFix
Captain Commodore @CaptainCommodore
Retro4u @Retro4u
YARC - Yet Another Retro Channel @YARC-1981
8bitsinthebasement @8bitsinthebasement
CHECK OUT MY OTHER COMMODORE/ACORN VIDEOS:
==========================================
đšī¸ Commodore 64 Programming: youtube.com/playlist?list=PLT0ijfj8mLN7G_Et0DGaVxcVK3N2EpnYk
đšī¸ Commodore 64 Hardware Videos: youtube.com/playlist?list=PLT0ijfj8mLN6JTkWianAanzEgLCaA0zFE
đšī¸ Commodore 64 Plus/4 Videos: youtube.com/playlist?list=PLT0ijfj8mLN7ioE3wBPYsu32V6Vs9goib
đšī¸ Acorn Electron Videos: youtube.com/playlist?list=PLT0ijfj8mLN5n1GNlJPZn3CW7o3hRf7Jv
đšī¸ Commodore 64 Games and Demos: youtube.com/playlist?list=PLT0ijfj8mLN6yuzbYo6MnQifgUEM08t83
đšī¸ The Pong Game Projects: youtube.com/playlist?list=PLT0ijfj8mLN6QqB1wxCWv7ERaw0fo44kB
#c64 #commodore #basic #programming #ifs #8bit #retrocomputing #arithmetic










