Conversation Between jiangzhengwenjzw and Blah
31 to 45 of 89
  1. jiangzhengwenjzw
    April 6th, 2016 11:18 PM
    jiangzhengwenjzw
    Hi, a question.
    To show an image in BG0, I want to write the tiles and tilemap into VRAM and pal into the pal buffer.
    However, this way has an obvious problem that the BG map will be drawn almost instantly, but the pal won't be copied to the PALETTE RAM instantly. Therefore, there will be a short period of time within which the image will be shown but the palette won't be correct. Do you have any idea of this kind of issue?
  2. jiangzhengwenjzw
    April 1st, 2016 7:51 PM
    jiangzhengwenjzw
    Yes, its smartness is beyond my imagination. I expected an error when the type of function pointer is not compatible with the declaration but there're only some warnings.
  3. Blah
    April 1st, 2016 7:43 PM
    Blah
    Ah, thanks for confirming. I had a feeling the compiler was smart enough to handle that, but wasn't 100% sure :)
  4. jiangzhengwenjzw
    April 1st, 2016 7:41 PM
    jiangzhengwenjzw
    I've tried and found that there's no need to +1, and even if the type of the function pointer is not compatible with the declaration of task_add, it worked!
    (I declared it by using "u8 task_add (void (*fp) (u8), u8);" but it won't get an error by using the pointer of "u16 rand (void);" as an argument. )
  5. Blah
    April 1st, 2016 6:43 PM
    Blah
    I'm not 100% sure about that example with rand actually.

    I know you'd need to define the function header for "rand" inorder to be able to even use it as a parameter, but in general adding +1 in BPRE.ld should not affect functionality (I'm not 100% sure, just pretty sure).

    You can for example do this:

    void task_example(u8 task_id) {
    return;
    }

    void set_task() {
    task_add(task_example, 0x1);
    task_add(task_example + 1, 0x1);
    }

    I think both of those task_add will work. Try to compile it and check!
  6. jiangzhengwenjzw
    April 1st, 2016 6:18 PM
    jiangzhengwenjzw
    Ok, so i should just use task_add(another, 1)?
    Then I'm a bit confused with the existing functions in FR.
    I define the offsets of the functions used in the project in something like the ".ld" (the file used by ld) and we +1 (or |1) to the offsets.
    So what if we want to use the pointers to them? for example:
    in the file xx.ld: rand = 0x8044ec9;
    in the souce code: task_add(rand, 1) //I know it's no use to add rand as a task, but just an example

    Is it correct?
  7. Blah
    April 1st, 2016 8:53 AM
    Blah
    Don't add +1 in C.
  8. jiangzhengwenjzw
    April 1st, 2016 8:36 AM
    jiangzhengwenjzw
    Hi, I just thought of another problem.
    As you know, some functions takes function pointers as parameters and will it be correct to use the following in C?
    //declarations
    int first()
    {
    task_add(another+1, 1);
    return 0;
    }

    void another(void)
    {
    //stuff
    }

    The main problem is that i don't know what will happen if i add 1 to a function pointer, because i haven't done it when I'm learning C programming.
  9. jiangzhengwenjzw
    March 26th, 2016 5:58 PM
    jiangzhengwenjzw
    I simply want to use something I can control and understand haha
    But for the makefile I have no idea, because i simply use gcc, ld & objcopy, I may give python a try
  10. Blah
    March 26th, 2016 8:32 AM
    Blah
    Modify the make file? I don't know, why can't you use the Python files? Just download python :o
  11. jiangzhengwenjzw
    March 26th, 2016 7:54 AM
    jiangzhengwenjzw
    I think the main difference between us is that I'm using make but you're not using it. Should I modify it and how?
  12. Blah
    March 26th, 2016 7:32 AM
    Blah
    I have no idea. I'm able to compile this source code http://imgur.com/AHT42gw
  13. jiangzhengwenjzw
    March 26th, 2016 7:24 AM
    jiangzhengwenjzw
    I've tried it, but still not working.
    See it: http://www.mediafire.com/download/v8dhdt6ih1kz8it/test1.zip
  14. Blah
    March 26th, 2016 7:20 AM
    Blah
    you needed to do "extern void func_2();"

    Don't put the void inside the brackets. They mean different things.
  15. jiangzhengwenjzw
    March 26th, 2016 5:42 AM
    jiangzhengwenjzw