1- First you open the cheat engine and dwarf fortress
2-On cheat engine click on select a process to work, the icon is the one with an pc on it.
3-Find dwarf fortress.exe there and click on open
4-Now on dwarf fortress, go to design a world with advanced parameters.
5-Start to generate a world.
6-Go to cheat engine write the size of X or Y map size on the value text field and click on first scan.
7-Stop the world generation, go back to advanced world generation and select a parameter with different size and start to generate an world.
8- Go to cheat engine write the X or Y map size of this new world parameter, at the value text field and click on first scan.
9-On the cheat engine on the left side, you will see a box with address value and previous value.
Here you will see the ram values, what this program do is to look for ram values with the values you wrote on the text field, so the program looked for ram values that had the exact map size you searched when you searched them.
10-Continue going back to 7, until you have 4 values (or 8 if X and Y map size values are the same). When this happen click two times on the value and you will see the address appear on the bottom box.
11-Stop the world generation and go back to advanced world generation menu.
12-At cheat engine, now go to bottom box, click on the address you want and change the value, to the new value you want. Click the box near this value to make a cross inside this box, this means the ram value wont change
13-Now you can create a new world with this value.
PS: Sometimes dwarf fortress will crash while trying to generate a world.
If you want to do it for world Y value, just do the same thing I said here but with world Y value.
Another thing, many times, the max amount of sub-region amount is not enought even for 257x257 world, if you want to have an easier time generating a world bigger than 257x257, you will need to set the max number of subregion to a number higher than 5000 that is the limit, you can also use cheat engine to do that.