Hi Eliezer,
The KA8 is neither an S08 or an HC08, but an RS08, so the assembly language code may not work (I have never used an RS08, as I consider them brain-damaged.
But here is my I2C macro file anyway. IYou use it by stringing I2C commands together, such as this routine from an HC08 project:
;
;
; Read all just the motor limit parameters from the EEPROM,
; from the page pointed to by 'ParameterPage'. The parameters
; we need to read are 'MinPosition' and 'MaxPosition'.
;
ParamLoadLimits:
EE_READ ParameterPage,#(MinPosition-EEP_Start),EER_ERR2
;node page, byte in EEPROM, error exit
;
EE_BYTE_IN ;get a data byte from EEPROM
EE_ACK ;ACK it to continue
sta MinPosition ;store the data byte
;
EE_BYTE_IN ;get a data byte from EEPROM
EE_ACK ;ACK it to continue
sta MinPosition+1 ;store the data byte
;
EE_BYTE_IN ;get a data byte from EEPROM
EE_ACK ;ACK it to continue
sta MinPosition+2 ;store the data byte
;
EE_BYTE_IN ;get a data byte from EEPROM
EE_ACK ;ACK it to continue
sta MaxPosition ;store the data byte
;
EE_BYTE_IN ;get a data byte from EEPROM
EE_ACK ;ACK it to continue
sta MaxPosition+1 ;store the data byte
;
EE_BYTE_IN ;get a data byte from EEPROM
EE_NAK ;NAK it to make it stop
sta MaxPosition+2 ;store the data byte
;
; done reading bytes
;
EE_STOP ;and issue the stop sequence.
;
jsr SetLimits ;update the DSP on the situation
clc ;clear carry
rts ;return happy with carry clear
;
;
; EEPROM error routine for a Read of limit parameters.
;
EER_ERR2:
EE_STOP ;drop the EEPROM
ErrLog E_EEPRMread ;"EEPROM Read Error"
sec ;set carry
rts ;return empty handed with carry set