Well, it seems you have been messing up the legdefs array, swapping piece definitions, as the numbers returned by the piece functions no longer correspond to the move definitions for the corresponding piece. In some cases they are even 'out of phase', so that the y-step of a piece is interpreted as a range, and this causes the error when the y-step is too negative.
For example, you have
def N cond #0 135 0;
But in fact the legdefs array contains the definition of Silver in that location, not Knight. You apparently have inserted the Silver definitions before that of Knight, with as a result that the definition of the Knight moves now starts at 187 instead of 135. You cannot juggle the move definitions in legdefs without adapting the piece routines to the new location of their moves.
Well, it seems you have been messing up the legdefs array, swapping piece definitions, as the numbers returned by the piece functions no longer correspond to the move definitions for the corresponding piece. In some cases they are even 'out of phase', so that the y-step of a piece is interpreted as a range, and this causes the error when the y-step is too negative.
For example, you have
But in fact the legdefs array contains the definition of Silver in that location, not Knight. You apparently have inserted the Silver definitions before that of Knight, with as a result that the definition of the Knight moves now starts at 187 instead of 135. You cannot juggle the move definitions in legdefs without adapting the piece routines to the new location of their moves.