![]() |
Game is crashing due to out of memory (48k) (*solved*) - Printable Version +- Forum (https://www.boriel.com/forum) +-- Forum: Compilers and Computer Languages (https://www.boriel.com/forum/forumdisplay.php?fid=12) +--- Forum: ZX Basic Compiler (https://www.boriel.com/forum/forumdisplay.php?fid=11) +---- Forum: Bug Reports (https://www.boriel.com/forum/forumdisplay.php?fid=15) +---- Thread: Game is crashing due to out of memory (48k) (*solved*) (/showthread.php?tid=1090) |
Game is crashing due to out of memory (48k) (*solved*) - RandomiserUsr - 04-25-2021 Hi I am writing a text adventure game (simply for my own fun) rather than use the other systems out there e.g. PAW Infocom, DAAD, TADS, Aventuron etc... I wanted the challenge in writing one for the ZX Spectrum . :-) The biggest issue I had was the amount of Text that needed storing. At first I was going to use some sort of compression but couldn't get it work so I created a tokenised dictionary that turned string arrays (Locations, Objects, Examination results etc...) to numeric arrays thus the memory was reduced quite a bit. So I thought this would suffice but I soon ran out of memory. I then attempted to look into the text compression again and then worked out how to do this, but due to the size of the dictionary which was needed still it crashed when there was a decompression of the location file. I also attempted to use +3 Disk but whilst I was able to a) load a picture b) load a text it crashed subsequent attempts. (Memory clash perhaps)? So I am here looking for some hints/tips on the options I have. I do have another plan though where I will try to rewrite it but this time start using text compression from the start.... we will see ... but the main thing for me is Thanks to Boriel bringing the ZXB to use and Einar Saukas for their both their support :-) RE: Game is crashing due to out of memory (48k) - RandomiserUsr - 04-26-2021 UPDATE: I have now moved all the .BAS files that originally segregated into modules into one file and now the ZX0 compression routines are working. A new Out of memory is now being displayed but I am not sure why? Compiling with the following (Not the big heap) --tzx --BASIC --autorun --heap=4800 --optimize 3 --org=25000 --debug-memory --debug-array Putting an output of the memory just before the line that causes it i.e. EX$(AVL) = ExitsDesc(LOC) mem avl 3515 mem MaxAvl 1571 and you can see there is plenty of available memory. I am decompressing to 62000 (F230) so it is out of the way Next the memory map. Below you can see the program starts at 25,000 (61A8) and ends at 59,402 Quote:61A8: .core.__START_PROGRAM So I am not sure how/why it running out of memory. Could the out of memory error be a false message, could it be a memory address clash? Any tips would be useful. Thank you in advance. UPDATE - SOLVED : Okay I found out the issue ! DIM MSG1 as UBYTE = 0 DIM MSG2 as UBYTE = 1 DIM MSG3 as UBYTE = 2 DIM A$(10) A$(MSG1) = "Msg 1 on page 1" A$(MSG2) = "Msg 2 on page 1" A$(MSG3) = "Msg 2 on page 1" So changing it to this works A$(1) = "Msg 1 on page 1" A$(2) = "Msg 2 on page 1" A$(3) = "Msg 3 on page 1" The above is only an example but still shows the error which is actually correct. To be exact the compiler should complain about DIM A$(MSG1) is not valid instead it compiles then gives the out of memory message. :-) Thanks RE: Game is crashing due to out of memory (48k) - boriel - 04-27-2021 (04-26-2021, 05:48 PM)RandomiserUsr Wrote: UPDATE: This is weird. A$(0) should also work, because you're not using --array-base=1, so arrays start at 0. ![]() We should investigate this further. If you can elaborate a tiny example that reproduces the bug, please, let me know. RE: Game is crashing due to out of memory (48k) - RandomiserUsr - 04-27-2021 Hi I don't believe the issue is to do with arrays at 0 but the fact I am using a variable to reference index 0. The below example shows starting at 1 produces the same "out of memory" see below :- DIM MSG1 as UBYTE = 1 DIM MSG2 as UBYTE = 2 DIM MSG3 as UBYTE = 3 DIM A$(10) A$(MSG1) = "Msg 1 on page 1" A$(MSG2) = "Msg 2 on page 1" A$(MSG3) = "Msg 2 on page 1" print A$(1) print A$(2) print A$(3) Thanks RE: Game is crashing due to out of memory (48k) - RandomiserUsr - 04-28-2021 I am using zxbc.py 1.15.0-beta20 If this helps? I do think this was working at some point though RE: Game is crashing due to out of memory (48k) - boriel - 04-29-2021 (04-28-2021, 06:11 PM)RandomiserUsr Wrote: I am using That's right. This worked in 1.14.1. It's a regression (bug). I'll fix it. Sorry for the inconvenience. RE: Game is crashing due to out of memory (48k) - RandomiserUsr - 05-02-2021 great and no inconvenience at all just thankful for the tool - let us know what version it is in :-) Is there list of up and coming features for ZXB ? thanks RE: Game is crashing due to out of memory (48k) - boriel - 05-06-2021 (05-02-2021, 11:24 AM)RandomiserUsr Wrote: great and no inconvenience at all just thankful for the tool - let us know what version it is in :-) Please, try this version and tell me if it works ![]() http://www.boriel.com/files/zxb/zxbasic-1.15.0-beta26.tar.gz http://www.boriel.com/files/zxb/zxbasic-1.15.0-beta26.zip http://www.boriel.com/files/zxb/zxbasic-1.15.0-beta26-win32.zip http://www.boriel.com/files/zxb/zxbasic-1.15.0-beta26-linux64.tar.gz http://www.boriel.com/files/zxb/zxbasic-1.15.0-beta26-macos.tar.gz RE: Game is crashing due to out of memory (48k) - RandomiserUsr - 05-07-2021 (05-06-2021, 10:46 PM)boriel Wrote:(05-02-2021, 11:24 AM)RandomiserUsr Wrote: great and no inconvenience at all just thankful for the tool - let us know what version it is in :-) Yes this fixes the issue ! :-) Is there list of up and coming features for ZXB ? RE: Game is crashing due to out of memory (48k) - boriel - 05-08-2021 (05-07-2021, 04:24 PM)RandomiserUsr Wrote:(05-06-2021, 10:46 PM)boriel Wrote:(05-02-2021, 11:24 AM)RandomiserUsr Wrote: great and no inconvenience at all just thankful for the tool - let us know what version it is in :-) I will publish them in the Changelog.md file when released (you can also have a look at the github log but it might be a bit confusing...). The most important up to the moment are: - Better code generation (faster and smaller, and still more to come) - Fixes many bugs (ok, this one included, but this was a bug introduced due to this big change) - Variables can now have '_' character. So _a_variable is allowed. Also _ or __. - Config files. You can save your options in config file and load them (i.e. project.ini by default). See --save-config in the help I still need some extra time to finish some implementations, and that's all. RE: Game is crashing due to out of memory (48k) - RandomiserUsr - 05-08-2021 (05-08-2021, 06:48 AM)boriel Wrote:thanks for the above information :-) I am fine with github/lab logs so will check them out(05-07-2021, 04:24 PM)RandomiserUsr Wrote:(05-06-2021, 10:46 PM)boriel Wrote:(05-02-2021, 11:24 AM)RandomiserUsr Wrote: great and no inconvenience at all just thankful for the tool - let us know what version it is in :-) Thank you for continuing this brilliant project that brings joy to a lot of people |