| |
Jammer
Registered: Nov 2002 Posts: 1336 |
C64/C128 combo program compilation
Question might turn out plainly stupid so bear with me but I'm total noob on C128.
Can C64 program be compiled to run both on C64 and C128 in its native 128k mode if it has appropriate branches in code? Or it's always two separate tailored builds?
I've already learnt that C128 program startup is either $1C01 or $4001 but if C128 startup was embedded at the right spot, would it still launch? |
|
... 40 posts hidden. Click here to view all posts.... |
| |
zzarko
Registered: Feb 2003 Posts: 77 |
Knowing the machine is knowing the address of the loaded program. Binary could be attached to similar BASIC code. A few more data lines could hold some adjusting values, like to where to copy binary part, and then to jump to that address. Binary part could even have machine-specific sub-parts and so on. No? |
| |
MagerValp
Registered: Dec 2001 Posts: 1078 |
Quoting chatGPZA stub loader is easy to do - the challenge is to make it a single self contained binary :)
My sample project above does that, although I was lazy and only did an 8-bit code relocator and the "program" is just inc $d020. But it's a single .prg that loads and runs on both C64 and C128. |
| |
Krill
Registered: Apr 2002 Posts: 2982 |
While this thread seems to degra^Wmorph into a code golf challenge, i need to re-emphasise that having a single binary run in both C-64 and native C-128 modes is a pointless exercise wrt actual real-life use-cases. =) |
| |
Martin Piper
Registered: Nov 2007 Posts: 726 |
I think the examples given above demonstrate real life use cases.
They are real applications, they have use...
A nice puzzle is to have the BASIC start with only a SYS <simple number>.
It's doable. |
| |
MagerValp
Registered: Dec 2001 Posts: 1078 |
True, you can just use SYS7181 and put startup code at two different offsets in the .prg.
And I disagree that it's useless, file browsers are a good example where it makes sense. Games though maybe not so much. |
Previous - 1 | 2 | 3 | 4 | 5 - Next |