I am having trouble with doing a 'mod' instruction in an interrupt routine. It crashes FF without a reset cause being printed to the terminal.
The code looks like this:
: my_int
1 esc.seq.step +! \ increment step by 1, next of the seq of 6
esc.seq.step @ 6 mod esc.seq.step ! \ modular 6 division
;i
Any reason why this should not work? The inetrrupt is the comparator int.
Do you have to disable comp interrupt on entry to the routine?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
There was a bug in UM/MOD which is the base for all division and MOD routines. It has now been made interrupt safe.
A fix has been uploaded.
I recommend using a simple IF statement instead of MOD in the interrupt routine. That is much faster.
: my_int
1 esc.seq.step +! \ increment step by 1, next of the seq of 6
esc.seq.step @ 5 > if 0 esc.seq.step ! then
;i
If you have to use MOD I recommend using U/MOD or UM/MOD which are faster than MOD.
Last edit: Mikael Nordman 2023-10-26
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am having trouble with doing a 'mod' instruction in an interrupt routine. It crashes FF without a reset cause being printed to the terminal.
The code looks like this:
Any reason why this should not work? The inetrrupt is the comparator int.
Do you have to disable comp interrupt on entry to the routine?
There was a bug in UM/MOD which is the base for all division and MOD routines. It has now been made interrupt safe.
A fix has been uploaded.
I recommend using a simple IF statement instead of MOD in the interrupt routine. That is much faster.
If you have to use MOD I recommend using U/MOD or UM/MOD which are faster than MOD.
Last edit: Mikael Nordman 2023-10-26
Many thanks. I had already changed to an IF..THEN
So latest changes in github I presume. EDIT found it :)
Last edit: Bernard Mentink 2023-10-27