13 May 2008

First way to scroll scanlines

Yesterday, I was exhausted, but I found out a code that could be interesing, the matters was that it used PAlib, but I think it wasn't restrictive, so I tried. I explain it a bit.

"Way to scroll scanlines (strips) of a bitmap bg via registers"
link here

1.- REG_VCOUNT is a readable register, and tell us in which line, the NDS is painting
2.- If we activate the IRQ_HBLANK interruption and mix with REG_VCOUNT, when we modify the BG2_CX, only will scroll the actual REG_VCOUNT line, so we can make effects like shaking, wavy, scrolling, etc...
3.- It's necessary activate IRQ_VBLANK to make only 192 changes per frame (swiWaitForVBlank();)

NOTES: BG2_CX =_val<<8; means 1pixel scroll, <<4 1/2 pixel scroll, and so on.

Now I'm looking for the way to do with HDMA, because this way needs to use the CPU for itself 192 times per frame, so takes a lot of CPU. (I think that because dsmume puts 120 but other emulators tells more than 35 fps, so I'm not sure about consumption).

No comments: