Built-in Routines

The mikroBasic PRO for FT90x compiler provides a set of useful built-in utility functions. Built-in functions do not have any special requirements. You can use them in any part of your project.

The Delay_us and Delay_ms routines are implemented as “inline”; i.e. code is generated in the place of a call, so the call doesn’t count against the nested call limit.

The Vdelay_ms, Vdelay_advanced_ms, Delay_Cyc, Delay_Cyc_Long, Get_Fosc_kHz and Get_Fosc_Per_Cyc are actual Basic routines. Their sources can be found in the __Lib_Delays.mbas file located in the Uses folder of the compiler.

Lo

Prototype

sub function Lo(dim Argument as byte..float) as byte

Description

Function returns the lowest byte of Argument. Function does not interpret bit patterns of Argument – it merely returns 8 bits as found in register.

This is an “inline” routine; code is generated in the place of the call, so the call doesn’t count against the nested call limit.

Parameters
  • Argument: input value. Can be 16-bit or 32-bit value.
Returns

Lowest 8 bits (byte) of Argument, bits 7..0.

Requires

Arguments must be variable of scalar type (i.e. Arithmetic Types and Pointers).

Example
d = 0x12345678 	
tmp = Lo(d)  ' Equals 0x78

Lo(d) = 0xAA ' d equals 0x123456AA
Notes

None.

Hi

Prototype

sub function Hi(dim Argument as as word..float) as byte

Description

Function returns next to the lowest byte of Argument. Function does not interpret bit patterns of Argument – it merely returns 8 bits as found in register.

This is an “inline” routine; code is generated in the place of the call, so the call doesn’t count against the nested call limit.

Parameters
  • Argument: input value. Can be 16-bit or 32-bit value.
Returns

Returns next to the lowest byte of Argument, bits 8..15.

Requires

Arguments must be variable of scalar type (i.e. Arithmetic Types and Pointers).

Example
d = 0x12345678 	
tmp = Hi(d)  ' Equals 0x56

Hi(d) = 0xAA ' d equals 0x1234AA78
Notes

None.

Higher

Prototype

sub function Higher(dim Argument as as longword..float) as byte

Description

Function returns next to the highest byte of Argument. Function does not interpret bit patterns of Argument – it merely returns 8 bits as found in register.

This is an “inline” routine; code is generated in the place of the call, so the call doesn’t count against the nested call limit.

Parameters
  • Argument: input value. Can be of longword, longint or float type.
Returns

Returns next to the highest byte of Argument, bits 16..23.

Requires

Arguments must be variable of scalar type (i.e. Arithmetic Types and Pointers).

Example
d = 0x12345678
tmp = Higher(d)  ' Equals 0x34

Higher(d) = 0xAA ' d equals 0x12AA5678
Notes

None.

Highest

Prototype

sub function Highest(dim Argument as longword..float) as byte

Description

Function returns the highest byte of Argument. Function does not interpret bit patterns of Argument – it merely returns 8 bits as found in register.

This is an “inline” routine; code is generated in the place of the call, so the call doesn’t count against the nested call limit.

Parameters
  • Argument: input value. Can be of longword, longint or float type.
Returns

Returns the highest byte of Argument, bits 24..31.

Requires

Arguments must be variable of scalar type (i.e. Arithmetic Types and Pointers).

Example
d = 0x12345678 	
tmp = Highest(d)  ' Equals 0x12

Highest(d) = 0xAA ' d equals 0xAA345678
Notes

None.

LoWord

Prototype

sub function LoWord(dim Argument as word..float) as word

Description

The function returns low word of Argument. The function does not interpret bit patterns of Argument – it merely returns 16 bits as found in register.

Parameters
  • Argument: input value. Can be of word..float type.
Returns

Low word of Argument, bits 15..0.

Requires

Nothing.

Example
d = 0x12345678 	
tmp = LoWord(d)  ' Equals 0x5678

LoWord(d) = 0xAAAA ' d equals 0x1234AAAA
Notes

None.

HiWord

Prototype

sub function HiWord(dim Argument as longword..float) as word

Description

The function returns high word of Argument. The function does not interpret bit patterns of Argument – it merely returns 16 bits as found in register.

