I'm making a library for JavaScript for handling TI-83/84 programs.
This will deal with both TI-BASIC programs and Asm programs.
It currently doesn't support the TI-84+ Color, but I may add support in the future since I expect to get one for Christmas.

This will be able to be used to easily create, read, and edit these types of files.

I've started with Asm programs, and you can do this so far:


Code:
<body>
<script src="ti83plus.js"></script>
<script>
    var prgm = new TI83PRGM("hello","asm");
    prgm.hex = "BB6D219F9DEF0A45EF2E45C948656C6C6F2C20576F726C642100";
    prgm.genBinary();
 
    prgm.download();
</script>
</body>


Note that this isn't a full assembler.
It just takes your hex and assembles it into a working program.
Like "AsmComp(".

That will generate a file named "hello.8xp" (in which will be named HELLO on the calculator) and can be ran with "Asm(prgmHELLO" and will display "Hello, World!" and skip a line. It then downloads the file to your computer.

".hex" is obviously the hex to your program.
It's just the hex in the data section after "BB6D".
So essentially, this will assemble your hex just like the assembler that comes with the TI-83/84 calculators.

".genBinary()" generates a binary array in which is stored in ".binary".
If you run ".download()", it converts the array to your binary file and downloads it to your computer.

There also ".setComment()" in which you can use before ".genBinary()" to add your own comment at the top. It's not required, tho. And the default comment is just a bunch of spaces.

This part is working pretty well.
What I am currently working on now is making TI-BASIC files work.
When they're done, you should be able to create one like so:


Code:
<body>
<script src="ti83plus.js"></script>
<script>
    var prgm = new TI83PRGM("hello","tibasic");
    prgm.txt = "Disp \"Hello, World!\"";
    prgm.genBinary();
 
    prgm.download();
</script>
</body>


This will do the same thing as the previous code. This time, it will generate a TI-BASIC program.


This will be able to be used to easily make web services in which generate TI-83/84 programs, or even make a web-based assembler. And since it's JavaScript, you do not even have to assemble it server-side. It can be completely assembled client-side. It can also be paired with Chrome desktop apps, in case you do not want to make a web app.
That's pretty cool! Does it auto-include the DCS header? If so, you should make the program icon something that possibly marks that the program came from this. If not, put the DCS header in there!

Also, do you plan on letting users upload a text file or is it copy and paste?
comicIDIOT wrote:
That's pretty cool! Does it auto-include the DCS header? If so, you should make the program icon something that possibly marks that the program came from this. If not, put the DCS header in there!

Also, do you plan on letting users upload a text file or is it copy and paste?


I don't know anything about the Doors CS header. :I
It just generates it as a typical Asm file like would be generated with the "AsmComp(" command.

You can run the generated file using "Asm(prgmHELLO" or, if you have Doors CS installed, just "prgmHELLO".

I don't know if JavaScript alone can upload files, so it'd probably be copy/paste.

However, if you create a desktop app in Chrome, JavaScript does gain the capabilities to read/write files. So you would be able to open a file like a regular program with that, if someone uses this library in conjunction with it to make something like an assembler.
Here's the ASM Header info if you are interested in adding that in at all.
comicIDIOT wrote:
Here's the ASM Header info if you are interested in adding that in at all.


Alright, I'll look into it.
Wow, that looks pretty cool! It could be very helpful for some web-applications.
Are you planning on adding support for like 8Xls and all the other 83+/84+/se formats?
Cool project, Amihart! Obviously I have extensive experience in this area from projects like SourceCoder, so I look forward to helping as much as you need in this thread. As Sorunome asked, what is your eventual set of goals with this project?
Sorunome wrote:
Wow, that looks pretty cool! It could be very helpful for some web-applications.
Are you planning on adding support for like 8Xls and all the other 83+/84+/se formats?


Yes. I plan to make it support some other formats.
I am actually currently working on images.
You should be able to do something like this once it's finished:


Code:
var img = new TI83PLUSVAR("Pic3");
img.src = "shrek.png";
img.create();


It does convert your images for you, and the converter takes all of the major formats.
Here is an example of the quality of the converter:

"shrek.png"


"pic3.8xi"
Very nice! Does it scale both dimensions without regard to aspect ratio? Do you plan to add options to control that later?
KermMartian wrote:
Very nice! Does it scale both dimensions without regard to aspect ratio? Do you plan to add options to control that later?


Sure, I guess.
Currently, it just resizes the image to 96x64 and then converts it.

I may add the option in the future.
Wow, that is pretty awesome! Now i have to come up with a good use for this library Razz
Anyways, what will it do to non-monochrome pics?
Sorunome wrote:
Wow, that is pretty awesome! Now i have to come up with a good use for this library Razz
Anyways, what will it do to non-monochrome pics?


Oh, well, currently nothing.
It kind of assumes that the image is monochrome, so if you want to convert a non-monochrome image, then you are going to want to convert it to monochrome first using some sort of photo editor, like GIMP or Paint .NET.

