Here is the way I have done it using the 9S08AW32. Should work the same.
Note: This was ported from some old 705 code, so the X register is used to manipulate and maintain a stack(used too much in the code to change this).
Hope it helps.
;
; Read in a Word from the EEPROM
; E - TOS = Address of the Word
; R - TOS & TOS+1 = Word Read
; L - A
;
RD_93XX:
LDA SPI1S ;dummy read to clear flags
LDA SPI1D ;dummy read to clear Data reg
LDA #$80 ;Add Read Command
STA ,X ;Save Command Bits
LDA 1,X ;Load Address from Para Stack
AND #$3F ;Mask Address Bits
ORA ,X ;Add Command Bits
STA 1,X ;Store on Parameter Stack
; write command
PUL_A ;Load Character from Stack
STA SPI1D ;Send Character
BSR WAIT_SPI ;wait for spi to finish
LDA SPI1D ;dummy read to clear Data reg
; READ BYTE
STA SPI1D ;dummy write
BSR WAIT_SPI ;wait for spi to finish
LDA SPI1D ;read byte
STA ,X ;store byte
DECX ;Dec Parameter Stack Ptr
; READ BYTE
STA SPI1D ;dummy write
BSR WAIT_SPI ;wait for spi to finish
LDA SPI1D ;read byte
STA ,X ;store byte
DECX ;Dec Parameter Stack Ptr
RTS ;return
;
; Write to EEPROM
; E - TOS = Address of EEPROM
; TOS+1 & TOS+2 = Word to be Sent
; R - none
; L - A
;
WR_93XX:
LDA SPI1S ;dummy read to clear flags
LDA SPI1D ;dummy read to clear Data reg
LDA #$40 ;Write Command
STA ,X ;Save Command Bits
LDA 1,X ;Load Address from Para Stack
AND #$3F ;Mask Address Bits
ORA ,X ;Add Command Bits
STA 1,X ;Store on Parameter Stack
; write command
PUL_A ;Load Character from Stack
STA SPI1D ;Send Character
BSR WAIT_SPI ;wait for spi to finish
LDA SPI1D ;dummy read to clear Data reg
JSR SWAP ; Swap Bytes
;write byte
PUL_A ; Load Character from Stack
STA SPI1D ; Send Character
BSR WAIT_SPI ;wait for spi to finish
LDA SPI1D ;dummy read to clear Data reg
;write byte
PUL_A ; Load Character from Stack
STA SPI1D ; Send Character
BSR WAIT_SPI ;wait for spi to finish
LDA SPI1D ;dummy read to clear Data reg
RTS
; WAIT FOR SPI TRANSFER TO COMPLETE
WAIT_SPI:
BRSET SPI1S_SPTEF,SPI1S,WAIT_SPI0 ; Check for Xmit Reg Empty
JSR PAUSE ; No Wait
BRA WAIT_SPI
WAIT_SPI0:
RTS