Parameters
  • Argument: input value. Can be of longword, longint or float type.
Returns

High word of Argument, bits 31..16.

Requires

Nothing.

Example
d = 0x12345678 	
tmp = HiWord(d)  ' Equals 0x1234

HiWord(d) = 0xAAAA ' d equals 0xAAAA5678
Notes

None.

HigherWord

Prototype

sub function HigherWord(dim Argument as uint64..extended) as word

Description

The function returns higher word of Argument. The function does not interpret bit patterns of Argument – it merely returns 16 bits as found in register.

Parameters
  • Argument: input value. Can be of int64, uint64 or extended type.
Returns

Higher word of Argument, bits 47..32.

Requires

Nothing.

Example
d = 0x1122334455667788
tmp = HigherWord(d)  ' Equals 0x33344

HigherWord(d) = 0xAAAA ' d equals 0x1122AAAA55667788
Notes

None.

HighestWord

Prototype

sub function HighestWord(dim Argument as uint64..extended) as word

Description

The function returns highest word of Argument. The function does not interpret bit patterns of Argument – it merely returns 16 bits as found in register.

Parameters
  • Argument: input value. Can be of int64, uint64 or extended type.
Returns

Highest word of Argument, bits 63..48.

Requires

Nothing.

Example
d = 0x1122334455667788
tmp = HighestWord(d)  ' Equals 0x1122

HighestWord(d) = 0xAAAA ' d equals 0xAAAA334455667788
Notes

None.

Lolongword

Prototype

sub function Lolongword(dim Argument as longword..extended) as longword

Description

The function returns low longword of Argument. The function does not interpret bit patterns of Argument – it merely returns 32 bits as found in register.

Parameters
  • Argument: input value. Can be of 32-bit or 64-bit type.
Returns

Low longword of Argument, bits 31..0.

Requires

Nothing.

Example
d = 0x1122334455667788
tmp = Lolongword(d)  ' Equals 0x55667788

Lolongword(d) = 0xAAAAAAAA ' d equals 0x11223344AAAAAAAA
Notes

None.

Hilongword

Prototype

sub function Hilongword(dim Argument as uint64..extended) as longword

Description

The function returns high longword of Argument. The function does not interpret bit patterns of Argument – it merely returns 32 bits as found in register.

Parameters
  • Argument: input value. Can be of int64, uint64 or extended type.
Returns

High longword of Argument, bits 63..32.

Requires

Nothing.

Example
d = 0x1122334455667788
tmp = Hilongword(d)  ' Equals 0x11223344

Hilongword(d) = 0xAAAAAAAA; ' d equals 0xAAAAAAAA55667788
Notes

None.

Inc

Prototype

sub procedure Inc(dim byref par as longint)

Description

Increases parameter par by 1.

Parameters
  • par: value which will be incremented by 1
Returns

Nothing.

Requires

Nothing.

Example
p = 4
Inc(p)  ' p is now 5
Notes

None.

Dec

Prototype

sub procedure Dec(dim byref par as longint)

Description

Decreases parameter par by 1.

Parameters
  • par: value which will be decremented by 1
Returns

Nothing.

Requires

Nothing.

Example
p = 4
Dec(p)  ' p is now 3
Notes

None.

Chr

Prototype

sub function Chr(dim code_ as byte) as char

Description

Function returns a character associated with the specified character code_. Numbers from 0 to 31 are the standard non-printable ASCII codes.

This is an “inline” routine; the code is generated in the place of the call.

Parameters
  • code_: input character
Returns

Returns a character associated with the specified character code_.

Requires

Nothing.

Example
c = Chr(10)  ' returns the linefeed character
Notes

None.

Ord

Prototype

sub function Ord(dim character as char) as byte

Description

Function returns ASCII code of the character.

This is an “inline” routine; the code is generated in the place of the call.

Parameters
  • character: input character
Returns

ASCII code of the character.

Requires

Nothing.

Example
c = Ord("A")  ' returns 65
Notes

None.

SetBit

Prototype

sub procedure SetBit(dim byref register_ as word, dim rbit as byte)

