Gameboy Development Forum

Discussion about software development for the old-school Gameboys, ranging from the "Gray brick" to Gameboy Color
(Launched in 2008)

You are not logged in.

Ads

#1 2018-01-02 14:20:09

Mills
Member
Registered: 2012-12-21
Posts: 132

Parallax effect for CGB

Hi, this is a fast (I think) Parallax fake for the Game Boy Color, all info is in readme.
Is is compiled to use with gbdk, but the C part of the code can be easily converted to asm (if you know how to).

It uses a little 16x16 pixel square, (I was not able to use a 64x64 one like toki tori).
This program uses the SCX and SCY registers to copy a specific frame of an animation to the parallax tiles, so this does not depend on anything else, just the scx and scy, and can be used with other functions.

https://raw.githubusercontent.com/mills32/Parallax-effect-for-Game-Boy-Color/master/graphics/bgb00010.bmp

In the sample demo, it works perfect, but using it with other functions may cause the dma function to write data outside vblank. I'm trying to use it in my puzzle game, but it usually produces garbage on screen because of this.

Hope it is usefull for someone.

Source and rom: https://github.com/mills32/Parallax-eff … -Boy-Color

Use pad to move screen.

Last edited by Mills (2018-01-04 10:59:56)

Offline

 

#2 2018-01-03 02:24:00

npzman
Banned
From:
Registered: 2014-11-19
Posts: 197

Re: Parallax effect for CGB

Nice one good job. Does it use ZGB ?

Last edited by npzman (2018-01-03 02:24:23)


Twitter : @Sfeedman please follow
Join : sfeed.club my website please join

Offline

 

#3 2018-01-04 06:08:39

Jonas
Member
From: Frankfurt, Germany
Registered: 2016-06-06
Posts: 112
Website

Re: Parallax effect for CGB

Good work, thanks for posting and uploading the source code!

Offline

 

#4 2018-01-05 18:19:36

DevEd
New member
Registered: 2015-11-04
Posts: 9

Re: Parallax effect for CGB

Please make an ASM only version. This would be incredibly useful to me if it weren't in C.


You know, the DevSound guy.

Offline

 

#5 2018-01-06 05:09:26

Mills
Member
Registered: 2012-12-21
Posts: 132

Re: Parallax effect for CGB

DevEd wrote:

Please make an ASM only version. This would be incredibly useful to me if it weren't in C.

My ASM knowledge is limited, Anyway it only has a bunch of "if" in c, to compare values, everything else is asm. If you know how to compare very big numbers in asm, you can easily port it.

Offline

 

#6 2020-06-25 16:34:18

psdominator
New member
Registered: 2020-06-25
Posts: 4

Re: Parallax effect for CGB

Is there a C only version, this would be useful for me.

Offline

 

#7 2020-06-26 11:37:32

toxa
Member
Registered: 2020-02-13
Posts: 305

Re: Parallax effect for CGB

you can write to HDMAx_REG's to rewrite DMA_TRANSFER() into C, and you can use several memcpy()'s for CPU_TRANSFER() replacement - that would be slower, but still work.

Offline

 

#8 2020-06-26 13:00:58

toxa
Member
Registered: 2020-02-13
Posts: 305

Re: Parallax effect for CGB

#define DMA_TRANSFER(sour, dest, sz) \
    HDMA1_REG = (UBYTE)((UWORD)(sour) >> 8), HDMA2_REG = (UBYTE)(sour), \
    HDMA3_REG = (UBYTE)((UWORD)(dest) >> 8), HDMA4_REG = (UBYTE)(dest), \
    HDMA5_REG = (UBYTE)(sz)

...

    DMA_TRANSFER(&tiles, 0x8000, (0x10u - 1) | 0x80); // transfer 16 tiles using H-Blank DMA

Offline

 

#9 2020-06-28 11:07:46

psdominator
New member
Registered: 2020-06-25
Posts: 4

Re: Parallax effect for CGB

thank you yery much smile

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson