Finally got all the machine code working. Had to reengineer the call and procedure machine code a bit from the recommend instructions, but all tests pass.