Page 10 of 11
RETROTrek - Early Development Thread
Posted: Wed Oct 14, 2020 7:00 pm
by Starsickle
1 hour ago, TomXP411 said:
When chaining programs, you have to make sure that the first program is the largest, in terms of code size. This is because BASIC locks in the beginning and end of variable memory when you RUN a program, and it does not move variables when you chain to another program.
So if you start on a program that's 12K, then load a program that's 15K, the 15K program will overwrite some of your variables.
So make sure your startup program is the largest.
RETROTREK.BAS = 40kb.
DATAINIT.BAS = 4kb.
Uhhhhhh.....
RETROTrek - Early Development Thread
Posted: Fri Oct 23, 2020 7:25 pm
by Starsickle
Yeah. I'm mystified. The main file clearly allocates more to memory in every regard than the data initialization file, so the explanation doesn't seem to fit.
No matter what the case - I need to fix this, and I don't know how. Design wise, everything important is allocated, and if the program can't even correctly execute a random string literal after going back into main fail execution? I am clueless as to what to change or how to make this work.
RETROTrek - Early Development Thread
Posted: Sat Oct 24, 2020 8:40 am
by TomXP411
Hmm... does your main program actually initialize any variables before LOADing the variable init program?
RETROTrek - Early Development Thread
Posted: Thu Oct 29, 2020 6:59 pm
by Starsickle
This is the majority of the block before the program handles its title screen input, after which it loads DATAINIT.PRG:
18 REM // DEPENDING ON GAME STATE: INIT DATA, MAIN LOOP, EXTRA, TERMINATE
29 REM //SETUP ENGINE, START GAME, MAIN LOOP, (TBD), END PROGRAM
20 IF CS%=0 THEN : CS%=1
21 ON CS% GOTO 25,1020,2000,9997,30000
22 GOTO 31110
25 REM //ENGINE SETUP AND INITIALIZATION=====================================
26 REM //NOTE: NEVER EVER OVERWRITE THESE!
27 CS%=0 : PL%=27 : REM //CONTROL STATE AND PREVIOUS LINE
28 VN$="0.0.1" : VD$="SEPTEMBER 14TH, 2020"
29 FC%=5 : BC%=0 : FI%=0 : BI%=5 : COLOR FC%, BC%
30 SX%=640 : SY%=480 : REM //SCREEN SIZE
31 DIM MSGQ$(20) : REM //OUTPUT SPAM QUEUE
32 QH=1 : QS=0 : REM //QUEUE HEAD, TAIL, AND STATUS
33 REM //===PROGRAM START=========================================
34 CLS : GOSUB 3120
35 LY%=43 : LX%=1 : GOSUB 1100
36 INPUT "PLEASE MAKE YOUR SELECTION"; MNU$
37 GT$ = MNU$
38 DEF FN FR(X)=FRE(0)-65536*(FRE(0)<0) : REM //COLLECT GARBAGE AND FREE BYTES
39 GOSUB 73 : POKE $30D,0 : POKE $30E,50 : SYS $FFF0
40 RF$ = STR$(FN FR(0))
41 PRINT FN FR(0);"BYTES FREE" : GOSUB 70
42 REM //===PROGRAM DATA ALLOCATION=================================
43 DIM GD%(10) : REM //GAME DATA - SEE README.
44 DIM RGN$(9,19,2) : REM //SPACIAL REGION - SEE README.
45 REM DIM SCTR$(9,9,2) : REM //SPACIAL SECTOR - SEE README.
46 DIM SPCS%(7,5) : REM //SPECIES LIST - SEE README.
47 REM //DIM PLANETS$(13,3) : REM //CONTAINS PLANET NAME, TYPE, IFF
48 DIM SHPS%(10,16) : DIM SID$(10,2) : REM //SHIPS LIST AND SHIP NAME AND IFF
49 NS%=0 : GD%(1)=10 : GD%(0)=0
50 SU$="GRN" : REM //SHIP STATUS
51 GA$ = "*********************************************************"
52 GB$ = "* *"
58 CS%=2
59 GOTO 1000
DATAINIT.PRG is less than 100 lines with whitespace, but both creates DATA and shoves values into the various arrays.
As reminder: check above image some posts up to see what is happening.
A good but laborious experiment is if I were to change the line numbers of the DATAINIT.PRG program to never touch any of the numbers in the main file? What would happen? Would the string literals upon execution be restored?
RETROTrek - Early Development Thread
Posted: Mon Nov 23, 2020 8:07 pm
by Starsickle
Disaster has Struck - A PSU incident has caused my Data HDD to stop responding completely, meaning it's effectively dead. A lot of recent projects since June have been busted, which means basically all of them. RetroTrek will have to be started over from Scratch, as I have lost even the Code, Design work, and Documentation.
I am currently in Crisis Response Mode, but I have no doubt I will need at least a good hug in a few days.
RETROTrek - Early Development Thread
Posted: Tue Nov 24, 2020 5:12 am
by Cyber
That's bad... I remeber one of my HDD died, and data was so valuable to me that I handed it over to data recovery service. My be you should do the same?
RETROTrek - Early Development Thread
Posted: Tue Nov 24, 2020 10:51 am
by desertfish
Shit man that sucks.
I had a (tiny) share of bad luck happen to me in the past, and since then a rsync job runs every 4 hours to backup all my stuff to a different machine at least...
RETROTrek - Early Development Thread
Posted: Tue Nov 24, 2020 1:39 pm
by Starsickle
There is some hope: I ordered a replacement PCB. An affordable waste if it doesn't work, but I believe I can do it myself.
Needless to say, despite the small preparations I've made, I'm going to be more aggressive about backing up data.
RETROTrek - Early Development Thread
Posted: Tue Nov 24, 2020 6:53 pm
by SlithyMatt
Remember, GitHub is free, and you can maintain private repos. Never depend on a single device to store your code and assets!
RETROTrek - Early Development Thread
Posted: Tue Nov 24, 2020 9:35 pm
by kliepatsch
q
@Starsickle I'm sorry to hear what happened, sucks indeed. Let us know if the HDD can ve revived.
I'd also like to backup SlithyMatt. Git (and GitHub) is a great way to manage and backup your coding work. I had to use it for my work - and I bet you, I wouldn't have done it on my own. Even the simplest things required a lot of googling - sometimes even now. But it's worth it. The whole project history gets saved and you can visit any point on the timeline. It's great. Now I use it for my hobby stuff, too.