TRSE
TRSE copied to clipboard
C64: For investigation - Could this prevent issues?
I've noticed that the function enablerasterirq() compiles to:
; Enable raster IRQ
lda $d01a
ora #$01
sta $d01a
lda #$1B
sta $d011
This introduces two potential issues:
- It turns the screen on at next vertical blank. So if you've forced the screen off it will be re-enabled at next vertical blank.
- It clears the HI bit (bit#8) which identifies which rasterline to generate an interrupt. This will prevent you from having interrupts above rasterline $ff.
I've got a suggestion on how to come around this potential problem. I guess it could bring havoc to older TRSE demos which use the following functions, but here it goes:
- Remove the writing to $d011 from the enablerasterirq() funtion. So that the revised function would be only like this:
; Enable raster IRQ
lda $d01a
ora #$01
sta $d01a
- Include the writing to $d011 in the funtction rasterirq(IRQ_HANDLER(),RASTERPOSITION,KERNAL/BASIC/IO). When the value of 'RASTERPOSTION' is equal or greater than $100 then bit #7 of $d011 is set. If the value of 'RASTERPOSITION' is less than $100 the bit #7 is cleared. NOTE: It could be that this is already the intention of TRSE. I notice that when the value is >$100 then the function includes a 'ldy #$01' but I can't see that this value is used anywhere.
Suggestion:
With a RASTERPOSITION =$FF
lda #$ff
sta $d012
lda #<IRQ_HANDLER
sta $fffe
lda #>IRQ_HANDLER
sta $ffff
lda $d011
and #%01111111
sta $d011
With a RASTERPOSITION =$102
lda #$02
sta $d012
lda #<IRQ_HANDLER
sta $fffe
lda #>IRQ_HANDLER
sta $ffff
lda $d011
ora #%10000000
sta $d011