Interrrrrrupt !!! (Development MSX Fora)MSX Resource Center PassionMSX MSX2 contest           
            
English Nederlands Español Português Russian         
 Nieuws
   Voorpagina
  Nieuws archief
  Nieuws onderwerpen

 Informatie
   MSX Fora
  Artikelen
  Recensies
  Beursverslagen
  Fotoreportages
  Beurzen en meetings
  Enquêtes
  Links
  Zoek

 Software
   Downloads
  Webshop

 MRC
   Wie we zijn
  Kom bij ons team
  Doneren
  Policies
  Contact met het MRC
  Link naar Ons
  Statistieken

 Zoek
 
  

  

 Login
 

Gebruikersnaam

Wachtwoord




Ben je nog niet lid? Klik hier en word MSX vriend!


 Statistieken
 

Er zijn 128 gasten en 1 MSX vriend online

Je bent een anonieme bezoeker.
 

MSX Fora


MSX Fora

Development - Interrrrrrupt !!!

Ga naar pagina ( 1 | 2 Volgende pagina )
Schrijver

Interrrrrrupt !!!

norakomi
msx professional
Berichten: 861
Geplaatst: 08 Mei 2005, 23:39   
LD A,$C3
LD ($FD9F),A
LD HL,STARS
LD ($FDA0),HL
RET

I figured out that this makes sets the computer to jump to label STARS on every interrupt.
But which interrupt is this?
And how can I make the computer jump to STARS at the start of VBLANK period?

And...... what does the LD A,$C3 imply to?
or the addresses ($FD9F-$FDA0)?
Edwin
msx professional
Berichten: 591
Geplaatst: 09 Mei 2005, 00:24   
$FD9F is the VDP interrupt hook, which actually *is* jumped to at the start of the VBLANK. (unless you turned off IE0 in the VDP)

$C3 implies a JP instruction.


Sonic_aka_T

msx guru
Berichten: 2261
Geplaatst: 09 Mei 2005, 00:27   
Well, first off, always be sure you do this with interrupts DISABLED. If not, you can get a real mess... Those addresses, called hooks, are CALLED every (vdp)interrupt by the MSX BIOS. There's two, one on $FD9A, one on $FD9F. Now, I can never remember which is which, but I *think* $FD9A is called on EVERY interrupt (be it from the VDP or any other source) and $FD9F is only called on the VDP's VBLANK. It could be the other way around tho...

Anyhoo, since the BIOS calls these hooks, you can put some code there to be executed whenever those hooks are called. By writing a $C3 to $FD9F and the address of 'STARS' to $FDA0-$FDA1 you're putting the code JP STARS on that hook. So basically you're telling the BIOS to jump to 'STARS' on every VDP vblank interrupt.

SetHook:
	LD	A,$C3
	LD	HL,MyInterrupt
	DI
	LD	($FD9F),A
	LD	($FDA0),HL
	EI
	RET
Mind you, you're not saving the old hook in this case. It's best to also save the previous code (using an LDIR or something) and jump to it at the end of your new interrupt routine...

Sonic_aka_T

msx guru
Berichten: 2261
Geplaatst: 09 Mei 2005, 00:29   
)^_^) "Hi edwin!"
norakomi
msx professional
Berichten: 861
Geplaatst: 09 Mei 2005, 00:44   
cool !!!
Now I know what a 'hook' is !!

Ouch !!! My brain is too small for all of this
norakomi
msx professional
Berichten: 861
Geplaatst: 09 Mei 2005, 01:20   
another question
(you must be thinkin somethin like: AAAAAAAAAA no more questions !!!!)

