Jump to content

Photo

IntyBASIC compiler


165 replies to this topic

#101 catsfolly ONLINE  

catsfolly

    Dragonstomper

  • 697 posts
  • Location:Japan

Posted Fri Feb 7, 2014 7:36 AM

 

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, Fri Feb 7, 2014 8:26 AM.


#102 nanochess ONLINE  

nanochess

    River Patroller

  • Topic Starter
  • 4,501 posts
  • Coding something good
  • Location:Mexico, Mexico

Posted Fri Feb 7, 2014 1:03 PM

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.



#103 DZ-Jay OFFLINE  

DZ-Jay

    Quadrunner

  • 9,734 posts
  • Triple-Stripe Mo' Bro
  • Location:NC, USA

Posted Sat Feb 8, 2014 5:56 AM

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.



#104 nanochess ONLINE  

nanochess

    River Patroller

  • Topic Starter
  • 4,501 posts
  • Coding something good
  • Location:Mexico, Mexico

Posted Sat Feb 8, 2014 7:05 AM

 

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.



#105 DZ-Jay OFFLINE  

DZ-Jay

    Quadrunner

  • 9,734 posts
  • Triple-Stripe Mo' Bro
  • Location:NC, USA

Posted Sat Feb 8, 2014 7:57 AM

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, Sat Feb 8, 2014 7:59 AM.


#106 nanochess ONLINE  

nanochess

    River Patroller

  • Topic Starter
  • 4,501 posts
  • Coding something good
  • Location:Mexico, Mexico

Posted Sat Feb 8, 2014 8:22 AM

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.



#107 DZ-Jay OFFLINE  

DZ-Jay

    Quadrunner

  • 9,734 posts
  • Triple-Stripe Mo' Bro
  • Location:NC, USA

Posted Sat Feb 8, 2014 8:41 AM

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.



#108 Kiwi OFFLINE  

Kiwi

    Stargunner

  • 1,303 posts

Posted Sat Feb 8, 2014 10:28 PM

Applecatcherwip.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. 



#109 retroillucid OFFLINE  

retroillucid

    Facebook.com/Collectorvision

  • 7,252 posts
  • CollectorVision Games - Publishing Homebrew
  • Location:Montreal, Canada

Posted Sat Feb 8, 2014 10:51 PM

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:



#110 nanochess ONLINE  

nanochess

    River Patroller

  • Topic Starter
  • 4,501 posts
  • Coding something good
  • Location:Mexico, Mexico

Posted Sat Feb 8, 2014 11:09 PM


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.



#111 Rev OFFLINE  

Rev

    A.K.A. Revolutionika

  • 14,862 posts
  • Location:NC

Posted Sun Feb 9, 2014 1:00 AM

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. 



#112 retroillucid OFFLINE  

retroillucid

    Facebook.com/Collectorvision

  • 7,252 posts
  • CollectorVision Games - Publishing Homebrew
  • Location:Montreal, Canada

Posted Sun Feb 9, 2014 1:00 AM

 

 

 

Nice, It reminds me of Kaboom a little. 

EXACTLY my thoughs! 



#113 GroovyBee OFFLINE  

GroovyBee

    Games Developer

  • 9,675 posts
  • Busy bee!
  • Location:North, England

Posted Sun Feb 9, 2014 3:44 AM

Here is my progress with this simple game I'm making with IntyBASIC.


Cool! Maybe its time it had its own development thread ;).

#114 DZ-Jay OFFLINE  

DZ-Jay

    Quadrunner

  • 9,734 posts
  • Triple-Stripe Mo' Bro
  • Location:NC, USA

Posted Sun Feb 9, 2014 6:28 AM

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!



#115 Kiwi OFFLINE  

Kiwi

    Stargunner

  • 1,303 posts

Posted Sun Feb 9, 2014 5:17 PM

 

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. 



#116 GroovyBee OFFLINE  

GroovyBee

    Games Developer

  • 9,675 posts
  • Busy bee!
  • Location:North, England

Posted Sun Feb 9, 2014 5:25 PM

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.

#117 DZ-Jay OFFLINE  

DZ-Jay

    Quadrunner

  • 9,734 posts
  • Triple-Stripe Mo' Bro
  • Location:NC, USA

Posted Sun Feb 9, 2014 6:32 PM

Take a look at the CART.MAC that comes with the SDK-1600: it prepares two distinct memory maps:  16K and 42K.  The former is for large "classic" cartridges, the latter is for the special JLP boards.

 

      -dZ.



#118 Kiwi OFFLINE  

Kiwi

    Stargunner

  • 1,303 posts

Posted Sun Feb 9, 2014 8:34 PM

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. 



#119 nanochess ONLINE  

nanochess

    River Patroller

  • Topic Starter
  • 4,501 posts
  • Coding something good
  • Location:Mexico, Mexico

Posted Sun Feb 9, 2014 10:39 PM

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.

#120 youki OFFLINE  

youki

    River Patroller

  • 2,198 posts

Posted Mon Feb 10, 2014 2:41 AM

How did i miss that thread!!!..

 

You are really Incredible Nanochess!!...

 

Now, i have what i need to start Ghost'n Zombie on IntTV!!   .... just one thing is missing... Time!.  



#121 youki OFFLINE  

youki

    River Patroller

  • 2,198 posts

Posted Mon Feb 10, 2014 2:47 AM

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!!!



#122 nanochess ONLINE  

nanochess

    River Patroller

  • Topic Starter
  • 4,501 posts
  • Coding something good
  • Location:Mexico, Mexico

Posted Mon Feb 10, 2014 8:33 AM

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:

#123 ls650 OFFLINE  

ls650

    Quadrunner

  • 6,546 posts
  • Atari rocks!
  • Location:British Columbia

Posted Mon Feb 10, 2014 9:19 AM

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!

#124 Gemintronic OFFLINE  

Gemintronic

    Jason S. - Lead Developer & CEO

  • 8,772 posts

Posted Mon Feb 10, 2014 9:49 AM

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 :)



#125 DZ-Jay OFFLINE  

DZ-Jay

    Quadrunner

  • 9,734 posts
  • Triple-Stripe Mo' Bro
  • Location:NC, USA

Posted Mon Feb 10, 2014 11:10 AM

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...




0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users