Issue #14 resolved

baserom.gbc pokered.gbc differ: byte 335, line 1

John Mothershed
created an issue

It assembles and links just fine except the rom differs, I'm guessing I have the wrong rom but I've downloadd the exact one you mentioned from 3 different sources and am beggining to wonder if this is an error.

Comments (12)

  1. John Mothershed reporter

    Sorry for the late reply, I'll be watching this more closely.

    Yes, it comes out exactly the same. I had installed the project on Linux so I tried it on Windows with same error. I've actually tripped checked the md5.

    This is the output:

    $ make
    awk -f textpre.awk < pokered.asm > pokered.tx
    rgbasm -o pokered.o pokered.tx
    Output filename pokered.o
    Assembling pokered.tx
    Pass 1...
    Pass 2...
    Success! 47982 lines in 1.19 seconds (2407123 lines/minute)
    rgblink -o pokered.gbc pokered.o
    rgbfix -jsv -k 01 -l 0x33 -m 0x13 -p 0 -r 03 -t "POKEMON RED" pokered.gbc
    cmp baserom.gbc pokered.gbc
    baserom.gbc pokered.gbc differ: byte 335, line 1
    Makefile:18: recipe for target `pokered.gbc' failed
    make: *** [pokered.gbc] Error 1
    

    This is the MD5 output:

    $ md5deep baserom.gbc
    3d45c1ee9abd5738df46d2bdda8b57dc  #####/pokered/baserom.gbc
    
  2. iimarckus repo owner

    There is something different in your build environment.

    We’ve had problems before with GNU awk messing things up due to locale issues. What is your value of LC_CTYPE? Try “make clean” and then “LC_CTYPE=en_US.UTF-8 make”. If that fixes things, you should probably set LC_CTYPE in your .bashrc or equivalent file.

  3. John Mothershed reporter

    It didn't fix it

    result of cleaning:

    $ make clean
    rm -f pokered.tx pokered.o pokered.gbc redrle text/oakspeech.tx text/pokedex.tx text/mapRedsHouse1F.tx  text/mapBluesHouse.tx text/mapPalletTown.tx
    

    result of build with custom parameter:

    $ LC_CTYPE=en_US.UTF-8 make
    awk -f textpre.awk < pokered.asm > pokered.tx
    awk -f textpre.awk < text/oakspeech.asm > text/oakspeech.tx
    awk -f textpre.awk < text/pokedex.asm > text/pokedex.tx
    awk -f textpre.awk < text/mapRedsHouse1F.asm > text/mapRedsHouse1F.tx
    awk -f textpre.awk < text/mapBluesHouse.asm > text/mapBluesHouse.tx
    awk -f textpre.awk < text/mapPalletTown.asm > text/mapPalletTown.tx
    rgbasm -o pokered.o pokered.tx
    Output filename pokered.o
    Assembling pokered.tx
    Pass 1...
    Pass 2...
    Success! 47982 lines in 1.15 seconds (2481827 lines/minute)
    rgblink -o pokered.gbc pokered.o
    rgbfix -jsv -k 01 -l 0x33 -m 0x13 -p 0 -r 03 -t "POKEMON RED" pokered.gbc
    cmp baserom.gbc pokered.gbc
    baserom.gbc pokered.gbc differ: byte 335, line 1
    Makefile:18: recipe for target `pokered.gbc' failed
    make: *** [pokered.gbc] Error 1
    
  4. John Mothershed reporter

    I went on and downloaded another ROM whose MD5 and name matched but it gave off the same error. This error is the same on 2 different platforms (Windows and Linux). I went on ahead and tried to play the generated ROM anyway because I'm out of options but it didn't play.

    I don't know where the problem's coming from it seems to compile and link perfectly and the ROM appears to be the correct ROM.

  5. iimarckus repo owner

    Your ROM is fine.

    Your pokered.tx shows that Unicode characters like é are not correctly translated. This has happened before due to locale issues with awk. Did you test the LC_CTYPE fix on Linux, or just Windows? (If you didn’t try it on Linux yet, please do so.)

    If the above really doesn’t work, run “make clean”, then try replacing “awk -f” with “awk -b -f” in the Makefile, and try again on both Linux and Windows.

  6. John Mothershed reporter

    Yes, the -b option made everything compile and link fine on Windows but Linux complains and says there's no such option as -b. I've even looked over the man page for awk on Windows and Linux and it's present on Windows but not on Linux. Perhaps this is an issue for my copy of Linux.

    Anyways, it compiled just fine on Windows with -b. I had tried the LC_CTYPE on Linux as well before but that didn't help either.

  7. Bryan Bishop

    Oops, I was wrong. LC_CTYPE=UTF-8 is probably not a valid collation. LC_CTYPE sets the order things sort in; presumably it's needed for awk's hashmap implementation. So, LC_CTYPE=en_US.UTF-8 does not work for us because, unlike UTF-8, en_US.UTF-8 is a valid collation choice, allowing it to make decisions like "a" and "A" being the same character. LC_CTYPE=C will sort by the binary value of the string. "C" is apparently the default when a bad value is given (like "UTF-8" or "asdfjkl").

    So, that's how UTF-8 "worked". What you really want is LC_CTYPE=C and not UTF-8 and not en_US.UTF-8. I recommend you add this line to your ~/.bashrc or whatever awful shell you're using:

    export LC_CTYPE=C

    Note that this is separate from LC_COLLATE, which controls stuff like "McNames" being sorted as if the "Mc" was a single character.

  8. Log in to comment