Skeetendo

’Cause all games were better on the GBC

You are not logged in.

#1 2015-01-13 10:43:12

piclarv
Member
Registered: 2015-01-05
Post 12/41

Generating maps in assembly

I don't know about you folks and maybe you use tools that I don't know about, but I think editing maps is the biggest pain in the pokered disassembly.  They are blocks of binary data which require a separate (hex) editor, and when you open it there it reads out as a string.  I thought of a way to make reading and editing more user friendly, and I don't know if there is a need for it or whatever, but this is the ASM for Red's House 1F

RedsHouse1FBlocks:
db $04, $09, $05, $07
db $0f, $0f, $0f, $0f
db $0f, $01, $02, $0f
db $0f, $0b, $0f, $0f

Notice that each line contains 4 bytes because the map has a width of 4.  If the map had a width of 10 you could write it so each line contained 10 bytes.  Opening the raw data in a hex editor always shows 16 bytes to a line, which is more often than not considerably less convenient.

Looking at it in this format I can see that $0f is empty floor, $0b is the exit, and $01+$02 together make up the table and chairs.  If I wanted to get rid of something, move something, or add something I would be able to pinpoint the byte more readily and I could use the same text editor that I use for everything else.

I replaced the blk with the asm in my lavender hack and it worked perfectly.  Just change the INCBIN "....blk" with INCLUDE "....asm" in the appropriate place.

https://github.com/piclarv/pokelavender … ouse1f.asm

Offline

#2 2015-01-13 15:38:58

ShantyTown
Member
Registered: 2013-12-04
Post 172/344

Re: Generating maps in assembly

piclarv wrote:

I don't know about you folks and maybe you use tools that I don't know about, but I think editing maps is the biggest pain in the pokered disassembly.  They are blocks of binary data which require a separate (hex) editor, and when you open it there it reads out as a string.  I thought of a way to make reading and editing more user friendly, and I don't know if there is a need for it or whatever, but this is the ASM for Red's House 1F

RedsHouse1FBlocks:
db $04, $09, $05, $07
db $0f, $0f, $0f, $0f
db $0f, $01, $02, $0f
db $0f, $0b, $0f, $0f

Notice that each line contains 4 bytes because the map has a width of 4.  If the map had a width of 10 you could write it so each line contained 10 bytes.  Opening the raw data in a hex editor always shows 16 bytes to a line, which is more often than not considerably less convenient.

Looking at it in this format I can see that $0f is empty floor, $0b is the exit, and $01+$02 together make up the table and chairs.  If I wanted to get rid of something, move something, or add something I would be able to pinpoint the byte more readily and I could use the same text editor that I use for everything else.

I replaced the blk with the asm in my lavender hack and it worked perfectly.  Just change the INCBIN "....blk" with INCLUDE "....asm" in the appropriate place.

https://github.com/piclarv/pokelavender … ouse1f.asm

You'll definitely want to use a mapping tool. :)  Someone else should chime in here because I don't know what is considered the best map editor nowadays.  I think the one included in the "extras" part of the disassembly projects is usable.  (I've been using my own crappy one for the last three years, so I haven't been paying attention to this very closely.)

Offline

#3 2015-01-13 18:02:38

Danny-E 33
Administrator
Registered: 2012-06-09
Post 839/1,119

Re: Generating maps in assembly

I cannot get the map editor to run on Windows, or on a Linux vm. Until it gets fixed, I have been making my maps using ClassicMap to directly edit a rom, and then opening the rom and the .blk file in a hex editor and copy/pasting.

Offline

#4 2015-01-13 18:15:14

comet
Member
Registered: 2012-04-09
Post 499/679

Re: Generating maps in assembly

I agree that maps should not be binary. They should take advantage of assembler constants wherever possible and being able to use a text editor is a must (vim by default will append a newline before filtering through xxd, and fixing that is already more work than just using a hex editor).

