From 97257174c1c83ab45df2d8cf12b7040918edd74b Mon Sep 17 00:00:00 2001 From: ABelliqueux Date: Sat, 26 Dec 2020 16:55:39 +0100 Subject: [PATCH] add 2nd controller instructions --- hello_pad.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/hello_pad.c b/hello_pad.c index 8c274fd..aaf2eb9 100644 --- a/hello_pad.c +++ b/hello_pad.c @@ -174,11 +174,12 @@ int main(void) // Pad stuff - pad = PadRead(0); // Read pad input. id is unused, always 0 + pad = PadRead(0); // Read pads input. id is unused, always 0. + // PadRead() returns a 32 bit value, where input from pad 1 is stored in the low 2 bytes and input from pad 2 is stored in the high 2 bytes. (https://matiaslavik.wordpress.com/2015/02/13/diving-into-psx-development/) + + // D-pad - // D-pad - - if(pad & PADLup) {PADL->y0 = CENTERY - 16;} // 🡩 + if(pad & PADLup) {PADL->y0 = CENTERY - 16;} // 🡩 // To access pad 2, use ( pad >> 16 & PADLup)... if(pad & PADLdown) {PADL->y0 = CENTERY + 16;} // 🡫 if(pad & PADLright){PADL->x0 = CENTERX - 64;} // 🡪 if(pad & PADLleft) {PADL->x0 = CENTERX - 96;} // 🡨