1
0
mirror of https://github.com/kalymos/PsNee.git synced 2026-03-10 04:44:23 +00:00

Ad bios patch 102A, and correct some images.

This commit is contained in:
kalymos
2025-04-22 17:39:36 +02:00
parent 8c35f3d852
commit 687c5575f4
11 changed files with 74 additions and 15 deletions

View File

@@ -1,7 +1,7 @@
#pragma once
#if defined(SCPH_102) || defined(SCPH_100) || defined(SCPH_7000_9000) || defined(SCPH_5500) || defined(SCPH_3500_5000) || defined(SCPH_3000) || defined(SCPH_1000)
#if defined(SCPH_102A) || defined(SCPH_102) || defined(SCPH_100) || defined(SCPH_7000_9000) || defined(SCPH_5500) || defined(SCPH_3500_5000) || defined(SCPH_3000) || defined(SCPH_1000)
void Timer_Start(void);
@@ -9,11 +9,16 @@ void Timer_Stop(void);
extern volatile uint8_t count_isr;
extern volatile uint32_t microsec;
extern volatile uint32_t millisec;
volatile uint8_t impulse = 0;
volatile uint8_t patch = 0;
#endif
#if defined(SCPH_102) || defined(SCPH_100) || defined(SCPH_7000_9000) || defined(SCPH_5500) || defined(SCPH_3500_5000) || defined(SCPH_3000) || defined(SCPH_1000)
ISR(PIN_AX_INTERRUPT_VECTOR) {
impulse++;
if (impulse == TRIGGER){ // If impulse reaches the value defined by TRIGGER, the following actions are performed:
@@ -97,5 +102,46 @@ void Bios_Patching(){
#endif
}
#endif
#ifdef SCPH_102A
void Bios_Patching_SCPH_102A() {
PIN_AX_INPUT; //A18
PIN_DX_INPUT; //D2
Timer_Start();
while (millisec < SATBILIZATIONPOINT); // this is right after SQCK appeared. wait a little to avoid noise
while (PIN_AX_READ != 0);
Timer_Stop();
// {
// ; //wait for stage 1 A18 pulse
// }
Timer_Start();
while (millisec < DELAYPOINT); //wait through stage 1 of A18 activity delay(1350)
Timer_Stop();
//noInterrupts(); // start critical section
Timer_Start();
while (PIN_AX_READ != 0);
{
; //wait for priming A18 pulse
}
//while (microsec < HOLD ); // delayMicroseconds(17) min 13us max 17us for 16Mhz ATmega (maximize this when tuning!)
HOLD;
PIN_DX_CLEAR; // store a low
PIN_DX_OUTPUT; // D2 = output. drags line low now
PATCHING;
//while (microsec < PATCHING ); // delayMicroseconds(4) min 2us for 16Mhz ATmega, 8Mhz requires 3us (minimize this when tuning, after maximizing first us delay!)
PIN_DX_INPUT; // D2 = input / high-z
//interrupts(); // end critical section
Timer_Stop();
// not necessary but I want to make sure these pins are now high-z again
PIN_AX_INPUT;
PIN_DX_INPUT;
}
#endif

View File

@@ -158,7 +158,7 @@
#endif
// Handling the BIOS patch
#if defined(SCPH_102) || defined(SCPH_100) || defined(SCPH_7000_9000) || defined(SCPH_5500) || defined(SCPH_3500_5000) || defined(SCPH_3000) || defined(SCPH_1000)
#if defined(SCPH_102) || defined(SCPH_102A) || defined(SCPH_100) || defined(SCPH_7000_9000) || defined(SCPH_5500) || defined(SCPH_3500_5000) || defined(SCPH_3000) || defined(SCPH_1000)
// Clear the timer interrupt flag
#define TIMER_TIFR_CLEAR TIFR0 |= (1 << OCF0A) // Clear the Timer0 Compare Match A interrupt flag
@@ -262,7 +262,7 @@
#endif
// Handling the BIOS patch
#if defined(SCPH_102) || defined(SCPH_100) || defined(SCPH_7000_9000) || defined(SCPH_5500) || defined(SCPH_3500_5000) || defined(SCPH_3000) || defined(SCPH_1000)
#if defined(SCPH_102) || defined(SCPH_102A) || defined(SCPH_100) || defined(SCPH_7000_9000) || defined(SCPH_5500) || defined(SCPH_3500_5000) || defined(SCPH_3000) || defined(SCPH_1000)
// Pins input
#define PIN_AX_INPUT DDRD &= ~(1 << DDD1)
#define PIN_AY_INPUT DDRD &= ~(1 << DDD0)
@@ -362,7 +362,7 @@
#define PIN_LED_OFF PORTB &= ~(1 << PB3)
#endif
#if !defined(SCPH_xxx1) && !defined(SCPH_xxx2) && !defined(SCPH_103) && !defined(SCPH_xxxx)
#if !defined(SCPH_xxx1) && !defined(SCPH_xxx2) && && !defined(SCPH_xxx3) !defined(SCPH_103) && && !defined(SCPH_101) !defined(SCPH_xxxx)
#error "ATtiny85_45_25 Not compatible with BIOS patch"
#endif

View File

@@ -36,6 +36,7 @@
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
//#define SCPH_102 // DX - D0, AX - A7. BIOS ver. 4.4e, CRC 0BAD7EA9 | 4.5e, CRC 76B880E5
//#define SCPH_102A // ! works in progress DX - D2, AX - A18. BIOS ver. 4.4e, CRC 0BAD7EA9 | 4.5e, CRC 76B880E5
//#define SCPH_100 // DX - D0, AX - A7. BIOS ver. 4.3j, CRC F2AF798B
//#define SCPH_7000_9000 // DX - D0, AX - A7. BIOS ver. 4.0j, CRC EC541CD0
//#define SCPH_5500 // DX - D0, AX - A5. BIOS ver. 3.0j, CRC FF3EEB8C
@@ -49,10 +50,10 @@
//------------------------------------------------------------------------------------------------
//#define ATmega328_168
#define ATmega328_168
//#define ATmega32U4_16U4
//#define ATtiny85_45_25
//#define ATtiny88_48
/*
Fuses:
ATmega - H: DF, L: EE, E: FD.
@@ -86,8 +87,8 @@
// Options
//------------------------------------------------------------------------------------------------
#define LED_RUN // Turns on the LED when injections occur. D13 for Arduino, ATtiny add a led between PB3 (pin 2) and gnd with a 1k resistor in series, ATmega32U4 (Pro Micro) add a led between PB6 (pin 10) and gnd with a 1k resistor in series
#define PATCH_SWITCH // Enables hardware support for disabling BIOS patching. Useful in rare cases where the BIOS patch prevents the playback of original games
//#define LED_RUN // Turns on the LED when injections occur. D13 for Arduino, ATtiny add a led between PB3 (pin 2) and gnd with a 1k resistor in series, ATmega32U4 (Pro Micro) add a led between PB6 (pin 10) and gnd with a 1k resistor in series
//#define PATCH_SWITCH // Enables hardware support for disabling BIOS patching. Useful in rare cases where the BIOS patch prevents the playback of original games
//------------------------------------------------------------------------------------------------
// pointer and variable section
@@ -104,7 +105,7 @@
//Creation of the different variables for the counter
volatile uint8_t count_isr = 0;
volatile uint32_t microsec = 0;
volatile uint16_t millisec = 0;
volatile uint32_t millisec = 0;
//Flag initializing for automatic console generation selection 0 = old, 1 = pu-22 end ++
volatile bool wfck_mode = 0;
@@ -342,14 +343,18 @@ int main() {
Init();
#if defined(BIOS_PATCH)
#ifdef BIOS_PATCH
#ifdef LED_RUN
PIN_LED_ON;
#endif
if (Flag_Switch == 0) {
Bios_Patching();
#ifdef SCPH_102A
Bios_Patching_SCPH_102A();
#else
Bios_Patching();
#endif
}
#ifdef LED_RUN

View File

@@ -17,6 +17,14 @@
*/
#ifdef SCPH_102A
//#define SCEE
#define BIOS_PATCH
#define SATBILIZATIONPOINT 100
#define DELAYPOINT 1350
#define HOLD _delay_us(17)
#define PATCHING _delay_us(4)
#endif
#ifdef SCPH_102
//#define SCEE
@@ -101,7 +109,7 @@
const char region[3] = {'a', 'a', 'a'};
#endif
#if defined(SCPH_102) || defined(SCPH_xxx2)
#if defined(SCPH_102) || defined(SCPH_xxx2) || defined(SCPH_102A)
const char region[3] = {'e', 'e', 'e'};
#endif
@@ -114,7 +122,7 @@ const char region[3] = {'a', 'e', 'i'};
#endif
//All models have bad behavior below 11, PU-41 can start to have bad behavior beyond 20, for fat models we can go up to 60
#if defined(SCPH_100) || defined(SCPH_101) || defined(SCPH_102) || defined(SCPH_103) || defined(SCPH_xxxx)
#if defined(SCPH_100) || defined(SCPH_101) || defined(SCPH_102) || defined(SCPH_102A) || defined(SCPH_103) || defined(SCPH_xxxx)
#define HYSTERESIS_MAX 15
#endif
@@ -125,11 +133,11 @@ const char region[3] = {'a', 'e', 'i'};
#if !defined(SCPH_xxx1) && !defined(SCPH_xxx2) && !defined(SCPH_xxx3) && !defined(SCPH_103) && \
!defined(SCPH_102) && !defined(SCPH_101) && !defined(SCPH_100) && !defined(SCPH_7000_9000) && \
!defined(SCPH_5500) && !defined(SCPH_3500_5000) && !defined(SCPH_3000) && \
!defined(SCPH_1000) && !defined(SCPH_xxxx)
!defined(SCPH_1000) && !defined(SCPH_xxxx) && !defined(SCPH_102A)
#error "Console not selected! Please uncoment #define with SCPH model number."
#elif !(defined(SCPH_xxx1) ^ defined(SCPH_xxx2) ^ defined(SCPH_xxx3) ^ defined(SCPH_103) ^ \
defined(SCPH_102) ^ defined(SCPH_101) ^ defined(SCPH_100) ^ defined(SCPH_7000_9000) ^ \
defined(SCPH_5500) ^ defined(SCPH_3500_5000) ^ defined(SCPH_3000) ^ \
defined(SCPH_1000) ^ defined(SCPH_xxxx))
defined(SCPH_1000) ^ defined(SCPH_xxxx) ^ defined(SCPH_102A))
#error "May be selected only one console! Please check #define with SCPH model number."
#endif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 MiB

After

Width:  |  Height:  |  Size: 5.2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 MiB

After

Width:  |  Height:  |  Size: 5.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 MiB

After

Width:  |  Height:  |  Size: 5.2 MiB

BIN
images/BIOS/32p.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB

After

Width:  |  Height:  |  Size: 1.3 MiB

BIN
images/BIOS/40p.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 MiB