breakintoprogram / agon-bbc-basic-adl

Official AGON QUARK Firmware: BASIC Interpreter (ADL version)
zlib License
16 stars 0 forks source link

some how my dim is not global if use on agon light 2 #20

Open tenij000 opened 5 months ago

tenij000 commented 5 months ago

if press 2 then give number for example 10 then it works if press 3 then give number then does't work

sofar dont now how make it global Grid%(10,40)

1 DIM Grid%(10,40) 2 Grid%(2,2)=25 3 d%=0

10 REM BBC BASIC Program to Move Character with WASD 20 MODE 1 : REM Set the screen mode (teletext mode for simplicity) 30 x%=0 : REM Initial x position 40 y%=0 : REM Initial y position 41 result% = 10 50 PRINT TAB(x%, y%); "@" : REM Print the character at the initial position

60 REM Main loop 70 REPEAT

80 REM Read key press 90 key$ = GET$ 100 REM Clear the previous character 110 PRINT TAB(x%, y%); " "; 120 REM Update position based on key press 130 IF key$ = "w" AND y% > 0 THEN y% = y% - 1 140 IF key$ = "s" AND y% < 24 THEN y% = y% + 1 150 IF key$ = "a" AND x% > 0 THEN x% = x% - 1 160 IF key$ = "d" AND x% < 39 THEN x% = x% + 1 161 IF key$ = "1" THEN PROC_REKEN 162 IF key$ = "2" THEN d%= 1 163 IF d% = 1 THEN INPUT getal% 164 IF d% = 1 THEN Grid%(x%,y%)=getal% 165 d%=0 166 IF key$ = "3" THEN PROC_GETAL(x%,y%)

170 REM Print the character at the new position 180 PRINT TAB(x%, y%); "@"; 181 PRINT TAB(20,26);y%,x% 182
183 PROC_TEKEN 184 result% = Grid%(x%,y%) 185 PRINT TAB(20,27);"regel",result%

186 IF x% = 2 AND y% = 2 THEN PRINT TAB(1,30);"CEL10,10" 190 UNTIL FALSE

1010 DEF PROC_REKEN 1020 PRINT TAB(1,1);"1 2 3 4 5 6 7 8 9 10" 1030 ENDPROC

2000 DEF PROC_TEKEN 2010 MOVE 0,300 2011 DRAW 10,10,400,10 2012 ENDPROC

3000 DEF PROC_GETAL(x%,y%) 3010 INPUT getal% 3020 REM PRINT getal% 3030 Grid%(x%,y%)=getal% 3031 Grid%(5,5)=66 3030 ENDPROC