Ricky Spanish Posted March 4 Share Posted March 4 Error - 8 at line 480 INPUT/READ Type Mismatch 400 DIM DND(20,21),ND$(20),SD$(10),WD$(10),ED$(10),EN$(25),C$(10) 480 FOR Y=1 TO 21:FOR X=1 TO 20:READ D:DND(X,Y)=D:NEXT X:NEXT Can't wrap my mind on where I messed up here. BASIC XE w/ extensions if that matters. Quote Link to comment Share on other sites More sharing options...
_The Doctor__ Posted March 4 Share Posted March 4 (edited) what are you reading D from? show us the data statement line and it's contents Edited March 4 by _The Doctor__ Quote Link to comment Share on other sites More sharing options...
Ricky Spanish Posted March 4 Author Share Posted March 4 44 minutes ago, _The Doctor__ said: show us the data statement line and it's contents 3760 DATA 1,1,1,1,1,1,1,1,1,1,1,1,4,4,4,4,4,4,4,4 3780 DATA 1,1,1,1,0,0,0,1,0,11,1,1,4,4,26,11,0,25,4,4 3800 DATA 1,1,0,0,0,1,0,0,0,1,1,1,4,4,6,4,4,4,4,4 3820 DATA 1,1,1,1,0,1,1,1,0,0,0,0,6,0,0,0,0,4,1,1 3840 DATA 1,0,1,0,1,1,0,0,1,22,0,0,6,0,1,0,1,1,18,1 3860 DATA 1,0,0,0,0,0,0,1,23,0,0,1,1,0,1,0,1,1,0,1 3880 DATA 1,3,3,3,1,0,1,1,0,0,17,1,19,0,6,0,1,0,0,1 3900 DATA 1,3,22,22,0,1,0,1,1,0,1,1,1,0,1,1,0,0,1,1 3920 DATA 1,3,22,6,21,1,0,0,0,0,0,0,0,0,0,0,0,6,26,1 3940 DATA 1,3,22,1,20,1,2,2,2,2,2,1,1,1,1,0,1,1,19,1 3960 DATA 1,3,22,1,10,1,2,2,2,2,2,1,1,1,1,0,1,1,19,1 3980 DATA 1,3,11,1,20,10,.7,.7,2,.7,10,0,0,0,0,0,1,1,0,1 4000 DATA 1,0,0,1,1,1,2,.7,.7,.7,2,1,0,1,1,18,1,1,0,1 4020 DATA 1,0,1,1,1,1,2,2,.7,2,2,1,0,0,0,0,0,0,0,1 4040 DATA 1,0,1,15,1,1,1,1,10,1,1,1,0,1,1,0,1,1,1,1 4060 DATA 1,0,1,11,1,1,1,1,0,.5,1,1,0,1,1,0,12,1,1,1 4080 DATA 1,0,10,0,10,13,10,0,0,0,0,10,0,0,0,0,0,1,18,1 4100 DATA 1,0,1,11,1,1,1,1,4,0,1,1_,0,1,1,1,0,1,0,1 4120 DATA 1,12,1,14,1,1,1,1,0,0,1,1,0,0,17,1,0,0,0,1 4140 DATA 1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1 4160 DATA 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 Quote Link to comment Share on other sites More sharing options...
_The Doctor__ Posted March 4 Share Posted March 4 4100 DATA 1,0,1,11,1,1,1,1,4,0,1,1_,0,1,1,1,0,1,0,1 can't have an underscore or other character data it must be numbers only for non string read. 1 1 Quote Link to comment Share on other sites More sharing options...
TGB1718 Posted March 4 Share Posted March 4 7 hours ago, Ricky Spanish said: 480 FOR Y=1 TO 21:FOR X=1 TO 20:READ D:DND(X,Y)=D:NEXT X:NEXT Don't know if you're aware, but numeric arrays start at '0' so in your code, you are wasting 42 elements of the array * 6 = 252 bytes 2 1 Quote Link to comment Share on other sites More sharing options...
Ricky Spanish Posted March 4 Author Share Posted March 4 Hmmm.. no clue how that _ got in there. Thanks. Quote Link to comment Share on other sites More sharing options...
Ricky Spanish Posted March 4 Author Share Posted March 4 Right, so got all that straightened out. Now I'm faced with an Error - 6 at line 480 No DATA to READ 😐 Quote Link to comment Share on other sites More sharing options...
TGB1718 Posted March 4 Share Posted March 4 11 minutes ago, Ricky Spanish said: Error - 6 at line 480 No DATA to READ It's out of data, I put a counter in and there are only 418 data items, you need 420 Quote Link to comment Share on other sites More sharing options...
Ricky Spanish Posted March 4 Author Share Posted March 4 8 minutes ago, TGB1718 said: It's out of data, I put a counter in and there are only 418 data items, you need 420 And this is why I'm didn't go into the DATA entry field. So, how do I find where I f'ed up ? Thanks. Quote Link to comment Share on other sites More sharing options...
thank you Posted March 5 Share Posted March 5 This has always worked for me... 6969 DATA 69,69 Seriously though, In the old days (assuming a type-in) you'd just go back over it from the start... always sucked when you'd make an error that gave the correct 'checksum' from the 'proofreader'... There is not enough information presented for anybody to answer this question but I do count 21 DATA statements so they have to have on average 20 elements each (last two lines are 18 so.... ?) 1 Quote Link to comment Share on other sites More sharing options...
Rybags Posted March 5 Share Posted March 5 A hint for tracking down such problems - this applies to Atari Basic as well as Basic XL and XE. ? PEEK(183) + PEEK(184) * 256 will give the current DATA line so if you have such an error this can help to narrow down the cause. 2 1 Quote Link to comment Share on other sites More sharing options...
TGB1718 Posted March 5 Share Posted March 5 4 hours ago, Rybags said: A hint for tracking down such problems - this applies to Atari Basic as well as Basic XL and XE. ? PEEK(183) + PEEK(184) * 256 will give the current DATA line so if you have such an error this can help to narrow down the cause. Nice, I didn't know that one, really good for "bad" data, but in this case I think it's just run out of data Quote Link to comment Share on other sites More sharing options...
Ricky Spanish Posted March 5 Author Share Posted March 5 (edited) 14 hours ago, Rybags said: A hint for tracking down such problems - this applies to Atari Basic as well as Basic XL and XE. ? PEEK(183) + PEEK(184) * 256 will give the current DATA line so if you have such an error this can help to narrow down the cause. Thanks. Ran it. Typed in the above and... THis is with OSS Basic XE. Edited March 5 by Ricky Spanish Quote Link to comment Share on other sites More sharing options...
_The Doctor__ Posted March 5 Share Posted March 5 He runs out of data, so he is missing 2 things. you already know it runs out on the last data statement... He can track down the missing data, shorten a loop by 2, or add dummy data. Then he can at least see something. Quote Link to comment Share on other sites More sharing options...
Ricky Spanish Posted March 5 Author Share Posted March 5 Right, so shortened x to 18. Runs now. Typed in the above and ... Quote Link to comment Share on other sites More sharing options...
yetanothertroll Posted March 5 Share Posted March 5 (edited) I'll often throw in some sort of string tag to track this sort of thing down, (air code) 10 dim a(10,10), tag$(10) 20 for row = 0 to 10 30 read tag$ 35 if tag$(1, 3) <> "row" then stop 40 for col = 0 to 10 50 read temp 60 a(row, col) = temp 70 next col 80 next row 90 read tag$ 95 if tag$ <> "EOF" then print "oopsie!" 99 end 900 data "row 0", 1, 2, 3, ... 910 data "row 1", 5, 9, 7, ... ... 999 data "EOF" Edited March 5 by yetanothertroll line numbering goof Quote Link to comment Share on other sites More sharing options...
Rybags Posted March 6 Share Posted March 6 32768 indicates out of data but you'd have gotten an error message or trap condition anyway. Quote Link to comment Share on other sites More sharing options...
Ricky Spanish Posted March 6 Author Share Posted March 6 2 hours ago, Rybags said: 32768 indicates out of data but you'd have gotten an error message or trap condition anyway. K well my bad for not mentioning this earlier.. but I'm a potato when it comes to programing. Saying so-in-so number means X I can't comprehend unless I have something that I can refer too. Just by looking at number 32768 or 262144 I have no clue on what that means without a point of reference. Is there any material/notes out there that explain diagnostic statements like : ? PEEK(183) + PEEK(184) * 256 Quote Link to comment Share on other sites More sharing options...
Rybags Posted March 6 Share Posted March 6 (edited) The huge number there is due to multiplying instead of adding. Diagnostic statement - not really. You'll see lots of that sort of thing, it's how 6502 programs usually stores words of binary data (word = 16 bits) Low byte followed by high byte. Edited March 6 by Rybags Quote Link to comment Share on other sites More sharing options...
TGB1718 Posted March 6 Share Posted March 6 7 hours ago, Ricky Spanish said: Is there any material/notes out there that explain diagnostic statements like : ? PEEK(183) + PEEK(184) * 256 It's a standard way to find 16 bit values as @Rybags says, you will see in many programs things like this 10 REM DISPLAY LIST ADDRESS 20 DL=PEEK(560)+PEEK(561)*256 30 REM SCREEN ADDRESS 40 SC=PEEK(88)+PEEK(89)*256 Once you have those addresses, you can PEEK/POKE as required so for SC above you can POKE characters directly to the screen (bear in mind screen characters are not ASCII) e.g. 1 ? CHR$(125):REM CLS 2 DIM A$(20) 3 SC=PEEK(88)+PEEK(89)*256:REM GET SCREEN START 4 A$="12345678901234567890" 5 FOR I=1 TO LEN(A$) 6 POKE SC+I,ASC(A$(I,I)) :REM POKE CHARACTERS TO SCREEN 7 NEXT I on screen you will see:- QRSTUVWXYPQRSTUVWXYP Quote Link to comment Share on other sites More sharing options...
Ricky Spanish Posted March 7 Author Share Posted March 7 Thanks. Quote Link to comment Share on other sites More sharing options...
+slx Posted March 7 Share Posted March 7 With BASIC XE (and other advanced variants) you can actually use DPEEK(183) and BASIC will multiply and add the contents of 184 on its own. (In case you wonder what this is good for to start with, the 6502 stores numbers larger than 256 in two subsequent memory locations, the first one being the lower half or LSB. To get a two-byte number you PEEK it and add 256 times the value of the following byte.) 1 1 Quote Link to comment Share on other sites More sharing options...
Ricky Spanish Posted March 9 Author Share Posted March 9 Took a while but it all sorted out now. Thanks. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.