Jump to content

Photo

IntyBASIC compiler v1.2.8: The good things are now better!

Intellivision IntyBASIC

247 replies to this topic

#1 nanochess OFFLINE  

nanochess

    River Patroller

  • 4,637 posts
  • Coding something good
  • Location:Mexico, Mexico

Posted Sat Aug 8, 2015 2:45 PM

Hi guys.
 
I got extra inspiration for this version after fighting with complex IF in one line, now you can use block structured IF while preserving the old-style IF, even better the new DO/LOOP statement construct and a way to exit loops with EXIT. Check the manual for the full syntax.

Also some enhancements to DEF FN to make it more powerful. The IntyColor utility got a much needed revamp, now it allows to use MOBs in your images for extra graphics definition, automatically or with an instructions file provided by you ;)
 
Note: if you have downloaded version 1.2 before, download now latest one, it solves a bug when compiling the multiline IF statement.
 
Changes, enhancements and fixes in version 1.2:

  • Support for multiline IF/ELSEIF/END IF
  • Added statement DO WHILE expr...LOOP, DO UNTIL expr...LOOP, DO...LOOP WHILE expr, DO...LOOP UNTIL expr.
  • Added statement EXIT, use as: EXIT FOR, EXIT WHILE or EXIT DO.
  • Added #BACKTAB array to access screen directly (without using PEEK/POKE)
  • DEF FN now accepts strings in definition.
  • New LEN() function to get size of string.
  • New POS() function to get current screen position.
  • Initializes ECS sound generator.
  • Added automatic seed of pseudorandom generator with RAM trash (courtesy of GroovyBee)
  • Warnings now can be disabled with option -w
  • Macro replacement now accepts string as arguments.
  • Shows file causing error or warning when inside INCLUDE. (some very big programs developed in IntyBASIC were needing this ;) )
  • Optimized generation of code for plus constant followed by minus constant.
  • Optimized generation of code for POKE.
  • Solved bug where nested macros doesn't worked.
  • Solved several bugs in macros for multiplication by constant (not so used numbers)
  • Added a new contribution (tcg.bas) by Catsfolly.
  • Superb enhancements for IntyColor utility: (run without arguments to see usage)
    • Option -m for creating MOB automatically (for third/fourth color in same block)
    • Option -c to not include constants.c (option -m)
    • Option -r to create BMP report colored (error/GRAM/GROM)
    • Option -g to indicate how to use the MOB (use with -m)
    • Options -fx and -fy to flip in X and Y directions.

New in version 1.2.2:

  • Support for reading/writing JLP in-flash memory using the FLASH statement, now you can make your game to save your high-score tables, achievements, current position in game, etc. (new sample flash.bas)
  • Stack is now always allocated to system memory, some things moved in intybasic_epilogue.asm.
  • Generates warnings when using constants bigger than 8 bits for assignment to 8-bits variables or for TO value.
  • Generates errors if labels are redefined, undefined and warnings if never used. (instead of waiting for assembler pass to catch them)
  • New contribution 42k.bas by GroovyBee, shows how to make a maximum-sized IntyBASIC program.

New in version 1.2.3:

  • Added SIGNED statement to indicate arrays or variables of 8-bits signed. At start of your program, for example, add SIGNED a,my_array,b,c
  • SPRITE statement now allows expression on MOB index. So it's easy to write FOR A=0 TO 7:SPRITE A,0:NEXT A
  • SCREEN allows for sixth argument to support a wide origin screen, useful for horizontal scrolling or to display a fraction of a big map. (check landscape.bas)
  • Solved bug where warnings were treated as errors for final return code of command line. (it interrupted SDK compilation)
  • Solved bug where some warnings couldn't be disabled.
  • Solved bug where 16-bits variables counting was wrong.
  • New sample: landscape.bas (additional SCREEN syntax)

