pouët.net

Go to bottom

sharing same binary among old computer?

category: offtopic [glöplog]
I wonder if it could have been possible to have one single file that would run on a C64, AppleII or Amstrad computer? The file would have to be exchange via BBS, but once you get the file binary... could some bytes be used differently among those system in order to end up with a start properly on different systems?

The same question can goes for other system like TRS80, Sinclair, Atari, ...
added on the 2013-02-12 19:16:38 by F-Cycles F-Cycles
I remember hearing about a shell code framework that does this, the name escapes me. It's a clever idea
added on the 2013-02-12 20:10:52 by sigflup sigflup
Amstrad has a rather big header you need so you can load anything executable: http://www.cpctech.org.uk/docs/allhead.html

C64 has a smaller header, I think (4 bytes ?).

First of all you'd have to make a header that matches both, and load at a location that's user RAM on both machines. Then, you have to find a way to make each CPU jump to appropriate code. That's the easy part once you solved the header problems.

An easier solution might be to use ASCII files. The Amstrad at least can load ASCII files and parse them as BASIC. Writing a BASIC program that works on all the computers is a challenge as well, but you can try it :)
why would it have to be exchanged via BBS?
added on the 2013-02-12 20:38:39 by rudi rudi
rudi: I say BBS (or internet). But, I don't think you can have a disk image that could fit many system? hum.. but maybe it is possible...
added on the 2013-02-12 20:44:26 by F-Cycles F-Cycles
Even if there was some clever hack to be able to run the same program on many different machines, you'd still get one huge arse binary blob containing roughly the same routine in 5 different incarnations because every machine works a bit different.
added on the 2013-02-12 20:55:02 by ___ ___
There was the Starglider 2 game running on both Amiga and Atari ST, while the disk structures were different. Apart from this i don't know if some parts of the code were shared between both computers (both wit a Motorola 68k cpu)

I also investigated on making an Archimedes/Atari ST binary a loooong time ago (ARM/Motorola 68k cpus). It is possible (i have the magic opcodes somewhere but i doubt you want me to dig it up), but the project was discontinued (if you want the same demo on different cpus, you have to write the code twice, and i went lazy).

So it is possible, go on and play with opcodes and fileformats. Have fun! :)
added on the 2013-02-12 20:57:21 by baah baah
Oh, and the 3d of starglider 2 was cool too...
BB Image
added on the 2013-02-12 20:58:21 by baah baah
Oh and just for fun, here's a polyglot C/Pascal sourcecode...
Code: (* /* C code */ main()) { printf("Hello world!\n"); /* Pascal code *) begin writeln('Hello world!'); end. { */ }
added on the 2013-02-12 21:02:21 by baah baah
Knoeki: I was thinking more about a 1/4kb intro which could be duplicated. Although, does not mean it has to be the same stuff. But, it has to be easy to use, just like any other files on those hardware.

baah: thanks for info... :)
added on the 2013-02-12 21:10:35 by F-Cycles F-Cycles
ok.
some instructions might share the same opcodes. so if rare cases you could perform the same instructions, but each cpu is different that it would probably be useless when most of the opcodes have different values.

like most people say here. you would have to make some obscure initialization and jumps to different parts of code. it would probably work, but the drawback would be that you'd have to code different routines for each cpu.
added on the 2013-02-12 21:13:44 by rudi rudi
another thing is that each hardware is different. the graphics chip (VIC) for the c64 would probably be different from a graphics chip on the Atari. aka different registers.
added on the 2013-02-12 21:16:01 by rudi rudi
That would be cool.

I also remember a greek magazine with bonus 3.5" disk coming in tripple format, Amiga, AtariST and PC. Don't know how they did that.
added on the 2013-02-12 21:20:07 by Optimus Optimus
On machines with same cpu (eg Apple 2/c64 or Amiga/Atari ST) sharing some parts of code (calculus routines) would kick ass, i believe it is possible if fileformats allows it. Also you'll have to find a way to check which machine you're on.

Anyway tell F-Cycles it's useless, maybe he'll prove you wrong! :)
added on the 2013-02-12 21:29:52 by baah baah
This thread can give a bit of quick informations on some filesystems. Not much, though...
added on the 2013-02-12 21:54:51 by baah baah
Thanks baah! haha... well, I forgot most of the info was stored into the header and not on the disk system. But, does not mean it's not possible. But it surely limit what can be done. Although, it was more a question by curiosity than an actual idea of a project.
added on the 2013-02-12 22:46:13 by F-Cycles F-Cycles
MSX should be easy at least with its no-nonsense pure dos binaries. No headers, just load the code at 100h. Have been thinking of at least a MSX+MS-DOS executable prod at some point.
added on the 2013-02-12 23:39:36 by Marq Marq
Marq: same with DOS's .com files. load the code at 100h there and you have something running.

so MSX and DOS's com could in theory be compatible if one hacked something together there?
added on the 2013-02-13 01:29:12 by rudi rudi
hmm, even just shared data files would be cool, shared code seems to exotic to work wonders
You could have some kind of "Universal Demo Loader" ported to different platforms and demos/programs would be files with the binaries for different systems packed it it (for example, C64 code at 100h, CPC code at 210h and ZXS code at 300h) but that would be SO lame.
added on the 2013-02-13 05:31:13 by IvanDSM IvanDSM
even if the opcodes are the same, wouldn't the different memory locations be a problem/
added on the 2013-02-13 08:21:24 by Gargaj Gargaj
If you're talking about the suggestion i said, there would be different code for each computer in separate parts of the file, the problem is it would need a launcher and would take too much space. Otherwise i don't think you can make the same opcodes for different computers, since procedures are different in each computer. On the MSX and DOS thing rudi, Marq and Weyland are talking about i think it's not going to work. On an MSX DOS .exe there's Z80 code and on a PC DOS .exe there's x86 code so i guess compatibility is pretty much impossible.
added on the 2013-02-13 09:43:29 by IvanDSM IvanDSM
I wrote a long explaination about the subject, then Pouet/The browser logged me out so its lost.

To make it short.: Forget about it. Invest your time on more useful things. :)
added on the 2013-02-13 12:37:30 by Exin Exin
Would be cool as easter egg.
added on the 2013-02-13 12:55:59 by Optimus Optimus

login

Go to top