Page 1 of 1

Scroll Map scaling

Posted: Mon Jun 11, 2012 1:51 am
by Bitybity
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.

Posted: Mon Jun 11, 2012 3:32 am
by HardWareMan
Vertical screen scrolling at horizontal interrupt.

Posted: Mon Jun 11, 2012 3:39 am
by Bitybity
Okay, but, when HBlank is called, how many pixels must move, and how many times for each time HBlank is called?

Posted: Mon Jun 11, 2012 8:20 am
by HardWareMan
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.

Posted: Mon Jun 11, 2012 12:17 pm
by Gigasoft
I'm quite sure that it actually says "Thunder Farce".

Posted: Mon Jun 11, 2012 4:17 pm
by Chilly Willy
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.

Posted: Mon Jun 11, 2012 5:05 pm
by sega16
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);

Posted: Mon Jun 11, 2012 5:47 pm
by Chilly Willy
Shouldn't that

Code: Select all

tst.b   (want_line_double)
be more something like

Code: Select all

eori.b   #1,(want_line_double)
?

Posted: Mon Jun 11, 2012 8:03 pm
by HardWareMan
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.

Posted: Mon Jun 11, 2012 9:05 pm
by sega16
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.

Posted: Sun Jun 17, 2012 12:24 am
by Gigasoft
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.

Posted: Sun Jun 17, 2012 2:06 am
by Chilly Willy
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: