* 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 4238 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: October 29, 2017, 07:12:08 am »
Great :)
TI-68k programs are scarce nowadays, so it could arguably be featured wherever you post it. The ticalc.org POTY time is nearing ;)
« Last Edit: October 29, 2017, 07:21:59 am by Lionel Debroux »
Member of the TI-Chess Team.
Co-maintainer of GCC4TI (GCC4TI online documentation), TIEmu and TILP.
Co-admin of TI-Planet.

Online xlibman

  • Omni founder & CW co-founder
  • Super User
  • Original 5
  • CodeWalrus Supporter
  • *
  • Join Date: Nov 2014
  • Location: Quebec, Canada
  • Posts: 18876
  • Post Rating Ratio: +99/-4
    • dj_omnimaga
    • DJOmnimaga.music
    • @DJOmnimaga
    • dj_omnimaga
    • @DJOmnimaga
    • /u/DJ_Omnimaga
    • DJOmnimaga
    • 112/11286
    • @djomnimaga
    • @DJOmnimaga
    • DJ Omnimaga music store
  • Gender: Male
Re: Jumpman Resurrected
« Reply #46 on: October 29, 2017, 12:35:32 pm »
Awesome to see this released. :3= I wonder if I got spare batteries to try it when it comes out...
  • Calculators owned: TI-57, 73, TI-80 (broken), TI-81, TI-82, TI-83, TI-83+ (broken), TI-83+ (broken), TI-83+SE (broken), TI-84+, TI-84+CSE, TI-84+CE, TI-85, TI-86, TI-89T, TI-92, TI-Nspire, TI-Nspire CX (semi-broken), HP 39gII, HP Prime, Casio fx-7000G, fx-7400G+, fx-7700GE, fx-9750G+, fx-9750GII, fx-9860G, cfx-9850G, FX-1.0+, fx-CG10, fx-CP400
  • Consoles, mobile devices and vintage computers owned: Samsung i5510, Nexus 5, Atari 2600, Lynx, SMS, Game Gear, Genesis, Dreamcast, NES, SNES, N64, GCN, Wii, Wii U, GBA, DS, 3DS, PS2, PS3, PS4, PSP, PSVita, XBox 360, XBOne

Bandcamp|Reverbnation|Facebook|Youtube|Twitter
Retired Omnimaga admin (2001-11) and editor (2012-14)

Offline Ranman

  • Full User
  • Safe-haven access
  • Join Date: Feb 2017
  • Location:
  • Posts: 73
  • Post Rating Ratio: +4/-0
  • Gender: Male
Re: Jumpman Resurrected
« Reply #47 on: October 31, 2017, 04:52:00 am »
Jumpman 89 v1.00 is complete and I have uploaded it to Ticalc.  :w00t:
  • Calculators owned: TI-89 HW1, TI-92+, Casio 9860G Slim, Casio fx6300, Tandy PC7
Ranman
Bringing Randy Glover's Jumpman to the TI-89 calculator. Download available at Ticalc.

Offline Lionel Debroux

  • Full User
  • Join Date: Jan 2015
  • Location:
  • Posts: 230
  • Post Rating Ratio: +11/-0
    • debrouxl
    • 58/5891
