Everything
4.2.7 Intrinsic functions

CC-RL provides the following "intrinsic functions". The intrinsic functions can only be called from function definitions.

The instructions that can be described as functions are as follows.

Table 4.16

Intrinsic Function

Intrinsic
Function

Function

Format

__DI

Outputs a DI instruction.

void __DI(void);
__EI

Outputs a EI instruction.

void __EI(void);
__halt

Outputs a HALT instruction.

void __halt(void);
__stop

Outputs a STOP instruction.

void __stop(void);
__brk

Outputs a BRK instruction.

void __brk(void);
__nop

Outputs a NOP instruction.

void __nop(void);
__rolb

Rotates x to the left y times assuming that x has a size of eight bits.

Operation is undefined for the case where the rotation count is greater than the size of the value.

If the rotation count may be greater than the size, mask the count to not exceed the size.

unsigned char __rolb(
    unsigned char x,
    unsigned char y
);
__rorb

Rotates x to the right y times assuming that x has a size of eight bits.

Operation is undefined for the case where the rotation count is greater than the size of the value.

If the rotation count may be greater than the size, mask the count to not exceed the size.

unsigned char __rorb(
    unsigned char x,
    unsigned char y
);
__rolw

Rotates x to the left y times assuming that x has a size of 16 bits.

Operation is undefined for the case where the rotation count is greater than the size of the value.

If the rotation count may be greater than the size, mask the count to not exceed the size.

unsigned int __rolw(
    unsigned int x,
    unsigned char y
);
__rorw

Rotates x to the right y times assuming that x has a size of 16 bits.

Operation is undefined for the case where the rotation count is greater than the size of the value.

If the rotation count may be greater than the size, mask the count to not exceed the size.

unsigned int __rorw(
    unsigned int x,
    unsigned char y
);
__mulu

Executes unsigned multiplication between (unsigned int)x and (unsigned int)y and returns a 16-bit result.

unsigned int __mulu(
    unsigned char x,
    unsigned char y
);
__mului

Executes unsigned multiplication between (unsigned long)x and (unsigned long)y and returns a 32-bit result.

unsigned long __mului(
    unsigned int x,
    unsigned int y
);
__mulsi

Executes signed multiplication between (signed long)x and (signed long)y and returns a 32-bit result.

signed long __mulsi(
    signed int x,
    signed int y
);
__mulul

Executes unsigned multiplication between (unsigned long long)x and (unsigned long long)y and returns a 64-bit result.

unsigned long long __mulul(
    unsigned long x,
    unsigned long y
);
__mulsl

Executes signed multiplication between (signed long long)x and (signed long long)y and returns a 64-bit result.

signed long long __mulsl(
    signed long x,
    signed long y
);
__divui

Executes unsigned division between x and y and returns a 16-bit result.

When divisor y is 0, 0xFFFF is returned.

unsigned int __divui(
    unsigned int x,
    unsigned char y
);
__divul

Executes unsigned division between x and y and returns a 32-bit result.

When divisor y is 0, 0xFFFFFFFF is returned.

unsigned long __divul(
    unsigned long x,
    unsigned int y
);
__remui

Executes unsigned remainder operation between x and y and returns a 8-bit result.

When divisor y is 0, the lower-order 8 bits of dividend x are returned.

unsigned char __remui(
    unsigned int x,
    unsigned char y
);
__remul

Executes unsigned remainder operation between x and y and returns a 16-bit result.

When divisor y is 0, the lower-order 16 bits of dividend x are returned.

unsigned int __remul(
    unsigned long x,
    unsigned int y
);
__macui

Executes unsigned multiply-accumulate operation (unsigned long) x * (unsigned long) y + z, and returns a 32-bit result.

unsigned long __macui(
    unsigned int x,
    unsigned int y,
    unsigned long z
);
__macsi

Executes unsigned multiply-accumulate operation (signed long) x * (signed long) y + z, and returns a 32-bit result.

signed long __macsi(
    signed int x,
    signed int y,
    signed long z
);
__get_psw

Returns the contents of PSW.

unsigned char   __get_psw(void);
__set_psw

Sets x to PSW.

void __set_psw(unsigned char x);
__set1

The set1 instruction is used to set bit y of the address indicated by x to 1.

Only a constant from 0 to 7 can be specified for bit y and a compile error will occur when any other value is specified.

void __set1(
    unsigned char __near *x,
    unsigned char y
);
__clr1

The clr1 instruction is used to clear bit y of the address indicated by x to 0.

Only a constant from 0 to 7 can be specified for bit y and a compile error will occur when any other value is specified.

void __clr1(
    unsigned char __near *x,
    unsigned char y
);
__not1

The not1 instruction (xor instruction for the saddr area) is used to invert bit y of the address indicated by x.

Only a constant from 0 to 7 can be specified for bit y and a compile error will occur when any other value is specified.

void __not1(
    unsigned char __near *x,
    unsigned char y
);