Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > C64/C128 combo program compilation
2024-08-15 22:47
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?
2024-08-15 23:05
wil

Registered: Jan 2019
Posts: 63
If the I/O area is set to be visible via the MMU, the layout of VIC registers, SID registers, screen (at $400) and color ram ($d800) are identical to the C64, so it should be possible to write a program that starts for example at $1c0d and if executed on the C64, transfers the program there first. Of course, this requires the user to load the program with ",8" on the C64; otherwise, the Basic Sysline is not at $801.

When using Sprites while having the Kernal active, the C128 needs to be told to get its fingers off the sprite registers (by clearing bit 1 of $A04). Note that the user could also have used the GRAPHICS command before loading the program, then the start adress is even at $4001.
2024-08-16 00:02
Count Zero

Registered: Jan 2003
Posts: 1940
BASIC programs can be made "multi platform" more or less easily. Likely in the BBS/terminal field such 64/128 cross platform support can be found.
I remember some filebrowser source which had vc20/c16/c64/c128 code included but that produced several binaries.
2024-08-16 00:31
Jammer

Registered: Nov 2002
Posts: 1336
I'm mostly concerned with asm code run via sysline.
2024-08-16 00:45
Krill

Registered: Apr 2002
Posts: 2981
X-Y problem time! =)

C-128 programs usually run via the boot block. You insert the disk, power up or reset the computer, program boots.

As such, you wouldn't really have to have the very same program run natively on both C-64 and C-128. It'd be an academic exercise with little practical relevance.

So, what do you actually want to achieve?
2024-08-16 00:52
Jammer

Registered: Nov 2002
Posts: 1336
One-filed C64 fps game which runs at slightly better framerate if it detects C128 😃
2024-08-16 01:04
chatGPZ

Registered: Dec 2001
Posts: 11390
for that, just always do the d030 switching in the border. no need to detect anything :) (and then it will automagically also work with other turbos that use that bit)
2024-08-16 01:06
Krill

Registered: Apr 2002
Posts: 2981
Quoting Jammer
One-filed C64 fps game which runs at slightly better framerate if it detects C128 😃
So not running in native C-128 mode?
2024-08-16 01:16
chatGPZ

Registered: Dec 2001
Posts: 11390
BTW, crafting a file that would load and start in c128 mode instead of c64 mode (and still works in c64 mode) is probably possible too (not trivial, and you'll be forced to load ,8 only in one of the modes). I doubt it makes sense for the sort of thing you have in mind though :)
2024-08-16 01:24
Krill

Registered: Apr 2002
Posts: 2981
Quoting chatGPZ
and you'll be forced to load ,8 only in one of the modes)
Could be quite possible to craft an ",8,1" (or BLOAD) autorun program that would work in both C-64 and native C-128 modes.

But then again, quite pointless when there is a boot block (plus not a sensible notion of "one-filer" on C-128).
2024-08-16 04:29
chatGPZ

Registered: Dec 2001
Posts: 11390
oh yeah, with autorun. sure. even more messier :=)
 
... 35 posts hidden. Click here to view all posts....
 
Previous - 1 | 2 | 3 | 4 | 5 - Next
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
Didi/Laxity
Andy/AEG
CA$H/TRiAD
Mr. Commodore/UCF/Un..
t0m3000/hf^boom!^ibx
Guests online: 116
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Coma Light 13  (9.6)
4 Edge of Disgrace  (9.6)
5 Mojo  (9.6)
6 Uncensored  (9.6)
7 The Demo Coder  (9.6)
8 Comaland 100%  (9.6)
9 Wonderland XIV  (9.6)
10 What Is The Matrix 2  (9.6)
Top onefile Demos
1 Layers  (9.7)
2 Cubic Dream  (9.6)
3 Party Elk 2  (9.6)
4 Copper Booze  (9.6)
5 Rainbow Connection  (9.5)
6 Morph  (9.5)
7 Dawnfall V1.1  (9.5)
8 Libertongo  (9.5)
9 Katzen-Video.mp4  (9.5)
10 Onscreen 5k  (9.5)
Top Groups
1 Booze Design  (9.3)
2 Oxyron  (9.3)
3 Performers  (9.3)
4 Fairlight  (9.3)
5 Triad  (9.3)
Top NTSC-Fixers
1 Pudwerx  (10)
2 Stormbringer  (10)
3 Fungus  (9.7)
4 Booze  (9.7)
5 Grim Reaper  (9.3)

Home - Disclaimer
Copyright © No Name 2001-2025
Page generated in: 0.051 sec.