Omnimaga

Calculator Community => OTcalc => Discontinued => Major Community Projects => [OTcalc] Z80-Software => Topic started by: nemo on August 08, 2010, 02:00:04 pm

Title: OT Basic
Post by: nemo on August 08, 2010, 02:00:04 pm
We're all familiar with TI-Basic. I think there should be a similar language for OT calculators. OT basic is not a final name. That can be discussed later. However, if you agree there should be a basic-like language, what are commands and features you would like to see? Named variables? Compiled rather than interpreted? I want radical ideas, things you wish you could do. However, I have one condition. Please no features that are gaming specific!! This is for math programs mainly. No requests for sprite routines or the like obviously targeted for gaming.  Command suggestions will be edited in regardless of feasibility.

Note: This topic should have extremely little discussion. Do not shoot down anyone's idea. Don't speculate on whether hardware can handle it or not. We can discuss fine details after the calculators hardware is planned. I ask this so this thread is as uncluttered as possible! Thank you.

Data Structures and Variable Types:
-Lists
-Matrices
-Multidimensional arrays
-Strings
-Character arrays
-Declared Variables
-Int, Float, Bool etc. types
-Prefixed variables to define their types. (ex. sVAR would be a string)
-Vectors


Variable Commands:
-ToUpperCase/ToLowerCase
-Pic recalling/storing
-Undeclare/Delvar function to free up memory
-Conversions between data types (i.e. list>Matrix, String>Number, Number>String etc.)
-Sum/Mean/Median of a List/Matrix/Array
-Random numbers, integers, matrices, lists, other data types
-Advanced Array functions

Graphical Commands:
-Pxl-On/Off/Change
-Pt-On/Off/Change
-Line
-Circle
-Polygon
-Graph Function
-Shade
-Clear Screen
-3-D support and polygons
-Operating System GUI elements, like DCS libs.

Control Statements:
-If (File/Variable Exists)-Else-End
-If-Else-End
-For
-While
-Break
-Try/Catch
-Goto/Lbl

I/O Commands:
-Getkey (multiple keypress getkey)
-Link Send
-Link Receive
-Prompt/Input
-Disp/Output/Print

Operators:
-Multiplicative
-Subtraction
-Negativity
-Addition
-Division
-Modulus
-Assignment
-Equality
-Inequality operators (greater than, less than etc.)
-Exponent
-Logical not()
-Logical and
-Logical or
-Logical xor
-Increment command (+= in C)
-Decrement commmand (-= in C) same with multiply, divide, modulus.


Math Functions:
-Every math function in the OTz80 calc that can be used outside a program on the "homescreen"
-include sorting lists


Language Design:
-Two languages, one interpreted, one compiled?
-Syntax highlighting! (great suggestion willrandship)
-Search function (ctrl+f)
-Numbered lines in the GUI
-SkipTo command, to skip to a programmer-defined place in the code, or waypoints like 1/4, 1/2, 3/4 through the code.
-Descriptive error messages when a program errors.
-Key to break execution of programs (like [On])
-Copy/Paste sections of code
-Undo/Redo function.
-Token based/Non-token based, still needs to be decided.
-Access to foreign characters and lowercase.




Title: Re: OT Basic
Post by: DJ Omnimaga on August 08, 2010, 02:29:33 pm
From what I remember, I think they wanted to include a language similar to TI-83+ BASIC. Something faster as well.

That said, while the language must be aimed towards maths, let's not limit itself like the TI-Nspire did. Let's not do the same mistake as TI did by removing Getkey and even Input.

