testing and unfinished changes to main
This commit is contained in:
parent
cc6dd3bc0b
commit
edda7eefb6
|
|
@ -1,16 +1,24 @@
|
|||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Linux",
|
||||
"name": "nspire",
|
||||
"includePath": [
|
||||
"${workspaceFolder}/**",
|
||||
"/home/franchioping/NSpire/Nespire/**",
|
||||
"/home/franchioping/NSpire/Ndless/ndless-sdk/include/*"
|
||||
],
|
||||
"defines": [],
|
||||
"compilerPath": "/usr/bin/clang",
|
||||
"compilerPath": "/home/franchioping/NSpire/Ndless/ndless-sdk/bin/nspire-gcc",
|
||||
"cStandard": "c17",
|
||||
"cppStandard": "c++17",
|
||||
"intelliSenseMode": "linux-gcc-arm"
|
||||
"compilerPathInCppPropertiesJson": "/home/franchioping/NSpire/Ndless/ndless-sdk/bin/nspire-gcc",
|
||||
"mergeConfigurations": false,
|
||||
"browse": {
|
||||
"path": [
|
||||
"/home/franchioping/NSpire/Ndless/ndless-sdk/include/*",
|
||||
"${workspaceFolder}"
|
||||
],
|
||||
"limitSymbolsToIncludedHeaders": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"version": 4
|
||||
|
|
|
|||
|
|
@ -1,3 +1,7 @@
|
|||
{
|
||||
"makefile.makefilePath": ""
|
||||
"makefile.makefilePath": "",
|
||||
"files.associations": {
|
||||
"platform-nspire.h": "c",
|
||||
"*.inc": "c"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
4
|
||||
|
|
@ -1,22 +1,60 @@
|
|||
PREFIX=nspire-
|
||||
DEBUG = FALSE
|
||||
|
||||
all: nes_emu.tns clean_p
|
||||
@echo DONE
|
||||
BLD_FILE ?= .buildver
|
||||
|
||||
nes_emu.tns : nespire.elf
|
||||
genzehn --input $< --output $@ --name "nes_emu"
|
||||
make-prg $@ ./nes_emu.prg.tns
|
||||
# Initiate BLD_FILE if not exists
|
||||
buildver_create := $(shell if ! test -f $(BLD_FILE); then echo 0 > $(BLD_FILE); fi)
|
||||
|
||||
nespire.elf : main.o cpu.o debug.o memory.o ppu.o rom.o menu.o
|
||||
$(PREFIX)ld main.o cpu.o debug.o memory.o ppu.o rom.o menu.o -o $@
|
||||
# Prepare callable function. This function updates BLD_FILE
|
||||
buildver = $(shell echo $$(($$(cat $(BLD_FILE)) + 1)) > $(BLD_FILE))
|
||||
|
||||
VER = buildver
|
||||
|
||||
GCC = nspire-gcc
|
||||
AS = nspire-as
|
||||
GXX = nspire-g++
|
||||
LD = nspire-ld
|
||||
GENZEHN = genzehn
|
||||
|
||||
EXE = nespire$(shell cat $(BLD_FILE))
|
||||
|
||||
|
||||
GCCFLAGS = -Wall -W -marm
|
||||
LDFLAGS =
|
||||
ZEHNFLAGS = --name "$(EXE)"
|
||||
|
||||
ifeq ($(DEBUG),FALSE)
|
||||
GCCFLAGS += -Os
|
||||
else
|
||||
GCCFLAGS += -O0 -g
|
||||
endif
|
||||
|
||||
OBJS = $(patsubst %.c, %.o, $(shell find . -name \*.c))
|
||||
OBJS += $(patsubst %.cpp, %.o, $(shell find . -name \*.cpp))
|
||||
OBJS += $(patsubst %.S, %.o, $(shell find . -name \*.S))
|
||||
DISTDIR = builds
|
||||
|
||||
|
||||
all:$(DISTDIR)/$(EXE).tns
|
||||
|
||||
%.o: %.c
|
||||
$(GCC) $(GCCFLAGS) -c $< -o $@
|
||||
|
||||
%.o: %.cpp
|
||||
$(GXX) $(GCCFLAGS) -c $< -o $@
|
||||
|
||||
%.o: %.S
|
||||
$(PREFIX)gcc -Wall -W -marm -Os -c $< -o $@
|
||||
$(AS) -c $< -o $@
|
||||
|
||||
$(DISTDIR)/$(EXE).elf: $(OBJS)
|
||||
mkdir -p $(DISTDIR)
|
||||
$(LD) $^ -o $@ $(LDFLAGS)
|
||||
|
||||
clean_p:
|
||||
@rm -f *.o nespire.elf
|
||||
$(DISTDIR)/$(EXE).tns: $(DISTDIR)/$(EXE).elf
|
||||
$(GENZEHN) --input $^ --output $@.zehn $(ZEHNFLAGS)
|
||||
$(call buildver)
|
||||
make-prg $@.zehn $@
|
||||
rm $@.zehn
|
||||
|
||||
|
||||
clean: clean_p
|
||||
@rm -f nes_emu.tns nes_emu.prg.tns
|
||||
clean:
|
||||
rm -f $(OBJS)
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -373,6 +373,8 @@ touchpad_read_input:
|
|||
|
||||
.pool
|
||||
|
||||
.extern write_save_state
|
||||
|
||||
save_state:
|
||||
str lr, saved_state_cpu_status+56
|
||||
adr lr, saved_state_cpu_status
|
||||
|
|
@ -392,8 +394,11 @@ save_state:
|
|||
cmp r1, #0
|
||||
bne sstate_loop
|
||||
|
||||
mov r0, #1
|
||||
str r0, save_state_exists
|
||||
|
||||
|
||||
mov r0, saved_state_cpu_status
|
||||
str r1, saved_state_cpu_cpsr
|
||||
bl write_save_state
|
||||
|
||||
ldr lr, saved_state_cpu_status+56 // subroutine return
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,25 @@
|
|||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <libndls.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
#define s_SIZE 0x4600;
|
||||
|
||||
void write_save_state(uint32_t saved_state_cpu_status_addr, uint32_t saved_state_cpu_cpsr);
|
||||
|
||||
void write_save_state(uint32_t saved_state_cpu_status_addr, uint32_t saved_state_cpu_cpsr){
|
||||
size_t lenght = s_SIZE;
|
||||
|
||||
size_t data_size = s_SIZE + sizeof(uint32_t);
|
||||
uint32_t *data = malloc(data_size);
|
||||
|
||||
|
||||
memcpy(data, saved_state_cpu_status_addr, lenght);
|
||||
|
||||
data[data_size-1] = saved_state_cpu_cpsr;
|
||||
|
||||
FILE* savefile = fopen("/documents/ndless/test.tns", "wb");
|
||||
fwrite(data, data_size, 1, savefile);
|
||||
fclose(savefile);
|
||||
}
|
||||
Binary file not shown.
|
|
@ -1 +1 @@
|
|||
6
|
||||
10
|
||||
|
|
|
|||
|
|
@ -32,11 +32,10 @@ endif
|
|||
OBJS = $(patsubst %.c, %.o, $(shell find . -name \*.c))
|
||||
OBJS += $(patsubst %.cpp, %.o, $(shell find . -name \*.cpp))
|
||||
OBJS += $(patsubst %.S, %.o, $(shell find . -name \*.S))
|
||||
DISTDIR = .
|
||||
vpath %.tns $(DISTDIR)
|
||||
vpath %.elf $(DISTDIR)
|
||||
DISTDIR = builds
|
||||
|
||||
all: $(EXE).tns
|
||||
|
||||
all:$(DISTDIR)/$(EXE).tns
|
||||
|
||||
%.o: %.c
|
||||
$(GCC) $(GCCFLAGS) -c $< -o $@
|
||||
|
|
@ -47,15 +46,15 @@ all: $(EXE).tns
|
|||
%.o: %.S
|
||||
$(AS) -c $< -o $@
|
||||
|
||||
$(EXE).elf: $(OBJS)
|
||||
$(DISTDIR)/$(EXE).elf: $(OBJS)
|
||||
mkdir -p $(DISTDIR)
|
||||
$(LD) $^ -o $@ $(LDFLAGS)
|
||||
|
||||
$(EXE).tns: $(EXE).elf
|
||||
$(DISTDIR)/$(EXE).tns: $(DISTDIR)/$(EXE).elf
|
||||
$(GENZEHN) --input $^ --output $@.zehn $(ZEHNFLAGS)
|
||||
$(call buildver)
|
||||
make-prg $@.zehn $@
|
||||
rm $@.zehn
|
||||
|
||||
clean:
|
||||
rm -f $(OBJS) $(DISTDIR)/$(EXE).tns $(DISTDIR)/$(EXE).elf $(DISTDIR)/$(EXE).zehn nespire_mod_*.elf nespire_mod_*.tns
|
||||
rm -f $(OBJS)
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -1,22 +1,24 @@
|
|||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <dirent.h>
|
||||
#include <nspireio/nspireio.h>
|
||||
#include <libndls.h>
|
||||
#include <nspireio/platform-nspire.h>
|
||||
|
||||
void util_stuff();
|
||||
void util_stuff(int argc, char **argv);
|
||||
|
||||
|
||||
int KEYS_TO_QUIT = 2;
|
||||
void util_stuff(int argc, char **argv){
|
||||
|
||||
void util_stuff(){
|
||||
|
||||
printf("Hello World!\n");
|
||||
puts("TEST");
|
||||
|
||||
|
||||
for(int i = 0; i < KEYS_TO_QUIT; i++){
|
||||
wait_key_pressed();
|
||||
// init console
|
||||
nio_console console;
|
||||
nio_init(&console, NIO_MAX_COLS , NIO_MAX_ROWS, 0, 0, NIO_COLOR_BLACK, NIO_COLOR_WHITE, true);
|
||||
nio_set_default(&console);
|
||||
nio_printf("test\n");
|
||||
nio_printf("argc: %d\n", argc);
|
||||
for(int i = 0; i < argc; i++){
|
||||
nio_printf("arg %d: %s\n", i, argv[i]);
|
||||
}
|
||||
|
||||
wait_key_pressed();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
BIN
testing/util.o
BIN
testing/util.o
Binary file not shown.
Loading…
Reference in New Issue