Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
128K SPECTRUM COMPATIBILITY...
#16
Then we might have to add some new syntax sugar like:
Code:
SUB dada(param) AT 26000

END SUB
:?:
Reply
#17
Hmm.

I think that's too specific - and has issues of overrun. I could have one routine at a low address that's too long, and a second routine at a higher address that then backs down and overwrites the lower one. That would be hell to diagnose!

I'm fairly Okay with zxb managing the very specific bits of memory - I just want to say "this bit goes in this zone" - and the compiler to tell me if it gets too big to fit in there...

What did you think about my bank directive idea earlier in this thread? Doesn't have to be 128K yet to start on that path. Could just cover three 48K bank areas.
Reply
#18
Another strategy could be:
  • Work with 16Kb segments
  • One of them for the main() program
  • Other for the heap
  • Other two for functions
  • Another one for data (music, graphics)
Any of them must no go out of its segment/bank (the compiler could warn about this).
An alternative syntax:
Code:
REM Stay in BANK #4
#pragma bank 4
The compiler could try to put your code in that segment, and warns if it gets out of it. You could use #pragma bank N to specify which bank should the code/data/dim/asm should go. :?:
Reply
#19
How about defining which Bank and which addresser can be used fpr specific data at the beginn of compiled code, as compiler directives?

Code:
#BANK 4,49152,1000 FOR HEAP
#BANK 4,50152,15384 FOR FUNCTION
#BANK 1,49152 FOR graphicsdata
#BANK nr, startaddress[, size] FOR Functiontype/Label
------------------------------------------------------------
http://lcd-one.da.ru redirector is dead
Visit my http://members.inode.at/838331/index.html home page!
Reply
#20
I am totally stuck with that same issue. I was trying to maintain all code below the 0xC000 so I could use the 4rth bank and the other 4 extra ones to have compressed data there, but even if I use ORG 25000 or whatever it doesn't work and I got totally unexpected results. It is possible, also, to use the non-screen informartion (above the 6912) from the screen bank for data?

I know I am resurrecting a 5 year old topic, so... Any new options nowadays?

Also, I still don't have a clue if it is possible to play AY music with ZXBasic...
Reply
#21
That should work. The problem might be the HEAP. Perhaps using --heap-size option will help: by default ZX BASIC will use all remaining memory for the HEAP (which is used mostly for string management at this moment).

Try compiling with --heap-size=200 (use only 200 bytes for heap)

More info at https://zxbasic.readthedocs.io/en/docs/z...ne_Options
Reply
#22
LCD Wrote:How about defining which Bank and which addresser can be used fpr specific data at the beginn of compiled code, as compiler directives?

Code:
#BANK 4,49152,1000 FOR HEAP
#BANK 4,50152,15384 FOR FUNCTION
#BANK 1,49152 FOR graphicsdata
#BANK nr, startaddress[, size] FOR Functiontype/Label

That's what I was thinking for (or something similar).
Reply
#23
Well, at the end I managed (reading the documentation) to make the code start at 24200 with the -ORG command when compiling, then when I load the data that I want to be starting at 0xC000 i put the asm org 0xC000 and at the end of this loading stuff code I return with another ORG command to the memory adress the code wat before that moment (checking memory.txt and recompiling) so I finally managed to keep everything under 0xC000 except the specific data I want. I haven't tried bank changing yet, but I think that is a good start!
Also, the problem was the heap, that was overlaping some data from 0xC000; I changed ir to 1024 because now that I start the program at 24200 I have enough space, but in fact, I have no idea what is the heap for. Something related to strings? Cause all the text I show on the game is printed char by char, reading from memory, no strings. Do I nead a heap at all? What is the minimmum or recomendable size?

Also, about printing chars each by each... Is there a faster alternative to print available?

Thanks and sorry for spreading many topics around!
Reply
#24
Cesc Wrote:Well, at the end I managed (reading the documentation) to make the code start at 24200 with the -ORG command when compiling, then when I load the data that I want to be starting at 0xC000 i put the asm org 0xC000 and at the end of this loading stuff code I return with another ORG command to the memory adress the code wat before that moment (checking memory.txt and recompiling) so I finally managed to keep everything under 0xC000 except the specific data I want. I haven't tried bank changing yet, but I think that is a good start!
Also, the problem was the heap, that was overlaping some data from 0xC000; I changed ir to 1024 because now that I start the program at 24200 I have enough space, but in fact, I have no idea what is the heap for. Something related to strings? Cause all the text I show on the game is printed char by char, reading from memory, no strings. Do I nead a heap at all? What is the minimmum or recomendable size?

Also, about printing chars each by each... Is there a faster alternative to print available?

Thanks and sorry for spreading many topics around!
As answered above, it's for managing strings (i.e. a$ = b$ + c$). If you use PRINT "A" you might not need it. But if you use a$ = "XXX": PRINT a$ you will.
For small strings, like in your case, a 256 bytes heap is more than enough.
Reply
#25
Cesc Wrote:Well, at the end I managed (reading the documentation) to make the code start at 24200 with the -ORG command when compiling, then when I load the data that I want to be starting at 0xC000 i put the asm org 0xC000 and at the end of this loading stuff code I return with another ORG command to the memory adress the code wat before that moment (checking memory.txt and recompiling) so I finally managed to keep everything under 0xC000 except the specific data I want. I haven't tried bank changing yet, but I think that is a good start!
Also, the problem was the heap, that was overlaping some data from 0xC000; I changed ir to 1024 because now that I start the program at 24200 I have enough space, but in fact, I have no idea what is the heap for. Something related to strings? Cause all the text I show on the game is printed char by char, reading from memory, no strings. Do I nead a heap at all? What is the minimmum or recomendable size?

Also, about printing chars each by each... Is there a faster alternative to print available?

Thanks and sorry for spreading many topics around!

Are any of the routines in the library helpful? What are you trying to achieve?

https://zxbasic.readthedocs.io/en/docs/library/
Reply
#26
britlion Wrote:Any chance that memory management will be included?

We can't even carve off contended / uncontended space right now.

E.g. this doesn't work:

Code:
asm
org 26000
end asm

print "hello"

asm
org 32768
end asm

print "world"
...
Just for the record, this is already supported in the upcoming 1.8.10. I'm (slowly) hearing towards 128K memory support without breaking compatibility.
Reply
#27
britlion Wrote:Are any of the routines in the library helpful? What are you trying to achieve?

https://zxbasic.readthedocs.io/en/docs/library/

I was trying to have more space available for my code, basically. I didn't had the time to test enough stuff yet, but I will start back soon. Probably gonna move to worldspectrum forums as you suggested Smile
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)