dim msx basic

Page 1/3
| 2 | 3

By TheKid

Paladin (808)

TheKid's picture

02-10-2017, 13:27

Hi there,

I was wondering if there is a basic command that is faster then dim.

I am filling a dim x(31,15) with values (2 digits) from a .txt file.
After that I read from this same dim to do several things with it.

I doing the programming in openmsx, which has the marvellous F9 speedup options. But in real time, it is kind of slow.
Is there anothter/faster command then DIM to store 256 2 digit values in msx basic ?

Login or register to post comments

By Lord_Zett

Paladin (807)

Lord_Zett's picture

02-10-2017, 14:09

after dim bsave the memory part with those var. so you can reuse them

By nikodr

Paladin (726)

nikodr's picture

02-10-2017, 15:10

Well i know that you use basic but would assume that asm code would make it very fast.Why don't you try to check that?
Msx basic would not be very fast for dim and variables.

By Sandy Brand

Master (153)

Sandy Brand's picture

02-10-2017, 16:46

Maybe use something like the KUN-compiler?

By wolf_

Ambassador_ (9767)

wolf_'s picture

02-10-2017, 17:10

I've got this idea, and I don't know whether it makes sense or whether it works. Perhaps soms system guru like NYYRIKKI would know. BASIC is partly slow because of error checking. If you write outside the bounds of an array, you get an error. This error is actually pure luxery, because normally the system would just behave strangly, or may even crash (if you'd overwrite code with data).

Would it be possible to
1) read out (dmp) the BASIC ROM
2) erase all the error checks
3) load the adjusted BASIC into RAM and use it as such
?

See it as a kind of 'release mode', when you replace the foolproof yet slow BASIC with a faster yet crash-prone altered BASIC. You'd still develop your game in standard BASIC, and once it's all finished, you run it in the adjusted BASIC.

Or, is this a bad idea? Murdoch

By tvalenca

Paladin (728)

tvalenca's picture

02-10-2017, 18:55

Don't MSX-BASIC v2 have a feature for that? (Wiki - Programming - MSX-BASIC Instructions - COPY)

By Vampier

Prophet (2296)

Vampier's picture

02-10-2017, 19:13

if you have a dimensional array why not use the memory directly with poke/peek?

By TheKid

Paladin (808)

TheKid's picture

02-10-2017, 19:33

@Vampier: Okay, I am not familiar with pokes. Which addresses area available to store 256 values Smile

By tvalenca

Paladin (728)

tvalenca's picture

02-10-2017, 19:53

No problem if it is a String array. But if it is an Integer array you'll need to poke numbers the way BASIC stores them on variables. (token for each 1-digit numbers, then single token for 1-byte numbers (from 10 to 255) finally another token for 2-byte numbers. And of course a token for the negative sign)

By tvalenca

Paladin (728)

tvalenca's picture

02-10-2017, 19:56

I'm not used to it, but you can reach one variable's address using VARPTR.

By TheKid

Paladin (808)

TheKid's picture

02-10-2017, 20:06

@tvalenca: Line one of my txt file looks like this:
06,06,06,06,07,07,07,07,07,07,07,06,06,06,06,06,07,00,00,00,00,00,00,00,07,00,00,00,00,00,00,00

The whole file has 15 of these kind of lines.

Page 1/3
| 2 | 3