Skip to content

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


DecRange

Systems: MOS6502
Parameters: b,b,b


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

  • [address] - the address to decrement
  • [start] - if decrease would hit this value, roll over to [end]
  • [end] - value stored when rollover happens

Description

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

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

Examples

decRange(my_variable, 255, 42); // decrease my_variable by 1, keeping it between 0 and 42 decRange(my_array[i], 10, 13); // decrease my_array[i] by 1, keeping it between 11 and 13