The Speccy's spritely young offspring. Discuss everything from FPGA to ZX
funkheld
Dizzy
Posts: 57 Joined: Tue May 18, 2021 9:01 pm
Quote
0
login to like this post
Post
by funkheld » Mon May 02, 2022 9:49 pm
Hi good afternoon.
why does this error come up in nextbasic please?
Thank you.
greeting
funkheld
Dizzy
Posts: 57 Joined: Tue May 18, 2021 9:01 pm
Quote
0
login to like this post
Post
by funkheld » Tue May 03, 2022 12:47 pm
I'm looking for a demo that works with bank and peek in nextbasic.
not funktion :
1050 b=b+1 : a= bank 15 peek b
thanks
greeting
Pobulous
Dynamite Dan
Posts: 1425 Joined: Wed Nov 15, 2017 12:51 pm
Quote
0
login to like this post
Post
by Pobulous » Tue May 03, 2022 1:38 pm
Has NextBasic done away with the need to use LET for variable assignment?
funkheld
Dizzy
Posts: 57 Joined: Tue May 18, 2021 9:01 pm
Quote
0
login to like this post
Post
by funkheld » Tue May 03, 2022 5:38 pm
hello , this is ok.
now the x doesn't count in the peek.
greeting
Code: Select all
10 RUN AT 3
45 load "daten.map" bank 20
48 let b=0 : let a=0 : let x=0
50 for x=0 to 12
60 let a=% bank 20 peek x : print a
70 next x
90 go to 90
greeting
szerman
Drutt
Posts: 13 Joined: Sat May 28, 2022 6:53 am
Quote
0
login to like this post
Post
by szerman » Tue Jun 21, 2022 11:51 am
I am no expert but try
10 RUN AT 3
45 load "daten.map" bank 20
48 %b=0 : %a=0 : %x=0
50 for %x=0 to 12
60 let a=% bank 20 peek x : print %a
70 next %x
It is all down to the fact let a=% bank 20 peek x is declaired % so the output vairable needs the % to display correctly I think
funkheld
Dizzy
Posts: 57 Joined: Tue May 18, 2021 9:01 pm
Quote
0
login to like this post
Post
by funkheld » Wed Jun 22, 2022 8:41 am
thanks for the information.
unfortunately that doesn't work either.
greeting
SNG
Drutt
Posts: 13 Joined: Sat Dec 23, 2023 12:16 am
Quote
0
login to like this post
Post
by SNG » Sat Dec 23, 2023 9:36 am
The suggestion fixed one error, the use of x in an integer context when %x was required, but introduced another of the same type.
60 let %a=% bank 20 peek x : print %a
Now you are assigning to %a so printing it makes sense. Alternative fix:
60 let a=% bank 20 peek x : print a
Or cut out the middle-man:
60 PRINT % bank 20 peek x
The great majority of discussion and support for NextBASIC is in the Facebook group BASIC on the ZX Spectrum Next. See you there?
SNG
Drutt
Posts: 13 Joined: Sat Dec 23, 2023 12:16 am
Quote
0
login to like this post
Post
by SNG » Sat Dec 23, 2023 9:44 am
Line 48 is entirely redundant and can safely be omitted, BTW.
Incidentally the title is misleading. There is no error in nextBASIC shown here, just one common beginner misunderstanding about the meaning and purpose of % there. I have explained that more fully in another reply here.
I think a lot of people are initially confused because they think the % belongs to a variable rather than the whole expression it prefixes. This may be because they’ve been exposed to the different and relatively useless use of % as a suffix in Microsoft BASIC. The performance and memory benefit of integer expressions in NextBASIC is several times greater, and grows with increasing program size.