The language needs to be interpreted, so the user immediately can run it like other calc BASIC languages, stable, so no crashes/data loss occurs while testing, error checking, to make it easy for the user to track errors, like in TI-BASIC, easy to use language, possibly similar to TI-BASIC but not too close to not get sued and tokenized, so it won't take considerable amounts of memory like TI-86 BASIC programs..
Title: Re: OT Basic
Post by: program4 on August 08, 2010, 02:31:23 pm
I think it should be interpreted, with an option to compile, in case you need to brute force something.
Title: Re: OT Basic
Post by: cooliojazz on August 08, 2010, 02:38:38 pm
For data structures, I think it should have more standard data type support, aka, instead of lists and matrices, have multidimensional arrays.  It should also of course have things like strings and numbers, not sure whether it would be advantageous to have separate int types, etc, but I would guess not.
Title: Re: OT Basic
Post by: calc84maniac on August 08, 2010, 02:43:24 pm
I assume this is for OTZ80? Cause for OTARM, it would be simple to load Python, for example, among many other languages. One of the perks of using Linux :)
Title: Re: OT Basic
Post by: program4 on August 08, 2010, 02:46:19 pm
It might have arrays of strings, unless that is too much towards gaming.
Title: Re: OT Basic
Post by: Builderboy on August 08, 2010, 03:26:36 pm
It needs to be intuitive enough to still be easily usable in class (yes we did actualy write some programs in all of my math classes) and it needs needs neeeds all the advanced trig and statistical functions that the 84 has, if not more.  If we are to hope to better TI, we will need to 1up them in every way.
Title: Re: OT Basic
Post by: fb39ca4 on August 08, 2010, 03:27:18 pm
For data structures, I think it should have more standard data type support, aka, instead of lists and matrices, have multidimensional arrays.  It should also of course have things like strings and numbers, not sure whether it would be advantageous to have separate int types, etc, but I would guess not.
I don't think we should have different number types, rather, just a float that applies to all numbers, like in TI-basic
Strings are fine, they could be used in say, a dictionary program.
For variables, I think they should be done similar to C, where they are declared, and can have any name, and be any type (number, string, list, matrix, etc.)
Control statements: If, Else Elseif, For, While, Break, Try (executes block of code, error code, if any, stored in a variable), Goto, and anything else useful.
Operators: +-*/, negative sign, exponent carat, <>=, assignment, not, and, or, xor, not-variants.
I/O: Getkey, Link(sends/recieves 1-byte codes on the link port), pixel-commands, line, circle, polygon, draw function, draw sprite, scroll screen, and so on and so forth.
Title: Re: OT Basic
Post by: DJ Omnimaga on August 08, 2010, 03:46:13 pm
The language really needs to be as simple as possible. I already found getting used to For() loop syntaxes very hard at first back in 2001. We need to not use a more complicated language, so people bother to learn to use it, but at the same time, the language needs to not be too complicated for the average student.
Title: Re: OT Basic
Post by: matthias1992 on August 08, 2010, 04:15:13 pm
I suggest making two languages, the easy one, basic should be interpreted. The harder one should be compiled. We could make some sort C-like language on it where every variable needs to be declared (I suggest any variable may be max. 8 char long?). I do think the basic version should be like Visual-Basic. Easy to use.

I do think having similarities is good but there may be some extra's to it. I'd love to develop a whole new language which takes the best of both worlds, the speed (or near it) of assembly yet the ease of use of basic. I am not talking about something Axe like hear because personally I don't find Axe that easy to use, especially because all the similar tokens confuse me. I suggest delivering this second language with a on-calc SDK and Compiler (all in one) as a external download. This so that newbs can't damage their calculator by playing around with the language (if it were pre-installed).

I'd say for the Advanced level (which i will from now on refer to as AOT: Advanced OmniTech) language to support a difference between data types to save space. This in contradiction to the Basic language which I suggest can have 8 char length varaibles that can be a string or a matrix or anything else just by assigning values like so:

MyVar = "ABCD"
MyVar = 10
MyVar = [[1,2][3,4]]

This does cause gaps in memory filled with garbage because you switch between types but I think it is easy. A other way would be doing a prefix like so:

sMyVar = "ABCD"
rMyVar = 10
mMyVar = [[1,2][3,4]]

The prefix doesn't count as character in the variables name. The AOT will (in my idea of it) declare variables like so:

New String MyVar = "ABCD"

or:

New String MyVar;
Myvar = "ABCD"

Aot will see the difference between Shorts, Doubles, Int's and Reals (and floats) as long as the type is declared (which is a must). For a Short it will reserve less space in memory so a advanced programmer can declare the types he needs.

Ok here I think is some keydifferences between Ti-Basic and OTBasic
First off all since there is more space we can use more descriptive tokens then par example: expr(). Secondly since the screen will hopefully be bigger there isn't a problem in making tokens longer in terms of displaying them.

definetely make indents for loops, very useful when young programmers get into more advanced PC languages, if they used OTB before (and they probaly will) then the gap between these languages would be smaller.

= assigns, no more sto token. This means assignments can be done in strings. Which means You can do subprograms in strings.

Custom named vars! Hopefully >5 chars long. Most likely with a pre- or suffix to define its type (int, real, mtrx, string etc)though but we will have to see about that later. This allows to create manual vars so different programs won't overwrite your variables. This does take up space but with a simple new command:
Code: [Select]
UndeclareYou can remove the vars you don't need to be saved and keep the ones that say, store level/player data. So you could do:
Code: [Select]
Undeclare Myvar1, Myvar2, Myvar3or:
Code: [Select]
Undeclare All()The parenthesis behind All could then contain nothing which litteraly deletes all declared vars or it could contain a type as, int, string, mtrx, real.
Code: [Select]
Undeclare All(int)This undeclares/ removes all vars of the type integer

Edit: Here are some more thoughts about AOT (not OTBasic as the above) syntax

Operators:

