How to reduce file size?

Everything else that doesn't fall into one of the other PB categories.
User avatar
Mijikai
Addict
Addict
Posts: 1360
Joined: Sun Sep 11, 2016 2:17 pm

Re: How to reduce file size?

Post by Mijikai »

@NicTheQuick thanks for the clarification :)
User_Russian
Addict
Addict
Posts: 1443
Joined: Wed Nov 12, 2008 5:01 pm
Location: Russia

Re: How to reduce file size?

Post by User_Russian »

NicTheQuick wrote:Of course, on small microcontrollers with 1 MB of flash memory or less you need to look at each bit individually to get the smallest executable possible.
1 MB of flash this is a very very large amount of memory for the microcontroller!
Here is a typical 8-bit microcontroller with a 2 KB flash and 68 bytes of RAM. https://www.microchip.com/wwwproducts/en/PIC16F84
Here is a modern 32-bit microcontroller with an ARM core, in which 16 KB of flash memory and 4 KB of RAM. https://www.st.com/en/microcontrollers- ... 030f4.html
BarryG
Addict
Addict
Posts: 3324
Joined: Thu Apr 18, 2019 8:17 am

Re: How to reduce file size?

Post by BarryG »

Demivec wrote:Is there any reason why you would be limited to only a 1.44 mb floppy?
I'm guessing it's for one of those "intro" contests where the executable size must be 1.44 MB or less to enter.
User avatar
chi
Addict
Addict
Posts: 1034
Joined: Sat May 05, 2007 5:31 pm
Location: Linz, Austria

Re: How to reduce file size?

Post by chi »

Vernostonos wrote:Are there any tricks for keeping file size down for a PB project?
I just hit 101 kb and have only half of my character creation system finished. I'm worried once all the dialog, custom fonts, and locations are completed its no longer going to fit on a 1.44mb floppy.
If you are worried about file size you should take a look at the ASM file Purebasic generates (pbcompiler.exe /COMMENTED). PB tends to call some init/end/free library functions even though no other functions of that particular library are called, thus inflating the final exe with unused libs.
I wrote an IDE tool for this matter (pbOptimizer). Another way to reduce the size of your program, if you are working with images, is to not include Use???ImageDecoder() but instead use LoadImageEx/LoadSpriteEx.
Et cetera is my worst enemy
User avatar
Vernostonos
User
User
Posts: 58
Joined: Thu Jul 02, 2020 9:52 pm

Re: How to reduce file size?

Post by Vernostonos »

Thank you everyone for the tips. My original post was vague, for example I shaved off about 5kb by eliminating large areas of copy and pasted code. Instead using "procedures" to display the same information across a range of different prompts. I'm a novice so I am still learning how to kick bad habits and better optimize my code.
Josh wrote:
Vernostonos wrote:... its no longer going to fit on a 1.44mb floppy.
Excuse me, it's the year 2020.
Considering I'm working on a "console/command prompt" type game its a requirement of mine. It might seem like an odd goal to fit a game on a 1.44mb floppy, its more about the novelty of actually doing it. I have no plans to enter a contest this is just a personal project for fun and learning.
Bitblazer wrote:What is your software supposed to do? What is your target operating system?
Windows for now but you can see more about my game project here.
viewtopic.php?f=13&t=75649
Post Reply