Having big issues using memcpy/memmove and custom routines to do the same.

Discussion in 'Sega Dreamcast Development and Research' started by Mrneo240, Feb 15, 2018.

  1. Mrneo240

    Mrneo240 Gutsy Member

    Joined:
    Sep 15, 2017
    Messages:
    462
    Likes Received:
    571
    Hi,

    Back again with hopefully one of tha last "simple" questions I have.
    I'm currently trying to copy some memory (500kb) from one place to another, doing this immediately freezes my program.

    How (without Kos, newlib) can I copy this data? Is it because I'm naively doing? Should I try to keep things memory aligned (32 bit aligned?)?

    Thanks for the help to what I assume will be an easy question.

    Btw im moving from 0xACC00000 to 0xAC010000, which should just be the uncached version of 0x8C010000 (EIP of 1st_read.bin)

    For the people pointing out that I'm overwriting my current program, I'm not running from 0x8C01000, it's from a completely different place in memory.

    Code:
    Void memmove(void *dest, void *src, int Len)
    {
    Char *_dest=(char*)dest;
    Char *_src=(char*)src;
    
    Int I;
    For(I=0;I<Len;I++)
        *(_dest+I) = _src[I];
    }
     
    fafadou and TerdFerguson like this.
  2. Xerxes3rd

    Xerxes3rd Rapidly Rising Member

    Joined:
    Sep 1, 2016
    Messages:
    96
    Likes Received:
    35
    I don’t think you need to be dereferencing ‘dest’

    When in doubt, examine the source code for memcpy =)
     
  3. Mrneo240

    Mrneo240 Gutsy Member

    Joined:
    Sep 15, 2017
    Messages:
    462
    Likes Received:
    571
  4. yzb37859365

    yzb37859365 Spirited Member

    Joined:
    Jul 14, 2013
    Messages:
    187
    Likes Received:
    124
    Is it your own program or the program segment added to the original game?
    You can upload the 2 - band SH4 assembler bin file to see


    是你自己写的程序还是在原游戏中添加的程序段?
    你可以上传2进制的sh4汇编bin文件上来看看
     
    Last edited: Feb 16, 2018
    Mrneo240 and fafadou like this.
  5. Mrneo240

    Mrneo240 Gutsy Member

    Joined:
    Sep 15, 2017
    Messages:
    462
    Likes Received:
    571
    Found out the issue. It was an issue with overwriting something that I didn't know existed.
     
  6. Mrneo240

    Mrneo240 Gutsy Member

    Joined:
    Sep 15, 2017
    Messages:
    462
    Likes Received:
    571
    Thanks for all the help! Its finished! (still not quite ready for a source level release but the binary will be out soon)

    A new configurable IP.BIN with basic patching, boots scrambled/unscrambled binaries, can do other stuff. should be comparable with ECHELON's but much more powerful!
     
    fafadou and Xerxes3rd like this.
sonicdude10
Draft saved Draft deleted
Insert every image as a...
  1.  0%

Share This Page