jabyengine/include/PSX/GTE/gte.hpp

27 lines
890 B
C++

#pragma once
#include "gte_instruction.hpp"
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));
}
}
}