Join us on Discord!
You can help CodeWalrus stay online by donating here.
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Lionel Debroux

#16
Web / Re: Going 'https'
September 12, 2018, 06:23:23 AM
TI-Planet, Cemetech and ticalc.org also use the automated Let's Encrypt CA to obtain certificates trusted by clients. And we all configure our Web servers to listen for TLS connections on TCP port 443, presenting the server certificate obtained from Let's Encrypt to clients.
#17
Hi Zeda :)
That's another great display that TI uses silly, slow algorithms...
That reminds me of Samuel Stearley's faster next_expression_index() and list item access routines for the TI-68k series.

Out of curiosity:
* how much execution time does inlining the comparison function save ?
* what's the execution time of an implementation of shellsort with a reasonable sequence (not the original O(n^2) one) on the same-sized lists produced from the same random seeds ? There's no O(n*log(n)) implementation of shellsort, but there's usually a range of sizes where an implementation with a reasonable sequence it trounces the quadratic sorts while being competitive with some asymptotically better O(n*log(n)) sorts. 200 items could be within that range, but 999 usually isn't.
#18
QuoteAny sane person dealing with sensitive, closed-source code would host their code themselves.
Right, but so many directors, financial people and managers aren't sane and competent that it isn't funny :)

Migrating a company's documents and e-mails to Office 365 - or the Google version thereof - shouldn't ever be an option to be considered seriously because of the privacy / confidentiality implications, let alone a decision imposed on users. My company's going through that **** at the moment, it's criminal.
#19
The biggest issue is probably the private repos, used by companies for their internal source code, falling into the hands of one of the Internet giants (whichever it is - it would largely be the same for Google, Apple or Amazon; Facebook's not really into coding in the first place). Even larger potential for industrial spying than with an independent Github, and an unfair advantage against competitors wrt. Azure integration (well, they'd better provide GCE and AWS integration at the same time if they want to avoid that pitfall) + LinkedIn integration (no alternative with remotely similar popularity).
Companies moving to their private Gitlab / Gerrit / similar instances would just be doing what they should have done much earlier.

Also, some people think that this move makes MS (even) more vulnerable to censorship, especially China's censorship: https://twitter.com/i/web/status/1003397774908559360

My main TI community projects are in the process of being imported to Gitlab, though I'll probably continue updating both sides for a while.
#20
For a while, I used Choqok, which is far more convenient than the standard browser-based client (I don't have a smartphone) because it makes it possible to store large - and even insanely large - amounts of contents for later reading. I gave up on most of Twitter altogether, because I was drowning in content, but I miss some aspects of the Choqok experience.
It's sad to see that they're attacking third-party clients again...

Ads aren't an issue with uBlock Origin. In general, ad blocking, besides removing often uninteresting and always distracting content, is also a must for security, as ads were shown multiple times to be an attack vector.
#21
Other / Re: About the whole tibet thing on Piwik
May 07, 2018, 02:20:12 PM
In dictatorships such as China and Russia - but let's face it, also in so-called democracies - some state workers sometimes have the right to break even their countries' rules, in a more or less controlled way, to misinform, mislead and perform mischief on people from other countries and in other countries. Maybe that's what we're seeing here.
#22
Other / Re: TI Nspire SMS Shield
April 23, 2018, 05:10:16 AM
Interesting work :)
The shield is quite thick, so it's not stealthy... but that's probably not a design goal ^^

There's quite a bit of code duplication between the nspire-communication/nspire-client/uart_*/*.cpp files; you may want to factor uart_getsn_mdf() and friends to a common file. Also, you may want to use a thin layer to abstract the UART protocol communication details, making it possible to add support for other transmitters :)
#23
Consoles / Re: Graphics-hacking Super Mario Bros.
February 20, 2018, 11:17:07 AM
Amusing :)

Do you plan on making a special version of Oiram CE, which could feature a subset of your sprite mods, the peace sign or things like that ?
#24
Ndless 4.5 should have worked for OS 4.5, yeah.

Which date code can you see on the back of your calculator ? It's at the right of the serial number, 1 letter (factory code) + 4 figures (MMYY) + 0, 1 or 2 letters (hardware revision, recent Nspire CX / CX CAS calculators have 2 letters).
#25
Looks pretty nice :)
#26
Calc Projects, Programming & Tutorials / Re: Pyramid 89
December 01, 2017, 04:47:17 PM
Several suggestions about the code:
  • the ZIP file is incomplete ;)
    The three missing assembly files can be found in the Jumpman ZIP (and should be using the versions for which I suggested optimizations in the other thread, I haven't downloaded the latest Jumpman version to check).
  • conversely, the Pyramid Solitaire ZIP might be cleaned up, as some functions don't seem to be used;
  • in TimeUtils.c, Sleep(): the "/ 2.65" causes a conversion to float, a floating-point division, and a conversion back to integer. "* 100 / 265" is more efficient size-wise (that's what matters) and speed-wise;
  • in pyramid.c:
    • I noticed that depending on how the linker reorders section, the call to SetUserFont(intvfont - 32 * 8, ...) (clever way to save space, I like it in general :) ) can end up producing a reference to outside the program's space, and the linker produces an error in such a case. As long as you don't hit the issue, it doesn't matter much.
    • careful ordering of the functions in pyramid.c (I can provide you the file if you're interested) makes it possible to declare the functions "static", which avoids the need to use prototype declarations at the beginning, and most of all, opens the set of functions to inlining - usually beneficial to code size for functions called only once, or trivial functions such as ResetAutoQuit();
    • in MoveCursor(), you're using floats for the usual Pythagorean distance computation; isn't there a way you could use squared distances, avoiding sqrt and floats altogether ? ;)
    • is there a way to reach value == 26 in CheckSelection() ? Normally, kings are selected as single cards. The point is, if value == 26 can't occur, then you can use value == 13 instead of (value % 13) == 0... avoiding a division and opening the function to inlining.
#27
Calc Projects, Programming & Tutorials / Re: Pyramid 89
November 13, 2017, 09:17:57 PM
Looks good indeed, another good find on your formerly lost backup drive :)
#28
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.
#29
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:
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:
  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.
#30
Yeah, PatrickD is still around :)
Powered by EzPortal