Quantcast
Channel: User user2297996 - Stack Overflow
Viewing all articles
Browse latest Browse all 37

How to properly use interrupt handlers in 6502 Assembler?

$
0
0

I'm new to assemblers, so this question might sound dumb, but exactly what type of code should be implemented in a raster interrupt handler?

So I know this handler gets called when the desired raster line is rendered. But this seems to happen only once (if I ack the interrupt). Unless I clear the screen or redraw the relevant part of it, the handler routine won't be called again, right?

So then what's the point of using an interrupt?

If have a main loop like this:

main  jsr readKeyboard  jsr readJoystick  ...  jmp main

... then I have an endless loop monitoring everything anyway, so I don't understand what do I use interrupts for?

I mean, I thought interrupts can be used to implement an event system. They eliminate the need for polling and wasting CPU cycles by waiting. But if they happen only once, then this is not possible.

interruptHandler  inc $d019 ; acknowledge  ...  ; do the work  jmp $ea81

If I acknowledge like this, the method is called only once. If I don't, it gets called over and over again.

So please help me understand the concept here.

What's the right way to use interrupts? What functionality they are suitable for? When should I use them?

Thx!


Viewing all articles
Browse latest Browse all 37

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>