Commodore 64 basic doesn’t have min or max functions.
DEF (https://www.c64-wiki.com/wiki/DEF) would be the way to do this, but I don’t see how to write a performant version in a single expression (you can’t use IF as an expression. You could cast to float, compute some specially chosen sigmoid function, and round to int, but that’s slow)
can give you clamping, but haven’t checked it ((x < -127) is minus one for true or zero for false, so the part marked ^^^^ subtracts x + 127 from x when it is too low, and that’s equivalent to subtracting x (yielding zero) and subtracting -127 (yielding -127). The other part is similar, but for values that are too high.
"Intelligent C64s restore themselves to their former position of prominence. The singularity is near."