While Kerm's binpac is an enormous blessing to the ti community and I am thankful for it every time I assemble a program, I've always wanted to make my own linker in C++ so that I can run it as an .exe on a computer without python, and, even better, to get a better idea of how linkers work and what they do.

I know that I could just pop open binpac.py and look over the source code, but it isn't very well commented (sorry Kerm! Sad), and, on top of that, I have practically no experience with the Python libs that Kerm uses in binpac!

Thanks in advance! Very Happy
Well, what do you want to know, how a linker works, or even what in general one does?

Basically, what linkers do is that they take a raw output file (in z80 assembly case, usually a .hex file) and turn it into a file runnable on the platform. As for what Kerm's does, I just scanned through it and it basically is adding headers to the file, and outputting the file in an .8** and adding things to the file's header like "**TI83**" so that it is recognized by a connection/sending program as a valid file for that platform.
I recommend using Java, if that's an option, because practically EVERY computer has the Java Runtime on it. An exe is only good for Windows.
You need the JVM to run Java code, and you need Wine to run a .exe. Everyone on Windows can run the exe without a single extra thing, and anyone on Linux is going to need to download something to run either, so why use Java instead? Then you just make both parties download something.
_player1537 wrote:
You need the JVM to run Java code, and you need Wine to run a .exe. Everyone on Windows can run the exe without a single extra thing, and anyone on Linux is going to need to download something to run either, so why use Java instead? Then you just make both parties download something.


1. What shka said

2. Wine doesn't always work (Wine Is Not an Emulator). Java does.
If Wine didn't work for something as simple as input, string concatenation (sp), and output, no one would even think to use it.
_player1537 wrote:
If Wine didn't work for something as simple as input, string concatenation (sp), and output, no one would even think to use it.


Wine doesn't come with most (Read that as "Every single major") distro, but java comes with most OSs.
_player1537 wrote:


2. Wine doesn't always work (Wine Is Not an Emulator). Java does.


How does the second part of that follow the first part? A name shouldn't have much impact on the quality of the environment simulation...

Anyway, as for the subject of Linking, I highly recommend that you look at the wikipedia article on the subject as well as the external links presented therein.
Then clearly Fedora isn't a major distro/OS because it doesn't come with Wine nor Java. If the OP said he wanted to write it in C/C++, let him. If anything, we already have a super-portable Python linker, so there isn't a reason to change languages simply for compatability.
Why worry about Wine? Is it *really* that hard to distribute the source along with an .exe build and a generic linux one? Or just let Linux users build it themselves?
It is extremely rare to find a computer without the JRE anymore. I am certain that the number of personal computers with Java outnumber the number of personal computers running Windows (or anything else), hands down. However, C/C++ will make a very solid program, provided it doesn't do anything dangerous; and provided that it's just a command-line program, it can run on multiple machines if recompiled for the major ones and all versions are released. Java is not as solid (fast/low-level), but it is safer and much more universal.

However, something that can run in a browser (JavaScript, PHP, etc.) would be even more universal Smile

...But all in all, C++ is a pretty good choice. I just think Java is more accessible.

