gtBASIC

Using, learning, programming and modding the Gigatron and anything related.
Forum rules
Be nice. No drama.
at67
Site Admin
Posts: 647
Joined: 14 May 2018, 08:29

Re: gtBASIC

Post by at67 »

'SPRITE PATTERN, <id>, <pattern id>'

This syntax error doc bug has already been fixed.
wbushby
Posts: 208
Joined: 16 Jul 2021, 10:59

Re: gtBASIC

Post by wbushby »

Don't you need the x and y to put the sprite(pattern) somewhere ?
and what is the difference between id and patternid ?

I definitely don't understand how patterns work. Do they need a show command, etc like sprites ?
at67
Site Admin
Posts: 647
Joined: 14 May 2018, 08:29

Re: gtBASIC

Post by at67 »

It's pretty simple, all it does is change the contents of the sprite's image.

PATTERN is the old school BASIC name for a swappable image for a SPRITE, so:

'SPRITE PATTERN, <id>, <pattern id>' means change the image for SPRITE <id> to PATTERN <id>

You usually do this at a much lower rate/frequency than the SPRITE MOVE command, hence why x and y aren't needed, they are just reused from the last SPRITE MOVE command, (the same as SPRITE SHOW's state, it is just re-used).

Check out 'Sprites_ROMvX0.gbas' for an example.
wbushby
Posts: 208
Joined: 16 Jul 2021, 10:59

Re: gtBASIC

Post by wbushby »

Great, I got the patterns working. That relieved the sprite restriction of 18 sprites.

Now it seems that I have an issue with the number of LOAD BLT commands I have. I have 41 at the moment but the program stops working over 35 ish BLTs.

I use 16 - 18 images per level although some graphics are used on multiple levels.

My graphics load is currently as follows with 15k spare memory.

I was wondering if there is a chain command to load a basic module and run it from the current basic module ?

This would allow me to make the 20 levels that exist in this game.

LOAD SPRITE, Images/Willy1.tga, 0
LOAD SPRITE, Images/Willy2.tga, 1
LOAD SPRITE, Images/Willy3.tga, 2
LOAD SPRITE, Images/Willy4.tga, 3
LOAD SPRITE, Images/Willy5.tga, 4
LOAD SPRITE, Images/Willy6.tga, 5
LOAD SPRITE, Images/CentralCavern/Guardian1.tga, 6
LOAD SPRITE, Images/ColdRoom/Guardian1.tga, 7

LOAD PATTERN, Images/CentralCavern/Guardian1.tga, 0
LOAD PATTERN, Images/CentralCavern/Guardian2.tga, 1
LOAD PATTERN, Images/CentralCavern/Guardian3.tga, 2
LOAD PATTERN, Images/CentralCavern/Guardian4.tga, 3
LOAD PATTERN, Images/CentralCavern/Guardian5.tga, 4
LOAD PATTERN, Images/CentralCavern/Guardian6.tga, 5
LOAD PATTERN, Images/ColdRoom/Guardian1.tga, 6
LOAD PATTERN, Images/ColdRoom/Guardian2.tga, 7
LOAD PATTERN, Images/ColdRoom/Guardian3.tga, 8
LOAD PATTERN, Images/ColdRoom/Guardian4.tga, 9
LOAD PATTERN, Images/ColdRoom/Guardian5.tga, 10
LOAD PATTERN, Images/ColdRoom/Guardian6.tga, 11


LOAD BLIT, Images/Life.tga, 0, NoFlip
LOAD BLIT, Images/CentralCavern/Floor.tga, 1, NoFlip
LOAD BLIT, Images/CentralCavern/CrumblingFloor.tga, 2, NoFlip
LOAD BLIT, Images/CentralCavern/Wall.tga, 3, NoFlip
LOAD BLIT, Images/CentralCavern/Conveyor.tga, 4, NoFlip
LOAD BLIT, Images/CentralCavern/Nasty1.tga, 5, NoFlip
LOAD BLIT, Images/CentralCavern/Nasty2.tga, 6, NoFlip
LOAD BLIT, Images/CentralCavern/Portal.tga, 7, NoFlip
LOAD BLIT, Images/CentralCavern/ItemOrange.tga, 8, NoFlip
LOAD BLIT, Images/CentralCavern/ItemYellow.tga, 9, NoFlip
LOAD BLIT, Images/CentralCavern/ItemPurple.tga, 10, NoFlip
LOAD BLIT, Images/CentralCavern/ItemGreen.tga, 11, NoFlip
LOAD BLIT, Images/CentralCavern/ItemBlank.tga, 12, NoFlip
LOAD BLIT, Images/Plynth.tga, 13, NoFlip
LOAD BLIT, Images/Boot.tga, 14, NoFlip
LOAD BLIT, Images/ColumnBottom.tga, 15, NoFlip
LOAD BLIT, Images/Column.tga, 16, NoFlip
LOAD BLIT, Images/WillyImg.tga, 17, NoFlip
LOAD BLIT, Images/CentralCavern/PortalFlash.tga, 18, NoFlip
LOAD BLIT, Images/CentralCavern/Conveyor1.tga, 19, NoFlip
LOAD BLIT, Images/CentralCavern/Conveyor2.tga, 20, NoFlip
LOAD BLIT, Images/CentralCavern/Conveyor3.tga, 21, NoFlip
LOAD BLIT, Images/CentralCavern/Conveyor4.tga, 22, NoFlip
LOAD BLIT, Images/CentralCavern/Conveyor5.tga, 23, NoFlip
LOAD BLIT, Images/CentralCavern/Conveyor6.tga, 24, NoFlip

