Join us on Discord!
You can help CodeWalrus stay online by donating here.

[Hybrid-Basic][Library] TI-Basic DIY Library

Started by 123outerme, January 16, 2017, 12:29:41 AM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

123outerme

I'm going to rework the code I had for the "TI-Basic Library" into a DIY-Library maker! Got some code that repeats over-and-over, and you want to save space? Easy! You can create your own customly-named AppVar, holding all the information, from the name of the function, to the subroutines they execute!
Unfortunately, there are some drawbacks so far:
*Can only handle one input after the (. You can technically have more than one input, you just have to make sure it isn't destroyed by any variable used by prgmDIYLIB
*Can only handle number inputs
*Only technically works on the CSE. It would be pretty easy to port to monochrome calcs (and possibly the CE), so if you're interested, contact me!
*Running it is most likely slower than just typing out the equation normally

(note: This is not a serious project. I finished this in like 4 hours and felt like it was cool to mess around with)


[spoiler=Old Message]Just for kicks, I felt like making a Basic Library. It's incredibly inefficient for most tasks. As a proof-of-concept I whipped up a fucntion to find the digits of a real integer and a function to square a number. Just an example, the calling the squaring function takes ~12 bytes more than just doing X2. The interpreter is 102 bytes large as of now, and uses a database AppVar to store all function names, function equates, etc. This is so the AppVar can be archived, saving RAM (in theory). Right now, it's only technically compatible with the +CSE because I'm only familiar with Celtic II functions, however it would be as simple as replacing 2 commands to port it over to monochrome calcs. For calculators which have no way of accessing AppVars, the interpreter would be significantly larger, and it'd be a little more work. Also it can't really handle more than one argument or outputting anything other than a string. Yeah.
Post suggestions here, and I'll post what I've implemented.

[spoiler=Commands]
*DIGITS( - finds the digits of a real integer
*SQUARE( - squares the number
[/spoiler][/spoiler]

If you downloaded the previous version, please redownload. The previous version could only handle 2 commands, where as this one has been fixed to handle as many as possible.
  • Calculators owned: TI-84+CSE, TI-nspire Clickpad, TI-84+SE

E37

can you just type in the command?
If so, that sounds really cool!  Post some more details on how it works?  ;)
  • Consoles, mobile devices and vintage computers owned: Ti83,Ti84!
I've never finished a project, there is always a way to improve!
What's my calc's name? Convert $37 to decimal. Look up that element in the periodic table. Then take the abbreviation of that element and you have it!
Look! A slime!    <(^.^)>

123outerme

Quote from: E37 on January 16, 2017, 12:37:55 AM
can you just type in the command?
If so, that sounds really cool!  Post some more details on how it works?  ;)
Unfortunately, no. You have to type something like:

:"DIGIT(100
:prgmLIBRARY
// bytes: 19

Just for reference, the code it runs takes up only 15 bytes (including protecting against nonreal numbers or a mix of real/nonreal), plus the 102-byte interpreter, means that this is for right now, really inefficient. I assume that if I use this to create subroutines (which actually sounds better than using this as a library), there would actually be space to gain from this.
  • Calculators owned: TI-84+CSE, TI-nspire Clickpad, TI-84+SE

E37

Will you make it so the user can make their own?

I can't tell, is it written in basic or assembly? Appvars suggest assembly, but it is called like basic. (no Asm() command)
  • Consoles, mobile devices and vintage computers owned: Ti83,Ti84!
I've never finished a project, there is always a way to improve!
What's my calc's name? Convert $37 to decimal. Look up that element in the periodic table. Then take the abbreviation of that element and you have it!
Look! A slime!    <(^.^)>

123outerme

Quote from: E37 on January 16, 2017, 12:49:16 AM
Will you make it so the user can make their own?

I can't tell, is it written in basic or assembly? Appvars suggest assembly, but it is called like basic. (no Asm() command)
Users can make their own if they open the AppVar (on a computer, of course), but there's no way to make one on-calc as of yet. That might actually be something interesting to consider.
It's a Hybrid-BASIC program, accessing the pre-created AppVar using Celtic II CSE.
  • Calculators owned: TI-84+CSE, TI-nspire Clickpad, TI-84+SE

E37

It would definitely be more useful if you added the ability to create the appvars on the calc.
It would be really useful then, and could even be used for making really large games or games that share large chunks of the same code.
  • Consoles, mobile devices and vintage computers owned: Ti83,Ti84!
I've never finished a project, there is always a way to improve!
What's my calc's name? Convert $37 to decimal. Look up that element in the periodic table. Then take the abbreviation of that element and you have it!
Look! A slime!    <(^.^)>

123outerme

Quote from: E37 on January 16, 2017, 12:56:38 AM
It would definitely be more useful if you added the ability to create the appvars on the calc.
It would be really useful then, and could even be used for making really large games or games that share large chunks of the same code.
Yeah, I think so too. I'll probably make an on-calc editor that has the names of the functions listed. When you select one, you'll be able to edit its name and the function it performs.
  • Calculators owned: TI-84+CSE, TI-nspire Clickpad, TI-84+SE

E37

A port to the b/w calcs would be nice when you have finished the color version. With a little work, you could make something really great from this!
  • Consoles, mobile devices and vintage computers owned: Ti83,Ti84!
I've never finished a project, there is always a way to improve!
What's my calc's name? Convert $37 to decimal. Look up that element in the periodic table. Then take the abbreviation of that element and you have it!
Look! A slime!    <(^.^)>

123outerme

Quote from: E37 on January 16, 2017, 01:08:40 AM
A port to the b/w calcs would be nice when you have finished the color version. With a little work, you could make something really great from this!
That actually wouldn't take long at all, I just have to know; is Doors a staple in the community for monochrome calcs, as it is for the CSE? Or will I have to (get someone to) do it in Axe?
  • Calculators owned: TI-84+CSE, TI-nspire Clickpad, TI-84+SE

123outerme

#9
Update: Screenshot! Also download if anyone wants it. This download is for the TI-84+CSE only, requiring Doors CSE. It is fairly easy to port, so if you're interested in porting it to monochrome calcs/the CE, contact me!
  • Calculators owned: TI-84+CSE, TI-nspire Clickpad, TI-84+SE

Dream of Omnimaga

I'M not too sure if I really understand the concept, no matter how much I try to read, but is it kinda like some sort of programming language maker?
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

123outerme

Quote from: DJ Omnimaga on January 16, 2017, 05:27:35 AM
I'M not too sure if I really understand the concept, no matter how much I try to read, but is it kinda like some sort of programming language maker?
In a way, yes! It's more like doing this in ASM (lifted straight from Learn Asm in 28 Days):

#define    move(src, dest)    LD dest, src

except it doesn't handle more than one input inside the parentheses at a time (though by customizing the algorithm you can still make it process more than one input, since it uses expr() to function)
  • Calculators owned: TI-84+CSE, TI-nspire Clickpad, TI-84+SE

Dream of Omnimaga

Ah ok. I remember in 2006 when someone made a new programming language in pure BASIC. It was supposedly slower but up to 3 times smaller O.O

http://www.omnimaga.org/ti-z80-calculator-projects/stupidlydidledtupidlydidledidledidly/
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

p2

so this thing lets you write some code that will then be packed into a userdefined command and executed even faster than regular code?
Well that's really nice! O.O
But how far is it possible to include those commands into a project?
Forexample if you have 2 games using this, but each using commands with similar names but different mechanics, will that even be possible?
  • Calculators owned: ti-83+, ti-84+, ti-84+, ti-84+se, ti-84+se(te), ti-nsphire, ti-nsphire CAS, ti-nsphire CX-CAS, ti-voyage, ti-voyage, Who reads this list anyways...?
Anyway war sucks. Just bring us your food instead of missiles  :P ~ DJ Omnimaga (11.10.2016 20:21:48)
if you cant get a jframe set up, draw stuff to it, and receive input, i can only imagine how horrible your game code is _._   ~ c4ooo (14.11.2016 22:44:07)
If they pull a Harambe on me tell my family I love them ~ u/Pwntear37d (AssangeWatch /r/)
make Walrii great again ~ DJ Omnimaga (28.11.2016 23:01:31)
God invented the pc, satan the smartphone I guess ~ p4nix (16.02.2017 22:51:49)

123outerme

Quote from: p2 on January 16, 2017, 11:48:13 AM
so this thing lets you write some code that will then be packed into a userdefined command and executed even faster than regular code?
Well that's really nice! O.O
But how far is it possible to include those commands into a project?
Forexample if you have 2 games using this, but each using commands with similar names but different mechanics, will that even be possible?
It's actually a bit slower than regular code, since it needs to interpret the command you're sending and still execute the code.
The answer to your other question is pretty simple: On creating an AppVar, you define its name. Just change a name that won't be called by any other game. Then, when you go to run the commands, make sure the name of your AppVar (prefixed by "rowSwap(" ) is in Str0. It will search through ONLY your AppVar to find the command.
  • Calculators owned: TI-84+CSE, TI-nspire Clickpad, TI-84+SE

Powered by EzPortal