Jump to content
IGNORED

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


Recommended Posts

Ok. No questions in a while. So now we are all pros? :)

Just one. for doesn't count backward.

 

for example,

 

for i=239 to 0

poke $200+i,0

next i

 

One work around I found is

i=239

while i<>0 then

poke $200+i,0

i=i-1

wend

 

Just glanced at the manual just now, maybe I needed to add step -1

 

for i=239 to 0 step -1

 

I think I answered my own question. This is why I don't ask question often. ;)

  • Like 1
Link to comment
Share on other sites

Perhaps the compiler should generate an error if the termination value of a loop is less than its starting value and no negative step amount is supplied.

That's not really a good idea. A program may depend on the fact that a variable has decrement below a threshold and expect the loop to be skipped.

 

You can't predict it when the counter values are variables and the normal "BASIC" expected behaviour is for the loop to not execute.

Link to comment
Share on other sites

That's not really a good idea. A program may depend on the fact that a variable has decrement below a threshold and expect the loop to be skipped.

 

You can't predict it when the counter values are variables and the normal "BASIC" expected behaviour is for the loop to not execute.

 

In the case of constants you know the start and end limits at compile time.

  • Like 1
Link to comment
Share on other sites

 

In the case of constants you know the start and end limits at compile time.

Well of course, but then you have special code that offers one behaviour on Mondays, Tuesdays, and Wednesdays, and different a behaviour on Thursdays and Fridays, and God knows what it does when the noon is full. :P

 

Unpredictability and I consistency is the enemy of programmer productivity. :)

 

That said, I can't see it ever being valid to have the initial constant being lower than the maximum, so perhaps it wouldn't be too bad as a warning.

 

dZ.

Link to comment
Share on other sites

While I have it on my mind, a reminder that a compiler flag for OPTION EXPLICIT style variable declarations enfocement would have come in real handy about 3 months ago ;)

 

Working hard for the programmer ;) https://github.com/nanochess/IntyBASIC/commit/92c94d655110195ae5f764919d9133ccfb23d8ff

  • Like 2
Link to comment
Share on other sites

 

In the case of constants you know the start and end limits at compile time.

 

 

Well of course, but then you have special code that offers one behaviour on Mondays, Tuesdays, and Wednesdays, and different a behaviour on Thursdays and Fridays, and God knows what it does when the noon is full. :P

 

Unpredictability and I consistency is the enemy of programmer productivity. :)

 

That said, I can't see it ever being valid to have the initial constant being lower than the maximum, so perhaps it wouldn't be too bad as a warning.

 

dZ.

 

Hmmm... so something like this ;) https://github.com/nanochess/IntyBASIC/commit/a225e142c161aa0767ac36c1ba96b5f05a9cab87

Link to comment
Share on other sites

At least in every Microsoft BASIC implementation I have encountered, a FOR loop always runs at least once before the TO statement is checked. Thus FOR i=239 TO 0 without the STEP argument would assign 239 to i, execute the loop once, increase i by one, check if it is zero and then exit, unless of course the variable i is furthermore modified inside the loop.

 

Edit: Nope, changing the variable inside the loop doesn't affect FOR behavior for the case where start > end. However you can make interesting things.

 

 

10 poke36878,15:dx=1.5:l=0
15 fori=170to250:poke36875,i:i=i-dx:ifi<128theni=128:dx=-dx
17 ifi>200andl<15thendx=-dx*1.5:i=200:l=l+1
20 next:printi
Edited by carlsson
  • Like 2
Link to comment
Share on other sites

Oh yea, now I remembered the questions.

 

Is there something like case/break for IntyBASIC. As the list of objects behavior list grows, the slower the game goes.(Hey it rhymes.) When I switch from if's to case/break series in Rockcutter, the chance of slowdown decreased by a lot.

 

What the other question I had. I knew I should have written it down... I'll spam err post the question later when it come back to me within a couple minutes.

Link to comment
Share on other sites

New in version 1.2.8: (download in first post)

  • 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! ;)

  • Like 3
Link to comment
Share on other sites

Ok. No questions in a while. So now we are all pros? :)

 

Hey Oscar, I think I've run into something new. Unless someone's mentioned this before and I've forgotten:

 

When I run an IntyBASIC game on a Sears console, it very quickly displays the standard EXEC titlescreen with "IntyBASIC program" as title and whatever random year you threw into the headers. On other consoles, this is entirely bypassed.

 

