I need a screen split in screen 5 and I use IE1 and R#19.
I have RAM in Page 0.
My ISR code has two routines:
vdpregs0 equ 0f3dfh vdpregs1 equ 0ffe7h-8 _interrupt1: push af ; disable screen (test) ld a,(vdpregs0+1) and 255-64 ld (vdpregs0+1),a ; 3/13 out (0x99),a ld a,0x80 + 1 out (0x99),a ; reset X scrolling xor a out (0x99),a ld a, 0x80 + 18 out (0x99),a ; red color for test ld a,8 out (0x99),a ld a, 0x80 + 7 out (0x99),a push hl ; set the new line interrupt at a lower line ld hl,_interrupt2 ld (0x0038+1),hl ld hl,vdpregs1+23 ; 3/10 ld a,255 ; 2/7 add a,(hl) ; 1/7 ld (vdpregs1+19),a ; 3/13 out (0x99),a ld a,0x80 + 19 out (0x99),a pop hl ; reset the line interrupt flag enabling the next line interrupt ld a,1 out (0x99),a ld a, 0x80 + 15 out (0x99),a in a,(0x99) xor a out (0x99),a ld a, 0x80 + 15 out (0x99),a pop af ret _interrupt2: push af ; green color for test ld a,3 out (0x99),a ld a, 0x80 + 7 out (0x99),a ; enable screen (test) ld a,(vdpregs0+1) or 64 ld (vdpregs0+1),a ; 3/13 out (0x99),a ld a,0x80 + 1 out (0x99),a push hl ; restore the line interrupt at a higher line ld hl,_interrupt1 ld (0x0038+1),hl ld hl,vdpregs1+23 ; 3/10 ld a,11*16-2 ; 2/7 add a,(hl) ; 1/7 ld (vdpregs1+19),a ; 3/13 out (0x99),a ld a,0x80 + 19 out (0x99),a pop hl ; read the S#0 !!! why I need this ??? in a,(0x99) ld a,1 out (0x99),a ld a, 0x80 + 15 out (0x99),a ; read the S#1 enabling the next line interrupt in a,(0x99) xor a out (0x99),a ld a, 0x80 + 15 out (0x99),a pop af ret #endasm
In my main, at initialization time, I have:
di ld hl,_interrupt1 ld a,0xC3 ld (0x0038+1),hl ld (0x0038),a ld a,(vdpregs0) or 16 ld (vdpregs0),a ; enable IE1 out (0x99),a ld a,0x80 out (0x99),a ld hl,vdpregs1+23 ; 3/10 ld a,11*16-2 ; 2/7 add a,(hl) ; 1/7 ld (vdpregs1+19),a ; 3/13 out (0x99),a ld a,0x80 + 19 out (0x99),a ei
At first glance the code works (tested on bluemsx)
I can see a red bar between line 11*16-2 and the end of the screen (line 192 in my test).
I've got the feeling that something does not work as it should...
If I set IE1 in R#0 I enable line interrupt at the line in R#19
The second interrupts was planned at line 255 !!
The green color, instead, starts midway at line 192 !!
My first question is:
a) Can we set line interrupts into the vertical border?
This leads to a new question:
b) is the line interrupt additional to the normal Vblank interrupt we get when IE0 is set ?
As I did not reset IE0 in R#1 I should continue to get the normal Vblank...
But that should prevent the call of interrupt2 at line 255...
I tried to disable IE0 (in theory no more vblank) but I get only a red screen, i.e. a call to interrupt1 and nothing else.
c) do IE1 AND IE0 interact?
Any expert here ?