gtBASIC

Using, learning, programming and modding the Gigatron and anything related.
Forum rules
Be nice. No drama.
wbushby
Posts: 68
Joined: 16 Jul 2021, 10:59

Re: gtBASIC

Post by wbushby »

After more economising I get this:

Memory::printFreeRamList() : 130 : 0xee00 1
Memory::printFreeRamList() : Expected 28467 : Found 28467

*******************************************************
* Assembling file : 'pirateadventure64k.gasm'
*******************************************************
Loader::saveGt1File() : total segment size:49 > 256 in segment 8
Couldn't compile ./pirateadventure64k.gt1 from pirateadventure64k.gbas : contains Native code or file system error
at67
Posts: 431
Joined: 14 May 2018, 08:29

Re: gtBASIC

Post by at67 »

Try replacing the code in loader.cpp at line 238:

Code: Select all

                bool lastSegFractured = false;
                Gt1Segment segment = {false, hiAddr, segmentsIn[0]._loAddress, uint8_t(segmentsIn[0]._dataBytes.size()), segmentsIn[0]._dataBytes};
                for(int i=0; i<int(segmentsIn.size()); i++)
                {
                    if(segment._dataBytes.size() == 0)
                    {
                        lastSegFractured = false;
                        segment._loAddress = segmentsIn[i]._loAddress;
                        segment._dataBytes = segmentsIn[i]._dataBytes;
                        segment._segmentSize = uint8_t(segmentsIn[i]._dataBytes.size());
                    }

                    if(i<int(segmentsIn.size()-1)  &&  segmentsIn[i]._loAddress + segmentsIn[i]._dataBytes.size()  ==  segmentsIn[i + 1]._loAddress)
                    {
                        segment._dataBytes.insert(segment._dataBytes.end(), segmentsIn[i + 1]._dataBytes.begin(), segmentsIn[i + 1]._dataBytes.end());

                        uint16_t segmentSize = segment._segmentSize + segmentsIn[i + 1]._segmentSize;
                        if(segmentSize > SEGMENT_SIZE)
                        {
                            fprintf(stderr, "Loader::saveGt1File() : total segment size:%d > %d in segment %d\n", segment._segmentSize, SEGMENT_SIZE, i);
                            return false;
                        }

                        segment._segmentSize += segmentsIn[i + 1]._segmentSize;
                        if(segmentSize == SEGMENT_SIZE) segment._segmentSize = 0;
                    }
                    else
                    {
                        lastSegFractured = true;
                        segmentsOut.push_back(segment);
                        segment._dataBytes.clear();
                    }
                }
                if(!lastSegFractured) segmentsOut.push_back(segment);
With this:

Code: Select all

                Gt1Segment segment = {false, hiAddr, segmentsIn[0]._loAddress, uint8_t(segmentsIn[0]._dataBytes.size()), segmentsIn[0]._dataBytes};
                for(int i=0; i<int(segmentsIn.size()); i++)
                {
                    if(segment._dataBytes.size() == 0)
                    {
                        segment._loAddress = segmentsIn[i]._loAddress;
                        segment._dataBytes = segmentsIn[i]._dataBytes;
                        segment._segmentSize = uint8_t(segmentsIn[i]._dataBytes.size());
                    }

                    if(i < int(segmentsIn.size()-1))
                    {
                        uint16_t currEnd = segmentsIn[i]._loAddress + uint16_t(segmentsIn[i]._dataBytes.size());
                        uint16_t nextStart = segmentsIn[i + 1]._loAddress;
                        uint16_t newSize = segment._segmentSize + segmentsIn[i + 1]._segmentSize;
                        if(currEnd == nextStart  &&  newSize <= SEGMENT_SIZE)
                        {
                            segment._dataBytes.insert(segment._dataBytes.end(), segmentsIn[i + 1]._dataBytes.begin(), segmentsIn[i + 1]._dataBytes.end());
                            segment._segmentSize += segmentsIn[i + 1]._segmentSize;
                        }
                        else
                        {
                            segmentsOut.push_back(segment);
                            segment._dataBytes.clear();
                        }
                    }
                    else
                    {
                        segmentsOut.push_back(segment);
                        segment._dataBytes.clear();
                    }
                }
P.S. I just edited the replacement code, so if you grabbed it earlier than this edit, then grab it again!
wbushby
Posts: 68
Joined: 16 Jul 2021, 10:59

Re: gtBASIC

Post by wbushby »

got this now
Memory::printFreeRamList() : Expected 28467 : Found 28467

