You can take a look at the Assembler part of FIOLIB to see how it passes variables over. May it helps a bit. [nb]See files RUNC-64K.MAX and RUNC-X16.MAX on DSK. Please use VaraDOS, VDOS or X-DDOS for reading DSK in Vortex Format.[/nb]
The assembly code hasn't really given me any real insight unfortunately, I know that to use the oscall routine an array called regs[number] has been setup to pass values to that oscall. there's examples of this which I posted on the 1st page of this thread, along with the oscall routine, the different numbers in the regs array reflect the registers used (af,hl,de & bc I think in that order from 0 to 3). Obviously the oscall routine has 2 parameters, the first being the address to call the external routine - what the oscall routine does here is setup a jump routine by poking address 30h with c3 and HL which goes into 31 & 32 is obviously the address for the call, so when it's ready to be called - rst 30h.
What I don't get with the oscall routine is all the POPping - BC,DE,HL followed by PUSHing HL,DE & BC, DE gets PUSHed again after the address routine has been setup. ex (sp),ix is then applied - I'm not sure what that means, ex is an exchange instruction, I'm not sure why it has to exchange with the stack pointer - the contents of the stack pointer would go into the Index Register I presume and then it gets switched over again once the locations & contents of the Index Registers have been placed into their rightful registers.
The routine I wanted to write to pass values from small-c to Assembly is a bit different, in my case I want to designate the xpos & ypos in order to use those to plot that image to screen. oscall is a bit different in that it has to accommodate whatever gets thrown back at it, so anything which uses A,HL,DE or BC probably has to go through all that POPing & PUSHing regardless. My routine only has to worry about DE & HL (presumably) which would have DE & HL, the address of the image I'm doing internally, cause it would be easier to feed the colour data of the image from some M/C data, I could possibly use oscall to call the routines, but I thought it would be faster to keep it all Assembly and call the address from the routine itself.