[cc65] a question about the write function

From: Jac Ato <jaxatwork11gmail.com>
Date: 2007-02-10 23:58:38
In an attempt to implement the printf function on my embedded system,
I wanted to reroute any queries that are sent through printf to my
serial function: uart_send_char(char c). But I have failed to do
exactly that. I've noticed that on the platform that I am working on,
a modified NES with a serial port, I cannot get cc65 to generate a
working binary file with the code below. It just wont get to the part
of the write function. This was checked through my NES simulator. So
what is the best way of doing the above idea? I have something like:

int main (void){
	printf("hello%d", 2);
	while(1)
	return EXIT_SUCCESS;
}

int __fastcall__ write (int fd, const void* buf, unsigned count){
	char* temp=buf;
	char i=0;
	do{uart_send_char(temp[i++]);}
	while(count--);
}

I know that fastcall will get the right most parameter (is it count?)
from a register instead of the stack, so that my implementation is
probably wrong. But just to give an idea, this is what I want to do.
Also, what does fd represents?

Thanks for any help.
JA
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Sat Feb 10 23:58:52 2007

This archive was generated by hypermail 2.1.8 : 2007-02-10 23:58:55 CET