*******************************************************
* Assembling file : 'pirateadventure64k.gasm'
*******************************************************

Loader::printGt1Stats() : Page overflow : segment 86 : address 0xf031 : segmentSize 208

That adds to 257. 1 too many
at67
Posts: 431
Joined: 14 May 2018, 08:29

Re: gtBASIC

Post by at67 »

Can you email me the code, it's pretty hard to debug this way.
at67
Posts: 431
Joined: 14 May 2018, 08:29

Re: gtBASIC

Post by at67 »

Try replacing the same section of code with this:

Code: Select all

                Gt1Segment segment = {false, hiAddr, segmentsIn[0]._loAddress, uint8_t(segmentsIn[0]._dataBytes.size()), segmentsIn[0]._dataBytes};
                for(int i=0; i<int(segmentsIn.size()); i++)
                {
                    if(segment._dataBytes.size() == 0)
                    {
                        segment._loAddress = segmentsIn[i]._loAddress;
                        segment._dataBytes = segmentsIn[i]._dataBytes;
                        segment._segmentSize = uint8_t(segmentsIn[i]._dataBytes.size());
                    }

                    if(i < int(segmentsIn.size()-1))
                    {
                        uint16_t page = MAKE_ADDR(hiAddr, 0x00);
                        uint16_t currEnd = segmentsIn[i]._loAddress + uint16_t(segmentsIn[i]._dataBytes.size());
                        uint16_t nextStart = segmentsIn[i + 1]._loAddress;
                        uint16_t newSize = segment._segmentSize + segmentsIn[i + 1]._segmentSize - 1;
                        //fprintf(stderr, "0x%04x 0x%04x 0x%04x 0x%04x %d 0x%02x 0x%02x\n", page, currEnd, nextStart, newSize, newSize, HI_BYTE(page + newSize), HI_BYTE(page));
                        if(currEnd == nextStart  &&  HI_BYTE(page + newSize) == HI_BYTE(page))
                        {
                            segment._dataBytes.insert(segment._dataBytes.end(), segmentsIn[i + 1]._dataBytes.begin(), segmentsIn[i + 1]._dataBytes.end());
                            segment._segmentSize += segmentsIn[i + 1]._segmentSize;
                        }
                        else
                        {
                            segmentsOut.push_back(segment);
                            segment._dataBytes.clear();
                        }
                    }
                    else
                    {
                        segmentsOut.push_back(segment);
                        segment._dataBytes.clear();
                    }
                }
Last edited by at67 on 03 Nov 2021, 22:04, edited 1 time in total.
wbushby
Posts: 68
Joined: 16 Jul 2021, 10:59

Re: gtBASIC

Post by wbushby »

same result
Loader::printGt1Stats() : Page overflow : segment 86 : address 0xf031 : segmentSize 208

C:\RetroComputors\Gigatron\Programming\Pirates>
at67
Posts: 431
Joined: 14 May 2018, 08:29

Re: gtBASIC

Post by at67 »

Your code compiles fine on my end with the above new changes to loader.cpp.

If you can't get past this error, then you can disable the merging of sub segments within pages by changing loader.cpp:217 from:

Code: Select all

#if 1
To:

Code: Select all

#if 0
I didn't have to do this though.

P.S. Disabling the merge of sub segments makes the build process slightly slower and the resultant .gt1 file slightly bigger, (so no big deal for now).
wbushby
Posts: 68
Joined: 16 Jul 2021, 10:59

Re: gtBASIC

Post by wbushby »

I am getting the same error after the change above. something weird here. I verified I am using the updated executable.

There is something I am doing wrong

Can you send me a current copy of loader.cpp ?
at67
Posts: 431
Joined: 14 May 2018, 08:29

Re: gtBASIC

Post by at67 »

My loader is substantially different to yours, as the entire codebase has changed significantly over the last year; for you to be able to even compile it you would need all of the rest of the source and I am not yet ready to release it, (there's just too many potential bugs, unknowns and unfinished features that would probably make your life and mine miserable), sorry.

I've triple checked the loader code I posted in both ROMv5a and ROMvX0 and your code compiles fine and exactly the same for both ROM's, (in terms of functionality).

I'll do my best to release the full source code over the next few weeks, but I have so much on my plate I can't make any promises.
wbushby
Posts: 68
Joined: 16 Jul 2021, 10:59

Re: gtBASIC

Post by wbushby »

don't worry about it. i can continue to code without debugging anyway
Post Reply