As for [insert linux distro that nobody is going to have unless they are computer savy enough to make downloading a JRE trivial ...] users, are you that bent against not having Java (the "write once, run anywhere" language) on your machine!? Whenever I found a computer without it, I'd always "fix" it, since it "should" be there ... but that's rare now. ... But I hear ya, because I was bent against having the .NET framework on mine (pssh, you certainly can NOT just expect that to be anywhere ... though C# is amazing).


...Sorry, this is getting a bit out of hand. Java was a suggestion because (aside from the let's choose an obscure OS that is in the 1% of those without Java) it's universal. But that's to say that one language is better than another, and that is certainly not true; it's all preference. If you prefer C++, use that because TONS of software for ANY platform is written in C++. When you look for software online, you find an exe or whatever works for your OS anyway
_player1537 wrote:
Then clearly Fedora isn't a major distro/OS because it doesn't come with Wine nor Java. If the OP said he wanted to write it in C/C++, let him. If anything, we already have a super-portable Python linker, so there isn't a reason to change languages simply for compatability.


Java is in the repos, Wine isn't. Simple as that.
... Yes it is. That's how I got Wine, from the repos. (On the other hand, I got Java from Sun, not the repos).
_player1537 wrote:
... Yes it is. That's how I got Wine, from the repos. (On the other hand, I got Java from Sun, not the repos).


a long searches... Anyway, I have java workng perfectly on my machine, but I never downloaded anything from sun.
Which assembler are you using? If it's Brass (part of the DoorsCS SDK) then there's no need for any linker as Brass itself is capable of generating calculator binaries directly with the .binarymode directive; replace the combile.bat with the following:


Code:
@echo off
cls
echo ----------------------------------
echo    Doors CS Assembler\Compiler   
echo           Version 2.0         
echo      Written by Kerm Martian     
echo      http:\\www.Cemetech.net       
echo ----------------------------------
echo ----- Assembling %1 for the TI-83/84 Plus...
echo #define TI83P >tasm\%1.asm
echo .binarymode ti8x >tasm\%1.asm
if exist source\%1.asm type source\%1.asm >>tasm\%1.asm
if exist source\%1.z80 type source\%1.z80 >>tasm\%1.asm
cd tasm
brass %1.asm ..\exec\%1.8xp -l ..\list\%1.list.html
if errorlevel 1 goto ERRORS
echo ----- %1 for the TI-83/84 Plus Assembled and Compiled.
echo TI-83 Plus version is %1.8xp
goto DONE
:ERRORS
echo ----- There were errors.
cd..
:DONE
del ..\tasm\%1.asm >nul
cd..


(Note that, of course, Brass is a .exe yet being a .NET application will run just fine on platforms with an equivalent to the .NET framework, e.g. Mono).
This has turned into a language debate. :/

To the OP, you could look at this. It includes a file describing the structure of 8xp files, and it includes an .exe and source (but it's in VB Razz).
For completeness I'd say that the best documentation for all the file formats can be found in TI Link Protocol & File Format Guide v1.4.
benryves wrote:
For completeness I'd say that the best documentation for all the file formats can be found in TI Link Protocol & File Format Guide v1.4.
This indeed, a live copy can also be found on Merth's site at a URL I don't recall and http://jonimoose.net/calcstuff/tilp/docs/linkguide/ As well as somewhere on http://lpg.ticalc.org. Though the tilp dev's, namely Lionel haven't released an update to it in a while corrections in the form of patches are welcome.
souvik1997 wrote:
This has turned into a language debate. :/

...but I really enjoyed reading the language debate!! Very Happy

shkaboinka wrote:
...Sorry, this is getting a bit out of hand. Java was a suggestion because (aside from the let's choose an obscure OS that is in the 1% of those without Java) it's universal. But that's to say that one language is better than another, and that is certainly not true; it's all preference. If you prefer C++, use that because TONS of software for ANY platform is written in C++. When you look for software online, you find an exe or whatever works for your OS anyway


I liked all the points you made, and I agree with what you're saying. Even though java would be a good decision, I feel much more comfortable in C++, and, anyways, most of my friends are non-computer-savvy Windows users, so a .exe will run on any other machine I need it to.

The whole point of me wanting to do this is to have a single folder to drag around on my thumb drive so that I can assemble and debug asm almost anywhere, right? All the z80 assemblers I know about are .exe, so using java for compatibility is a mute point if you can't even run the assembler Wink


Thanks for the batch file, benryves! I'll start using it before I even start my linker project, but I want to try and write a linker anyways, it sounds like great fun!
(I just realized that people would laugh at me for saying that anywhere but Cemetech. You guys are great)
and, speaking of Brass, thank you for making it! You did a fantastic job!

Also, thanks to ben, souvik, and storm for the documentation. It helps a TON.

Correct me if I'm suffering from beginners' ignorance, but isn't this actually pretty (really) easy?
Rascherite wrote:
and, speaking of Brass, thank you for making it! You did a fantastic job!
You wouldn't say that if you've seen the code (it was one of my first C# projects, and I'm amazed it works at all). Wink Thanks, though.

Quote:
Correct me if I'm suffering from beginners' ignorance, but isn't this actually pretty (really) easy?
It's pretty easy indeed.
  
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