That said, binaries are not fixed width (any hex editor that can't change width is not worth your time). If you want to resize or crop a text file horizontally you run into problems.

It's not ideal, but a solution that can use centralized constants while retaining semantic value is charmaps (2 chars wide for aspect ratio and more obvious combinations of characters for blocks).

charmap "  ", BLK_GROUND
    charmap "gg", BLK_GRASS
    charmap "ww", BLK_WATER
    charmap "--", BLK_ROOF
    charmap "/-", BLK_ROOF_L
    charmap "-\", BLK_ROOF_R
    charmap "/=", BLK_LAB_ROOF_L
    charmap "==", BLK_LAB_ROOF
    charmap "=\", BLK_LAB_ROOF_R
    charmap "[_", BLK_LAB_L
    charmap "_]", BLK_LAB_R
    charmap "__", BLK_LAB
    charmap "[=", BLK_HOUSE_L
    charmap "=]", BLK_HOUSE_R
    charmap "[@", BLK_HOUSE_DOOR
    charmap "@]", BLK_DOOR_HOUSE
    charmap "@_", BLK_DOOR_LAB
    charmap "/\", BLK_TREE
    charmap "oo", BLK_ROCKS
    charmap "nn", BLK_FENCE
    charmap "ns", BLK_FENCE_SIGN
    charmap " s", BLK_SIGN_R
    charmap "~~", BLK_FLOWERS
    charmap "::", BLK_DIRT
    charmap "**", BLK_WALL_N
    charmap "oo", BLK_WALL_S
    charmap ":8", BLK_WALL_E
    charmap "8:", BLK_WALL_W
    charmap "*8", BLK_WALL_NE
    charmap "8*", BLK_WALL_NW
    charmap "o8", BLK_WALL_SE
    charmap "8o", BLK_WALL_SW
PalletTownBlocks::
    db "8*********gg*******8"
    db "8:  /--\    /--\  :8"
    db "8: s[=@]   s[@=]  :8"
    db "8:                :8"
    db "8:  nnns  /====\  :8"
    db "8:  ~~~~  [_@__]  :8"
    db "8:        nnnsnn  :8"
    db "8:::wwww  ~~~~::  :8"
    db "8o::wwwwooooooooooo8"

Last time this came up we decided it wasn't better.

Offline

#5 2015-01-13 18:34:20

piclarv
Member
Registered: 2015-01-05
Post 13/41

Re: Generating maps in assembly

Interesting that everyone has their preferences.  Danny, I thought about using that method and I might in the future, but I'm considering making maps from scratch for a new region, and as far as I can tell ClassicMap locks you into the dimensions of already existing maps.

Comet, that method seems awful. Lol, but thanks for sharing.

Offline

#6 2015-01-13 21:39:55

ShantyTown
Member
Registered: 2013-12-04
Post 173/344

Re: Generating maps in assembly

piclarv wrote:

Interesting that everyone has their preferences.  Danny, I thought about using that method and I might in the future, but I'm considering making maps from scratch for a new region, and as far as I can tell ClassicMap locks you into the dimensions of already existing maps.

Comet, that method seems awful. Lol, but thanks for sharing.

I can send you my map editor when I get home later today. It allows you to edit maps graphically and export them as binary, which you can copy paste into your rom.

Comet, that's a really awesome way of mapping!  I wish it's flaws weren't so big.

Offline

#7 2015-01-13 22:34:56

piclarv
Member
Registered: 2015-01-05
Post 16/41

Re: Generating maps in assembly

Thanks ShantyTown, you can send it to piclarv at gmail.com  -- does it run in Windows or Linux?

Offline

#8 2015-01-14 00:39:47

ShantyTown
Member
Registered: 2013-12-04
Post 174/344

Re: Generating maps in assembly

piclarv wrote:

Thanks ShantyTown, you can send it to piclarv at gmail.com  -- does it run in Windows or Linux?

I sent you the program.  It's a .jar, so it's cross-platform.  Although, it might require Java 7 to run.

Last edited by ShantyTown (2015-01-14 00:42:05)

Offline

#9 2015-01-14 13:04:30

pokeglitch
Member
Registered: 2013-02-20
Post 81/95

Re: Generating maps in assembly

ShantyTown, can you share it with me as well? (Or with the whole forum?) I've been using RedMap before I started with the disassembly, so I don't know what it's export options are.

Offline

#10 2015-01-14 15:38:13

piclarv
Member
Registered: 2015-01-05
Post 18/41

Re: Generating maps in assembly

ShantyTown, I just tried it out and that is great.  I hope you don't mind I am sharing it since there seems to be some interest.

Last edited by piclarv (2015-01-14 22:02:39)

Offline

#11 2015-01-14 21:24:16

ShantyTown
Member
Registered: 2013-12-04
Post 175/344

Re: Generating maps in assembly

piclarv wrote:

ShantyTown, I just tried it out and that is great.  I hope you don't mind I am sharing it since there seems to be some interest.  Pokeglitch, here you go.

http://bit.ly/1C0HP0p

I need to do some work on it before a public link is out. For example, the address of the tileset header pointers is hardcoded. Pokeglitch uses the disassembly, so if he changes bank 0, it's likely that address will change, which will break the map editor. Could I ask you to remove that link?  I'll post a better version in the next few days.

Offline

#12 2015-01-14 22:03:13

piclarv
Member
Registered: 2015-01-05
Post 19/41

Re: Generating maps in assembly

Will delete the file soon. Deleted link.

Offline

#13 2015-01-15 23:49:16

ShantyTown
Member
Registered: 2013-12-04
Post 178/344

Re: Generating maps in assembly

I've posted RBMap in the Tools/Resources section of the forum.

Offline

Board footer

Powered by FluxBB