mirror of https://github.com/zeldaret/mm.git
Add more files
This commit is contained in:
parent
53b1539754
commit
54ac4a79d1
|
@ -0,0 +1,7 @@
|
||||||
|
.set noat
|
||||||
|
.set noreorder
|
||||||
|
.set gp=64
|
||||||
|
.macro glabel label
|
||||||
|
.global \label
|
||||||
|
\label:
|
||||||
|
.endm
|
|
@ -0,0 +1,13 @@
|
||||||
|
#ifndef _RAMROM_H_
|
||||||
|
#define _RAMROM_H_
|
||||||
|
|
||||||
|
#include <PR/ultratypes.h>
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
/* 0 */ long type;
|
||||||
|
/* 4 */ long length;
|
||||||
|
/* 8 */ long magic;
|
||||||
|
/* 12 */ unsigned char userdata[24564];
|
||||||
|
} RamRomBuffer;
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,10 @@
|
||||||
|
#ifndef _RDB_H_
|
||||||
|
#define _RDB_H_
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
/* 0 */ unsigned int type : 2;
|
||||||
|
/* 0 */ unsigned int length : 2;
|
||||||
|
/* 1 */ unsigned char buf[3];
|
||||||
|
} rdbPacket;
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,39 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
import shlex
|
||||||
|
import subprocess
|
||||||
|
import tempfile
|
||||||
|
|
||||||
|
dir_path = os.path.dirname(os.path.realpath(__file__))
|
||||||
|
asm_processor = ['python3', os.path.join(dir_path, "tools/asm-processor/asm-processor.py")]
|
||||||
|
prelude = os.path.join(dir_path, "include/prelude.inc")
|
||||||
|
|
||||||
|
all_args = sys.argv[1:]
|
||||||
|
sep1 = all_args.index('--')
|
||||||
|
sep2 = all_args.index('--', sep1+1)
|
||||||
|
|
||||||
|
compiler = all_args[:sep1]
|
||||||
|
|
||||||
|
assembler = all_args[sep1+1:sep2]
|
||||||
|
assembler_sh = ' '.join(shlex.quote(x) for x in assembler)
|
||||||
|
|
||||||
|
compile_args = all_args[sep2+1:]
|
||||||
|
in_file = compile_args[-1]
|
||||||
|
out_ind = compile_args.index('-o')
|
||||||
|
out_file = compile_args[out_ind + 1]
|
||||||
|
del compile_args[-1]
|
||||||
|
del compile_args[out_ind + 1]
|
||||||
|
del compile_args[out_ind]
|
||||||
|
|
||||||
|
in_dir = os.path.split(os.path.realpath(in_file))[0]
|
||||||
|
opt_flags = [x for x in compile_args if x in ['-g', '-O2', '-framepointer']]
|
||||||
|
|
||||||
|
preprocessed_file = tempfile.NamedTemporaryFile(prefix='preprocessed', suffix='.c')
|
||||||
|
|
||||||
|
if opt_flags != []:
|
||||||
|
subprocess.check_call(asm_processor + opt_flags + [in_file], stdout=preprocessed_file)
|
||||||
|
subprocess.check_call(compiler + compile_args + ['-I', in_dir, '-o', out_file, preprocessed_file.name])
|
||||||
|
subprocess.check_call(asm_processor + opt_flags + [in_file, '--post-process', out_file, '--assembler', assembler_sh, '--asm-prelude', prelude])
|
||||||
|
else:
|
||||||
|
subprocess.check_call(compiler + compile_args + ['-I', in_dir, '-o', out_file, in_file])
|
Loading…
Reference in New Issue