New in version 1.2.4:

  • Optimizes sequences of ANDI/XORI instructions.
  • Gives warning in case of assignment to variable previously declared as CONST.
  • Solved bug where ELSEIF had to be finished with ELSE.
  • A few warnings returned wrongly an error code in command-line.
  • Warns about assignment to variables reserved for IntyBASIC use.
  • Updated constants.bas
  • IntyColor: Updated for new SCREEN syntax.
  • IntyColor: MOB data for assembler mode output is now in hardware order and generates better data.
  • IntyColor: Solved color bug introduced in 1.2.1

New in version 1.2.5:

  • Added UNSIGNED statement, allows to make unsigned comparisons.
  • Added PLAY VOLUME statement.
  • Added NO DRUMS syntax to PLAY.
  • Added MUSIC JUMP statement.
  • Added MUSIC.PLAYING expression.
  • Added CALL statement (like USR but outside expressions)
  • DATA allows for string literal.
  • DO statement followed by colon now isn't taken as label.
  • Corrected bug in PAL detection.
  • Updated constants.bas (corrections and new constants for Coloured Squares mode) and keypad.bas sample.
  • Added contrib/ColouredSquares.bas a sample of drawing lines in Coloured Squares mode by GroovyBee.
  • Added samples/bats.bas (animated bats)
  • Added samples/envelope.bas (using envelope sounds)

New in version 1.2.6:

  • Detects when PROCEDURE isn't finished at end of source code. Also starting a new PROCEDURE without closing the previous one now is an error instead of a warning.
  • Added DATA VARPTR to allow arrays of pointers to arrays and/or variables.
  • Generates warning when using DEFINE and requesting more than 16 GRAM to define.
  • Internal: the mode_select variable now preserves in bit 0 the actual mode.
  • Solved bugs in multiplication by 126 and 127.
  • Solved bug in usage of JLP acceleration. (wrongly cached registers)
  • Corrected contrib/clowns.bas (catsfolly) it broke with a change in constants.bas
  • Added contrib/Gram2GromFont.bas (GroovyBee) showing how to take the GROM font and creating an entirely new font.
  • Added contrib/TinyFont.bas (GroovyBee) showing how to display 40 columns using a 4 pixel wide font.
  • Added manual notes about assembly language conventions for USR and CALL.

New in version 1.2.7:

  • Allows to concatenate lines using the character \ at the end of a line. (suggested by GroovyBee)
  • Now optimizes access to arrays when using same index even if different array or offset. (double speed in common cases!!! intvnut suggested it a long of time ago)
  • Solved bug where DEFINE VARPTR swallowed one extra lexical component.
  • Solved bug where 1024-x*x generated wrong code.
  • Solved bug where PRINT "string" as first statement would write in non-screen memory.
  • Minor edit in manual (definition of BORDER)

New in version 1.2.8:

  • Added DATA PACKED for strings, same as DATA but fits two characters per word.
  • Added OPTION EXPLICIT to force declaration of variables using DIM (without index), for example DIM A,B
  • Added OPTION WARNINGS to disable compilation warnings.
  • Warns about strange use of constants in FOR/NEXT
  • Changed CC3/JLP memory flags to "=RM" for as1600 (needed for LTO-Flash)
  • Solved three minor bugs. (optimization: reused register already trashed, weird expression a<5>b crashing, array optimization would trigger as1600 error because of "big" constant)

Enjoy it! ;)

Attached Files


Edited by nanochess, Fri Oct 7, 2016 5:29 PM.


#2 DZ-Jay OFFLINE  

DZ-Jay

    Quadrunner

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

Posted Sun Aug 9, 2015 8:45 AM

IntyBASIC SDK v1.2 coming real soon!



#3 Shalmezad OFFLINE  

Shalmezad

    Space Invader

  • 17 posts

Posted Tue Aug 11, 2015 9:13 AM

 

  • Support for multiline IF/ELSEIF/END IF

:-o
Normally, I prefer holding off on updating things for a bit, but I think I can make an exception this time. :grin:
Thanks for the update!



