Add some GTE code

This commit is contained in:
2024-01-24 12:04:03 -05:00
parent 6f3b67fab8
commit 1922515228
5 changed files with 107 additions and 2 deletions

View File

@@ -1,3 +1,27 @@
#pragma once
#include "gte_instruction.hpp"
namespace JabyEngine {}
namespace JabyEngine {
namespace GTE {
/*
gte_SetGeomOffset(ofx,ofy)
Load GTE-offset.
*/
static void set_geom_offset(int32_t off_x, int32_t off_y) {
__asm__ volatile("sll $12, %0, 16" :: "r"(off_x), "r"(off_y) : "$12", "$13");
__asm__ volatile("sll $13, %1, 16" :: "r"(off_x), "r"(off_y) : "$12", "$13");
__asm__ volatile("ctc2 $12, $24" :: "r"(off_x), "r"(off_y) : "$12", "$13");
__asm__ volatile("ctc2 $13, $25" :: "r"(off_x), "r"(off_y) : "$12", "$13");
}
/*
gte_SetGeomScreen(h)
Load distance from viewpoint to screen.
*/
static void set_geom_screen(int32_t h) {
__asm__ volatile("ctc2 %0, $26" :: "r"(h));
}
}
}