Interrupts

BlitzMax Forums/BlitzMax Programming/Interrupts

Nigel Brown(Posted 2005) [#1]
Is there a way to generate an interupt and service it? I need to look at the parallel port 256 times in a 2ms period.


boomboommax(Posted 2005) [#2]
"I need to look at the parallel port 256 times in a 2ms period."

gonna get a stiff neck:P


ImaginaryHuman(Posted 2005) [#3]
lol ... I don't think there is currently a way without doing something unconventional and `manual`, if at all. You can set up timers but I don't know if that would work or not. An interrupt literally interrupts the CPU and calls a separate piece of code that you have set up as the interrupt program. I'm pretty sure Blitz just doesn't have that capability.


Damien Sturdy(Posted 2005) [#4]
Well, Blitz *should*.
This kind of stuff is damn useful for hobby hardware projects. If blitz would do this, I'd be tinkering around all the time :D I got a ton of old stuff i could wire up like thi*bang*


Dreamora(Posted 2005) [#5]
You might use ASM for that and import it


ImaginaryHuman(Posted 2005) [#6]
Yah you would pretty much have to do it in C or ASM. On the Amiga for example you had to have a piece of executable binary which usually was coded in Assembler, and the pointer to it had to be placed in a particular memory location that acts as an interrupt jump register. Then the interrupt had to be activated. The piece of code had to preserve any registers it used and restore them after its processing and then trigger the interrupt to be cleared. Then processing would resume as normal. They were very handy for making things synchronized to the vertical blank interrupt. Also the blitter (gfx render hardware) had interrupts, as did the disk-drive DMA. It's something that's pretty close to the hardware so I don't know how easy it would be to implement in max given its a high level language.


FlameDuck(Posted 2005) [#7]
I'm pretty sure Blitz just doesn't have that capability.
Neither does Windows. Interupts are ultra low-level CPU things, and messing with them may cause Windows to stop responding, as the task scheduler crashes rather spectacularly.

What you need is timers, or a real-time OS like QNX.


ImaginaryHuman(Posted 2005) [#8]
Yah. I was a little bit disappointed that Max doesn't have timers that interrupt things - you can't get it to just suddenly call a function when the time is up. Even if it did this behind the scenes it'd be okay.

BTW Mikkel, I think I asked you before, but whatever happened to `Minimum Safe Distance`? Is it still on the internet somewhere? Was there ever a screenshot released? Do you have one?


FlameDuck(Posted 2005) [#9]
I was a little bit disappointed that Max doesn't have timers that interrupt things - you can't get it to just suddenly call a function when the time is up.
Yeah. I was hoping for a multithreaded environment too. However I appreciate that writing one that works well on Windows is a right pain in the backside.

BTW Mikkel, I think I asked you before, but whatever happened to `Minimum Safe Distance`?
I dunno what happened to it after Rob Hutchinson switched to PC. I think I've seen the graphics pop up from time to time, in some similar project, but they always seem to vanish again.

I think it's fairly safe to assume it's dead.