#4 nanochess OFFLINE  

nanochess

    River Patroller

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

Posted Wed Aug 19, 2015 4:26 PM

Updated to version 1.2.1, it solves an important bug in multiline IF statement also avoids to get stuck when processing macro call with syntax errors.

 

New things:

 

o Added #BACKTAB array (direct access to screen)
o Optimized code generation for POKE.
o Optimized plus constant followed by minus constant.

o New options -fx and -fy for IntyColor, flips image in X and Y directions. (suggested by First Spear)

o Updated tcg.bas contribution by catsfolly



#5 freewheel OFFLINE  

freewheel

    River Patroller

  • 2,861 posts

Posted Wed Aug 19, 2015 6:59 PM


o Added #BACKTAB array (direct access to screen)

 

This doesn't consume valuable memory, does it? :) I assume you're just doing some clever lookups under the covers like we've all done manually up till now.



#6 nanochess OFFLINE  

nanochess

    River Patroller

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

Posted Wed Aug 19, 2015 9:02 PM

 

This doesn't consume valuable memory, does it? :) I assume you're just doing some clever lookups under the covers like we've all done manually up till now.

 

Doesn't use extra memory. It's a shadow over the real BACKTAB buffer, you can write directly to screen like an array.

 

Given the small memory capacity of Intellivision (although a lot more than Atari VCS) I'm very careful to not add new variables and instead trying to reduce memory footprint.



#7 nanochess OFFLINE  

nanochess

    River Patroller

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

Posted Mon Aug 24, 2015 2:07 PM

Updated to version 1.2.2 with support for erasing/reading/writing JLP Flash memory ;) (check first post)
 
Now you can make your games to save high-score tables, achievements, positions and so.

BTW, forgot to put this in manual:
    Don't forget to use the option --jlp in jzintv and --jlp-savegame=file
I remember promising this support more than one year ago :grin:

#8 carlsson ONLINE  

carlsson

    River Patroller

  • 4,243 posts
  • Location:Västerås, Sweden

Posted Tue Sep 1, 2015 2:04 PM

I might be missing something, but inspired by atari2600land's thread, I compiled this very simple program:

 

score = 0

 

On both IntyBASIC 1.1 and 1.2.1, the output says the program uses 1 8-bit variable of 228 available and 0 16-bit variables of 47 available.

On IntyBASIC 1.2.2, the output says the program uses 1 8-bit variable of 228 available and 1 16-bit variable of 47 available.

 

Further testing suggests that with 1.2.2, for each 8-bit variable declared, the number of 16-bit variables also is increased, but for each 16-bit variable, the counter on 8-bit variables is untouched as it should. Has anyone else noticed this?



#9 nanochess OFFLINE  

nanochess

    River Patroller

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

Posted Tue Sep 1, 2015 2:49 PM

I might be missing something, but inspired by atari2600land's thread, I compiled this very simple program:

score = 0

On both IntyBASIC 1.1 and 1.2.1, the output says the program uses 1 8-bit variable of 228 available and 0 16-bit variables of 47 available.

On IntyBASIC 1.2.2, the output says the program uses 1 8-bit variable of 228 available and 1 16-bit variable of 47 available.

 

Further testing suggests that with 1.2.2, for each 8-bit variable declared, the number of 16-bit variables also is increased, but for each 16-bit variable, the counter on 8-bit variables is untouched as it should. Has anyone else noticed this?

 

A bug, just I'm uploading v1.2.3 ;)



#10 nanochess OFFLINE  

nanochess

    River Patroller

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

Posted Tue Sep 1, 2015 2:55 PM

Just updated IntyBASIC to version 1.2.3 (check first post)



#11 First Spear OFFLINE  

First Spear

    Stargunner

  • 1,020 posts

Posted Tue Sep 1, 2015 8:01 PM

The new Sprite and Landscape stuff is really, really good. Thank you!

 

