diff --git a/src/Core.h b/src/Core.h index de2b3f433..259d556c8 100644 --- a/src/Core.h +++ b/src/Core.h @@ -274,6 +274,7 @@ typedef cc_uint8 cc_bool; #undef CC_BUILD_FREETYPE #define CC_BUILD_ATARIOS #define CC_BUILD_COOPTHREADED + #define CC_BUILD_TINYMEM #define CC_BUILD_LOWMEM #define CC_BUILD_NOMUSIC #define CC_BUILD_NOSOUNDS diff --git a/src/Server.c b/src/Server.c index f6fea3c60..c554b5a41 100644 --- a/src/Server.c +++ b/src/Server.c @@ -132,7 +132,7 @@ static void SPConnection_BeginConnect(void) { Random_SeedFromCurrentTime(&rnd); 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; verSize = 16; #elif defined CC_BUILD_LOWMEM @@ -144,7 +144,7 @@ static void SPConnection_BeginConnect(void) { #endif 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; #else Gen_Active = &NotchyGen; diff --git a/src/atari_st/Platform_Atari.c b/src/atari_st/Platform_Atari.c index 26871a2af..2a09beb03 100644 --- a/src/atari_st/Platform_Atari.c +++ b/src/atari_st/Platform_Atari.c @@ -41,8 +41,8 @@ cc_uint8 Platform_Flags = PLAT_FLAG_SINGLE_PROCESS | PLAT_FLAG_APP_EXIT; int main(int argc, char** argv) { SetupProgram(argc, argv); while (Window_Main.Exists) { - //RunGame(); - RunProgram(argc, argv); + RunGame(); + //RunProgram(argc, argv); } Window_Free(); @@ -84,15 +84,21 @@ void Mem_Free(void* mem) { /*########################################################################################################################* *------------------------------------------------------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) { if (end < beg) return 0; - cc_uint64 delta = end - beg; - return 1; // TODO implement + // 200 ticks a second + // 1,000,000 microseconds a second + // > one tick = 10^6/200 = 5000 microseconds + return (end - beg) * 5000; } cc_uint64 Stopwatch_Measure(void) { - return 1; // TODO implement + return Supexec(Read_200HZ); } void Platform_Log(const char* msg, int len) { @@ -270,7 +276,6 @@ cc_result Socket_CheckWritable(cc_socket s, cc_bool* writable) { /*########################################################################################################################* *--------------------------------------------------------Platform---------------------------------------------------------* *#########################################################################################################################*/ - void Platform_Init(void) { LONG size = (LONG)Malloc(-1); char* ptr = Malloc(size); @@ -280,7 +285,6 @@ void Platform_Init(void) { ta_init(heap_beg, heap_end, 256, 16, 4); int size_ = (int)(heap_end - heap_beg); - Platform_Log3("HEAP: %i bytes (%x -> %x)", &size_, &heap_beg, &heap_end); } void Platform_Free(void) { } diff --git a/src/atari_st/Window_Atari.c b/src/atari_st/Window_Atari.c index 70f10c919..1314f558e 100644 --- a/src/atari_st/Window_Atari.c +++ b/src/atari_st/Window_Atari.c @@ -25,12 +25,12 @@ void Window_PreInit(void) { for (int i = 0; i < 16; i++) { int R = (i & 0x1) >> 0; - int G = (i & 0x2) >> 1; - int B = (i & 0xC) >> 2; + int B = (i & 0x2) >> 1; + int G = (i & 0xC) >> 2; R = R ? ((R << 3) | 0x07) : 0; - G = G ? ((G << 3) | 0x07) : 0; - B = B ? ((B << 2) | 0x03) : 0; + B = B ? ((B << 3) | 0x07) : 0; + G = G ? ((G << 2) | 0x03) : 0; Setcolor(i, (R << 8) | (G << 4) | B); } @@ -129,18 +129,18 @@ void Window_DrawFramebuffer(Rect2D r, struct Bitmap* bmp) { // TODO optimise BitmapCol col = row[x]; cc_uint8 R = BitmapCol_R(col) >> 7; - cc_uint8 G = BitmapCol_G(col) >> 7; - cc_uint8 B = BitmapCol_B(col) >> 6; + cc_uint8 G = BitmapCol_G(col) >> 6; + cc_uint8 B = BitmapCol_B(col) >> 7; //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); planes[word].plane1 |= R << bit; - planes[word].plane2 |= G << bit; - planes[word].plane3 |= b1<< bit; - planes[word].plane4 |= b2<< bit; + planes[word].plane2 |= B << bit; + planes[word].plane3 |= g1<< bit; + planes[word].plane4 |= g2<< bit; } } } @@ -192,8 +192,8 @@ void OnscreenKeyboard_Close(void) { *#########################################################################################################################*/ void Window_ShowDialog(const char* title, const char* msg) { /* TODO implement */ - //Platform_LogConst(title); - //Platform_LogConst(msg); + Platform_LogConst(title); + Platform_LogConst(msg); } cc_result Window_OpenFileDialog(const struct OpenFileDialogArgs* args) {