Menu
JAQForum Ver 19.10.27

Forum Index : Microcontroller and PC projects : MMBasic: are there any interrupts with arguments ?

Posted: 06:49pm
30 Apr 2024
Copy link to clipboard
thwill
Guru


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
 
Posted: 07:04pm
30 Apr 2024
Copy link to clipboard
matherp
Guru

No: and I can't immediately see how it would work. MUCH easier would be a MMBasic defined variable.
 
Posted: 07:16pm
30 Apr 2024
Copy link to clipboard
thwill
Guru


  matherp said  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
 
Posted: 11:30am
05 May 2024
Copy link to clipboard
thwill
Guru


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
 
Posted: 01:03pm
05 May 2024
Copy link to clipboard
LeoNicolas
Guru


This is cool. Can you share the commit link? I'm curious to see what you came with.
 
Posted: 01:28pm
05 May 2024
Copy link to clipboard
thwill
Guru


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
 


To reply to this topic, you need to log in.

© JAQ Software 2024