Description

Function sets the bit rbit of register_. Parameter rbit needs to be a variable or literal with value 0..15. For more information on register identifiers see Predefined Globals and Constants .

This is an “inline” routine; the code is generated in the place of the call.

Parameters
  • register_: desired register
  • rbit: desired bit
Returns

Nothing.

Requires

Nothing.

Example
SetBit(GPIO_PORT_08_15, 2)  ' Set GPIO_PORT_08_15.2
Notes

None.

ClearBit

Prototype

sub procedure ClearBit(dim byref register_ as word, dim rbit as byte)

Description

Function clears the bit rbit of register. Parameter rbit needs to be a variable or literal with value 0..15. See Predefined globals and constants for more information on register identifiers.

This is an “inline” routine; code is generated in the place of the call, so the call doesn’t count against the nested call limit.

Parameters
  • register_: desired register
  • rbit: desired bit
Returns

Nothing.

Requires

Nothing.

Example
ClearBit(GPIO_PORT_16_23, 7)  ' Clear GPIO_PORT_16_23.7
Notes

None.

TestBit

Prototype

sub function TestBit(dim register_, rbit as byte) as byte

Description

Function tests if the bit rbit of register is set. If set, function returns 1, otherwise returns 0. Parameter rbit needs to be a variable or literal with value 0..15. See Predefined globals and constants for more information on register identifiers.

This is an “inline” routine; code is generated in the place of the call, so the call doesn’t count against the nested call limit.

Parameters
  • register_: desired register
  • rbit: desired bit
Returns

If the bit is set, returns 1, otherwise returns 0.

Requires

Nothing.

Example
flag = TestBit(GPIO_PORT_32_39, 2)  ' 1 if GPIO_PORT_32_39.2 is set, otherwise 0
Notes

None.

Delay_us

Prototype

sub procedure Delay_us(const time_in_us as longword)

Description

Creates a software delay in duration of Time_In_us microseconds.

This is an “inline” routine; the code is generated in the place of the call, so the call doesn’t count against the nested call limit.

Parameters
  • Time_In_us: delay time in microseconds. Valid values: constant values, range of applicable constants depends on the oscillator frequency
Returns

Nothing.

Requires

Nothing.

Example
Delay_us(1000)  ' One millisecond pause
Notes

None.

Delay_ms

Prototype

sub procedure Delay_ms(const time_in_ms as longword)

Description

Creates a software delay in duration of Time_In_ms milliseconds.

This is an “inline” routine; the code is generated in the place of the call, so the call doesn’t count against the nested call limit.

Parameters
  • Time_In_ms: delay time in milliseconds. Valid values: constant values, range of applicable constants depends on the oscillator frequency
Returns

Nothing.

Requires

Nothing.

Example
Delay_ms(1000)  ' One second pause
Notes

For generating delays with variable as input parameter use the Vdelay_ms routine.

VDelay_ms

Prototype

sub procedure Vdelay_ms(dim time_in_ms as word)

Description

Creates a software delay in duration of Time_ms milliseconds. Generated delay is not as precise as the delay created by Delay_ms.

Parameters
  • Time_ms: delay time in milliseconds
Returns

Nothing.

Requires

Nothing.

Example
pause = 1000
' ...
Vdelay_ms(pause)  ' ~ one second pause
Notes

    None.

VDelay_advanced_ms

Prototype

sub procedure VDelay_advanced_ms(dim time_ms, Current_Fosc_kHz as word)

Description

Creates a software delay in duration of time_in_ms milliseconds (a variable), for a given oscillator frequency. Generated delay is not as precise as the delay created by Delay_ms.

Note that Vdelay_ms is library function rather than a built-in routine; it is presented in this topic for the sake of convenience.

Parameters
  • time_ms: delay time in milliseconds
  • Current_Fosc_kHz: frequency in kHz
Returns

Nothing.

Requires

Nothing.

Example
pause = 1000
fosc = 10000

VDelay_advanced_ms(pause, fosc)  ' Generates approximately one second pause, for a oscillator frequency of 10 MHz
Notes

None.

Delay_Cyc

Prototype

