CEMETECH
Leading The Way To The Future
Login [Register]
Username:
Password:
Autologin:

Don't have an account? Register now to chat, post, use our tools, and much more.
Latest Headlines
Online Users
There are 109 users online: 2 members, 82 guests and 25 bots.
Members: chickendude.
Bots: Spinn3r (1), Magpie Crawler (4), Yahoo! Slurp (1), Googlebot (18), MSN/Bing (1).
RSS & Social Media
SAX
You must log in to view the SAX chat widget
    » Goto page 1, 2  Next
» View previous topic :: View next topic  
Author Message
Rascherite


New Member


Joined: 09 Nov 2011
Posts: 93
Location: Under a heaping pile of saxophones

Posted: 03 Jan 2012 08:17:07 pm    Post subject: Creating my own z80 linker?

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
Back to top
Ashbad


... I think redheaded girls are kind of cool


Joined: 01 Dec 2010
Posts: 2417
Location: Stomp Stomp Stomp, The Idiot Convention

Posted: 03 Jan 2012 08:24:49 pm    Post subject:

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.
_________________
-Ashbad
Back to top
shkaboinka


Power User


Joined: 30 Jun 2010
Posts: 371
Location: Spokane, WA

Posted: 03 Jan 2012 08:36:14 pm    Post subject:

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.
Back to top
_player1537


Guru-in-Training


Joined: 25 Nov 2009
Posts: 2957

Posted: 03 Jan 2012 08:40:02 pm    Post subject:

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.
_________________
http://tanner.myserverathome.com
Back to top
seana11


Super-Expert


Joined: 23 May 2011
Posts: 833
Location: Well, the sign says "You are here"...

Posted: 03 Jan 2012 08:42:02 pm    Post subject:

_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.
_________________

Code:
-----BEGIN GEEK CODE BLOCK-----
GCS d- s+: a---@ C+++ UL++ P L+++ E- W++ N o? K? w--- O? M--
V- PS++(--) PE- Y+ PGP t 5? X(+) R tv-- b++(+++) DI+(++)
D(+) G e-(*)>++@ h! r!>+++ y?
------END GEEK CODE BLOCK------
decoded
Back to top
_player1537


Guru-in-Training


Joined: 25 Nov 2009
Posts: 2957

Posted: 03 Jan 2012 08:43:22 pm    Post subject:

If Wine didn't work for something as simple as input, string concatenation (sp), and output, no one would even think to use it.
_________________
http://tanner.myserverathome.com
Back to top
seana11


Super-Expert


Joined: 23 May 2011
Posts: 833
Location: Well, the sign says "You are here"...

Posted: 03 Jan 2012 08:45:46 pm    Post subject:

_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.
_________________

Code:
-----BEGIN GEEK CODE BLOCK-----
GCS d- s+: a---@ C+++ UL++ P L+++ E- W++ N o? K? w--- O? M--
V- PS++(--) PE- Y+ PGP t 5? X(+) R tv-- b++(+++) DI+(++)
D(+) G e-(*)>++@ h! r!>+++ y?
------END GEEK CODE BLOCK------
decoded
Back to top
Qwerty.55


Expert


Joined: 08 Dec 2010
Posts: 613

Posted: 03 Jan 2012 08:47:54 pm    Post subject:

