Writing to registers on the lineinterrupt. (Development Foros MSX)MSX Resource Center            
                       
English Nederlands Espa�ol Portugu�s Russian                  
 Noticias
   Página principal
  Almacén de noticias
  Temas de noticias

 Recursos
   Foros MSX
  Artículos
  Analisis
  Informe de ferias/RUs
  Álbum de fotos
  Ferias y encuentros
  Encuestas
  Enlaces
  Buscar

 Software
   Descargas
  Tienda Online

 MRC
   Quiénes somos
  Únete a nuestro equipo
  Donar
  Políticas
  Contacta con nosotros
  Enlázanos
  Estadísticas

 Buscar
 
  

  

 Login
 

Login

Contraseña




¿Aún no tienes una cuenta? ¡Conviértete en miembro del MSX Resource Center! ¡Únete a nosotros!.


 Estadísticas
 

Hay 63 invitados y 9 miembros en línea

Eres un usuario anónimo.
 

Foros MSX


Foros MSX

Development - Writing to registers on the lineinterrupt.

Ir a la página ( 1 | 2 Siguiente página )
Autor

Writing to registers on the lineinterrupt.

norakomi
msx professional
Mensajes: 861
Publicado: Agosto 04 2005, 19:06   
Hello,
I just thought about something.
At line y=19, my Lineinterrupt starts, and this is what it does:
Lineint:
Ld a,(scroll)
Out ($99),a
Ld a,18+128 ;horizontal scroll register
Out ($99),a
Ret
This lineinterrupt Interrupts my normal interrupt at VBLANK,
Now, I think THIS IS THE REASON why my msx has been CRASHING ever since I started working with the screensplit.

I think that when the VBLANK int. starts and reaches line y=19 while writing or reading a register,
The interrupt messes this process up, which at times results in a crash.....
Can someone confirm this please??
BiFi
msx guru
Mensajes: 3142
Publicado: Agosto 04 2005, 19:30   
Line interrupts can't be done on the VBLANK interrupt. By then the line was scanned and handled already. You need to put the line interrupt on a different hook. Where hook $FD9F is called when a VBLANK interrupt occurs, hook $FD9A is called every time an interrupt occurs. For a line interrupt on the interrupt handler you need to set the $FD9A hook to read the Line Interrupt flag (FH, bit 0 in S#1) and set the IE1 bit to enable interrupts on the Line Interrupt.

At the line interrupt you first need to read the Line Interrupt flag to determine which device caused the interrupt... something like this:

init:
...
ld a,($f3df) ; enable IE1
or 16
ld ($f3df),a
out ($99),a
ld a,128+0
out ($99),a
...


FD9A:
push af
ld a,1 ; read S#1
out ($99),a
ld a,128+15
out ($99),a
nop
in a,($99)
rra
jp nc,nextint

ld a,(scroll)
out ($99),a
ld a,128+18
out ($99),a
...

nextint:
pop af
ret

GhostwriterP
msx addict
Mensajes: 320
Publicado: Agosto 04 2005, 19:40   
It will only interrupt your VBLANK interrupt if you have used EI. Otherwise it will just folowup as
soon the VBLANK int is finished.
By recalling that you do a lot in your VBLANK int (i believe like that big copy, music, sfx and then writing
SPAT [so waiting for the copy to finish]) you might be better of with a status/score panel at the bottom
of the screen.
And BTW you do set the line int in your VBLANK int right? How do you keep track of what interrupt occeurs,
do read it or use the fact that the next int is no other than the line int and after that it is VBLANK again?
Latok
msx master
Mensajes: 1735
Publicado: Agosto 04 2005, 19:41   
It's amazing how fast and accurate you're answering such questions, BiFi. Cheers for that
GhostwriterP
msx addict
Mensajes: 320
Publicado: Agosto 04 2005, 19:47   
Whoa... BIOS hooks... Sloooooow!
There are a lot of unnesesary pushes... and thus a lot off pops required.
You better set the line int for 2 or 3 line earlier then

But then i don not know much about BIOS so i clould be mistaken.
BiFi
msx guru
Mensajes: 3142
Publicado: Agosto 04 2005, 19:52   
Latok: you know me... coder at heart

GhostP: I agree, but he doesn't say he's running all this in MSX-DOS environment where he can set up his own interrupt handler since it's RAM in that area... And it's also possible to do continuous polling on the line interrupt and VBLANK... result: no interrupts at all...
norakomi
msx professional
Mensajes: 861
Publicado: Agosto 06 2005, 21:48   
No, Im not running under dos,
Is there a way to override *not use* the Bios.
Because I'm using the Bios at Vblank int, and also with Lineint,
however, I have not got a clue what the difference is between using or not using
the Bios at the interrupt,

Its very vague (yep, Im a newbee) for me......

And I still would like to hold on to Wbass2 (sorry, I still like it,... its like
your first bike, ... ride it till your old)
Sonic_aka_T

msx guru
Mensajes: 2269
Publicado: Agosto 06 2005, 22:33   
norakomi: WB-ASS2 is great, but it's not a suitable assembler/environment to write SpaceManbow2 (or any shooter for that matter). You would need to switch to a more 'heavy duty' assembler that can handle large sources. Personally, I'd suggest some of the newer xdev (Hi Wolf!) assemblers like tniasm or sjasm.

