Weird problem with PSET - help please

Страница 2/2
1 |

By Grauw

Ascended (9904)

Аватар пользователя Grauw

22-12-2014, 23:21

Nothing wrong with storing data in VRAM… I think it’s rather clever Smile.

By JohnHassink

Ambassador (5575)

Аватар пользователя JohnHassink

22-12-2014, 23:22

Heehee, thanks. Smile I did the same with LEDA:
http://www.msx.org/downloads/mrc-challenges/mega-challenge/0...
I do know that a downside is that reading/writing VRAM is quite slow compared to normal RAM, but in this case, it doesn't matter much.

By Sandy Brand

Master (229)

Аватар пользователя Sandy Brand

23-12-2014, 00:07

Not only is it slower, it most likely will take up more memory when converted into actual executable code. Smile

I remember a common trick was to use the memory buffer that is normally reserved for MSX-Basic's PLAY command (assuming that you are not using it).

By JohnHassink

Ambassador (5575)

Аватар пользователя JohnHassink

23-12-2014, 00:57

Sandy Brand wrote:

Not only is it slower, it most likely will take up more memory when converted into actual executable code. Smile

How is that? Smile

Sandy Brand wrote:

I remember a common trick was to use the memory buffer that is normally reserved for MSX-Basic's PLAY command (assuming that you are not using it).

Interesting! Would the data 'survive' transition between turbo blocks, as far as you know?

By ericb59

Paragon (1046)

Аватар пользователя ericb59

23-12-2014, 07:54

john, with Nestor basic you have specific USR() function to store and read bytes in memory segments.
easy to use.
if you need help, send me an email...

ps : you can also store and read strings, bytes, or integer values

By NYYRIKKI

Enlighted (5776)

Аватар пользователя NYYRIKKI

23-12-2014, 09:08

@John
Looking at your problem... Did you know that you can transfer integer variables to turbo block by adding them after CALL TURBO command?

Example:
10 DEFINT A-Z
20 MX=30:MY=40
30 CALL TURBO ON (MX,MY)
40 PRINT MX,MY

By Sandy Brand

Master (229)

Аватар пользователя Sandy Brand

23-12-2014, 23:31

Sandy Brand]
[quote=JohnHassink
wrote:
Sandy Brand wrote:

Not only is it slower, it most likely will take up more memory when converted into actual executable code. Smile

How is that? Smile

Assuming it work the same as the good ol' KUN compiler; it basically converts your Basic byte-code into actual Z80 assembly code at run-time. It may store and run that generated Z80 assembly code in some other memory location but that also has a limit.

I remember quite a lot of my time with the KUN compiler was figuring out ways to reduce the memory footprint of the Basic code because I kept running out of memory Smile

By Grauw

Ascended (9904)

Аватар пользователя Grauw

24-12-2014, 00:58

Yeah, that was also a limit I used to hit when I programmed in Basic-kun. Someone should make a version which uses the free memory in pages 0-1 and the memory mapper to store the compiled Basic program. Add the ability to compile to BIN, COM or ROM, lift some of the other limitations as well, and I’m sure that would make a lot of happy programmers Smile.

By anonymous

incognito ergo sum (116)

Аватар пользователя anonymous

24-12-2014, 07:31

in stead of errors or crashes it would be fun if a compiler had a database of commands it can't handle but should be correct...
And it should never be loaded where Moonblaster has its replayer Wink

By ericb59

Paragon (1046)

Аватар пользователя ericb59

24-12-2014, 15:07

If you are using Nestor Basic you absolutely need a MSX with 128K of Ram (minimum).
Nestor Basic divide Ram in 16K Segments, from 0 to 7.
Segment 7 is absolutely empty by default. So you can store any data you want in this 16K memory segment.

For Example, if you want to store coordinates, you can use NBasic Function n°6 (Write a Byte to a segment)
Do like this :
x,y = the coordinate you want to save (bytes)
s= the segment where you want to save
a= the adress in the segment where you want to save first byte

(...)
90 call turbo on
95 dim p(3)
100 x=55:y=72:s=7:a=&h0
110 p(0)=s:p(1)=a:p(2)=x:e=usr(6)
115 p(1)=a+1:p(2)=y:e=usr(6)
120 call turbo off

This will store 55 at adress &h0 of segment 7 and store 72 at adress &h1 of segment 7.

To read byte from memory and, so, recover your coordinates, use Nbasic function n°2 (Read byte from a segment)

(...)
190 call turbo on
195 dim p(3)
200 s=7:a=&h0
210 p(0)=s:p(1)=a:e=usr(2):x=p(2)
215 p(1)=a+1:e=usr(2):y=p(2)
220 call turbo off

Hope this will help...

Страница 2/2
1 |