from data sheet


Serial Data to Output Valid— — 450 ns
CS Setup Time 50 nS


a 3mS pause is way to long


SetPort_A:
OutA_hi=OutA.highbyte 'Splits into hibyte
OutA_lo=OutA.lowbyte 'And into low byte of the word var
OutA_MCPReg = OLATA 'Sets up PORTA output
OutA_DataOut=OutA_lo 'Sets up data to be pushed to the MCP23S17 as the low byte
gosub SEND_OutA_2317 'Send it
pause 3 'Wait a bit cannot see that this is necessary or even adds any value
OutA_MCPReg = OLATB 'Sets up PORTB output
OutA_DataOut=OutA_hi 'Sets up data to be pushed to the MCP23S17 as the hi byte
gosub SEND_OutA_2317 'Send it
return

if you want speed why set only 1 bit at a time when they all are going to be set anyway

for i=0 to 15 : OutA.0[i]=1 : gosub SetPort_A : next i
Code:
OutA=$ffff
gosub SetPort_A
would be 15 times faster