sub procedure Delay_Cyc(dim cycles_div_by_10 as longword)

Description

Creates a delay based on MCU clock.

Parameters
  • cycles_div_by_10: number of cycles divided by 10
Returns

Nothing.

Requires

Nothing.

Example
Delay_Cyc(10)  ' 1 cycles pause
Notes

Delay_Cyc is a library function rather than a built-in routine; it is presented in this topic for the sake of convenience.

Delay_Cyc_Long

Prototype

sub procedure Delay_Cyc_Long(dim CycNo as word)

Description

Creates a delay based on MCU clock. Delay lasts for CycNo MCU clock cycles.

Parameters
  • CycNo: number of MCU cycles
Returns

Nothing.

Requires

Nothing.

Example
Delay_Cyc_Long(16384)  ' 16384 cycles pause 
Notes

Delay_Cyc_Long is a library function rather than a built-in routine; it is presented in this topic for the sake of convenience.

Clock_kHz

Prototype

sub function Clock_kHz() as longint

Description

Returns device clock in kHz, rounded to the nearest integer.

This is an “inline” routine; the code is generated in the place of the call.

Parameters

None.

Returns

Device clock in kHz, rounded to the nearest integer.

Requires

Nothing.

Example
clk = Clock_kHz()
Notes

None.

Clock_MHz

Prototype

sub function Clock_MHz() as word

Description

Returns device clock in MHz, rounded to the nearest integer.

This is an “inline” routine; the code is generated in the place of the call.

Parameters

None.

Returns

Device clock in MHz, rounded to the nearest integer.

Requires

Nothing.

Example
clk = Clock_MHz()
Notes

None.

Get_Fosc_kHz

Prototype

sub function Get_Fosc_kHz() as longint

Description

Function returns device clock in kHz, rounded to the nearest integer.

Parameters

None.

Returns

Device clock in kHz.

Requires

Nothing.

Example
clk = Get_Fosc_kHz()
Notes

Get_Fosc_kHz is a library function rather than a built-in routine; it is presented in this topic for the sake of convenience.

Get_Peripheral_Clock_kHz

Prototype

sub functionGet_Peripheral_Clock_kHz() as longint

Description

Function returns peripheral clock in kHz, rounded to the nearest integer.

Parameters

None.

Returns

Periperal clock in kHz, rounded to the nearest integer.

Requires

Nothing.

Example
clk = Get_Peripheral_Clock_kHz()
Notes

None.

Get_Fosc_Per_Cyc

Prototype

sub function Get_Fosc_Per_Cyc() as word

Description

Function returns device's clock per cycle, rounded to the nearest integer.

Note that Get_Fosc_Per_Cyc is library function rather than a built-in routine; it is presented in this topic for the sake of convenience.

Parameters

None.

Returns

Device's clock per cycle, rounded to the nearest integer.

Requires

Nothing.

Example
dim clk_per_cyc as word
...
clk_per_cyc = Get_Fosc_Per_Cyc()
Notes

None.

SystemReset

Prototype

sub procedure SystemReset()

Description

This function will perform a software reset of the entire device. The processor and all peripherals are reset and all device registers will return to their default values
(with the exception of the reset cause register, which will maintain its current value but have the software reset bit set as well).

Parameters

None.

Returns

Nothing.

Requires

Nothing.

Example
SystemReset()
Notes

None.

DisableContextSaving

Prototype

sub procedure DisableContextSaving()

Description

Use the DisableContextSaving() to instruct the compiler not to automatically perform context-switching. This means that no register will be saved/restored by the compiler on entrance/exit from interrupt service routine. This enables the user to manually write code for saving registers upon entrance and to restore them before exit from interrupt.

Parameters

None.

Returns

Nothing.

Requires

This routine must be called from main.

Example
DisableContextSaving() ' instruct the compiler not to automatically perform context-switching
Notes

None.

SetFuncCall

Prototype

sub procedure SetFuncCall(dim FuncName as string)

Description

If the linker encounters an indirect function call (by a pointer to function), it assumes that any routine whose address was taken anywhere in the program can be called at that point if it's prototype matches the pointer declaration.

