* WalrusIRC

You need to have 5 posts and not be part of restricted usergroups in order to use the WalrusIRC embedded shoutbox. However, you can also access our IRC channel called #CodeWalrus via EFnet.

Author Topic: Jumpman Resurrected  (Read 4305 times)

0 Members and 1 Guest are viewing this topic.

Offline Lionel Debroux

  • Full User
  • Join Date: Jan 2015
  • Location:
  • Posts: 230
  • Post Rating Ratio: +11/-0
    • debrouxl
    • 58/5891
Re: Jumpman Resurrected
« Reply #45 on: November 01, 2017, 08:59:42 am »
I proceeded with manual allocation of the 5 aforementioned large buffers, changing the declaration to pointers instead of arrays, adding the EXTERNAL_LEVEL_BUFFER_SIZE define, and adding -mno-bss to the compiler flags.

The current diff is as follows:
Code: [Select]
diff -Naurp '--exclude=*.89z' '--exclude=*.9xz' '--exclude=*.v2z' '--exclude=*.89y' '--exclude=*.a' '--exclude=extgraph.h' Jumpman_89_v1.0_orig/jm_bullets.c Jumpman_89_v1.0/jm_bullets.c
--- Jumpman_89_v1.0_orig/jm_bullets.c 2017-10-30 19:58:34.000000000 +0100
+++ Jumpman_89_v1.0/jm_bullets.c 2017-11-01 08:58:48.421104022 +0100
@@ -110,10 +110,10 @@ void DrawBullets(void)
 
 void UpdateBullets(void)
 {
- static int1 spear_y_offset[18]      =  {-2,-2,-1,-1, 0,-1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 2, 2, 3}; //der may need to update this
- static int1 hailstone_x_offset[10]  =  { 0, 1, 1, 2, 2, 1, 1, 0, 0, 0};
- static int1 hailstone_y_offset[10]  =  {-2,-1,-1, 0, 0, 1, 1, 2, 1, 1};
- static int1 zig_zag_xy_offset[32]   =  { 1, 1,-1,-1,-1,-1, 1, 1};
+ static const int1 spear_y_offset[18]      =  {-2,-2,-1,-1, 0,-1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 2, 2, 3}; //der may need to update this
+ static const int1 hailstone_x_offset[10]  =  { 0, 1, 1, 2, 2, 1, 1, 0, 0, 0};
+ static const int1 hailstone_y_offset[10]  =  {-2,-1,-1, 0, 0, 1, 1, 2, 1, 1};
+ static const int1 zig_zag_xy_offset[32]   =  { 1, 1,-1,-1,-1,-1, 1, 1};
  BULLET_OBJECT_Type* bullet = &bullet_list[0];
  uint1 speed;
  uint1 direction;
diff -Naurp '--exclude=*.89z' '--exclude=*.9xz' '--exclude=*.v2z' '--exclude=*.89y' '--exclude=*.a' '--exclude=extgraph.h' Jumpman_89_v1.0_orig/jm_collectables.c Jumpman_89_v1.0/jm_collectables.c
--- Jumpman_89_v1.0_orig/jm_collectables.c 2017-10-30 19:58:34.000000000 +0100
+++ Jumpman_89_v1.0/jm_collectables.c 2017-11-01 08:59:06.213472323 +0100
@@ -734,4 +734,4 @@ void ModifyPlatformObject(OBJECT_Type* o
  y += 4;
  }
  }
