Renamed uxn ref to uxnmin

This commit is contained in:
Devine Lu Linvega 2024-02-16 13:40:58 -08:00
parent a84854cb29
commit fa7946e154
2 changed files with 27 additions and 20 deletions

View File

@ -1,16 +1,25 @@
.PHONY: all run test format clean .PHONY: all run test format clean
all: bin/uxn all: bin/uxnmin bin/opctest
run: all run: all
@ wc -c bin/uxn @ bin/uxnmin
@ cat console.tal | bin/uxn drifloon.bin > bin/console.rom @ bin/uxnmin missing.rom
@ bin/uxn test.bin "String sent through stdin" @ bin/uxnmin bin/opctest.rom
@ cat console.tal | bin/uxnmin drifloon.bin > bin/console.rom
@ bin/uxnmin bin/console.rom "String sent through stdin"
format: format:
@ clang-format -i uxn.c @ clang-format -i uxnmin.c
clean: clean:
@ rm -r -f bin @ rm -fr bin
install: all
@ cp bin/uxnmin ~/bin
archive: all
cp uxnmin.c ~/Git/oscean/etc/uxnmin.c.txt
bin/uxn: uxn.c bin/opctest: ../cli/opctest/opctest.tal
@ uxnasm ../cli/opctest/opctest.tal bin/opctest.rom
bin/uxnmin: uxnmin.c
@ mkdir -p bin/ @ mkdir -p bin/
@ cc -std=c89 -Os -DNDEBUG -g0 -s -Wno-unknown-pragmas uxn.c -o bin/uxn @ cc -std=c89 -Os -DNDEBUG -g0 -s -Wno-unknown-pragmas uxnmin.c -o bin/uxnmin
@ wc -c bin/uxnmin

View File

@ -15,14 +15,6 @@ typedef struct Uxn {
int uxn_eval(Uxn *u, Uint16 pc); int uxn_eval(Uxn *u, Uint16 pc);
int
console_input(Uxn *u, char c, int type)
{
Uint16 vector = u->dev[0x10] << 8 | u->dev[0x11];
u->dev[0x12] = c, u->dev[0x17] = type;
return uxn_eval(u, vector);
}
Uint8 Uint8
emu_dei(Uxn *u, Uint8 addr) emu_dei(Uxn *u, Uint8 addr)
{ {
@ -108,24 +100,30 @@ uxn_eval(Uxn *u, Uint16 pc)
} }
} }
void
console_input(Uxn *u, char c, int type)
{
u->dev[0x12] = c, u->dev[0x17] = type;
uxn_eval(u, u->dev[0x10] << 8 | u->dev[0x11]);
}
int int
main(int argc, char **argv) main(int argc, char **argv)
{ {
FILE *f; FILE *f;
int i = 1; int i = 1;
Uxn u = {0}; Uxn u = {0};
if(i == argc) { if(argc < 2) {
fprintf(stdout, "usage: %s file.rom [args..]\n", argv[0]); fprintf(stdout, "usage: %s file.rom [args..]\n", argv[0]);
return 0; return 0;
} }
f = fopen(argv[i++], "rb"); f = fopen(argv[i++], "rb");
if(!f) { if(!f) {
fprintf(stderr, "Failed to initialize %s\n", argv[1]); fprintf(stderr, "uxnmin: Error %s\n", argv[1]);
return 0; return 0;
} }
fread(&u.ram[0x0100], 0xff00, 1, f);
fclose(f);
u.dev[0x17] = argc - i; u.dev[0x17] = argc - i;
fread(&u.ram[0x0100], 0xff00, 1, f), fclose(f);
if(uxn_eval(&u, 0x0100) && (u.dev[0x10] << 8 | u.dev[0x11])) { if(uxn_eval(&u, 0x0100) && (u.dev[0x10] << 8 | u.dev[0x11])) {
for(; i < argc; i++) { for(; i < argc; i++) {
char *p = argv[i]; char *p = argv[i];