data from bank 22 to bank 14 does not work in nextbasic

The Speccy's spritely young offspring. Discuss everything from FPGA to ZX
Post Reply
funkheld
Dizzy
Posts: 55
Joined: Tue May 18, 2021 9:01 pm

data from bank 22 to bank 14 does not work in nextbasic

Post by funkheld »

Hi good afternoon.
why does bank 14 not receive any data from bank 22?

this is with data 192 byte : tilesprite2.map

this screen :
https://www.specnext.com/forum/viewtopi ... a68a831b77

Thank you.
greeting

no date from bank 22 to bank 14 :
1050 b=b+1 : %a=% bank 22 peek b : bank 14 poke y+0*16,%a
1055 b=b+1 : %a=% bank 22 peek b : bank 14 poke y+1*16,%a

this data is ok :
1050 b=b+1 : %a=% bank 22 peek b : bank 14 poke y+0*16,18 rem tile nr. 18
1055 b=b+1 : %a=% bank 22 peek b : bank 14 poke y+1*16,16 rem tile nr. 16

Code: Select all

10 RUN AT 3
20 LAYER 2,1: CLS : LAYER DIM 16,0,255-16,191
30 LOAD "sprite2.spr" BANK 13 
40 LOAD "tilespriteleer.map" BANK 14
45 load "tilesprite2.map" bank 22
50 TILE BANK 13
60 TILE DIM 14,0,16,16
70 TILE 16,12
80 b=0 : y=0 : %a=0 
100 repeat
120 IF INKEY$ ="q" THEN  %x=%x+1 : if %x>255 then %x=0 
125 proc bewege()
131 y=%x/16
132 proc setze()
145 pause 1
146 repeat until 0
150 rem
1000 DEFPROC bewege()
1020 reg %$16,%x
1030 endproc
1035 rem
1040 defproc setze()
1050 b=b+1 : %a=% bank 22 peek b : bank 14 poke y+0*16,18 
1055 b=b+1 : %a=% bank 22 peek b : bank 14 poke y+1*16,16
1065 b=b+1 : %a=% bank 22 peek b : bank 14 poke y+3*16,%a
1066 b=b+1 : %a=% bank 22 peek b : bank 14 poke y+4*16,%a
1067 b=b+1 : %a=% bank 22 peek b : bank 14 poke y+5*16,%a
1070 b=b+1 : %a=% bank 22 peek b : bank 14 poke y+6*16,%a
1075 b=b+1 : %a=% bank 22 peek b : bank 14 poke y+7*16,%a
1080 b=b+1 : %a=% bank 22 peek b : bank 14 poke y+8*16,%a
1085 b=b+1 : %a=% bank 22 peek b : bank 14 poke y+9*16,%a
1090 b=b+1 : %a=% bank 22 peek b : bank 14 poke y+10*16,%a
1094 b=b+1 : %a=% bank 22 peek b : bank 14 poke y+11*16,%a 
1095 y=0 
1100 TILE 16,12
1110 endproc
SNG
Drutt
Posts: 13
Joined: Sat Dec 23, 2023 12:16 am

Re: data from bank 22 to bank 14 does not work in nextbasic

Post by SNG »

Your code does not work because you are setting the variable b and then using the independent variable %b in the integer PEEK expression. The % is effective on all variable references till the end of the expression e.g. up to THEN, colon, comma or enter.

Set %b instead of b and it will work as you expected. Like all integer variables, %b is zero after CLEAR or NEW till you change it. Changing b won’t touch %b.
Post Reply