Re: Jumpman Resurrected
« Reply #48 on: October 31, 2017, 07:36:27 pm »
I'm now looking at the project, and I have several optimization suggestions :)
* first and foremost: unless you experience issues with optimized compilation, which is very infrequent, you should compile with optimization (-Os compiler flag), which, besides speeding up the program, also saves a fantastic amount of space ;)
* on top of that, the -fomit-frame-pointer -mregparm=5 compiler flags save some more space;
* you really should dynamically allocate 5 huge variables: external_level_buffer (jm_levels.c) and the four LCD_SIZE'd variables from jm_graphics.c. You can allocate a single block and play with pointer arithmetic a bit. Currently, they get stored in BSS, but BSS suck for both size and speed efficiency - both directly, because of inefficient instructions + relocation information, and indirectly, because they can prevent from making other optimizations. Getting rid of BSS for most programs I worked on, not just TICT programs, was a major win.
* for now, using compressed relocations and compressed references for BSS saves some more space. When the above variables are dynamically allocated, the BSS becomes small enough to merge with the main executable, and compressed BSS references are moot.
* you used the old, large version of IsVTI(); the newest version can be found inline in e.g. https://github.com/debrouxl/gcc4ti/blob/next/trunk/tigcc/archive/gray.s or in https://github.com/debrouxl/gcc4ti/blob/next/trunk/tigcc/archive/hw_version.s ;
* in GraySetScreenColor_R(): 1) move.l #0xffffffff,%d0 / %d5 would be much better as moveq #-1,%d0 / % d5, 2) the andi.l instructions would be smaller and faster as moveq to an additional register followed by and.l, 3) the cmpi.b instructions might be redundant because the andi.l (with a single-bit mask) already sets the CCR flags, 4) you should use explicit short branches;
* in GraySingleSprite8_COLOR_R(): 1) cmpi.w #0,%d4 is better written as tst.w %d4 (and you could even avoid the tst.w %d4 if you load d6 before loading d4), 2a) given that you're not using the upper part of d5, you should use moveq # instead of move #, 2b) in fact you could replace everything between __GraySingleSprite8_R__Test_WHITE and __GraySingleSprite8_R__Test_Finish by a single lsr.w #3,%d4 instruction (and thereby avoid using d5 at all), 3) you should use an explicit .l on the adda, 4) you should use explicit short branches.

This computer doesn't have GCC4TI binaries, I'll have to build them... or use the other computer's binaries.

On my side, the current build stats for jumpman are:
Code: [Select]
  Program Variable Size:                    45249 Bytes
  BSS Size:                                 47878 Bytes
  Absolute Relocs:                          712
  Natively Emitted Relocs:                  2
  Relocs Removed by Branch Optimization:    299
  Relocs Removed by Move Optimization:      211
  Relocs Removed by Test Optimization:      5
  Space Saved by Range-Cutting:             1110 Bytes
« Last Edit: November 01, 2017, 07:46:47 am by Lionel Debroux »
Member of the TI-Chess Team.
Co-maintainer of GCC4TI (GCC4TI online documentation), TIEmu and TILP.
Co-admin of TI-Planet.

Offline Lionel Debroux

  • Full User
  • Join Date: Jan 2015
  • Location:
  • Posts: 230
  • Post Rating Ratio: +11/-0
    • debrouxl
    • 58/5891
Re: Jumpman Resurrected
« Reply #49 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.

Offline Ranman

  • Full User
  • Safe-haven access
  • Join Date: Feb 2017
  • Location:
  • Posts: 73
  • Post Rating Ratio: +4/-0
  • Gender: Male
Re: Jumpman Resurrected
« Reply #50 on: November 01, 2017, 11:20:57 am »
Thanks soooo much Lionel.

Let me ponder each very good point you made before I ask any questions.

I tried the -Os all by itself... it saved 10Kb all by itself AND made Jumpman about twice as fast.

I'll touch base with you again.
  • Calculators owned: TI-89 HW1, TI-92+, Casio 9860G Slim, Casio fx6300, Tandy PC7
Ranman
Bringing Randy Glover's Jumpman to the TI-89 calculator. Download available at Ticalc.

Offline Ranman

  • Full User
  • Safe-haven access
  • Join Date: Feb 2017
  • Location:
  • Posts: 73
  • Post Rating Ratio: +4/-0
  • Gender: Male
Re: Jumpman Resurrected
« Reply #51 on: November 07, 2017, 03:58:15 am »
For Lionel...

I implemented your suggestions. The -Os switch did cause me some problems... specifically it made the DrawSelectScreen function very fragile. I had to add some defensive coding to get it working again; but still it seems like even minor change to the function would break it again. It is working now. The -Os switch also resulted in my Sleep function no longer delaying for the specified amount of milliseconds (it was getting optimized out)... this gave the appearance that Jumpman was 100% to 200% faster. I ended adding some asm("NOP") to ensure my delay loop would not get optimized.

