Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 16:26 25 Nov 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

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

Author Message
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4036
Posted: 06:49pm 30 Apr 2024
Copy link to clipboard 
Print this post

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
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9110
Posted: 07:04pm 30 Apr 2024
Copy link to clipboard 
Print this post

No: and I can't immediately see how it would work. MUCH easier would be a MMBasic defined variable.
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4036
Posted: 07:16pm 30 Apr 2024
Copy link to clipboard 
Print this post

  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
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4036
Posted: 11:30am 05 May 2024
Copy link to clipboard 
Print this post

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
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
LeoNicolas

Guru

Joined: 07/10/2020
Location: Canada
Posts: 479
Posted: 01:03pm 05 May 2024
Copy link to clipboard 
Print this post

This is cool. Can you share the commit link? I'm curious to see what you came with.
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4036
Posted: 01:28pm 05 May 2024
Copy link to clipboard 
Print this post

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
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
Print this page


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

© JAQ Software 2024