= is the assignment operator
== is the equal operator
/= (i can't do the non-equal sign here) is the non-equal operator
+ is plus
- is negative (I don't know if we need to make a distinction between - and (-) as the Ti calc does but I assume not)
* is multiply
/ is division
: is a logical and so you could have If A:B=1 (which tests if a=1 and b=1)
| is a logical or so you could have If A|B=1 (which tests if a=1 or b=1)
++ Increment with one stores to itself
-- decrement with one stores to itself
+= Increment with one assign to a new varaible or itself (which would be rather stupid considering the availability of ++ and --)
-= Decrement with one assign to a new varaible or itself (which would be rather stupid considering the availability of ++ and --)

IO:

Print [text | string | variable],[text | string | variable], [etc..] print a text, string or variable or a combination of those at the current cursorposition
Write X-location, Y-location, [text | string | var], [text | string | var], [text | string | var] , [etc] print a text, string or variable or a combination of those at the specified x and y position
Mprint [equation] writes out the specified eqaution in a pretty-print style.
Title: Re: OT Basic
Post by: SirCmpwn on August 08, 2010, 04:41:49 pm
How about Mosaic for the harder language?  z80 assembly is pretty straightforward in terms of support :P  And Mosaic is already planned on being bundled in KOS.
Title: Re: OT Basic
Post by: matthias1992 on August 08, 2010, 04:47:32 pm
How about Mosaic for the harder language?  z80 assembly is pretty straightforward in terms of support :P  And Mosaic is already planned on being bundled in KOS.
That isn't a bad idea. But I do think the gap between Z80 and this OTBasic would be too big. This is why I recommend making a golden midway that isn't pre-installed but externally downloadable. Going from basic to asm is a steep learning curve going through AOT first eases you in since it will support inline asm and will have some pretty advanced funtionalities (like flag manipulation), don't worry though It won't be by far a replacement for Mosaic. I guess that adds the counter up to three languages of which I suggest only the Basic Language is preinstalled.
Title: Re: OT Basic
Post by: willrandship on August 08, 2010, 04:48:57 pm
I think compiling should be implemented very visibly, so it's obvious that you can speed up your programs very easily.

Also, any chance for syntax highlighting and bolding? We'll be using a greyscale screen, right? I figure we'll have quite a bit of room for fancier effects like that.
Title: Re: OT Basic
Post by: calc84maniac on August 08, 2010, 04:56:30 pm
How about Mosaic for the harder language?  z80 assembly is pretty straightforward in terms of support :P  And Mosaic is already planned on being bundled in KOS.
This isn't KOS, this is OTZ80. I doubt Mosaic supports eZ80 anyway ;)
Title: Re: OT Basic
Post by: matthias1992 on August 08, 2010, 05:01:59 pm
How about Mosaic for the harder language?  z80 assembly is pretty straightforward in terms of support :P  And Mosaic is already planned on being bundled in KOS.
This isn't KOS, this is OTZ80. I doubt Mosaic supports eZ80 anyway ;)
True but KOS is very likely to be implented into this system though...Altough I still personally prefer to see a whole new OS for it (which can also be KOS but is specifically written for the eZ80 to take full advantage of speed increases and new commands)
Title: Re: OT Basic
Post by: matthias1992 on August 08, 2010, 05:04:40 pm
Really very much sorry for the double post but if I just modify my previous post it will be easily overglanced so temporarily I'll say it here (/me hopes there are no ill-mooded moderators around)

Add vectors as a data structure! Like so:

Vector2
Vector3
Vector4

just like in C#/XNA. Sir will most likely know what I am talking about, its very usefull.
Title: Re: OT Basic
Post by: DJ Omnimaga on August 08, 2010, 06:18:57 pm
/me omnomnoms matthias1992 who loses the game in the process. :P

Personally for languages, I think there should be one that is easy and oriented for math, and it would be up to someone to write one that is easy but game-oriented. Axe Parser would be a nice language IMHO. Just look how popular it is right now. This is what BASIC game programmers wanted for the past 10 years or so. However, more alternatives would be nice, and obviously, assembly support. ASM is less hard to learn for some people, but for others it is, like me. I tried 3 times, personally. I also never got the grasp of C
Title: Re: OT Basic
Post by: nemo on August 09, 2010, 12:24:48 am
DJ, i would love to see an integrated game-designing language for a calculator, but i feel like SAT/ACT testing people would look at that feature and immediately be turned away. that's why i'd rather have this a math-oriented language. of course getkey and output will be supported.

i'm currently editing in all the suggestions (i didn't have easy things such as multiplication, addition, subtraction etc. in because i was on a phone). right now i'm not going to put what each operator/function will look like, just the name. i remember someone suggested using = as the assignment operator and == as the equality. i'm just going to write down assignment and operator, as the actual symbol will depend upon the hardware. thank you all for the suggestions, keep them coming!
Title: Re: OT Basic
Post by: DJ Omnimaga on August 09, 2010, 12:33:05 am
Yeah I know. The main language should be math-oriented and advertised as powerful language to program your everyday applications. In addition to that, there should be a secure teacher mode disallowing the execution of any other language program or even some math programs.

For games, it should be a separate language that is compiled. It wouldn't even be included on the calc by default. Maybe just on the CD or something, or available via download online here or ticalc.org.
Title: Re: OT Basic
Post by: TC01 on August 09, 2010, 12:39:39 am
I'm guessing "OTAxe" (given the naming trend of things around here...) would probably just be as the current Axe is- a downloaded compiler for the calculator. However, I agree that "OT Basic" would have to be math-oriented and there definitely would have to be a Press-To-Test mode.
Title: Re: OT Basic
Post by: Happybobjr on August 10, 2010, 05:45:40 pm
Maybe do ti-Basic's "DelVar"  but have it so you can remove more than one at a time.

Ti-basic. 

delvar A
delvar g
devar x
delvar z

Ot-basic.

delvar a,g,x,z
Title: Re: OT Basic
Post by: _player1537 on August 10, 2010, 05:53:27 pm
*better, have it do Delvar agxz :D
Title: Re: OT Basic
Post by: yunhua98 on August 10, 2010, 06:05:52 pm
but what if the variable is multi-letter?
btw, happybobjr, I think you can already do that
Title: Re: OT Basic
Post by: _player1537 on August 10, 2010, 06:08:25 pm
Ooops, was thinking like in ti-basic where the variables are A-Z and theta.
Title: Re: OT Basic
Post by: Mighty Moose on August 10, 2010, 06:18:47 pm
What about 3-D graphics?  I heard someone mention that a while ago in another thread.
Extruded polygons?
You could do something like Solid( or 3D( - not quite sure how you could implement other things, maybe like:
Solid(Array of points (x1,y1,x2...), length of extrusion)
Title: Re: OT Basic
Post by: fb39ca4 on August 10, 2010, 06:32:35 pm
Maybe a function to convert 3d coordinates to a 2d projection, and another one to fill polygons.
Title: Re: OT Basic
Post by: nemo on August 10, 2010, 08:53:24 pm
3-D graphics are now noted, though i'm not too sure due to the obvious capabilities of 3-D games.

as for delvar, someone earlier suggested a command called "Undeclare" which would pretty much do the same thing. added it in for reference though.

good suggestions guys! keep them coming. i'm sure computer programmers have other things they wish they could do on a calculator.

Title: Re: OT Basic
Post by: tloz128 on August 10, 2010, 08:58:32 pm
I know that we don't want the language to seem game-oriented, but I think that there should be a way to draw sprites on the screen (though it obviously wouldn't be called that). Maybe a recallpic sort of thing with images of a custom size?
Title: Re: OT Basic
Post by: TIfanx1999 on August 10, 2010, 09:51:59 pm
I know that we don't want the language to seem game-oriented, but I think that there should be a way to draw sprites on the screen (though it obviously wouldn't be called that). Maybe a recallpic sort of thing with images of a custom size?
I'd have to agree. This is definitely something I would like to see included.
Title: Re: OT Basic
Post by: willrandship on August 10, 2010, 11:01:21 pm
3D may be a tad unrealistic, how about a built-in raycaster?

i always liked the variable management of the 86. It was very C-like. You could have a variable up to 8 letters long, and you wouldn't need to call it, for example "prgmVAR", you could just use it as VAR instead. That way, if you needed to switch the variable type you were using, it would be less work.

EDIT: @DJ

What about having a programming language, (game oriented) and a function creator? The function creator would be very similar to the nspire's language, simple to use and very similar to the home screen. The game creator would be much more complicated, function-wise.
Title: Re: OT Basic
Post by: matthias1992 on August 11, 2010, 04:06:53 pm
I have another suggestion, This one I borrowed from Visual Basic.
Code: [Select]
Try
..some code
Catch
..errorhandling code
End try

The try-catch-end statement Tries to run the code, if it fails however the error is "catched" and can be handled appropiately. In Visual Basic one would do:
Code: [Select]
Try
..some code
Catch ex as Exception
..errorhandling code
End Try
However for OTBasic I'd just do "Catch" instead of "Catch ex as Exception" or worse "Catch System.Diagnostics.Rightrestrictions as Exception" (< that is not a real error btw). Also "End Try" can be "End". The use of this is that you can safely test code and use code that might not work on every calc. Say a user has for some reason restricted rights on a calc and A program does a function/command or whatever that falls outside those rights, then the user would get a message saying what the problem was, thanks to try-catch-end.
I think it is specifically handy for programs or routines that are prone to errors. Since I assume there is a implented break function to prevent (like we have now, the on that prevents RAM clears) it might be less useful. It really depends on how the OS is programmed and if there is something like 'rights' cause then it's useful.

Edit1:
For the Language Design section: How about a undo/redo function? So if you accidentally hit clear you can still get your line back. I would make the redo's/undo's limited though to keep memory usage low. Maybe even auto-backupping when enabled? (for the paranoid amongst us)
Edit2:
I Have no clue whatsoever how the KOS GUI is gonna look like but maybe we could implent some of it's GUI elements (e.g. Button, Label, WindowForm (once again I dunno if these will actually exist, just saying)) make them callable as drawing functions. This could however be also a external "package" which brings me to my next idea. Making the langauge 'package' compatible. With that I mean that certain commands can be added via a package. This package contains the tokens for the commands and KOS compatible routines to run them. This way users can extend the langauge to their likingning.
Edit3:
Another conditional structure I'd like to see is this one (which I borrowed from batch):
Code: [Select]
If Exists sString
..do something
End
This tests whether string String exists or not. This can be useful to say, have user able to remove a game but to save the game data/save game. With one check you could then easily see if there was any saved that and act appropiately. I think this is very, very useful!
Title: Re: OT Basic
Post by: program4 on August 11, 2010, 05:01:00 pm
Tokens like sin( are length 1 when put into a string on the TI-84. This can be annoying sometimes, because they appear as 4 characters. I think the OTZ80 should take sin( as 4 characters when using the length( command.

It would be cool if you had routines like toUpperCase and toLowerCase for a string.  :D

Also, it would be good if you could convert from number to string and vice versa, or better yet be able to add a number and a string to get a string.

Two-dimensional menus are a must, in my opinion.
Title: Re: OT Basic
Post by: calcdude84se on August 11, 2010, 05:02:49 pm
Possible would be having a non-token based system, or have it only use tokens internally, and not for editing.
String routines would be cool.
Title: Re: OT Basic
Post by: nemo on August 11, 2010, 05:11:59 pm
suggestions added.

program4, what do you mean by two-dimensional menus?
Title: Re: OT Basic
Post by: program4 on August 11, 2010, 05:28:26 pm
Like the MATH menu on the TI-84, not the apps menu: there is an up and down dimension, and left and right (in a program).
Title: Re: OT Basic
Post by: Happybobjr on August 11, 2010, 05:37:11 pm
how about we can check to see if variable currently exist.
Title: Re: OT Basic
Post by: calcdude84se on August 11, 2010, 05:43:01 pm
I think matthias1992 suggest an "IfExists" for that, but bumping it is fine ;D
Title: Re: OT Basic
Post by: matthias1992 on August 11, 2010, 09:05:13 pm
I had an Idea for merging this Basic language with the harder language I proposed. Add-ons is the keyword. I'd like to see libraries and packages included which I define as follows

The use of a SDK or library is to add aditional functionality that wasn't available in the bare-bone version of OTBasic which is by default included in the OS. Now any PACKAGE completely overwrites the Oncalc-editor and the tokens/commands and replaces it with the Default Bare-Bone commands + the added commands. A LIBRARY is a seperate file that can be included in the Prgram itself using something like: "UseLib([libname])" This adds tokens without overwriting the Bare-Bone editor. The side-effect is that a external file (the Library) is needed.

So basically you can use new commands when adding a library. When adding a package you can simply pack multiple libraries into on file which itself is inherit to the OS. So shortly said: a library adds one external file, a package adds  multiple libraries but doesn't make a external file. It becomes a part of the editor as if it was already rpogrammed with these extra commands.

I hope I don't confuse anyone with this IDEA. It's just a suggestion.
Title: Re: OT Basic
Post by: program4 on August 12, 2010, 08:51:49 am
Your idea would be great, except that the programs that use the libraries would not be compatible with someone that doesn't have the libraries. I think that these libraries should be automatically included in the OS, but you should need an external application to access them (just like the extra variables on the TI-84).
Title: Re: OT Basic
Post by: calcdude84se on August 12, 2010, 09:35:30 am
Sounds good.
program4: The solution to that is to package the library with the program, and perhaps give the device a central libraries location. If the libraries the program needs are already there, you can just have the device discard the extra copies.
Title: Re: OT Basic
Post by: matthias1992 on August 12, 2010, 09:43:25 am
Sounds good.
program4: The solution to that is to package the library with the program, and perhaps give the device a central libraries location. If the libraries the program needs are already there, you can just have the device discard the extra copies.
Exactly. Whenever you do something like: UseLib([LibName]) it knows it has to send/include the library as well. I like the central libraries Idea alot. Just like you had apps on the original TI-8x you can now have a same sort of place for packages and libraries. That would be pretty awesome :P. Imagine a 3Dlibrary being created, you can then in OTBasic do 3D stuff with poly's and so! That is because every library is programmed in assembly so it runs real fast! That would be pretty awesome right?
Title: Re: OT Basic
Post by: calcdude84se on August 12, 2010, 09:51:23 am
You sorta reminded me of the never-used OpenLib( and ExecLib( commands on the 84+(SE). :P
Though libraries would actually be libraries and not stand-alone apps ;D
Although this is more of a device suggestion than BASIC language suggestion, will there be folders? I'm assuming yes, since you plan to use KOS or something similar. Maybe a /libs folder for everything library-related. :)
Title: Re: OT Basic
Post by: matthias1992 on August 12, 2010, 10:03:36 am
You sorta reminded me of the never-used OpenLib( and ExecLib( commands on the 84+(SE). :P
Though libraries would actually be libraries and not stand-alone apps ;D
Although this is more of a device suggestion than BASIC language suggestion, will there be folders? I'm assuming yes, since you plan to use KOS or something similar. Maybe a /libs folder for everything library-related. :)
I believe there attemtps/plans at making a FAT like filesystem but I can't tell for sure. Would be great though. I never really understood OpenLib() and ExecLib().
Title: Re: OT Basic
Post by: calcdude84se on August 12, 2010, 10:26:58 am
So, a quick digression to explain what they are.
Basically, they allow you to use a specially formatted flash app as a library. You choose the library with OpenLib(, and send commands to it with ExecLib(. Note that the app really only has one entry point, though, since ExecLib( only takes one argument.
The only app I know of to use this is Usb8x.

And yeah, SirCmpwn plans a hierarchal file system. (If I get my OS finished fast enough, mine will too ;D)
Title: Re: OT Basic
Post by: matthias1992 on September 03, 2010, 05:58:40 pm
I just thought of some more commands we might want to include namely random number generators and sorting commands (to sort lists but maybe also to sort strings?? (migh be useful when delimiting))

any ideas on that?
Title: Re: OT Basic
Post by: DJ Omnimaga on September 03, 2010, 06:34:43 pm
random function seems like a must to me. Even non-game-programmable calcs, such as cheap scientific ones, had Rand anyway. Sorting commands would be a good addition too.
Title: Re: OT Basic
Post by: nemo on September 03, 2010, 08:59:50 pm
yeah, rand is good. i forgot about that. i'm think rand 0-1, randint # specified - # specified, randmatrix every value is between two specified numbers and randlist, same thing as randmatrix but for a list. and i know there were suggestions for other data types, so hopefully find a way to get random data types too. sorting would also be good.
Title: Re: OT Basic
Post by: calcdude84se on September 03, 2010, 09:10:41 pm
A possibly, somewhat advanced feature would be more list functions. Or rather, array functions ;D
Things like list comprehension, for example. (Example (made up syntax): [x <- list1 | x>5] would return a list that consists of all the elements of list1 that are greater than five)
Title: Re: OT Basic
Post by: tloz128 on September 03, 2010, 11:11:03 pm
I think that it should support multiple key presses (lack of this is one of the things I hate the most about TI basic).
Title: Re: OT Basic
Post by: program4 on September 04, 2010, 04:44:19 pm
There should be a way to reach all the characters, including the ones normally inaccessible (like the alpha in Omnimaga) from a menu. Also, have more of them  :P
Title: Re: OT Basic
Post by: DJ Omnimaga on September 04, 2010, 06:54:17 pm
I agree with program4. I find it weird that lowercases are disabled by default and that you need to install a language APP and turn your calc in a different language to access them...
Title: Re: OT Basic
Post by: nemo on September 05, 2010, 09:34:57 pm
alright so i've been thinking a lot about the data types involved in this, and i think there shouldn't be too many as to confuse the casual programmer, but enough so an advanced programmer can save a lot of memory. thus, here are my suggestions for data types dealing with numbers only, excluding strings or data structures (lists/matrices/arrays) for now:

-Byte holds values -128 to 127, integers only
-2Byte holds values -32768  to 32767, integers only.
-4Byte Word holds values... really big. like -2 billion to 2 billion.
-16.16 fixed point values  -32768.32768 to 32767.32767
-the unsigned versions of the above numbers
-The OS Float, however the OS stores floating point, that's this data type. no unsigned version.

also, maybe have a menu where you can turn on and off advanced features, such as specifying what data type a variable should be. suggestions? also, adding in the array functions, multiple keypresses and foreign characters suggestions to the first post.
Title: Re: OT Basic
Post by: shmibs on September 05, 2010, 09:55:03 pm
/\i like(although i dont really see the purpose of word storage other than os calculations...)
a menu sounds nice, too(all number dealings are floating point by default for nubs, but can be set to the others to increase calculation speed)
Title: Re: OT Basic
Post by: fb39ca4 on September 06, 2010, 11:47:33 am
That would be nice.
For the 16.16 fixed point value, the range would be -32,768 to 32,767.9998...
Title: Re: OT Basic
Post by: matthias1992 on September 06, 2010, 01:48:31 pm
alright so i've been thinking a lot about the data types involved in this, and i think there shouldn't be too many as to confuse the casual programmer, but enough so an advanced programmer can save a lot of memory. thus, here are my suggestions for data types dealing with numbers only, excluding strings or data structures (lists/matrices/arrays) for now:

-Byte holds values -128 to 127, integers only
-2Byte holds values -32768  to 32767, integers only.
-4Byte Word holds values... really big. like -2 billion to 2 billion.
-16.16 fixed point values  -32768.32768 to 32767.32767
-the unsigned versions of the above numbers
-The OS Float, however the OS stores floating point, that's this data type. no unsigned version.

also, maybe have a menu where you can turn on and off advanced features, such as specifying what data type a variable should be. suggestions? also, adding in the array functions, multiple keypresses and foreign characters suggestions to the first post.

If I am catching you right then you also mean that when a user defines a variable and that variable is a number then the user also has to define what kind of type the number is? e.g.

Byte 1->aVar
Int 123->aOtherV
etc..

If so then I would make this optional in the following sense: If a user defines a variable that contains a number but he/she does not defines the number-variable's type then a floating point is assumed. So:

102->myVar

would be presumed to be a float which, logically, takes up more space then a int. A more advanced programmer therefore would do this:

Int 102->myVar.

Ther is one problem with this, mainly that the very word 'Int' itself takes up space. So maybe it'sbetter to do prefixes (I think we already discussed that but I am not sure...) I suggest these prefixes.

" --string
i --int
r --real
m --matrix
l --list
f -- float
o --bit (based on the 'switch' term... b for bit and f for flag are already used as 'byte' and 'float')
b --byte :=8bits
d --double byte :=16bits
w -- word :=32 bits

example
Code: [Select]
"FooBar->myvar
l0,1,2,3,4->myVar
Disp "I Say : myvar : myVar[1]

In the above example are tow more things:

1. myvar and myVar, shall we make a distinction between the tow? inother words should variables be case sensitive?
2. the ":" (without quotes) sign which would combine several variables and strings into one Disp command. (I originally wanted to use the "&" token but I thought that would be uneasy to access if we were to use a keypad similar to TI's)

Just say what you think about this...

edit in my example code it is seemingly impossible to include the ":" token in a string, this exmaple below however does so:
Code: [Select]
Disp "M says : ": : "Hello

which combines the strings "M says", ":" and "Hello".
maybe "&" is better after all...
Title: Re: OT Basic
Post by: Xeda112358 on March 16, 2011, 05:07:26 pm
I am interested in developing a programming language. If anybody has seen ReCode, it uses 5 bcalls (one of which isn't needed anymore, but is included to keep compatibility with previous versions). The others are used to create vars, delete vars, and the last is InsertMem and all of those are used for the simple reason that I don't know the OS protocol for that stuff. Other than that, it is a fast interpreted language that currently has sprite support, strings and real numbers, text (not using anything from the OS), and other random things. I think that if I really wanted to I can fit a whole programming language into 16KB, but if I extended it to 32KB I could make the programming environment, all of the tokens and not use the OS at all. The only problem is that I am not familiar with writing to flash (in case variables need to be archived). For those who are not familiar with ReCode, here is a screenshot of an example program:
(http://maxcoderz.org/forum/download/file.php?id=70)
Title: Re: OT Basic
Post by: AngelFish on March 16, 2011, 05:10:34 pm
/\i like(although i dont really see the purpose of word storage other than os calculations...)
a menu sounds nice, too(all number dealings are floating point by default for nubs, but can be set to the others to increase calculation speed)

I don't think floating point should be the default. It's too slow. Perhaps a fixed decimal point would be a better default, since it's faster to compute and slightly more accurate.
Title: Re: OT Basic
Post by: Xeda112358 on March 16, 2011, 05:13:09 pm
Actually, I have done some work with BCD math and floating point and to be honest, it isn't all that slow. However, I personally prefer making all of the math routines based on binary and then convert it to decimal only for display purposes.
Title: Re: OT Basic
Post by: matthias1992 on March 16, 2011, 05:50:46 pm
Sorry to mix up hard and software here but, floating point math should not be that hard if we go for a propellor based design, it has full hardware 32 bit math support and can do float calculations in just one out of eight cores....

So really Floats is more hardware related if speed is an issue...

I figured a third option, eZ80 with a propellor as gpu? I mean, gpu's today are so great because they use stream processors, with a prop that is possible too...
Title: Re: OT Basic
Post by: program4 on March 16, 2011, 09:06:41 pm

edit in my example code it is seemingly impossible to include the ":" token in a string, this exmaple below however does so:
Code: [Select]
Disp "M says : ": : "Hello

which combines the strings "M says", ":" and "Hello".
maybe "&" is better after all...

Maybe the ability to add quotation marks to a string would be nice, like using escape code or whatever it's called. Like, the " symbol means you type
Code: [Select]
/" and the / symbol means you type
Code: [Select]
// just like in Java. This would also allow for escape sequences like newline
Code: [Select]
/n
Title: Re: OT Basic
Post by: Xeda112358 on March 16, 2011, 09:53:17 pm
There will definitely need to be a char() command so that users can have access to all of the ASCII characters and this will allow for something like this to concatenate strings (like on the 89):
Code: [Select]
"Hello "&"World"&char(33
Title: Re: OT Basic
Post by: program4 on March 17, 2011, 09:05:04 pm
I agree, too. This would also essentially allow digit to string conversion, if say char(62) corresponds to 1 then char(61+x) corresponds to x. But, number to string conversion would still have to be added separately.
Title: Re: OT Basic
Post by: Xeda112358 on March 17, 2011, 09:33:26 pm
Well it isn't very difficult in assembly, it just requires writing a byte.
Title: Re: OT Basic
Post by: Deep Toaster on March 19, 2011, 11:06:40 pm
Maybe the ability to add quotation marks to a string would be nice, like using escape code or whatever it's called. Like, the " symbol means you type
Code: [Select]
/" and the / symbol means you type
Code: [Select]
// just like in Java. This would also allow for escape sequences like newline
Code: [Select]
/n

I'd actually suggest a backslash (\) instead. It's what languages like Java use, and using / could get messy when users want the division sign -- which could happen a lot on a calculator ;)
Title: Re: OT Basic
Post by: jnesselr on March 20, 2011, 01:48:15 pm
Maybe the ability to add quotation marks to a string would be nice, like using escape code or whatever it's called. Like, the " symbol means you type
Code: [Select]
/" and the / symbol means you type
Code: [Select]
// just like in Java. This would also allow for escape sequences like newline
Code: [Select]
/n

I'd actually suggest a backslash (\) instead. It's what languages like Java use, and using / could get messy when users want the division sign -- which could happen a lot on a calculator ;)
yeah, backslash definitely should be used.
Title: Re: OT Basic
Post by: program4 on March 20, 2011, 09:13:26 pm
Oh oops, it looks like I forgot my Java.  :-[
Title: Re: OT Basic
Post by: AngelFish on March 20, 2011, 09:25:18 pm
I agree, too. This would also essentially allow digit to string conversion, if say char(62) corresponds to 1 then char(61+x) corresponds to x. But, number to string conversion would still have to be added separately.

I'd recommend going with hex and standard ASCII. That'd mean that char(31) would return "1" and char(62) would return "b." It'd also make things like char(546869732069732066756e) really easy to parse if they were in hex rather than decimal.
Title: Re: OT Basic
Post by: Xeda112358 on March 20, 2011, 09:33:38 pm
I agree and I also think that to keep data smaller, the program should undergo a "tokenization" process like with the TI-89. This way, data can be converted directly to bytes that the parser can work with.
Title: Re: OT Basic
Post by: jnesselr on March 20, 2011, 09:34:15 pm
I agree, too. This would also essentially allow digit to string conversion, if say char(62) corresponds to 1 then char(61+x) corresponds to x. But, number to string conversion would still have to be added separately.

I'd recommend going with hex and standard ASCII. That'd mean that char(31) would return "1" and char(62) would return "b." It'd also make things like char(546869732069732066756e) really easy to parse if they were in hex rather than decimal.
agreed.  In fact, I like that a lot better.  But I like char(596F752772652072696768742C2074686973206973206C6F616473206F662066756E2E) better.
Title: Re: OT Basic
Post by: Deep Toaster on March 21, 2011, 10:49:23 am
I agree, too. This would also essentially allow digit to string conversion, if say char(62) corresponds to 1 then char(61+x) corresponds to x. But, number to string conversion would still have to be added separately.

I'd recommend going with hex and standard ASCII. That'd mean that char(31) would return "1" and char(62) would return "b." It'd also make things like char(546869732069732066756e) really easy to parse if they were in hex rather than decimal.

I don't like the idea of having numbers be treated fundamentally as hex. It's bad for UI to say that the 62 in char(62) is hex, while the 62 in floor(62) is decimal.
Title: Re: OT Basic
Post by: jnesselr on March 21, 2011, 12:00:16 pm
true.  Maybe a lowercase b/h?  or %/$?
Title: Re: OT Basic
Post by: Deep Toaster on March 21, 2011, 12:30:50 pm
true.  Maybe a lowercase b/h?  or %/$?

I think %/$ would be a good idea. They're hardly used in other situations.

Unless we want to make them actual operators? :D

EDIT: Btw, who's actually working on this?
Title: Re: OT Basic
Post by: jnesselr on March 21, 2011, 12:39:46 pm
true.  Maybe a lowercase b/h?  or %/$?

I think %/$ would be a good idea. They're hardly used in other situations.

Unless we want to make them actual operators? :D

EDIT: Btw, who's actually working on this?
We don't actually have a physical calc yet, so it's mostly conceptual atm.
Title: Re: OT Basic
Post by: Ashbad on March 21, 2011, 01:49:35 pm
I acutally like the idea of using hex for a char() command.  That's actually how most people denote chars.  If you want to make a decimal version, I suggest a Byte() or RShort() command.

Also, I suggest an optinional approach of OOP -- like C++.
Title: Re: OT Basic
Post by: Deep Toaster on March 21, 2011, 01:55:45 pm
I acutally like the idea of using hex for a char() command.  That's actually how most people denote chars.  If you want to make a decimal version, I suggest a Byte() or RShort() command.

People don't like inconsistency though. Plus if we don't make an exception for char( and instead let it take a value the same way as any other command, the OS code for it would be much, much smaller.

EDIT: We can always have a format for hex numbers, as graphmastur said.
Title: Re: OT Basic
Post by: jnesselr on March 21, 2011, 02:34:04 pm
I like some aspects of it being OOP, but more like a struct than an actual object with methods and such, like it is in Java.
Title: Re: OT Basic
Post by: fb39ca4 on March 21, 2011, 02:39:08 pm
true.  Maybe a lowercase b/h?  or %/$?

I think %/$ would be a good idea. They're hardly used in other situations.

Unless we want to make them actual operators? :D

EDIT: Btw, who's actually working on this?
% might be used as the modulus operator, like in C. @ could be used as well
Title: Re: OT Basic
Post by: jnesselr on March 21, 2011, 10:21:06 pm
true.  Maybe a lowercase b/h?  or %/$?

I think %/$ would be a good idea. They're hardly used in other situations.

Unless we want to make them actual operators? :D

EDIT: Btw, who's actually working on this?
% might be used as the modulus operator, like in C. @ could be used as well
Yeah, that's true.  Hmm.  @ for modulus or binary?  I could live with mod like you have and/or/xor in Z80 basic.
Title: Re: OT Basic
Post by: DJ Omnimaga on March 26, 2011, 11:15:39 pm
Personally I think there needs to be alternatives to floating points too, maybe even through MODE changes (float, fix 0-9, integer 1 byte through 4 unsigned, etc). Because one major issue with BASIC is that floating points are huge. In a list, a floating point number is 9 bytes instead of 1 for a 1 byte integer. I think there should be support for 1, 2 and maybe even 4 bytes integers, and why not nibbles/binary while we're at it?