Scroll Map scaling

For anything related to VDP (plane, color, sprite, tiles)

Moderators: BigEvilCorporation, Mask of Destiny

Post Reply
Bitybity
Interested
Posts: 36
Joined: Wed Dec 07, 2011 2:09 am

Scroll Map scaling

Post by Bitybity » Mon Jun 11, 2012 1:51 am

Hello everyone. Here I come, with another question.

Have you ever played Thunder Force IV, and seen how does the title screen scales?

Here's what I mean:

Image
Image

I want to do some scaling in my game too, like this; but, I don't even know what logic have this.

Can someone tell me a way to do this? Thanks.

HardWareMan
Very interested
Posts: 745
Joined: Sat Dec 15, 2007 7:49 am
Location: Kazakhstan, Pavlodar

Post by HardWareMan » Mon Jun 11, 2012 3:32 am

Vertical screen scrolling at horizontal interrupt.

Bitybity
Interested
Posts: 36
Joined: Wed Dec 07, 2011 2:09 am

Post by Bitybity » Mon Jun 11, 2012 3:39 am

Okay, but, when HBlank is called, how many pixels must move, and how many times for each time HBlank is called?

HardWareMan
Very interested
Posts: 745
Joined: Sat Dec 15, 2007 7:49 am
Location: Kazakhstan, Pavlodar

Post by HardWareMan » Mon Jun 11, 2012 8:20 am

Set HBlank every 2 scanlines and scroll picture down by 1 pixel and you strech image by 2x. At VBlank you must reset scroll to 0.

Gigasoft
Very interested
Posts: 95
Joined: Fri Jan 01, 2010 2:24 am

Post by Gigasoft » Mon Jun 11, 2012 12:17 pm

I'm quite sure that it actually says "Thunder Farce".

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Mon Jun 11, 2012 4:17 pm

Gigasoft wrote:I'm quite sure that it actually says "Thunder Farce".
That was my first thought! :lol:

They're just putting a little "tail" on each letter, but it makes the "o" look more like an "a" instead.

sega16
Very interested
Posts: 251
Joined: Sat Jan 29, 2011 3:16 pm
Location: U.S.A.

Post by sega16 » Mon Jun 11, 2012 5:05 pm

Here is how you do it in asm

Code: Select all

;---------------------
; Horizontal Blank
;---------------------
HBlank:
	tst.b	(want_line_double)
	beq.s	   no_double	;branch if beq=0 bne!=0
	move.l	#$40000010,($C00004).l;		; Set VDP to V-Ram write mode at location 0000
	move.l	(vscroll),($C00000).l		; set the line scroll data
	subq	#1,(vscroll)
no_double:
	rte
If you want it to double plane b change the 4 to a 6
Also on vblank you must have:

Code: Select all

;---------------------
; Vertical Blank
;---------------------
VBlank:
	move.w	#$800,(vscroll)

and at the beginning of your code you must have

Code: Select all


	move.w	#$8014,($C00004).l	; enable H-interrupts
	move.w	#$8A01,($C00004).l
And to do it in c using SGDK
Vblank:

Code: Select all

void vblank()
{
    vscroll=0x800;
}

Code: Select all

void myHBlankFunction()
{
   *((u32 *) /*GFX_CTRL_PORT*/0xC00004) = 0x40000010;
    //asm("MOVE.L 0x40000010, (0xC00004)");

    *((u16 *) 0xC00000) = vscroll;
    vscroll--;

}
and in your main code do

Code: Select all

    setVBlankCallback(vblank);
      // define method to call on HInt / HBlank
  setHBlankCallback(myHBlankFunction);
  VDP_setHIntCounter(1);
  // enable H Int
  VDP_setHInterrupt(1);

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Mon Jun 11, 2012 5:47 pm

Shouldn't that

Code: Select all

tst.b   (want_line_double)
be more something like

Code: Select all

eori.b   #1,(want_line_double)
?

HardWareMan
Very interested
Posts: 745
Joined: Sat Dec 15, 2007 7:49 am
Location: Kazakhstan, Pavlodar

Post by HardWareMan » Mon Jun 11, 2012 8:03 pm

Chilly Willy wrote:Shouldn't that

Code: Select all

tst.b   (want_line_double)
be more something like

Code: Select all

eori.b   #1,(want_line_double)
?
Because it is mask flag, not even/odd scanline detector? And why don't just set HBlank firing every second scanline? For example my old video PD ROM:

Code: Select all

; In VDP init code set HBlank firing at every second scanline.
move.l   #$C00004,a6
move.l   #$C00000,a5
move.w   #$8A01,$c00004

; In VBlank procedure reset vertical scroll position.
move.l   #0,d5

; All dirty work done in HBlank procedure.
HInt:
cmp.w    #0,d5                  ;Begin of frame?
beq      HInit                  ;No - continue to scroll down by 1 scanline
move.l   #$40000010,(a6)        ;Access to scroll RAM
and.w    #$0FF,d5               ;Offset wraping
move.w   d5,(a5)                ;Access to scroll RAM
sub.w    #1,d5                  ;Next scanline
rte
HInit:
move.w   #$8A01,(a6)            ;Set HInt skip 1 scanline
move.l   #$40000010,(a6)        ;Access to scroll RAM
move.w   d5,(a5)                ;Access to scroll RAM
sub.w    #1,d5
rte
Sonic 3D Blast intro does same thing.

sega16
Very interested
Posts: 251
Joined: Sat Jan 29, 2011 3:16 pm
Location: U.S.A.

Post by sega16 » Mon Jun 11, 2012 9:05 pm

tst.b (want_line_double) works just fine what is means is do you want the screen doubled. Set it to zero do disable line doubling and set it to 1 to enable it.

Gigasoft
Very interested
Posts: 95
Joined: Fri Jan 01, 2010 2:24 am

Post by Gigasoft » Sun Jun 17, 2012 12:24 am

That's kind of pointless, since you could just disable H-interrupts instead. And instead of writing the address each time, you should set the auto-increment to 0.

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Sun Jun 17, 2012 2:06 am

Gigasoft wrote:That's kind of pointless, since you could just disable H-interrupts instead. And instead of writing the address each time, you should set the auto-increment to 0.
That was why I asked if the test was wrong... because if it's not, it's completely pointless. You either do the int or not, and that would be decided before enabling the hint or not. :lol:

Post Reply