Alice 2020-11-11 09:07 (Edited)
I do have many DIM statements...however...most are DIM var(x,1) or var$(x,1). Small dimensions. Am I missing something? Building a text-based adventure RPG. No data loaded...
Help if possible.
I can group the all the DIM var(x,1) into a var(x,y) and have notes on the different addresses if I have to...but theoretically it shouldn’t save any room...unless LowRes reserves space for DIMs before they are loaded.
Timo 2020-11-11 11:07
In LowRes NX v1.1 the limits are 256 simple variables and 256 arrays. If you have recursive subprograms, then each call will count.
Actually I didn't think anyone would reach that limit...
Timo 2020-11-11 12:14
...and some more limits:
Alice 2020-11-11 12:39
Thanks Timo...saw that somewhere. The game has an action for each key. The numerous variables were because each “action” had coding and things to do based on the type of entity it was handling...so it adds up quickly if you want to have a descriptive array name for each “variable”. Each entity has it’s set of programmable actions to create the game so it makes for a very flexible structure. The only real thing in the game loop is handling the entity interaction with the “action” the player selects. Code is triggered by the entities” set-up. The story is contained in the entities.
If you have any info on saving a game state (other than poking the memory)...that would be great! If not I imagine I can peek/poke unused memory with long strings that I can encode/decode. Doesn’t seem to be any issues handling very long strings.
Alice 2020-11-11 12:47 (Edited)
Just a clarification on the array size...4th root of 32768?...13 per index? (Or other combination)...for a 4d
Or 32768 (k)bytes of data?....or dim var(32768,32768,32768,32768)? (Lol...unlikely)
rilden 2020-11-11 14:44
A(3) has 4 elements: A(0), A(1), A(2), A(3)
In general A(N) has N+1 elements
A(1,2) has 6 elements: A(0,0), A(0,1), A(0,2), A(1,0), A(1,1), A(1,2)
In general A(M,N) has (M+1)*(N+1) elements
For a 4 dimensional array A(M,N,O,P) the number of elements is (M+1)*(N+1)*(O+1)*(P+1)
A(12,12,12,13) has a size of 13*13*13*14=30758
A(12,12,13,13) has a size of 13*13*14*14=33124
You can have array indexes greater than 13:
A(100,20,3,2) has a size of 101*21*4*3=25452
Timo 2020-11-11 14:49
Yes, 32768 items in total for an array.
Alice 2020-11-13 05:01
Just filled a 32768 item string array with 1,000,000 character length strings in each cell Without errors....that’s 32,768M characters.
Please check...this will resolve storage issues if you use string manipulation functions to access values.
Alice 2020-11-13 05:59
How long can a string be?....
‘B$ is a 100,000 character string made in a previous loop.
And still going...adding 100k characters
Prints 1.72E+07 for LEN(A$)
Timo 2020-11-13 07:59 (Edited)
Strings are internally C strings (null terminated) and don’t have a length limit.
In general the BASIC interpreter is not limited by the simulated hardware, but runs beside. It has its own limits though. Some of them were chosen on purpose (tokens) and others are just there, because the system is programmed in C without dynamic array sizes.
Alice 2020-11-13 08:07
Works for me...thanks.
Alice 2020-11-13 08:11 (Edited)
On the same train of thought...if we peek/poke other memory addresses (listed below)...do they stick or are they just registered when the program is loaded?
(Yes...I understand they technically wouldn’t be able to be written to as they are simulating chips...but this is a virtual system so I’m trying my luck here, lol)
$0000 - Cartridge ROM (32 KB)
$8000 - Character Data (4 KB)
$9000 - BG0 Data (2 KB)
$9800 - BG1 Data (2 KB)
...I believe they are cleared...just loaded from the program for use since they are generated from the listing. Might be wrong, but pretty sure.
Timo 2020-11-13 09:13
You can PEEK everywhere (inside the 64 kB address space) but you can only POKE into the last 32 kB (RAM and chips). You can actually modify graphics, sound etc. just by poking.
Alice 2020-11-13 09:17
Agreed...but is it persistent?...pretty sure it’s all loaded from the listing (bottom for sound, graphics, bgs)
Alice 2020-11-13 09:22
(Unrelated to persistent) I’m planning on making a smaller font for my game 4x6 so the text will need to be loaded directly to avoid the wide spacing of the default font. Poke everything to the BG in a custom print statement. Bold with a binary multiplier and overlap with an add/multiply. Can’t use the default because the characters can’t overlap because they are restricted to the cell spacing.
Timo 2020-11-13 09:35 (Edited)
At program start the default characters (ROM #2) and palettes (ROM #1) are copied to the video RAM, but then you can modify the RAM as you wish.
In LowRes NX the word "persistent" is used for data which stays even after exiting the program. It's actually saved on disk and loaded automatically after restart. All other memory can be used to read and write as expected, but it gets lots when you exit the program.
About 4x6 fonts, there are two ways of doing this:
By using both BGs and squeeze the raster lines. I made an example here: https://lowresnx.inutilis.com/topic.php?id=54
Or by implementing a pixel buffer (LowRes NX is based on tiles/cells). It's tricky, because there are not enough characters to fill the whole screen, but some people managed to do so anyway: https://lowresnx.inutilis.com/topic.php?id=1501
Alice 2020-11-13 10:11
Great idea on the use of two backgrounds and raster lines. Pretty slick. I like the “Don’t do it” at the end...lol.
Not sure the “pixel buffer method” is worth the trouble.
I already have a modified print statement that takes care of correct line breaks on long strings and also handles reaching the end of a screen with a continue (so I can just use one long string and not worry about it). I just send all the prints to the new sub.
I think I’ll just get the numbering for the binary values I need for the letters and poke them to the BG, just a multiplier on the first of the two letter combination, and add the second letter. Then I can handle the color and stuff directly if I need to instead of using the pallets. Seems easier and more intuitive for me. I can just make my letters and call them to print at specific locations. That will fit in with my modified print command I already have that tracks position...I’ll just half the width and add a vertical counter.
Your font is very similar to mine on the first example...very nice. (WHM...ugly characters...lol)