Omnimaga
Calculator Community => Other Calculators => Topic started by: coolsnake on September 02, 2010, 03:45:02 pm
-
I've had a craving today for a programming language on the pc which is quite similar to TI-Basic.
This craving was mostly fueled by the BasiC++ project here on omnimaga. :P
/Insert rant about how most programming languages are hard, either in use or in syntax.
This is something I created today in TI-Basic. It's a primitive fighting engine with you being the X and the enemy being the Z. If either of you punches your respective character changes to the theta symbol.
(http://a.imageshack.us/img341/6496/tibasic.gif)
This is a direct port in FreeBASIC, a language which I understood in less than one day with the help of one tutorial and the command list. ;D
(http://a.imageshack.us/img713/6058/freebasic.gif)
Moral of the story, you know more of programming than you think + FreeBASIC is awesome. :P
also, port to axe^^
(http://a.imageshack.us/img37/6789/axer.gif)
-
Sweet! So it has many of the similar syntax and commands? Looks really nice :)
-
That looks great! Really want to try it, but it's taking so long to install... :P
-
That looks really cool :) Where can you learn and such? I'll add it to my tutorial thread :D
-
It seems to run faster than TI-BASIC ;)
-
I'm going to guess that's because it's a computer language ;)
-
I wonder if it'll possible to add a language like BASIC to KOS (not exactly like TI-BASIC; something simple and fast).
-
Well I think one of the big reasons TI-BASIC is so slow is because it parses as it runs. So if there was a good way to parse it first then execute or something it would not be as big of an issue.
-
Well I think one of the big reasons TI-BASIC is so slow is because it parses as it runs. So if there was a good way to parse it first then execute or something it would not be as big of an issue.
Wow, the TI community has yet to come up with a working BASIC to ASM converter.
-
People have tried but it's incredibly hard to do. I mean it's sorta like what Quigibo is doing with Axe except you have to take each command and match it up in assembly and ya. Well I think anyways. In short...its hard :P
-
...and an hour and a half later, FreeBASIC is 75% done installing :P
-
now I have an urge to work on BasiC++ :P
-
@DThought: I started installing this compile a few seconds ago. It's done now. :P
-
now I have an urge to work on BasiC++ :P
What is the completion percentage of BasiC++ anyways?
-
@DThought: I started installing this compile a few seconds ago. It's done now. :P
:( Two hours later, it's done. I hate Windows.
And meishe91, http://tinyurl.com/cxkn9u (http://tinyurl.com/cxkn9u) is the manual.
-
right now it is at 0% because it was lost when my hard drive was wiped and I havent worked on it since. My plan has been to start it back up again after I finish piworld, but if I get a strong enough urge to work on it before then I might
you can see what it was like before the wipe happened though: http://i534.photobucket.com/albums/ee348/Miotatsu/Untitled-50.png
also sorry for the offtopicness, FreeBASIC looks cool
-
Ah ok, well that sucks about the hard drive wipe :( But good luck with Piworld in the meantime :)
It looked cool though.
@Deep Thought
Thanks :)
-
Well I think one of the big reasons TI-BASIC is so slow is because it parses as it runs. So if there was a good way to parse it first then execute or something it would not be as big of an issue.
It would still be almost as slow, because of all the floating-point arithmetic. It would also be significantly bigger.
-
@meishe
Hmm....isn't that pretty much what axe does? (well kinda) :P
I know, it converts it to asm, not preparsing per se, but it's a similar idea.
BTW, the concept of parsing before running a program is called compiling :P
Floating point arithmetic.....is there any way around it in TI-Basic?
-
Well I think one of the big reasons TI-BASIC is so slow is because it parses as it runs. So if there was a good way to parse it first then execute or something it would not be as big of an issue.
It would still be almost as slow, because of all the floating-point arithmetic. It would also be significantly bigger.
Ah ok, gotcha. I just read that somewhere or something like that. Probably just misinterpreted or something. What does the floating point do though? Like why does that slow it down?
@meishe
Hmm....isn't that pretty much what axe does? (well kinda) :P
I know, it converts it to asm, not preparsing per se, but it's a similar idea.
BTW, the concept of parsing before running a program is called compiling :P
Floating point arithmetic.....is there any way around it in TI-Basic?
What exactly are you referencing? As for as I know Axe is a language in itself and then you run it through AxeParser which then compiles it into assembly which is just a step up from computer language (binary, correct?) so it parses it very little when it's executed. But with TI-BASIC it runs directly as it is and as it runs the calculator compiles it as it goes, at least that is what I've gotten from reading some things.
Ya, I know. Just couldn't think of the word :P
-
well, kind of. Interpreting means basically what you said.
if you've ever heard of RPG maker 2000 or Game Maker, they are both Interpreted languages, which, like you say, means basically compiling as you go, and forgetting the compiled stuff after it's run.
And yes, but I was just saying axe was a fairly viable super-fast replacement for Ti-basic, and to the first-time user it appears to be doing something similar.
I think the 86 pre-parsed its code, because it would take a while to run after being edited, and take a while to be edited after run. Still only about 84+ speed though (which is amazing considering how much worse of a cpu it has, and the actual parsing it has to do. TI-84 basic only has to read the tokens, while 86 basic has to read real text.)
-
Keep in mind this project is not for calcs, though, it's for the computer. I'll move the topic in the BasiC++ sub-fora to avoid confusion. It's a PC language that is pretty much the same as TI-BASIC. It does games similar to on a calc, but later I think he was planning to add some more stuff so people can do old-skool PC games with the ease of TI-BASIC (and maybe Axe?)
I am glad this is not dead, btw :)
-
Wait, why are you moving this to BasiC++? Miotatsu was just talking about it for a second, FreeBASIC is something completely different. So I think this should really be in Non-Calc-Related Computer Projects And Ideas or something similar.
-
Oh wow, sorry, my bad. When I opened this topic, for some reasons, it went straight to page 2, even thought I did not read the topic at all before. I saw Miotatsu's first post and thought it was a new topic by him about his old BasiC++ project, renamed to FreeBASIC.
I'll need to check harder next time, I didn't know about that forum glitch until now x.x
My apologies again. Gonna move this back to calc section.
Awesome btw, Coolsnake. :)
-
Ah ok, that's what I kinda thought you had done :P What forum glitch?
-
Normally, on the new posts page, when you click a topic name, it takes you to the first post made since the last time you read the topic. However, this time, it took me on page 2 instead of 1, even if I never saw page 1 before. I think that happened before, too, but I'm unsure anymore.
-
Ah ok. Gotcha.
-
I'm glad you all like FreeBASIC. :)
The syntax is kinda the same. Just different words for the same thing :P
The thing I like so much about it is that it handles the command prompt screen almost exactly the same way TI-basic handles the calculator screen.
E.g Output(5,1,"blablabla") becomes
LOCATE 5,1 'places the cursor at that spot
print "blablabla"
-
Hmm, some of it reminds me Casio calculators...
If it's similar to TI-BASIC and Casio BASIC, maybe I could learn it easily :)
-
Hey, it's standalone! Good, I can have it on my thumb drive :)
-
For those who want a jumpstart on how to use FreeBASIC:
http://www.freebasic.net/wiki/wikka.php?wakka=TutGettingStartedQB
http://www.freebasic.net/wiki/wikka.php?wakka=TutHowToProgGame1
I only read those two to make my port from TI-Basic to Freebasic.
The first link shows how to output text, draw lines,draw circles, rectangles.
The second one is more interesting. It shows you how to create a game loop by moving a circle.
It'll introduce you to FB's "GetKey", "ClrHome", loops and the declaration of variables.
They don't take long to read either, it's great!
Look at this page to get a quick peek at all the commands:
http://www.freebasic.net/wiki/wikka.php?wakka=CatPgFullIndex
Hmm, some of it reminds me Casio calculators...
If it's similar to TI-BASIC and Casio BASIC, maybe I could learn it easily :)
Well that's the beauty of it. It may not have the exactly same syntax but It certainly does "feel" like TI-Basic.
I'm really developing to become a FreeBASIC fanboy now. :P
You could also "setup" FreeBASIC to behave alot more like TI-Basic on the calculator.
Here's a quick tutorial:
NOTE: You can get alot of this out of the previously mentioned tutorials too.
If you add the following line to the top of your FreeBASIC source, you get a 16x8 character screen like the one on your calc.
screenres 136,72
If you add these lines to the top you can use the very responsive GetKey from FB(there's also a slower one):
#include "fbgfx.bi"
Using FB
The very responsive GetKey works just like in Axe
MultiKey(SC_KEY)
If you want to use certain variables you have to declare them.
You're probably not used to this in TI-Basic but it's standard fare in computer languages.
DIM as integer A,B,C
DIM as string Str1,Str2
It's pretty straightforward. Here's a link to the datatypes.
http://www.freebasic.net/wiki/wikka.php?wakka=CatPgStdDataTypes
If you want to store variables:
A=10
str1="abc"
The pause command in TI-Basic becomes
Sleep
If you want to pause for 100 milliseconds
Sleep 100,1
If you don't add the ",1" it'll wait for 100 milliseconds OR until a key is pressed. the ",1" disables the latter.
ClrHome becomes
Cls
If your hesistant about using FB's syntax and rather want to use TI-Basic's syntax, you can just add a subroutine to the beginning of your code.
e.g for ClrHome
Sub ClrHome
cls
End sub
And now you can use ClrHome in the same way you use it as in TI-Basic! :D
i'm going to go out on a limb here and say that you can do this for about every TI-Basic command except:
-the (unconventional) storage of variables e.g 10-> B
-Conditionals
-Loops
Here's a subroutine to use the Output command.
Note that I use output1(Y,X,"text") instead of output(Y,X,"text") because there already is a (different) function called output in FB, so I can't just replace it with mine.
sub output1(Y as integer,X as integer,text as string)
locate Y,X
print text
end sub
Also be aware that FB is certainly not limited to the stuff I'm showing you.
Check FB's projects page to see what FB is capable of.
http://www.freebasic.net/forum/viewforum.php?f=8
I kinda smirked at the gameboy emulator thing.
*imagines writing a gameboy emulator in TI-Basic ;D*
-
Nice. I'm really glad there's a TI-BASIC like computer language. I tried VB and C before and I just don't like it. Same for TI-Nspire/89 BASIC, although not as much. I prefer syntaxes like TI-83+ BASIC or Axe. Also I'm glad it is not just limited to text games.
-
Very cool. I'll add that to my Tutorials page.
-
If your hesistant about using FB's syntax and rather want to use TI-Basic's syntax, you can just add a subroutine to the beginning of your code.
e.g for ClrHome
Sub ClrHome
cls
End sub
And now you can use ClrHome in the same way you use it as in TI-Basic! :D
i'm going to go out on a limb here and say that you can do this for about every TI-Basic command except:
-the (unconventional) storage of variables e.g 10-> B
-Conditionals
-Loops
Wow, that's a really useful feature. We should keep track of the particularly useful replacements and post it somewhere...
-
Ok so if we call a command that is not the name of any FreeBASIC command or name used, it will interpret it as an actual sub-routine? Seems kinda nice. Someone could easily write a set of sub-routines that lets someone use pretty much all game programming TI-BASIC commands.
-
Hm, I wonder if FreeBASIC could be changed a bit (meaning the source itself so that it would run TI-BASIC programs perfectly. That would be easier than using an emu!
-
That would be hella awesome :D Or maybe a crossover language for people who know calc programing but want to move onto computer programing
-
Well isn't that essentially what Miotatsu is doing with BasiC++?
-
And I think there was a topic somewhere around here about making an online calc simulator ... what about just a simple TI-BASIC emulator? It would be really helpful to people without an emu on their computer.
-
I've been browsing FB's site for a bit and I think I might be able to create a library for FB. Concretely it means you just need to add two files to the FreeBasic lib directory, add two lines of code to the start of your source code, and presto, pseudo TI Basic. :P
I do consider this a "hackish" attempt though, since it's just mainly renaming known functions. But meh, I've never written a library before and it sounds fun. :D
Hm, I wonder if FreeBASIC could be changed a bit (meaning the source itself so that it would run TI-BASIC programs perfectly. That would be easier than using an emu!
Well FreeBASIC is opensource... But I doubt it would be that easy.^^ It's mainly there so people can use new but potentially unstable versions.
-
One other question about FreeBASIC: if you want people to be able to play your game, do they absolutely need to install FreeBASIC or can you make them standalone executables like Visual Basic and RPG Maker (in the latter, you needed to use an undocumented trick to remove dependencies, though)?
-
Don't worry, it compiles to standalone executables. Dependencies are a turnoff in general :P
-
Ok good. With one of my old VB games, I discovered it requires me to download some OCX files to play them and it won't tell me where to put them (in the system folders it doesn't work in Windows 7 64 bit)
-
is this for the nspire?
-
Sadly, no. It's a computer program (definitely Windows, Idk about Linux or Mac OS)
-
It would be cool if it was made for the Nspire. I always wished there was an easy language for it. Otherwise, Axe could work, but it can be a bit harder I guess, than 83+ style basic.
-
Don't worry, it compiles to standalone executables.
Oh, so it's like Axe (as in compiling to assembly)!
And I think there is a Linux version for download. Haven't tried it yet.