Use the SetFuncCall directive within routine body to instruct the linker which routines can be called indirectly from that routine :
SetFunCCall (called_func[, ,...])

Routines specified in the SetFunCCall argument list will be linked if the routine containing SetFunCCall directive is called in the code no matter whether any of them was explicitly called or not.

Thus, placing SetFuncCall directive in main will make compiler link specified routines always.

Parameters
  • FuncName: function name
Returns

Nothing.

Requires

Nothing.

Example:
sub procedure first(p, q as byte)
...
  SetFuncCall(second) ' let linker know that we will call the routine 'second'
...
end sub
Notes

The SetFuncCall directive can help the linker to optimize function frame allocation in the compiled stack.

SetOrg

Prototype

sub procedure SetOrg(dim RoutineName as string, dim address as longint)

Description

Use the SetOrg() routine to specify the starting address of a routine in ROM.

Parameters
  • RoutineName: routine name
  • address: starting address
Returns

Nothing.

Requires

This routine must be called from main.

Example
SetOrg(UART1_Write, 0x1234)
Notes

None.

GetDateTime

Prototype

sub function GetDateTime() as string

Description

Use the GetDateTime() to get date and time of compilation as string in your code.

Parameters

None.

Returns

String with date and time when this routine is compiled.

Requires

Nothing.

Example
str = GetDateTime()
Notes

None.

DoGetDateTime

Prototype

sub function DoGetDateTime() as string

Description

Use the DoGetDateTime() to get date and time of compilation as string in your code.

Parameters

None.

Returns

String with date and time when this routine is compiled.

Requires

Nothing.

Example
str = DoGetDateTime()
Notes

None.

GetVersion

Prototype

sub function GetVersion() as string

Description

Use the GetVersion() to get the current version of compiler.

Parameters

None.

Returns

String with current compiler version.

Requires

Nothing.

Example
str = GetVersion() ' for example, str will take the value of '8.2.1.6'
Notes

None.

DoGetVersion

Prototype

sub function DoGetVersion() as string

Description

Use the DoGetVersion() to get the current version of compiler.

Parameters

None.

Returns

String with current compiler version.

Requires

Nothing.

Example
str = DoGetVersion() ' for example, str will take the value of '8.2.1.6'
Notes

None.

New

Prototype

sub procedure New(dim byref Ptr as pointer)

Description

Allocates a block of memory from the memory Heap, taking care of the alignment. It is recommended to use this routine instead of GetMem.

Parameters
  • Ptr: variable of any pointer type, pointing to an object which is to be allocated.
Returns

Returns a pointer to the memory block allocated by the function; Otherwise 0 (no free blocks of memory are large enough).

Requires

Nothing.

Example

Notes

None.

Dispose

Prototype

sub procedure Dispose(dim byref Ptr as pointer)

Description

Disposes a block of memory from the memory Heap, referenced by Ptr and returns its memory to the Heap.

Parameters
  • Ptr: variable of any pointer type previously assigned by the New procedure.
Returns

Requires

Nothing.

Example

Notes

After calling this routine, the value of Ptr is nil (0) (not assigned pointer).

MEMCPY_B

Prototype

sub function MEMCPY_B(dim s1 as ^byte, dim s2 as ^byte, dim nn as longword) as ^byte

Description

Function copies nn bytes from the object pointed to by s2 into the object pointed to by s1. If copying takes place between objects that overlap, the behavior is undefined.

The behavior of the MEMCPY instruction is exactly the same as the standard C memcpy() function in ISO/IEC 9899:1990 ("ISO C90").

Returns

The function returns address of the object pointed to by s1.

Requires

Nothing.

Notes

Use this function for all object alignments.

MEMCPY_S

Prototype

sub function MEMCPY_S(dim s1 as ^byte, dim s2 as ^byte, dim nn as longword) as ^byte

Description

Function copies nn bytes from the object pointed to by s2 into the object pointed to by s1. If copying takes place between objects that overlap, the behavior is undefined.

The behavior of the MEMCPY instruction is exactly the same as the standard C memcpy() function in ISO/IEC 9899:1990 ("ISO C90").

Returns

The function returns address of the object pointed to by s1.