If you try to pass an image that's not monochrome, it'll just come out as all black.
I currently have a working demo for hex assembler and the image converter.

Go here:
http://jsterm.site40.net/ti83plus/window.html

I know it's kinda ugly. It looks nicer as a desktop app, but I'm not going to publish the desktop app until it's finished.

There's also a lot of buttons disabled. Those are disabled because they currently either don't work or don't have any code to them.

To use the hex one, it's pretty self explanatory.
Type out your hex code just like you would type it on the calculator, discluding "AsmPrgm" at the top.

Such as, a basic "Hello, World!" code would look like this:


Code:
219F9D
EF0A45
EF2E45
C9
48656C6C6F2C20576F726C642100


Put that in the big textbox. In the little textbox, type the title of your file (such as "hello" or something, it'll automatically capitalize it).


For the image converter, click the "Image" tab and then title the image either "Pic0", "Pic1", "Pic2", ... "Pic9". Any of those will work. If you don't name it that, it won't work.

Now, just click "Open..." then select your file, then click "Build".
Note that it does take a few seconds to build. It's not instant.

You should get a file named something like "Pic3.8xi". Move that to your calculator and it should work.

The images must contain white in it. All white in the image is translated to an "off" pixel and all other colors "on". If your image does not contain white, then you'll end up with a picture that's just all black.

Anyways, that's what I have so far. I'll post an update once I get some more stuff working.

You can view the JavaScript simply by right-clicking and clicking "View Source". None of it's obfuscated, but sometimes my structure is a bit messy.
This is purely JavaScript.

If you view the "main.js", you can see how the hex and image files are created. They are simply created like so:


Code:
 var prgm = new TI83PLUSPRGM(txtFname.value,"hex");
    prgm.hex = txtCode.value;
    prgm.genBinary();
    prgm.download();


See how simplistic that is?
Look at the images:


Code:
    var img = new TI83PLUSVAR(txtFname.value);
    var url = window.URL || window.webkitURL;
    var f = openFileDialog.files[0];
    img.src = url.createObjectURL(f);
    img.genImage();


The images currently are a little bit more complicated because of Google's security policy.
They'll easily convert any image simply by providing the ".src" with the link to the image. However, Chrome refuses to simply load non-local images from your computer, so this is a work-around for that. If the images aren't local, you don't need the work-around.
I'm currently working on the assembler part.
Here's an example of what I have so far (this will create a program that will say "Hi!"):


Code:
var prgm = new TI83PLUSPRGM("hello","asm");
prgm.txt = "";
prgm.txt += ".db bb\n";
prgm.txt += ".db 6d\n";
prgm.txt += "ld a, 72\n";
prgm.txt += "rst 28h\n";
prgm.txt += ".db 0445\n";
prgm.txt += "ld a, 105\n";
prgm.txt += "rst 28h\n";
prgm.txt += ".db 0445\n";
prgm.txt += "ld a, 33\n";
prgm.txt += "rst 28h\n";
prgm.txt += ".db 0445\n";
prgm.txt += "rst 28h\n";
prgm.txt += ".db 2e45\n";
prgm.txt += "ret\n";
prgm.genBinary();
prgm.download();
Looks like a prmg.AddLine would be a handy function to include.
Neat! I tried the link; but I couldn't connect!
willwac wrote:
Neat! I tried the link; but I couldn't connect!


What do you mean? Does it just say "[your browser] cannot connect to [this website]"?
Yep.
I've been trying to port some of my library to C++ so you can use it from the command line.
I ported the hex portion into a command called "z80hex".
Something like this may already exist, but if not, well, here it is anyways.

This is the output for "z80hex --help" which basically sums up what it does:

Code:
Usage: z80hex   [--help][--mono][--color][--bin][--asc]
                [file][name][comment]
        --help          Displays this help text.
        --mono          Specifies that the TI-83/84 has a monochrome screen.
        --color         Specifies that the TI-83/84 has a color screen.
        --bin           Specifies that the file to package is binary hex.
        --asc           Specifies that the file to package is ASCII hex.
        file            Specifies the name of the file to package.
        name            Specifies the name of the file to package.
        comment         Specifies a comment for the package.


It basically is the "AsmComp(" thing in TI-BASIC but for the PC.
If you have z80 hex in either an ASCII file or a binary file it will build it to a .8xp for the TI-83/84s. Use the "--color" switch if you're using a TI-84+CSE. The "--dump" switch will also extract the hex.

The code is just two files that use all standard libraries. So I'm pretty sure any OS could compile then.
For now it's on my Google Drive if anyone wants to test it out.

I hope to bring the image converter to C++ as well. And even expand on it to make it also convert color images to the TI-84+CSE.
To answer the rhetorical question at the beginning of this post, yes, such programs exist, namely DevPac83, DevPac8x, and my BinPac8x. However, it sounds like yours offers more options than the existing programs. Good luck with this, and if I get a chance and you don't mind the feedback, I might peek at your C++ code and critique it.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 2
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement