<!DOCTYPE html><html><head><title></title><style type="text/css">p.MsoNormal,p.MsoNoSpacing{margin:0}</style></head><body><div>For the multiple interrupt handling in software approach, if I understand Jörg's proposal correctly, it's important not to forget to explicitly store the link register before, and restore it after invoking the individual handler procedures. The processor does not do this. Thanks to Paul Reed for relieving my related headaches last year. :)</div><div><br></div><div>As an aside, with an FPGA it's not too complicated to implement a hardware-based interrupt controller with several input lines as a "front end" to the one interrupt of the processor. I have used mine for months now and it works well. I currently use it mostly for handling errors detected by hardware devices (eg. watchdog, stack overflow monitor).<br></div><div><br></div><div>Regards<br></div><div>-- gray<br></div><div><br></div><div><br></div><div>On Wed, 31 Mar 2021, at 04:45, Jörg wrote:<br></div><blockquote type="cite" id="qt" style=""><div>Although TestInt is low-level, it should use Kernel.Install (SYSTEM.ADR(Int), 4) to make it a little bit less low-level😀<br></div><div><br></div><div>This little wrapper makes interrupts a little bit better consumable:<br></div><div>MODULE Interrupts; (* jr/31mar21 *)<br></div><div>IMPORT S := SYSTEM, Kernel;<br></div><div>PROCEDURE Install*(handler: PROCEDURE);<br></div><div> BEGIN Kernel.Install(S.ADR(handler), 4) END Install;<br></div><div>PROCEDURE Set*(on: BOOLEAN);<br></div><div> BEGIN S.LDPSR(ORD(on)) END Set;<br></div><div>END Interrupts.<br></div><div><br></div><div>With it TestInt.Mod gets<br></div><div>MODULE TestInt;<br></div><div>IMPORT Interrupts;<br></div><div>VAR led, cnt: INTEGER;<br></div><div>PROCEDURE* MyInterrupt;<br></div><div> BEGIN<br></div><div> INC(cnt); IF cnt = 500 THEN led := 3-led; LED(led); cnt := 0 END<br></div><div> END MyInterrupt;<br></div><div>PROCEDURE On*; BEGIN Interrupts.Set(TRUE) END On;<br></div><div>PROCEDURE Off*; BEGIN Interrupts.Set(FALSE) END Off;<br></div><div>BEGIN<br></div><div> led := 1; cnt := 0; Interrupts.Install(MyInterrupt)<br></div><div>END<br></div><div>TestInt.On<br></div><div>TestInt.Off<br></div><div><br></div><div>Interrupts.Mod could be enhanced servicing multiple interrupt handlers. Comparable to the background tasks in Oberon.Mod. This enhancement would install its own interrupt handler doing the scheduling, and the user‘s „interrupt handlers“ are normal procedures without * marking of the procedure. You would then install your handler like this<br></div><div>PROCEDURE MyTask; BEGIN led := 3 - led; LED(led) END MyTask;<br></div><div>BEGIN led := 1; Interrupts.Install(MyTask, 500) END TestInt.<br></div><div><br></div><div><div dir="ltr">br, Jörg<br></div><div dir="ltr"><div><br></div><blockquote type="cite"><div>Am 30.03.2021 um 23:45 schrieb Charles Perkins <chuck@kuracali.com>:<br></div></blockquote></div><blockquote type="cite"><div dir="ltr"><div><br></div><div dir="ltr"><div>Hello Everybody,<br></div><div><br></div><div>I wanted to explore interrupt handling in Oberon and I discovered that Peter De Wachter's excellent emulator did not implement them, which is not surprising, as the current Project Oberon source doesn't use them as far as I can tell and the only example source code showing how to use interrupts is the TestInt module on Professor Wirth's own 2018 update to RISC5: <a href="https://people.inf.ethz.ch/wirth/ProjectOberon/RISC5.Update.pdf">https://people.inf.ethz.ch/wirth/ProjectOberon/RISC5.Update.pdf</a><br></div><div><br></div><div>Since I wanted to compile and run that small example I forked Peter's emulator and added support for Interrupts in a branch here: <a href="https://github.com/io-core/oberon-risc-emu">https://github.com/io-core/oberon-risc-emu</a> (only a few small changes were needed.)<br></div><div><br></div><div>With those changes I am able to compile the TestInt module and execute it in the emulator using the 2019 disk image in the repo. Emulated LEDs update once per second as expected.<br></div><div><br></div><div>I don't intend to maintain a fork of Peter's emulator, I just wanted to experiment with interrupts and share the implementation in case anyone else is interested.<br></div><div><br></div><div>Best Regards,<br></div><div>Chuck<br></div></div><div><span>--</span><br></div><div><span>Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems</span><br></div><div><span>https://lists.inf.ethz.ch/mailman/listinfo/oberon</span><br></div></div></blockquote></div><div>--<br></div><div><a href="mailto:Oberon%40lists.inf.ethz.ch">Oberon@lists.inf.ethz.ch</a> mailing list for ETH Oberon and related systems<br></div><div><a href="https://lists.inf.ethz.ch/mailman/listinfo/oberon">https://lists.inf.ethz.ch/mailman/listinfo/oberon</a><br></div><div><br></div></blockquote><div><br></div></body></html>