-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved common code to static library, refactored mask-bit test
- Loading branch information
1 parent
0626d0b
commit 79dfb13
Showing
14 changed files
with
263 additions
and
181 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ build/ | |
.vscode/ | ||
.idea/ | ||
|
||
*.a | ||
*.elf | ||
*.exe | ||
*.zip | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
BASEDIR = $(dir $(lastword $(MAKEFILE_LIST))) | ||
include $(BASEDIR)/common.mk | ||
|
||
INCLUDE += -I$(BASEDIR)/common | ||
LIBDIRS += -L$(BASEDIR)/common | ||
LIBS += -lc -lcommon -lpsxetc -lpsxgpu -lpsxapi | ||
|
||
all: $(OFILES) | ||
$(LD) $(LDFLAGS) $(LIBDIRS) $(OFILES) $(LIBS) -o $(TARGET) | ||
elf2x -q $(TARGET) | ||
|
||
clean: | ||
rm -rf build $(TARGET) $(TARGET:.elf=.exe) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
PSN00BSDK ?= /opt/psn00bsdk/ | ||
PREFIX = mipsel-unknown-elf- | ||
INCLUDE := -I$(PSN00BSDK)/libpsn00b/include | ||
LIBDIRS := -L$(PSN00BSDK)/libpsn00b | ||
GCC_VERSION = 7.4.0 | ||
GCC_BASE = /usr/local/mipsel-unknown-elf | ||
|
||
CFLAGS = -g -msoft-float -O2 -fno-builtin -fdata-sections -ffunction-sections | ||
CPPFLAGS = $(CFLAGS) -fno-exceptions | ||
AFLAGS = -g -msoft-float | ||
LDFLAGS = -g -Ttext=0x80010000 -gc-sections -T $(GCC_BASE)/mipsel-unknown-elf/lib/ldscripts/elf32elmip.x | ||
|
||
# Toolchain programs | ||
CC = $(PREFIX)gcc | ||
CXX = $(PREFIX)g++ | ||
AS = $(PREFIX)as | ||
AR = $(PREFIX)ar | ||
LD = $(PREFIX)ld | ||
RANLIB = $(PREFIX)ranlib | ||
|
||
LIBS = | ||
|
||
CFILES = $(notdir $(wildcard *.c)) | ||
CPPFILES = $(notdir $(wildcard *.cpp)) | ||
AFILES = $(notdir $(wildcard *.s)) | ||
OFILES = $(addprefix build/,$(CFILES:.c=.o) $(CPPFILES:.cpp=.o) $(AFILES:.s=.o)) | ||
|
||
build/%.o: %.c | ||
@mkdir -p $(dir $@) | ||
$(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@ | ||
|
||
build/%.o: %.cpp | ||
@mkdir -p $(dir $@) | ||
$(CXX) $(AFLAGS) $(INCLUDE) -c $< -o $@ | ||
|
||
build/%.o: %.s | ||
@mkdir -p $(dir $@) | ||
$(CC) $(AFLAGS) $(INCLUDE) -c $< -o $@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
include ../common.mk | ||
|
||
TARGET = libcommon.a | ||
|
||
all: $(TARGET) | ||
|
||
$(TARGET): $(OFILES) | ||
$(AR) cr $(TARGET) $(OFILES) | ||
$(RANLIB) $(TARGET) | ||
|
||
clean: | ||
rm -Rf build $(TARGET) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#pragma once | ||
#include <stdint.h> | ||
#include <stdio.h> | ||
#include "gpu.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#pragma once | ||
#include "stdint.h" | ||
#include <psxgpu.h> | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
typedef struct CPU2VRAM { | ||
unsigned int tag; | ||
unsigned char p0,p1,p2,code; | ||
unsigned short x0,y0; | ||
unsigned short w,h; | ||
unsigned int data; // Single pixel | ||
} CPU2VRAM; | ||
|
||
typedef struct VRAM2CPU { | ||
unsigned int tag; | ||
unsigned char p0,p1,p2,code; | ||
unsigned short x0,y0; | ||
unsigned short w,h; | ||
} VRAM2CPU; | ||
|
||
void setResolution(int w, int h); | ||
void initVideo(int width, int height); | ||
void fillRect(int x, int y, int w, int h, int r, int g, int b); | ||
void clearScreen(); | ||
|
||
void setMaskBitSetting(bool setBit, bool checkBit); | ||
void gpuNop(); | ||
uint32_t ReadGPUstat(); | ||
void writeGP0(uint8_t cmd, uint32_t value); | ||
void writeGP1(uint8_t cmd, uint32_t data); | ||
|
||
uint32_t readGPU(); | ||
void vramPut(int x, int y, uint16_t pixel); | ||
uint32_t vramGet(int x, int y); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#pragma once | ||
|
||
#define assertEquals(given, expected) \ | ||
do { \ | ||
auto GIVEN = (given); \ | ||
auto EXPECTED = (expected); \ | ||
if (GIVEN == EXPECTED) { \ | ||
printf("pass - %s\n", __FUNCTION__); \ | ||
} else { \ | ||
printf("fail - %s:%d `"#given" == "#expected"`," \ | ||
" given: 0x%x, expected: 0x%x\n", \ | ||
__FUNCTION__, __LINE__, GIVEN, EXPECTED); \ | ||
} \ | ||
} while(0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
include $(PSN00BSDK)/sdk-common.mk | ||
include ../../common-test.mk | ||
|
||
TARGET = mask-bit.elf |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.