LOAD BLIT, Images/ColdRoom/Floor.tga, 25, NoFlip
LOAD BLIT, Images/ColdRoom/CrumblingFloor.tga, 26, NoFlip
LOAD BLIT, Images/ColdRoom/Wall.tga, 27, NoFlip
LOAD BLIT, Images/ColdRoom/Conveyor.tga, 28, NoFlip
LOAD BLIT, Images/ColdRoom/Nasty2.tga, 29, NoFlip
LOAD BLIT, Images/ColdRoom/Portal.tga, 30, NoFlip
LOAD BLIT, Images/ColdRoom/PortalFlash.tga, 31, NoFlip
LOAD BLIT, Images/ColdRoom/ItemBlue.tga, 32, NoFlip
LOAD BLIT, Images/ColdRoom/ItemYellow.tga, 33, NoFlip
LOAD BLIT, Images/ColdRoom/ItemPurple.tga, 34, NoFlip
LOAD BLIT, Images/ColdRoom/ItemGreen.tga, 35, NoFlip
LOAD BLIT, Images/ColdRoom/Conveyor1.tga, 36, NoFlip
LOAD BLIT, Images/ColdRoom/Conveyor2.tga, 37, NoFlip
LOAD BLIT, Images/ColdRoom/Conveyor3.tga, 38, NoFlip
LOAD BLIT, Images/ColdRoom/Conveyor4.tga, 39, NoFlip
LOAD BLIT, Images/ColdRoom/Conveyor5.tga, 40, NoFlip
LOAD BLIT, Images/ColdRoom/Conveyor6.tga, 41, NoFlip
at67
Site Admin
Posts: 647
Joined: 14 May 2018, 08:29

Re: gtBASIC

Post by at67 »

Try this pragma early in your code:

Code: Select all

'use this after _runtimeStart_ to specify maximum number of blits if you have more than 48
_maxNumBlits_ 62
There is no CHAIN command, but there is a MODULE command that inserts a module, (like C's include), e.g.

Code: Select all

module "PucMonData_ROMv5a.m"
So you could do something like:

Code: Select all

module "Level1.m"
module "Level2.m"
    .
    .
    .
module "Level20.m"
You can use whatever file extension you like, (or none), for files loaded by the MODULE command.

See PucMon for an example.
wbushby
Posts: 208
Joined: 16 Jul 2021, 10:59

Re: gtBASIC

Post by wbushby »

I understand that I will not be able to load .tga files during operation as they must compiled into the application.

Is that correct ?
at67
Site Admin
Posts: 647
Joined: 14 May 2018, 08:29

Re: gtBASIC

Post by at67 »

You shouldn't use the LOAD command for any file type within a PROC or GOSUB, as that is undefined behaviour. If you look at PucMon it uses LOAD commands within modules just fine.
wbushby
Posts: 208
Joined: 16 Jul 2021, 10:59

Re: gtBASIC

Post by wbushby »

I don't see how the MODULE command will reduce the initial load of the game as I understand it the command works like #include in c++ which just inserts the included code into the calling module before compile. Am I correct in this assumption ?

I am looking for a way to reduce the images and music loaded to the game at certain points in it's running. Such as separating the title screen part from the main game part and loading the level graphics as you reach a level.

That way I would be able to have infinite levels if I wanted.
at67
Site Admin
Posts: 647
Joined: 14 May 2018, 08:29

Re: gtBASIC

Post by at67 »

Where would you load it from?

I have an unfinished bit of code that will allow you to OPEN files on Pluggy Reloaded and then LOAD them as you described above, but no timeline to completion unfortunately.

You can load a title screen as part of the loading process, which takes up no RAM, (technically it loads into the screen RAM as part of Gigatron's loader), just use the following to load any sized image, (up to full-screen), into the top left hand corner:

Code: Select all

'LOAD IMAGE, <filename>, <optional screen address>
load image, ../../res/image/sunset.tga
wbushby
Posts: 208
Joined: 16 Jul 2021, 10:59

Re: gtBASIC

Post by wbushby »

Thank you, that save me 10k in memory usage.

Can I load screens from inside procedure code as I go along ?
Post Reply