Requires

Function parameters must have alignment 2.

Notes

Use this function when function parameters have alignment 2.

MEMCPY_L

Prototype

sub function MEMCPY_L(dim s1 as ^byte, dim s2 as ^byte, dim nn as longword) as ^byte

Description

Function copies nn bytes from the object pointed to by s2 into the object pointed to by s1. If copying takes place between objects that overlap, the behavior is undefined.

The behavior of the MEMCPY instruction is exactly the same as the standard C memcpy() function in ISO/IEC 9899:1990 ("ISO C90").

Returns

The function returns address of the object pointed to by s1.

Requires

Function parameters must have alignment 4.

Notes

Use this function when function parameters have alignment 4.

MEMSET_B

Prototype

sub function MEMSET_B(dim s as ^byte, dim c as longword, dim n as longword) as ^byte

Description

Function copies the value of the byte c into each of the first n bytes of the object pointed by s.

The behavior of the MEMSET instruction is exactly the same as the standard C memsety() function in ISO/IEC 9899:1990 ("ISO C90").

Returns

The function returns address of the object pointed to by s.

Requires

Nothing.

Notes

None.

MEMSET_S

Prototype

sub function MEMSET_S(dim s as ^byte, dim c as longword, dim n as longword) as ^byte

Description

Function copies the value of the byte c into each of the first n bytes of the object pointed by s.

The behavior of the MEMSET instruction is exactly the same as the standard C memset() function in ISO/IEC 9899:1990 ("ISO C90").

Returns

The function returns address of the object pointed to by s.

Requires

Function parameters must have alignment 2.

Notes

Use this function when function parameters have alignment 2.

MEMSET_L

Prototype

sub function MEMSET_L(dim s as ^byte, dim c as longword, dim n as longword) as ^byte

Description

Function copies the value of the byte c into each of the first n bytes of the object pointed by s.

The behavior of the MEMSET instruction is exactly the same as the standard C memset() function in ISO/IEC 9899:1990 ("ISO C90").

Returns

The function returns address of the object pointed to by s.

Requires

Function parameters must have alignment 4.

Notes

Use this function when function parameters have alignment 4.

STREAMIN_B

Prototype

sub function STREAMIN_B(dim s1 as ^byte, dim s2 as ^byte, dim nn as longword) as ^byte

Description

Function moves n bytes from an object pointed to by s2 located in I/O, to an object pointed to by s1 located in program memory.

Returns

The function returns address of the object pointed to by s1.

Requires

Nothing.

Notes

None.

STREAMIN_S

Prototype

sub function STREAMIN_S(dim s1 as ^byte, dim s2 as ^byte, dim nn as longword) as ^byte

Description

Function moves n bytes from an object pointed to by s2 located in I/O, to an object pointed to by s1 located in program memory.

Returns

The function returns address of the object pointed to by s1.

Requires

Function parameters must have alignment 2.

Notes

Use this function when function parameters have alignment 2.

STREAMIN_L

Prototype

sub function STREAMIN_L(dim s1 as ^byte, dim s2 as ^byte, dim nn as longword) as ^byte

Description

Function moves n bytes from an object pointed to by s2 located in I/O, to an object pointed to by s1 located in program memory.

Returns

The function returns address of the object pointed to by s1.

Requires

Function parameters must have alignment 4.

Notes

Use this function when function parameters have alignment 4.

STREAMINI_B

Prototype

sub function STREAMINI_B(dim s1 as ^byte, dim s2 as ^byte, dim nn as longword) as ^byte

Description

Function moves n bytes from an object pointed to by s2 located in I/O, to an object pointed to by s1 located in program memory, with incrementing destination program memory address.

Returns

The function returns address of the object pointed to by s1.

Requires

Nothing.

Notes

None.

STREAMINI_S

Prototype

sub function STREAMINI_S(dim s1 as ^byte, dim s2 as ^byte, dim nn as longword) as ^byte

Description

Function moves n bytes from an object pointed to by s2 located in I/O, to an object pointed to by s1 located in program memory, with incrementing destination program memory address.

Returns

The function returns address of the object pointed to by s1.

Requires