-}
\ Pas de fin de ligne à la fin du fichier
+}
diff -Naurp '--exclude=*.89z' '--exclude=*.9xz' '--exclude=*.v2z' '--exclude=*.89y' '--exclude=*.a' '--exclude=extgraph.h' Jumpman_89_v1.0_orig/jm_enemies.c Jumpman_89_v1.0/jm_enemies.c
--- Jumpman_89_v1.0_orig/jm_enemies.c 2017-10-30 19:58:34.000000000 +0100
+++ Jumpman_89_v1.0/jm_enemies.c 2017-11-01 09:28:00.657375227 +0100
@@ -39,7 +39,7 @@ uint1 GetAIType3Move(ENEMY_OBJECT_Type*
 
 ENEMY_OBJECT_Type enemy_list[ENEMY_COUNT_MAX];
 
-ENEMY_OBJECT_Type enemy_definition_list[] =
+const ENEMY_OBJECT_Type enemy_definition_list[] =
 {
  {
  GAME_PIECE_Falling_Bomb,
@@ -2337,4 +2337,4 @@ uint1 GetAIType3Move(ENEMY_OBJECT_Type*
 
 
  return temp_direction;
-}
\ Pas de fin de ligne à la fin du fichier
+}
diff -Naurp '--exclude=*.89z' '--exclude=*.9xz' '--exclude=*.v2z' '--exclude=*.89y' '--exclude=*.a' '--exclude=extgraph.h' Jumpman_89_v1.0_orig/jm_enemies.h Jumpman_89_v1.0/jm_enemies.h
--- Jumpman_89_v1.0_orig/jm_enemies.h 2017-10-30 19:58:34.000000000 +0100
+++ Jumpman_89_v1.0/jm_enemies.h 2017-10-31 21:29:43.997428638 +0100
@@ -134,7 +134,7 @@ extern ENEMY_OBJECT_Type enemy_list[ENEM
 extern int2 enemy_count;
 
 
-extern ENEMY_OBJECT_Type enemy_definition_list[];
+extern const ENEMY_OBJECT_Type enemy_definition_list[];
 
 
 void DrawEnemies(void);
diff -Naurp '--exclude=*.89z' '--exclude=*.9xz' '--exclude=*.v2z' '--exclude=*.89y' '--exclude=*.a' '--exclude=extgraph.h' Jumpman_89_v1.0_orig/jm_graphics.c Jumpman_89_v1.0/jm_graphics.c
--- Jumpman_89_v1.0_orig/jm_graphics.c 2017-10-30 19:58:34.000000000 +0100
+++ Jumpman_89_v1.0/jm_graphics.c 2017-11-01 08:48:41.604542948 +0100
@@ -25,19 +25,19 @@
 
 #include "jm_graphics.h"
 
-#include "j3.h"
+#include "J3.H"
 #include "j7.h"
-#include "j8.h"
+#include "J8.H"
 
 uint1* plane_visible_0;
 uint1* plane_visible_1;
 uint1* plane_active_0;
 uint1* plane_active_1;
 
-uint1 visible_plane_0[LCD_SIZE];
-uint1 visible_plane_1[LCD_SIZE];
-uint1 active_plane_0[LCD_SIZE];
-uint1 active_plane_1[LCD_SIZE];
+uint1 * visible_plane_0;
+uint1 * visible_plane_1;
+uint1 * active_plane_0;
+uint1 * active_plane_1;
 
 uint1 jumpman_bkgd_0[12];
 uint1 jumpman_bkgd_1[12];
diff -Naurp '--exclude=*.89z' '--exclude=*.9xz' '--exclude=*.v2z' '--exclude=*.89y' '--exclude=*.a' '--exclude=extgraph.h' Jumpman_89_v1.0_orig/jm_graphics.h Jumpman_89_v1.0/jm_graphics.h
--- Jumpman_89_v1.0_orig/jm_graphics.h 2017-10-30 19:58:34.000000000 +0100
+++ Jumpman_89_v1.0/jm_graphics.h 2017-11-01 08:48:33.304371135 +0100
@@ -27,10 +27,10 @@ extern uint1* plane_visible_1;
 extern uint1* plane_active_0;
 extern uint1* plane_active_1;
 
-extern uint1 visible_plane_0[LCD_SIZE];  // *30+8
-extern uint1 visible_plane_1[LCD_SIZE];
-extern uint1 active_plane_0[LCD_SIZE];
-extern uint1 active_plane_1[LCD_SIZE];
+extern uint1 * visible_plane_0;  // *30+8
+extern uint1 * visible_plane_1;
+extern uint1 * active_plane_0;
+extern uint1 * active_plane_1;
 
 extern uint1 jumpman_bkgd_0[12];
 extern uint1 jumpman_bkgd_1[12];
diff -Naurp '--exclude=*.89z' '--exclude=*.9xz' '--exclude=*.v2z' '--exclude=*.89y' '--exclude=*.a' '--exclude=extgraph.h' Jumpman_89_v1.0_orig/jm_jumpman.c Jumpman_89_v1.0/jm_jumpman.c
--- Jumpman_89_v1.0_orig/jm_jumpman.c 2017-10-30 20:03:20.000000000 +0100
+++ Jumpman_89_v1.0/jm_jumpman.c 2017-11-01 09:42:20.247168695 +0100
@@ -111,6 +111,16 @@ void _main(void)
  pSprites1 = j3;
  pSprites2 = j7;
 
+ external_level_buffer = malloc(EXTERNAL_LEVEL_BUFFER_SIZE + 4 * LCD_SIZE);
+ if (!external_level_buffer)
+ {
+ return;
+ }
+ visible_plane_0 = external_level_buffer + EXTERNAL_LEVEL_BUFFER_SIZE;
+ visible_plane_1 = visible_plane_0 + LCD_SIZE;
+ active_plane_0 = visible_plane_1 + LCD_SIZE;
+ active_plane_1 = active_plane_0 + LCD_SIZE;
+
  plane_visible_0 = &visible_plane_0[0]; // 8*30
  plane_visible_1 = &visible_plane_1[0]; // 8*30
  plane_active_0  = &active_plane_0[0]; // 8*30
diff -Naurp '--exclude=*.89z' '--exclude=*.9xz' '--exclude=*.v2z' '--exclude=*.89y' '--exclude=*.a' '--exclude=extgraph.h' Jumpman_89_v1.0_orig/jm_levels.c Jumpman_89_v1.0/jm_levels.c
--- Jumpman_89_v1.0_orig/jm_levels.c 2017-10-30 20:03:20.000000000 +0100
+++ Jumpman_89_v1.0/jm_levels.c 2017-11-01 09:16:06.862599710 +0100
@@ -167,7 +167,7 @@ LEVEL_Type current_level;
 int2 level_number;
 bool level_complete;
 uint1 level_toggle_bits;
-uint1 external_level_buffer[30*1024 + 256];
+uint1 * external_level_buffer;
 
 
 
@@ -248,7 +248,7 @@ void DrawSelectScreen(void)
  char* file_name;
  char* name;
  register uint4 file_address;
- char file_type[] = "jml";
+ static const char file_type[] = "jml";
 
  GrayFillScreen(COLOR_Black);
  SwapPlaneBuffers();
diff -Naurp '--exclude=*.89z' '--exclude=*.9xz' '--exclude=*.v2z' '--exclude=*.89y' '--exclude=*.a' '--exclude=extgraph.h' Jumpman_89_v1.0_orig/jm_levels.h Jumpman_89_v1.0/jm_levels.h
--- Jumpman_89_v1.0_orig/jm_levels.h 2017-10-30 21:22:42.000000000 +0100
+++ Jumpman_89_v1.0/jm_levels.h 2017-11-01 09:21:13.856954478 +0100
@@ -175,6 +175,8 @@ extern bool level_complete;
 extern int2 level_number;
 extern LEVEL_Type current_level;
 extern LEVEL_Type level[];
+#define EXTERNAL_LEVEL_BUFFER_SIZE (30*1024U + 256)
+extern uint1 * external_level_buffer;
 
 extern uint1 level_toggle_bits;
 extern uint4 level_toggle_girders_count;
diff -Naurp '--exclude=*.89z' '--exclude=*.9xz' '--exclude=*.v2z' '--exclude=*.89y' '--exclude=*.a' '--exclude=extgraph.h' Jumpman_89_v1.0_orig/jm_objects.h Jumpman_89_v1.0/jm_objects.h
--- Jumpman_89_v1.0_orig/jm_objects.h 2017-10-30 21:22:54.000000000 +0100
+++ Jumpman_89_v1.0/jm_objects.h 2017-10-31 21:15:59.896355639 +0100
@@ -294,4 +294,5 @@ OBJECT_Type* GetNextObjectEntry(void);
 void ResetIndexByType(void);
 
 
-#endif
\ Pas de fin de ligne à la fin du fichier
+#endif
+
diff -Naurp '--exclude=*.89z' '--exclude=*.9xz' '--exclude=*.v2z' '--exclude=*.89y' '--exclude=*.a' '--exclude=extgraph.h' Jumpman_89_v1.0_orig/jm_platforms.c Jumpman_89_v1.0/jm_platforms.c
--- Jumpman_89_v1.0_orig/jm_platforms.c 2017-10-30 19:58:34.000000000 +0100
+++ Jumpman_89_v1.0/jm_platforms.c 2017-11-01 09:28:31.206007583 +0100
@@ -24,6 +24,7 @@
 #include "FontUtils.h"
 
 #include "jm_platforms.h"
+#include "jm_bullets.h"
 #include "jm_moving_platforms.h"
 #include "jm_objects.h"
 #include "jm_graphics.h"
@@ -313,9 +314,9 @@ void DrawPlatformLevel(void)
 
 bool girder_check_row[12];
 bool ladder_check_row[12];
-bool ladder_check;
-bool chain_check;
-bool rope_check;
+bool ladder_check = 0;
+bool chain_check = 0;
+bool rope_check = 0;
 int2 ladder_rung_index = 0;
 int2 skip_rope_check = 0;
 int2 skip_chain_check = 0;
@@ -528,22 +529,6 @@ bool CheckJumpmanGirderRow(int2 y1, int2
 }
 
 
-bool CheckJumpmanLadder(void)
-{
- return CheckJumpmanLadderRow(2, 8);
-}
-
-bool CheckJumpmanChain(void)
-{
- return chain_check;
-}
-
-bool CheckJumpmanRope(void)
-{
- return rope_check;
-}
-
-
 /*
 void Illuminate()
 {
diff -Naurp '--exclude=*.89z' '--exclude=*.9xz' '--exclude=*.v2z' '--exclude=*.89y' '--exclude=*.a' '--exclude=extgraph.h' Jumpman_89_v1.0_orig/jm_platforms.h Jumpman_89_v1.0/jm_platforms.h
--- Jumpman_89_v1.0_orig/jm_platforms.h 2017-10-30 19:58:34.000000000 +0100
+++ Jumpman_89_v1.0/jm_platforms.h 2017-10-31 21:34:58.507944389 +0100
@@ -27,17 +27,31 @@
 
 extern int2 skip_rope_check;
 extern int2 skip_chain_check;
+extern bool ladder_check;
+extern bool chain_check;
+extern bool rope_check;
 
 
 void ConstructPlatformLevel(void);
 void DrawPlatformPiece(uint1 value, uint1 flags, int2 x, int2 y);
 void ModifyPlatformPiece(uint1 value, uint1 new_flags, int2 x, int2 y);
 void DrawPlatformLevel(void);
-bool CheckJumpmanLadder(void);
 bool CheckJumpmanLadderRow(int2 y1, int2 y2);
+inline bool CheckJumpmanLadder(void)
+{
+ return CheckJumpmanLadderRow(2, 8);
+}
 bool CheckJumpmanGirderRow(int2 y1, int2 y2);
-bool CheckJumpmanChain(void);
-bool CheckJumpmanRope(void);
+inline bool CheckJumpmanChain(void)
+{
+ return chain_check;
+}
+
+inline bool CheckJumpmanRope(void)
+{
+ return rope_check;
+}
+
 void CheckPlatformInteractions(DIR_Type direction);
 void Illuminate();
 void Hotfoot();
diff -Naurp '--exclude=*.89z' '--exclude=*.9xz' '--exclude=*.v2z' '--exclude=*.89y' '--exclude=*.a' '--exclude=extgraph.h' Jumpman_89_v1.0_orig/jm_scores.c Jumpman_89_v1.0/jm_scores.c
--- Jumpman_89_v1.0_orig/jm_scores.c 2017-10-30 19:58:34.000000000 +0100
+++ Jumpman_89_v1.0/jm_scores.c 2017-10-31 21:45:38.941212319 +0100
@@ -115,7 +115,7 @@ HIGH_SCORES_Type high_scores_list =
 
 void ReadHighScores(void)
 {
- char file_name[] = "jms";
+ static const char file_name[] = "jms";
  uint4 file_address;
 
  file_address = (uint4)OpenFile(file_name);
@@ -128,7 +128,7 @@ void ReadHighScores(void)
 
 void SaveHighScores(void)
 {
- char file_name[] = "jms";
+ static const char file_name[] = "jms";
  uint4 file_address;
 
  UnarchiveFile(file_name);
@@ -152,7 +152,7 @@ void SaveHighScores(void)
 void DrawFinalScores(void)
 {
  char buffer[32];
- char line_12[] = "~~~~~~~~~~~~";
+ static const char line_12[] = "~~~~~~~~~~~~";
 
  GrayUserDrawStr(80-(11*4/2),20, "TOTAL SCORE", COLOR_White, 0x00);
  GrayUserDrawStr(80-(12*4/2),31, line_12, COLOR_White, 0x00);
diff -Naurp '--exclude=*.89z' '--exclude=*.9xz' '--exclude=*.v2z' '--exclude=*.89y' '--exclude=*.a' '--exclude=extgraph.h' Jumpman_89_v1.0_orig/jm_scores.h Jumpman_89_v1.0/jm_scores.h
--- Jumpman_89_v1.0_orig/jm_scores.h 2017-10-30 19:58:34.000000000 +0100
+++ Jumpman_89_v1.0/jm_scores.h 2017-10-31 21:16:24.052856092 +0100
@@ -55,4 +55,5 @@ void ReadHighScores(void);
 void SaveHighScores(void);
 
 
-#endif
\ Pas de fin de ligne à la fin du fichier
+#endif
+
diff -Naurp '--exclude=*.89z' '--exclude=*.9xz' '--exclude=*.v2z' '--exclude=*.89y' '--exclude=*.a' '--exclude=extgraph.h' Jumpman_89_v1.0_orig/jm_titlescreen.c Jumpman_89_v1.0/jm_titlescreen.c
--- Jumpman_89_v1.0_orig/jm_titlescreen.c 2017-10-30 19:58:34.000000000 +0100
+++ Jumpman_89_v1.0/jm_titlescreen.c 2017-10-31 21:46:35.106375900 +0100
@@ -36,7 +36,7 @@
 
 
 // Titlescreen
-OBJECT_Type titlescreen_object_list[13] =
+static const OBJECT_Type titlescreen_object_list[13] =
 {
  { 1, GAME_PIECE_Jumpman,    FLAG_VA, 19, 20,  SPECIAL_ABILITY_None},
 
@@ -58,7 +58,7 @@ OBJECT_Type titlescreen_object_list[13]
 };
 
 
-LETTER_Type  letter_list_orig[7] =
+static const LETTER_Type  letter_list_orig[7] =
 {
  {156,18,1,1},
  {156,18,2,2},
diff -Naurp '--exclude=*.89z' '--exclude=*.9xz' '--exclude=*.v2z' '--exclude=*.89y' '--exclude=*.a' '--exclude=extgraph.h' Jumpman_89_v1.0_orig/jm_utilities.h Jumpman_89_v1.0/jm_utilities.h
--- Jumpman_89_v1.0_orig/jm_utilities.h 2017-10-30 21:23:04.000000000 +0100
+++ Jumpman_89_v1.0/jm_utilities.h 2017-10-31 21:15:56.312281387 +0100
@@ -107,4 +107,5 @@ void ResetAutoQuit(void);
 uint2 CalculateVpc(uint2* address, int2 size);
 bool IsVpcValid(uint2* address, int2 size, uint2 vpc);
 
-#endif
\ Pas de fin de ligne à la fin du fichier
+#endif
+
diff -Naurp '--exclude=*.89z' '--exclude=*.9xz' '--exclude=*.v2z' '--exclude=*.89y' '--exclude=*.a' '--exclude=extgraph.h' Jumpman_89_v1.0_orig/jumpman.tpr Jumpman_89_v1.0/jumpman.tpr
--- Jumpman_89_v1.0_orig/jumpman.tpr 2017-10-30 23:00:34.000000000 +0100
+++ Jumpman_89_v1.0/jumpman.tpr 2017-11-01 09:46:55.888874464 +0100
@@ -6,11 +6,11 @@ Use Data Variable=0
 Data Variable=
 Copy Data Variable=1
 Copy Data Variable if Archived=1
-Pack=1
+Pack=0
 Packed Variable=jumpman
 Project Name=jm
-GCC Switches=-Wall -W -Wwrite-strings -ffunction-sections -fdata-sections
-GNU Assembler Switches=
+GCC Switches=-Os -fomit-frame-pointer -mregparm=5 -Wall -W -Wwrite-strings -ffunction-sections -fdata-sections -mno-bss -I. -Iutils -IExtGraph-b02b924/lib -Igfx
+GNU Assembler Switches=--all-relocs
 Assembler Switches=-g -t
 Debug Info=0
 Standard Library=1
@@ -38,9 +38,9 @@ Use PreOS=0
 Minimum AMS Version Defined=1
 Minimum AMS Version=1.00
 Unofficial OS Support=0
-Reloc Format=AMS
+Reloc Format=Compressed
 ROM Call Format=Direct
-BSS Ref Format=Kernel
+BSS Ref Format=Compressed
 Data Ref Format=Kernel
 Use F-Line Jumps=0
 Use 4-Byte F-Line Jumps=0
diff -Naurp '--exclude=*.89z' '--exclude=*.9xz' '--exclude=*.v2z' '--exclude=*.89y' '--exclude=*.a' '--exclude=extgraph.h' Jumpman_89_v1.0_orig/utils/BasicTypes.h Jumpman_89_v1.0/utils/BasicTypes.h
--- Jumpman_89_v1.0_orig/utils/BasicTypes.h 2017-10-30 19:58:34.000000000 +0100
+++ Jumpman_89_v1.0/utils/BasicTypes.h 2017-10-31 21:15:25.495642956 +0100
@@ -83,4 +83,5 @@ typedef struct
 
 
 
-#endif // _BasicTypes
\ Pas de fin de ligne à la fin du fichier
+#endif // _BasicTypes
+
diff -Naurp '--exclude=*.89z' '--exclude=*.9xz' '--exclude=*.v2z' '--exclude=*.89y' '--exclude=*.a' '--exclude=extgraph.h' Jumpman_89_v1.0_orig/utils/BasicUtils.c Jumpman_89_v1.0/utils/BasicUtils.c
--- Jumpman_89_v1.0_orig/utils/BasicUtils.c 2017-10-30 19:58:34.000000000 +0100
+++ Jumpman_89_v1.0/utils/BasicUtils.c 2017-10-31 21:48:17.676500857 +0100
@@ -15,9 +15,3 @@
 
 #include "BasicUtils.h"
 
-
-int2 RandomNumber(int2 MaximumNumber)
-{
- // generate a random 16 bit integer between 0 and MaximumNumber
- return random(MaximumNumber);
-}
diff -Naurp '--exclude=*.89z' '--exclude=*.9xz' '--exclude=*.v2z' '--exclude=*.89y' '--exclude=*.a' '--exclude=extgraph.h' Jumpman_89_v1.0_orig/utils/BasicUtils.h Jumpman_89_v1.0/utils/BasicUtils.h
--- Jumpman_89_v1.0_orig/utils/BasicUtils.h 2017-10-30 19:58:34.000000000 +0100
+++ Jumpman_89_v1.0/utils/BasicUtils.h 2017-11-01 09:00:12.306840452 +0100
@@ -16,7 +16,11 @@
 
 #include "BasicTypes.h"
 
-int2 RandomNumber(int2 MaximumNumber);
+inline int2 RandomNumber(int2 MaximumNumber)
+{
+ // generate a random 16 bit integer between 0 and MaximumNumber
+ return random(MaximumNumber);
+}
 
 extern short IsVTI(void);
 
@@ -24,4 +28,5 @@ extern short IsVTI(void);
 #define BOUNDS_COLLIDE_UTIL(x0, y0, x1, y1, w0, w1, h0, h1) \
  ((x0 < (x1 + w1)) && ((x0 + w0) > x1) && (y0 < (y1 + h1)) && ((y0 + h0) > y1))
 
-#endif // _BasicUtils
\ Pas de fin de ligne à la fin du fichier
+#endif // _BasicUtils
+
diff -Naurp '--exclude=*.89z' '--exclude=*.9xz' '--exclude=*.v2z' '--exclude=*.89y' '--exclude=*.a' '--exclude=extgraph.h' Jumpman_89_v1.0_orig/utils/GrayUtils.h Jumpman_89_v1.0/utils/GrayUtils.h
--- Jumpman_89_v1.0_orig/utils/GrayUtils.h 2017-10-30 19:58:34.000000000 +0100
+++ Jumpman_89_v1.0/utils/GrayUtils.h 2017-10-31 21:15:41.271969796 +0100
@@ -74,4 +74,5 @@ extern void GrayClipSingleSprite16_COLOR
     register void *dest1 asm("%a1"))
     __attribute__((__stkparm__));
 
-#endif // _GrayUtils
\ Pas de fin de ligne à la fin du fichier
+#endif // _GrayUtils
+
diff -Naurp '--exclude=*.89z' '--exclude=*.9xz' '--exclude=*.v2z' '--exclude=*.89y' '--exclude=*.a' '--exclude=extgraph.h' Jumpman_89_v1.0_orig/utils/KeyUtils.h Jumpman_89_v1.0/utils/KeyUtils.h
--- Jumpman_89_v1.0_orig/utils/KeyUtils.h 2017-10-30 19:58:34.000000000 +0100
+++ Jumpman_89_v1.0/utils/KeyUtils.h 2017-10-31 21:16:42.997248566 +0100
@@ -89,4 +89,5 @@ int2 ConvertKeyPressToNumber(KeyboardInp
 
 
 
-#endif // _KeyboardUtils
\ Pas de fin de ligne à la fin du fichier
+#endif // _KeyboardUtils
+
diff -Naurp '--exclude=*.89z' '--exclude=*.9xz' '--exclude=*.v2z' '--exclude=*.89y' '--exclude=*.a' '--exclude=extgraph.h' Jumpman_89_v1.0_orig/utils/TimeUtils.c Jumpman_89_v1.0/utils/TimeUtils.c
--- Jumpman_89_v1.0_orig/utils/TimeUtils.c 2017-10-30 19:58:34.000000000 +0100
+++ Jumpman_89_v1.0/utils/TimeUtils.c 2017-10-31 21:52:14.033397491 +0100
@@ -66,21 +66,3 @@ void InitTimer(uint2 timer, uint4 millis
  KillTimer(USER_TIMER); // TIOS requires to free the timer prior to use
  OSRegisterTimer (timer, timerValue); // Auto-Int 5 is triggered 20 times per second
 }
-
-uint2 CheckTimer(uint2 timer)
-{
- if (OSTimerExpired (timer))
- return 1;
- else
- return 0;
-}
-
-void RestartTimer(uint2 timer)
-{
- OSTimerRestart (timer);
-}
-
-void KillTimer(uint2 timer)
-{
- OSFreeTimer (timer);
-}
\ Pas de fin de ligne à la fin du fichier
diff -Naurp '--exclude=*.89z' '--exclude=*.9xz' '--exclude=*.v2z' '--exclude=*.89y' '--exclude=*.a' '--exclude=extgraph.h' Jumpman_89_v1.0_orig/utils/TimeUtils.h Jumpman_89_v1.0/utils/TimeUtils.h
--- Jumpman_89_v1.0_orig/utils/TimeUtils.h 2017-10-30 19:58:34.000000000 +0100
+++ Jumpman_89_v1.0/utils/TimeUtils.h 2017-10-31 21:52:10.033314620 +0100
@@ -21,9 +21,19 @@
 void Sleep(uint4 milliseconds);
 
 void InitTimer(uint2 timer, uint4 milliseconds);
-void KillTimer(uint2 timer);
-void RestartTimer(uint2 timer);
-uint2 CheckTimer(uint2 timer);
+inline void KillTimer(uint2 timer)
+{
+ OSFreeTimer (timer);
+}
+inline void RestartTimer(uint2 timer)
+{
+ OSTimerRestart (timer);
+}
 
+inline int2 CheckTimer(uint2 timer)
+{
+ return OSTimerExpired (timer);
+}
+
+#endif // _TimerUtils
 
-#endif // _TimerUtils
\ Pas de fin de ligne à la fin du fichier
diff -Naurp '--exclude=*.89z' '--exclude=*.9xz' '--exclude=*.v2z' '--exclude=*.89y' '--exclude=*.a' '--exclude=extgraph.h' Jumpman_89_v1.0_orig/utils/TrigUtils.c Jumpman_89_v1.0/utils/TrigUtils.c
--- Jumpman_89_v1.0_orig/utils/TrigUtils.c 2017-10-30 19:58:34.000000000 +0100
+++ Jumpman_89_v1.0/utils/TrigUtils.c 2017-10-31 21:53:50.999406347 +0100
@@ -45,7 +45,7 @@ int1 iCos(int2 angle)
 
 int1 iSin(int2 angle)
 {
- float sinValue;
+ int1 sinValue;
 
  if (angle < 0)
  {
diff -Naurp '--exclude=*.89z' '--exclude=*.9xz' '--exclude=*.v2z' '--exclude=*.89y' '--exclude=*.a' '--exclude=extgraph.h' Jumpman_89_v1.0_orig/utils/TrigUtils.h Jumpman_89_v1.0/utils/TrigUtils.h
--- Jumpman_89_v1.0_orig/utils/TrigUtils.h 2017-10-30 19:58:34.000000000 +0100
+++ Jumpman_89_v1.0/utils/TrigUtils.h 2017-10-31 21:16:45.189293978 +0100
@@ -23,4 +23,5 @@ int1  iCos(int2 angle);
 int1  iSin(int2 angle);
 
 
-#endif // #ifndef _TrigUtils
\ Pas de fin de ligne à la fin du fichier
+#endif // #ifndef _TrigUtils
+

Comments on this diff:
* the newlines at ends of files prevent noisy warnings;
* the -I GCC switches in jumpman.tpr are just a way to adapt to building with tprbuilder, which requires working around the "virtual folders" misfeature of the IDE. You can ignore them;
* the case changes in #include lines make it possible to build on platforms with case-sensitive filesystems (*nix), so you should take them;
* the Pack=0 in jumpman.tpr is just to avoid severe console spam by ttpack when using the compiler and linker in verbose mode, you should ignore that line;
* the functions inlined into the headers are a leftover from the point I was trying to haggle down on the size, before noticing that the build was performed without optimization. I left them because they slightly help;
* making "jml", "jms", line_12 strings constant shaves dozens of bytes per instance;
* the -l flag can be passed to GNU as, provided jm_levels.c (instead of jm_levels.h) is #include'd by jm_jumpman.c to influence section reordering by the linker in such a way that UnpackBuffer is close enough to DrawSelectScreen, but... it only shaves several dozen bytes overall, so I rolled back these changes.

The program stats have become:
Code: [Select]
  Program Variable Size:                    45907 Bytes
  Absolute Relocs:                          442
  Natively Emitted Relocs:                  0
  Relocs Removed by Branch Optimization:    298
  Relocs Removed by Move Optimization:      439
  Relocs Removed by Test Optimization:      34
  Relocs Removed by Calc Optimization:      12
  Space Saved by Range-Cutting:             1658 Bytes
Unsurprisingly, Jumpman is yet another instance of using BSS being a bad thing (remove -mno-bss from the compiler flags and compare the program variable size + bss size, as well as the number of relocations)... TIGCC 0.95 brought a wealth of useful capabilities, but that one, despite being one of the most requested features formerly provided only by "kernels", is just bad in most situations.
Member of the TI-Chess Team.
Co-maintainer of GCC4TI (GCC4TI online documentation), TIEmu and TILP.
Co-admin of TI-Planet.

 


You can also use the following HTML or bulletin board code to share it on your page or forum signature!


Also do not forget to check our affiliates below.
Planet Casio TI-Planet Calc.news BroniesQC BosaikNet Velocity Games