Datasheet
PSoC Designer IDE Guide, Document # 001-42655 Rev *B 101
Assembler
For example, an assembly function that is passed a single byte as a parameter and has no return
value looks like this:
C function declaration (typically in a .h header file)
#pragma fastcall16 send_byte
void send_byte( char val);
C function call (in a .c file)
send_byte( 0x37);
Assembly function definition (in an .asm file)
export _send_byte
; Fastcall16 inputs (single byte)
; A – data value
; Fastcall16 return value (none)
_send_byte:
mov reg[ PRT1DR],A
ret
An assembly function that is passed two bytes and returns one byte might look like this:
C function declaration (typically in a .h header file)
#pragma fastcall16 read_indexed_reg
char read_indexed_reg( char bank, char index);
C function call (in a .c file)
val = read_indexed_reg( 0x01, index);
Assembly function definition (in an .asm file)
export read_indexed_reg
; Read byte from specified IO register
; Fastcall16 inputs (two single bytes)
; A – bank number (0 or non-zero)
; X – register number
; Fastcall16 return value (single byte)
; A – read data
_read_indexed_reg:
cpl A
jnz get_data:
or F, FLAG_XIO_MASK; switch to bank 1
get_data:
mov A, reg[X]
and F, ~FLAG_XIO_MASK; make sure we’re in bank 0
ret