![]() |
![]() |
#2661 |
Registered User
![]() Join Date: Aug 2022
Location: UK
Posts: 1,764
|
I have the additional motivation that I want to finish something I started in 1996/97 lol
|
![]() |
![]() |
#2662 |
Registered User
![]() Join Date: Aug 2022
Location: UK
Posts: 1,764
|
On the subject of C/asm interoperability...
There are some functions ported from asm to C that, from the C side would benefit from being easily inlined. Short functions like Sys_MarkTime() that are just wrappers for a call to ReadEClock() for example. Inlining these in C is easy (just declare them in the headers as inline) but we'd need to absolutely ensure that a callable version is emitted to allow it to be called from the assembler side still. Is there a way to guarantee that the compiler will generate an externally callable version of a function that is inlined everywhere else in the C code? The only solution that sprang to mind without going into compiler specifics would be to rename the inline version and have the assembler callable version use it, but that feels really clunky. Alternatively, we could just have completely separate asm versions since the C version uses an underscore at the start of the symbol name anyway and just keep them separate. Inline C version and the assembler cod calls it's own (original) version. More stuff to maintain though. Last edited by Karlos; 28 May 2023 at 16:21. |
![]() |
![]() |
#2663 |
Registered User
![]() Join Date: Feb 2017
Location: Denmark
Posts: 570
|
You can use the esoteric "extern inline" feature (https://en.cppreference.com/w/c/language/inline), but probably nicer to just have few facade functions in C that ASM code can call to deal with register conventions as necessary. I.e.
Code:
// In a header inline ULONG Sys_MarkTime(struct EClockVal* dest) { return ReadEClock(dest); } // In A C file ULONG Sys_MarkTime_ASM(REG(a0, struct EClockVal* dest)) { return Sys_MarkTime(dest); } ![]() |
![]() |
![]() |
#2664 | |
Registered User
![]() Join Date: Aug 2022
Location: UK
Posts: 1,764
|
Quote:
|
|
![]() |
![]() |
#2665 |
Registered User
![]() Join Date: Aug 2022
Location: UK
Posts: 1,764
|
@pipper & @abu
Now that we have RTG and 50Hz can no longer be considered the standard for timing, I am thinking we should use a more consistent timing mechanism. For example, I stead of updating animations every game frame (or multiples thereof), we should probably define a standard animation rate that's independent of the frame rate. I am thinking we can use the timer we added to measure the elapsed time between frames and use that to update a basic counter for the animation frame number when the elapsed time has exceeded a given interval. This way, when the frame rate is high, the animations will run at an approximately constant rate of our choosing (based on that interval) but on slower machines, the increment rate will approach once per frame, thus ensuring the animation doesn't become jerky. |
![]() |
![]() |
#2666 |
Registered User
![]() Join Date: Nov 2018
Location: Italy
Posts: 118
|
@Karlos
In end it may be less work to get it working by compiling the game directly on PPC for OS4/MOS than to adapt the current 68k RTG version to fully work on NG systems :-) |
![]() |
![]() |
#2667 | |
Registered User
![]() Join Date: Aug 2022
Location: UK
Posts: 1,764
|
Quote:
System friendly 68K applications generally run fine directly on NG systems. That's one of, perhaps the the only true benefit of NG today. Absolutely every other semi modern thing they can do at all can be done more easily and for far less expenditure on any contemporary x64 or ARM hardware. I'm not saying an NG port has no place but the target should be a migration to platform agnostic C, not to NG specifically. For that goal, I'd say a clean room reimplementation of the engine is the correct approach. Otherwise you remain locked in by many of the limitations of the original that are difficult to unpick. |
|
![]() |
![]() |
#2668 |
Registered User
![]() Join Date: Nov 2018
Location: Italy
Posts: 118
|
Well from direct experience I noticed that not always old games marked as 68k RTG will actually work well under OS4... maybe they work better on AmigaOS 4 for classic but not on every OS4 compatible machines.. atleast this was my experience by try certain games on my Sam440
Anyway we'll see, I'm available to try it and possibly report to you any eventual problems, you can count on me for betatest ... after all, the source is always available if someone in later future wants to port it directly to OS4 or MorphOS :-) |
![]() |
![]() |
#2669 | |
Registered User
![]() Join Date: Oct 2020
Location: Bicester
Posts: 1,136
|
Quote:
|
|
![]() |
![]() |
#2670 | |
Registered User
![]() Join Date: Jul 2017
Location: San Jose
Posts: 582
|
Quote:
For now I papered over the timing issue by creating a 50Hz timer interrupt to drive the former VBlank stuff on RTG. Not ideal, but seems to work. I think once we have ported most of the game loop to C we can try rearranging things in a more framerate independent way. One thing I would like to keep is the mouse input responsiveness. I always liked how “low latency” the mouse input feels regardless how sluggish the game runs. |
|
![]() |
![]() |
#2671 | |
Registered User
![]() Join Date: Oct 2020
Location: Bicester
Posts: 1,136
|
Quote:
![]() |
|
![]() |
![]() |
#2672 | |
Registered User
![]() Join Date: Aug 2022
Location: UK
Posts: 1,764
|
Quote:
In my opinion, at least, the effort involved in implementing a from scratch version in C or C++ is rather less than trying to convert from ASM to C and in doing so you can avoid lots of pitfalls and plan for new features better. When you write entire applications in assembler you generally don't need to care about things that lend themselves to maintenance and longevity. This gets reflected in the code that is written. |
|
![]() |
![]() |
#2673 | |
Registered User
![]() Join Date: Aug 2022
Location: UK
Posts: 1,764
|
Quote:
|
|
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Alien Breed 3D II The Killing Grounds RTG patch | Angus | Retrogaming General Discussion | 63 | 14 December 2022 15:20 |
Alien Breed & Alien Breed '92: SE - delay when picking up items / opening doors | Ian | support.WinUAE | 16 | 23 December 2016 15:50 |
Alien Breed 3D II : The Killing Grounds code booklet | alexh | support.Games | 19 | 10 October 2012 22:17 |
Alien Breed 3D 2 - The Killing Grounds | Ironclaw | support.Games | 12 | 13 September 2005 13:07 |
HD Version of Alien Breed I ? | Kintaro | request.Old Rare Games | 20 | 31 July 2003 10:48 |
|
|