Fermer2
deleted2Le 06/10/2015 à 19:07
yop,

J'ai deux questions bien distinctes :

1. Comment produire l'appel d'un ramcall en fline en C ? Ce n'est pas supporté par TIGCC/GCC4TI via un switch, alors comment faire ?
J'ai clairement pas le niveau pour patcher ld-tigcc...
Pour rappel, il s'agit de produire le word 0xF000 + numéro du ramcall, avec les arguments sur la pile ou dans les registres.
Je suis prêt à utiliser des macros dégueulasses si c'est le seul moyen.


2. Comment appeler les ramcalls qui utilisent passent des arguments dans des registres aux fonctions appelées ?
Je pense par exemple à LibsExec :
35-kernel::LibsExec(char *lib_name, WORD function, BYTE version, ...)	(Preos only)

	The parameters are pushed on the stack.
	It calls the function without modifying the registers, and it pops its argument 
	during the call (LIB_DESCRIPTOR, function, and version).
	BYTE doesn't follow the C convesion for char (Sorry). Uses macro instead.

	It relocs the library, calls the function and unreallocs the library.
	The parameters pushed on the stack are corrupted.
	If there is an error, the parameter 'lib_name' equals zero after the call.

	Destroy:
		Like the called function

	Example:
		pea	arg2function		; Arg2 of the function
		move.w	#arg1function,-(a7)	; Arg1 of the function
		move.b	#1,-(a7)		; Version 1
		move.w	#3,-(a7)		; Function 3
		pea	LibsName		; Libs Name
		move.w	#145,d0			; D0 = 145 for the function !
		jsr	kernel::LibsExec
		tst.l	(a7)
		lea	(4+2+2+2+4)(a7),a7	; Does not affect the flag
		beq.s	\error
		...

	LibsName	dc.b	"totolib",0
En l'occurence, j'ai une fonction dont le proto prend des arguments par registres, mais comment dire ça au proto de LibsExec, qui va tout vouloir passer sur la pile ?

L'include de Pedrom définit ça :
#define	kernel_LibsExec	_RAM_CALL_1D
__attribute__((__stkparm__)) void kernel_LibsExec(char *name, short function, char version, ...);
Faut-il que j'écrive quelque chose comme ça pour faire l'appel qui me convient :
void modified_LibsExec(char *name, short function, char version, int truc asm("%d0"));
#define	modified_LibsExec	_RAM_CALL_1D
Dans l'idée, c'est ça ?