| |
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? |
|
... 35 posts hidden. Click here to view all posts.... |
| |
oziphantom
Registered: Oct 2014 Posts: 490 |
Oh you are using a GTK version, yeah "attach/load" just attaches the image for me. But that is on 3.7.1 might be different on a newer version. |
| |
Jammer
Registered: Nov 2002 Posts: 1336 |
Quoting JackAsserAs GP said. Just flip the bit in the border regardless if it's a C128 or C64. It doesn't matter for the C64, and a C128 user will get the boost. No problems.
I understood you here that I need to keep constant track of switching $d030 for border and visible area but from what I test the thing, it works fine just after switching $d030 to 1 for good and machine keeps track on its own. Anyway, it works, yay! :D |
| |
tlr
Registered: Sep 2003 Posts: 1791 |
Quote: Quoting JackAsserAs GP said. Just flip the bit in the border regardless if it's a C128 or C64. It doesn't matter for the C64, and a C128 user will get the boost. No problems.
I understood you here that I need to keep constant track of switching $d030 for border and visible area but from what I test the thing, it works fine just after switching $d030 to 1 for good and machine keeps track on its own. Anyway, it works, yay! :D
Uhm, are you sure about that? It screws big time with VIC-II output on the c128s I’ve tested. What machine are you running on? |
| |
Jammer
Registered: Nov 2002 Posts: 1336 |
Quoting tlrUhm, are you sure about that? It screws big time with VIC-II output on the c128s I’ve tested. What machine are you running on?
x128, C64 compatible mode in GTK Vice 3.8 r44982. No access to real machine. |
| |
chatGPZ
Registered: Dec 2001 Posts: 11391 |
beware, x128 does not emulate the ViCIIe garbage that you see when switching to 2MHz - try z64k (and certainly the real thing) |
| |
Jammer
Registered: Nov 2002 Posts: 1336 |
Thanks, guys, for the heads up! <3 Is it also same problem with SuperCPU and other accelerators? |
| |
chatGPZ
Registered: Dec 2001 Posts: 11391 |
No, the others don't result in that kind of garbage display. SCPU is an entirely different beast though :) |
| |
zzarko
Registered: Feb 2003 Posts: 77 |
3rd place at Revision 2024 Wild category:
https://www.pouet.net/prod.php?which=96567
The same binary (although with some caveats) works on C64, MSDOS, Linux, SNES, NDS, Gameboy, Gamecube, can be unpacked as a ZIP file (then it contains its complete source) and can be openbed as PDF. For any of these, just change the extension.
So I would guess there is definitely a way to make one binary that runs on C64 and C128 without modifications (I am not saying that I can make one!). |
| |
Martin Piper
Registered: Nov 2007 Posts: 726 |
Quote: 3rd place at Revision 2024 Wild category:
https://www.pouet.net/prod.php?which=96567
The same binary (although with some caveats) works on C64, MSDOS, Linux, SNES, NDS, Gameboy, Gamecube, can be unpacked as a ZIP file (then it contains its complete source) and can be openbed as PDF. For any of these, just change the extension.
So I would guess there is definitely a way to make one binary that runs on C64 and C128 without modifications (I am not saying that I can make one!).
This is nice. As long as the prg is loaded with ,8 and not ,8,1 then it would be relatively easy to make a prg that detects if it is running in C64 or C128. |
| |
oziphantom
Registered: Oct 2014 Posts: 490 |
I guess you could use BASIC to detect which machine you are on, or maybe which version of BASIC you are running?
Set the BASIC error vector to something custom and then try and run a BASIC 7.0 command, if it fails you know you are BASIC 2, if it passes you know you are BASIC 7 and hence then know were the asm code starts. Both the 64 and 128 have the BASIC error vector at $300/1.
However you then still have the issue that your code has to handle being in two different memory locations, but I guess at that point you could jump to a known address at the end of code on a 128 that then copies the main code down to 0801 or wherever you want to start, then apply your patches and then jump to it. |
Previous - 1 | 2 | 3 | 4 | 5 - Next |