If I put a sprite on screen and keep it at a fixed position (y=y+r#23)
in screen (in the centre),
while r#23 scrolls the screen (slowly) by constantly adding +1 to r#23

what happens is:
You see the sprite standing in the middle of the screen and you see a white block scrolling
from the bottom of the screen to the top, and this repeats itself.

When this white block touches the sprite (meaning the sprite has an y coordinate of 211)
the sprite will blink on that line.
If I scroll r#23 with 2 pixels at a time, the sprite will not blink, because it will never have an
y coordinate of 211.

Is there a sollution for this problem, or does this mean that vertical
scrolling allways has to occur with 2,4,6,8 (etc.) pixels at a time??
BiFi
msx guru
Berichten: 3142
Geplaatst: 09 Mei 2005, 07:28   
Quote:

By writing a $C3 to $FD9F and the address of 'STARS' to $FDA0-$FDA1 you're putting the code JP STARS on that hook. So basically you're telling the BIOS to jump to 'STARS' on every VDP vblank interrupt.

Actually, you're telling the Z80 to jump to 'STARS' when apparently the vblank caused the interrupt. The BIOS isn't going anywhere. It'll stay exactly where it is, since it's in ROM.
[D-Tail]

msx guru
Berichten: 2991
Geplaatst: 09 Mei 2005, 07:58   
norakomi: the VDP manual states that a sprite on line 216 won't be displayed, and sprites with a lower priority than that one either. In MSX1 screenmodes that's Y coordinate 208. Perhaps that is what's buggering you

And there's nothing you can do about it, really. Just try to fix a workaround. I myself had problems with some BASIC race game (*sigh*, there we go again :\), which put the sprite on Y=215 whenever the Y coordinate would be 216.
BiFi
msx guru
Berichten: 3142
Geplaatst: 09 Mei 2005, 08:13   
Most games with hardware vertical scroll (if not all) simply jump over Y=216. You might want to use that too.
ro
msx guru
Berichten: 2307
Geplaatst: 09 Mei 2005, 09:56   
norakomi, can you read any dutch? then I might have the perfect articles for you lying around somewhere...

some specs on ints:
- Interrupts are called from the VDP times (50 times per second on PAL monitor and 60 time per second on NTSC monitor. you can select pal/ntsc mode with vpd reg 9. bit 1: 0=ntsc, 1=pal.. or was it the other way around?)
- There can also be other interrupt sources like the MSX AUDIO / MoonSound for example. But we'll stick the the default; VPD in these examples.
- There are 2 kinda VDP interrupts. The VBLANK which happens any 1/50(1/60) of a second at the BOTTOM of the screen. This one is kinda default. In BIOS mode (page 0,0,0 <- set to standard BIOS) and will call the "hook" 0xFD9F. The other interrupt is a bit more complicated; the Line Interrupt (LNI for short) You can set more than one LNI per screenbuild up. more on that later when you have some experience. let's concentrate on the Vblank for now
- Every time an (VDP) interrupt occurs the addres 0x38 in the BIOS is called. Take a look with your disassembler at that routine. 0x38 does various things; "call" the FD9F HOOK, handle keyboard input, handel some BASIC stuff (like the PLAY command), check drive status, control some timers and much more stuff.
- the HOOK is where you can "hook" on your own routine. check Sonic's remarks above... FD9F is the VBLANK hook while FD9A is the LNI hook

Hope you get an idea of how all this (complicated) stuff works...
cheers.
BiFi
msx guru
Berichten: 3142
Geplaatst: 09 Mei 2005, 10:31   
FD9A is the hook which is called every interrupt, regardless if it's a VDP line interrupt. This is done to have other than VDP interrupts handled, like MSX-AUDIO, GFX9000, Moonsound, RS232 interfaces and other hardware capable of sending an interrupt signal...

For example... The latest Moonblaster Wave replayer uses the OPL4 timer to handle the music playing on.

This in addition to ro's quite complete explaination...
[D-Tail]

msx guru
Berichten: 2991
Geplaatst: 09 Mei 2005, 13:11   
Quote:

Most games with hardware vertical scroll (if not all) simply jump over Y=216. You might want to use that too.

Mm... don't think that will fix it. It's about to avoid sprites getting Y=216. Since sprite coordinates differ over time (that's what sprites are for, keep 'em moving), it's hard to tell at what R#23 value the sprite flicker will occur. Better to avoid it in the sprite tables.
BiFi
msx guru
Berichten: 3142
Geplaatst: 09 Mei 2005, 14:54   
I don't think you understand... It's not the value of R#23 that causes the sprite flicker, it's the Y coordinate of the sprite you need to update while doing a R#23 scroll to keep the sprite in the same place on the screen during the scroll.
[D-Tail]

msx guru
Berichten: 2991
Geplaatst: 09 Mei 2005, 16:11   
Quote:

norakomi: the VDP manual states that a sprite on line 216 won't be displayed, and sprites with a lower priority than that one either. In MSX1 screenmodes that's Y coordinate 208. Perhaps that is what's buggering you

And there's nothing you can do about it, really. Just try to fix a workaround. I myself had problems with some BASIC race game (*sigh*, there we go again :\), which put the sprite on Y=215 whenever the Y coordinate would be 216.

Quoting myself feels a bit awkward ^^

[edit]Extra explanation: I figured you meant R#23 = 216 when you said 'most games using hardware scroll skip that line'. Ha well...[/edit]
Sonic_aka_T

msx guru
Berichten: 2261
Geplaatst: 09 Mei 2005, 16:29   
Quote:

Quote:

By writing a $C3 to $FD9F and the address of 'STARS' to $FDA0-$FDA1 you're putting the code JP STARS on that hook. So basically you're telling the BIOS to jump to 'STARS' on every VDP vblank interrupt.

Actually, you're telling the Z80 to jump to 'STARS' when apparently the vblank caused the interrupt. The BIOS isn't going anywhere. It'll stay exactly where it is, since it's in ROM.

Ofcourse if I were equally anal I would ask you how high the Z80 jumps
 
Ga naar pagina ( 1 | 2 Volgende pagina )
 







(c) 1994 - 2008 Stichting MSX Resource Center. MSX is een trademark van MSX Licensing Corporation.