Menu | JAQForum Ver 19.10.27 |
Forum Index : Microcontroller and PC projects : MMBasic: are there any interrupts with arguments ?
Hi folks, I can't find one, but I thought I'd check are there any MMBasic commands that use an interrupt routine with an argument ? I ask because MMB4L will have a command thus: GRAPHICS WINDOW id, x, y, w, h [, interrupt] And when the interrupt is called (due to a Window event such as the user clicking [x] to close it) it will need to receive as a minimum the window 'id' and a value indicating what type of event occurred. e.g. Sub my_interrupt(id As Integer, type As Integer) ... End Sub Best wishes, Tom Edited 2024-05-01 04:55 by thwill |
||||||
No: and I can't immediately see how it would work. MUCH easier would be a MMBasic defined variable. |
||||||
I agree, but that isn't as powerful or scalable so I think it is worth my having a punt at implementing it ... not that it looks easy, the way that interrupt SUBs are called is already a bit "unusual". Best wishes, Tom |
||||||
Done . Pretty straightforward, but writing and robustly testing new* code to parse FUNCTION/SUB signatures was time consuming. * Obviously MMBasic could already do this (see DefinedSubFun() in the source) but it does so in conjunction with parsing the line making the FUNCTION/SUB call. I didn't have such a line to to parse; though faking such was an alternative implementation I considered but discounted as it being more likely "there be dragons". Onwards and upwards, Tom Edited 2024-05-05 22:12 by thwill |
||||||
This is cool. Can you share the commit link? I'm curious to see what you came with. |
||||||
Hi Leo, I'm not sure about "cool", I was more thinking "very niche" . This is all on the development branch for MMB4L v0.7.0: https://github.com/thwill1000/mmb4l/tree/develop-0.7.0 And the commits in question are: Add parse_fn_sig() to parse FUNCTION/SUB signatures Add optional interrupt param to GRAPHICS WINDOW CLOSE WARNING! This is not a stable branch and I'm the only contributor to it, as such I'm engaged in interactive rebases and other horrors. If you know git then you know what I mean, if you don't then it's unlikely to bother you too much . Best wishes, Tom |
||||||