fuedhq
|
|
« Reply #64 on: February 12, 2021, 04:34:30 PM » |
|
More like dealing with the constrains of the target system, the TRS-80 Color Computer (COCO). BASIC is the only language I can work with. I think I let the game idea fly too high without thinking better about the memory use. But now I refuse to bring the idea down. Time to learn to deal with disks on the COCO. Remember I was working with Extended Color Basic(ECB)? Now I will have to use Disk Extended Color Basic(DECB). That means the graphic performance solution I´m using will need to be tweaked, since it does not work on the later. Probably foreseeing it back on the project start, Erik Gavriluk and Simon Jonassen both shared code to fix that front, so I should be good to go as soon as I add that. My current code pipeline uses Atom IDE and Xroar emulator, code is loaded by the emulator simulating a k7 tape out of an ASCii file from the IDE. Since I will be using disks instead of k7, how to do so? With the marvelous tool RSDOS, by Sheldon MacDonald. It is a quite complex disk tool a pro can examine tracks and whatnot, stuff way above my knowledge, but for the little I need, pushing code from my IDE into a disk image to be loaded by the emulator, it works perfectly and is very simple. Here is an introduction video by the author: One can even edit the basic code directly in it! Super! Keep in mind it is a work in progress. If you are interested on it, you can download it from here: http://www.smotion3d.net/downloads/rsdoswin.zipSheldon keeps an FTP with his tools, you may examine it here: www.smotion3d.netStill, going through this process every time I want to test a code means a lot of clicking and waiting. My current k7 loading means I just hit ctrl-s on the IDE, click on the emulator, hit ctrl-l, load the file, type CLOAD and RUN. It is fast enough, but as the game progresses, I will eventually be needing to test it through disk, so all is fine here. Let's get back to the memory dilemma and how the disk stuff may solve it. Thinking about that MERGE command on the Dragon, here is what I thought. My code structure is very linear and modular, so enemies and stages are well set apart. I could load the game containing the first stage. If one advances, the code loads the second stage over the first stage and resumes from there. So with such stuff, I won't be limited to ~25kb for the full game but be free to load in eternal amounts of 25kb code. To be a bit more technical, I´m not loading data as with loading a picture, I want to merge code, load in new logic. The prior code is kept, if the new one shares the same line number, it should overwrite, if not, add to code, and if the new line number is blank, it should delete the original one. I would expect the code to resume after that as if nothing happened. Someone told me that Disk Extended Color Basic has a MERGE command that may just do that. It does merge the code as I wanted but I got kicked out of the program back to the BASIC prompt. Erik Gavriluk then said: Someone mentioned the merge command but forgot the ",R" which means "run after merge" MERGE file,R Merge a program and start it running Try: MERGE "LEVEL.BAS",RAnd so I did, but by running after merge, it started from the code beginning, it did not resume. Also, run clears all variables... So what about keeping some variables through? I may not need many. Here is what Richard Kelly said: You might just have your variables put into the cassette buffer instead. First POKE474,A:POKE475,B:POKE476,C then in the second program have A=PEEK(474):B=PEEK(475):C=PEEK(476). I did something similar with my maze-making algorithm.That, while a bit complex to me, sounded like a great idea! Now that the game is going on disks, it should be fine. Justin Poirier also proposed a way using OPEN, LINEINPUT and CLOSE. Other friends also had different solutions. But here I thought, do I really need to push variables forward? If so, which ones and why? Well, stage number might be one, but thinking deeper about it, it is quite a static one and the merged stage can have it hardcoded on a sort of head line, so that one is fine. This game has no score, so the troublesome one might be player´s energy. I may want to keep its value as one advances through enemies. But wait, is it really needed? Maybe within a stage, but not through the whole game. I'm not going to have pickups to increase it, mostly maybe increase it a little every time you beat an enemy, like in King of Fighters, but even then, when you change stages, you get everything back up again, same stuff as in Street Fighter or even the brawlers when a stage is done. So for now, I will go along without it. With that partially resolved, time to give it a test. This is what the main program looks like: 10 GOTO 100 20 PRINT"A="A" B="B" ANY KEY TO MERGE":EXEC44539 30 MERGE"MRGTP1",R
100 B=10:A=1:GOTO 20
200 DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 210 DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 280 DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 290 DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 So the main code is made by lines 10 to 30. Line 10 shoots the code to line 100, which is the head line on the data code, and then it shoots back to the main code at 20, prints variables A and B, waits for a key press and then do the merge. Here is the code to be merged: 100 A=2:GOTO 20
200 DATA 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 210 DATA 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 280 DATA 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 290 DATA 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 This code has only the head line and dummy datas, head line sets variable A to a different value but does not touch B. After running this code, this is what I get: As we can see, A comes out as 2, think of that as the stage variable. B comes out as 0, it was not kept after the run command, got reset from 10 to 0. Seems to work! But there is more... I remade this test with both files having dummy data taking almost the full 22823 bytes available each. Here is a more detailed outcome: Loaded the core code and after running and immediately braking the code, memory left was 111 bytes. Loading it took about 22 seconds. Hitting a key to get to the merge part, it look about 110 seconds to do so. after such, memory left was 123 bytes. Results: Memory monster seems tamed, disk system seems under control, but what is with that almost 2 minutes to load 22k? I probably won't need to load that much but that is a long time for a player to wait! If I load/merge 10k, then I should be expecting it to take a minute, quite too much. I will need to take a closer look into it.
|
|
« Last Edit: February 12, 2021, 07:50:13 PM by fuedhq »
|
Logged
|
|
|
|