Resizing map quest

My next goal for this game is to reduce that size by messing with the map.tmx and configuration. Defmap.asm seems to be the area I want to concentrate on.

define bitsym 5
define bithlf 1
define mapw 12
define maph 2
define scrw 15
define scrh 10

The first 2 definitions bitsym and bithlf do not make any sense to me, so a quick search on the mojon twins forums show.

As I work with Tiled, I use the TmxCnv tool that is already correctly prepared to hide the original map:

It can also be modified by hand mapa.h, but it is the least advisable. It is very important to take note of the bitsym and bithlf values that TmxCompress returns to us, since we will have to pass them manually later to the DMAP_BITSYMB and DMAP_BITHALF directives of config.h Change number 2. The file config.h This file is the simplest of modify, you just have to add these 4 lines anywhere in the file:

#define DMAP_BITSYMB 4
#define DMAP_BITHALF 0
#define DMAP_BUFFER 0x5b01

Obviously the constants DMAP_BITSYMB and DMAP_BITHALF must be modified with the values

suggested by the map compressor.

Now this refers to the Mojon Twins Churrera, but it gives us a bit of a clue on what the definitions are used for.

The line in the make.bat that uses TMXCompress is

lib\bin\TmxCompress gfx\map.tmx build\map_compressed.bin > build\defmap.asm

TMXCompress takes the map found in gfx\map.tmx, it compresses the map and pushes the output to build\map_compressed.bin. Furthermore it generates variables and pushes them to defmap.asm.

So, in theory, all I have to do is modify the map and compressed.bin should change size and the variables in defmap.asm should also change.

If in doubt, I made a backup of the original just in case I mess it all up.

I open map.tmx (By the way, you need a copy of tiled map editor at

Go to map – resize map and change from 21 tiles high to 11 tiles high. Save that bad boy and lets recompile.

And.. nothing. To quote qbert @!#?@!

Sorry Folks.

Not saying that defmap didn’t get modified, it just got modified with the exact same definitions, so the maph definition should have changed, it didn’t.

The game size changed to 27,203, which is interesting, but none of the other definitions changed like I expected.

Found the error and it was my goofup. Make the map size in Tiled to 10 tiles high instead of 11.

Go to map – resize map and change from 21 tiles high to 10 tiles high. Save it and lets recompile again.

So, now defmap.asm shows

define bitsym 5
define bithlf 1
define mapw 12
define maph 1
define scrw 15
define scrh 10

The file size changed to 27,168.

I’m going to make a very quick change to main.c to change the end game to killing 2 enemies so I can see the end screen, this is only to quicken the testing.

The line to be modified is

if( killed==10 )

I’ll change that to

if( killed==2 )

Recompile, test.


Now, let’s resize that map again.

Go to map – resize map and change from 191 tiles wide to 15 tiles high. Save it and lets recompile again.

Tap size is 26,637

Test and “Winner Winner Chicken Dinner”!

Defmap.asm is showing the proper values. Morning mission over.


Author: andydansby

I'm a hobbyist coder working with the ZX Spectrum. Living in New York state near the Syracuse area. I grew up in Virgina. The first computer my parents bought for me was a Timex Sinclair 2068.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s