gtBASIC
Forum rules
Be nice. No drama.
Be nice. No drama.
Re: gtBASIC
I made it work by defining the array very early in the program.
I had to define the largest arrays first then work down to the smallest
now I have an issue with data statements:
DATA 0, 0, 0, 0, 0, 0, "", 0, 0, 0, 0, 0, 0, "APARTMENT IN LONDON"
DATA 0, 0, 0, 0, 0, 1, "ALCOVE", 0, 0, 4, 2, 0, 0, "SECRET PASSAGEWAY"
DATA 0, 0, 0, 3, 0, 0, "MUSTY ATTIC"
DATA 0, 0, 0, 0, 0, 0, "*I'M OUTSIDE AN OPEN WINDOW ON A LEDGE ON THE SIDE OF A VERY TALL BUILDING"
DATA 0, 0, 8, 0, 0, 0, "SANDY BEACH ON A TROPICAL ISLE", 0, 12, 13, 14, 0, 11, "MAZE OF CAVES"
DATA 0, 0, 14, 6, 0, 0, "MEADOW", 0, 0, 0, 8, 0, 0, "GRASS SHACK"
DATA 10, 24, 10, 10, 0, 0, "*I'M IN THE OCEAN", 0, 0, 0, 0, 7, "PIT"
DATA 7, 0, 14, 13, 0, 0, "MAZE OF CAVES", 7, 14, 12, 19, 0, 0, "MAZE OF CAVES"
DATA 0, 0, 0, 8, 0, 0, "*I'M AT THE FOOT OF A CAVE RIDDEN HILL. A PATH LEADS TO THE TOP"
DATA 17, 0, 0, 0, 0, 0, "TOOL SHED", 0, 0, 17, 0, 0, 0, "LONG HALLWAY"
DATA 0, 0, 0, 1, 6, 0, 0, "LARGE CAVERN"
DATA 0, 0, 0, 0, 0, "*I'M ON TOP OF A HILL. BELOW IS PIRATES ISLAND. ACROSS THE SEA OFF IN THE DISTANCE I SEE *TREASURE* ISLAND"
DATA 0, 14, 14, 13, 0, 0, "MAZE OF CAVES", 0, 0, 0, 0, 0, 0, "*I'M ABOARD PIRATE SHIP ANCHORED OFF SHORE"
DATA 0, 0, 0, 0, 0, 0, "*I'M ABOARD PIRATE SHIP ANCHORED OFF SHORE", 0, 22, 0, 0, 0, 0, "*I'M ON THE BEACH AT TREASURE ISLAND"
DATA 21, 0, 23, 0, 0, 0, "SPOOKY OLD GRAVEYARD FILLED WITH PILES OF EMPTY AND BROKEN RUM BOTTLES"
DATA 0, 0, 0, 22, 0, 0, "LARGE BARREN FIELD", 10, 6, 6, 6, 0, 0, "SHALLOW LAGOON. TO THE NORTH IS THE OCEAN"
DATA 0, 0, 0, 23, 0, 0, "SACKED AND DESERTED MONASTARY", 0, 0, 0, 0, 0, 0, ""
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, ""
DATA 0, 0, 0, 0, 0, 0, "", 0, 0, 0, 0, 0, 0, "", 0, 0, 0, 0, 0, 0, "*WELCOME TO NEVER NEVER LAND"
Gives error:
*******************************************************
* Linking
*******************************************************
* Name : Address : Size
*******************************************************
Memory::getFreeRAM() : No free RAM found of size 488 bytes
Compiler::outputDATA() : not enough RAM for data LUT of size 488
I had to define the largest arrays first then work down to the smallest
now I have an issue with data statements:
DATA 0, 0, 0, 0, 0, 0, "", 0, 0, 0, 0, 0, 0, "APARTMENT IN LONDON"
DATA 0, 0, 0, 0, 0, 1, "ALCOVE", 0, 0, 4, 2, 0, 0, "SECRET PASSAGEWAY"
DATA 0, 0, 0, 3, 0, 0, "MUSTY ATTIC"
DATA 0, 0, 0, 0, 0, 0, "*I'M OUTSIDE AN OPEN WINDOW ON A LEDGE ON THE SIDE OF A VERY TALL BUILDING"
DATA 0, 0, 8, 0, 0, 0, "SANDY BEACH ON A TROPICAL ISLE", 0, 12, 13, 14, 0, 11, "MAZE OF CAVES"
DATA 0, 0, 14, 6, 0, 0, "MEADOW", 0, 0, 0, 8, 0, 0, "GRASS SHACK"
DATA 10, 24, 10, 10, 0, 0, "*I'M IN THE OCEAN", 0, 0, 0, 0, 7, "PIT"
DATA 7, 0, 14, 13, 0, 0, "MAZE OF CAVES", 7, 14, 12, 19, 0, 0, "MAZE OF CAVES"
DATA 0, 0, 0, 8, 0, 0, "*I'M AT THE FOOT OF A CAVE RIDDEN HILL. A PATH LEADS TO THE TOP"
DATA 17, 0, 0, 0, 0, 0, "TOOL SHED", 0, 0, 17, 0, 0, 0, "LONG HALLWAY"
DATA 0, 0, 0, 1, 6, 0, 0, "LARGE CAVERN"
DATA 0, 0, 0, 0, 0, "*I'M ON TOP OF A HILL. BELOW IS PIRATES ISLAND. ACROSS THE SEA OFF IN THE DISTANCE I SEE *TREASURE* ISLAND"
DATA 0, 14, 14, 13, 0, 0, "MAZE OF CAVES", 0, 0, 0, 0, 0, 0, "*I'M ABOARD PIRATE SHIP ANCHORED OFF SHORE"
DATA 0, 0, 0, 0, 0, 0, "*I'M ABOARD PIRATE SHIP ANCHORED OFF SHORE", 0, 22, 0, 0, 0, 0, "*I'M ON THE BEACH AT TREASURE ISLAND"
DATA 21, 0, 23, 0, 0, 0, "SPOOKY OLD GRAVEYARD FILLED WITH PILES OF EMPTY AND BROKEN RUM BOTTLES"
DATA 0, 0, 0, 22, 0, 0, "LARGE BARREN FIELD", 10, 6, 6, 6, 0, 0, "SHALLOW LAGOON. TO THE NORTH IS THE OCEAN"
DATA 0, 0, 0, 23, 0, 0, "SACKED AND DESERTED MONASTARY", 0, 0, 0, 0, 0, 0, ""
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, ""
DATA 0, 0, 0, 0, 0, 0, "", 0, 0, 0, 0, 0, 0, "", 0, 0, 0, 0, 0, 0, "*WELCOME TO NEVER NEVER LAND"
Gives error:
*******************************************************
* Linking
*******************************************************
* Name : Address : Size
*******************************************************
Memory::getFreeRAM() : No free RAM found of size 488 bytes
Compiler::outputDATA() : not enough RAM for data LUT of size 488
Re: gtBASIC
I changed the program structure to exclude the data statements and it is working ok now
Re: gtBASIC
gtBASIC gives you complete control over the memory map it creates and this is how you do it, prioritise your memory allocations by order and always define them early for best results!
The DATA statement is purely there for compatibility reasons, it's a horribly inefficient command as it requires two times the memory as equivalent DIM or DEF statements, in hindsight I shouldn't have implemented it; and in your case forces the strings to be variable strings, (which requires each string to be 96 bytes in length even if they are only read only strings of a few bytes in length). Using constant strings or a constant array of strings will require much less memory.
Re: gtBASIC
What is the operator for an exponential ?
I am trying to port this code:
X% = 2^LL+.5
I am trying to port this code:
X% = 2^LL+.5
Re: gtBASIC
It's **, caution it will overflow the default signed 16bit int very quickly. Integer only obviously.
Re: gtBASIC
I am getting a strange message at the end of the assembly. I can't see the cause.
*****************************************************
* Assembling file : 'pirateadventure64k.gasm'
*******************************************************
Assembler::assemble() : 'pirateadventure64k.gasm:3352' : missing operand/s ' HALT '
*****************************************************
* Assembling file : 'pirateadventure64k.gasm'
*******************************************************
Assembler::assemble() : 'pirateadventure64k.gasm:3352' : missing operand/s ' HALT '
Re: gtBASIC
You'll have to send me the code, it looks like you have found another bug, a quick test you can try is to remove the offending 'END' statement. 'END' statements are compiled into 'HALT' vCPU assembly code, (which is really a never ending SYS call).
If you have multiple END statements, try replacing them with goto's as a quick hack and have them all execute to a label with one common END.
P.S. You could also try modifying 'assembler.cpp', original code at line 2599 is:
Replace it with:
If you have multiple END statements, try replacing them with goto's as a quick hack and have them all execute to a label with one common END.
P.S. You could also try modifying 'assembler.cpp', original code at line 2599 is:
Code: Select all
// Native NOP
if(opcodeType == Native && opcode0 == 0x02)
{
operandValid = true;
}
// Missing operand
else if((outputSize == TwoBytes || outputSize == ThreeBytes) && int(tokens.size()) <= tokenIndex)
{
fprintf(stderr, "Assembler::assemble() : '%s:%d' : missing operand/s '%s'\n", filename.c_str(), _lineNumber+1, lineToken._text.c_str());
return false;
}
Code: Select all
// Native NOP
if(opcodeType == Native && opcode0 == 0x02)
{
operandValid = true;
}
else if(opcodeType == vCpu && opcode0 == OPCODE_V_HALT && opcode1 == OPERAND_V_HALT)
{
// Handle in switch(outputSize)
}
// Missing operand
else if((outputSize == TwoBytes || outputSize == ThreeBytes) && int(tokens.size()) <= tokenIndex)
{
fprintf(stderr, "Assembler::assemble() : '%s:%d' : missing operand/s '%s'\n", filename.c_str(), _lineNumber+1, lineToken._text.c_str());
return false;
}
Re: gtBASIC
I have no END statement in my code. The asm section seems to have created it itself
NOTE: I made the change you recommended and that fixed the HALT error.
Now I have a page boundary issue.
NOTE: I made the change you recommended and that fixed the HALT error.
Now I have a page boundary issue.
Re: gtBASIC
gtBASIC always adds an END statement at what it thinks is the end of your code, try the above change to 'assembler.cpp', you should probably send me the code if the above change doesn't fix it.
Can you post the actual error? You may have run out of RAM again.
Can you post the actual error? You may have run out of RAM again.
Re: gtBASIC
Memory::printFreeRamList() : 159 : 0xda00 1
Memory::printFreeRamList() : Expected 5607 : Found 5607
*******************************************************
* Assembling file : 'pirateadventure64k.gasm'
*******************************************************
Assembler::checkInvalidAddress() : 'pirateadventure64k.gasm:4290' : page boundary compromised : FFFF : 0000 : 'divide16bit LDW mathX'
These errors are earlier:
* inputKeys : 0xa405 : 85 bytes
* newLineScroll : 0x30aa : 85 bytes
Memory::getNextCodeAddress() : Couldn't find free code space in RAM of size 83 bytes
Memory::getNextCodeAddress() : Couldn't find free code space in RAM of size 78 bytes
Memory::getNextCodeAddress() : Couldn't find free code space in RAM of size 75 bytes
Memory::getNextCodeAddress() : Couldn't find free code space in RAM of size 73 bytes
Memory::getNextCodeAddress() : Couldn't find free code space in RAM of size 68 bytes
*
It definitely looks like I ran out of memory .
I will try using more constants to free up some memory.
After setting string arrays to constants I get this error
Memory::printFreeRamList() : 188 : 0xef00 1
Memory::printFreeRamList() : Expected 12941 : Found 12941
*******************************************************
* Assembling file : 'pirateadventure64k.gasm'
*******************************************************
Loader::printGt1Stats() : Page overflow : segment 123 : address 0xb402 : segmentSize 255
Memory::printFreeRamList() : Expected 5607 : Found 5607
*******************************************************
* Assembling file : 'pirateadventure64k.gasm'
*******************************************************
Assembler::checkInvalidAddress() : 'pirateadventure64k.gasm:4290' : page boundary compromised : FFFF : 0000 : 'divide16bit LDW mathX'
These errors are earlier:
* inputKeys : 0xa405 : 85 bytes
* newLineScroll : 0x30aa : 85 bytes
Memory::getNextCodeAddress() : Couldn't find free code space in RAM of size 83 bytes
Memory::getNextCodeAddress() : Couldn't find free code space in RAM of size 78 bytes
Memory::getNextCodeAddress() : Couldn't find free code space in RAM of size 75 bytes
Memory::getNextCodeAddress() : Couldn't find free code space in RAM of size 73 bytes
Memory::getNextCodeAddress() : Couldn't find free code space in RAM of size 68 bytes
*
It definitely looks like I ran out of memory .
I will try using more constants to free up some memory.
After setting string arrays to constants I get this error
Memory::printFreeRamList() : 188 : 0xef00 1
Memory::printFreeRamList() : Expected 12941 : Found 12941
*******************************************************
* Assembling file : 'pirateadventure64k.gasm'
*******************************************************
Loader::printGt1Stats() : Page overflow : segment 123 : address 0xb402 : segmentSize 255