I don't even know if this is fixable, from what I understand about how you're bypassing the EXEC. It's brief, but it does show up every time you hit reset.

 

Link to comment
Share on other sites

 

Could you elaborate on this? I've had no issues running my stuff on the LTO Flash, including games that save to its internal flash memory. You have me worried though.

 

 

I stumble upon this when using the --cc3 flag of IntyBASIC, LTO Flash woudn't detect the ROM file correctly and would run without the extra RAM memory until the flags where "=RW"

Link to comment
Share on other sites

 

Hey Oscar, I think I've run into something new. Unless someone's mentioned this before and I've forgotten:

 

When I run an IntyBASIC game on a Sears console, it very quickly displays the standard EXEC titlescreen with "IntyBASIC program" as title and whatever random year you threw into the headers. On other consoles, this is entirely bypassed.

 

I don't even know if this is fixable, from what I understand about how you're bypassing the EXEC. It's brief, but it does show up every time you hit reset.

 

 

I didn't knew.

Link to comment
Share on other sites

 

I stumble upon this when using the --cc3 flag of IntyBASIC, LTO Flash woudn't detect the ROM file correctly and would run without the extra RAM memory until the flags where "=RW"

 

OK, so it doesn't affect JLP use - cool :D

 

 

I didn't knew.

 

Yeah, I doubt anyone has tested an IntyBASIC game on a Sears console yet (I think there's only been one IntyBASIC game on cart so far, and the LTO Flash was just released. Let me know if I can help out somehow, if you don't have a Sears console. Desert Bus will just have to live with this as a bug for now.

 

Also, THANK YOU for DATA PACKED. I've been doing it manually for a while now; this will save me loads of time. Now I just have to see if reading/decoding is any simpler, or if you've just done what I do (sounds like it, from your description).

  • Like 1
Link to comment
Share on other sites

New in version 1.2.8: (download in first post)

  • 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

Enjoy it! ;)

Well, that's two things I could have used 3 months ago ;)

Thanks, it will be a great help for my next game!

  • Like 1
Link to comment
Share on other sites

 

Hey Oscar, I think I've run into something new. Unless someone's mentioned this before and I've forgotten:

 

When I run an IntyBASIC game on a Sears console, it very quickly displays the standard EXEC titlescreen with "IntyBASIC program" as title and whatever random year you threw into the headers. On other consoles, this is entirely bypassed.

 

I don't even know if this is fixable, from what I understand about how you're bypassing the EXEC. It's brief, but it does show up every time you hit reset.

 

Doesn't intvsteve have a sears? He has everything else...

Link to comment
Share on other sites

New in version 1.2.8: (download in first post)

  • 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! ;)

 

Hi, Oscar,

 

Perhaps it's something small, but you may want to consider the consistency of the "OPTION" keyword. It seems rather strange and unintuitive that "OPTION EXPLICIT" enables strict variable declarations, while "OPTION WARNINGS" disables warnings. Why not disable warnings by default and allow people to turn them on with the option? That way, IntyBASIC is permissive out of the box like typical BASIC.

 

-dZ.

Link to comment
Share on other sites

 

Hi, Oscar,

 

Perhaps it's something small, but you may want to consider the consistency of the "OPTION" keyword. It seems rather strange and unintuitive that "OPTION EXPLICIT" enables strict variable declarations, while "OPTION WARNINGS" disables warnings. Why not disable warnings by default and allow people to turn them on with the option? That way, IntyBASIC is permissive out of the box like typical BASIC.

 

-dZ.

 

Well, the syntax for OPTION WARNINGS requires ON/OFF, so it is OPTION WARNINGS ON or OPTION WARNINGS OFF.

 

The syntax for OPTION EXPLICIT is per Visual BASIC, you can have the following:

 

OPTION EXPLICIT         ' Same as ON
OPTION EXPLICIT ON
OPTION EXPLICIT OFF
Link to comment
Share on other sites

 

 

Well, the syntax for OPTION WARNINGS requires ON/OFF, so it is OPTION WARNINGS ON or OPTION WARNINGS OFF.

 

The syntax for OPTION EXPLICIT is per Visual BASIC, you can have the following:

OPTION EXPLICIT         ' Same as ON
OPTION EXPLICIT ON
OPTION EXPLICIT OFF

 

Ah! That's good! :) :thumbsup:

 

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