Loading custom character sets

Basic and Machine Language

Moderator: Moderators

Legacy
Vic 20 Enthusiast
Posts: 154
Joined: Wed Dec 31, 2008 4:01 pm

Post by Legacy »

Jeff , if My Dear Aunt Sally applied here then it would still be incorrect. According to the order of operations, Multiplication takes precedence over Subtraction which is second and Addition is last in this case ,
My Dear Sally Aunt? . That's what it looks like to me, but then again, if multiplication was done first, then the correct answer would come out 7215 either way, only 1 is being subtracted, I think it goes x / + - , so maybe you were right after all but the way carlsson shows it is :

7168+6*8-1 = 7168+48-1 = 7168+47 = 7215 <- correct evaluation
Multiplication Subtraction Addition

which makes it look like subtraction comes before addition! oopsy doodles
Legacy
Vic 20 Enthusiast
Posts: 154
Joined: Wed Dec 31, 2008 4:01 pm

Post by Legacy »

And now for the grand finale, thanks for the tips Carlsson, helped me finish up my screen pokes efficently whithout doin poke #, poke # , poke #, shout out to Kweepa an Carlsson!!
(ps. for unexpanded vic)

1 poke52,28:poke56,28: clr
2 for i=7168 to 7679:poke i,peek(i+25600):next
3 poke 36869,255
10 for l=7168 to 7168 + 6*8 - 1:read a:pokel,a:next
20 data 48,48,96,96,192,192,254,254
21 data 254,254,192,204,108,96,60,60
22 data 240,240,192,239,239,118,62,30
23 data 62,62,102,102,214,214,6,6
24 data 24,56,112,96,192,192,254,254
25 data 198,230,118,62,30,6,30,30
30 poke 36879,8
35 print"{clr}{white}{right 6, down7} @.a.b.c.d.e."
40 for s = 1 to 1000
45 for i = 1 to 7
50 p=38560
52 for v=1to6: poke p,i:p=p+2:next v
55 for t=1to25:next t:next i:next s
Leeeeee
soldering master
Posts: 396
Joined: Fri Apr 23, 2004 8:14 am

Post by Leeeeee »

Multiplication and division have the same priority and are executed in order left to right. The same is true for addition and subtraction.

Lee.
carlsson
Class of '6502
Posts: 5516
Joined: Wed Mar 10, 2004 1:41 am

Post by carlsson »

Legacy wrote:50 p=38560
52 for v=1to6: poke p,i:p=p+2:next v
Those two lines could possibly be rewritten as:

50 p=38560
52 for v=0 to 5:poke p+v*2,i:next v

or even:
50 for p=38560 to 38570 step 2:poke p,i:next p

It depends on whether you actually want variable p to be increased or not. The FOR statement will run up to and including 38570.
Anders Carlsson

Image Image Image Image Image
User avatar
Jeff-20
Denial Founder
Posts: 5759
Joined: Wed Dec 31, 1969 6:00 pm

Post by Jeff-20 »

Leeeeee wrote:Multiplication and division have the same priority and are executed in order left to right. The same is true for addition and subtraction.
What he said. :p

I'm shocked I even know that. I'm awful at math. Oddly enough, I didn't learn this in school. I learned it by trial and error on my VIC when I was 9 or something. Oh what a mystery that was. Pre-internet there were few places to get questioned answered so you just had to form and test your own theories.
High Scores, Links, and Jeff's Basic Games page.
carlsson
Class of '6502
Posts: 5516
Joined: Wed Mar 10, 2004 1:41 am

Post by carlsson »

The University of VIC-20. :lol:
Anders Carlsson

Image Image Image Image Image
DELETED

Post by DELETED »

DELETED
User avatar
Pedro Lambrini
Vic 20 Scientist
Posts: 1132
Joined: Mon Dec 01, 2008 11:36 am

Post by Pedro Lambrini »

Brackets, ORDER, Division, Multiplication, Addition, Subtraction. Order basically means 'to the power of'. :)

I remember that from school too!
Ian Colquhoun
Vic 20 Hobbyist
Posts: 147
Joined: Fri Dec 29, 2006 7:38 am
Location: Toronto, Canada

Post by Ian Colquhoun »

Pedro Lambrini wrote:Brackets, ORDER, Division, Multiplication, Addition, Subtraction. Order basically means 'to the power of'. :)

I remember that from school too!
Or even BEDMAS.

Brackets, exponents, division, multiplication, addition, subtraction.

What is "ORDER"? Isn't that what this whole discussion is about?
Realms of Mystery BBS
bbs.pipesup.ca 6400
(currently offline)
User avatar
Pedro Lambrini
Vic 20 Scientist
Posts: 1132
Joined: Mon Dec 01, 2008 11:36 am

Post by Pedro Lambrini »

I had a look around and found that on the BBC Childrens site they have changed the 'O' from the word Order to the word Other even though they explain Other to be the same as Order! Here's a quote:

"...All of these terms are fairly obvious except for 'Other', which are really just powers (e.g. 23 or 42 etc.)"

Hope that makes more sense. :)
Leeeeee
soldering master
Posts: 396
Joined: Fri Apr 23, 2004 8:14 am

Post by Leeeeee »

Also don't forget AND and OR with AND being lower prioroty than add or subtract and OR being the lowest priority of all.

Lee.
User avatar
Jeff-20
Denial Founder
Posts: 5759
Joined: Wed Dec 31, 1969 6:00 pm

Post by Jeff-20 »

I have always been confused by the priority the VIC gives logical connectives. Every time I use it I have to experiment until I get the desired results. And I always forget the next time I need it. :oops:

What is the definitive rule for AND, OR, NOT? I think the VIC may not follow the normal rules here.
High Scores, Links, and Jeff's Basic Games page.
Leeeeee
soldering master
Posts: 396
Joined: Fri Apr 23, 2004 8:14 am

Post by Leeeeee »

Priorities in descending order are ..

()
^
preceding -, e.g. A=-7*3 does (-7)*3
* /
+ -
NOT
AND
OR

This is pretty much standard for all Microsoft BASICs.

Lee.
carlsson
Class of '6502
Posts: 5516
Joined: Wed Mar 10, 2004 1:41 am

Post by carlsson »

BEDMAS sounds like a holiday you spend asleep.
Anders Carlsson

Image Image Image Image Image
MacbthPSW
Vic 20 Afficionado
Posts: 478
Joined: Wed Apr 06, 2005 1:56 pm

Post by MacbthPSW »

I learned it as BEDMAS too. Must be an Ontario thing?
Post Reply