_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.
_________________
∂²Ψ -(2m(V(x)-E)Ψ
----- = -------------
∂x² ℏ²Ψ


Last edited by Qwerty.55 on 03 Jan 2012 08:50:34 pm; edited 1 time in total
Back to top
_player1537


Guru-in-Training


Joined: 25 Nov 2009
Posts: 2957

Posted: 03 Jan 2012 08:48:23 pm    Post subject:

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.
_________________
http://tanner.myserverathome.com
Back to top
Ashbad


... I think redheaded girls are kind of cool


Joined: 01 Dec 2010
Posts: 2417
Location: Stomp Stomp Stomp, The Idiot Convention

Posted: 03 Jan 2012 08:49:47 pm    Post subject:

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?
_________________
-Ashbad
Back to top
shkaboinka


Power User


Joined: 30 Jun 2010
Posts: 371
Location: Spokane, WA

Posted: 03 Jan 2012 08:49:57 pm    Post subject:

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


Last edited by shkaboinka on 03 Jan 2012 09:00:36 pm; edited 1 time in total
Back to top
seana11


Super-Expert


Joined: 23 May 2011
Posts: 833
Location: Well, the sign says "You are here"...

Posted: 03 Jan 2012 08:52:06 pm    Post subject:

_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.
_________________

Code:
-----BEGIN GEEK CODE BLOCK-----
GCS d- s+: a---@ C+++ UL++ P L+++ E- W++ N o? K? w--- O? M--
V- PS++(--) PE- Y+ PGP t 5? X(+) R tv-- b++(+++) DI+(++)
D(+) G e-(*)>++@ h! r!>+++ y?
------END GEEK CODE BLOCK------
decoded
Back to top
_player1537


Guru-in-Training


Joined: 25 Nov 2009
Posts: 2957

Posted: 03 Jan 2012 08:53:57 pm    Post subject:

... Yes it is. That's how I got Wine, from the repos. (On the other hand, I got Java from Sun, not the repos).
_________________
http://tanner.myserverathome.com
Back to top
seana11


Super-Expert


Joined: 23 May 2011
Posts: 833
Location: Well, the sign says "You are here"...

Posted: 03 Jan 2012 08:57:53 pm    Post subject:

_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.
_________________

Code:
-----BEGIN GEEK CODE BLOCK-----
GCS d- s+: a---@ C+++ UL++ P L+++ E- W++ N o? K? w--- O? M--
V- PS++(--) PE- Y+ PGP t 5? X(+) R tv-- b++(+++) DI+(++)
D(+) G e-(*)>++@ h! r!>+++ y?
------END GEEK CODE BLOCK------
decoded
Back to top
benryves


Cemetech Expert


Joined: 12 Aug 2008
Posts: 1357
Location: London, United Kingdom

Posted: 03 Jan 2012 09:35:45 pm    Post subject:

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).
Back to top
souvik1997


Guru-in-Training


Joined: 19 Apr 2010
Posts: 2870

Posted: 03 Jan 2012 09:41:56 pm    Post subject:

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).
_________________
CALCnet Tournament-38%


deviantArt
Back to top
benryves


Cemetech Expert


Joined: 12 Aug 2008
Posts: 1357
Location: London, United Kingdom

Posted: 03 Jan 2012 10:22:52 pm    Post subject:

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.
Back to top
TheStorm


NOU!


Joined: 26 Mar 2007
Posts: 2375

Posted: 03 Jan 2012 10:25:28 pm    Post subject:

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.
_________________

"Always code as if the person who will maintain your code is a maniac serial killer that knows where you live" -Unknown

"If you've done something right no one will know that you've done anything at all" -Futurama

"Have a nice day, or not, the choice is yours." Tom Steiner

<Michael_V> or create a Borg collective and call it The 83+
<Michael_V> Lower your slide cases and prepare to be silent linked. Memory clears are futile.
Back to top
Rascherite


New Member


Joined: 09 Nov 2011
Posts: 93
Location: Under a heaping pile of saxophones

Posted: 04 Jan 2012 12:51:53 am    Post subject:

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?
_________________
"If you don't live it, it won't come out of your horn."
-Charlie Parker

TI BASIC Sudoku - optimizing random puzzle generator, making number of preset squares more even and reliable

asm metronome - trying to figure out how to dougie with the interrupts
Back to top
benryves


Cemetech Expert


Joined: 12 Aug 2008
Posts: 1357
Location: London, United Kingdom

Posted: 04 Jan 2012 05:45:18 am    Post subject:

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.
Back to top
Display posts from previous:   
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
    » Goto page 1, 2  Next
» View previous topic :: View next topic  
Page 1 of 2 » All times are GMT - 5 Hours

 
Jump to:  
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

© Copyright 2000-2013 Cemetech & Kerm Martian :: Page Execution Time: 0.038154 seconds.