Browse Source

* Updated libndsfpc to ver. 1.5.7

git-svn-id: trunk@22648 -
Legolas 12 years ago
parent
commit
5e40262fe2

+ 1 - 0
.gitattributes

@@ -4964,6 +4964,7 @@ packages/libndsfpc/src/nds/input.inc svneol=native#text/plain
 packages/libndsfpc/src/nds/interrupts.inc svneol=native#text/plain
 packages/libndsfpc/src/nds/ipc.inc svneol=native#text/plain
 packages/libndsfpc/src/nds/jtypes.inc svneol=native#text/plain
+packages/libndsfpc/src/nds/libversion.inc svneol=native#text/plain
 packages/libndsfpc/src/nds/memory.inc svneol=native#text/plain
 packages/libndsfpc/src/nds/nds.inc svneol=native#text/plain
 packages/libndsfpc/src/nds/ndsinclude.inc svneol=native#text/plain

+ 2 - 2
packages/libndsfpc/examples/filesystem/nitrofs/nitrodir/Makefile.fpc

@@ -4,7 +4,7 @@
 
 [target]
 loaders= 
-programs=*
+programs=nitrodir
 
 [require]
 packages=libndsfpc
@@ -20,7 +20,7 @@ target=nds
 fpcdir=../../../../../..
 
 [compiler]
-options=-gl -Xm -O2 
+options=-Xm -O2 
 #-d__THUMB__
 
 [clean]

+ 1 - 1
packages/libndsfpc/examples/gl2d/2Dplus3D/Makefile.fpc

@@ -20,7 +20,7 @@ target=nds
 fpcdir=../../../../..
 
 [compiler]
-options=-gl -Xm -O2 
+options=-Xm -O2 
 #-d__THUMB__
 
 [clean]

+ 1 - 1
packages/libndsfpc/examples/gl2d/dual_screen/Makefile.fpc

@@ -20,7 +20,7 @@ target=nds
 fpcdir=../../../../..
 
 [compiler]
-options=-gl -Xm -O2 
+options=-Xm -O2 
 #-d__THUMB__
 
 [clean]

+ 1 - 1
packages/libndsfpc/examples/gl2d/fonts/Makefile.fpc

@@ -20,7 +20,7 @@ target=nds
 fpcdir=../../../../..
 
 [compiler]
-options=-gl -Xm -O2 
+options=-Xm -O2 
 #-d__THUMB__
 
 [clean]

+ 1 - 1
packages/libndsfpc/examples/gl2d/primitives/Makefile.fpc

@@ -20,7 +20,7 @@ target=nds
 fpcdir=../../../../..
 
 [compiler]
-options=-gl -Xm -O2 
+options=-Xm -O2 
 #-d__THUMB__
 
 [clean]

+ 1 - 1
packages/libndsfpc/examples/gl2d/scrolling/Makefile.fpc

@@ -20,7 +20,7 @@ target=nds
 fpcdir=../../../../..
 
 [compiler]
-options=-gl -Xm -O2 
+options=-Xm -O2 
 #-d__THUMB__
 
 [clean]

+ 1 - 1
packages/libndsfpc/examples/gl2d/sprites/Makefile.fpc

@@ -20,7 +20,7 @@ target=nds
 fpcdir=../../../../..
 
 [compiler]
-options=-gl -Xm -O2 
+options=-Xm -O2 
 #-d__THUMB__
 
 [clean]

+ 6 - 1
packages/libndsfpc/examples/graphics/Backgrounds/256_color_bmp/256ColorBmp.pp

@@ -33,6 +33,11 @@ begin
 
 
   while true do
-    swiWaitForVBlank();
+  begin
+		swiWaitForVBlank();
+		scanKeys();
+		if (keysDown() and KEY_START) <> 0 then 
+      exit;
+  end;
 
 end.

+ 3 - 1
packages/libndsfpc/examples/graphics/Backgrounds/Double_Buffer/DoubleBuffer.pp

@@ -43,7 +43,9 @@ begin
 				backBuffer[iy * 256 + ix] := random(colorMask) or BIT(15);
 
 		swiWaitForVBlank();
