Jump to content
IGNORED

IntyBASIC compiler


nanochess

Recommended Posts

 

What about doing it the typical BASIC way: all DATA entries go in the same table, and you use the READ command to get the read the next cell, keeping an internal cursor that can be reset with CLEAR.

 

-dZ.

What Intybasic has is already better than that: You can set up multiple tables - use the command RESTORE tablename to set the internal cursor to the start of the specified table, and then use READ to get successive values from the table.

 

This works great if you use exactly one table at a time in your game. But I tend to write table driven code, with many different tables. For example, in Clowns and Balloons, I have one table that has the balloon positions for each round, and another table that describes the animation of the stretcher when hit. So I read the data for the first round, and the internal cursor is all set to read the next round's data, but then the clown hits the stretcher and I set the internal cursor to read the stretcher animation data, and so I "lose my place" in the balloon data.

 

What I want are read-only arrays of data, where I can index the data tables however I want, and can have more than one table active at a time.

I guess I haven't learned to think in the "typical BASIC way"...

Edited by catsfolly
Link to comment
Share on other sites

Just updated IntyBASIC to v0.3

 

Major enhancements include the DATA statement accessable with array indexing and the DIM statement for modifiable arrays.

REM Sample of read-only array using DATA and labels

FOR A=0 TO 4
PRINT AT POSITION(A),"Z"
NEXT A

POSITION:
DATA 50,69,88,107,126

--------------------

REM Sample of modifiable arrays
DIM X(5)
X(0)=1
FOR A=1 TO 4
X(A)=X(A-1)+X(A)
NEXT A

This should be enough for fairly complex games :D. I'll be checking this thread in order to foresee possible enhancements to language :)

 

I've added also a memory limit detection just in case variables exceed the available space. Besides arrays can also be declared in 16-bits RAM space using DIM #A(5) although the space is more limited.

  • Like 5
Link to comment
Share on other sites

What Intybasic has is already better than that: You can set up multiple tables - use the command RESTORE tablename to set the internal cursor to the start of the specified table, and then use READ to get successive values from the table.

 

This works great if you use exactly one table at a time in your game. But I tend to write table driven code, with many different tables. For example, in Clowns and Balloons, I have one table that has the balloon positions for each round, and another table that describes the animation of the stretcher when hit. So I read the data for the first round, and the internal cursor is all set to read the next round's data, but then the clown hits the stretcher and I set the internal cursor to read the stretcher animation data, and so I "lose my place" in the balloon data.

 

What I want are read-only arrays of data, where I can index the data tables however I want, and can have more than one table active at a time.

I guess I haven't learned to think in the "typical BASIC way"...

 

Well, I thought that since it was intended to be BASIC, it should have the expected constructs and devices. Of course, it should also have any extended commands and structures that gives it more power.

 

The way static tables are done in the "old school" BASIC was by defining a "data segment": All DATA statements end up being collected as one single block, you iterate it by using the READ command, which keeps an internal cursor that can be reset using the RESTORE command.

 

The typical pattern for reading tables was something like this:

DIM A(10) : REM Define an array for my table
 
REM Load 10 cells into "A" table
FOR I = 0 TO 9
    READ A(I)
NEXT I
 
REM Data segment
DATA 1,2,3,4,5,6,7,8,9,10

Yes it is verbose, and required using RAM to store the table because there was no direct indexing of the data segment. Your suggestion fixes that, which is awesome.

 

What I asked for was the old mechanism to be added as well so that old school BASIC games can be more easily ported. Just a thought, to keep the BASIC somewhat standard, with extensions (like in the good ol' days).

 

-dZ.

  • Like 1
Link to comment
Share on other sites

 

What I asked for was the old mechanism to be added as well so that old school BASIC games can be more easily ported. Just a thought, to keep the BASIC somewhat standard, with extensions (like in the good ol' days).

 

-dZ.

 

Whoops! just I've noted that READ A(I) cannot be used because currently it only works for normal variables, but you can do it by indirect methods like:

 

READ VALUE

A(I)=VALUE

 

Anyway your typical pattern would work :), only make sure to put a RESTORE statement.

Link to comment
Share on other sites

Are the labels constrained to data tables? Or are they free-form? Can I just index whatever I please?

If I do something stupid like this,

FOO:
FOR I = 1 TO 10
    PRINT FOO(I)
NEXT I

will I get exactly what I deserve?

I see this being a potential issue or source of confusion during debugging...

dZ.

Edited by DZ-Jay
Link to comment
Share on other sites

Are the labels constrained to data tables? Or are they free-form? Can I just index whatever I please?

 

If I do something stupid like this,

 

FOO:
FOR I = 1 TO 10
    PRINT FOO(I)
NEXT I

will I get exactly what I deserve?

 

I see this being a potential issue or source of confusion during debugging...

 

dZ.

 

Yep. You can do that and read a bunch of binary code.

 

I made it that way in order to keep the compiler simple. Anyway, you can use big labels to avoid any possible confusion.

 

The assembler catchs the redefined and undefined labels.

  • Like 1
Link to comment
Share on other sites

That's cool, I was just curious. I think the indexed label is a powerful device, it just gives you a chance to shoot yourself in the foot. I'm not knocking your version of BASIC, it truly is fantastic the things that can be done with it (I'm impressed with all the demos so far, especial catsfolly's!).

 

Anyway, I don't have a better suggestion that doesn't involve complicating the compiler. Keep up the good work. :)

 

