Skip to content

title: "IncRange" description: TRSE built-in method (from IDE help)


IncRange

Systems: MOS6502
Parameters: b,b,b


IncRange( [address] , [start] , [end] );

  • [address] - the address to increment
  • [start] - starting value
  • [end] - if increase would hit this value, roll over to [start]

Description

Increases the byte value at the address with 1. If increasing the value would cause value to hit [end], stores [start] to value instead.

Notice that if variable value is outside the [start] and [end] range when calling this, function might misbehave.

Examples

incRange(my_variable, 0, 100); // increase my_variable by 1, keeping it between 0 and 99 incRange(my_array[i], 10, 13); // increase my_array[i] by 1, keeping it between 10 and 12