Mintoris Forum

Author Topic: Add interruptions in the programming  (Read 785 times)

FabianClub

  • Full Member
  • ***
  • Posts: 76
Add interruptions in the programming
« on: May 24, 2018, 01:43 PM »
Guess? I come with another idea that I came up with for the future, which in my opinion could be very useful for people who develop projects with Mintoris Basic.
I wonder if they could add interruptions in the programming.
That is to say that interruptions can be programmed (like those that could be done in Assembler with the Z80) and that every so often preconfigured, the program stops and jumps to a line of the specified program.
Better still if you can schedule several different interruptions.
Thank you very much for reading my suggestions.

sraffens

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 220
Re: Add interruptions in the programming
« Reply #1 on: May 24, 2018, 05:11 PM »
There are callback functions, these are "Event Handlers" and are like interrupt handlers.
In game engine mode there are many more.
Take a look at the reference manual, "Event Triggered Subroutines"

Event Programming is the best.
Using timers to trigger  "User Event".
Callbacks to process the events quickly,
The main polling loop processes the data.

Callbacks is one form of cooperative multitasking.
Use queues to pass data.
Event Handler write to the queue and the main polling loop reads from the queue.

You will have a bad day if you ever "block" a callback, your system will slowdown or halt and you have no idea why.
Currently BASIC 7.xxx will not you pause execution in any subroutine.
"block" - anything that will slow or pause execution; long loops, polling loops, Wait, Input, …

« Last Edit: May 24, 2018, 06:06 PM by sraffens »

FabianClub

  • Full Member
  • ***
  • Posts: 76
Re: Add interruptions in the programming
« Reply #2 on: May 26, 2018, 01:47 AM »
Thanks for your time answering.
I tell you that I have already made many very extensive applications in Mintoris Basic and I even published them in the Google Play Store.
I know the "Event Triggered Subroutines", but that's not what I'm looking for.
These subbrigs can be used for specific functions.
SetOnBackButtonSub: when the cell back button is pressed.
SetOnKeySub: When a key is pressed
SetOnPauseSub: When the program is paused by the Home key of the cell phone
SetOnResumeSub: When it returns from the previous pause.
SetOnSqlExceptionSub: for handling SQL data
SetOnTouchSub: when the screen is touched
 And all events for Game Engine Mode. Destined to Sprites, texts, collision, etc.
And I have used a lot of these events in my games.
But what I need is something else.
As I said before in my first post, I think it would be extremely useful to have interruption subroutines like the microprocessors. These interruptions do not have a specific function designed by Chuck, but each programmer uses them for what he thinks is necessary.
I will give you an example. I can define interrupts every 10 seconds so that they refer me to a subroutine that will control certain metadata of the program. And I can also define another subroutine of interruptions, in which every second go to a block to show the time on the screen, with minutes and seconds. In turn, I can define a third interruption, which every 100 milliseconds leads the execution to a subroutine that moves some graphics on the screen.
You understand? That was always very useful in programming‼
Thank you‼

FabianClub

  • Full Member
  • ***
  • Posts: 76
Re: Add interruptions in the programming
« Reply #3 on: May 27, 2018, 07:03 PM »
Oh, another thing I was thinking.
It would be very useful if you could find a way that these interrupts can also be used in a different way. If a timer could be programmed so that each time lapse it jumps to a specific line of the program.

sraffens

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 220
Re: Add interruptions in the programming
« Reply #4 on: May 28, 2018, 01:00 AM »
The only time I have worked with interrupts is when there is no OS and when I controlled the hardware directly.

Since you know "all events for Game Engine Mode. Destined to Sprites, texts, collision, etc.", then the timers available Game Engine Mode is not an option.

Maybe someday.

Mintoris

  • Administrator
  • Full Member
  • *****
  • Posts: 57
Re: Add interruptions in the programming
« Reply #5 on: Jun 02, 2018, 04:56 AM »
One of my goals for version 8 is to merge the feature of all the video modes so that you can mix and match as you please. As far as the new interrupts you ask for, I think adding some type of timer interrupt will take care of that. Otherwise we have most of the other interrupt stuff already in version 8. Interrupts work much better in version 8 as well.