-dZ.

  • Like 1
Link to comment
Share on other sites

post-24767-0-22205400-1391919161.gif <--- click to animate

 

Here is my progress with this simple game I'm making with IntyBASIC. Everytime you fill the basket, the speed of the item dropping increases. There are 23 level of speed. At level 23, the items drops very very quickly. The worm population will increase with time if you haven't fill the basket up. The population reset once you completed a basket. If you catch a worm with the basket with apple, then the worm will eat all the apple and you have another chance to fill the basket back up. If the basket is empty and you catch the worm, then the worm eats the basket, causing you to lose a heart. If you do not have any hearts left, then the dreadful worm eats you and it's game over.

 

I am going to add more items to be dropped, also make a colorful background backdrop. I have 2 colorstack to use for the background. I am using the 2 colorstack for the HUD for the basket and the lives. The bin is now 5.5 KB. I will probably move the functions to another block if I need more than 8KB.

  • Like 8
Link to comment
Share on other sites

attachicon.gifApplecatcherwip.gif <--- click to animate

 

Here is my progress with this simple game I'm making with IntyBASIC. Everytime you fill the basket, the speed of the item dropping increases. There are 23 level of speed. At level 23, the items drops very very quickly. The worm population will increase with time if you haven't fill the basket up. The population reset once you completed a basket. If you catch a worm with the basket with apple, then the worm will eat all the apple and you have another chance to fill the basket back up. If the basket is empty and you catch the worm, then the worm eats the basket, causing you to lose a heart. If you do not have any hearts left, then the dreadful worm eats you and it's game over.

 

I am going to add more items to be dropped, also make a colorful background backdrop. I have 2 colorstack to use for the background. I am using the 2 colorstack for the HUD for the basket and the lives. The bin is now 5.5 KB. I will probably move the functions to another block if I need more than 8KB.

 

Great works! :thumbsup:

  • Like 1
Link to comment
Share on other sites

I am going to add more items to be dropped, also make a colorful background backdrop. I have 2 colorstack to use for the background. I am using the 2 colorstack for the HUD for the basket and the lives. The bin is now 5.5 KB. I will probably move the functions to another block if I need more than 8KB.

 

Your binary can go up to 16K without problems. In Intellivision each memory address can contain 16-bits, the main memory zone in $5000-$6fff is 8K words or 16K bytes.

  • Like 1
Link to comment
Share on other sites

attachicon.gifApplecatcherwip.gif <--- click to animate

 

Here is my progress with this simple game I'm making with IntyBASIC. Everytime you fill the basket, the speed of the item dropping increases. There are 23 level of speed. At level 23, the items drops very very quickly. The worm population will increase with time if you haven't fill the basket up. The population reset once you completed a basket. If you catch a worm with the basket with apple, then the worm will eat all the apple and you have another chance to fill the basket back up. If the basket is empty and you catch the worm, then the worm eats the basket, causing you to lose a heart. If you do not have any hearts left, then the dreadful worm eats you and it's game over.

 

I am going to add more items to be dropped, also make a colorful background backdrop. I have 2 colorstack to use for the background. I am using the 2 colorstack for the HUD for the basket and the lives. The bin is now 5.5 KB. I will probably move the functions to another block if I need more than 8KB.

 

 

 

Nice, It reminds me of Kaboom a little.

  • Like 2
Link to comment
Share on other sites

attachicon.gifApplecatcherwip.gif <--- click to animate

 

Here is my progress with this simple game I'm making with IntyBASIC. Everytime you fill the basket, the speed of the item dropping increases. There are 23 level of speed. At level 23, the items drops very very quickly. The worm population will increase with time if you haven't fill the basket up. The population reset once you completed a basket. If you catch a worm with the basket with apple, then the worm will eat all the apple and you have another chance to fill the basket back up. If the basket is empty and you catch the worm, then the worm eats the basket, causing you to lose a heart. If you do not have any hearts left, then the dreadful worm eats you and it's game over.

 

I am going to add more items to be dropped, also make a colorful background backdrop. I have 2 colorstack to use for the background. I am using the 2 colorstack for the HUD for the basket and the lives. The bin is now 5.5 KB. I will probably move the functions to another block if I need more than 8KB.

 

Looks very good! If I may make a suggestion, is to start the falling items with a speed lightly greater than zero. Accelerating from absolute rest makes it feel a bit lethargic, and somewhat distracts from the action.

 

Great work!

  • Like 1
Link to comment
Share on other sites

 

