Jump to content
IGNORED

DIMensioning error 8


Recommended Posts

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.
 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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 :)

 

  • Like 2
  • Thanks 1
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.... ?)

 

 

  • Haha 1
Link to comment
Share on other sites

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.

  • Like 2
  • Thanks 1
Link to comment
Share on other sites

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

Link to comment
Share on other sites

Posted (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...

 

20240305_133955.jpg

 

THis is with OSS Basic XE. 

Edited by Ricky Spanish
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 by yetanothertroll
line numbering goof
Link to comment
Share on other sites

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 

Link to comment
Share on other sites

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 by Rybags
Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

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.)

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...