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?
 
... 35 posts hidden. Click here to view all posts....
 
2024-08-16 11:27
Jammer

Registered: Nov 2002
Posts: 1336
Should Vice C128 switch back to 128 mode and crash the machine if I only attach/load file in GO64 mode?
2024-08-16 11:36
oziphantom

Registered: Oct 2014
Posts: 490
if you autostart it, it will then reset the machine and hence boot in 128 mode. You need to attach the d64 and then load in C64 mode.
2024-08-16 11:41
tlr

Registered: Sep 2003
Posts: 1791
Quote: Quoting tlr
Simply include $2c/PEEK(44) in your address calculations.

Using this method you can make a binary that starts from basic on most/all commodore 8-bits.


In C128 mode basic start is at $2d/$2e instead, so it requires a little more logic. Certainly still doable, but I don't think I've seen a ready to use basic stub for both C64 and C128?


Aha, didn't know that. Seems it's different on the PET as well now that I look it up. It's apparently only the kernal that is somewhat compatible.
2024-08-16 11:46
Krill

Registered: Apr 2002
Posts: 2981
Quoting Jammer
If I can switch to 2MHz in C64 mode as well, that's perfectly what I need. Thanks!
Great! :)

Your original "C128 in its native 128k mode" implied actual native C-128 mode usage, such as using all 128 KB of RAM, relocateable zeropage and stack, double-buffered $D800 colour RAM and whatnot.

But if you only need 2 MHz, awesome. =)

Take care to have smoother but not faster gameplay with various turbo speeds of up to 48 MHz (update state in VBL or using the timers).

Wolfenstein engine thingy in One-Der is a good example for that, plays silky-smooth on U64@48MHz.
2024-08-16 11:52
Jammer

Registered: Nov 2002
Posts: 1336
Quoting oziphantom
if you autostart it, it will then reset the machine and hence boot in 128 mode. You need to attach the d64 and then load in C64 mode.


There's 'Autostart' option and 'Attach/Load' which, I guess, shouldn't reset the machine, only fill memory with file data. It works properly for x64sc at least but I suppose it's that bootblock mechanism, inherent to C128?
2024-08-16 12:00
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.
2024-08-16 12:57
Jammer

Registered: Nov 2002
Posts: 1336
Quoting JackAsser
As 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
2024-08-16 13:13
tlr

Registered: Sep 2003
Posts: 1791
Quote: Quoting JackAsser
As 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?
2024-08-16 13:20
Jammer

Registered: Nov 2002
Posts: 1336
Quoting tlr
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?

x128, C64 compatible mode in GTK Vice 3.8 r44982. No access to real machine.
2024-08-16 13:28
chatGPZ

Registered: Dec 2001
Posts: 11390
beware, x128 does not emulate the ViCIIe garbage that you see when switching to 2MHz - try z64k (and certainly the real thing)
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
CA$H/TRiAD
pastbytes
Devia/Ancients
MWR/Visdom
Asphodel
iAN CooG/HVSC
j0x
Guests online: 118
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 Graphicians
1 Hend  (9.8)
2 Mirage  (9.7)
3 Archmage  (9.7)
4 Pal  (9.6)
5 Carrion  (9.6)

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