Function parameters must have alignment 2.

Notes

Use this function when function parameters have alignment 2.

STREAMINI_L

Prototype

sub function STREAMINI_L(dim s1 as ^byte, dim s2 as ^byte, dim nn as longword) as ^byte

Description

Function moves n bytes from an object pointed to by s2 located in I/O, to an object pointed to by s1 located in program memory, with incrementing destination program memory address.

Returns

The function returns address of the object pointed to by s1.

Requires

Function parameters must have alignment 4.

Notes

Use this function when function parameters have alignment 4.

STREAMOUT_B

Prototype

sub function STREAMOUT_B(dim s1 as ^byte, dim s2 as ^byte, dim nn as longword) as ^byte

Description

Function moves n bytes from an object pointed to by s2 located in program memory, to an object pointed to by s1 located in I/O.

Returns

The function returns address of the object pointed to by s1.

Requires

Nothing.

Notes

None.

STREAMOUT_S

Prototype

sub function STREAMOUT_S(dim s1 as ^byte, dim s2 as ^byte, dim nn as longword) as ^byte

Description

Function moves n bytes from an object pointed to by s2 located in program memory, to an object pointed to by s1 located in I/O.

Returns

The function returns address of the object pointed to by s1.

Requires

Function parameters must have alignment 2.

Notes

Use this function when function parameters have alignment 2.

STREAMOUT_L

Prototype

sub function STREAMOUT_L(dim s1 as ^byte, dim s2 as ^byte, dim nn as longword) as ^byte

Description

Function moves n bytes from an object pointed to by s2 located in program memory, to an object pointed to by s1 located in I/O.

Returns

The function returns address of the object pointed to by s1.

Requires

Function parameters must have alignment 4.

Notes

Use this function when function parameters have alignment 4.

STREAMOUTI_B

Prototype

sub function STREAMOUTI_B(dim s1 as ^byte, dim s2 as ^byte, dim nn as longword) as ^byte

Description

Function moves n bytes from an object pointed to by s2 located in program memory, to an object pointed to by s1 located in I/O, with incrementing source program memory address.

Returns

The function returns address of the object pointed to by s1.

Requires

Nothing.

Notes

None.

STREAMOUTI_S

Prototype

sub function STREAMOUTI_S(dim s1 as ^byte, dim s2 as ^byte, dim nn as longword) as ^byte

Description

Function moves n bytes from an object pointed to by s2 located in program memory, to an object pointed to by s1 located in I/O, with incrementing source program memory address.

Returns

The function returns address of the object pointed to by s1.

Requires

Function parameters must have alignment 2.

Notes

Use this function when function parameters have alignment 2.

STREAMOUTI_L

Prototype

sub function STREAMOUTI_L(dim s1 as ^byte, dim s2 as ^byte, dim nn as longword) as ^byte

Description

Function moves n bytes from an object pointed to by s2 located in program memory, to an object pointed to by s1 located in I/O, with incrementing source program memory address.

Returns

The function returns address of the object pointed to by s1.

Requires

Function parameters must have alignment 4.

Notes

Use this function when function parameters have alignment 4.

STRCMP_B

Prototype

sub function STRCMP_B(dim byref s1 as string, dim byref s2 as string) as longint

Description

Function compares strings s1 and s2 and returns zero if the strings are equal, or returns a difference between the first differing characters (in a left-to-right evaluation).
Accordingly, the result is greater than zero if s1 is greater than s2 and vice versa.

The behavior of the STRCMP_B instruction is exactly the same as the standard C strcmp() function in ISO/IEC 9899:1990 ("ISO C90").

Returns

The function returns zero if the strings are equal, or returns a difference between the first differing characters (in a left-to-right evaluation).

Requires

Nothing.

Notes

None.

STRCMP_S

Prototype

sub function STRCMP_S(dim byref s1 as string, dim byref s2 as string) as longint

Description

Function compares strings s1 and s2 and returns zero if the strings are equal, or returns a difference between the first differing characters (in a left-to-right evaluation).
Accordingly, the result is greater than zero if s1 is greater than s2 and vice versa.