I did not implement the inlines that you suggested. I did not realize the BSS section resulted in such unoptimized calls. Thanks for pointing that out.

Thank you for your suggestions to make Jumpman even better.

I also corrected a few minor bugs:
- enemy collision detection was intentionally disabled for testing purposes but was unintentionally included in the release.... whoops :-[
- tightened up the collision detection with bullets and collectables
- corrected the version string to v1.01

Update coming soon  ;D
« Last Edit: November 07, 2017, 05:03:58 am by Ranman »
  • Calculators owned: TI-89 HW1, TI-92+, Casio 9860G Slim, Casio fx6300, Tandy PC7
Ranman
Bringing Randy Glover's Jumpman to the TI-89 calculator. Download available at Ticalc.

Offline Lionel Debroux

  • Full User
  • Join Date: Jan 2015
  • Location:
  • Posts: 230
  • Post Rating Ratio: +11/-0
    • debrouxl
    • 58/5891
Re: Jumpman Resurrected
« Reply #52 on: November 07, 2017, 06:36:20 am »
Don't worry, few people realize how much BSS suck. Getting rid of BSS is one of the optimizations I performed most often on other authors' programs, so BSS removal ended up being more clearly featured in my TICT S1P9 optimization tutorial :)

Usually, when code doesn't work with optimization turned on, it's a bug, so you were right to fix DrawSelectScreen.

Inlining the functions saved a bit of space, but much less than compiling with -Os + getting rid of BSS, so yeah, it's not that important to do so.

I produced no less than two releases of TI-Chess where I had left in an asm("0: bra.s 0b") infinite debugging loop, forgetting to restore collision detection is less of a problem than that :)

Did you switch to GCC4TI for building ? GCC4TI's SAVE_SCREEN support is 16 bytes smaller.

Oh, and for adding 92+/V200 support, you should use fully separate builds. Compatible builds with optimized calc consts are usually a disaster for optimization, too.
Member of the TI-Chess Team.
Co-maintainer of GCC4TI (GCC4TI online documentation), TIEmu and TILP.
Co-admin of TI-Planet.

Offline Ranman

  • Full User
  • Safe-haven access
  • Join Date: Feb 2017
  • Location:
  • Posts: 73
  • Post Rating Ratio: +4/-0
  • Gender: Male
Re: Jumpman Resurrected
« Reply #53 on: November 11, 2017, 03:39:48 pm »
Today I uploaded Jumpman 89 v1.01 to Ticalc. It contains a lot of optimizations suggested by LIonel Debroux and some minor corrections to the game engine.

Jumpman 89 v1.01
  - added optimizations suggested by Lionel Debroux (thank you Lionel)
  - corrected version string (V1.00 was released with the version string set to v0.95)
  - corrected enemy collision detection (v1.00 was released with enemy collision detection unintentionally disabled)
  - increased accuracy of bullet and collectable collision detection

I also uploaded the Jumpman Jr level pack that consists of 12 new levels.
  • Calculators owned: TI-89 HW1, TI-92+, Casio 9860G Slim, Casio fx6300, Tandy PC7
Ranman
Bringing Randy Glover's Jumpman to the TI-89 calculator. Download available at Ticalc.

Offline Ranman

  • Full User
  • Safe-haven access
  • Join Date: Feb 2017
  • Location:
  • Posts: 73
  • Post Rating Ratio: +4/-0
  • Gender: Male
Re: Jumpman Resurrected
« Reply #54 on: November 17, 2017, 01:40:12 pm »
A few in the community have requested a version of Jumpman for the 92+ and V200 calculators. I am officially announcing that a version of Jumpman for the TI-92+ and V200 is now under construction.

Jumpman 92+ will support the keyboard layout differences. The graphics will remain unchanged but the playable area will be centered on the larger screen.
« Last Edit: November 17, 2017, 02:27:45 pm by Ranman »
  • Calculators owned: TI-89 HW1, TI-92+, Casio 9860G Slim, Casio fx6300, Tandy PC7
Ranman
Bringing Randy Glover's Jumpman to the TI-89 calculator. Download available at Ticalc.

 


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