This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to insert Assembly code into C code

I have got this code which insert Assembly code into C code. How can the parameter of the function,tx_buffer be passed into the assembly? Also what is the value of R7 in the first line? And how can it return a unsigned char?


unsigned char DriverLoadHeader(unsigned char tx_buffer)
{
#pragma asm
	MOV A, R7
	MOV R1, A
	INC R1
	MOV R0,#HEADER_SIZE

;Reset to TX FIFO
	MOV A, #10
	MOV DPTR, #SCR2
	MOVX @DPTR, A

	MOV DPTR, #TX_FIFO
LOAD_LOOP:
	MOV A, @R1
	MOVX @DPTR, A
	INC R1

	DJNZ R0,LOAD_LOOP


#pragma endasm
	return 1;
}

0