Your binary can go up to 16K without problems. In Intellivision each memory address can contain 16-bits, the main memory zone in $5000-$6fff is 8K words or 16K bytes.

 

I am confused. I was thinking $x000-$xFFF would be 4096 bytes, so would it be 2048 words. So would the zone $5000-$6fff would be 8KB? $7000 and to an memory address I can't recall, I think is where the executive ROM or the GROM/GRAM address locations are, so data couldn't be written to or read from in that zone. I will have to reread then instruction to be sure. From the memory map info, there should be about 32-48KB without a mapper chip since I think the address space is limited to $0000-$FFFF like the Colecovision. I'm happy that "ASM ORG $xxxx" worked so it allows me to make a bigger game. It kinda hard to tell sdcc where the data is located and how to send a pointer to an unknown memory location since the label would be different. That still a mystery I will eventually solve, so I can use Mega-cart for Colecovision.

 

 

Looks very good! If I may make a suggestion, is to start the falling items with a speed lightly greater than zero. Accelerating from absolute rest makes it feel a bit lethargic, and somewhat distracts from the action.

 

Great work!

 

There will be a top part of a tree and it serves as a warning if something about to fall like a water droplet. It will drop like crazy in higher difficulty. I'm going to draw that backdrop tonight.

Link to comment
Share on other sites

I am confused. I was thinking $x000-$xFFF would be 4096 bytes, so would it be 2048 words.

The data bus is 16 bits wide so its 4096 words or 8K bytes. Have a look in the notes inside the SDK1600's cart.mac and it'll tell you the memory map for a 16K words and 42K words game.

 

There will be a top part of a tree and it serves as a warning if something about to fall like a water droplet.

You could use the sprite priority bit to have them fall from behind the tree.

Link to comment
Share on other sites

I apologize, I couldn't locate that specific files cart.mac in the SDK1600. I did managed to read the other resources. If a binary is 16 KB using address $5000-$6FFF, when putting that binary to cart, it becomes 8KB due to 16-bit being 1 byte. I'm seeing how big the .bin file before it needed another 16KB.

Link to comment
Share on other sites

I apologize, I couldn't locate that specific files cart.mac in the SDK1600. I did managed to read the other resources. If a binary is 16 KB using address $5000-$6FFF, when putting that binary to cart, it becomes 8KB due to 16-bit being 1 byte. I'm seeing how big the .bin file before it needed another 16KB.

Just a brief explanation. ;)

 

1. With IntyBASIC you're using $5000-$6fff by default (unless you put an ASM ORG statement)

2. Each address contains a 16-bit word, but in the BIN file each word is represented as two bytes.

3. So $5000-$6FFF is 8K words and the BIN file would size up to 16 kbytes to contain these 8K words.

  • Like 1
Link to comment
Share on other sites

I'm just thinking.

 

Take the same thing , generate asm for Colecovision and you have the BasicVision that PixelBoy wanted to do for the Colecovision.

 

And make in sort it works also for MSX ,SG1000 , SMS... and why not NES.

 

Then i will put a giant statue of you in my garden!!!

  • Like 2
Link to comment
Share on other sites

I'm just thinking.

 

Take the same thing , generate asm for Colecovision and you have the BasicVision that PixelBoy wanted to do for the Colecovision.

 

And make in sort it works also for MSX ,SG1000 , SMS... and why not NES.

Way too much work! :)

 

Then i will put a giant statue of you in my garden!!!

:lol: :lolblue: :lol: :lolblue:

Link to comment
Share on other sites

That Applecatcher looks like the start of a great Kaboom-style game.

 

I think the speed should stay slow for the first level, as you have it, but make the level shorter (fewer apples to catch) and have the next level pick up the pace quicker. The first level of a game should be easy enough that even a Grandma can complete it, but then start bringing on the challenge quicker.

 

And yes, I think the plain black background needs some graphics to spruce it up visually.

 

Great start!

Link to comment
Share on other sites

I'm just thinking.

 

Take the same thing , generate asm for Colecovision and you have the BasicVision that PixelBoy wanted to do for the Colecovision.

 

And make in sort it works also for MSX ,SG1000 , SMS... and why not NES.

 

Then i will put a giant statue of you in my garden!!!

 

Actually, haroldoop and nitrofurano have already made some progress on ZX Basic ports for the SMS and Coleco. A programmer of your caliber could probably pick up where they left off easy :)

  • Like 1
Link to comment
Share on other sites

That Applecatcher looks like the start of a great Kaboom-style game.

 

I think the speed should stay slow for the first level, as you have it, but make the level shorter (fewer apples to catch) and have the next level pick up the pace quicker. The first level of a game should be easy enough that even a Grandma can complete it, but then start bringing on the challenge quicker.

 

And yes, I think the plain black background needs some graphics to spruce it up visually.

 

Great start!

I'm not talking about the speed, but the acceleration. It makes the game perceivable sluggish. There are ways to affect the perception of speed without changing the balance or difficulty. It's a matter of polish.

 

Just saying...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...