For the next generation of my home-brew-6502-based-castle-runner computer I decided I need interrupts for screen updates. This came up after upping the frequency of the computer. Running the thing on 8MHz caused the screen updates to go too fast and not very smooth.

So, the next update will be a 10Hz refresh pulse (probably coming from a simple 555 circuit) on the IRQ of the CPU, and then on that IRQ the entire screen will be refreshed from some (to be defined) video RAM page.

For now, the code is in the be able to provide an IRQ routine in the assembly, by simply providing a label as HW_IRW:

:HW_IRQ
SEI
LDA #$01
STA $80
LDA #$05
STA $81
JSR :DisplayGotoXY
LDA LO(@SPLASH)
STA $80
LDA HI(@SPLASH)
STA $81
JSR :DisplayString
CLI
RTS

The assembler will then put the address where that label points to as the second vector in the HEX file (after the RESB vector) and the programmer will send it in the header. The hardware programmer will read the vector from the header and write it at address 0x7ffe.

Code can be found here: https://github.com/derpflanz/castle-runner/tree/feature/add_irq_vector

Categories: Geekstuff

0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.