Skip to content

Commit

Permalink
Add restart ROM functionality, update README
Browse files Browse the repository at this point in the history
  • Loading branch information
ckosmic committed Oct 8, 2020
1 parent 590dd8c commit 0ae071b
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 68 deletions.
38 changes: 36 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,46 @@

Chip-84 is a CHIP-8 and SCHIP-8 interpreter originally written for the TI-84 Plus CE calculator and has been ported to many different systems. This is the PlayStation 1 port a.k.a. the PSX Edition.

This version of Chip-84 is built upon the [PSn00bSDK](https://github.com/Lameguy64/PSn00bSDK) by Lameguy64.
This version of Chip-84 is built upon the [PSn00bSDK](https://github.com/Lameguy64/PSn00bSDK) by Lameguy64 and works on real hardware.

## Building

1. Setup [PSn00bSDK](https://github.com/Lameguy64/PSn00bSDK) by following its build instructions
2. Clone this repository and run `make`
2. Clone this repository and run `make resources`
3. Then run `make`

### Tips
- Use `make resources` to build data.lzp which holds the screen sprite and ROMs
- Change the location of NO$PSX in Makefile and use `make run` to run the built PSX-EXE in NO$PSX
- Use `make iso` to build a .bin and .cue file using mkpsxiso
- You can add/remove ROMs by editing the data.xml file and repacking with `make resources`

## Usage

### In CHIP-8 Program
D-pad Up: Key 1
D-pad Down: Key 2
D-pad Left: Key 3
D-pad Right: Key C
Triangle: Key 4
Cross (X): Key 5
Square: Key 6
Circle: Key D
R1: Key 7
R2 Key 8
L1: Key 9
L2: Key E
Left Stick Down: Key A
Left Stick Up: Key 0
Left Stick Left: Key B
Left Stick Right: Key F

Start: Main menu
R3: Toggle debug mode
Select: Advance frame while in debug mode

### In Menus
Up/Down: Navigate
Left/Right: Raise/lower option values
Cross (X): Select
Circle: Back
2 changes: 0 additions & 2 deletions helper.h

This file was deleted.

26 changes: 0 additions & 26 deletions helper.s

This file was deleted.

57 changes: 19 additions & 38 deletions main.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#include <lzp.h>
#include "helper.h"
#include "chip8.h"

/* OT and Packet Buffer sizes */
Expand Down Expand Up @@ -209,35 +208,6 @@ void menuKeypad(PADTYPE* pad) {
} else {
keys[0xd] = 0;
}
if(!(pad->btn&PAD_R1)) {
if(keys[0x7] == 0)
keys[0x7] = 1;
else if(keys[0x7] == 1)
keys[0x7] = 2;
} else {
keys[0x7] = 0;
}
if(!(pad->btn&PAD_R2)) {
keys[0x8] = 1;
} else {
keys[0x8] = 0;
}
if(!(pad->btn&PAD_L1)) {
keys[0x9] = 1;
} else {
keys[0x9] = 0;
}
if(!(pad->btn&PAD_L2)) {
keys[0xe] = 1;
} else {
keys[0xe] = 0;
}
if(!(pad->btn&PAD_SELECT)) {

}
if(!(pad->btn&PAD_START)) {

}
}
}
}
Expand Down Expand Up @@ -402,6 +372,12 @@ int main(int argc, char* argv[]) {
memcpy(screen_tim.paddr, canvas_data, pixel_number);
}

// PSn00bSDK quirk: for some reason changing the scale of a quad affects the UV
// mapping of it, so I had to mess with the quad's size and UV coords for it
// to work on real hardware. In NO$PSX, it'll look kinda weird, but XEBRA, mednafen
// or a real PS1 should look relatively normal. I say relatively because the bottom
// right edges of the screen are cut off a bit.

// Draw screen quad
quad = (POLY_FT4*)db_nextpri;
setPolyFT4(quad);
Expand Down Expand Up @@ -539,18 +515,22 @@ int main(int argc, char* argv[]) {
selection++;
}
}
if(selection < 0) selection = 3;
if(selection > 3) selection = 0;
if(selection < 0) selection = 4;
if(selection > 4) selection = 0;

if(keys[0x5] == 0 && tmp == 2) {
if(selection == 0) {
mode = 0;
break;
} else if(selection == 1) {
loadProgramPsx(fileSelection);
mode = 0;
break;
} else if(selection == 2) {
selection = 0;
mode = 1;
break;
} else if(selection == 3) {
} else if(selection == 4) {
debugMode ^= 1;
//mode = 0;
cpf = 1;
Expand All @@ -560,18 +540,19 @@ int main(int argc, char* argv[]) {


FntPrint(fntStream, "\n MAIN MENU\n\n");
char menuItems[4][32] = {
char menuItems[5][32] = {
"RESUME",
"RESTART",
"CHOOSE A ROM...",
"CYCLES PER FRAME: ",
"DEBUG MODE: OFF"
};
if(debugMode)
strcpy(menuItems[3], "DEBUG MODE: ON ");
for(i = 0; i < 4; i++) {
strcpy(menuItems[4], "DEBUG MODE: ON ");
for(i = 0; i < 5; i++) {
char menuItemBuffer[20];
if(i == 2) {
if(selection == 2) {
if(i == 3) {
if(selection == 3) {
if(keys[0x3] == 1) {
frameRef = frame;
cpf--;
Expand Down

0 comments on commit 0ae071b

Please sign in to comment.