Hi Nathan,
I have been having fun using the assembly level programming and working on the PS2 controller code. As you mentioned in another post, if I get this to work reasonably well you might convert it into a command. To make this easier I was wondering if you have some defined coding standards. In particular do you have a standard way you pass paramters between subroutines and registers you save and destroy and a standard way to setup a call frame.
Looking at what the C compiler generates, it looks like it passes the first three parameters in registers R0-R2. Any additional registers are stored on the stack and the caller is responsible for cleaning up the stack after the call. I know that ER7 is the stack pointer. It appears like the C compiler sets up ER6 as a stack frame pointer. They generally appear to setup the stack with code something like:
Mysub:
push er6
mov.l er7, er6
sub.l #<Local Size?, er7
...
; end of the function
add.l #<the size>,er7
pop.l er6
rts
The reason I am looking at this is the current function I am updating uses temporary localized in scope variables. Probably the better way would be for me to define these on the stack local to the function, but so far I have done it the lazy way of defining the variables in basic and simply using them… Suggestions?
Kurt