mirror of
https://github.com/Ed94/pikuma_ps1.git
synced 2026-06-01 18:41:13 -07:00
Compare commits
6 Commits
d2d47ac8a4
..
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 27667a4232 | |||
| 11cc936d2d | |||
| 679c022625 | |||
| b81221cbf5 | |||
| fe4bd6d86d | |||
| 8b5fb7a5a1 |
+5
-1
@@ -16,7 +16,11 @@ indent_size = 4
|
|||||||
indent_style = space
|
indent_style = space
|
||||||
indent_size = 4
|
indent_size = 4
|
||||||
|
|
||||||
[*{.h, .c, .hpp, .cpp}]
|
[*.h]
|
||||||
|
indent_style = tab
|
||||||
|
indent_size = 2
|
||||||
|
|
||||||
|
[*.c]
|
||||||
indent_style = tab
|
indent_style = tab
|
||||||
indent_size = 2
|
indent_size = 2
|
||||||
|
|
||||||
|
|||||||
+141
-124
@@ -3,105 +3,123 @@
|
|||||||
# include "assert.h"
|
# include "assert.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define LP_ static // local_persist
|
|
||||||
#define internal static // internal
|
|
||||||
#define global
|
|
||||||
#define gknown
|
|
||||||
|
|
||||||
#define align_(value) __attribute__((aligned (value))) // for easy alignment
|
|
||||||
#define expect_(x, y) __builtin_expect(x, y) // so compiler knows the common path
|
|
||||||
#define FI_ static inline __attribute__((always_inline)) // force inline
|
|
||||||
#define NI_ static __attribute__((noinline)) // force no inline [used in thread api]
|
|
||||||
#define R_ __restrict // pointers are either restricted or volatile and nothing else
|
|
||||||
#define V_ volatile // pointers are either restricted or volatile and nothing else
|
|
||||||
|
|
||||||
#define glue_impl(A, B) A ## B
|
|
||||||
#define glue(A, B) glue_impl(A, B)
|
|
||||||
#define stringify_impl(S) #S
|
|
||||||
#define stringify(S) stringify_impl(S)
|
|
||||||
#define tmpl(prefix, type) prefix ## _ ## type
|
|
||||||
|
|
||||||
#define offset_of(type, member) cast(U8,__builtin_offsetof(type,member))
|
#define offset_of(type, member) cast(U8,__builtin_offsetof(type,member))
|
||||||
#define static_assert _Static_assert
|
#define static_assert _Static_assert
|
||||||
#define typeof __typeof__
|
#define typeof __typeof__
|
||||||
#define typeof_ptr(ptr) typeof((ptr)[0])
|
#define typeof_ptr(ptr) typeof((ptr)[0])
|
||||||
#define typeof_same(a, b) _Generic((a), typeof((b)): 1, default: 0)
|
#define typeof_same(a, b) _Generic((a), typeof((b)): 1, default: 0)
|
||||||
|
|
||||||
#define def_R_(type) type*restrict type ## _R
|
#define m_expand(...) __VA_ARGS__
|
||||||
#define def_V_(type) type*volatile type ## _V
|
#define glue_impl(A, B) A ## B
|
||||||
#define def_ptr_set(type) def_R_(type); typedef def_V_(type)
|
#define glue(A, B) glue_impl(A, B)
|
||||||
#define def_tset(type) type; typedef def_ptr_set(type)
|
#define tmpl(prefix, type) prefix ## _ ## type
|
||||||
|
|
||||||
typedef __UINT8_TYPE__ def_tset(U1);
|
#define stringify_impl(S) #S
|
||||||
typedef __UINT16_TYPE__ def_tset(U2);
|
#define stringify(S) stringify_impl(S)
|
||||||
typedef __UINT32_TYPE__ def_tset(U4);
|
|
||||||
typedef __INT8_TYPE__ def_tset(S1);
|
#define VA_Sel_1( _1, ... ) _1 // <-- Of all th args passed pick _1.
|
||||||
typedef __INT16_TYPE__ def_tset(S2);
|
#define VA_Sel_2( _1, _2, ... ) _2 // <-- Of all the args passed pick _2.
|
||||||
typedef __INT32_TYPE__ def_tset(S4);
|
#define VA_Sel_3( _1, _2, _3, ... ) _3 // etc..
|
||||||
typedef unsigned char def_tset(B1);
|
|
||||||
typedef __UINT16_TYPE__ def_tset(B2);
|
#define global static // Mark global data
|
||||||
typedef __UINT32_TYPE__ def_tset(B4);
|
#define gknown // Mark global data used in procedure
|
||||||
typedef __UINT64_TYPE__ def_tset(B8);
|
|
||||||
|
#define LP_ static // static data within procedure scope
|
||||||
|
#define internal static // internal
|
||||||
|
|
||||||
|
#define asm __asm__
|
||||||
|
#define align_(value) __attribute__((aligned (value))) // for easy alignment
|
||||||
|
#define C_(type,data) ((type)(data)) // for enforced precedence
|
||||||
|
#define expect_(x, y) __builtin_expect(x, y) // so compiler knows the common path
|
||||||
|
#define I_ internal inline
|
||||||
|
#define FI_ inline __attribute__((always_inline)) // inline always
|
||||||
|
#define NI_ internal __attribute__((noinline)) // inline never
|
||||||
|
#define RO_ __attribute__((section(".rodata"))) // Read only data allocation
|
||||||
|
#define R_ restrict // pointers are either restricted or volatile and nothing else
|
||||||
|
#define V_ volatile // pointers are either restricted or volatile and nothing else
|
||||||
|
#define T_ typeof
|
||||||
|
#define T_same(a,b) _Generic((a), typeof((b)): 1, default: 0)
|
||||||
|
|
||||||
|
#define r_(ptr) C_(T_(ptr[0])*R_, ptr)
|
||||||
|
#define v_(ptr) C_(T_(ptr[0])*V_, ptr)
|
||||||
|
#define tr_(type, ptr) C_(type*R_, ptr)
|
||||||
|
#define tv_(type, ptr) C_(type*V_, ptr)
|
||||||
|
|
||||||
|
#define TypeR_(type) type*restrict type ## _R
|
||||||
|
#define TypeV_(type) type*volatile type ## _V
|
||||||
|
#define PtrSet_(type) TypeR_(type); typedef TypeV_(type)
|
||||||
|
#define TSet_(type) type; typedef PtrSet_(type)
|
||||||
|
|
||||||
|
#define array_len(a) (U8)(sizeof(a) / sizeof(typeof((a)[0])))
|
||||||
|
#define array_decl(type, ...) (type[]){__VA_ARGS__}
|
||||||
|
#define Array_sym(type,len) A ## len ## _ ## type
|
||||||
|
#define Array_expand(type,len) type Array_sym(type, len)[len]; typedef PtrSet_(Array_sym(type, len))
|
||||||
|
#define Array_(type,len) Array_expand(type,len)
|
||||||
|
#define Bit_(id,b) id = (1 << b), tmpl(id,pos) = b
|
||||||
|
#define Enum_(underlying_type, symbol) underlying_type TSet_(symbol); enum symbol
|
||||||
|
#define Proc_(symbol) symbol
|
||||||
|
#define Struct_(symbol) struct symbol TSet_(symbol); struct symbol
|
||||||
|
#define Union_(symbol) union symbol TSet_(symbol); union symbol
|
||||||
|
|
||||||
|
#define Opt_(proc) Struct_(tmpl(Opt,proc))
|
||||||
|
#define opt_(symbol, ...) (tmpl(Opt,symbol)){__VA_ARGS__}
|
||||||
|
#define Ret_(proc) Struct_(tmpl(Ret,proc))
|
||||||
|
#define ret_(proc) tmpl(Ret,proc) proc
|
||||||
|
|
||||||
|
// Using Byte-Width convention for the fundamental types.
|
||||||
|
typedef __UINT8_TYPE__ TSet_(U1);
|
||||||
|
typedef __UINT16_TYPE__ TSet_(U2);
|
||||||
|
typedef __UINT32_TYPE__ TSet_(U4);
|
||||||
|
typedef __INT8_TYPE__ TSet_(S1);
|
||||||
|
typedef __INT16_TYPE__ TSet_(S2);
|
||||||
|
typedef __INT32_TYPE__ TSet_(S4);
|
||||||
|
typedef unsigned char TSet_(B1);
|
||||||
|
typedef __UINT16_TYPE__ TSet_(B2);
|
||||||
|
typedef __UINT32_TYPE__ TSet_(B4);
|
||||||
|
|
||||||
|
#define u1_(value) C_(U1, value)
|
||||||
|
#define u2_(value) C_(U2, value)
|
||||||
|
#define u4_(value) C_(U4, value)
|
||||||
|
#define s1_(value) C_(S1, value)
|
||||||
|
#define s2_(value) C_(S2, value)
|
||||||
|
#define s4_(value) C_(S4, value)
|
||||||
|
|
||||||
|
#define u1_r(value) C_(U1*R_, value)
|
||||||
|
#define u2_r(value) C_(U2*R_, value)
|
||||||
|
#define u4_r(value) C_(U4*R_, value)
|
||||||
|
#define u1_v(value) C_(U1*V_, value)
|
||||||
|
#define u2_v(value) C_(U2*V_, value)
|
||||||
|
#define u4_v(value) C_(U4*V_, value)
|
||||||
enum { false = 0, true = 1, true_overflow, };
|
enum { false = 0, true = 1, true_overflow, };
|
||||||
|
|
||||||
#define u1_r(value) cast(U1_R, value)
|
typedef void Proc_(VoidFn) (void);
|
||||||
#define u2_r(value) cast(U2_R, value)
|
|
||||||
#define u4_r(value) cast(U4_R, value)
|
|
||||||
#define u1_v(value) cast(U1_V, value)
|
|
||||||
#define u2_v(value) cast(U2_V, value)
|
|
||||||
#define u4_v(value) cast(U4_V, value)
|
|
||||||
|
|
||||||
#define u1_(value) cast(U1, value)
|
#define kilo(n) (C_(U4, n) << 10)
|
||||||
#define u2_(value) cast(U2, value)
|
#define mega(n) (C_(U4, n) << 20)
|
||||||
#define u4_(value) cast(U4, value)
|
#define giga(n) (C_(U4, n) << 30)
|
||||||
#define s1_(value) cast(S1, value)
|
#define tera(n) (C_(U4, n) << 40)
|
||||||
#define s2_(value) cast(S2, value)
|
#define null C_(U4, 0)
|
||||||
#define s4_(value) cast(S4, value)
|
#define nullptr C_(void*, 0)
|
||||||
|
#define O_(type,member) C_(U4,__builtin_offsetof(type,member))
|
||||||
|
#define S_(data) C_(U4, sizeof(data))
|
||||||
|
|
||||||
#define farray_len(array) (SSIZE)sizeof(array) / size_of( typeof((array)[0]))
|
#define sop_1(op,a,b) C_(U1, s1_(a) op s1_(b))
|
||||||
#define farray_init(type, ...) (type[]){__VA_ARGS__}
|
#define sop_2(op,a,b) C_(U2, s2_(a) op s2_(b))
|
||||||
#define def_farray_sym(_type, _len) A ## _len ## _ ## _type
|
#define sop_4(op,a,b) C_(U4, s4_(a) op s4_(b))
|
||||||
#define def_farray_impl(_type, _len) _type def_farray_sym(_type, _len)[_len]; typedef def_ptr_set(def_farray_sym(_type, _len))
|
|
||||||
#define def_farray(type, len) def_farray_impl(type, len)
|
|
||||||
#define def_enum(underlying_type, symbol) underlying_type def_tset(symbol); enum symbol
|
|
||||||
#define def_struct(symbol) struct symbol def_tset(symbol); struct symbol
|
|
||||||
#define def_union(symbol) union symbol def_tset(symbol); union symbol
|
|
||||||
#define def_proc(symbol) symbol
|
|
||||||
#define opt_args(symbol, ...) &(symbol){__VA_ARGS__}
|
|
||||||
#define ret_type(type) type
|
|
||||||
|
|
||||||
#define o_(field) offset_of(typeof_ptr(& field), filed))
|
|
||||||
|
|
||||||
#define alignas _Alignas
|
|
||||||
#define alignof _Alignof
|
|
||||||
#define byte_pad(amount, ...) B1 glue(_PAD_, __VA_ARGS__) [amount]
|
|
||||||
#define cast(type, data) ((type)(data))
|
|
||||||
#define pcast(type, data) (cast(type*, & (data)) [0])
|
|
||||||
#define nullptr cast(void*, 0)
|
|
||||||
#define size_of(data) cast(U4, sizeof(data))
|
|
||||||
|
|
||||||
#define r_(ptr) cast(typeof_ptr(ptr)*R_, ptr)
|
|
||||||
#define v_(ptr) cast(typeof_ptr(ptr)*V_, ptr)
|
|
||||||
#define tr_(type, ptr) cast(type*R_, ptr)
|
|
||||||
#define tv_(type, ptr) cast(type*V_, ptr)
|
|
||||||
|
|
||||||
#define kilo(n) (cast(U4, n) << 10)
|
|
||||||
#define mega(n) (cast(U4, n) << 20)
|
|
||||||
#define giga(n) (cast(U4, n) << 30)
|
|
||||||
#define tera(n) (cast(U4, n) << 40)
|
|
||||||
|
|
||||||
#define dbg_args(...) __VA_ARGS__
|
|
||||||
|
|
||||||
#define sop_1(op, a, b) cast(U1, s1_(a) op s1_(b))
|
|
||||||
#define sop_2(op, a, b) cast(U2, s2_(a) op s2_(b))
|
|
||||||
#define sop_4(op, a, b) cast(U4, s4_(a) op s4_(b))
|
|
||||||
|
|
||||||
|
#undef def_signed_op
|
||||||
#define def_signed_op(id,op,width) FI_ U ## width id ## _s ## width(U ## width a, U ## width b) {return sop_ ## width(op, a, b); }
|
#define def_signed_op(id,op,width) FI_ U ## width id ## _s ## width(U ## width a, U ## width b) {return sop_ ## width(op, a, b); }
|
||||||
#define def_signed_ops(id,op) def_signed_op(id, op, 1) def_signed_op(id, op, 2) def_signed_op(id, op, 4)
|
#define def_signed_ops(id,op) def_signed_op(id, op, 1) def_signed_op(id, op, 2) def_signed_op(id, op, 4)
|
||||||
def_signed_ops(add, +) def_signed_ops(sub, -)
|
def_signed_ops(add, +)
|
||||||
def_signed_ops(mut, *) def_signed_ops(div, /)
|
def_signed_ops(sub, -)
|
||||||
def_signed_ops(gt, >) def_signed_ops(lt, <)
|
def_signed_ops(mut, *)
|
||||||
def_signed_ops(ge, >=) def_signed_ops(le, <=)
|
def_signed_ops(div, /)
|
||||||
|
def_signed_ops(gt, >)
|
||||||
|
def_signed_ops(lt, <)
|
||||||
|
def_signed_ops(ge, >=)
|
||||||
|
def_signed_ops(le, <=)
|
||||||
|
#undef def_signed_ops
|
||||||
|
#undef def_signed_op
|
||||||
|
|
||||||
#define def_generic_sop(op, a, ...) _Generic((a), U1: op ## _s1, U2: op ## _s2, U4: op ## _s4) (a, __VA_ARGS__)
|
#define def_generic_sop(op, a, ...) _Generic((a), U1: op ## _s1, U2: op ## _s2, U4: op ## _s4) (a, __VA_ARGS__)
|
||||||
#define add_s(a,b) def_generic_sop(add,a,b)
|
#define add_s(a,b) def_generic_sop(add,a,b)
|
||||||
@@ -111,6 +129,29 @@ def_signed_ops(ge, >=) def_signed_ops(le, <=)
|
|||||||
#define lt_s(a,b) def_generic_sop(lt, a,b)
|
#define lt_s(a,b) def_generic_sop(lt, a,b)
|
||||||
#define ge_s(a,b) def_generic_sop(ge, a,b)
|
#define ge_s(a,b) def_generic_sop(ge, a,b)
|
||||||
#define le_s(a,b) def_generic_sop(le, a,b)
|
#define le_s(a,b) def_generic_sop(le, a,b)
|
||||||
|
#undef def_generic_sop
|
||||||
|
|
||||||
|
#define o_(field) offset_of(typeof_ptr(& field), filed))
|
||||||
|
|
||||||
|
#define alignas _Alignas
|
||||||
|
#define alignof _Alignof
|
||||||
|
#define byte_pad(amount, ...) B1 glue(_PAD_, __VA_ARGS__) [amount]
|
||||||
|
#define pcast(type, data) (C_(type*, & (data)) [0])
|
||||||
|
|
||||||
|
#define dbg_args(...) __VA_ARGS__
|
||||||
|
|
||||||
|
#pragma region Control Flow & Iteration
|
||||||
|
#define each_iter(type, iter, end) (type iter = 0; iter < end; ++ iter)
|
||||||
|
#define index_iter(type, iter, begin, op, end) (type iter = begin; iter op end; (begin < end ? ++ iter : -- iter))
|
||||||
|
#define range_iter(iter,op,range) (T_((range).p0) iter = (range).p0; iter op (range).p1; ((range).p0 < (range).p1 ? ++ iter : -- iter))
|
||||||
|
|
||||||
|
#define defer(expr) for(U4 once= 1; once!=1;++ once,(expr)) // Basic do something after body
|
||||||
|
#define scope(begin,end) for(U4 once=(1,(begin)); once!=1;++ once,(end )) // Do things before or after a scope
|
||||||
|
#define defer_rewind(cursor) for(T_(cursor) sp=cursor,once=0; once!=1;++ once,cursor=sp) // Used with arenas/stacks
|
||||||
|
#define defer_info(type,expr, ...) for(type info= {__VA_ARGS__}; info.once!=1;++info.once,(expr)) // Defer with tracked state
|
||||||
|
|
||||||
|
#define do_while(cond) for (U8 once=0; once!=1 || (cond); ++once)
|
||||||
|
#pragma endregion Control Flow & Iteration
|
||||||
|
|
||||||
#define span_iter(type, iter, m_begin, op, m_end) ( \
|
#define span_iter(type, iter, m_begin, op, m_end) ( \
|
||||||
tmpl(Iter_Span,type) iter = { \
|
tmpl(Iter_Span,type) iter = { \
|
||||||
@@ -119,44 +160,20 @@ def_signed_ops(ge, >=) def_signed_ops(le, <=)
|
|||||||
iter.cursor op iter.r.end; \
|
iter.cursor op iter.r.end; \
|
||||||
++ iter.cursor \
|
++ iter.cursor \
|
||||||
)
|
)
|
||||||
#define def_span(type) \
|
#define Span_(type) \
|
||||||
def_struct(tmpl( Span,type)) { type begin; type end; }; \
|
Struct_(tmpl( Span,type)) { type begin; type end; }; \
|
||||||
typedef def_struct(tmpl(Iter_Span,type)) { tmpl(Span,type) r; type cursor; }
|
typedef Struct_(tmpl(Iter_Span,type)) { tmpl(Span,type) r; type cursor; }
|
||||||
|
|
||||||
typedef def_span(S4);
|
typedef Span_(S4);
|
||||||
typedef def_span(U4);
|
typedef Span_(U4);
|
||||||
|
|
||||||
typedef void def_proc(VoidFn) (void);
|
#if 0
|
||||||
|
#pragma region Debug
|
||||||
typedef unsigned char def_tset(UTF8);
|
#define debug_trap() __builtin_debugtrap()
|
||||||
typedef def_struct(Str8) { UTF8* ptr; U4 len; }; typedef Str8 def_tset(Slice_UTF8);
|
#if BUILD_DEBUG
|
||||||
typedef def_struct(Slice_Str8) { Str8* ptr; U4 len; };
|
IA_ void assert(U8 cond) { if(cond){return;} else{debug_trap(); ms_exit_process(1);} }
|
||||||
#define txt(string_literal) (Str8){ (UTF8*) string_literal, size_of(string_literal) - 1 }
|
#else
|
||||||
|
#define assert(cond)
|
||||||
#define def_Slice(type) def_struct(tmpl(Slice,type)) { type* ptr; U4 len; }
|
#endif
|
||||||
#define slice_assert(slice) do { assert((slice).ptr != nullptr); assert((slice).len > 0); } while(0)
|
#pragma endregion Debug
|
||||||
#define slice_end(slice) ((slice).ptr + (slice).len)
|
#endif
|
||||||
#define size_of_slice_type(slice) size_of((slice).ptr[0])
|
|
||||||
|
|
||||||
typedef def_Slice(void);
|
|
||||||
typedef def_Slice(B1);
|
|
||||||
#define slice_byte(slice) ((Slice_B1){cast(B1*, (slice).ptr), (slice).len * size_of_slice_type(slice)})
|
|
||||||
#define slice_fmem(mem) ((Slice_B1){ mem, size_of(mem) })
|
|
||||||
|
|
||||||
void slice__copy(Slice_B1 dest, U4 dest_typewidth, Slice_B1 src, U4 src_typewidth);
|
|
||||||
void slice__zero(Slice_B1 mem, U4 typewidth);
|
|
||||||
#define slice_copy(dest, src) do { \
|
|
||||||
static_assert(typeof_same(dest, src)); \
|
|
||||||
slice__copy(slice_byte(dest), size_of_slice_type(dest), slice_byte(src), size_of_slice_type(src)); \
|
|
||||||
} while (0)
|
|
||||||
#define slice_zero(slice) slice__zero(slice_byte(slice), size_of_slice_type(slice))
|
|
||||||
|
|
||||||
#define slice_iter(container, iter) ( \
|
|
||||||
typeof((container).ptr) iter = (container).ptr; \
|
|
||||||
iter != slice_end(container); \
|
|
||||||
++ iter \
|
|
||||||
)
|
|
||||||
#define slice_from_farray(type, ...) & (tmpl(Slice,type)) { \
|
|
||||||
.ptr = farray_init(type, __VA_ARGS__), \
|
|
||||||
.len = farray_len( farray_init(type, __VA_ARGS__)) \
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,31 +0,0 @@
|
|||||||
#ifdef INTELLISENSE_DIRECTIVES
|
|
||||||
# pragma once
|
|
||||||
# include "dsl.h"
|
|
||||||
# include "memory.h"
|
|
||||||
# include "strings.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef def_struct(Opts_farena) {
|
|
||||||
Str8 type_name;
|
|
||||||
U4 alignment;
|
|
||||||
};
|
|
||||||
typedef def_struct(FArena) {
|
|
||||||
void* start;
|
|
||||||
U4 capacity;
|
|
||||||
U4 used;
|
|
||||||
};
|
|
||||||
FArena farena_make (Slice_B1 mem);
|
|
||||||
void farena_init (FArena* arena, Slice_B1 byte);
|
|
||||||
Slice_B1 farena__push (FArena* arena, U4 amount, U4 type_width, Opts_farena* opts);
|
|
||||||
void farena_reset (FArena* arena);
|
|
||||||
void farena_rewind(FArena* arena, AllocatorSP save_point);
|
|
||||||
AllocatorSP farena_save (FArena arena);
|
|
||||||
|
|
||||||
// void farena_allocator_proc(AllocatorProc_In in, AllocatorProc_Out* out);
|
|
||||||
// #define ainfo_farena(arena) (AllocatorInfo){ .proc = farena_allocator_proc, .data = & arena }
|
|
||||||
|
|
||||||
#define farena_push(arena, type, ...) \
|
|
||||||
cast(type*, farena__push(arena, size_of(type), 1, opt_args(Opts_farena_push, lit(stringify(type)), __VA_ARGS__))).ptr
|
|
||||||
|
|
||||||
#define farena_push_array(arena, type, amount, ...) \
|
|
||||||
(Slice ## type){ farena__push(arena, size_of(type), amount, opt_args(Opts_farena_push, lit(stringify(type)), __VA_ARGS__)).ptr, amount }
|
|
||||||
@@ -0,0 +1,262 @@
|
|||||||
|
#ifdef INTELLISENSE_DIRECTIVES
|
||||||
|
# pragma once
|
||||||
|
# include "dsl.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* ============================================================================
|
||||||
|
* INLINE ASSEMBLY BLOB DISPATCHER (UP TO 99 INSTRUCTIONS)
|
||||||
|
* ============================================================================ */
|
||||||
|
|
||||||
|
/* --- 1. The Argument Counter --- */
|
||||||
|
#define _ASM_COUNT_ARGS_IMPL( \
|
||||||
|
_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, \
|
||||||
|
_11,_12,_13,_14,_15,_16,_17,_18,_19,_20, \
|
||||||
|
_21,_22,_23,_24,_25,_26,_27,_28,_29,_30, \
|
||||||
|
_31,_32,_33,_34,_35,_36,_37,_38,_39,_40, \
|
||||||
|
_41,_42,_43,_44,_45,_46,_47,_48,_49,_50, \
|
||||||
|
_51,_52,_53,_54,_55,_56,_57,_58,_59,_60, \
|
||||||
|
_61,_62,_63,_64,_65,_66,_67,_68,_69,_70, \
|
||||||
|
_71,_72,_73,_74,_75,_76,_77,_78,_79,_80, \
|
||||||
|
_81,_82,_83,_84,_85,_86,_87,_88,_89,_90, \
|
||||||
|
_91,_92,_93,_94,_95,_96,_97,_98,_99, N, ...) N
|
||||||
|
|
||||||
|
#define _ASM_COUNT_ARGS(...) m_expand(_ASM_COUNT_ARGS_IMPL(__VA_ARGS__, \
|
||||||
|
99, 98, 97, 96, 95, 94, 93, 92, 91, 90, \
|
||||||
|
89, 88, 87, 86, 85, 84, 83, 82, 81, 80, \
|
||||||
|
79, 78, 77, 76, 75, 74, 73, 72, 71, 70, \
|
||||||
|
69, 68, 67, 66, 65, 64, 63, 62, 61, 60, \
|
||||||
|
59, 58, 57, 56, 55, 54, 53, 52, 51, 50, \
|
||||||
|
49, 48, 47, 46, 45, 44, 43, 42, 41, 40, \
|
||||||
|
39, 38, 37, 36, 35, 34, 33, 32, 31, 30, \
|
||||||
|
29, 28, 27, 26, 25, 24, 23, 22, 21, 20, \
|
||||||
|
19, 18, 17, 16, 15, 14, 13, 12, 11, 10, \
|
||||||
|
9, 8, 7, 6, 5, 4, 3, 2, 1, 0))
|
||||||
|
|
||||||
|
/* --- 2. String Concatenation Helpers --- */
|
||||||
|
#define _STR1 "%c0"
|
||||||
|
#define _STR2 _STR1 ", %c1"
|
||||||
|
#define _STR3 _STR2 ", %c2"
|
||||||
|
#define _STR4 _STR3 ", %c3"
|
||||||
|
#define _STR5 _STR4 ", %c4"
|
||||||
|
#define _STR6 _STR5 ", %c5"
|
||||||
|
#define _STR7 _STR6 ", %c6"
|
||||||
|
#define _STR8 _STR7 ", %c7"
|
||||||
|
#define _STR9 _STR8 ", %c8"
|
||||||
|
#define _STR10 _STR9 ", %c9"
|
||||||
|
#define _STR11 _STR10 ", %c10"
|
||||||
|
#define _STR12 _STR11 ", %c11"
|
||||||
|
#define _STR13 _STR12 ", %c12"
|
||||||
|
#define _STR14 _STR13 ", %c13"
|
||||||
|
#define _STR15 _STR14 ", %c14"
|
||||||
|
#define _STR16 _STR15 ", %c15"
|
||||||
|
#define _STR17 _STR16 ", %c16"
|
||||||
|
#define _STR18 _STR17 ", %c17"
|
||||||
|
#define _STR19 _STR18 ", %c18"
|
||||||
|
#define _STR20 _STR19 ", %c19"
|
||||||
|
#define _STR21 _STR20 ", %c20"
|
||||||
|
#define _STR22 _STR21 ", %c21"
|
||||||
|
#define _STR23 _STR22 ", %c22"
|
||||||
|
#define _STR24 _STR23 ", %c23"
|
||||||
|
#define _STR25 _STR24 ", %c24"
|
||||||
|
#define _STR26 _STR25 ", %c25"
|
||||||
|
#define _STR27 _STR26 ", %c26"
|
||||||
|
#define _STR28 _STR27 ", %c27"
|
||||||
|
#define _STR29 _STR28 ", %c28"
|
||||||
|
#define _STR30 _STR29 ", %c29"
|
||||||
|
#define _STR31 _STR30 ", %c30"
|
||||||
|
#define _STR32 _STR31 ", %c31"
|
||||||
|
#define _STR33 _STR32 ", %c32"
|
||||||
|
#define _STR34 _STR33 ", %c33"
|
||||||
|
#define _STR35 _STR34 ", %c34"
|
||||||
|
#define _STR36 _STR35 ", %c35"
|
||||||
|
#define _STR37 _STR36 ", %c36"
|
||||||
|
#define _STR38 _STR37 ", %c37"
|
||||||
|
#define _STR39 _STR38 ", %c38"
|
||||||
|
#define _STR40 _STR39 ", %c39"
|
||||||
|
#define _STR41 _STR40 ", %c40"
|
||||||
|
#define _STR42 _STR41 ", %c41"
|
||||||
|
#define _STR43 _STR42 ", %c42"
|
||||||
|
#define _STR44 _STR43 ", %c43"
|
||||||
|
#define _STR45 _STR44 ", %c44"
|
||||||
|
#define _STR46 _STR45 ", %c45"
|
||||||
|
#define _STR47 _STR46 ", %c46"
|
||||||
|
#define _STR48 _STR47 ", %c47"
|
||||||
|
#define _STR49 _STR48 ", %c48"
|
||||||
|
#define _STR50 _STR49 ", %c49"
|
||||||
|
#define _STR51 _STR50 ", %c50"
|
||||||
|
#define _STR52 _STR51 ", %c51"
|
||||||
|
#define _STR53 _STR52 ", %c52"
|
||||||
|
#define _STR54 _STR53 ", %c53"
|
||||||
|
#define _STR55 _STR54 ", %c54"
|
||||||
|
#define _STR56 _STR55 ", %c55"
|
||||||
|
#define _STR57 _STR56 ", %c56"
|
||||||
|
#define _STR58 _STR57 ", %c57"
|
||||||
|
#define _STR59 _STR58 ", %c58"
|
||||||
|
#define _STR60 _STR59 ", %c59"
|
||||||
|
#define _STR61 _STR60 ", %c60"
|
||||||
|
#define _STR62 _STR61 ", %c61"
|
||||||
|
#define _STR63 _STR62 ", %c62"
|
||||||
|
#define _STR64 _STR63 ", %c63"
|
||||||
|
#define _STR65 _STR64 ", %c64"
|
||||||
|
#define _STR66 _STR65 ", %c65"
|
||||||
|
#define _STR67 _STR66 ", %c66"
|
||||||
|
#define _STR68 _STR67 ", %c67"
|
||||||
|
#define _STR69 _STR68 ", %c68"
|
||||||
|
#define _STR70 _STR69 ", %c69"
|
||||||
|
#define _STR71 _STR70 ", %c70"
|
||||||
|
#define _STR72 _STR71 ", %c71"
|
||||||
|
#define _STR73 _STR72 ", %c72"
|
||||||
|
#define _STR74 _STR73 ", %c73"
|
||||||
|
#define _STR75 _STR74 ", %c74"
|
||||||
|
#define _STR76 _STR75 ", %c75"
|
||||||
|
#define _STR77 _STR76 ", %c76"
|
||||||
|
#define _STR78 _STR77 ", %c77"
|
||||||
|
#define _STR79 _STR78 ", %c78"
|
||||||
|
#define _STR80 _STR79 ", %c79"
|
||||||
|
#define _STR81 _STR80 ", %c80"
|
||||||
|
#define _STR82 _STR81 ", %c81"
|
||||||
|
#define _STR83 _STR82 ", %c82"
|
||||||
|
#define _STR84 _STR83 ", %c83"
|
||||||
|
#define _STR85 _STR84 ", %c84"
|
||||||
|
#define _STR86 _STR85 ", %c85"
|
||||||
|
#define _STR87 _STR86 ", %c86"
|
||||||
|
#define _STR88 _STR87 ", %c87"
|
||||||
|
#define _STR89 _STR88 ", %c88"
|
||||||
|
#define _STR90 _STR89 ", %c89"
|
||||||
|
#define _STR91 _STR90 ", %c90"
|
||||||
|
#define _STR92 _STR91 ", %c91"
|
||||||
|
#define _STR93 _STR92 ", %c92"
|
||||||
|
#define _STR94 _STR93 ", %c93"
|
||||||
|
#define _STR95 _STR94 ", %c94"
|
||||||
|
#define _STR96 _STR95 ", %c95"
|
||||||
|
#define _STR97 _STR96 ", %c96"
|
||||||
|
#define _STR98 _STR97 ", %c97"
|
||||||
|
#define _STR99 _STR98 ", %c98"
|
||||||
|
|
||||||
|
/* Utilizing cascading operand strings to compress the payload */
|
||||||
|
#define _OP10 "i"(p0),"i"(p1),"i"(p2),"i"(p3),"i"(p4),"i"(p5),"i"(p6),"i"(p7),"i"(p8),"i"(p9)
|
||||||
|
#define _OP20 _OP10,"i"(p10),"i"(p11),"i"(p12),"i"(p13),"i"(p14),"i"(p15),"i"(p16),"i"(p17),"i"(p18),"i"(p19)
|
||||||
|
#define _OP30 _OP20,"i"(p20),"i"(p21),"i"(p22),"i"(p23),"i"(p24),"i"(p25),"i"(p26),"i"(p27),"i"(p28),"i"(p29)
|
||||||
|
#define _OP40 _OP30,"i"(p30),"i"(p31),"i"(p32),"i"(p33),"i"(p34),"i"(p35),"i"(p36),"i"(p37),"i"(p38),"i"(p39)
|
||||||
|
#define _OP50 _OP40,"i"(p40),"i"(p41),"i"(p42),"i"(p43),"i"(p44),"i"(p45),"i"(p46),"i"(p47),"i"(p48),"i"(p49)
|
||||||
|
#define _OP60 _OP50,"i"(p50),"i"(p51),"i"(p52),"i"(p53),"i"(p54),"i"(p55),"i"(p56),"i"(p57),"i"(p58),"i"(p59)
|
||||||
|
#define _OP70 _OP60,"i"(p60),"i"(p61),"i"(p62),"i"(p63),"i"(p64),"i"(p65),"i"(p66),"i"(p67),"i"(p68),"i"(p69)
|
||||||
|
#define _OP80 _OP70,"i"(p70),"i"(p71),"i"(p72),"i"(p73),"i"(p74),"i"(p75),"i"(p76),"i"(p77),"i"(p78),"i"(p79)
|
||||||
|
#define _OP90 _OP80,"i"(p80),"i"(p81),"i"(p82),"i"(p83),"i"(p84),"i"(p85),"i"(p86),"i"(p87),"i"(p88),"i"(p89)
|
||||||
|
|
||||||
|
/* --- The AST Generators (1 to 99) --- */
|
||||||
|
#define _INL_1(p0) ".word " _STR1 : : "i"(p0)
|
||||||
|
#define _INL_2(p0,p1) ".word " _STR2 : : "i"(p0),"i"(p1)
|
||||||
|
#define _INL_3(p0,p1,p2) ".word " _STR3 : : "i"(p0),"i"(p1),"i"(p2)
|
||||||
|
#define _INL_4(p0,p1,p2,p3) ".word " _STR4 : : "i"(p0),"i"(p1),"i"(p2),"i"(p3)
|
||||||
|
#define _INL_5(p0,p1,p2,p3,p4) ".word " _STR5 : : "i"(p0),"i"(p1),"i"(p2),"i"(p3),"i"(p4)
|
||||||
|
#define _INL_6(p0,p1,p2,p3,p4,p5) ".word " _STR6 : : "i"(p0),"i"(p1),"i"(p2),"i"(p3),"i"(p4),"i"(p5)
|
||||||
|
#define _INL_7(p0,p1,p2,p3,p4,p5,p6) ".word " _STR7 : : "i"(p0),"i"(p1),"i"(p2),"i"(p3),"i"(p4),"i"(p5),"i"(p6)
|
||||||
|
#define _INL_8(p0,p1,p2,p3,p4,p5,p6,p7) ".word " _STR8 : : "i"(p0),"i"(p1),"i"(p2),"i"(p3),"i"(p4),"i"(p5),"i"(p6),"i"(p7)
|
||||||
|
#define _INL_9(p0,p1,p2,p3,p4,p5,p6,p7,p8) ".word " _STR9 : : "i"(p0),"i"(p1),"i"(p2),"i"(p3),"i"(p4),"i"(p5),"i"(p6),"i"(p7),"i"(p8)
|
||||||
|
#define _INL_10(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9) ".word " _STR10 : : _OP10
|
||||||
|
|
||||||
|
#define _INL_11(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10) ".word " _STR11 : : _OP10,"i"(p10)
|
||||||
|
#define _INL_12(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11) ".word " _STR12 : : _OP10,"i"(p10),"i"(p11)
|
||||||
|
#define _INL_13(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12) ".word " _STR13 : : _OP10,"i"(p10),"i"(p11),"i"(p12)
|
||||||
|
#define _INL_14(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13) ".word " _STR14 : : _OP10,"i"(p10),"i"(p11),"i"(p12),"i"(p13)
|
||||||
|
#define _INL_15(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14) ".word " _STR15 : : _OP10,"i"(p10),"i"(p11),"i"(p12),"i"(p13),"i"(p14)
|
||||||
|
#define _INL_16(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15) ".word " _STR16 : : _OP10,"i"(p10),"i"(p11),"i"(p12),"i"(p13),"i"(p14),"i"(p15)
|
||||||
|
#define _INL_17(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16) ".word " _STR17 : : _OP10,"i"(p10),"i"(p11),"i"(p12),"i"(p13),"i"(p14),"i"(p15),"i"(p16)
|
||||||
|
#define _INL_18(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17) ".word " _STR18 : : _OP10,"i"(p10),"i"(p11),"i"(p12),"i"(p13),"i"(p14),"i"(p15),"i"(p16),"i"(p17)
|
||||||
|
#define _INL_19(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18) ".word " _STR19 : : _OP10,"i"(p10),"i"(p11),"i"(p12),"i"(p13),"i"(p14),"i"(p15),"i"(p16),"i"(p17),"i"(p18)
|
||||||
|
#define _INL_20(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19) ".word " _STR20 : : _OP20
|
||||||
|
|
||||||
|
#define _INL_21(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20) ".word " _STR21 : : _OP20,"i"(p20)
|
||||||
|
#define _INL_22(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21) ".word " _STR22 : : _OP20,"i"(p20),"i"(p21)
|
||||||
|
#define _INL_23(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22) ".word " _STR23 : : _OP20,"i"(p20),"i"(p21),"i"(p22)
|
||||||
|
#define _INL_24(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23) ".word " _STR24 : : _OP20,"i"(p20),"i"(p21),"i"(p22),"i"(p23)
|
||||||
|
#define _INL_25(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24) ".word " _STR25 : : _OP20,"i"(p20),"i"(p21),"i"(p22),"i"(p23),"i"(p24)
|
||||||
|
#define _INL_26(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25) ".word " _STR26 : : _OP20,"i"(p20),"i"(p21),"i"(p22),"i"(p23),"i"(p24),"i"(p25)
|
||||||
|
#define _INL_27(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26) ".word " _STR27 : : _OP20,"i"(p20),"i"(p21),"i"(p22),"i"(p23),"i"(p24),"i"(p25),"i"(p26)
|
||||||
|
#define _INL_28(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27) ".word " _STR28 : : _OP20,"i"(p20),"i"(p21),"i"(p22),"i"(p23),"i"(p24),"i"(p25),"i"(p26),"i"(p27)
|
||||||
|
#define _INL_29(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28) ".word " _STR29 : : _OP20,"i"(p20),"i"(p21),"i"(p22),"i"(p23),"i"(p24),"i"(p25),"i"(p26),"i"(p27),"i"(p28)
|
||||||
|
#define _INL_30(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29) ".word " _STR30 : : _OP30
|
||||||
|
|
||||||
|
#define _INL_31(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30) ".word " _STR31 : : _OP30,"i"(p30)
|
||||||
|
#define _INL_32(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31) ".word " _STR32 : : _OP30,"i"(p30),"i"(p31)
|
||||||
|
#define _INL_33(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31,p32) ".word " _STR33 : : _OP30,"i"(p30),"i"(p31),"i"(p32)
|
||||||
|
#define _INL_34(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31,p32,p33) ".word " _STR34 : : _OP30,"i"(p30),"i"(p31),"i"(p32),"i"(p33)
|
||||||
|
#define _INL_35(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31,p32,p33,p34) ".word " _STR35 : : _OP30,"i"(p30),"i"(p31),"i"(p32),"i"(p33),"i"(p34)
|
||||||
|
#define _INL_36(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31,p32,p33,p34,p35) ".word " _STR36 : : _OP30,"i"(p30),"i"(p31),"i"(p32),"i"(p33),"i"(p34),"i"(p35)
|
||||||
|
#define _INL_37(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31,p32,p33,p34,p35,p36) ".word " _STR37 : : _OP30,"i"(p30),"i"(p31),"i"(p32),"i"(p33),"i"(p34),"i"(p35),"i"(p36)
|
||||||
|
#define _INL_38(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31,p32,p33,p34,p35,p36,p37) ".word " _STR38 : : _OP30,"i"(p30),"i"(p31),"i"(p32),"i"(p33),"i"(p34),"i"(p35),"i"(p36),"i"(p37)
|
||||||
|
#define _INL_39(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31,p32,p33,p34,p35,p36,p37,p38) ".word " _STR39 : : _OP30,"i"(p30),"i"(p31),"i"(p32),"i"(p33),"i"(p34),"i"(p35),"i"(p36),"i"(p37),"i"(p38)
|
||||||
|
#define _INL_40(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31,p32,p33,p34,p35,p36,p37,p38,p39) ".word " _STR40 : : _OP40
|
||||||
|
|
||||||
|
#define _INL_41(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31,p32,p33,p34,p35,p36,p37,p38,p39,p40) ".word " _STR41 : : _OP40,"i"(p40)
|
||||||
|
#define _INL_42(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31,p32,p33,p34,p35,p36,p37,p38,p39,p40,p41) ".word " _STR42 : : _OP40,"i"(p40),"i"(p41)
|
||||||
|
#define _INL_43(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31,p32,p33,p34,p35,p36,p37,p38,p39,p40,p41,p42) ".word " _STR43 : : _OP40,"i"(p40),"i"(p41),"i"(p42)
|
||||||
|
#define _INL_44(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31,p32,p33,p34,p35,p36,p37,p38,p39,p40,p41,p42,p43) ".word " _STR44 : : _OP40,"i"(p40),"i"(p41),"i"(p42),"i"(p43)
|
||||||
|
#define _INL_45(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31,p32,p33,p34,p35,p36,p37,p38,p39,p40,p41,p42,p43,p44) ".word " _STR45 : : _OP40,"i"(p40),"i"(p41),"i"(p42),"i"(p43),"i"(p44)
|
||||||
|
#define _INL_46(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31,p32,p33,p34,p35,p36,p37,p38,p39,p40,p41,p42,p43,p44,p45) ".word " _STR46 : : _OP40,"i"(p40),"i"(p41),"i"(p42),"i"(p43),"i"(p44),"i"(p45)
|
||||||
|
#define _INL_47(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31,p32,p33,p34,p35,p36,p37,p38,p39,p40,p41,p42,p43,p44,p45,p46) ".word " _STR47 : : _OP40,"i"(p40),"i"(p41),"i"(p42),"i"(p43),"i"(p44),"i"(p45),"i"(p46)
|
||||||
|
#define _INL_48(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31,p32,p33,p34,p35,p36,p37,p38,p39,p40,p41,p42,p43,p44,p45,p46,p47) ".word " _STR48 : : _OP40,"i"(p40),"i"(p41),"i"(p42),"i"(p43),"i"(p44),"i"(p45),"i"(p46),"i"(p47)
|
||||||
|
#define _INL_49(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31,p32,p33,p34,p35,p36,p37,p38,p39,p40,p41,p42,p43,p44,p45,p46,p47,p48) ".word " _STR49 : : _OP40,"i"(p40),"i"(p41),"i"(p42),"i"(p43),"i"(p44),"i"(p45),"i"(p46),"i"(p47),"i"(p48)
|
||||||
|
#define _INL_50(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31,p32,p33,p34,p35,p36,p37,p38,p39,p40,p41,p42,p43,p44,p45,p46,p47,p48,p49) ".word " _STR50 : : _OP50
|
||||||
|
|
||||||
|
#define _INL_51(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31,p32,p33,p34,p35,p36,p37,p38,p39,p40,p41,p42,p43,p44,p45,p46,p47,p48,p49,p50) ".word " _STR51 : : _OP50,"i"(p50)
|
||||||
|
#define _INL_52(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31,p32,p33,p34,p35,p36,p37,p38,p39,p40,p41,p42,p43,p44,p45,p46,p47,p48,p49,p50,p51) ".word " _STR52 : : _OP50,"i"(p50),"i"(p51)
|
||||||
|
#define _INL_53(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31,p32,p33,p34,p35,p36,p37,p38,p39,p40,p41,p42,p43,p44,p45,p46,p47,p48,p49,p50,p51,p52) ".word " _STR53 : : _OP50,"i"(p50),"i"(p51),"i"(p52)
|
||||||
|
#define _INL_54(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31,p32,p33,p34,p35,p36,p37,p38,p39,p40,p41,p42,p43,p44,p45,p46,p47,p48,p49,p50,p51,p52,p53) ".word " _STR54 : : _OP50,"i"(p50),"i"(p51),"i"(p52),"i"(p53)
|
||||||
|
#define _INL_55(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31,p32,p33,p34,p35,p36,p37,p38,p39,p40,p41,p42,p43,p44,p45,p46,p47,p48,p49,p50,p51,p52,p53,p54) ".word " _STR55 : : _OP50,"i"(p50),"i"(p51),"i"(p52),"i"(p53),"i"(p54)
|
||||||
|
#define _INL_56(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31,p32,p33,p34,p35,p36,p37,p38,p39,p40,p41,p42,p43,p44,p45,p46,p47,p48,p49,p50,p51,p52,p53,p54,p55) ".word " _STR56 : : _OP50,"i"(p50),"i"(p51),"i"(p52),"i"(p53),"i"(p54),"i"(p55)
|
||||||
|
#define _INL_57(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31,p32,p33,p34,p35,p36,p37,p38,p39,p40,p41,p42,p43,p44,p45,p46,p47,p48,p49,p50,p51,p52,p53,p54,p55,p56) ".word " _STR57 : : _OP50,"i"(p50),"i"(p51),"i"(p52),"i"(p53),"i"(p54),"i"(p55),"i"(p56)
|
||||||
|
#define _INL_58(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31,p32,p33,p34,p35,p36,p37,p38,p39,p40,p41,p42,p43,p44,p45,p46,p47,p48,p49,p50,p51,p52,p53,p54,p55,p56,p57) ".word " _STR58 : : _OP50,"i"(p50),"i"(p51),"i"(p52),"i"(p53),"i"(p54),"i"(p55),"i"(p56),"i"(p57)
|
||||||
|
#define _INL_59(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31,p32,p33,p34,p35,p36,p37,p38,p39,p40,p41,p42,p43,p44,p45,p46,p47,p48,p49,p50,p51,p52,p53,p54,p55,p56,p57,p58) ".word " _STR59 : : _OP50,"i"(p50),"i"(p51),"i"(p52),"i"(p53),"i"(p54),"i"(p55),"i"(p56),"i"(p57),"i"(p58)
|
||||||
|
#define _INL_60(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31,p32,p33,p34,p35,p36,p37,p38,p39,p40,p41,p42,p43,p44,p45,p46,p47,p48,p49,p50,p51,p52,p53,p54,p55,p56,p57,p58,p59) ".word " _STR60 : : _OP60
|
||||||
|
|
||||||
|
#define _INL_61(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31,p32,p33,p34,p35,p36,p37,p38,p39,p40,p41,p42,p43,p44,p45,p46,p47,p48,p49,p50,p51,p52,p53,p54,p55,p56,p57,p58,p59,p60) ".word " _STR61 : : _OP60,"i"(p60)
|
||||||
|
#define _INL_62(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31,p32,p33,p34,p35,p36,p37,p38,p39,p40,p41,p42,p43,p44,p45,p46,p47,p48,p49,p50,p51,p52,p53,p54,p55,p56,p57,p58,p59,p60,p61) ".word " _STR62 : : _OP60,"i"(p60),"i"(p61)
|
||||||
|
#define _INL_63(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31,p32,p33,p34,p35,p36,p37,p38,p39,p40,p41,p42,p43,p44,p45,p46,p47,p48,p49,p50,p51,p52,p53,p54,p55,p56,p57,p58,p59,p60,p61,p62) ".word " _STR63 : : _OP60,"i"(p60),"i"(p61),"i"(p62)
|
||||||
|
#define _INL_64(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31,p32,p33,p34,p35,p36,p37,p38,p39,p40,p41,p42,p43,p44,p45,p46,p47,p48,p49,p50,p51,p52,p53,p54,p55,p56,p57,p58,p59,p60,p61,p62,p63) ".word " _STR64 : : _OP60,"i"(p60),"i"(p61),"i"(p62),"i"(p63)
|
||||||
|
#define _INL_65(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31,p32,p33,p34,p35,p36,p37,p38,p39,p40,p41,p42,p43,p44,p45,p46,p47,p48,p49,p50,p51,p52,p53,p54,p55,p56,p57,p58,p59,p60,p61,p62,p63,p64) ".word " _STR65 : : _OP60,"i"(p60),"i"(p61),"i"(p62),"i"(p63),"i"(p64)
|
||||||
|
#define _INL_66(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31,p32,p33,p34,p35,p36,p37,p38,p39,p40,p41,p42,p43,p44,p45,p46,p47,p48,p49,p50,p51,p52,p53,p54,p55,p56,p57,p58,p59,p60,p61,p62,p63,p64,p65) ".word " _STR66 : : _OP60,"i"(p60),"i"(p61),"i"(p62),"i"(p63),"i"(p64),"i"(p65)
|
||||||
|
#define _INL_67(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31,p32,p33,p34,p35,p36,p37,p38,p39,p40,p41,p42,p43,p44,p45,p46,p47,p48,p49,p50,p51,p52,p53,p54,p55,p56,p57,p58,p59,p60,p61,p62,p63,p64,p65,p66) ".word " _STR67 : : _OP60,"i"(p60),"i"(p61),"i"(p62),"i"(p63),"i"(p64),"i"(p65),"i"(p66)
|
||||||
|
#define _INL_68(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31,p32,p33,p34,p35,p36,p37,p38,p39,p40,p41,p42,p43,p44,p45,p46,p47,p48,p49,p50,p51,p52,p53,p54,p55,p56,p57,p58,p59,p60,p61,p62,p63,p64,p65,p66,p67) ".word " _STR68 : : _OP60,"i"(p60),"i"(p61),"i"(p62),"i"(p63),"i"(p64),"i"(p65),"i"(p66),"i"(p67)
|
||||||
|
#define _INL_69(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31,p32,p33,p34,p35,p36,p37,p38,p39,p40,p41,p42,p43,p44,p45,p46,p47,p48,p49,p50,p51,p52,p53,p54,p55,p56,p57,p58,p59,p60,p61,p62,p63,p64,p65,p66,p67,p68) ".word " _STR69 : : _OP60,"i"(p60),"i"(p61),"i"(p62),"i"(p63),"i"(p64),"i"(p65),"i"(p66),"i"(p67),"i"(p68)
|
||||||
|
#define _INL_70(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31,p32,p33,p34,p35,p36,p37,p38,p39,p40,p41,p42,p43,p44,p45,p46,p47,p48,p49,p50,p51,p52,p53,p54,p55,p56,p57,p58,p59,p60,p61,p62,p63,p64,p65,p66,p67,p68,p69) ".word " _STR70 : : _OP70
|
||||||
|
|
||||||
|
#define _INL_71(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31,p32,p33,p34,p35,p36,p37,p38,p39,p40,p41,p42,p43,p44,p45,p46,p47,p48,p49,p50,p51,p52,p53,p54,p55,p56,p57,p58,p59,p60,p61,p62,p63,p64,p65,p66,p67,p68,p69,p70) ".word " _STR71 : : _OP70,"i"(p70)
|
||||||
|
#define _INL_72(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31,p32,p33,p34,p35,p36,p37,p38,p39,p40,p41,p42,p43,p44,p45,p46,p47,p48,p49,p50,p51,p52,p53,p54,p55,p56,p57,p58,p59,p60,p61,p62,p63,p64,p65,p66,p67,p68,p69,p70,p71) ".word " _STR72 : : _OP70,"i"(p70),"i"(p71)
|
||||||
|
#define _INL_73(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31,p32,p33,p34,p35,p36,p37,p38,p39,p40,p41,p42,p43,p44,p45,p46,p47,p48,p49,p50,p51,p52,p53,p54,p55,p56,p57,p58,p59,p60,p61,p62,p63,p64,p65,p66,p67,p68,p69,p70,p71,p72) ".word " _STR73 : : _OP70,"i"(p70),"i"(p71),"i"(p72)
|
||||||
|
#define _INL_74(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31,p32,p33,p34,p35,p36,p37,p38,p39,p40,p41,p42,p43,p44,p45,p46,p47,p48,p49,p50,p51,p52,p53,p54,p55,p56,p57,p58,p59,p60,p61,p62,p63,p64,p65,p66,p67,p68,p69,p70,p71,p72,p73) ".word " _STR74 : : _OP70,"i"(p70),"i"(p71),"i"(p72),"i"(p73)
|
||||||
|
#define _INL_75(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31,p32,p33,p34,p35,p36,p37,p38,p39,p40,p41,p42,p43,p44,p45,p46,p47,p48,p49,p50,p51,p52,p53,p54,p55,p56,p57,p58,p59,p60,p61,p62,p63,p64,p65,p66,p67,p68,p69,p70,p71,p72,p73,p74) ".word " _STR75 : : _OP70,"i"(p70),"i"(p71),"i"(p72),"i"(p73),"i"(p74)
|
||||||
|
#define _INL_76(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31,p32,p33,p34,p35,p36,p37,p38,p39,p40,p41,p42,p43,p44,p45,p46,p47,p48,p49,p50,p51,p52,p53,p54,p55,p56,p57,p58,p59,p60,p61,p62,p63,p64,p65,p66,p67,p68,p69,p70,p71,p72,p73,p74,p75) ".word " _STR76 : : _OP70,"i"(p70),"i"(p71),"i"(p72),"i"(p73),"i"(p74),"i"(p75)
|
||||||
|
#define _INL_77(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31,p32,p33,p34,p35,p36,p37,p38,p39,p40,p41,p42,p43,p44,p45,p46,p47,p48,p49,p50,p51,p52,p53,p54,p55,p56,p57,p58,p59,p60,p61,p62,p63,p64,p65,p66,p67,p68,p69,p70,p71,p72,p73,p74,p75,p76) ".word " _STR77 : : _OP70,"i"(p70),"i"(p71),"i"(p72),"i"(p73),"i"(p74),"i"(p75),"i"(p76)
|
||||||
|
#define _INL_78(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31,p32,p33,p34,p35,p36,p37,p38,p39,p40,p41,p42,p43,p44,p45,p46,p47,p48,p49,p50,p51,p52,p53,p54,p55,p56,p57,p58,p59,p60,p61,p62,p63,p64,p65,p66,p67,p68,p69,p70,p71,p72,p73,p74,p75,p76,p77) ".word " _STR78 : : _OP70,"i"(p70),"i"(p71),"i"(p72),"i"(p73),"i"(p74),"i"(p75),"i"(p76),"i"(p77)
|
||||||
|
#define _INL_79(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31,p32,p33,p34,p35,p36,p37,p38,p39,p40,p41,p42,p43,p44,p45,p46,p47,p48,p49,p50,p51,p52,p53,p54,p55,p56,p57,p58,p59,p60,p61,p62,p63,p64,p65,p66,p67,p68,p69,p70,p71,p72,p73,p74,p75,p76,p77,p78) ".word " _STR79 : : _OP70,"i"(p70),"i"(p71),"i"(p72),"i"(p73),"i"(p74),"i"(p75),"i"(p76),"i"(p77),"i"(p78)
|
||||||
|
#define _INL_80(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31,p32,p33,p34,p35,p36,p37,p38,p39,p40,p41,p42,p43,p44,p45,p46,p47,p48,p49,p50,p51,p52,p53,p54,p55,p56,p57,p58,p59,p60,p61,p62,p63,p64,p65,p66,p67,p68,p69,p70,p71,p72,p73,p74,p75,p76,p77,p78,p79) ".word " _STR80 : : _OP80
|
||||||
|
|
||||||
|
#define _INL_81(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31,p32,p33,p34,p35,p36,p37,p38,p39,p40,p41,p42,p43,p44,p45,p46,p47,p48,p49,p50,p51,p52,p53,p54,p55,p56,p57,p58,p59,p60,p61,p62,p63,p64,p65,p66,p67,p68,p69,p70,p71,p72,p73,p74,p75,p76,p77,p78,p79,p80) ".word " _STR81 : : _OP80,"i"(p80)
|
||||||
|
#define _INL_82(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31,p32,p33,p34,p35,p36,p37,p38,p39,p40,p41,p42,p43,p44,p45,p46,p47,p48,p49,p50,p51,p52,p53,p54,p55,p56,p57,p58,p59,p60,p61,p62,p63,p64,p65,p66,p67,p68,p69,p70,p71,p72,p73,p74,p75,p76,p77,p78,p79,p80,p81) ".word " _STR82 : : _OP80,"i"(p80),"i"(p81)
|
||||||
|
#define _INL_83(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31,p32,p33,p34,p35,p36,p37,p38,p39,p40,p41,p42,p43,p44,p45,p46,p47,p48,p49,p50,p51,p52,p53,p54,p55,p56,p57,p58,p59,p60,p61,p62,p63,p64,p65,p66,p67,p68,p69,p70,p71,p72,p73,p74,p75,p76,p77,p78,p79,p80,p81,p82) ".word " _STR83 : : _OP80,"i"(p80),"i"(p81),"i"(p82)
|
||||||
|
#define _INL_84(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31,p32,p33,p34,p35,p36,p37,p38,p39,p40,p41,p42,p43,p44,p45,p46,p47,p48,p49,p50,p51,p52,p53,p54,p55,p56,p57,p58,p59,p60,p61,p62,p63,p64,p65,p66,p67,p68,p69,p70,p71,p72,p73,p74,p75,p76,p77,p78,p79,p80,p81,p82,p83) ".word " _STR84 : : _OP80,"i"(p80),"i"(p81),"i"(p82),"i"(p83)
|
||||||
|
#define _INL_85(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31,p32,p33,p34,p35,p36,p37,p38,p39,p40,p41,p42,p43,p44,p45,p46,p47,p48,p49,p50,p51,p52,p53,p54,p55,p56,p57,p58,p59,p60,p61,p62,p63,p64,p65,p66,p67,p68,p69,p70,p71,p72,p73,p74,p75,p76,p77,p78,p79,p80,p81,p82,p83,p84) ".word " _STR85 : : _OP80,"i"(p80),"i"(p81),"i"(p82),"i"(p83),"i"(p84)
|
||||||
|
#define _INL_86(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31,p32,p33,p34,p35,p36,p37,p38,p39,p40,p41,p42,p43,p44,p45,p46,p47,p48,p49,p50,p51,p52,p53,p54,p55,p56,p57,p58,p59,p60,p61,p62,p63,p64,p65,p66,p67,p68,p69,p70,p71,p72,p73,p74,p75,p76,p77,p78,p79,p80,p81,p82,p83,p84,p85) ".word " _STR86 : : _OP80,"i"(p80),"i"(p81),"i"(p82),"i"(p83),"i"(p84),"i"(p85)
|
||||||
|
#define _INL_87(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31,p32,p33,p34,p35,p36,p37,p38,p39,p40,p41,p42,p43,p44,p45,p46,p47,p48,p49,p50,p51,p52,p53,p54,p55,p56,p57,p58,p59,p60,p61,p62,p63,p64,p65,p66,p67,p68,p69,p70,p71,p72,p73,p74,p75,p76,p77,p78,p79,p80,p81,p82,p83,p84,p85,p86) ".word " _STR87 : : _OP80,"i"(p80),"i"(p81),"i"(p82),"i"(p83),"i"(p84),"i"(p85),"i"(p86)
|
||||||
|
#define _INL_88(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31,p32,p33,p34,p35,p36,p37,p38,p39,p40,p41,p42,p43,p44,p45,p46,p47,p48,p49,p50,p51,p52,p53,p54,p55,p56,p57,p58,p59,p60,p61,p62,p63,p64,p65,p66,p67,p68,p69,p70,p71,p72,p73,p74,p75,p76,p77,p78,p79,p80,p81,p82,p83,p84,p85,p86,p87) ".word " _STR88 : : _OP80,"i"(p80),"i"(p81),"i"(p82),"i"(p83),"i"(p84),"i"(p85),"i"(p86),"i"(p87)
|
||||||
|
#define _INL_89(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31,p32,p33,p34,p35,p36,p37,p38,p39,p40,p41,p42,p43,p44,p45,p46,p47,p48,p49,p50,p51,p52,p53,p54,p55,p56,p57,p58,p59,p60,p61,p62,p63,p64,p65,p66,p67,p68,p69,p70,p71,p72,p73,p74,p75,p76,p77,p78,p79,p80,p81,p82,p83,p84,p85,p86,p87,p88) ".word " _STR89 : : _OP80,"i"(p80),"i"(p81),"i"(p82),"i"(p83),"i"(p84),"i"(p85),"i"(p86),"i"(p87),"i"(p88)
|
||||||
|
#define _INL_90(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31,p32,p33,p34,p35,p36,p37,p38,p39,p40,p41,p42,p43,p44,p45,p46,p47,p48,p49,p50,p51,p52,p53,p54,p55,p56,p57,p58,p59,p60,p61,p62,p63,p64,p65,p66,p67,p68,p69,p70,p71,p72,p73,p74,p75,p76,p77,p78,p79,p80,p81,p82,p83,p84,p85,p86,p87,p88,p89) ".word " _STR90 : : _OP90
|
||||||
|
|
||||||
|
#define _INL_91(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31,p32,p33,p34,p35,p36,p37,p38,p39,p40,p41,p42,p43,p44,p45,p46,p47,p48,p49,p50,p51,p52,p53,p54,p55,p56,p57,p58,p59,p60,p61,p62,p63,p64,p65,p66,p67,p68,p69,p70,p71,p72,p73,p74,p75,p76,p77,p78,p79,p80,p81,p82,p83,p84,p85,p86,p87,p88,p89,p90) ".word " _STR91 : : _OP90,"i"(p90)
|
||||||
|
#define _INL_92(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31,p32,p33,p34,p35,p36,p37,p38,p39,p40,p41,p42,p43,p44,p45,p46,p47,p48,p49,p50,p51,p52,p53,p54,p55,p56,p57,p58,p59,p60,p61,p62,p63,p64,p65,p66,p67,p68,p69,p70,p71,p72,p73,p74,p75,p76,p77,p78,p79,p80,p81,p82,p83,p84,p85,p86,p87,p88,p89,p90,p91) ".word " _STR92 : : _OP90,"i"(p90),"i"(p91)
|
||||||
|
#define _INL_93(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31,p32,p33,p34,p35,p36,p37,p38,p39,p40,p41,p42,p43,p44,p45,p46,p47,p48,p49,p50,p51,p52,p53,p54,p55,p56,p57,p58,p59,p60,p61,p62,p63,p64,p65,p66,p67,p68,p69,p70,p71,p72,p73,p74,p75,p76,p77,p78,p79,p80,p81,p82,p83,p84,p85,p86,p87,p88,p89,p90,p91,p92) ".word " _STR93 : : _OP90,"i"(p90),"i"(p91),"i"(p92)
|
||||||
|
#define _INL_94(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31,p32,p33,p34,p35,p36,p37,p38,p39,p40,p41,p42,p43,p44,p45,p46,p47,p48,p49,p50,p51,p52,p53,p54,p55,p56,p57,p58,p59,p60,p61,p62,p63,p64,p65,p66,p67,p68,p69,p70,p71,p72,p73,p74,p75,p76,p77,p78,p79,p80,p81,p82,p83,p84,p85,p86,p87,p88,p89,p90,p91,p92,p93) ".word " _STR94 : : _OP90,"i"(p90),"i"(p91),"i"(p92),"i"(p93)
|
||||||
|
#define _INL_95(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31,p32,p33,p34,p35,p36,p37,p38,p39,p40,p41,p42,p43,p44,p45,p46,p47,p48,p49,p50,p51,p52,p53,p54,p55,p56,p57,p58,p59,p60,p61,p62,p63,p64,p65,p66,p67,p68,p69,p70,p71,p72,p73,p74,p75,p76,p77,p78,p79,p80,p81,p82,p83,p84,p85,p86,p87,p88,p89,p90,p91,p92,p93,p94) ".word " _STR95 : : _OP90,"i"(p90),"i"(p91),"i"(p92),"i"(p93),"i"(p94)
|
||||||
|
#define _INL_96(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31,p32,p33,p34,p35,p36,p37,p38,p39,p40,p41,p42,p43,p44,p45,p46,p47,p48,p49,p50,p51,p52,p53,p54,p55,p56,p57,p58,p59,p60,p61,p62,p63,p64,p65,p66,p67,p68,p69,p70,p71,p72,p73,p74,p75,p76,p77,p78,p79,p80,p81,p82,p83,p84,p85,p86,p87,p88,p89,p90,p91,p92,p93,p94,p95) ".word " _STR96 : : _OP90,"i"(p90),"i"(p91),"i"(p92),"i"(p93),"i"(p94),"i"(p95)
|
||||||
|
#define _INL_97(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31,p32,p33,p34,p35,p36,p37,p38,p39,p40,p41,p42,p43,p44,p45,p46,p47,p48,p49,p50,p51,p52,p53,p54,p55,p56,p57,p58,p59,p60,p61,p62,p63,p64,p65,p66,p67,p68,p69,p70,p71,p72,p73,p74,p75,p76,p77,p78,p79,p80,p81,p82,p83,p84,p85,p86,p87,p88,p89,p90,p91,p92,p93,p94,p95,p96) ".word " _STR97 : : _OP90,"i"(p90),"i"(p91),"i"(p92),"i"(p93),"i"(p94),"i"(p95),"i"(p96)
|
||||||
|
#define _INL_98(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31,p32,p33,p34,p35,p36,p37,p38,p39,p40,p41,p42,p43,p44,p45,p46,p47,p48,p49,p50,p51,p52,p53,p54,p55,p56,p57,p58,p59,p60,p61,p62,p63,p64,p65,p66,p67,p68,p69,p70,p71,p72,p73,p74,p75,p76,p77,p78,p79,p80,p81,p82,p83,p84,p85,p86,p87,p88,p89,p90,p91,p92,p93,p94,p95,p96,p97) ".word " _STR98 : : _OP90,"i"(p90),"i"(p91),"i"(p92),"i"(p93),"i"(p94),"i"(p95),"i"(p96),"i"(p97)
|
||||||
|
#define _INL_99(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31,p32,p33,p34,p35,p36,p37,p38,p39,p40,p41,p42,p43,p44,p45,p46,p47,p48,p49,p50,p51,p52,p53,p54,p55,p56,p57,p58,p59,p60,p61,p62,p63,p64,p65,p66,p67,p68,p69,p70,p71,p72,p73,p74,p75,p76,p77,p78,p79,p80,p81,p82,p83,p84,p85,p86,p87,p88,p89,p90,p91,p92,p93,p94,p95,p96,p97,p98) ".word " _STR99 : : _OP90,"i"(p90),"i"(p91),"i"(p92),"i"(p93),"i"(p94),"i"(p95),"i"(p96),"i"(p97),"i"(p98)
|
||||||
|
|
||||||
|
/* The AST Builders */
|
||||||
|
#define asm_clobber(...) : __VA_ARGS__
|
||||||
|
#define asm_inline(...) m_expand(glue(_INL_, _ASM_COUNT_ARGS(__VA_ARGS__))(__VA_ARGS__))
|
||||||
|
|
||||||
|
/* The Shell */
|
||||||
|
#define asm_blob(inlines, clobbers) asm volatile ( inlines clobbers )
|
||||||
+28
-3
@@ -4,7 +4,7 @@
|
|||||||
# include "math.h"
|
# include "math.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef def_enum(U4, gp_Commands) {
|
typedef Enum_(U4, gp_Commands) {
|
||||||
gcmd_Reset = 0b000,
|
gcmd_Reset = 0b000,
|
||||||
gcmd_Polygon = 0b001,
|
gcmd_Polygon = 0b001,
|
||||||
gcmd_Line = 0b010,
|
gcmd_Line = 0b010,
|
||||||
@@ -75,7 +75,7 @@ enum {
|
|||||||
gp_SetArea_BottomRight = (gcmd_SetDrawArea_BotRight << gcmd_offset),
|
gp_SetArea_BottomRight = (gcmd_SetDrawArea_BotRight << gcmd_offset),
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef def_struct(RGB8) { B1 r; B1 g; B1 b; };
|
typedef Struct_(RGB8) { B1 r; B1 g; B1 b; };
|
||||||
#define rgb8(r, g, b) (RGB8){ r, g, b }
|
#define rgb8(r, g, b) (RGB8){ r, g, b }
|
||||||
|
|
||||||
typedef B1 gp_Pixel16[1];
|
typedef B1 gp_Pixel16[1];
|
||||||
@@ -88,10 +88,35 @@ enum {
|
|||||||
gp_b16_Y = 16,
|
gp_b16_Y = 16,
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef def_struct(gp_Vec2) { U2 y; U2 x; };
|
typedef Struct_(gp_Vec2) { U2 y; U2 x; };
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
void gp_screen_init(void) __asm__("gp_screen_init_asm");
|
void gp_screen_init(void) __asm__("gp_screen_init_asm");
|
||||||
#else
|
#else
|
||||||
#define gp_screen_init() gp_screen_init_c11()
|
#define gp_screen_init() gp_screen_init_c11()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// TODO REVIEW:
|
||||||
|
|
||||||
|
/* --- GPU Command Semantics (GP0) --- */
|
||||||
|
|
||||||
|
#define GPU_CMD_CLEAR_CACHE 0x01
|
||||||
|
#define GPU_CMD_VRAM_FILL 0x02
|
||||||
|
#define GPU_CMD_VRAM_COPY 0x80
|
||||||
|
#define GPU_CMD_VRAM_READ 0xC0
|
||||||
|
#define GPU_CMD_POLY_F3 0x20 /* Flat Triangle */
|
||||||
|
#define GPU_CMD_POLY_FT3 0x24 /* Flat Textured Triangle */
|
||||||
|
#define GPU_CMD_POLY_G3 0x30 /* Gouraud Triangle */
|
||||||
|
#define GPU_CMD_POLY_GT3 0x34 /* Gouraud Textured Triangle */
|
||||||
|
#define GPU_CMD_POLY_F4 0x28 /* Flat Quad */
|
||||||
|
#define GPU_CMD_POLY_FT4 0x2C /* Flat Textured Quad */
|
||||||
|
#define GPU_CMD_POLY_G4 0x38 /* Gouraud Quad */
|
||||||
|
#define GPU_CMD_POLY_GT4 0x3C /* Gouraud Textured Quad */
|
||||||
|
|
||||||
|
/* --- Hardware MMIO Addresses --- */
|
||||||
|
|
||||||
|
#define HW_GP0_ADDR 0x1F801810 /* GPU Data Port */
|
||||||
|
#define HW_GP1_ADDR 0x1F801814 /* GPU Status/Control Port */
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,204 @@
|
|||||||
|
#ifdef INTELLISENSE_DIRECTIVES
|
||||||
|
# pragma once
|
||||||
|
# include "dsl.h"
|
||||||
|
# include "math.h"
|
||||||
|
# include "mips.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* C2 data registers */
|
||||||
|
|
||||||
|
/* --- GTE Data Registers (Coprocessor 2) --- */
|
||||||
|
enum {
|
||||||
|
C2_VXY0 = 0, C2_VZ0 = 1, C2_VXY1 = 2, C2_VZ1 = 3,
|
||||||
|
C2_VXY2 = 4, C2_VZ2 = 5, C2_RGB = 6, C2_OTZ = 7,
|
||||||
|
C2_IR0 = 8, C2_IR1 = 9, C2_IR2 = 10, C2_IR3 = 11,
|
||||||
|
C2_SXY0 = 12, C2_SXY1 = 13, C2_SXY2 = 14, C2_SXYP = 15,
|
||||||
|
C2_SZ0 = 16, C2_SZ1 = 17, C2_SZ2 = 18, C2_SZ3 = 19,
|
||||||
|
C2_RGB0 = 20, C2_RGB1 = 21, C2_RGB2 = 22, C2_RES1 = 23,
|
||||||
|
C2_MAC0 = 24, C2_MAC1 = 25, C2_MAC2 = 26, C2_MAC3 = 27,
|
||||||
|
C2_IRGB = 28, C2_ORGB = 29, C2_LZCS = 30, C2_LZCR = 31
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Semantic Aliases for GTE Data Registers */
|
||||||
|
enum {
|
||||||
|
gte_in_v0_xy = C2_VXY0, /* Input Vector 0 (X, Y) */
|
||||||
|
gte_in_v0_z = C2_VZ0, /* Input Vector 0 (Z) */
|
||||||
|
gte_in_v1_xy = C2_VXY1, /* Input Vector 1 (X, Y) */
|
||||||
|
gte_in_v1_z = C2_VZ1, /* Input Vector 1 (Z) */
|
||||||
|
gte_in_v2_xy = C2_VXY2, /* Input Vector 2 (X, Y) */
|
||||||
|
gte_in_v2_z = C2_VZ2, /* Input Vector 2 (Z) */
|
||||||
|
gte_in_rgb = C2_RGB, /* Input Color (R, G, B, Code) */
|
||||||
|
gte_out_scr_xy0 = C2_SXY0, /* Output Screen Coord 0 (X, Y) */
|
||||||
|
gte_out_scr_xy1 = C2_SXY1, /* Output Screen Coord 1 (X, Y) */
|
||||||
|
gte_out_scr_xy2 = C2_SXY2, /* Output Screen Coord 2 (X, Y) */
|
||||||
|
gte_out_depth = C2_OTZ, /* Output Ordering Table Z (Depth) */
|
||||||
|
gte_math_accum0 = C2_MAC0, /* Math Accumulator 0 */
|
||||||
|
gte_math_accum1 = C2_MAC1, /* Math Accumulator 1 */
|
||||||
|
gte_math_accum2 = C2_MAC2, /* Math Accumulator 2 */
|
||||||
|
};
|
||||||
|
|
||||||
|
/* --- GTE Command Semantics (The Bitfield Meanings) ---
|
||||||
|
* A GTE command is a single 32-bit word sent to COP2.
|
||||||
|
* It is highly configurable via bitfields.
|
||||||
|
*/
|
||||||
|
|
||||||
|
enum {
|
||||||
|
/* Shift Fraction (Bit 19) - Determines fixed-point division */
|
||||||
|
|
||||||
|
gte_sf_fractional = 0, /* Divide result by 4096 (Standard 4.12 fixed point) */
|
||||||
|
gte_sf_integer = 1, /* No division (Raw integer math) */
|
||||||
|
|
||||||
|
/* Matrix Select (Bits 18-17) - Which 3x3 matrix to multiply by */
|
||||||
|
|
||||||
|
gte_mx_rotation = 0, /* Rotation Matrix (RT) */
|
||||||
|
gte_mx_light = 1, /* Light Matrix (LL) */
|
||||||
|
gte_mx_color = 2, /* Color Matrix (LC) */
|
||||||
|
gte_mx_none = 3, /* Reserved / Do not multiply */
|
||||||
|
|
||||||
|
/* Vector select (Bits 16-15) - Which input vector to use */
|
||||||
|
|
||||||
|
gte_v_v0 = 0, /* Use Vector 0 (VXY0, VZ0) */
|
||||||
|
gte_v_v1 = 1, /* Use Vector 1 (VXY1, VZ1) */
|
||||||
|
gte_v_v2 = 2, /* Use Vector 2 (VXY2, VZ2) */
|
||||||
|
gte_v_ir_regs = 3, /* Use Intermediate Registers (IR1, IR2, IR3) */
|
||||||
|
|
||||||
|
/* Control Vector Select (Bits 14-13) - Which vector to ADD after multiplication */
|
||||||
|
|
||||||
|
gte_cv_translate = 0, /* Add Translation Vector (TRX, TRY, TRZ) */
|
||||||
|
gte_cv_bg_color = 1, /* Add Background Color (RBK, GBK, BBK) */
|
||||||
|
gte_cv_far_color = 2, /* Add Far Color (RFC, GFC, BFC) */
|
||||||
|
gte_cv_none = 3, /* Add Zero (No addition) */
|
||||||
|
|
||||||
|
/* Limit/Clamp (Bit 10) - Prevents overflow artifacts */
|
||||||
|
|
||||||
|
gte_lm_normal = 0, /* Normal math (can overflow) */
|
||||||
|
gte_lm_clamp = 1, /* Clamp results to valid hardware ranges (e.g., RGB 0-255) */
|
||||||
|
|
||||||
|
/* Core Command IDs (Bits 5-0) */
|
||||||
|
|
||||||
|
gte_cmd_rtps = 0x01, /* Rot/Trans Perspective Single (1 vertex) */
|
||||||
|
gte_cmd_rtpt = 0x02, /* Rot/Trans Perspective Triple (3 vertices) */
|
||||||
|
gte_cmd_nclip = 0x06, /* Normal Clipping (Backface culling) */
|
||||||
|
gte_cmd_op = 0x0C, /* Outer Product */
|
||||||
|
gte_cmd_mvmva = 0x12, /* Matrix Vector Multiply & Add (Custom math) */
|
||||||
|
|
||||||
|
/* --- GTE Command Bit-Field Layout ---
|
||||||
|
* A GTE command word (sent to COP2 with RS=1) is laid out as:
|
||||||
|
*
|
||||||
|
* 31........25 24 23..19 18..17 16..15 14..13 12..11 10 9.......6 5.......0
|
||||||
|
* +------------+--+-----+------+------+------+------+---+--------+----------+
|
||||||
|
* | 0x3E (COP2)| 1| -- | sf | mx | v | cv | --| lm | -- | cmd |
|
||||||
|
* +------------+--+-----+------+------+------+------+---+--------+----------+
|
||||||
|
* \_____ GTE_PAYLOAD _____/ \__ GTE_CMD __/
|
||||||
|
*
|
||||||
|
* Shifts/masks below are the *bit positions* and *bit widths* of each
|
||||||
|
* configurable field, used by the ENC_GTE_CMD encoder. Mirrors the
|
||||||
|
* OPCODE_SHIFT / RS_SHIFT convention used in mips.h.
|
||||||
|
*/
|
||||||
|
|
||||||
|
gte_shift_sf = 19, gte_width_sf = 1, gte_mask_sf = 0x1,
|
||||||
|
gte_shift_mx = 17, gte_width_mx = 2, gte_mask_mx = 0x3,
|
||||||
|
gte_shift_v = 15, gte_width_v = 2, gte_mask_v = 0x3,
|
||||||
|
gte_shift_cv = 13, gte_width_cv = 2, gte_mask_cv = 0x3,
|
||||||
|
gte_shift_lm = 10, gte_width_lm = 1, gte_mask_lm = 0x1,
|
||||||
|
gte_shift_cmd = 0, gte_width_cmd = 6, gte_mask_cmd = 0x3F,
|
||||||
|
};
|
||||||
|
|
||||||
|
/* --- GTE Control Register Indices (for ctc2/cfc2) --- */
|
||||||
|
|
||||||
|
enum {
|
||||||
|
gte_cr_RT11 = 0, gte_cr_RT12 = 1, gte_cr_RT13 = 2,
|
||||||
|
gte_cr_RT21 = 3, gte_cr_RT22 = 4, gte_cr_RT23 = 5,
|
||||||
|
gte_cr_RT31 = 6, gte_cr_RT32 = 7, gte_cr_RT33 = 8,
|
||||||
|
gte_cr_TRX = 9, gte_cr_TRY = 10, gte_cr_TRZ = 11,
|
||||||
|
gte_cr_L11 = 12, gte_cr_L12 = 13, gte_cr_L13 = 14,
|
||||||
|
gte_cr_L21 = 15, gte_cr_L22 = 16, gte_cr_L23 = 17,
|
||||||
|
gte_cr_LR1 = 18, gte_cr_LR2 = 19, gte_cr_LR3 = 20,
|
||||||
|
gte_cr_RBK = 24, gte_cr_GBK = 25, gte_cr_BBK = 26,
|
||||||
|
gte_cr_RFC = 27, gte_cr_GFC = 28, gte_cr_BFC = 29,
|
||||||
|
gte_cr_OFX = 30, gte_cr_OFY = 31,
|
||||||
|
};
|
||||||
|
|
||||||
|
/* COP2 (GTE) Transfer Format
|
||||||
|
* Opcode is always op_cop2. The 'sub' field determines direction (MT/MF). */
|
||||||
|
#define enc_cop2_tx(sub, rt, rd) enc_op(op_cop2) | enc_rs(sub) | enc_rt(rt) | enc_rd(rd)
|
||||||
|
|
||||||
|
/* GTE Command Format (The math engine trigger)
|
||||||
|
* Opcode is always MIPS_OP_COP2, RS is always 1 (CO).
|
||||||
|
* The lower 25 bits are the GTE-specific command payload.
|
||||||
|
*
|
||||||
|
* The granular `enc_gte_<field>(x)` macros below mirror the `enc_op`/`enc_rs`
|
||||||
|
* pattern in mips.h: each one self-masks and shifts its own field, so a
|
||||||
|
* caller can build up a GTE command piece by piece (handy for state-driven
|
||||||
|
* MVMVA emitters that vary one field at a time).
|
||||||
|
*
|
||||||
|
* `ENC_GTE_CMD` is the all-in-one convenience for emitting a full command
|
||||||
|
* word in one go. It just ORs the per-field encoders together. */
|
||||||
|
#define gte_cmd_base (enc_op(op_cop2) | (1 << 25))
|
||||||
|
|
||||||
|
/* Per-field encoders. Each one does (value & mask) << shift on its own. */
|
||||||
|
#define enc_gte_sf(sf) (((sf) & gte_mask_sf ) << gte_shift_sf )
|
||||||
|
#define enc_gte_mx(mx) (((mx) & gte_mask_mx ) << gte_shift_mx )
|
||||||
|
#define enc_gte_v(v) (((v) & gte_mask_v ) << gte_shift_v )
|
||||||
|
#define enc_gte_cv(cv) (((cv) & gte_mask_cv ) << gte_shift_cv )
|
||||||
|
#define enc_gte_lm(lm) (((lm) & gte_mask_lm ) << gte_shift_lm )
|
||||||
|
#define enc_gte_cmd(cmd) (((cmd) & gte_mask_cmd) << gte_shift_cmd)
|
||||||
|
|
||||||
|
/* Composite: all six GTE fields + the COP2/CO base. */
|
||||||
|
#define enc_gte_cmd(sf, mx, v, cv, lm, cmd) ( \
|
||||||
|
gte_cmd_base \
|
||||||
|
| enc_gte_sf(sf) \
|
||||||
|
| enc_gte_mx(mx) \
|
||||||
|
| enc_gte_v(v) \
|
||||||
|
| enc_gte_cv(cv) \
|
||||||
|
| enc_gte_lm(lm) \
|
||||||
|
| enc_gte_cmd(cmd) \
|
||||||
|
)
|
||||||
|
|
||||||
|
/* asm_gte_matrix_set_rotation(r0)
|
||||||
|
*
|
||||||
|
* Loads the 3x3 rotation matrix at `r0` into the GTE's rotation-matrix
|
||||||
|
* control registers (RT11..RT22, indices 0..4) via ctc2.
|
||||||
|
*
|
||||||
|
* Memory layout at r0: five contiguous 32-bit words (offsets 0..16),
|
||||||
|
* each holding two packed 16-bit matrix elements. The first 1.5 rows
|
||||||
|
* of a standard PSX SDK MATRIX struct (where each row is laid out as
|
||||||
|
* [RT_xx, RT_xy] | [RT_xz, pad] | ...).
|
||||||
|
*
|
||||||
|
* Generated MIPS (mirrors the source macro):
|
||||||
|
*
|
||||||
|
* lw $12, 0( %0 ) ; word 0
|
||||||
|
* lw $13, 4( %0 ) ; word 1
|
||||||
|
* ctc2 $12, $0 ; → C2_RT11
|
||||||
|
* ctc2 $13, $1 ; → C2_RT12
|
||||||
|
* lw $12, 8( %0 ) ; word 2
|
||||||
|
* lw $13, 12( %0 ) ; word 3
|
||||||
|
* lw $14, 16( %0 ) ; word 4
|
||||||
|
* ctc2 $12, $2 ; → C2_RT13
|
||||||
|
* ctc2 $13, $3 ; → C2_RT21
|
||||||
|
* ctc2 $14, $4 ; → C2_RT22
|
||||||
|
*
|
||||||
|
* WARNING: Incomplete by design. The source macro only writes RT11..RT22
|
||||||
|
* (5 of 9 rotation elements); RT23 and the entire RT3x row are left
|
||||||
|
* untouched. Real libpsn00b SetRotMatrix writes all 9. Use only when the
|
||||||
|
* GTE's remaining rotation entries are already correct, or you will
|
||||||
|
* get stale-RT2x/RT3x artifacts in RTPS/RTPT/MVMVA output.
|
||||||
|
*/
|
||||||
|
#define asm_gte_matrix_set_rotation(r0) \
|
||||||
|
asm volatile( \
|
||||||
|
asm_inline( \
|
||||||
|
load_imm(R_T4, r0, 0), \
|
||||||
|
load_imm(R_T5, r0, 4), \
|
||||||
|
enc_cop2_tx(cop_mt, R_T4, 0), \
|
||||||
|
enc_cop2_tx(cop_mt, R_T5, 1), \
|
||||||
|
load_imm(R_T4, r0, 8), \
|
||||||
|
load_imm(R_T5, r0, 12), \
|
||||||
|
load_imm(R_T6, r0, 16), \
|
||||||
|
enc_cop2_tx(cop_mt, R_T4, 2), \
|
||||||
|
enc_cop2_tx(cop_mt, R_T5, 3), \
|
||||||
|
enc_cop2_tx(cop_mt, R_T6, 4) \
|
||||||
|
) \
|
||||||
|
asm_clobber( clb_system, "$12", "$13", "$14") \
|
||||||
|
: \
|
||||||
|
: "r"(r0) \
|
||||||
|
)
|
||||||
+22
-22
@@ -7,34 +7,34 @@
|
|||||||
#define max(A, B) (((A) > (B)) ? (A) : (B))
|
#define max(A, B) (((A) > (B)) ? (A) : (B))
|
||||||
#define clamp_bot(X, B) max(X, B)
|
#define clamp_bot(X, B) max(X, B)
|
||||||
|
|
||||||
typedef def_farray(U4, 2);
|
typedef Array_(U4, 2);
|
||||||
typedef def_farray(S2, 2);
|
typedef Array_(S2, 2);
|
||||||
typedef def_farray(S2, 3);
|
typedef Array_(S2, 3);
|
||||||
typedef def_farray(S4, 2);
|
typedef Array_(S4, 2);
|
||||||
typedef def_farray(S4, 3);
|
typedef Array_(S4, 3);
|
||||||
typedef def_farray(S4, 4);
|
typedef Array_(S4, 4);
|
||||||
typedef S2 A3A3_S2[3][3];
|
typedef S2 A3x3_S2[3][3];
|
||||||
|
|
||||||
typedef def_struct(Extent2_S2) { S2 width; S2 height; };
|
typedef Struct_(Extent2_S2) { S2 width; S2 height; };
|
||||||
typedef def_struct(Extent2_S4) { S4 width; S4 height; };
|
typedef Struct_(Extent2_S4) { S4 width; S4 height; };
|
||||||
|
|
||||||
typedef def_struct(V2_S2) { S2 x; S2 y; };
|
typedef Struct_(V2_S2) { S2 x; S2 y; };
|
||||||
typedef def_struct(V2_S4) { S4 x; S4 y; };
|
typedef Struct_(V2_S4) { S4 x; S4 y; };
|
||||||
typedef def_struct(V3_S2) { S2 x; S2 y; S2 z; S2 pad; };
|
typedef Struct_(V3_S2) { S2 x; S2 y; S2 z; S2 pad; };
|
||||||
typedef def_struct(V3_S4) { S4 x; S4 y; S4 z; S4 pad; };
|
typedef Struct_(V3_S4) { S4 x; S4 y; S4 z; S4 pad; };
|
||||||
typedef def_struct(V4_S2) { S2 x; S2 y; S2 z; S2 w; };
|
typedef Struct_(V4_S2) { S2 x; S2 y; S2 z; S2 w; };
|
||||||
typedef def_struct(V4_S4) { S4 x; S4 y; S4 z; S4 w; };
|
typedef Struct_(V4_S4) { S4 x; S4 y; S4 z; S4 w; };
|
||||||
|
|
||||||
typedef def_struct(R2_S2) { V2_S2 p0; V2_S2 p1; };
|
typedef Struct_(R2_S2) { V2_S2 p0; V2_S2 p1; };
|
||||||
typedef def_struct(R2_S4) { V2_S4 p0; V2_S4 p1; };
|
typedef Struct_(R2_S4) { V2_S4 p0; V2_S4 p1; };
|
||||||
|
|
||||||
typedef def_struct(Rect_S2) { S2 x; S2 y; S2 width; S2 height; };
|
typedef Struct_(Rect_S2) { S2 x; S2 y; S2 width; S2 height; };
|
||||||
typedef def_struct(Rect_S4) { S4 x; S4 y; S4 width; S4 height; };
|
typedef Struct_(Rect_S4) { S4 x; S4 y; S4 width; S4 height; };
|
||||||
|
|
||||||
typedef def_struct(M3_S2) { A3A3_S2 m; A3_S4 t; };
|
typedef Struct_(M3_S2) { A3x3_S2 m; A3_S4 t; };
|
||||||
|
|
||||||
typedef def_farray(V2_S2, 3);
|
typedef Array_(V2_S2, 3);
|
||||||
typedef def_farray(V2_S2, 4);
|
typedef Array_(V2_S2, 4);
|
||||||
|
|
||||||
#define v2s2(x,y) (V2_S2){x,y}
|
#define v2s2(x,y) (V2_S2){x,y}
|
||||||
#define v3s2(x,y,z) (V3_S2){x,y,z,0}
|
#define v3s2(x,y,z) (V3_S2){x,y,z,0}
|
||||||
|
|||||||
+79
-101
@@ -3,6 +3,13 @@
|
|||||||
# include "dsl.h"
|
# include "dsl.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define MEM_ALIGNMENT_DEFAULT (2 * S_(void*))
|
||||||
|
|
||||||
|
#define assert_bounds(point, start, end) for(;0;){ \
|
||||||
|
assert((start) <= (point)); \
|
||||||
|
assert((point) <= (end)); \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
inline U4 align_pow2(U4 x, U4 b) {
|
inline U4 align_pow2(U4 x, U4 b) {
|
||||||
assert(b != 0);
|
assert(b != 0);
|
||||||
assert((b & (b - 1)) == 0); // Check power of 2
|
assert((b & (b - 1)) == 0); // Check power of 2
|
||||||
@@ -11,17 +18,17 @@ inline U4 align_pow2(U4 x, U4 b) {
|
|||||||
|
|
||||||
#define align_struct(type_width) ((U4)(((type_width) + 3) & ~3))
|
#define align_struct(type_width) ((U4)(((type_width) + 3) & ~3))
|
||||||
|
|
||||||
#define assert_bounds(point, start, end) do { \
|
FI_ void mem_bump(U4 start, U4 cap, U4*R_ used, U4 amount) {
|
||||||
U4 pos_point = cast(U4, point); \
|
assert(amount <= (cap - used[0]));
|
||||||
U4 pos_start = cast(U4, start); \
|
used[0] += amount;
|
||||||
U4 pos_end = cast(U4, end); \
|
}
|
||||||
assert(pos_start <= pos_point); \
|
|
||||||
assert(pos_point <= pos_end); \
|
|
||||||
} while(0)
|
|
||||||
|
|
||||||
void* memory_copy (void* restrict dest, void const* restrict src, U4 length) __asm__("memcpy");
|
FI_ U4 mem_copy (U4 dest, U4 src, U4 len) { return (U4)(__builtin_memcpy ((void*)dest, (void const*)src, len)); }
|
||||||
void* memory_copy_overlapping(void* restrict dest, void const* restrict src, U4 length);
|
FI_ U4 mem_copy_overlapping(U4 dest, U4 src, U4 len) { return (U4)(__builtin_memmove((void*)dest, (void const*)src, len)); }
|
||||||
B4 memory_zero (void* dest, U4 length);
|
FI_ U4 mem_fill (U4 dest, U4 value, U4 len) { return (U4)(__builtin_memset ((void*)dest, (int) value, len)); }
|
||||||
|
FI_ B4 mem_zero (U4 dest, U4 len) { if(dest == 0){return false;} mem_fill(dest, 0, len); return true; }
|
||||||
|
|
||||||
|
#pragma region DAG
|
||||||
|
|
||||||
#define check_nil(nil, p) ((p) == 0 || (p) == nil)
|
#define check_nil(nil, p) ((p) == 0 || (p) == nil)
|
||||||
#define set_nil(nil, p) ((p) = nil)
|
#define set_nil(nil, p) ((p) = nil)
|
||||||
@@ -42,101 +49,72 @@ B4 memory_zero (void* dest, U4 length);
|
|||||||
)
|
)
|
||||||
#define sll_queue_push_n(f, l, n, next) sll_queue_push_nz(0, f, l, n, next)
|
#define sll_queue_push_n(f, l, n, next) sll_queue_push_nz(0, f, l, n, next)
|
||||||
|
|
||||||
#pragma region Allocator Interface
|
#pragma endregion DAG
|
||||||
#if 0
|
|
||||||
typedef def_enum(U4, AllocatorOp) {
|
|
||||||
AllocatorOp_Alloc_NoZero = 0, // If Alloc exist, so must No_Zero
|
|
||||||
AllocatorOp_Alloc,
|
|
||||||
AllocatorOp_Free,
|
|
||||||
AllocatorOp_Reset,
|
|
||||||
AllocatorOp_Grow_NoZero,
|
|
||||||
AllocatorOp_Grow,
|
|
||||||
AllocatorOp_Shrink,
|
|
||||||
AllocatorOp_Rewind,
|
|
||||||
AllocatorOp_SavePoint,
|
|
||||||
AllocatorOp_Query, // Must always be implemented
|
|
||||||
};
|
|
||||||
typedef def_enum(U4, AllocatorQueryFlags) {
|
|
||||||
AllocatorQuery_Alloc = (1 << 0),
|
|
||||||
AllocatorQuery_Free = (1 << 1),
|
|
||||||
// Wipe the allocator's state
|
|
||||||
AllocatorQuery_Reset = (1 << 2),
|
|
||||||
// Supports both grow and shrink
|
|
||||||
AllocatorQuery_Shrink = (1 << 4),
|
|
||||||
AllocatorQuery_Grow = (1 << 5),
|
|
||||||
AllocatorQuery_Resize = AllocatorQuery_Grow | AllocatorQuery_Shrink,
|
|
||||||
// Ability to rewind to a save point (ex: arenas, stack), must also be able to save such a point
|
|
||||||
AllocatorQuery_Rewind = (1 << 6),
|
|
||||||
};
|
|
||||||
typedef struct AllocatorProc_In AllocatorProc_In;
|
|
||||||
typedef struct AllocatorProc_Out AllocatorProc_Out;
|
|
||||||
typedef void def_proc(AllocatorProc) (AllocatorProc_In In, AllocatorProc_Out* Out);
|
|
||||||
typedef def_struct(AllocatorSP) {
|
|
||||||
AllocatorProc* type_sig;
|
|
||||||
U4 slot;
|
|
||||||
};
|
|
||||||
struct AllocatorProc_In {
|
|
||||||
void* data;
|
|
||||||
U4 requested_size;
|
|
||||||
U4 alignment;
|
|
||||||
union {
|
|
||||||
Slice_B1 old_allocation;
|
|
||||||
AllocatorSP save_point;
|
|
||||||
};
|
|
||||||
AllocatorOp op;
|
|
||||||
byte_pad(4);
|
|
||||||
};
|
|
||||||
struct AllocatorProc_Out {
|
|
||||||
union {
|
|
||||||
Slice_B1 allocation;
|
|
||||||
AllocatorSP save_point;
|
|
||||||
};
|
|
||||||
AllocatorQueryFlags features;
|
|
||||||
U4 left; // Contiguous memory left
|
|
||||||
U4 max_alloc;
|
|
||||||
U4 min_alloc;
|
|
||||||
// byte_pad(8);
|
|
||||||
};
|
|
||||||
typedef def_struct(AllocatorInfo) {
|
|
||||||
AllocatorProc* proc;
|
|
||||||
void* data;
|
|
||||||
};
|
|
||||||
static_assert(size_of(AllocatorSP) <= size_of(Slice_B1));
|
|
||||||
typedef def_struct(AllocatorQueryInfo) {
|
|
||||||
AllocatorSP save_point;
|
|
||||||
AllocatorQueryFlags features;
|
|
||||||
U4 left; // Contiguous memory left
|
|
||||||
U4 max_alloc;
|
|
||||||
U4 min_alloc;
|
|
||||||
// byte_pad(4);
|
|
||||||
};
|
|
||||||
static_assert(size_of(AllocatorProc_Out) == size_of(AllocatorQueryInfo));
|
|
||||||
|
|
||||||
#define MEMORY_ALIGNMENT_DEFAULT (2 * size_of(void*))
|
#pragma region Slice
|
||||||
|
|
||||||
AllocatorQueryInfo allocator_query(AllocatorInfo ainfo);
|
typedef unsigned char UTF8;
|
||||||
|
typedef Struct_(Str8) { UTF8* ptr; U4 len; };
|
||||||
|
typedef Struct_(Slice_Str8) { Str8* ptr; U4 len; };
|
||||||
|
#define txt(string_literal) (Str8){ (UTF8*) string_literal, S_(string_literal) - 1 }
|
||||||
|
|
||||||
void mem_free (AllocatorInfo ainfo, Slice_B1 mem);
|
typedef Struct_(Slice) { U4 ptr, len; }; // Untyped Slice
|
||||||
void mem_reset (AllocatorInfo ainfo);
|
FI_ Slice slice_ut_(U4 ptr, U4 len) { return (Slice){ptr, len}; }
|
||||||
void mem_rewind (AllocatorInfo ainfo, AllocatorSP save_point);
|
|
||||||
AllocatorSP mem_save_point(AllocatorInfo ainfo);
|
|
||||||
|
|
||||||
typedef def_struct(Opts_mem_alloc) { U4 alignment; B4 no_zero; byte_pad(4); };
|
#define Slice_(type) Struct_(tmpl(Slice,type)) { type* ptr; U4 len; }
|
||||||
typedef def_struct(Opts_mem_grow) { U4 alignment; B4 no_zero; byte_pad(4); };
|
typedef Slice_(B1);
|
||||||
typedef def_struct(Opts_mem_shrink) { U4 alignment; };
|
#define slice_assert(s) do { assert((s).ptr != 0); assert((s).len > 0); } while(0)
|
||||||
typedef def_struct(Opts_mem_resize) { U4 alignment; B4 no_zero; byte_pad(4); };
|
#define slice_end(slice) ((slice).ptr + (slice).len)
|
||||||
|
#define S_slice(s) ((s).len * S_((s).ptr[0]))
|
||||||
|
|
||||||
Slice_B1 mem__alloc (AllocatorInfo ainfo, U4 size, Opts_mem_alloc* opts);
|
#define slice_ut(ptr,len) slice_ut_(u4_(ptr), u4_(len))
|
||||||
Slice_B1 mem__grow (AllocatorInfo ainfo, Slice_B1 mem, U4 size, Opts_mem_grow* opts);
|
#define slice_ut_arr(a) slice_ut_(u4_(a), S_(a))
|
||||||
Slice_B1 mem__resize(AllocatorInfo ainfo, Slice_B1 mem, U4 size, Opts_mem_resize* opts);
|
#define slice_to_ut(s) slice_ut_(u4_((s).ptr), S_slice(s))
|
||||||
Slice_B1 mem__shrink(AllocatorInfo ainfo, Slice_B1 mem, U4 size, Opts_mem_shrink* opts);
|
|
||||||
|
|
||||||
#define mem_alloc(ainfo, size, ...) mem__alloc (ainfo, size, opt_args(Opts_mem_alloc, __VA_ARGS__))
|
#define slice_iter(container, iter) (T_((container).ptr) iter = (container).ptr; iter != slice_end(container); ++ iter)
|
||||||
#define mem_grow(ainfo, mem, size, ...) mem__grow (ainfo, mem, size, opt_args(Opts_mem_grow, __VA_ARGS__))
|
#define slice_arg_from_array(type, ...) & (tmpl(Slice,type)) { .ptr = array_decl(type,__VA_ARGS__), .len = array_len( array_decl(type,__VA_ARGS__)) }
|
||||||
#define mem_resize(ainfo, mem, size, ...) mem__resize(ainfo, mem, size, opt_args(Opts_mem_resize, __VA_ARGS__))
|
|
||||||
#define mem_shrink(ainfo, mem, size, ...) mem__shrink(ainfo, mem, size, opt_args(Opts_mem_shrink, __VA_ARGS__))
|
|
||||||
|
|
||||||
#define alloc_type(ainfo, type, ...) (type*) mem__alloc(ainfo, size_of(type), opt_args(Opts_mem_alloc, __VA_ARGS__)).ptr
|
FI_ void slice_zero_(Slice s) { slice_assert(s); mem_zero(s.ptr, s.len); }
|
||||||
#define alloc_slice(ainfo, type, num, ...) (tmpl(Slice,type)){ mem__alloc(ainfo, size_of(type) * num, opt_args(Opts_mem_alloc, __VA_ARGS__)).ptr, num }
|
#define slice_zero(s) slice_zero_(slice_to_ut(s))
|
||||||
#endif
|
|
||||||
#pragma endregion Allocator Interface
|
FI_ void slice_copy_(Slice dest, Slice src) {
|
||||||
|
assert(dest.len >= src.len);
|
||||||
|
slice_assert(dest);
|
||||||
|
slice_assert(src);
|
||||||
|
mem_copy(dest.ptr, src.ptr, src.len);
|
||||||
|
}
|
||||||
|
#define slice_copy(dest, src) do { \
|
||||||
|
static_assert(T_same(dest, src)); \
|
||||||
|
slice_copy_(slice_to_ut(dest), slice_to_ut(src)); \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
|
#pragma endregion Slice
|
||||||
|
|
||||||
|
#pragma region FArena
|
||||||
|
|
||||||
|
typedef Opt_(farena) { U4 alignment, type_width; };
|
||||||
|
typedef Struct_(FArena) { U4 start, capacity, used; };
|
||||||
|
FI_ void farena_init(FArena_R arena, Slice mem) { assert(arena != nullptr);
|
||||||
|
arena->start = mem.ptr;
|
||||||
|
arena->capacity = mem.len;
|
||||||
|
arena->used = 0;
|
||||||
|
}
|
||||||
|
FI_ FArena farena_make(Slice mem) { FArena a; farena_init(& a, mem); return a; }
|
||||||
|
I_ Slice farena_push(FArena_R arena, U4 amount, Opt_farena o) {
|
||||||
|
if (amount == 0) { return (Slice){}; }
|
||||||
|
U4 desired = amount * (o.type_width == 0 ? 1 : o.type_width);
|
||||||
|
U4 to_commit = align_pow2(desired, o.alignment ? o.alignment : MEM_ALIGNMENT_DEFAULT);
|
||||||
|
mem_bump(arena->start, arena->capacity, & arena->used, to_commit);
|
||||||
|
return (Slice){ arena->start + arena->used, to_commit };
|
||||||
|
}
|
||||||
|
FI_ void farena_reset(FArena_R arena) { arena->used = 0; }
|
||||||
|
FI_ void farena_rewind(FArena_R arena, U4 save_point) {
|
||||||
|
U4 end = arena->start + arena->used; assert_bounds(save_point, arena->start, end);
|
||||||
|
arena->used -= save_point - arena->start;
|
||||||
|
}
|
||||||
|
FI_ U4 farena_save(FArena arena) { return arena.used; }
|
||||||
|
#define farena_push_(arena, amount, ...) farena_push((arena), (amount), opt_(farena, __VA_ARGS__))
|
||||||
|
#define farena_push_type(arena, type, ...) C_(type*, farena_push((arena), 1, opt_(farena, .type_width=S_(type), __VA_ARGS__)).ptr)
|
||||||
|
#define farena_push_array(arena, type, amount, ...) (tmpl(Slice,type)){ C_(type*, farena_push((arena), (amount), opt_(farena, .type_width=S_(type), __VA_ARGS__)).ptr), (amount) }
|
||||||
|
|
||||||
|
#pragma endregion FArena
|
||||||
|
|||||||
@@ -0,0 +1,211 @@
|
|||||||
|
#ifdef INTELLISENSE_DIRECTIVES
|
||||||
|
# pragma once
|
||||||
|
# include "dsl.h"
|
||||||
|
# include "gcc_asm.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
enum {
|
||||||
|
/* --- MIPS CPU Registers --- */
|
||||||
|
|
||||||
|
R_0 = 0, R_AT = 1, R_V0 = 2, R_V1 = 3,
|
||||||
|
R_A0 = 4, R_A1 = 5, R_A2 = 6, R_A3 = 7,
|
||||||
|
R_T0 = 8, R_T1 = 9, R_T2 = 10, R_T3 = 11,
|
||||||
|
R_T4 = 12, R_T5 = 13, R_T6 = 14, R_T7 = 15,
|
||||||
|
R_S0 = 16, R_S1 = 17, R_S2 = 18, R_S3 = 19,
|
||||||
|
R_S4 = 20, R_S5 = 21, R_S6 = 22, R_S7 = 23,
|
||||||
|
R_T8 = 24, R_T9 = 25, R_K0 = 26, R_K1 = 27,
|
||||||
|
R_GP = 28, R_SP = 29, R_FP = 30, R_RA = 31
|
||||||
|
|
||||||
|
/* Semantic Aliases for MIPS Registers (O32 ABI) */
|
||||||
|
|
||||||
|
, rdiscard = R_0 /* Hardwired to 0 */
|
||||||
|
, rret_0 = R_V0 /* Function return value */
|
||||||
|
, rret_1 = R_V1 /* Second return value (e.g., 64-bit) */
|
||||||
|
, rarg_0 = R_A0 /* First function argument */
|
||||||
|
, rarg_1 = R_A1 /* Second function argument */
|
||||||
|
, rarg_2 = R_A2 /* Third function argument */
|
||||||
|
, rarg_3 = R_A3 /* Fourth function argument */
|
||||||
|
, rtmp_0 = R_T0 /* Temporary (Caller saved) */
|
||||||
|
, rtmp_1 = R_T1 /* Temporary (Caller saved) */
|
||||||
|
, rtmp_2 = R_T2 /* Temporary (Caller saved) */
|
||||||
|
, rsaved_0 = R_S0 /* Saved register (Callee saved) */
|
||||||
|
, rstack_ptr = R_SP /* Stack Pointer */
|
||||||
|
, rret_addr = R_RA /* Return Address (populated by JAL) */
|
||||||
|
|
||||||
|
/* --- MIPS CPU Opcodes (Bits 31-26) --- */
|
||||||
|
|
||||||
|
, op_special = 0x00 /* R-Type instructions (uses FUNCT field) */
|
||||||
|
, op_bcond = 0x01 /* Branch on condition */
|
||||||
|
, op_j = 0x02 /* Jump */
|
||||||
|
, op_jal = 0x03 /* Jump and Link */
|
||||||
|
, op_beq = 0x04 /* Branch on Equal */
|
||||||
|
, op_bne = 0x05 /* Branch on Not Equal */
|
||||||
|
, op_blez = 0x06 /* Branch on Less Than or Equal to Zero */
|
||||||
|
, op_bgtz = 0x07 /* Branch on Greater Than Zero */
|
||||||
|
, op_addi = 0x08 /* Add Immediate */
|
||||||
|
, op_addiu = 0x09 /* Add Immediate Unsigned */
|
||||||
|
, op_slti = 0x0A /* Set on Less Than Immediate */
|
||||||
|
, op_sltiu = 0x0B /* Set on Less Than Immediate Unsigned */
|
||||||
|
, op_andi = 0x0C /* AND Immediate */
|
||||||
|
, op_ori = 0x0D /* OR Immediate */
|
||||||
|
, op_xori = 0x0E /* XOR Immediate */
|
||||||
|
, op_lui = 0x0F /* Load Upper Immediate */
|
||||||
|
, op_cop0 = 0x10 /* Coprocessor 0 (System) */
|
||||||
|
, op_cop2 = 0x12 /* Coprocessor 2 (GTE) */
|
||||||
|
, op_la = 0
|
||||||
|
, op_li = 0
|
||||||
|
, op_lb = 0x20 /* Load Byte */
|
||||||
|
, op_lh = 0x21 /* Load Halfword */
|
||||||
|
, op_lw = 0x23 /* Load Word */
|
||||||
|
, op_lbu = 0x24 /* Load Byte Unsigned */
|
||||||
|
, op_lhu = 0x25 /* Load Halfword Unsigned */
|
||||||
|
, op_sb = 0x28 /* Store Byte */
|
||||||
|
, op_sh = 0x29 /* Store Halfword */
|
||||||
|
, op_sw = 0x2B /* Store Word */
|
||||||
|
|
||||||
|
, op_load_addr = op_la
|
||||||
|
, op_load_imm = op_li
|
||||||
|
, op_jump = op_j
|
||||||
|
, op_jump_nlink = op_jal
|
||||||
|
|
||||||
|
/* --- MIPS CPU Function Codes (Bits 5-0, used when OP == MIPS_OP_SPECIAL) --- */
|
||||||
|
|
||||||
|
, fc_sll = 0x00 /* Shift Word Left Logical */
|
||||||
|
, fc_srl = 0x02 /* Shift Word Right Logical */
|
||||||
|
, fc_sra = 0x03 /* Shift Word Right Arithmetic */
|
||||||
|
, fc_sllv = 0x04 /* Shift Word Left Logical Variable */
|
||||||
|
, fc_srlv = 0x06 /* Shift Word Right Logical Variable */
|
||||||
|
, fc_srav = 0x07 /* Shift Word Right Arithmetic Variable */
|
||||||
|
, fc_jr = 0x08 /* Jump Register */
|
||||||
|
, fc_jalr = 0x09 /* Jump and Link Register */
|
||||||
|
, fc_syscall = 0x0C /* System Call */
|
||||||
|
, fc_break = 0x0D /* Breakpoint */
|
||||||
|
, fc_mfhi = 0x10 /* Move From HI */
|
||||||
|
, fc_mthi = 0x11 /* Move To HI */
|
||||||
|
, fc_mflo = 0x12 /* Move From LO */
|
||||||
|
, fc_mtlo = 0x13 /* Move To LO */
|
||||||
|
, fc_mult = 0x18 /* Multiply Word */
|
||||||
|
, fc_multu = 0x19 /* Multiply Unsigned Word */
|
||||||
|
, fc_div = 0x1A /* Divide Word */
|
||||||
|
, fc_divu = 0x1B /* Divide Unsigned Word */
|
||||||
|
, fc_add = 0x20 /* Add Word */
|
||||||
|
, fc_addu = 0x21 /* Add Unsigned Word */
|
||||||
|
, fc_sub = 0x22 /* Subtract Word */
|
||||||
|
, fc_subu = 0x23 /* Subtract Unsigned Word */
|
||||||
|
, fc_and = 0x24 /* AND */
|
||||||
|
, fc_or = 0x25 /* OR */
|
||||||
|
, fc_xor = 0x26 /* XOR */
|
||||||
|
, fc_nor = 0x27 /* NOR */
|
||||||
|
, fc_slt = 0x2A /* Set on Less Than */
|
||||||
|
, fc_sltu = 0x2B /* Set on Less Than Unsigned */
|
||||||
|
|
||||||
|
, fc_jump_reg = fc_jr
|
||||||
|
|
||||||
|
/* --- Coprocessor 0 (System Control & Exceptions) --- */
|
||||||
|
|
||||||
|
, cop_mf = 0x00 /* Move From Coprocessor */
|
||||||
|
, cop_mt = 0x04 /* Move To Coprocessor */
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// Bitfield Packets (Encoders)
|
||||||
|
|
||||||
|
enum { _BitOffsets = 0
|
||||||
|
/* Bit Offsets for MIPS Instruction Fields */
|
||||||
|
|
||||||
|
, OPCODE_SHIFT = 26
|
||||||
|
, RS_SHIFT = 21
|
||||||
|
, RT_SHIFT = 16
|
||||||
|
, RD_SHIFT = 11
|
||||||
|
, SHAMT_SHIFT = 6 /* Shift Amount */
|
||||||
|
, FC_SHIFT = 0
|
||||||
|
|
||||||
|
/* Bit Masks to prevent overflow into adjacent fields */
|
||||||
|
|
||||||
|
, OPCODE_MASK = 0x3F
|
||||||
|
, REG_MASK = 0x1F
|
||||||
|
, SHAMT_MASK = 0x1F /* Shift Amount */
|
||||||
|
, FC_MASK = 0x3F
|
||||||
|
, IMM_MASK = 0xFFFF
|
||||||
|
};
|
||||||
|
|
||||||
|
#define enc_op(op) (((op) & OPCODE_MASK) << OPCODE_SHIFT)
|
||||||
|
#define enc_rs(rs) (((rs) & REG_MASK) << RS_SHIFT)
|
||||||
|
#define enc_rt(rt) (((rt) & REG_MASK) << RT_SHIFT)
|
||||||
|
#define enc_rd(rd) (((rd) & REG_MASK) << RD_SHIFT)
|
||||||
|
#define enc_shamt(shamt) (((shamt) & SHAMT_MASK) << SHAMT_SHIFT)
|
||||||
|
#define enc_fc(fc) (((fc) & FC_MASK) << FC_SHIFT)
|
||||||
|
#define enc_imm(imm) (((imm) & IMM_MASK))
|
||||||
|
|
||||||
|
/* MIPS R-Type Instruction Format (Register-to-Register) */
|
||||||
|
#define enc_r(op, rs, rt, rd, shamt, fc) (enc_op(op) | enc_rs(rs) | enc_rt(rt) | enc_rd(rd) | enc_shamt(shamt) | enc_fc(fc))
|
||||||
|
/* MIPS I-Type Instruction Format (Immediate/Constant) */
|
||||||
|
#define enc_i(op, rs, rt, imm) (enc_op(op) | enc_rs(rs) | enc_rt(rt) | enc_imm(imm))
|
||||||
|
|
||||||
|
/* COP0 (System) Transfer Format */
|
||||||
|
#define enc_cop0_tx(sub, rt, rd) enc_op(op_cop0) | enc_rs(sub) | enc_rt(rt) | enc_rd(rd)
|
||||||
|
|
||||||
|
/* COP0 Return From Exception (rfe) */
|
||||||
|
#define enc_rfe() 0x42000010
|
||||||
|
|
||||||
|
#define load_imm(rs,rt,imm) enc_i(op_lw, rs, rt, imm)
|
||||||
|
#define store_word(rs,rt,imm) enc_i(op_sw, rs, rt, imm)
|
||||||
|
#define add_ui(rs,rt,imm) enc_i(op_addiu, rs, rt, imm)
|
||||||
|
#define shift_ll(rs,rt,rd) enc_r(op_special, rs, rt, rd, 0, fc_sll)
|
||||||
|
|
||||||
|
#define jump_reg(rs) enc_r(op_special, rs, R_0, R_0, 0, fc_jr)
|
||||||
|
#define jump_nreg(rs,rt,rd) enc_r(op_special, rs, rt, rd, 0, fc_jalr)
|
||||||
|
|
||||||
|
#define nop() shift_ll(rdiscard, rdiscard, rdiscard)
|
||||||
|
|
||||||
|
// FI_ void emit_load_imm(U4 rs, U4 rt, U4 imm) { emit(load_imm()); }
|
||||||
|
|
||||||
|
// Binary Metaprogramming
|
||||||
|
|
||||||
|
typedef U4 const Code;
|
||||||
|
#define CodeBlob_(sym) tmpl(codeblob,sym) [] align_(4) =
|
||||||
|
|
||||||
|
// #define def_code_blob(func_name, func_signature, ...) \
|
||||||
|
// internal U4 const \
|
||||||
|
// tmpl(func_name,blob) [] align(4) \
|
||||||
|
// = { \
|
||||||
|
// __VA_ARGS__ \
|
||||||
|
// }; \
|
||||||
|
// internal func_signature func_name = (func_signature)func_name##_blob;
|
||||||
|
|
||||||
|
enum {
|
||||||
|
bios_flushcache = 0x44,
|
||||||
|
bios_table_addr = 0xA0,
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Flushes the Instruction Cache */
|
||||||
|
I_
|
||||||
|
Code CodeBlob_(mips_flush_icache) {
|
||||||
|
add_ui(rstack_ptr, rstack_ptr, -8),
|
||||||
|
store_word(rstack_ptr, rret_addr, 4),
|
||||||
|
add_ui(rdiscard, rret_0, bios_flushcache), add_ui(rdiscard, rtmp_0, bios_table_addr),
|
||||||
|
jump_nreg(rtmp_0, rdiscard, rret_addr),
|
||||||
|
nop(), load_imm(rstack_ptr, rret_addr, 4), jump_reg(rret_addr),
|
||||||
|
add_ui(rstack_ptr, rstack_ptr, 8)
|
||||||
|
};
|
||||||
|
FI_ void mips_flush_icache(void) { C_(VoidFn*, codeblob_mips_flush_icache)(); }
|
||||||
|
|
||||||
|
#define clb_system "$2", "$8", "$9", "$31", "memory"
|
||||||
|
|
||||||
|
#define asm_mips_flush_icache() asm volatile( \
|
||||||
|
asm_inline( \
|
||||||
|
add_ui(rstack_ptr, rstack_ptr, -8) \
|
||||||
|
, store_word(rstack_ptr, rret_addr, 4) \
|
||||||
|
, add_ui(rdiscard, rret_0, bios_flushcache), add_ui(rdiscard, rtmp_0, bios_table_addr) \
|
||||||
|
, jump_nreg(rtmp_0, rdiscard, rret_addr) \
|
||||||
|
, nop(), load_imm(rstack_ptr, rret_addr, 4), jump_reg(rret_addr) \
|
||||||
|
, add_ui(rstack_ptr, rstack_ptr, 8) \
|
||||||
|
) \
|
||||||
|
asm_clobber( clb_system ) \
|
||||||
|
)
|
||||||
|
|
||||||
|
void test_mips_asm() {
|
||||||
|
asm_mips_flush_icache();
|
||||||
|
}
|
||||||
|
|
||||||
|
// TAPE & EMITTERS
|
||||||
+47
-23
@@ -17,21 +17,21 @@ enum {
|
|||||||
};
|
};
|
||||||
|
|
||||||
typedef U4 OrderingTable_Buffer[OrderingTbl_Len];
|
typedef U4 OrderingTable_Buffer[OrderingTbl_Len];
|
||||||
typedef def_farray(OrderingTable_Buffer, 2);
|
typedef Array_(OrderingTable_Buffer, 2);
|
||||||
|
|
||||||
typedef B1 PrimitiveBuffer[PrimitiveBuff_Len];
|
typedef B1 PrimitiveBuffer[PrimitiveBuff_Len];
|
||||||
typedef def_farray(PrimitiveBuffer, 2);
|
typedef Array_(PrimitiveBuffer, 2);
|
||||||
typedef def_struct(PrimitiveArena) {
|
typedef Struct_(PrimitiveArena) {
|
||||||
A2_PrimitiveBuffer buf;
|
A2_PrimitiveBuffer buf;
|
||||||
U4 used;
|
U4 used;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define Cube_num_verts 8
|
#define Cube_num_verts 8
|
||||||
typedef def_farray(V3_S2, Cube_num_verts);
|
typedef Array_(V3_S2, Cube_num_verts);
|
||||||
#define Cube_num_faces 6
|
#define Cube_num_faces 6
|
||||||
typedef def_farray(V4_S2, Cube_num_faces);
|
typedef Array_(V4_S2, Cube_num_faces);
|
||||||
void ent_cube128_init(A8_V3_S2* verts, A6_V4_S2* faces) {
|
I_ void ent_cube128_init(A8_V3_S2* verts, A6_V4_S2* faces) {
|
||||||
memory_copy(verts, & (A8_V3_S2) {
|
LP_ A8_V3_S2 baked_verts = (A8_V3_S2) {
|
||||||
{ -128, -128, -128 },
|
{ -128, -128, -128 },
|
||||||
{ 128, -128, -128 },
|
{ 128, -128, -128 },
|
||||||
{ 128, -128, 128 },
|
{ 128, -128, 128 },
|
||||||
@@ -40,18 +40,20 @@ void ent_cube128_init(A8_V3_S2* verts, A6_V4_S2* faces) {
|
|||||||
{ 128, 128, -128 },
|
{ 128, 128, -128 },
|
||||||
{ 128, 128, 128 },
|
{ 128, 128, 128 },
|
||||||
{ -128, 128, 128 }
|
{ -128, 128, 128 }
|
||||||
}, size_of(A8_V3_S2) );
|
};
|
||||||
memory_copy(faces, & (A6_V4_S2) {
|
LP_ A6_V4_S2 baked_faces = (A6_V4_S2) {
|
||||||
{ 3, 2, 0, 1 },
|
{ 3, 2, 0, 1 },
|
||||||
{ 0, 1, 4, 5 },
|
{ 0, 1, 4, 5 },
|
||||||
{ 4, 5, 7, 6 },
|
{ 4, 5, 7, 6 },
|
||||||
{ 1, 2, 5, 6 },
|
{ 1, 2, 5, 6 },
|
||||||
{ 2, 3, 6, 7 },
|
{ 2, 3, 6, 7 },
|
||||||
{ 3, 0, 7, 4 },
|
{ 3, 0, 7, 4 },
|
||||||
}, size_of(A6_V4_S2) );
|
};
|
||||||
|
mem_copy(u4_(verts), u4_(& baked_verts), S_(A8_V3_S2) );
|
||||||
|
mem_copy(u4_(faces), u4_(& baked_faces), S_(A6_V4_S2) );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
typedef def_struct(Ent_Cube) {
|
typedef Struct_(Ent_Cube) {
|
||||||
V3_S4 accel;
|
V3_S4 accel;
|
||||||
V3_S4 vel;
|
V3_S4 vel;
|
||||||
V3_S4 pos;
|
V3_S4 pos;
|
||||||
@@ -62,22 +64,24 @@ typedef def_struct(Ent_Cube) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
#define Floor_num_verts 4
|
#define Floor_num_verts 4
|
||||||
typedef def_farray(V3_S2, Floor_num_verts);
|
typedef Array_(V3_S2, Floor_num_verts);
|
||||||
#define Floor_num_faces 2
|
#define Floor_num_faces 2
|
||||||
typedef def_farray(V3_S2, Floor_num_faces);
|
typedef Array_(V3_S2, Floor_num_faces);
|
||||||
void ent_floor_init(A4_V3_S2* verts, A2_V3_S2* faces) {
|
I_ void ent_floor_init(A4_V3_S2* verts, A2_V3_S2* faces) {
|
||||||
memory_copy(verts, &(A4_V3_S2) {
|
LP_ A4_V3_S2 baked_verts = (A4_V3_S2) {
|
||||||
{ -900, 0, -900 },
|
{ -900, 0, -900 },
|
||||||
{ -900, 0, 900 },
|
{ -900, 0, 900 },
|
||||||
{ 900, 0, -900 },
|
{ 900, 0, -900 },
|
||||||
{ 900, 0, 900 },
|
{ 900, 0, 900 },
|
||||||
}, size_of(A8_V3_S2));
|
};
|
||||||
memory_copy(faces, & (A2_V3_S2) {
|
LP_ A2_V3_S2 baked_faces = (A2_V3_S2) {
|
||||||
{ 0, 1, 2 },
|
{ 0, 1, 2 },
|
||||||
{ 1, 3, 2 },
|
{ 1, 3, 2 },
|
||||||
}, size_of(A2_V3_S2));
|
|
||||||
};
|
};
|
||||||
typedef def_struct(Ent_Floor) {
|
mem_copy(u4_(verts), u4_(& baked_verts), S_(A4_V3_S2));
|
||||||
|
mem_copy(u4_(faces), u4_(& baked_faces), S_(A2_V3_S2));
|
||||||
|
};
|
||||||
|
typedef Struct_(Ent_Floor) {
|
||||||
V3_S4 accel;
|
V3_S4 accel;
|
||||||
V3_S4 pos;
|
V3_S4 pos;
|
||||||
V3_S4 scale;
|
V3_S4 scale;
|
||||||
@@ -86,7 +90,7 @@ typedef def_struct(Ent_Floor) {
|
|||||||
A2_V3_S2 faces;
|
A2_V3_S2 faces;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef def_struct(SMemory) {
|
typedef Struct_(SMemory) {
|
||||||
DoubleBuffer screen_buf;
|
DoubleBuffer screen_buf;
|
||||||
A2_OrderingTable_Buffer ordering_tbl;
|
A2_OrderingTable_Buffer ordering_tbl;
|
||||||
PrimitiveArena primitives;
|
PrimitiveArena primitives;
|
||||||
@@ -100,7 +104,7 @@ typedef def_struct(SMemory) {
|
|||||||
global SMemory static_mem;
|
global SMemory static_mem;
|
||||||
extern SMemory static_mem;
|
extern SMemory static_mem;
|
||||||
|
|
||||||
B1* prim__alloc(U4 type_width, Str8 type_name) {
|
I_ B1* prim__alloc(U4 type_width, Str8 type_name) {
|
||||||
gknown PrimitiveArena* pa = & static_mem.primitives;
|
gknown PrimitiveArena* pa = & static_mem.primitives;
|
||||||
gknown B1* buf = (B1*) r_(static_mem.primitives.buf)[static_mem.active_buf_id];
|
gknown B1* buf = (B1*) r_(static_mem.primitives.buf)[static_mem.active_buf_id];
|
||||||
assert(pa->used + type_width < PrimitiveBuff_Len);
|
assert(pa->used + type_width < PrimitiveBuff_Len);
|
||||||
@@ -108,7 +112,7 @@ B1* prim__alloc(U4 type_width, Str8 type_name) {
|
|||||||
pa->used += type_width;
|
pa->used += type_width;
|
||||||
return next;
|
return next;
|
||||||
}
|
}
|
||||||
#define prim_alloc(type) (type*)prim__alloc(size_of(type), txt( stringify(type)))
|
#define prim_alloc(type) (type*)prim__alloc(S_(type), txt( stringify(type)))
|
||||||
|
|
||||||
void gp_screen_init_c11(DoubleBuffer* screen_buf, S2* active_buf_id)
|
void gp_screen_init_c11(DoubleBuffer* screen_buf, S2* active_buf_id)
|
||||||
{
|
{
|
||||||
@@ -157,6 +161,26 @@ void gp_display_frame(DoubleBuffer* screen_buf, S2* active_buf_id, U4* ordering_
|
|||||||
void render(void) {
|
void render(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// #define gte_ldv0(r0) \
|
||||||
|
// __asm__ volatile( \
|
||||||
|
// "lwc2 $0, 0( %0 );" \
|
||||||
|
// "lwc2 $1, 4( %0 )" \
|
||||||
|
// : \
|
||||||
|
// : "r"(r0))
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Loads a single V3_S2 to GTE vector register V0
|
||||||
|
*
|
||||||
|
* @details Loads values from an V3_S2 struct to GTE data registers C2_VXY0
|
||||||
|
* and C2_VZ0.
|
||||||
|
*/
|
||||||
|
// #define gte_ldv0( r0 ) __asm__ volatile ( \
|
||||||
|
// "lwc2 $0, 0( %0 );" \
|
||||||
|
// "lwc2 $1, 4( %0 );" \
|
||||||
|
// : \
|
||||||
|
// : "r"( r0 ) \
|
||||||
|
// : "$t0" )
|
||||||
|
|
||||||
void update(PrimitiveArena* pa, U4* ordering_buf)
|
void update(PrimitiveArena* pa, U4* ordering_buf)
|
||||||
{
|
{
|
||||||
orderingtbl_clear_reverse(ordering_buf, OrderingTbl_Len);
|
orderingtbl_clear_reverse(ordering_buf, OrderingTbl_Len);
|
||||||
@@ -219,7 +243,7 @@ void update(PrimitiveArena* pa, U4* ordering_buf)
|
|||||||
// static_mem.cube.rot.x += 6;
|
// static_mem.cube.rot.x += 6;
|
||||||
// static_mem.cube.rot.y += 8;
|
// static_mem.cube.rot.y += 8;
|
||||||
// static_mem.cube.rot.z += 12;
|
// static_mem.cube.rot.z += 12;
|
||||||
static_mem.cube.rot.y += 20;
|
static_mem.cube.rot.y += 0;
|
||||||
}
|
}
|
||||||
// Draw Floor
|
// Draw Floor
|
||||||
{
|
{
|
||||||
|
|||||||
+17
-17
@@ -5,8 +5,8 @@
|
|||||||
# include "duffle/gp.h"
|
# include "duffle/gp.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef def_struct(DrawEnv_Packed) { U4 tag; U4 code[15]; };
|
typedef Struct_(DrawEnv_Packed) { U4 tag; U4 code[15]; };
|
||||||
typedef def_struct(DrawEnv) {
|
typedef Struct_(DrawEnv) {
|
||||||
Rect_S2 clip_area;
|
Rect_S2 clip_area;
|
||||||
A2_S2 drawing_offset;
|
A2_S2 drawing_offset;
|
||||||
Rect_S2 texture_window;
|
Rect_S2 texture_window;
|
||||||
@@ -17,7 +17,7 @@ typedef def_struct(DrawEnv) {
|
|||||||
RGB8 initial_bg_color;
|
RGB8 initial_bg_color;
|
||||||
DrawEnv_Packed dr_env; // reserved
|
DrawEnv_Packed dr_env; // reserved
|
||||||
};
|
};
|
||||||
typedef def_struct(DisplayEnv) {
|
typedef Struct_(DisplayEnv) {
|
||||||
Rect_S2 display_area;
|
Rect_S2 display_area;
|
||||||
Rect_S2 screen;
|
Rect_S2 screen;
|
||||||
B1 vinterlace;
|
B1 vinterlace;
|
||||||
@@ -25,9 +25,9 @@ typedef def_struct(DisplayEnv) {
|
|||||||
B1 pad0;
|
B1 pad0;
|
||||||
B1 pad1;
|
B1 pad1;
|
||||||
};
|
};
|
||||||
typedef def_farray(DrawEnv, 2);
|
typedef Array_(DrawEnv, 2);
|
||||||
typedef def_farray(DisplayEnv, 2);
|
typedef Array_(DisplayEnv, 2);
|
||||||
typedef def_struct(DoubleBuffer) {
|
typedef Struct_(DoubleBuffer) {
|
||||||
A2_DrawEnv draw;
|
A2_DrawEnv draw;
|
||||||
A2_DisplayEnv display;
|
A2_DisplayEnv display;
|
||||||
};
|
};
|
||||||
@@ -58,7 +58,7 @@ U4 vsync(U4 mode) __asm__("VSync");
|
|||||||
|
|
||||||
void draw_orderingtbl(U4* buf) __asm__("DrawOTag");
|
void draw_orderingtbl(U4* buf) __asm__("DrawOTag");
|
||||||
|
|
||||||
typedef def_struct(PolyTag) {
|
typedef Struct_(PolyTag) {
|
||||||
U4 addr: 24;
|
U4 addr: 24;
|
||||||
U4 len: 8;
|
U4 len: 8;
|
||||||
RGB8 color;
|
RGB8 color;
|
||||||
@@ -106,7 +106,7 @@ typedef def_struct(PolyTag) {
|
|||||||
// #define setLineF4(p) set_len(p, 6), set_code(p, 0x4c),(p)->pad = 0x55555555
|
// #define setLineF4(p) set_len(p, 6), set_code(p, 0x4c),(p)->pad = 0x55555555
|
||||||
// #define setLineG4(p) set_len(p, 9), set_code(p, 0x5c),(p)->pad = 0x55555555, (p)->p2 = 0, (p)->p3 = 0
|
// #define setLineG4(p) set_len(p, 9), set_code(p, 0x5c),(p)->pad = 0x55555555, (p)->p2 = 0, (p)->p3 = 0
|
||||||
|
|
||||||
typedef def_struct(Poly_F3) {
|
typedef Struct_(Poly_F3) {
|
||||||
U4 tag;
|
U4 tag;
|
||||||
RGB8 color;
|
RGB8 color;
|
||||||
B1 code;
|
B1 code;
|
||||||
@@ -120,14 +120,14 @@ typedef def_struct(Poly_F3) {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef def_struct(Poly_G3) {
|
typedef Struct_(Poly_G3) {
|
||||||
U4 tag; RGB8 c0; B1 code;
|
U4 tag; RGB8 c0; B1 code;
|
||||||
V2_S2 p0; RGB8 c1; B1 pad1;
|
V2_S2 p0; RGB8 c1; B1 pad1;
|
||||||
V2_S2 p1; RGB8 c2; B1 pad2;
|
V2_S2 p1; RGB8 c2; B1 pad2;
|
||||||
V2_S2 p2;
|
V2_S2 p2;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef def_struct(Poly_F4) {
|
typedef Struct_(Poly_F4) {
|
||||||
U4 tag;
|
U4 tag;
|
||||||
RGB8 color;
|
RGB8 color;
|
||||||
B1 code;
|
B1 code;
|
||||||
@@ -142,7 +142,7 @@ typedef def_struct(Poly_F4) {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef def_struct(Poly_G4) {
|
typedef Struct_(Poly_G4) {
|
||||||
U4 tag; RGB8 c0; B1 code;
|
U4 tag; RGB8 c0; B1 code;
|
||||||
V2_S2 p0; RGB8 c1; B1 pad1;
|
V2_S2 p0; RGB8 c1; B1 pad1;
|
||||||
V2_S2 p1; RGB8 c2; B1 pad2;
|
V2_S2 p1; RGB8 c2; B1 pad2;
|
||||||
@@ -150,7 +150,7 @@ typedef def_struct(Poly_G4) {
|
|||||||
V2_S2 p3;
|
V2_S2 p3;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef def_struct(Tile) {
|
typedef Struct_(Tile) {
|
||||||
U4 tag;
|
U4 tag;
|
||||||
RGB8 color;
|
RGB8 color;
|
||||||
B1 code;
|
B1 code;
|
||||||
@@ -169,7 +169,7 @@ M3_S2* m3s2_scale (M3_S2* mat, V3_S4* vec) __asm__("ScaleMatrix");
|
|||||||
// Rotation, Translation, Perspective
|
// Rotation, Translation, Perspective
|
||||||
|
|
||||||
S4 rtp_v3s2_raw(V3_S2* vec, S4* xy, S4* pp, S4* flag) __asm__("RotTransPers");
|
S4 rtp_v3s2_raw(V3_S2* vec, S4* xy, S4* pp, S4* flag) __asm__("RotTransPers");
|
||||||
FI_ S4 rtp_v3s2(V3_S2* vec, V2_S2* xy, A2_S2* pp, S4* flag) { return rtp_v3s2_raw(vec, cast(S4*R_, & xy->x), cast(S4*R_, pp), r_(flag)); }
|
FI_ S4 rtp_v3s2(V3_S2* vec, V2_S2* xy, A2_S2* pp, S4* flag) { return rtp_v3s2_raw(vec, C_(S4*R_, & xy->x), C_(S4*R_, pp), r_(flag)); }
|
||||||
|
|
||||||
S4 rtp_avg_nclip_a3_v3s2_raw(V3_S2* v0, V3_S2* v1, V3_S2* v2, S4* xy1, S4* xy2, S4* xy3, S4* pp, S4* otz, S4* flag) __asm__("RotAverageNclip3");
|
S4 rtp_avg_nclip_a3_v3s2_raw(V3_S2* v0, V3_S2* v1, V3_S2* v2, S4* xy1, S4* xy2, S4* xy3, S4* pp, S4* otz, S4* flag) __asm__("RotAverageNclip3");
|
||||||
FI_ S4 rtp_avg_nclip_a3_v3s2(
|
FI_ S4 rtp_avg_nclip_a3_v3s2(
|
||||||
@@ -179,8 +179,8 @@ FI_ S4 rtp_avg_nclip_a3_v3s2(
|
|||||||
){
|
){
|
||||||
return rtp_avg_nclip_a3_v3s2_raw(
|
return rtp_avg_nclip_a3_v3s2_raw(
|
||||||
v0, v1, v2,
|
v0, v1, v2,
|
||||||
cast(S4*R_, xy0), cast(S4*R_, xy1), cast(S4*R_, xy2),
|
C_(S4*R_, xy0), C_(S4*R_, xy1), C_(S4*R_, xy2),
|
||||||
cast(S4*R_, pp), cast(S4*R_, otz), cast(S4*R_, flag)
|
C_(S4*R_, pp), C_(S4*R_, otz), C_(S4*R_, flag)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -192,8 +192,8 @@ FI_ S4 rtp_avg_nclip_a4_v3s2(
|
|||||||
){
|
){
|
||||||
return rtp_avg_nclip_a4_v3s2_raw(
|
return rtp_avg_nclip_a4_v3s2_raw(
|
||||||
v0, v1, v2, v3,
|
v0, v1, v2, v3,
|
||||||
cast(S4*R_, xy0), cast(S4*R_, xy1), cast(S4*R_, xy2), cast(S4*R_, xy3),
|
C_(S4*R_, xy0), C_(S4*R_, xy1), C_(S4*R_, xy2), C_(S4*R_, xy3),
|
||||||
cast(S4*R_, pp), cast(S4*R_, otz), cast(S4*R_, flag)
|
C_(S4*R_, pp), C_(S4*R_, otz), C_(S4*R_, flag)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ $f_define = "-D"
|
|||||||
$f_include = "-I"
|
$f_include = "-I"
|
||||||
$f_output = "-o"
|
$f_output = "-o"
|
||||||
$f_std_c11 = "-std=c11"
|
$f_std_c11 = "-std=c11"
|
||||||
|
$f_std_c23 = "-std=c23"
|
||||||
|
|
||||||
# Warning Flags
|
# Warning Flags
|
||||||
$f_wall = "-Wall"
|
$f_wall = "-Wall"
|
||||||
@@ -139,6 +140,7 @@ function compile-unit { param(
|
|||||||
$f_arch_no_shared,
|
$f_arch_no_shared,
|
||||||
$f_arch_no_stack_prot
|
$f_arch_no_stack_prot
|
||||||
)
|
)
|
||||||
|
# $compile_args += $f_std_c23
|
||||||
$compile_args += ($f_include + $path_psyq_imyu_inc)
|
$compile_args += ($f_include + $path_psyq_imyu_inc)
|
||||||
$compile_args += ($f_include + $path_nugget)
|
$compile_args += ($f_include + $path_nugget)
|
||||||
|
|
||||||
@@ -350,3 +352,48 @@ function build-gte_hello {
|
|||||||
make-binary $elf $exe
|
make-binary $elf $exe
|
||||||
}
|
}
|
||||||
build-gte_hello
|
build-gte_hello
|
||||||
|
|
||||||
|
function Send-ToEmulator { param(
|
||||||
|
[string]$exePath
|
||||||
|
)
|
||||||
|
$uri = "http://localhost:8080/api/v1/load-exec"
|
||||||
|
|
||||||
|
# Absolute path is safest for the emulator web server
|
||||||
|
$absolutePath = [System.IO.Path]::GetFullPath($exePath)
|
||||||
|
|
||||||
|
# Create JSON payload pointing to your compiled .ps-exe
|
||||||
|
$body = @{
|
||||||
|
filename = $absolutePath
|
||||||
|
} | ConvertTo-Json
|
||||||
|
|
||||||
|
Write-Host "Pushing hot-reload to PCSX-Redux..." -ForegroundColor Magenta
|
||||||
|
try {
|
||||||
|
$response = Invoke-RestMethod -Uri $uri -Method Post -Body $body -ContentType "application/json"
|
||||||
|
Write-Host "Hot-reload successful!" -ForegroundColor Green
|
||||||
|
} catch {
|
||||||
|
Write-Warning "Could not connect to PCSX-Redux web server. Ensure the emulator is running and Web Server is enabled."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# # Automatically hot-reloads it into the running emulator
|
||||||
|
# Send-ToEmulator (join-path $path_build 'hello_gte.ps-exe')
|
||||||
|
|
||||||
|
# --- Hot Reload via PCSX-Redux Web Server ---
|
||||||
|
$exe_path = join-path $path_build 'hello_gte.ps-exe'
|
||||||
|
$absolute_path = [System.IO.Path]::GetFullPath($exe_path)
|
||||||
|
|
||||||
|
# PCSX-Redux expects the file location in the URL query string!
|
||||||
|
# We URL-encode the path to ensure backslashes and spaces don't break the HTTP request.
|
||||||
|
$encoded_path = [uri]::EscapeDataString($absolute_path)
|
||||||
|
$uri = "http://localhost:8080/api/v1/load-exec?path=$encoded_path"
|
||||||
|
|
||||||
|
# Write-Host "Pushing hot-reload to PCSX-Redux..." -ForegroundColor Magenta
|
||||||
|
# try {
|
||||||
|
# # Send the request with the query string included
|
||||||
|
# Invoke-RestMethod -Uri $uri -Method Post
|
||||||
|
# Write-Host "Hot-reload successful!" -ForegroundColor Green
|
||||||
|
# } catch {
|
||||||
|
# Write-Host "Failed to hot-reload." -ForegroundColor Red
|
||||||
|
# # This will print the *actual* HTTP error instead of our generic warning
|
||||||
|
# Write-Host $_.Exception.Message -ForegroundColor Yellow
|
||||||
|
# }
|
||||||
|
|||||||
+1
-1
@@ -2,6 +2,6 @@
|
|||||||
"configureme": true,
|
"configureme": true,
|
||||||
"grey": false,
|
"grey": false,
|
||||||
"mask": 0.5,
|
"mask": 0.5,
|
||||||
"masktype": 2,
|
"masktype": 1,
|
||||||
"warp": 0
|
"warp": 0
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user