Conversation Between jiangzhengwenjzw and Blah
Showing Visitor Messages 31 to 45 of 89
-
April 6th, 2016 11:18 PMjiangzhengwenjzwHi, 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? -
April 1st, 2016 7:51 PMjiangzhengwenjzwYes, 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.
-
April 1st, 2016 7:43 PMBlahAh, thanks for confirming. I had a feeling the compiler was smart enough to handle that, but wasn't 100% sure :)
-
April 1st, 2016 7:41 PMjiangzhengwenjzwI'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. ) -
April 1st, 2016 6:43 PMBlahI'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! -
April 1st, 2016 6:18 PMjiangzhengwenjzwOk, 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? -
April 1st, 2016 8:53 AMBlahDon't add +1 in C.
-
April 1st, 2016 8:36 AMjiangzhengwenjzwHi, 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. -
March 26th, 2016 5:58 PMjiangzhengwenjzwI 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 -
March 26th, 2016 8:32 AMBlahModify the make file? I don't know, why can't you use the Python files? Just download python :o
-
March 26th, 2016 7:54 AMjiangzhengwenjzwI think the main difference between us is that I'm using make but you're not using it. Should I modify it and how?
-
March 26th, 2016 7:32 AMBlahI have no idea. I'm able to compile this source code http://imgur.com/AHT42gw
-
March 26th, 2016 7:24 AMjiangzhengwenjzwI've tried it, but still not working.
See it: http://www.mediafire.com/download/v8dhdt6ih1kz8it/test1.zip -
March 26th, 2016 7:20 AMBlahyou needed to do "extern void func_2();"
Don't put the void inside the brackets. They mean different things. -
March 26th, 2016 5:42 AMjiangzhengwenjzwSee it, I've tried :(
http://www.mediafire.com/download/qqgj0pbr74rkbrd/test0.zip