[snip]

  • Added SIGNED statement to indicate arrays or variables of 8-bits signed. At start of your program, for example, add SIGNED a,my_array,b,c
  • SPRITE statement now allows expression on MOB index. So it's easy to write FOR A=0 TO 7:SPRITE A,0:NEXT A
  • SCREEN allows for sixth argument to support a wide origin screen, useful for horizontal scrolling or to display a fraction of a big map. (check landscape.bas)
  • Solved bug where warnings were treated as errors for final return code of command line. (it interrupted SDK compilation)
  • Solved bug where some warnings couldn't be disabled.
  • Solved bug where 16-bits variables counting was wrong.
  • New sample: landscape.bas (additional SCREEN syntax)

 

Enjoy it! ;)



#12 Kiwi ONLINE  

Kiwi

    Stargunner

  • 1,345 posts

Posted Tue Sep 1, 2015 9:45 PM

Oscar, you're super awesome.  :thumbsup: :thumbsup: :thumbsup:



#13 nanochess OFFLINE  

nanochess

    River Patroller

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

Posted Wed Sep 2, 2015 10:13 PM

BTW, I encourage everyone to post sample codes to show how you solved your milestones, tips & techniques and so with IntyBASIC.

 

:) :thumbsup:



#14 artrag OFFLINE  

artrag

    Dragonstomper

  • 652 posts

Posted Mon Sep 7, 2015 12:34 AM

While testing the last features of version 1.2.3, I went to this statement:

 

 
	WAIT
	if (s=0) then
		SCREEN screen_0+wframe*(11*15),0,2,15,11,15
		wframe = (wframe+1) and 3
	end if		

I wanted to flip 4 blocks of  15x11 from ROM, but the compiler gives a strange warning, aborting compilaton:

 

 
IntyBASIC compiler v1.2 Sep/01/2015
© 2014-2015 Oscar Toledo G. http://nanochess.org/
 
Warning: invalid extra characters in line 45
23 used 8-bit variables of 228 available
1 used 16-bit variables of 47 available
Compilation finished
 
 
IntyBASIC compilation failed.
Program build aborted.
 
It seems that no expression is allowed on the label parameter and that the compiler does not report correctly the error.
 
I ended to use this:

		on  wframe goto f0,f1,f2,f3
f0:			SCREEN screen_0,0,2,15,11,15: goto f4
f1:			SCREEN screen_1,0,2,15,11,15: goto f4
f2:			SCREEN screen_2,0,2,15,11,15: goto f4
f3:			SCREEN screen_3,0,2,15,11,15
f4:		wframe = (wframe+1) and 3

I was wandering about having as parametric expression the label where the screen has been stored.

Is it possible somehow ?

 

[ Maybe something like VARPTR label(expr) as in DEFINE may work ;-) ]

 

 

Attached Files


Edited by artrag, Mon Sep 7, 2015 12:43 AM.


#15 DZ-Jay OFFLINE  

DZ-Jay

    Quadrunner

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

Posted Mon Sep 7, 2015 6:28 AM

While testing the last features of version 1.2.3, I went to this statement:

 

 
	WAIT
	if (s=0) then
		SCREEN screen_0+wframe*(11*15),0,2,15,11,15
		wframe = (wframe+1) and 3
	end if		

I wanted to flip 4 blocks of  15x11 from ROM, but the compiler gives a strange warning, aborting compilaton:

 

 
IntyBASIC compiler v1.2 Sep/01/2015
© 2014-2015 Oscar Toledo G. http://nanochess.org/
 
Warning: invalid extra characters in line 45
23 used 8-bit variables of 228 available
1 used 16-bit variables of 47 available
Compilation finished
 
 
IntyBASIC compilation failed.
Program build aborted.
 
It seems that no expression is allowed on the label parameter and that the compiler does not report correctly the error.
 
I ended to use this:

		on  wframe goto f0,f1,f2,f3
