Page 2 of 2

Re: How to reduce file size?

Posted: Tue Jul 14, 2020 11:23 am
by Mijikai
@NicTheQuick thanks for the clarification :)

Re: How to reduce file size?

Posted: Tue Jul 14, 2020 12:14 pm
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

Re: How to reduce file size?

Posted: Tue Jul 14, 2020 12:17 pm
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.

Re: How to reduce file size?

Posted: Tue Jul 14, 2020 1:52 pm
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.

Re: How to reduce file size?

Posted: Wed Jul 15, 2020 2:27 pm
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