gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > ARM-PDA to NDS portation problem

#47812 - Mighty Max - Wed Jul 13, 2005 8:58 pm

Hello,

i am currently working with some mates on the portation of an XStrong PDA application to the DS. As the XStrong is already a ARM microprocessor, this shouldnt be much of a problem for the most parts of the code.

I have looked into the DevKt ARM's libnds and ndslib includes to get the basic understanding about the DS framebuffer, but i didn't really get through. There seems to be a lot terminologie that is unknown to me in the definitions, as what a BG bank shall be etc ...

I did a search on the forums here already, but i could not find the explanation about the way the DS does the display in fully x1r5g5b5 mode.

What i'd need is to know where the framebuffer(s) of the NDS is located or how to read its address (if its variable). Is it possible in the non indexed (as in palette) xrgb mode to use transparent overlays ?

Thanks in advance
Mighty Max

#47816 - MrAdults - Wed Jul 13, 2005 9:43 pm

This should be everything you need then.
http://www.double.co.nz/nintendo_ds/nds_develop2.html

There is no palette-index-based mode (that I know of) for the framebuffer, but there are palette-based background modes that function similarly.

-Rich

#47818 - Mighty Max - Wed Jul 13, 2005 9:51 pm

Must have overseen it *scratch head*

Thank you :)

#47870 - dovoto - Thu Jul 14, 2005 5:10 am

There is the frame buffer which is unlayered and 15 bit color. There is also background modes which are layered and accessable as 15 bit or paletted frame buffers. These modes provide layering of backgrounds with limited transperency.

Also N was nice enough to give us more flexible sprites which include a true 2D 16 bit non-tiled mode.

Plenty of frame buffers to play around with and transperency can be had between them all (although it is not the most flexible of transperency)
_________________
www.drunkencoders.com

#48007 - Mighty Max - Fri Jul 15, 2005 10:57 pm

Thanks you too Dovoto :)

I think this is gonna be a time of noobism all over again ;)

As i don't want to just take but give too, i gonna add my replacement for the QueryPerformance functions from the WinAPI for everone.

Code:

bool timersinitialized = false ;

// additional define to timers.h
#define TIMER_PURE_CASCADE   (1<<2)

#ifndef _windef_
#define _windef_
typedef long BOOL ;
typedef __int64 LARGE_INTEGER ;
#define TRUE 0x80000000
#define FALSE 0x00000000
#endif

BOOL QueryPerformanceCounter(LARGE_INTEGER *lpPerformanceCount) {
   if (!timersinitialized) {
      // Initialize if not done before
      // Timer with 33.4MHz / 1024
      TIMER_CR(0) = TIMER_DIV_1024 | TIMER_PURE_CASCADE ;      // lower 16 bit
      TIMER_CR(1) = TIMER_PURE_CASCADE ;                  // bit 16..31
      TIMER_CR(2) = TIMER_PURE_CASCADE ;                  // bit 32..47
      TIMER_CR(3) = TIMER_PURE_CASCADE ;                  // highest 16 bit
      timersinitialized = true ;
   } ;
   // read the registers and combine 64bits (__int64)
   *lpPerformanceCount = (__int64)TIMER_DATA(0) | (TIMER_DATA(1) << 16) | (TIMER_DATA(2) << 32) | (TIMER_DATA(3) << 48) ;
   return TRUE ;
} ;

BOOL QueryPerformanceFrequency(LARGE_INTEGER *lpFrequency) {
   // counts per sec
   *lpFrequency = 33400000 / 1024 ;      // 33.4 M
   return TRUE ;
} ;


PS: I didnt come to test it yet, as my hardware did not yet arrive.