f0:			SCREEN screen_0,0,2,15,11,15: goto f4
f1:			SCREEN screen_1,0,2,15,11,15: goto f4
f2:			SCREEN screen_2,0,2,15,11,15: goto f4
f3:			SCREEN screen_3,0,2,15,11,15
f4:		wframe = (wframe+1) and 3

I was wandering about having as parametric expression the label where the screen has been stored.

Is it possible somehow ?

 

[ Maybe something like VARPTR label(expr) as in DEFINE may work ;-) ]

 

 

 

I think that all statements that take a label should accept a VARPTR() expression as well.  I know that Oscar has been adding this in some statements, so maybe it's just a matter of time.

 

About the error, are you using "include"?  Because the compiler tends to report the line number of the final composite source stream, instead of the local line of the specific source file that caused the exception.  That's not very helpful, but it has been reported already as a bug, so perhaps it'll be fixed soon.

 

The ROM looks good, although it does not have my name this time. ;)

 

(Just kidding, artrag!  It's looking cool.)



#16 nanochess OFFLINE  

nanochess

    River Patroller

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

Posted Mon Sep 7, 2015 9:31 AM

While testing the last features of version 1.2.3, I went to this statement:

 

 
	WAIT
	if (s=0) then
		SCREEN screen_0+wframe*(11*15),0,2,15,11,15
		wframe = (wframe+1) and 3
	end if		

I wanted to flip 4 blocks of  15x11 from ROM, but the compiler gives a strange warning, aborting compilaton:

 

 
IntyBASIC compiler v1.2 Sep/01/2015
© 2014-2015 Oscar Toledo G. http://nanochess.org/
 
Warning: invalid extra characters in line 45
23 used 8-bit variables of 228 available
1 used 16-bit variables of 47 available
Compilation finished
 
 
IntyBASIC compilation failed.
Program build aborted.
 
It seems that no expression is allowed on the label parameter and that the compiler does not report correctly the error.
 
I ended to use this:

		on  wframe goto f0,f1,f2,f3
f0:			SCREEN screen_0,0,2,15,11,15: goto f4
f1:			SCREEN screen_1,0,2,15,11,15: goto f4
f2:			SCREEN screen_2,0,2,15,11,15: goto f4
f3:			SCREEN screen_3,0,2,15,11,15
f4:		wframe = (wframe+1) and 3

I was wandering about having as parametric expression the label where the screen has been stored.

Is it possible somehow ?

 

[ Maybe something like VARPTR label(expr) as in DEFINE may work ;-) ]

 

 

 

You can accomplish exactly the same using:

 

SCREEN screen_0,wframe*(11*15),2,15,11,15

 

It's not obvious immediatly but the parameter following screen_0 is added to screen_0 ;)



#17 artrag OFFLINE  

artrag

    Dragonstomper

  • 652 posts

Posted Mon Sep 7, 2015 2:36 PM

Great! Thanks.

 

PS

This segment of code:
for n=0 to 7
WAIT:DEFINE DEF00+n*8,8,sprites+(n*64)
next

generates the very same warning I had above with SCREEN:

 

 
IntyBASIC compiler v1.2 Sep/01/2015
© 2014-2015 Oscar Toledo G. http://nanochess.org/
 
Warning: invalid extra characters in line 24
 

where line 24 is the DEFINE statement.

 

 

PS
More extra nasty aliens in this rom

 

Attached Files


Edited by artrag, Mon Sep 7, 2015 2:59 PM.


#18 nanochess OFFLINE  

nanochess

    River Patroller

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

Posted Mon Sep 7, 2015 4:57 PM

Great! Thanks.

 

PS

This segment of code:
for n=0 to 7
WAIT:DEFINE DEF00+n*8,8,sprites+(n*64)
next

generates the very same warning I had above with SCREEN:

 

 
IntyBASIC compiler v1.2 Sep/01/2015
© 2014-2015 Oscar Toledo G. http://nanochess.org/
 
Warning: invalid extra characters in line 24
 

where line 24 is the DEFINE statement.

 

 

