C development and patching for P01/P59
Re: C development and patching for P01/P59
Yeah, now I just have to figure out the correct gcc commands to get a asm file compiled.
LS1 Boost OS V3 Here. For feature suggestions post in here Development Thread. Support future development ->Patreon.
- antus
- Site Admin
- Posts: 8262
- Joined: Sat Feb 28, 2009 8:34 pm
- cars: TX Gemini 2L Twincam
TX Gemini SR20 18psi
Datsun 1200 Ute
Subaru Blitzen '06 EZ30 4th gen, 3.0R Spec B - Contact:
Re: C development and patching for P01/P59
start with the pcmhammer kernel in the pcmhammer repo, get that building then replace the kernel code with your code
https://github.com/LegacyNsfw/PcmHacks/ ... op/Kernels
https://github.com/LegacyNsfw/PcmHacks/ ... op/Kernels
Have you read the FAQ? For lots of information and links to significant threads see here: http://pcmhacking.net/forums/viewtopic.php?f=7&t=1396
Re: C development and patching for P01/P59
Actually, for assembly the PcmHacks/kernels build system would need a little twisting ...
Try this ...
Build.cmd - Slightly twisted for Assembly
Clean.cmd - For keeping tidy
kernel.S - Empty source
kernel.ld - Linker script You know me, I'll answer any questions I can.
Try this ...
Build.cmd - Slightly twisted for Assembly
Clean.cmd - For keeping tidy
kernel.S - Empty source
kernel.ld - Linker script You know me, I'll answer any questions I can.
Intelligence is in the details!
It is easier not to learn bad habits, then it is to break them!
If I was here to win a popularity contest, their would be no point, so I wouldn't be here!
It is easier not to learn bad habits, then it is to break them!
If I was here to win a popularity contest, their would be no point, so I wouldn't be here!
Re: C development and patching for P01/P59
Awesome thanks! That's a great starting point.
LS1 Boost OS V3 Here. For feature suggestions post in here Development Thread. Support future development ->Patreon.
Re: C development and patching for P01/P59
Well I still can't figure out how to create a label that allows me to easily reference addresses.
I've found documentation that shows how to do it but it doesn't want to compile.
I have a simple function I made to test with:
I've tried to put this at the beginning at it won't work even though multiple sources have it formatted in this way.
The branch label works which is great because I've previously had to calculate all the branch values which is really annoying and time consuming.
I've found documentation that shows how to do it but it doesn't want to compile.
I have a simple function I made to test with:
Code: Select all
MAPUpdate:
lsr #1,%d3;
move %d3, (0xFFFFAEEC).w;
nop;
nop;
bra Test;
nop;
Test:
nop;
rts;
Code: Select all
MAP EQU 0xFFFFAEEC;
MAPUpdate:
lsr #1,%d3;
move %d3, (MAP).w;
nop;
nop;
bra Test;
nop;
Test:
nop;
rts;
LS1 Boost OS V3 Here. For feature suggestions post in here Development Thread. Support future development ->Patreon.
Re: C development and patching for P01/P59
Code: Select all
.equ MAP, 0xFFFFAEEC
Intelligence is in the details!
It is easier not to learn bad habits, then it is to break them!
If I was here to win a popularity contest, their would be no point, so I wouldn't be here!
It is easier not to learn bad habits, then it is to break them!
If I was here to win a popularity contest, their would be no point, so I wouldn't be here!
Re: C development and patching for P01/P59
Sweet!
Yeah I did that already. Seems to work either way.
Yeah I did that already. Seems to work either way.
LS1 Boost OS V3 Here. For feature suggestions post in here Development Thread. Support future development ->Patreon.
Re: C development and patching for P01/P59
I still think we can find some compiler switches to make C into usable asm, but I'll admit I haven't tried with th M68k compiler. I got reasonable good code from a different Gnu compiler that I used with Subaru though.
For existing addresses in memory I did this:
And then wrote code like this:
For the P01 / P59, everything is done with integer math, so instead of float you'd have something like:
#define pThrottlePedal ((uint16_t*)0xFFnnnnnn)
For variables that I created in memory, I defined a RamVariables struct, and did this:
And...
For existing addresses in memory I did this:
Code: Select all
#define pRPM ((float*)0xFFFF51F8)
#define pSpeed ((float*)0xFFFF51E8)
#define pFlagsRevLimit_0x80 ((char*) 0xFFFF5A40)
#define pCruiseFlagsA ((char*) 0xFFFF4D65)
#define pLeftTgvVoltage ((float*)0xFFFF2D2C)
#define pThrottlePedal ((float*)0xFFFF5134)
Code: Select all
// Check the clutch switch
if (((*pCruiseFlagsA & 0x80) == 0) ||
(pRamVariables->RevMatchState == RevMatchCalibration))
{
// Normal rev limiter thresholds.
fuelCut = RedlineCut;
fuelResume = RedlineResume;
}
else
{
if (*pSpeed > FlatFootShiftSpeedThreshold)
{
if (*pThrottlePedal > 90.0f)
{
#define pThrottlePedal ((uint16_t*)0xFFnnnnnn)
For variables that I created in memory, I defined a RamVariables struct, and did this:
Code: Select all
#define pRamVariables ((RamVariables*) 0xFFFFA000)
Code: Select all
pRamVariables->VariableName = foo;
foo = pRamVariables->OtherVariableName;
Please don't PM me with technical questions - start a thread instead, and send me a link to it. That way I can answer in public, and help other people who have the same question. Thanks!
Re: C development and patching for P01/P59
Is there any reasonable documentation for the compiler? I was having a really hard time finding anything.
I found this: https://ftp.gnu.org/old-gnu/Manuals/gas ... /as_7.html
Edit: I found this page helpful for more syntax questions... https://ftp.gnu.org/old-gnu/Manuals/gas ... tml#SEC214
I found this: https://ftp.gnu.org/old-gnu/Manuals/gas ... /as_7.html
Edit: I found this page helpful for more syntax questions... https://ftp.gnu.org/old-gnu/Manuals/gas ... tml#SEC214
Last edited by bubba2533 on Thu Mar 10, 2022 5:02 am, edited 1 time in total.
LS1 Boost OS V3 Here. For feature suggestions post in here Development Thread. Support future development ->Patreon.
Re: C development and patching for P01/P59
Command line help is the best, then general GNU docs is all I know of, I'm sure there is others ...
Intelligence is in the details!
It is easier not to learn bad habits, then it is to break them!
If I was here to win a popularity contest, their would be no point, so I wouldn't be here!
It is easier not to learn bad habits, then it is to break them!
If I was here to win a popularity contest, their would be no point, so I wouldn't be here!