Skip to content

Commit

Permalink
Updated to 1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Lameguy64 committed Sep 28, 2019
1 parent c4a7ee2 commit c3f6f78
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 17 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ if you want to include license data.
Creating a ROM version of LITELOAD requires the loader to be compiled first.

You will also need the following:
* GCC compiler targetting your host (for the exe2bin utility)
* GCC compiler targeting your host (for the exe2bin utility)
* ARMIPS Assembler (get it [here](https://github.com/kingcom/armips)).

1. Compile exe2bin in the rom/util directory as a PC side program.
Expand All @@ -70,7 +70,7 @@ this method and is recommended if you use LITELOAD regularly.


## Upload protocol
If you wish to write your own uploader tool, the following describes LITELOAD's
If you wish to write your own upload tool, the following describes LITELOAD's
communication protocol. The protocol is designed to be as simple and efficient
as possible for simplified integration and provides the fastest upload rate
possible on the already slow serial interface.
Expand Down Expand Up @@ -172,6 +172,10 @@ start:


## Changelog
**Version 1.3 (09/28/2019)**
* Updated debug patch activation logic. Now writes 4 nops from 0xC000
instead of 3 for the new debug monitor patch of PSn00bDEBUG.

**Version 1.2 (07/19/2019)**
* Ported to PSn00bSDK, reducing the loader size from 38KB down to 18KB.
* Patch binary and ROM building guides updated for ARMIPS.
Expand Down
34 changes: 21 additions & 13 deletions main.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <psxetc.h>
Expand All @@ -8,7 +9,7 @@
#include <psxapi.h>
#include <psxsio.h>

#define VERSION "1.2"
#define VERSION "1.3"

#define set_bpc( r0 ) __asm__ volatile ( \
"mtc0 %0, $3;" \
Expand Down Expand Up @@ -38,24 +39,26 @@ typedef struct {
unsigned int crc32;
} BINPARAM;

TILE box;
char command[8];
EXPARAM params;
int y_center;
TILE box;
char command[8];
EXPARAM params;
int y_center;

unsigned short font_tpage;
unsigned short font_clut;

int patch_executed = false;

#define PATCH_ENTRY 0xA000C000

void (*patch_jump)(void) = (void*)0x80010000;


// Serial routines

char* sio_addr = NULL;
int sio_len,sio_read;

#define PATCH_ENTRY 0xC000

void (*patch_jump)(void) = (void*)0x80010000;

void _sioCallback() {

if ( ( sio_read < sio_len ) && ( sio_addr ) ) {
Expand Down Expand Up @@ -195,7 +198,7 @@ void drawtext(int x, int y, const char *text) {
SPRT_8 sprt;
DR_TPAGE tpage;

setDrawTPageVal( &tpage, font_tpage );
setDrawTPage(&tpage, 0, 0, font_tpage);
DrawPrim(&tpage);

setSprt8(&sprt);
Expand Down Expand Up @@ -275,7 +278,7 @@ void SetDefaultExitFromException();
void loadEXE() {

int i;
int* paddr = (int*)PATCH_ENTRY;
volatile int* paddr = (volatile int*)PATCH_ENTRY;

drawbars();
drawmessage("RECEIVING PARAMETERS...");
Expand Down Expand Up @@ -342,8 +345,12 @@ void loadEXE() {
ChangeClearRCnt(3, 1);
SetDefaultExitFromException();

paddr[1] = 0x0; // Enable a loaded debug stub by patching
paddr[0] = 0x0; // the first 2 instructions with nop
if( patch_executed ) {
paddr[0] = 0x0; // Enable a loaded debug stub by patching
paddr[1] = 0x0; // the first 4 instructions with nop
paddr[2] = 0x0; // (updated for new PSn00bDEBUG monitor)
paddr[3] = 0x0;
}

// Set BPC if first bit is set
if( params.exe_flags & 0x1 ) {
Expand Down Expand Up @@ -375,6 +382,7 @@ void loadBIN(int mode) {

if( mode ) {
param.addr = (unsigned int)patch_jump;
patch_executed = true;
}

setread((char*)param.addr, param.size);
Expand Down
2 changes: 1 addition & 1 deletion rom/makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ASM = armips

all: ../liteload.bin liteload.rom
all: ../liteload.bin
$(ASM) -sym liteload.sym romstrap.asm

../liteload.bin: ../liteload.exe
Expand Down
2 changes: 1 addition & 1 deletion system.cnf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
BOOT=cdrom:\liteload.exe;1
BOOT=cdrom:\liteload.exe;1 arg1 arg2 arg3
TCB=4
EVENT=10
STACK=801FFFF0

0 comments on commit c3f6f78

Please sign in to comment.