You can just copy some of the verbs from MotS...for the most part. First off, you have to think about which ones will most likely work if copied; the two AI verbs I added were copied from MotS, and I was pretty certain they would work in JK. FindSectorAtPos would probably work in JK too, though I can't tell for sure by just looking at it (it makes some calls to other functions which may or may not be in JK, but they probably are since JK needs to be able to do the equivalent of FindSectorAtPos anyway). You have to look out for some problems when copying things over. The addresses for the get parameter and set return value functions will be different, and some structures will be different too (some values will be in different locations or missing, depending on what got added in MotS). The best way to deal with this is to look at a similar function that is already in JK to figure out where the differences are. I looked at another similar AI function and was able to get the JK locations for the get parameter / set return value functions as well as figure out which offsets in the different structures in memory would be different (for example, the pointer to the AI data was at +0x278 instead of +0x284 in the thing struct).
PUSH will push the value onto the stack and decrease the stack pointer (ESP), it is used when passing variables to a function that is about to be called. You will see functions add or subtract amounts from ESP, the stack pointer, to either make room for local variables or to take care of adding/removing variables passed to a function.
Here's a rundown of the VectorDot function:
00506610 SUB ESP,18 ; make room for temps (0x18, 24 bytes, or 6 floats)
00506613 LEA EAX,DWORD PTR SS:[ESP] ; eax = pointer to temp vector (LEA stores the address calculated in the second parameter into the first, in this case it is pointless I think since it is just doing eax = esp)
00506617 PUSH ESI ; pushes ESI (just storing it to be popped back to its original state later)
00506618 MOV ESI,DWORD PTR SS:[ESP+20] ; esi = pointer to cog info, which is a parameter to all cog verb functions (ESP+20 because we just pushed ESI (ESP - 4) and we also made room for 24 temp bytes (ESP - 0x18)
0050661C PUSH EAX ; arg2 = pointer to temp vector
0050661D PUSH ESI ; arg1 = pointer to cog info
0050661E CALL JKCogRep.004E26E0 ; get parameter (this function is specific to getting a vector parameter, there are others for other types)
00506623 ADD ESP,8 ; restore stack (8 bytes in params, so add 8), eax = 1 edx = vector param ecx = vector.x (registers can hold return values or just be leftovers from the function called)
00506626 LEA ECX,DWORD PTR SS:[ESP+10] ; address of local temp vector 2 (keeping track of ESP can get confusing since the compiler can mangle things, ie ESP +10 for the second temp vector, rather than ESP+0C due to pushing ESI at 0x00506617)
0050662A PUSH ECX ; arg2 = pointer to temp vector 2
0050662B PUSH ESI ; arg1 = pointer to cog info
0050662C CALL JKCogRep.004E26E0 ; get next param
00506631 FLD DWORD PTR SS:[ESP+10] ; load vector1.y; the FPU works with a stack. FLD pushes the second param onto the top of the stack. (gets confusing now, after 0x00506610 vector1.x was ESP + 0, after 0x00506617 it was ESP + 4, now it is ESP + C due to not adjusting ESP after the last function call)
00506635 FLD DWORD PTR SS:[ESP+C] ; load vector1.x (v1.x, v1.y)
00506639 FMUL DWORD PTR SS:[ESP+18] ; multiply v1.x * v2.x (v1.x * v2.x, v1.y)
0050663D FLD DWORD PTR SS:[ESP+14] ; load vector1.z (v1.z, v1.x * v2.x, v1.y)
00506641 FXCH ST(2) ; exchange the 3rd item on the stack with the top (v1.y, v1.x * v2.x, v1.z)
00506643 FMUL DWORD PTR SS:[ESP+1C] ; multiply v1.y * v2.y (v1.y * v2.y, v1.x * v2.x, v1.z)
00506647 FXCH ST(2) ; exchange the 3rd item on the stack with the top (v1.z, v1.x * v2.x, v1.y * v2.y)
00506649 FMUL DWORD PTR SS:[ESP+20] ; multiply v1.z * v2.z (v1.z * v2.z, v1.x * v2.x, v1.y * v2.y)
0050664D FXCH ST(2) ; exchange (but what for?) (v1.y * v2.y, v1.x * v2.x, v1.z * v2.z)
0050664F FADDP ST(1),ST ; add to the 2nd item, pop the 1st (v1.x * v2.x + v1.y * v2.y, v1.z * v2.z)
00506651 FXCH ST(1) ; exchange (v1.z * v2.z, v1.x * v2.x + v1.y * v2.y)
00506653 ADD ESP,8 ; restore stack, esp = pointer to cog info
00506656 FADDP ST(1),ST ; add (v1.x * v2.x + v1.y * v2.y + v1.z * v2.z)
00506658 PUSH ECX ; pushes ecx, then overwrites the spot on the stack with rval
00506659 FSTP DWORD PTR SS:[ESP] ; arg2 = return value (top of floating point stack gets stored at ESP, then popped)
0050665C PUSH ESI ; arg1 = pointer to cog info
0050665D CALL JKCogRep.004E33C0 ; set return value
00506662 ADD ESP,8 ; restore stack
00506665 POP ESI ; restore esi from 0x00506617
00506666 ADD ESP,18 ; restore stack (temps)
00506669 RETN
I've found it is kind of hard to find references in google for assembly instructions...here is one I just now found for the floating point instruction set:
http://webster.cs.ucr.edu/AoA/Windows/HTML/RealArithmetica2.html
You can probably find all of the assembly instructions if you look hard enough at the Intel or AMD website.
It is harder to follow this stuff because it has been generated by a compiler, and you might notice some of it doesn't really make sense, despite getting the job done.
For now try altering some of the existing functions. Then if you want to add your own, look at the exe I posted, since it already has room for more functions.
Here are some important addresses in the exe I posted:
8f4000 - entry (look here to register more verbs)
8f5000 - sqrt 8f4a00
8f5030 - sin 8f4a08
8f5060 - cos 8f4a10
8f5090 - aigetalignment 8f4a18
8f50E0 - aisetalignment 8f4a28
the second address is where I put the string with the function name
One confusing thing you might run into in some of the functions is something like TEST EAX,EAX followed by JE some_address. This seems to get used a lot to check if a pointer is null, and if so then jump to some other point. CMP is another test function, it really just works a lot like SUB a, b in that it does a subtraction to see if they are equal or not...so you might see it followed by a JNZ (jump if not zero, ie not equal).
Best way to figure some of these things out (which function pointer to use for getting a certain type of parameter or setting a return value) is to look at other functions that have the same parameter or return value types.