Blanking the display for one (or more) scanlines only
Moderator: BigEvilCorporation
-
- Very interested
- Posts: 209
- Joined: Sat Sep 08, 2012 10:41 am
- Contact:
Blanking the display for one (or more) scanlines only
Hi!
I'm trying to achieve a "letterbox" style mode for cutscenes, creating black bars at the top and bottom of the screen. Modifying the tiles isn't a viable option without some considerable changes to my codebase, and it would use too many sprites.
I've tried blanking the display by modifying VDP reg 2 during HINT, which seems to give the desired effect for sprites but not for scroll planes.
Has anyone experimented with changing VDP regs inside HINT, and could share their findings?
I'm trying to achieve a "letterbox" style mode for cutscenes, creating black bars at the top and bottom of the screen. Modifying the tiles isn't a viable option without some considerable changes to my codebase, and it would use too many sprites.
I've tried blanking the display by modifying VDP reg 2 during HINT, which seems to give the desired effect for sprites but not for scroll planes.
Has anyone experimented with changing VDP regs inside HINT, and could share their findings?
A blog of my Megadrive programming adventures: http://www.bigevilcorporation.co.uk
Re: Blanking the display for one (or more) scanlines only
VDP reg 2 ($82xx) is the scroll A plane address...
As far as I'm aware you just have to toggle the display bit in reg 1 ($8134 disables display while keeping vblank IRQ and DMA turned on, $8174 turns it back on). That should affect everything, just beware that if you do it mid-scanline that it will blank the line halfway (with a granurality of 16 pixels - note to emulator authors: do it too early and Overdrive glitches).
If you only got it to work for sprites then you did something really wrong =P
As far as I'm aware you just have to toggle the display bit in reg 1 ($8134 disables display while keeping vblank IRQ and DMA turned on, $8174 turns it back on). That should affect everything, just beware that if you do it mid-scanline that it will blank the line halfway (with a granurality of 16 pixels - note to emulator authors: do it too early and Overdrive glitches).
If you only got it to work for sprites then you did something really wrong =P
Sik is pronounced as "seek", not as "sick".
-
- Very interested
- Posts: 209
- Joined: Sat Sep 08, 2012 10:41 am
- Contact:
Re: Blanking the display for one (or more) scanlines only
Damn. Well, my code is simple enough:Sik wrote:If you only got it to work for sprites then you did something really wrong =P
Code: Select all
HBlankInterrupt:
move.l d0, -(sp)
move.w (hline_counter), d0
andi.w #0x1, d0
cmp.w #0x1, d0
beq @ScreenOff
move.w #0x8174, vdp_control
bra @EndLetterbox
@ScreenOff:
move.w #0x8134, vdp_control
@EndLetterbox:
move.l (sp)+, d0
addi.w #0x1, hline_counter
rte
but the original scene looks like:
A blog of my Megadrive programming adventures: http://www.bigevilcorporation.co.uk
Re: Blanking the display for one (or more) scanlines only
You aren't trying to write to the scroll planes while the hblanks are happening, right? Because setting a register will unset the current address.
By the way, you can remove the CMP, it's redundant. In fact, it the subroutine is in RAM (convenient when you can have multiple hblank subroutines in the program) you probably could do this (where HBlank points to the subroutine address in RAM):
EDIT: but wait, is the scanlines effect the one you're trying to do? =/
By the way, you can remove the CMP, it's redundant. In fact, it the subroutine is in RAM (convenient when you can have multiple hblank subroutines in the program) you probably could do this (where HBlank points to the subroutine address in RAM):
Code: Select all
move.w #$8134, ($C00004)
bchg.b #6, (HBlank+3)
rte
Sik is pronounced as "seek", not as "sick".
-
- Very interested
- Posts: 209
- Joined: Sat Sep 08, 2012 10:41 am
- Contact:
Re: Blanking the display for one (or more) scanlines only
No, I keep the update and render code mutually exclusive, and there is nothing else in my hblank routine.Sik wrote:You aren't trying to write to the scroll planes while the hblanks are happening, right? Because setting a register will unset the current address.
Yep, something I learned recently and need to go back over the whole codebase optimising it all! Self-modifying code isn't something I've started learning yet, maybe later.Sik wrote: By the way, you can remove the CMP, it's redundant.
No, this is just a test. Eventually I want to blank the first and last 16 scanlines (maybe animating from 0 to 16).Sik wrote: EDIT: but wait, is the scanlines effect the one you're trying to do? =/
A blog of my Megadrive programming adventures: http://www.bigevilcorporation.co.uk
-
- Very interested
- Posts: 237
- Joined: Fri Apr 17, 2009 7:35 pm
- Location: USA
Re: Blanking the display for one (or more) scanlines only
I was thinking you could probably achieve the effect using h-ints to copy palettes at the appropriate times. You start with an all black palette, then when you hit the right scanline, switch to your color palette. Then when you hit the scanline you want on the bottom, switch back to all-black. You'd likely get the ugly CRAM dots here (but maybe it wouldn't be as obvious? They would be black perhaps??). This way you wouldn't even need to worry about masking sprites or constraining them to the viewport.
If there's a hole in this idea I'm curious.
If there's a hole in this idea I'm curious.
my album - last thursday died last week
-
- Very interested
- Posts: 2440
- Joined: Tue Dec 05, 2006 1:37 pm
- Location: Estonia, Rapla City
- Contact:
Re: Blanking the display for one (or more) scanlines only
It is easier to turn off rendering than to start messing with CRAM in the HBL handler, 1 write vs bazillion
Mida sa loed ? Nagunii aru ei saa
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen
Re: Blanking the display for one (or more) scanlines only
Sik wrote:Code: Select all
move.w #$8134, ($C00004) bchg.b #6, (HBlank+3) rte
VERY
CLEVER !!!!!
just that