Compare commits
1 Commits
topic/jb/g
...
topic/bg/f
| Author | SHA1 | Date | |
|---|---|---|---|
| 157e4d5937 |
@@ -109,20 +109,6 @@ namespace GTETest {
|
||||
GTE::set_geom_screen(256);
|
||||
}
|
||||
|
||||
static void check_values() {
|
||||
static constexpr int32_t Value = 256;
|
||||
|
||||
GTE::set_geom_screen(Value);
|
||||
printf("set_geom_screen: %i == %i\n", GTE::get_geom_screen(), Value);
|
||||
|
||||
int32_t x = 256;
|
||||
int32_t y = 512;
|
||||
|
||||
GTE::set_geom_offset(x, y);
|
||||
GTE::get_geom_offset(x, y);
|
||||
printf("%i == 256 && %i == 512\n", x, y);
|
||||
}
|
||||
|
||||
static bool update_or_exit() {
|
||||
Periphery::query_controller();
|
||||
if(Shared::back_menu.update(Make::PositionI16(0, GPU::Display::Height - 32))) {
|
||||
@@ -168,7 +154,6 @@ namespace GTETest {
|
||||
|
||||
void main() {
|
||||
setup();
|
||||
check_values();
|
||||
|
||||
while(true) {
|
||||
if(update_or_exit()) {
|
||||
|
||||
@@ -30,10 +30,10 @@ INPUT += $(OUTPUT_DIR)/JabyTails.img
|
||||
JabyTails_FLAGS = $(CLUT_4_COLOR_TRANS_FLAGS)
|
||||
|
||||
INPUT += $(OUTPUT_DIR)/IMG_6921.tim
|
||||
IMG_6921_TIM_FLAGS = tim full16 --clut-pos {384,255} --tex-pos {384,256}
|
||||
IMG_6921_TIM_FLAGS = tim full16 --clut-pos [384,255] --tex-pos [384,256]
|
||||
|
||||
INPUT += $(OUTPUT_DIR)/AllTheJaby.tim
|
||||
AllTheJaby_TIM_FLAGS = tim full16 --tex-pos {0,0}
|
||||
AllTheJaby_TIM_FLAGS = tim full16 --tex-pos [0,0]
|
||||
|
||||
$(OUTPUT_DIR)/%.vag: audio/%.wav
|
||||
@mkdir -p $(OUTPUT_DIR)
|
||||
|
||||
@@ -1,47 +1,6 @@
|
||||
#pragma once
|
||||
#include "gte_instruction.hpp"
|
||||
|
||||
// GTE Overview
|
||||
// GTE Data Register Summary (cop2r0-31)
|
||||
//
|
||||
// `mtc2` (Move To Coprocessor 2): Sets a Data Register (0–31).
|
||||
// `mfc2` (Move From Coprocessor 2): Gets a Data Register (0–31).
|
||||
//
|
||||
// | cop2r0-1 | 3xS16 | VXY0,VZ0 | Vector 0 (X,Y,Z) |
|
||||
// | cop2r2-3 | 3xS16 | VXY1,VZ1 | Vector 1 (X,Y,Z) |
|
||||
// | cop2r4-5 | 3xS16 | VXY2,VZ2 | Vector 2 (X,Y,Z) |
|
||||
// | cop2r6 | 4xU8 | RGBC | Color/code value |
|
||||
// | cop2r7 | 1xU16 | OTZ | Average Z value (for Ordering Table) |
|
||||
// | cop2r8 | 1xS16 | IR0 | 16bit Accumulator (Interpolate) |
|
||||
// | cop2r9-11 | 3xS16 | IR1,IR2,IR3 | 16bit Accumulator (Vector) |
|
||||
// | cop2r12-15 | 6xS16 | SXY0,SXY1,SXY2,SXYP | Screen XY-coordinate FIFO (3 stages) |
|
||||
// | cop2r16-19 | 4xU16 | SZ0,SZ1,SZ2,SZ3 | Screen Z-coordinate FIFO (4 stages) |
|
||||
// | cop2r20-22 | 12xU8 | RGB0,RGB1,RGB2 | Color CRGB-code/color FIFO (3 stages) |
|
||||
// | cop2r23 | 4xU8 | (RES1) | Prohibited |
|
||||
// | cop2r24 | 1xS32 | MAC0 | 32bit Maths Accumulators (Value) |
|
||||
// | cop2r25-27 | 3xS32 | MAC1,MAC2,MAC3 | 32bit Maths Accumulators (Vector) |
|
||||
// | cop2r28-29 | 1xU15 | IRGB,ORGB | Convert RGB Color (48bit vs 15bit) |
|
||||
// | cop2r30-31 | 2xS32 | LZCS,LZCR | Count Leading-Zeroes/Ones (sign bits) |
|
||||
//
|
||||
// GTE Control Register Summary (cop2r32-63)
|
||||
// ctc2 (Copy To Control Coprocessor 2): Sets a Control Register (cnt0–31).
|
||||
// cfc2 (Copy From Control Coprocessor 2): Gets a Control Register (cnt0–31).
|
||||
//
|
||||
// | cop2r32-36 9xS16 RT11RT12,..,RT33 | Rotation matrix (3x3) | cnt0-4 |
|
||||
// | cop2r37-39 3x 32 TRX,TRY,TRZ | Translation vector (X,Y,Z) | cnt5-7 |
|
||||
// | cop2r40-44 9xS16 L11L12,..,L33 | Light source matrix (3x3) | cnt8-12 |
|
||||
// | cop2r45-47 3x 32 RBK,GBK,BBK | Background color (R,G,B) | cnt13-15 |
|
||||
// | cop2r48-52 9xS16 LR1LR2,..,LB3 | Light color matrix source (3x3) | cnt16-20 |
|
||||
// | cop2r53-55 3x 32 RFC,GFC,BFC | Far color (R,G,B) | cnt21-23 |
|
||||
// | cop2r56-57 2x 32 OFX,OFY | Screen offset (X,Y) | cnt24-25 | (1bit sign, 15bit integer, 16bit fraction)
|
||||
// | cop2r58 BuggyU16 H | Projection plane distance. | cnt26 | (0bit sign, 16bit integer, 0bit fraction)
|
||||
// | cop2r59 S16 DQA | Depth queing parameter A (coeff) | cnt27 |
|
||||
// | cop2r60 32 DQB | Depth queing parameter B (offset) | cnt28 |
|
||||
// | cop2r61-62 2xS16 ZSF3,ZSF4 | Average Z scale factors | cnt29-30 |
|
||||
// | cop2r63 U20 FLAG | Returns any calculation errors | cnt31 |
|
||||
|
||||
|
||||
|
||||
namespace JabyEngine {
|
||||
namespace GTE {
|
||||
static constexpr auto StackSize = 16;
|
||||
@@ -254,19 +213,6 @@ namespace JabyEngine {
|
||||
__asm__ volatile("ctc2 $13, $25" :: "r"(off_x), "r"(off_y) : "$12", "$13");
|
||||
}
|
||||
|
||||
static void get_geom_offset(int32_t &off_x, int32_t &off_y) {
|
||||
int32_t raw_x, raw_y;
|
||||
|
||||
__asm__ volatile (
|
||||
"cfc2 %0, $24\n"
|
||||
"cfc2 %1, $25"
|
||||
: "=r" (raw_x), "=r" (raw_y)
|
||||
);
|
||||
|
||||
off_x = raw_x >> 16;
|
||||
off_y = raw_y >> 16;
|
||||
}
|
||||
|
||||
/*
|
||||
SetGeomScreen(h)
|
||||
|
||||
@@ -276,18 +222,6 @@ namespace JabyEngine {
|
||||
__asm__ volatile("ctc2 %0, $26" :: "r"(h));
|
||||
}
|
||||
|
||||
/*
|
||||
GetGeomScreen() (???)
|
||||
|
||||
Get distance from viewpoint to screen.
|
||||
*/
|
||||
static int32_t get_geom_screen() {
|
||||
int32_t h;
|
||||
|
||||
__asm__ volatile("cfc2 %0, $26" : "=r"(h));
|
||||
return h;
|
||||
}
|
||||
|
||||
// Implementations for the MATRIX struct
|
||||
inline MATRIX& MATRIX :: comp(const MATRIX& matrix) {
|
||||
return comp_matrix(matrix, *this, *this);
|
||||
|
||||
@@ -23,7 +23,7 @@ pub struct Point {
|
||||
}
|
||||
|
||||
impl Point {
|
||||
pub const POINT_VALUE_NAME:&'static str = "{x,y}";
|
||||
pub const POINT_VALUE_NAME:&'static str = "[x,y]";
|
||||
}
|
||||
|
||||
impl std::default::Default for Point {
|
||||
@@ -34,7 +34,7 @@ impl std::default::Default for Point {
|
||||
|
||||
impl ToString for Point {
|
||||
fn to_string(&self) -> std::string::String {
|
||||
"{0,0}".to_owned()
|
||||
"[0,0]".to_owned()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ impl FromStr for Point {
|
||||
type Err = String;
|
||||
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
let values:Vec<&str> = s.split(&['{', ',', '}']).filter_map(|value| if value.is_empty() {None} else {Some(value)}).collect();
|
||||
let values:Vec<&str> = s.split(&['[', ',', ']']).filter_map(|value| if value.is_empty() {None} else {Some(value)}).collect();
|
||||
|
||||
if values.len() != 2 {
|
||||
return Err(format!("Two values expected for Point but found {}", values.len()));
|
||||
|
||||
Reference in New Issue
Block a user