-
+		scanKeys();
+		if (keysDown() and KEY_START) <> 0 then 
+      exit;
 		//swap the back buffer to the current buffer
 		backBuffer := pcuint16(bgGetGfxPtr(bg));
 

+ 50 - 0
packages/libndsfpc/examples/graphics/Backgrounds/all_in_one/Advanced.pp

@@ -163,8 +163,58 @@ begin
 end;
 
 procedure advExtendedPalette();
+var
+  paletteSlots: array [0..3] of pcuint16; 
+  i: integer;
+  bg: integer;
 begin
+  (*
+  When extended palettes are enabled all tiled backgrounds which utilize 
+  16 bit map entries will use extended palettes.  Everything else will continue
+  to use standard palette memory.
+
+  Each tile on the screen may chose one of 16 256-color palettes.  Each background 
+  has its own set of 16 palettes meaning you can have 4*16*256 colors on screen 
+
+  Each background uses 8K of palette memory starting at the base of the vram bank
+  you allocate (which bank is up to you within limits, see the vram usage table
+  to determine which banks can be mapped for textures).  These 8K blocks are often
+  refered to as "slots" with each background getting its own slot.  
+
+   By default, Background 0 uses slot 0 ... Background 3 uses slot 3.  It is possible
+   to assign Background 0 to slot 2 and Background 1 to slot 3 (only these two are configurable)
+  
+  For more information: <a href="http://nocash.emubase.de/gbatek.htm#dsvideoextendedpalettes">gbatek</a>
+  *)
+
+  for i := 0 to 3 do
+    paletteSlots[i]^ := VRAM_E[i * 16 * 256];
+
+  videoSetMode(MODE_0_2D);
+  vramSetBankA(VRAM_A_MAIN_BG);
+
+  //enable extended palettes for background. Once on, the standard BG_PALETTE will 
+  //be ignored for tiled backgrounds with 16 bit map entries (everything else still uses
+  //the standard palette)
+  bgExtPaletteEnable();
+  
+  bg := bgInit(0, BgType_Text8bpp, BgSize_T_256x256, 0, 1);
+	
+	dmaCopy(@TextBackgroundsTiles, bgGetGfxPtr(bg), sizeof(TextBackgroundsTiles));
+	dmaCopy(@Layer256x256Map, bgGetMapPtr(bg),  Layer256x256MapLen);
+  
+  //lock vram E as we are going to use it for 
+  //extended palettes (see documentation for which vram 
+  //banks can be utilized).  You cannot write to it once
+  //it is mapped to the GPU.  These means you should
+  //not update your ext palettes outside of a blank period
+  vramSetBankE(VRAM_E_LCD);
+  dmaCopy(@TextBackgroundsPal, paletteSlots[0], sizeof(TextBackgroundsPal));
+  
+  //tell the GPU to use vram E as extended palette memory
+  vramSetBankE(VRAM_E_BG_EXT_PALETTE);
 
+	scroll(bg, 256, 256);
 end;
 
 procedure advMultipleLayers();

+ 2 - 0
packages/libndsfpc/examples/graphics/Backgrounds/rotation/Rotation.pp

@@ -78,6 +78,8 @@ begin
 
 
     swiWaitForVBlank();
+		if (keysDown() and KEY_START) <> 0 then 
+      exit;
 
     bgSetCenter(bg3, rcX, rcY);
     bgSetRotateScale(bg3, angle, scaleX, scaleY);

+ 4 - 1
packages/libndsfpc/examples/graphics/Sprites/animate_simple/AnimateSimple.pp

@@ -199,7 +199,10 @@ begin
     scanKeys();
 
     keys := keysHeld();
-
+		
+    if (keys and KEY_START) <> 0 then 
+      exit;
+      
     if keys <> 0 then
     begin
       if (keys and KEY_UP) <> 0 then

+ 3 - 1
packages/libndsfpc/examples/input/Touch_Pad/touch_test/touchTest.pp

@@ -89,7 +89,9 @@ begin
   
     pressed := keysDown();  // buttons pressed this loop
     held := keysHeld();     // buttons currently held