The behavior of the STRCMP_B instruction is exactly the same as the standard C strcmp() function in ISO/IEC 9899:1990 ("ISO C90").

Returns

The function returns zero if the strings are equal, or returns a difference between the first differing characters (in a left-to-right evaluation).

Requires

Function parameters must have alignment 2.

Notes

Use this function when function parameters have alignment 2.

STRCMP_L

Prototype

sub function STRCMP_L(dim byref s1 as string, dim byref s2 as string) as longint

Description

Function compares strings s1 and s2 and returns zero if the strings are equal, or returns a difference between the first differing characters (in a left-to-right evaluation).
Accordingly, the result is greater than zero if s1 is greater than s2 and vice versa.

The behavior of the STRCMP_B instruction is exactly the same as the standard C strcmp() function in ISO/IEC 9899:1990 ("ISO C90").

Returns

The function returns zero if the strings are equal, or returns a difference between the first differing characters (in a left-to-right evaluation).

Requires

Function parameters must have alignment 4.

Notes

Use this function when function parameters have alignment 4.

STPCPY_B

Prototype

sub procedure STPCPY_B(dim byref s1 as string, dim byref s2 as string) as string

Description

Function copies the string s2 into the string s1. If copying is successful, the function returns pointer to s1. If copying takes place between objects that overlap, the behavior is undefined.

The behavior of the STPCPY_B instruction is exactly the same as the standard C stpcpy() function in ISO/IEC 9899:1990 ("ISO C90").

Returns

The function returns address of the object pointed to by s1.

Requires

Nothing.

Notes

None.

STPCPY_S

Prototype

sub procedure STPCPY_S(dim byref s1 as string, dim byref s2 as string) as string

Description

Function copies the string s2 into the string s1. If copying is successful, the function returns pointer to s1. If copying takes place between objects that overlap, the behavior is undefined.

The behavior of the STPCPY_B instruction is exactly the same as the standard C stpcpy() function in ISO/IEC 9899:1990 ("ISO C90").

Returns

The function returns address of the object pointed to by s1.

Requires

Function parameters must have alignment 2.

Notes

Use this function when function parameters have alignment 2.

STPCPY_L

Prototype

sub procedure STPCPY_L(dim byref s1 as string, dim byref s2 as string) as string

Description

Function copies the string s2 into the string s1. If copying is successful, the function returns pointer to s1. If copying takes place between objects that overlap, the behavior is undefined.

The behavior of the STPCPY_L instruction is exactly the same as the standard C stpcpy() function in ISO/IEC 9899:1990 ("ISO C90").

Returns

The function returns address of the object pointed to by s1.

Requires

Function parameters must have alignment 4.

Notes

Use this function when function parameters have alignment 4.

STRLEN_B

Prototype

sub function STRLEN_B(dim byref s as string) as longword

Description

Function returns the length of the string s (the terminating null character does not count against string’s length).

The behavior of the STRLEN_B instruction is exactly the same as the standard C strlen() function in ISO/IEC 9899:1990 ("ISO C90").

Returns

Function returns the length of the string.

Requires

Nothing.

Notes

None.

STRLEN_S

Prototype

sub function STRLEN_S(dim byref s as string) as longword

Description

Function returns the length of the string s (the terminating null character does not count against string’s length).

The behavior of the STRLEN_S instruction is exactly the same as the standard C strlen() function in ISO/IEC 9899:1990 ("ISO C90").

Returns

Function returns the length of the string.

Requires

Function parameters must have alignment 2.

Notes

Use this function when function parameters have alignment 2.

STRLEN_L

Prototype

sub function STRLEN_L(dim byref s as string) as longword

Description

Function returns the length of the string s (the terminating null character does not count against string’s length).

The behavior of the STRLEN_L instruction is exactly the same as the standard C strlen() function in ISO/IEC 9899:1990 ("ISO C90").

Returns

Function returns the length of the string.

Requires

Function parameters must have alignment 4.

Notes

Use this function when function parameters have alignment 4.

Copyright (c) 2002-2015 mikroElektronika. All rights reserved.
What do you think about this topic ? Send us feedback!
Want more examples and libraries? 
Find them on LibStock - A place for the code