With regard to when you're using the BIOS, if you do a CALL to any address from $0000 - $3FFF, then you're using a BIOS routine. If you don't do any of those, you're not (actively) using the BIOS. In that case, I would indeed suggest 'deactivating' the BIOS alltogether, by setting RAM at $0000 - $7FFF and creating your own ISR. Remember to PUSH/POP all your registers in this ISR! If you want, you can eliminate some of those register-saves later on, if you're absolutely sure you're not using them. Also be sure you check the VDP for ints on this ISR, if not it'll keep generating them...
norakomi
msx professional
Mensajes: 861
Publicado: Agosto 07 2005, 00:48   
creating my own ISR>???

no clue, could you gimme an example???
Sonic_aka_T

msx guru
Mensajes: 2269
Publicado: Agosto 07 2005, 01:15   
uhm, it pretty much says what to do right there... PUSH all the registers, check the VDP to see if it was the VBLANK interrupt, if so call the routine you use to handle the VBLANK 'event' (did I just use that word?!?), if not check if it is a line interrupt and call the appropriate routine. After that, pop all registers again and return. You may need/want to enable/disable interrupts at some point, depending on how your code would normally execute. Keep in mind that something other than the VDP may generate INTs and foul things up for you. Also keep in mind that the correct code is present when the interrupt occurs. This usually means your ISR will be in either page 0 or 3, since there's almost always RAM there. Also keep in mind that you can't use the BIOS anymore after installing this ISR since may BIOS routines will do all sorts of nasty things like setting ROM everywhere and then enableing ints... not a good thing...

anyhoo:
	ORG $0038

	JP	MY_ISR



	ORG	$C000

MY_ISR:
	PUSH	AF
	CALL	INT_HK		; Call on ALL interrupts
	IN	A,($99)
	RLCA
	CALL	C,VBL_HK	; Call on VBLANK only
	POP	AF
	RET
In INT_HK you would prolly only need to check if the interrupt was generated by a line-interrupt or not. If so, you PUSH all the registers (alternatively only those you use in those routines) and call your line-interrupt routine, if not, you just RET. On VBL_HK you would probably end up pushing ALL your registers (remember the alternative registers!) since the replayer most probably uses all of 'em. Before calling your replayer you'll prolly want to call your 'graphics routines' first though, things like updating the sprite-table-pointers and setting VDP18. Anyhoo, I'm sure you get the idea...
norakomi
msx professional
Mensajes: 861
Publicado: Agosto 07 2005, 15:31   
Quote:


And BTW you do set the line int in your VBLANK int right? How do you keep track of what interrupt occeurs,
do read it or use the fact that the next int is no other than the line int and after that it is VBLANK again?


Vblank int is set on $Fd9f, and on $Fd9a is the line int.
Because $fd9a is called at y=212 and y=19 (at the splitline) I use the y=212 to set EI1 (enabling the splitline). As soon as the splitline is reached I disable EI1.
norakomi
msx professional
Mensajes: 861
Publicado: Agosto 07 2005, 15:40   
Quote:



anyhoo: ORG $0038

JP MY_ISR




So when I use $fd9f for my Vblank int. this means that when VBLANK is reached,
a call is made to $38, and there all the registers are pushed, followed by a RET,
then the jump to the VBLANK routine is made (which is set up in $fd9a-$fd9b),
doing all the things like the music replay etc..... and when , at the end of this
routine, is type EI, followed by RET, another call is made to $38 (or somewhere
in that area) to POP all the registers I pushed.......

so, at the interrupt:
PUSH registers, (Bios)
do Routine
POP registers, (Bios)

(hey, I think I'm starting to finaly understand (more 'bout) this Bios-thingy)

8)
AuroraMSX

msx master
Mensajes: 1277
Publicado: Agosto 07 2005, 17:06   
Quote:

Quote:



anyhoo:
	ORG $0038

	JP	MY_ISR




So when I use $fd9f for my Vblank int. this means that when VBLANK is reached,
a call is made to $38, and there all the registers are pushed, followed by a RET,
then the jump to the VBLANK routine is made (which is set up in $fd9a-$fd9b),
doing all the things like the music replay etc..... and when , at the end of this
routine, is type EI, followed by RET, another call is made to $38 (or somewhere
in that area) to POP all the registers I pushed.......



Close...
    ; this is an approximation of the BIOS code :)
    org #38
    jp int_routine

        :

int_routine: ; somewhere in the BIOS
    ; push all registers from AF upto IY
    ; and possibly the complete alternative reg set too, dunno
    call $FD9A ; H.KEYI - on each and every interrupt
    ; check if it's the VBLANK interrupt (set Z if so :-))
    call z,$FD9F ; H.TIMI 
    ; now do lot's of other stuff like checking the keyboard, 
    ; playing music (PLAY) etcetc
    ; pop all registers
    EI
    RET

Something like that. So the call to #0038 is made only once and from the BIOS routine, the hooks are CALLed ...

norakomi
msx professional
Mensajes: 861
Publicado: Agosto 07 2005, 17:21   
so if i in Wbass2 type
page 0,3,2,5 (for turboR)
then I can start to use the Bios,

AND set up my own ISR at $38...... correct?

But is there another advantage next to speed to set up your own ISR?
Sonic_aka_T

msx guru
Mensajes: 2269
Publicado: Agosto 07 2005, 18:23   
Not just speed, you also get nearly 16kBs of extra RAM... mind you, WB-ASS2 uses the BIOS, so you prolly have to be very careful about turning off the BIOS. Personally, I'd ditch WB-ASS2 while you still can, and go with one of the newer cross-assemblers. There's limits to what WB-ASS2 can do, and with SpaceManbow2 you would've prolly reached that limit.
 
Ir a la página ( 1 | 2 Siguiente página )
 







(c) 1994 - 2009 Fundación MSX Resource Center. MSX es una marca registrada de MSX Licensing Corporation