-  
+
+		if (pressed and KEY_START) <> 0 then 
+      exit;  
     // Right Shoulder button toggles the mode
 		if ( pressed and KEY_R) <> 0 then Inc(TouchType);
 

+ 19 - 0
packages/libndsfpc/src/fat/fat.inc

@@ -43,5 +43,24 @@ function fatInitDefault(): cbool; cdecl; external;
 function fatMountSimple (const name: pcchar; const ainterface: PDISC_INTERFACE): cbool; cdecl; external;
 function fatMount (const name: pcchar; const ainterface: PDISC_INTERFACE; startSector, cacheSize, SectorsPerPage: cuint32): cbool; cdecl; external;
 function fatUnmount(const name: pcchar): cbool; cdecl; external;
+
+// Get Volume Label
+procedure fatGetVolumeLabel(const name: pcchar; labl: pcchar); cdecl; external;
+
+// File attributes
+const
+  ATTR_ARCHIVE    = $20;  // Archive
+  ATTR_DIRECTORY  = $10;  // Directory
+  ATTR_VOLUME     = $08;  // Volume
+  ATTR_SYSTEM     = $04;  // System
+  ATTR_HIDDEN     = $02;  // Hidden
+  ATTR_READONLY   = $01;  // Read only
+
+
+// Methods to modify DOS File Attributes
+
+function FAT_getAttr(const _file: pcchar): cint; cdecl; external;
+function FAT_setAttr(const _file: pcchar; attr: cint): cint; cdecl; external;
+
 {$endif NDS_INTERFACE}
 

+ 13 - 5
packages/libndsfpc/src/nds/card.inc

@@ -17,11 +17,19 @@ const
   CARD_CR1_IRQ    = $40;  // in byte 1, i.e. 0x4000
 
   // SPI EEPROM COMMANDS
-  EEPROM_WRSR = $01;
-  EEPROM_WRDI = $04;
-  EEPROM_RDSR = $05;
-  EEPROM_WREN = $06;
-  EEPROM_RDID = $9f;
+
+  SPI_EEPROM_WRSR   = $01;
+  SPI_EEPROM_PP     = $02;	// Page Program
+  SPI_EEPROM_READ   = $03;
+  SPI_EEPROM_WRDI   = $04;  // Write disable
+  SPI_EEPROM_RDSR   = $05;  // Read status register
+  SPI_EEPROM_WREN   = $06;  // Write enable
+  SPI_EEPROM_PW     = $0a;	// Page Write
+  SPI_EEPROM_FAST   = $0b;	// Fast Read
+  SPI_EEPROM_RDID   = $9f;
+  SPI_EEPROM_RDP    = $ab;  // Release from deep power down
+  SPI_EEPROM_DPD    = $b9;  // Deep power down
+
 
 // REG_ROMCTRL:
   CARD_ACTIVATE   = (1 shl 31);  // when writing, get the ball rolling

+ 14 - 0
packages/libndsfpc/src/nds/libversion.inc

@@ -0,0 +1,14 @@
+{$ifdef NDS_INTERFACE}
+const
+  _LIBNDS_MAJOR_ = 1;
+  _LIBNDS_MINOR_ = 5;
+  _LIBNDS_PATCH_ = 7;
+
+  _LIBNDS_STRING = 'libNDS Release 1.5.7';
+{$endif NDS_INTERFACE}
+
+{$ifdef NDS_IMPLEMENTATION}
+
+
+{$endif NDS_IMPLEMENTATION}
+

+ 2 - 1
packages/libndsfpc/src/nds/ndsinclude.inc

@@ -1,5 +1,6 @@
 
 
+{$include libversion.inc} 
 { $include helper.inc}
 {$include ndstypes.inc}
 {$include bios.inc}
@@ -15,7 +16,7 @@
 {$include system.inc}
 {$include timers.inc}
 {$include fifomessages.inc} 
-{$include input.inc} // testing...
+{$include input.inc} 
  
 {$ifdef ARM9}
   {$include arm9/dynamicArray.inc}