PS
More extra nasty aliens in this rom

 

 

From the manual definition for DEFINE :) rewrite as this:

for n=0 to 7
WAIT:DEFINE DEF00+n*8,8,VARPTR sprites(n*32)
next

It's 32 because two BITMAP statements fit in one word of memory, so each sprite of 8x8 uses 4 words of memory. So 4 words * 8 sprites = 32

 

BTW, you really really should enter in the IntyBASIC contest with this current demo at least :)



#19 nanochess OFFLINE  

nanochess

    River Patroller

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

Posted Mon Sep 14, 2015 6:38 PM

Just found a small bug in syntax parsing, the following code will generate an error in assembly:

    IF expr THEN
    ELSEIF expr THEN
    END IF

This can be solved including an extra ELSE before END IF, you don't need to put any code:

    IF expr THEN
    ELSEIF expr THEN
    ELSE
        ' Bug patch
    END IF

It will be solved in next IntyBASIC version.



#20 Kiwi ONLINE  

Kiwi

    Stargunner

  • 1,345 posts

Posted Mon Sep 14, 2015 11:33 PM

I've used 'on frame' for the first time today.  I used it as a sound effect player.  

on frame gosub SoundFXEn

And my current sound function.
 

SoundFXEn:procedure
if SL=0 then sound 0,0,0 else SOUND 0,sound(SL+SPointer),V:SL=SL-1
if SL2=0 then sound 1,0,0 else SOUND 1,sound2(SL2+SPointer2),V2:SL2=SL2-1
return
end

I no longer have to reserved 16 words for sound data. I don't have to worry about having sound statement in the gameloop and outside of it, have the sound frozen, or have the sound play slower due to slowdown. 



#21 artrag OFFLINE  

artrag

    Dragonstomper

  • 652 posts

Posted Tue Sep 15, 2015 1:02 PM

Very nice, I was thinking to try something very similar. My idea was to support the .sfx file format from the ayfx ditor for ay8910 used for msx, zx spectrum and amstrad https://shiru.unterg.../ayfxedit04.zip
In case Oscar wants to add an asm sfx replayer to intybasic... :)

Edited by artrag, Tue Sep 15, 2015 1:03 PM.


#22 artrag OFFLINE  

artrag

    Dragonstomper

  • 652 posts

Posted Tue Sep 15, 2015 3:16 PM

PS

does the music command set somehow the register that mix noise and tunes ? I think that play music and sound could "interfere" each other on the setting on the mixer register (on AY8910 it is register 7, it should be the same on AY8912)

 

PPS

According to the manual, PLAY SIMPLE should reserve the 3rd channel to sfx

Nevertheless in this test in attach the sound of the bullets seems to interfere with the music.

Attached Files


Edited by artrag, Tue Sep 15, 2015 3:21 PM.


#23 nanochess OFFLINE  

nanochess

    River Patroller

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

Posted Thu Sep 17, 2015 9:14 AM

PS
does the music command set somehow the register that mix noise and tunes ? I think that play music and sound could "interfere" each other on the setting on the mixer register (on AY8910 it is register 7, it should be the same on AY8912)
 
PPS
According to the manual, PLAY SIMPLE should reserve the 3rd channel to sfx
Nevertheless in this test in attach the sound of the bullets seems to interfere with the music.


The music player always use the noise channel.

#24 nanochess OFFLINE  

nanochess

    River Patroller

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

Posted Wed Sep 30, 2015 4:06 PM

Just updated to version 1.2.4, mainly bug fixes and some small enhancements. :)

 

Check first post.



#25 artrag OFFLINE  

artrag

    Dragonstomper

  • 652 posts

Posted Wed Sep 30, 2015 4:32 PM

Shouldn't  this constant CONST DISC_SOUTH_WEST = $0025 be $0019 ?

 

You fixed DISC_SW in the same way







Also tagged with one or more of these keywords: Intellivision, IntyBASIC

0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users