gtBASIC
Forum rules
Be nice. No drama.
Be nice. No drama.
Re: gtBASIC
Not a problem. Just checking before I write redundant code.
I am thinking that maybe it would be good if later this year as I have time I will start writing something like the C64 Programmer's Reference Guide for this version of GTBasic. That way we can get all your great development into one place for new programmers to use.
Looking at how this game is performing in compiled basic on a platform based in 1970's hardware, I am impressed by GTBasic and the Gigatron.
I have 22 spare blank PCBs I should sell off so other interested people can get involved.
I am thinking that maybe it would be good if later this year as I have time I will start writing something like the C64 Programmer's Reference Guide for this version of GTBasic. That way we can get all your great development into one place for new programmers to use.
Looking at how this game is performing in compiled basic on a platform based in 1970's hardware, I am impressed by GTBasic and the Gigatron.
I have 22 spare blank PCBs I should sell off so other interested people can get involved.
Re: gtBASIC
Have you seen this unfinished doc https://github.com/at67/ROMvX0/blob/mai ... tBASIC.pdf?
If at some stage you'd like to try and help finish it, that would be awesome!
If at some stage you'd like to try and help finish it, that would be awesome!
Re: gtBASIC
I hadn't seen that document.
If you could produce a list of the command keywords from GTBasic source that would give me a total list to work towards
If you could produce a list of the command keywords from GTBasic source that would give me a total list to work towards
Re: gtBASIC
For detailed paramater lists you'll need to check the source code, which is trivial to do in the correpsonding files, pragmas.cpp, operators.cpp, functions.cpp, keywords.cpp, etc.
Pragmas:
Keywords:
Functions:
Operators:
Pragmas:
Code: Select all
// Pragmas
_pragmas["_codeRomType_"] = {"_codeRomType_", CODEROMTYPE };
_pragmas["_runtimePath_"] = {"_runtimePath_", RUNTIMEPATH };
_pragmas["_runtimeStart_"] = {"_runtimeStart_", RUNTIMESTART };
_pragmas["_userCodeStart_"] = {"_userCodeStart_", USERCODESTART };
_pragmas["_arraysStart_"] = {"_arraysStart_", ARRAYSSTART };
_pragmas["_stringsStart_"] = {"_stringsStart_", STRINGSSTART };
_pragmas["_stringWorkArea_"] = {"_stringWorkArea_", STRINGWORKAREA };
_pragmas["_stringMaxSize_"] = {"_stringMaxSize_", STRINGMAXSIZE };
_pragmas["_tempVarSize_"] = {"_tempVarSize_", TEMPVARSIZE };
_pragmas["_codeOptimiseType_"] = {"_codeOptimiseType_", CODEOPTIMISETYPE };
_pragmas["_arrayIndiciesOne_"] = {"_arrayIndiciesOne_", ARRAYINDICIESONE };
_pragmas["_maxNumBlits_"] = {"_maxNumBlits_", MAXNUMBLITS };
_pragmas["_blitStripeChunks_"] = {"_blitStripeChunks_", BLITSTRIPECHUNKS };
_pragmas["_maxNumPatterns_"] = {"_maxNumPatterns_", MAXNUMPATTERNS };
_pragmas["_enable6BitAudioEmu_"] = {"_enable6BitAudioEmu_", ENABLE6BITAUDIOEMU};
_pragmas["_enable8BitAudioEmu_"] = {"_enable8BitAudioEmu_", ENABLE8BITAUDIOEMU};
Code: Select all
// Equals keywords
_equalsKeywords["CONST" ] = "CONST";
_equalsKeywords["DIM" ] = "DIM";
_equalsKeywords["DEF" ] = "DEF";
_equalsKeywords["FOR" ] = "FOR";
_equalsKeywords["IF" ] = "IF";
_equalsKeywords["ELSEIF"] = "ELSEIF";
_equalsKeywords["WHILE" ] = "WHILE";
_equalsKeywords["UNTIL" ] = "UNTIL";
// Keywords
_keywords["END" ] = {"END", END, Compiler::SingleStatementParsed};
_keywords["INC" ] = {"INC", INC, Compiler::SingleStatementParsed};
_keywords["DEC" ] = {"DEC", DEC, Compiler::SingleStatementParsed};
_keywords["XCHG" ] = {"XCHG", XCHG, Compiler::SingleStatementParsed};
_keywords["SWAP" ] = {"SWAP", SWAP, Compiler::SingleStatementParsed};
_keywords["DBNE" ] = {"DBNE", DBNE, Compiler::SingleStatementParsed};
_keywords["DBGE" ] = {"DBGE", DBGE, Compiler::SingleStatementParsed};
_keywords["ON" ] = {"ON", ON, Compiler::SingleStatementParsed};
_keywords["GOTO" ] = {"GOTO", GOTO, Compiler::SingleStatementParsed};
_keywords["GOSUB" ] = {"GOSUB", GOSUB, Compiler::SingleStatementParsed};
_keywords["RETURN" ] = {"RETURN", RETURN, Compiler::SingleStatementParsed};
_keywords["RET" ] = {"RET", RET, Compiler::SingleStatementParsed};
_keywords["CLS" ] = {"CLS", CLS, Compiler::SingleStatementParsed};
_keywords["?" ] = {"?", PRINT, Compiler::SingleStatementParsed};
_keywords["PRINT" ] = {"PRINT", PRINT, Compiler::SingleStatementParsed};
_keywords["INPUT" ] = {"INPUT", INPUT, Compiler::SingleStatementParsed};
_keywords["FOR" ] = {"FOR", FOR, Compiler::SingleStatementParsed};
_keywords["NEXT" ] = {"NEXT", NEXT, Compiler::SingleStatementParsed};
_keywords["IF" ] = {"IF", IF, Compiler::MultiStatementParsed };
_keywords["ELSEIF" ] = {"ELSEIF", ELSEIF, Compiler::SingleStatementParsed};
_keywords["ELSE" ] = {"ELSE", ELSE, Compiler::SingleStatementParsed};
_keywords["ENDIF" ] = {"ENDIF", ENDIF, Compiler::SingleStatementParsed};
_keywords["WHILE" ] = {"WHILE", WHILE, Compiler::SingleStatementParsed};
_keywords["WEND" ] = {"WEND", WEND, Compiler::SingleStatementParsed};
_keywords["REPEAT" ] = {"REPEAT", REPEAT, Compiler::SingleStatementParsed};
_keywords["UNTIL" ] = {"UNTIL", UNTIL, Compiler::SingleStatementParsed};
_keywords["FOREVER" ] = {"FOREVER", FOREVER, Compiler::SingleStatementParsed};
_keywords["&FOREVER"] = {"&FOREVER", FOREVER, Compiler::SingleStatementParsed};
_keywords["AS" ] = {"AS", AS, Compiler::SingleStatementParsed};
_keywords["TYPE" ] = {"TYPE", TYPE, Compiler::SingleStatementParsed};
_keywords["CALL" ] = {"CALL", CALL, Compiler::SingleStatementParsed};
_keywords["PROC" ] = {"PROC", PROC, Compiler::SingleStatementParsed};
_keywords["ENDPROC" ] = {"ENDPROC", ENDPROC, Compiler::SingleStatementParsed};
_keywords["LOCAL" ] = {"LOCAL", LOCAL, Compiler::SingleStatementParsed};
_keywords["CONST" ] = {"CONST", CONST, Compiler::SingleStatementParsed};
_keywords["DIM" ] = {"DIM", DIM, Compiler::SingleStatementParsed};
_keywords["DEF" ] = {"DEF", DEF, Compiler::SingleStatementParsed};
_keywords["DATA" ] = {"DATA", DATA, Compiler::SingleStatementParsed};
_keywords["READ" ] = {"READ", READ, Compiler::SingleStatementParsed};
_keywords["RESTORE" ] = {"RESTORE", RESTORE, Compiler::SingleStatementParsed};
_keywords["ALLOC" ] = {"ALLOC", ALLOC, Compiler::SingleStatementParsed};
_keywords["FREE" ] = {"FREE", FREE, Compiler::SingleStatementParsed};
_keywords["CLEAR" ] = {"CLEAR", CLEAR, Compiler::SingleStatementParsed};
_keywords["AT" ] = {"AT", AT, Compiler::SingleStatementParsed};
_keywords["PUT" ] = {"PUT", PUT, Compiler::SingleStatementParsed};
_keywords["MODE" ] = {"MODE", MODE, Compiler::SingleStatementParsed};
_keywords["WAIT" ] = {"WAIT", WAIT, Compiler::SingleStatementParsed};
_keywords["PSET" ] = {"PSET", PSET, Compiler::SingleStatementParsed};
_keywords["LINE" ] = {"LINE", LINE, Compiler::SingleStatementParsed};
_keywords["HLINE" ] = {"HLINE", HLINE, Compiler::SingleStatementParsed};
_keywords["VLINE" ] = {"VLINE", VLINE, Compiler::SingleStatementParsed};
_keywords["CIRCLE" ] = {"CIRCLE", CIRCLE, Compiler::SingleStatementParsed};
_keywords["CIRCLEF" ] = {"CIRCLEF", CIRCLEF, Compiler::SingleStatementParsed};
_keywords["RECT" ] = {"RECT", RECT, Compiler::SingleStatementParsed};
_keywords["RECTF" ] = {"RECTF", RECTF, Compiler::SingleStatementParsed};
_keywords["POLY" ] = {"POLY", POLY, Compiler::SingleStatementParsed};
_keywords["POLYR" ] = {"POLYR", POLYR, Compiler::SingleStatementParsed};
_keywords["FILL" ] = {"FILL", FILL, Compiler::SingleStatementParsed};
_keywords["TCLIP" ] = {"TCLIP", TCLIP, Compiler::SingleStatementParsed};
_keywords["TSCROLL" ] = {"TSCROLL", TSCROLL, Compiler::SingleStatementParsed};
_keywords["TFNT4X6" ] = {"TFNT4X6", TFNT4X6, Compiler::SingleStatementParsed};
_keywords["HSCROLL" ] = {"HSCROLL", HSCROLL, Compiler::SingleStatementParsed};
_keywords["VSCROLL" ] = {"VSCROLL", VSCROLL, Compiler::SingleStatementParsed};
_keywords["POKE" ] = {"POKE", POKE, Compiler::SingleStatementParsed};
_keywords["DOKE" ] = {"DOKE", DOKE, Compiler::SingleStatementParsed};
_keywords["INIT" ] = {"INIT", INIT, Compiler::SingleStatementParsed};
_keywords["TICK" ] = {"TICK", TICK, Compiler::SingleStatementParsed};
_keywords["PLAY" ] = {"PLAY", PLAY, Compiler::SingleStatementParsed};
_keywords["LOAD" ] = {"LOAD", LOAD, Compiler::SingleStatementParsed};
_keywords["BLIT" ] = {"BLIT", BLIT, Compiler::SingleStatementParsed};
_keywords["SPRITE" ] = {"SPRITE", SPRITE, Compiler::SingleStatementParsed};
_keywords["SPRITES" ] = {"SPRITES", SPRITES, Compiler::SingleStatementParsed};
_keywords["SOUND" ] = {"SOUND", SOUND, Compiler::SingleStatementParsed};
_keywords["SET" ] = {"SET", SET, Compiler::SingleStatementParsed};
_keywords["ASM" ] = {"ASM", ASM, Compiler::SingleStatementParsed};
_keywords["ENDASM" ] = {"ENDASM", ENDASM, Compiler::SingleStatementParsed};
_keywords["BCDADD" ] = {"BCDADD", BCDADD, Compiler::SingleStatementParsed};
_keywords["BCDSUB" ] = {"BCDSUB", BCDSUB, Compiler::SingleStatementParsed};
_keywords["BCDINT" ] = {"BCDINT", BCDINT, Compiler::SingleStatementParsed};
_keywords["BCDCPY" ] = {"BCDCPY", BCDCPY, Compiler::SingleStatementParsed};
_keywords["VEC8" ] = {"VEC8", VEC8, Compiler::SingleStatementParsed};
_keywords["EXEC" ] = {"EXEC", EXEC, Compiler::SingleStatementParsed};
_keywords["OPEN" ] = {"OPEN", OPEN, Compiler::SingleStatementParsed};
_keywords["BRKPNT" ] = {"BRKPNT", BRKPNT, Compiler::SingleStatementParsed};
_keywords["GPRINTF" ] = {"GPRINTF", GPRINTF, Compiler::SingleStatementParsed};
_keywords["OPTIMISE"] = {"OPTIMISE", OPTIMISE, Compiler::SingleStatementParsed};
Code: Select all
// Functions
_functions["IARR" ] = "IARR";
_functions["SARR" ] = "SARR";
_functions["CARR" ] = "CARR";
_functions["PEEK" ] = "PEEK";
_functions["DEEK" ] = "DEEK";
_functions["USR" ] = "USR";
_functions["RND" ] = "RND";
_functions["URND" ] = "URND";
_functions["LEN" ] = "LEN";
_functions["GET" ] = "GET";
_functions["ABS" ] = "ABS";
_functions["SGN" ] = "SGN";
_functions["ASC" ] = "ASC";
_functions["TWIDTH" ] = "TWIDTH";
_functions["STRCMP" ] = "STRCMP";
_functions["BCDCMP" ] = "BCDCMP";
_functions["VAL" ] = "VAL";
_functions["LUP" ] = "LUP";
_functions["ADDR" ] = "ADDR";
_functions["ARRB" ] = "ARRB";
_functions["ARRW" ] = "ARRW";
_functions["POINT" ] = "POINT";
_functions["MIN" ] = "MIN";
_functions["MAX" ] = "MAX";
_functions["CLAMP" ] = "CLAMP";
_functions["FMUL" ] = "FMUL";
_functions["FDIV" ] = "FDIV";
_functions["FMOD" ] = "FMOD";
_functions["FDIVMOD"] = "FDIVMOD";
_functions["SQRT" ] = "SQRT";
// String functions
_stringFunctions["CHR$" ] = "CHR$";
_stringFunctions["SPC$" ] = "SPC$";
_stringFunctions["STR$" ] = "STR$";
_stringFunctions["STRING$"] = "STRING$";
_stringFunctions["TIME$" ] = "TIME$";
_stringFunctions["HEX$" ] = "HEX$";
_stringFunctions["FIND$" ] = "FIND$";
_stringFunctions["LEFT$" ] = "LEFT$";
_stringFunctions["RIGHT$" ] = "RIGHT$";
_stringFunctions["MID$" ] = "MID$";
_stringFunctions["LCASE$" ] = "LCASE$";
_stringFunctions["UCASE$" ] = "UCASE$";
_stringFunctions["STRCAT$"] = "STRCAT$";
Code: Select all
// Unary logic operators
Expression::Numeric POS(Expression::Numeric& numeric, const std::string& moduleName, const std::string& codeLineText, int codeLineStart);
Expression::Numeric NEG(Expression::Numeric& numeric, const std::string& moduleName, const std::string& codeLineText, int codeLineStart);
Expression::Numeric NOT(Expression::Numeric& numeric, const std::string& moduleName, const std::string& codeLineText, int codeLineStart);
// Unary math operators
Expression::Numeric CEIL(Expression::Numeric& numeric, const std::string& moduleName, const std::string& codeLineText, int codeLineStart);
Expression::Numeric FLOOR(Expression::Numeric& numeric, const std::string& moduleName, const std::string& codeLineText, int codeLineStart);
Expression::Numeric POWF(Expression::Numeric& numeric, const std::string& moduleName, const std::string& codeLineText, int codeLineStart);
Expression::Numeric SQRT(Expression::Numeric& numeric, const std::string& moduleName, const std::string& codeLineText, int codeLineStart);
Expression::Numeric EXP(Expression::Numeric& numeric, const std::string& moduleName, const std::string& codeLineText, int codeLineStart);
Expression::Numeric EXP2(Expression::Numeric& numeric, const std::string& moduleName, const std::string& codeLineText, int codeLineStart);
Expression::Numeric LOG(Expression::Numeric& numeric, const std::string& moduleName, const std::string& codeLineText, int codeLineStart);
Expression::Numeric LOG2(Expression::Numeric& numeric, const std::string& moduleName, const std::string& codeLineText, int codeLineStart);
Expression::Numeric LOG10(Expression::Numeric& numeric, const std::string& moduleName, const std::string& codeLineText, int codeLineStart);
Expression::Numeric SIN(Expression::Numeric& numeric, const std::string& moduleName, const std::string& codeLineText, int codeLineStart);
Expression::Numeric COS(Expression::Numeric& numeric, const std::string& moduleName, const std::string& codeLineText, int codeLineStart);
Expression::Numeric TAN(Expression::Numeric& numeric, const std::string& moduleName, const std::string& codeLineText, int codeLineStart);
Expression::Numeric ASIN(Expression::Numeric& numeric, const std::string& moduleName, const std::string& codeLineText, int codeLineStart);
Expression::Numeric ACOS(Expression::Numeric& numeric, const std::string& moduleName, const std::string& codeLineText, int codeLineStart);
Expression::Numeric ATAN(Expression::Numeric& numeric, const std::string& moduleName, const std::string& codeLineText, int codeLineStart);
Expression::Numeric ATAN2(Expression::Numeric& numeric, const std::string& moduleName, const std::string& codeLineText, int codeLineStart);
Expression::Numeric RAND(Expression::Numeric& numeric, const std::string& moduleName, const std::string& codeLineText, int codeLineStart);
Expression::Numeric REV16(Expression::Numeric& numeric, const std::string& moduleName, const std::string& codeLineText, int codeLineStart);
Expression::Numeric REV8(Expression::Numeric& numeric, const std::string& moduleName, const std::string& codeLineText, int codeLineStart);
Expression::Numeric REV4(Expression::Numeric& numeric, const std::string& moduleName, const std::string& codeLineText, int codeLineStart);
// Binary logic operators
Expression::Numeric AND(Expression::Numeric& left, Expression::Numeric& right, const std::string& moduleName, const std::string& codeLineText, int codeLineStart);
Expression::Numeric XOR(Expression::Numeric& left, Expression::Numeric& right, const std::string& moduleName, const std::string& codeLineText, int codeLineStart);
Expression::Numeric OR(Expression::Numeric& left, Expression::Numeric& right, const std::string& moduleName, const std::string& codeLineText, int codeLineStart);
Expression::Numeric LSL(Expression::Numeric& left, Expression::Numeric& right, const std::string& moduleName, const std::string& codeLineText, int codeLineStart);
Expression::Numeric LSR(Expression::Numeric& left, Expression::Numeric& right, const std::string& moduleName, const std::string& codeLineText, int codeLineStart);
Expression::Numeric ASR(Expression::Numeric& left, Expression::Numeric& right, const std::string& moduleName, const std::string& codeLineText, int codeLineStart);
// Binary math operators
Expression::Numeric ADD(Expression::Numeric& left, Expression::Numeric& right, const std::string& moduleName, const std::string& codeLineText, int codeLineStart);
Expression::Numeric SUB(Expression::Numeric& left, Expression::Numeric& right, const std::string& moduleName, const std::string& codeLineText, int codeLineStart);
Expression::Numeric MUL(Expression::Numeric& left, Expression::Numeric& right, const std::string& moduleName, const std::string& codeLineText, int codeLineStart);
Expression::Numeric DIV(Expression::Numeric& left, Expression::Numeric& right, const std::string& moduleName, const std::string& codeLineText, int codeLineStart);
Expression::Numeric MOD(Expression::Numeric& left, Expression::Numeric& right, const std::string& moduleName, const std::string& codeLineText, int codeLineStart);
Expression::Numeric POW(Expression::Numeric& left, Expression::Numeric& right, const std::string& moduleName, const std::string& codeLineText, int codeLineStart);
// Relational operators
Expression::Numeric EQ(Expression::Numeric& left, Expression::Numeric& right, Expression::Numeric& input, const std::string& moduleName, const std::string& codeLineText, int codeLineStart);
Expression::Numeric NE(Expression::Numeric& left, Expression::Numeric& right, Expression::Numeric& input, const std::string& moduleName, const std::string& codeLineText, int codeLineStart);
Expression::Numeric LE(Expression::Numeric& left, Expression::Numeric& right, Expression::Numeric& input, const std::string& moduleName, const std::string& codeLineText, int codeLineStart);
Expression::Numeric GE(Expression::Numeric& left, Expression::Numeric& right, Expression::Numeric& input, const std::string& moduleName, const std::string& codeLineText, int codeLineStart);
Expression::Numeric LT(Expression::Numeric& left, Expression::Numeric& right, Expression::Numeric& input, const std::string& moduleName, const std::string& codeLineText, int codeLineStart);
Expression::Numeric GT(Expression::Numeric& left, Expression::Numeric& right, Expression::Numeric& input, const std::string& moduleName, const std::string& codeLineText, int codeLineStart);
Re: gtBASIC
Is there a limit to the number of sprites ?
I have 18 declared and am getting an out of memory error
I have 18 declared and am getting an out of memory error
- Attachments
-
- screen.jpg (61 KiB) Viewed 2103 times
Re: gtBASIC
Yes there is:
1) Sprites are hard-coded to offscreen addresses for a 32K RAM Gigatron, (XXA0 to XXB3). This means the maximum number of sprite 9 pixel rows you can have is 120. So one sprite of vertical size 120 or ten sprites of vertical size 12, etc.
2) For a 64K RAM Gigatron you have (120+128) * 9 pixel rows maximum across all sprites.
1) Sprites are hard-coded to offscreen addresses for a 32K RAM Gigatron, (XXA0 to XXB3). This means the maximum number of sprite 9 pixel rows you can have is 120. So one sprite of vertical size 120 or ten sprites of vertical size 12, etc.
2) For a 64K RAM Gigatron you have (120+128) * 9 pixel rows maximum across all sprites.
Re: gtBASIC
OK, I will have to change the antagonists to bitmaps and manage drawing the movements as there are many needed in this game
It will probably save a lot of memory as I can flip bitmaps thus reducing the need for 6 bitmaps per antagonist to 3 per.
Too bad because I had 90% of the operational code done and was just going to push out all the levels I could fit.
It will probably save a lot of memory as I can flip bitmaps thus reducing the need for 6 bitmaps per antagonist to 3 per.
Too bad because I had 90% of the operational code done and was just going to push out all the levels I could fit.
Re: gtBASIC
Remember you can use the pattern statement to change sprite data in real time, so lets say for example you are limited to 10 sprites of varying sizes, (due to your offscreen limitations), as long as you never have more than ten sprites on screen, then you can use those ten sprites to represent many more objects, (e.g. 50), until you run out of normal RAM.
Another way to state it, is, work out the maximum number of sprites you will ever need based on max(different vertical heights, maximum on screen), then use LOAD SPRITE for those and the rest use LOAD PATTERN. Then switch each sprite to the correct image data needed using SPRITE PATTERN.
e.g. You have 5 sprites of varying heights and a maximum of 8 sprites on screen at once, but a total number of sprite patterns of 20.
number of LOAD SPRITES = max(5, 8) = 8, think of this as priming the hardware sprites.
number of LOAD PATTERNS = 12 to 20, depending on whether original 8 LOAD SPRITES images need to be re-used.
Another way to state it, is, work out the maximum number of sprites you will ever need based on max(different vertical heights, maximum on screen), then use LOAD SPRITE for those and the rest use LOAD PATTERN. Then switch each sprite to the correct image data needed using SPRITE PATTERN.
e.g. You have 5 sprites of varying heights and a maximum of 8 sprites on screen at once, but a total number of sprite patterns of 20.
number of LOAD SPRITES = max(5, 8) = 8, think of this as priming the hardware sprites.
number of LOAD PATTERNS = 12 to 20, depending on whether original 8 LOAD SPRITES images need to be re-used.
Re: gtBASIC
OK that is useful. I will look into that statement
Re: gtBASIC
what is the format of SPRITE PATTERN. I seem to get differing instructions when there is a syntax error. ?
Also what is the difference between ID and PatternID ?
Also what is the difference between ID and PatternID ?
- Attachments
-
- screen.jpg (88.46 KiB) Viewed 2079 times