Atari ST: In-game technically renders

This commit is contained in:
UnknownShadow200 2025-08-24 15:50:08 +10:00
parent 28ef8faaa1
commit afdfa29547
4 changed files with 26 additions and 21 deletions

View File

@ -274,6 +274,7 @@ typedef cc_uint8 cc_bool;
#undef CC_BUILD_FREETYPE #undef CC_BUILD_FREETYPE
#define CC_BUILD_ATARIOS #define CC_BUILD_ATARIOS
#define CC_BUILD_COOPTHREADED #define CC_BUILD_COOPTHREADED
#define CC_BUILD_TINYMEM
#define CC_BUILD_LOWMEM #define CC_BUILD_LOWMEM
#define CC_BUILD_NOMUSIC #define CC_BUILD_NOMUSIC
#define CC_BUILD_NOSOUNDS #define CC_BUILD_NOSOUNDS

View File

@ -132,7 +132,7 @@ static void SPConnection_BeginConnect(void) {
Random_SeedFromCurrentTime(&rnd); Random_SeedFromCurrentTime(&rnd);
World_NewMap(); World_NewMap();
#if defined CC_BUILD_NDS || defined CC_BUILD_PS1 || defined CC_BUILD_SATURN || defined CC_BUILD_MACCLASSIC || defined CC_BUILD_32X || defined CC_BUILD_GBA #if defined CC_BUILD_NDS || defined CC_BUILD_PS1 || defined CC_BUILD_SATURN || defined CC_BUILD_MACCLASSIC || defined CC_BUILD_TINYMEM
horSize = 16; horSize = 16;
verSize = 16; verSize = 16;
#elif defined CC_BUILD_LOWMEM #elif defined CC_BUILD_LOWMEM
@ -144,7 +144,7 @@ static void SPConnection_BeginConnect(void) {
#endif #endif
World_SetDimensions(horSize, verSize, horSize); World_SetDimensions(horSize, verSize, horSize);
#if defined CC_BUILD_N64 || defined CC_BUILD_NDS || defined CC_BUILD_PS1 || defined CC_BUILD_SATURN || defined CC_BUILD_32X || defined CC_BUILD_GBA #if defined CC_BUILD_N64 || defined CC_BUILD_NDS || defined CC_BUILD_PS1 || defined CC_BUILD_SATURN || defined CC_BUILD_TINYMEM
Gen_Active = &FlatgrassGen; Gen_Active = &FlatgrassGen;
#else #else
Gen_Active = &NotchyGen; Gen_Active = &NotchyGen;

View File

@ -41,8 +41,8 @@ cc_uint8 Platform_Flags = PLAT_FLAG_SINGLE_PROCESS | PLAT_FLAG_APP_EXIT;
int main(int argc, char** argv) { int main(int argc, char** argv) {
SetupProgram(argc, argv); SetupProgram(argc, argv);
while (Window_Main.Exists) { while (Window_Main.Exists) {
//RunGame(); RunGame();
RunProgram(argc, argv); //RunProgram(argc, argv);
} }
Window_Free(); Window_Free();
@ -84,15 +84,21 @@ void Mem_Free(void* mem) {
/*########################################################################################################################* /*########################################################################################################################*
*------------------------------------------------------Logging/Time-------------------------------------------------------* *------------------------------------------------------Logging/Time-------------------------------------------------------*
*#########################################################################################################################*/ *#########################################################################################################################*/
// Number of ticks 200 HZ system timer
// Must be called when in supervisor mode
static LONG Read_200HZ(void) { return *((LONG*)0x04BA); }
cc_uint64 Stopwatch_ElapsedMicroseconds(cc_uint64 beg, cc_uint64 end) { cc_uint64 Stopwatch_ElapsedMicroseconds(cc_uint64 beg, cc_uint64 end) {
if (end < beg) return 0; if (end < beg) return 0;
cc_uint64 delta = end - beg; // 200 ticks a second
return 1; // TODO implement // 1,000,000 microseconds a second
// > one tick = 10^6/200 = 5000 microseconds
return (end - beg) * 5000;
} }
cc_uint64 Stopwatch_Measure(void) { cc_uint64 Stopwatch_Measure(void) {
return 1; // TODO implement return Supexec(Read_200HZ);
} }
void Platform_Log(const char* msg, int len) { void Platform_Log(const char* msg, int len) {
@ -270,7 +276,6 @@ cc_result Socket_CheckWritable(cc_socket s, cc_bool* writable) {
/*########################################################################################################################* /*########################################################################################################################*
*--------------------------------------------------------Platform---------------------------------------------------------* *--------------------------------------------------------Platform---------------------------------------------------------*
*#########################################################################################################################*/ *#########################################################################################################################*/
void Platform_Init(void) { void Platform_Init(void) {
LONG size = (LONG)Malloc(-1); LONG size = (LONG)Malloc(-1);
char* ptr = Malloc(size); char* ptr = Malloc(size);
@ -280,7 +285,6 @@ void Platform_Init(void) {
ta_init(heap_beg, heap_end, 256, 16, 4); ta_init(heap_beg, heap_end, 256, 16, 4);
int size_ = (int)(heap_end - heap_beg); int size_ = (int)(heap_end - heap_beg);
Platform_Log3("HEAP: %i bytes (%x -> %x)", &size_, &heap_beg, &heap_end);
} }
void Platform_Free(void) { } void Platform_Free(void) { }

View File

@ -25,12 +25,12 @@ void Window_PreInit(void) {
for (int i = 0; i < 16; i++) for (int i = 0; i < 16; i++)
{ {
int R = (i & 0x1) >> 0; int R = (i & 0x1) >> 0;
int G = (i & 0x2) >> 1; int B = (i & 0x2) >> 1;
int B = (i & 0xC) >> 2; int G = (i & 0xC) >> 2;
R = R ? ((R << 3) | 0x07) : 0; R = R ? ((R << 3) | 0x07) : 0;
G = G ? ((G << 3) | 0x07) : 0; B = B ? ((B << 3) | 0x07) : 0;
B = B ? ((B << 2) | 0x03) : 0; G = G ? ((G << 2) | 0x03) : 0;
Setcolor(i, (R << 8) | (G << 4) | B); Setcolor(i, (R << 8) | (G << 4) | B);
} }
@ -129,18 +129,18 @@ void Window_DrawFramebuffer(Rect2D r, struct Bitmap* bmp) {
// TODO optimise // TODO optimise
BitmapCol col = row[x]; BitmapCol col = row[x];
cc_uint8 R = BitmapCol_R(col) >> 7; cc_uint8 R = BitmapCol_R(col) >> 7;
cc_uint8 G = BitmapCol_G(col) >> 7; cc_uint8 G = BitmapCol_G(col) >> 6;
cc_uint8 B = BitmapCol_B(col) >> 6; cc_uint8 B = BitmapCol_B(col) >> 7;
//int pal = R | (G << 1) | (B << 2); //int pal = R | (G << 1) | (B << 2);
int b1 = B & 0x01, b2 = (B >> 1); int g1 = G & 0x01, g2 = (G >> 1);
int word = idx >> 4, bit = 15 - (idx & 0x0F); int word = idx >> 4, bit = 15 - (idx & 0x0F);
planes[word].plane1 |= R << bit; planes[word].plane1 |= R << bit;
planes[word].plane2 |= G << bit; planes[word].plane2 |= B << bit;
planes[word].plane3 |= b1<< bit; planes[word].plane3 |= g1<< bit;
planes[word].plane4 |= b2<< bit; planes[word].plane4 |= g2<< bit;
} }
} }
} }
@ -192,8 +192,8 @@ void OnscreenKeyboard_Close(void) {
*#########################################################################################################################*/ *#########################################################################################################################*/
void Window_ShowDialog(const char* title, const char* msg) { void Window_ShowDialog(const char* title, const char* msg) {
/* TODO implement */ /* TODO implement */
//Platform_LogConst(title); Platform_LogConst(title);
//Platform_LogConst(msg); Platform_LogConst(msg);
} }
cc_result Window_OpenFileDialog(const struct OpenFileDialogArgs* args) { cc_result Window_OpenFileDialog(const struct OpenFileDialogArgs* args) {