* libndsfpc: forgot to commit a file

+ libndsfpc: added two new examples and regenerated makefiles

git-svn-id: trunk@28310 -
This commit is contained in:
Legolas 2014-08-04 19:39:02 +00:00
parent 935a3f1bc9
commit ca0ff3d2ea
116 changed files with 7648 additions and 164978 deletions

19
.gitattributes vendored
View File

@ -5076,6 +5076,24 @@ packages/libndsfpc/examples/graphics/Backgrounds/rotation/Makefile.fpc svneol=na
packages/libndsfpc/examples/graphics/Backgrounds/rotation/Rotation.pp svneol=native#text/plain
packages/libndsfpc/examples/graphics/Backgrounds/rotation/data/drunkenlogo.bin -text svneol=unset#application/octet-stream
packages/libndsfpc/examples/graphics/Backgrounds/rotation/data/palette.bin -text
packages/libndsfpc/examples/graphics/Effects/Makefile svneol=native#text/plain
packages/libndsfpc/examples/graphics/Effects/Makefile.fpc svneol=native#text/plain
packages/libndsfpc/examples/graphics/Effects/windows/Makefile svneol=native#text/plain
packages/libndsfpc/examples/graphics/Effects/windows/Makefile.fpc svneol=native#text/plain
packages/libndsfpc/examples/graphics/Effects/windows/gfx/drunkenlogo.grit svneol=native#text/plain
packages/libndsfpc/examples/graphics/Effects/windows/gfx/drunkenlogo.png -text
packages/libndsfpc/examples/graphics/Effects/windows/windows.pp svneol=native#text/plain
packages/libndsfpc/examples/graphics/Ext_Palettes/Makefile svneol=native#text/plain
packages/libndsfpc/examples/graphics/Ext_Palettes/Makefile.fpc svneol=native#text/plain
packages/libndsfpc/examples/graphics/Ext_Palettes/backgrounds/Makefile svneol=native#text/plain
packages/libndsfpc/examples/graphics/Ext_Palettes/backgrounds/Makefile.fpc svneol=native#text/plain
packages/libndsfpc/examples/graphics/Ext_Palettes/backgrounds/backgrounds.pp svneol=native#text/plain
packages/libndsfpc/examples/graphics/Ext_Palettes/backgrounds/gfx/devkitlogo.grit svneol=native#text/plain
packages/libndsfpc/examples/graphics/Ext_Palettes/backgrounds/gfx/devkitlogo.png -text
packages/libndsfpc/examples/graphics/Ext_Palettes/backgrounds/gfx/drunkenlogo.grit svneol=native#text/plain
packages/libndsfpc/examples/graphics/Ext_Palettes/backgrounds/gfx/drunkenlogo.png -text
packages/libndsfpc/examples/graphics/Ext_Palettes/backgrounds/inc/devkitlogo.inc svneol=native#text/plain
packages/libndsfpc/examples/graphics/Ext_Palettes/backgrounds/inc/drunkenlogo.inc svneol=native#text/plain
packages/libndsfpc/examples/graphics/Makefile svneol=native#text/plain
packages/libndsfpc/examples/graphics/Makefile.fpc svneol=native#text/plain
packages/libndsfpc/examples/graphics/Printing/Makefile svneol=native#text/plain
@ -5224,6 +5242,7 @@ packages/libndsfpc/src/nds/arm9/sprite.inc svneol=native#text/plain
packages/libndsfpc/src/nds/arm9/trig_lut.inc svneol=native#text/plain
packages/libndsfpc/src/nds/arm9/video.inc svneol=native#text/plain
packages/libndsfpc/src/nds/arm9/videoGL.inc svneol=native#text/plain
packages/libndsfpc/src/nds/arm9/window.inc svneol=native#text/plain
packages/libndsfpc/src/nds/bios.inc svneol=native#text/plain
packages/libndsfpc/src/nds/card.inc svneol=native#text/plain
packages/libndsfpc/src/nds/debug.inc svneol=native#text/plain

File diff suppressed because it is too large Load Diff

View File

@ -16,7 +16,7 @@ includedir=src src/dswifi src/fat src/maxmod src/gl2d
sourcedir=src tests
[prerules]
BINUTILSPREFIX=arm-eabi-
BINUTILSPREFIX=arm-none-eabi-
[install]
fpcpackage=y

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,18 @@
#
# Makefile.fpc for Free Pascal libndsfpc 2.x.y Examples
#
[target]
dirs=windows
[require]
packages=libndsfpc
[install]
fpcpackage=y
[default]
fpcdir=../../../../..
[rules]
.NOTPARALLEL:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,93 @@
#
# Makefile.fpc for Free Pascal libndsfpc 2.x.y Examples
#
[target]
loaders=
programs=windows
[require]
packages=libndsfpc
tools=bin2s mmutil grit rmdir
nortl=y
[install]
fpcpackage=y
[default]
cpu=arm
target=nds
fpcdir=
[compiler]
options=-g -Xm
#-d__THUMB__
[clean]
files=*.elf *.o *.s *.nds *.nef *.h *.bin *.map \
$(BUILD)/* \
$(INC)/*
units=*
[prerules]
BUILD = build
INC = inc
AUDIO_FILES = $(foreach dir, $(notdir $(wildcard audio/*.*)), $(CURDIR)/audio/$(dir))
GFX_FILES = $(foreach dir,gfx,$(notdir $(wildcard $(dir)/*.png)))
BIN_FILES = $(foreach dir,data,$(notdir $(wildcard $(dir)/*)))
[rules]
.NOTPARALLEL:
clean: dir_delete fpc_clean fpc_cleanall
all: dir_make $(BIN_FILES) $(GFX_FILES) fpc_all
#
# Delete temp directories
#
dir_delete:
@$(DELTREE) $(CURDIR)/$(BUILD)
@$(DELTREE) $(CURDIR)/$(INC)
#
# Create temp directories
#
dir_make:
ifneq ($(BUILD), $(CURDIR))
@$(MKDIR) $(BUILD)
endif
ifneq ($(INC), $(CURDIR))
@$(MKDIR) $(INC)
endif
#
# Audio files processing rule
#
soundbank.bin.o : $(AUDIO_FILES)
@$(MMUTIL) $^ -d -o$(BUILD)/soundbank.bin -h$(BUILD)/soundbank.h
$(BIN2S) $(BUILD)/soundbank.bin > $(BUILD)/soundbank.bin.s
$(AS) -o $(BUILD)/soundbank.bin.o $(BUILD)/soundbank.bin.s
#
# Png files processing rule
#
$(GFX_FILES): $(wildcard %.png)
@echo 'Converting $(@) file to asm...'
$(GRIT) gfx/$(@) -fts -ff gfx/$(basename $(@)).grit -o$(BUILD)/$(@)
@echo 'Assembling $(@).s file...'
$(AS) -o $(BUILD)/$(basename $(@)).o $(BUILD)/$(basename $(@)).s
@echo 'Done!'
#
# Binary files processing rule
#
$(BIN_FILES): $(wildcard %.*)
@echo 'Converting $(@) file to asm...'
@$(BIN2S) data/$(@) > $(BUILD)/$(@).s
@echo 'Creating $(@).inc include file...'
@echo "var" > `(echo "inc/"$(@F) | tr . .)`.inc
@echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"_end: array [0..0] of cuint8; cvar; external;" >> `(echo "inc/"$(@F) | tr . .)`.inc
@echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`": array [0..0] of cuint8; cvar; external;" >> `(echo "inc/"$(@F) | tr . .)`.inc
@echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size": cuint32; cvar; external;" >> `(echo "inc/"$(@F) | tr . .)`.inc
@echo 'Assembling $(@).s file...'
@$(AS) -o $(BUILD)/$(@).o $(BUILD)/$(@).s
@echo 'Done!'

View File

@ -0,0 +1,5 @@
# 8 bit bitmap
-gB8
# bitmap format
-gb

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

View File

@ -0,0 +1,76 @@
program windows;
{$L build/drunkenlogo.o}
{$mode objfpc}
uses
ctypes, nds9;
const
drunkenlogoPalLen = 512;
drunkenlogoBitmapLen = 65536;
var
drunkenlogoPal: array [0..255] of cushort; cvar; external;
drunkenlogoBitmap: array [0..16383] of cuint; cvar; external;
bg3: integer;
x, y, size: integer;
begin
videoSetMode(MODE_5_2D);
vramSetBankA(VRAM_A_MAIN_BG);
//enable a background
bg3 := bgInit(3, BgType_Bmp8, BgSize_B8_256x256, 0, 0);
//use the standard drunken logo
dmaCopy(@drunkenlogoBitmap, bgGetGfxPtr(bg3), drunkenlogoBitmapLen);
dmaCopy(@drunkenlogoPal, BG_PALETTE, drunkenlogoPalLen);
//enable window 0
windowEnable(WINDOW_0);
//enable window 0 on our new background
bgWindowEnable(bg3, WINDOW_0);
x := 60;
y := 60;
size := 100;
while true do
begin
scanKeys();
//the code below just moves the window around
if (keysHeld() and KEY_UP) <> 0 then dec(y);
if (keysHeld() and KEY_DOWN) <> 0 then inc(y);
if (keysHeld() and KEY_LEFT) <> 0 then dec(x);
if (keysHeld() and KEY_RIGHT) <> 0 then inc(x);
if (keysHeld() and KEY_A) <> 0 then dec(size);
if (keysHeld() and KEY_B) <> 0 then inc(size);
if (keysHeld() and KEY_X) <> 0 then
begin
bgWindowDisable(bg3, WINDOW_OUT);
bgWindowEnable(bg3, WINDOW_0);
end;
if (keysHeld() and KEY_Y) <> 0 then
begin
bgWindowDisable(bg3, WINDOW_0);
bgWindowEnable(bg3, WINDOW_OUT);
end;
if (x < 0) then x := 0;
if (x > SCREEN_WIDTH - 1) then x := SCREEN_WIDTH - 1;
if (y < 0) then y := 0;
if (y > SCREEN_HEIGHT - 1) then y := SCREEN_HEIGHT - 1;
swiWaitForVBlank();
//set up the boundaries on our window
windowSetBounds(WINDOW_0, x, y, x + size, y + size);
end;
end.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,18 @@
#
# Makefile.fpc for Free Pascal libndsfpc 2.x.y Examples
#
[target]
dirs=backgrounds
[require]
packages=libndsfpc
[install]
fpcpackage=y
[default]
fpcdir=../../../../..
[rules]
.NOTPARALLEL:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,95 @@
#
# Makefile.fpc for Free Pascal libndsfpc 2.x.y Examples
#
[target]
loaders=
programs=backgrounds
[require]
packages=libndsfpc
tools=bin2s mmutil grit rmdir mv
nortl=y
[install]
fpcpackage=y
[default]
cpu=arm
target=nds
fpcdir=
[compiler]
options=-g -Xm
[clean]
files=*.elf *.o *.s *.nds *.nef *.h *.bin *.map \
$(BUILD)/* \
$(INC)/*
units=*
[prerules]
BUILD = build
DATA = data
GFX = gfx
INC = inc
AUDIO_FILES = $(foreach dir, $(notdir $(wildcard audio/*.*)), $(CURDIR)/audio/$(dir))
GFX_FILES = $(foreach dir, $(GFX), $(notdir $(wildcard $(dir)/*.bmp $(dir)/*.png)))
BIN_FILES = $(foreach dir, $(DATA), $(notdir $(wildcard $(dir)/*)))
[rules]
.NOTPARALLEL:
clean: dir_delete fpc_clean fpc_cleanall
all: dir_make $(BIN_FILES) $(GFX_FILES) fpc_all
#
# Delete temp directories
#
dir_delete:
@$(DELTREE) $(CURDIR)/$(BUILD)
@$(DELTREE) $(CURDIR)/$(INC)
#
# Create temp directories
#
dir_make:
ifneq ($(BUILD), $(CURDIR))
@$(MKDIR) $(BUILD)
endif
ifneq ($(INC), $(CURDIR))
@$(MKDIR) $(INC)
endif
#
# Audio files processing rule
#
soundbank.bin.o : $(AUDIO_FILES)
@$(MMUTIL) $^ -d -o$(BUILD)/soundbank.bin -h$(BUILD)/soundbank.h
$(BIN2S) $(BUILD)/soundbank.bin > $(BUILD)/soundbank.bin.s
$(AS) -o $(BUILD)/soundbank.bin.o $(BUILD)/soundbank.bin.s
#
# Png files processing rule
#
$(GFX_FILES): $(wildcard %.bmp %.png)
@echo 'Converting $(@) file to asm...'
$(GRIT) $(GFX)/$(@) -fp -fts -ff $(GFX)/$(basename $(@)).grit -o$(BUILD)/$(@)
@echo 'Assembling $(@).s file...'
$(AS) -o $(BUILD)/$(basename $(@)).o $(BUILD)/$(basename $(@)).s
$(MV) -f $(BUILD)/$(basename $(@)).inc $(INC)/$(basename $(@)).inc
@echo 'Done!'
#
# Binary files processing rule
#
$(BIN_FILES): $(wildcard %.*)
@echo 'Converting $(@) file to asm...'
@$(BIN2S) $(DATA)/$(@) > $(BUILD)/$(@).s
@echo 'Creating $(@).inc include file...'
@echo "var" > `(echo "$(INC)/"$(@F) | tr . .)`.inc
@echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"_end: array [0..0] of cuint8; cvar; external;" >> `(echo "$(INC)/"$(@F) | tr . .)`.inc
@echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`": array [0..0] of cuint8; cvar; external;" >> `(echo "$(INC)/"$(@F) | tr . .)`.inc
@echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size": cuint32; cvar; external;" >> `(echo "$(INC)/"$(@F) | tr . .)`.inc
@echo 'Assembling $(@).s file...'
@$(AS) -o $(BUILD)/$(@).o $(BUILD)/$(@).s
@echo 'Done!'

View File

@ -0,0 +1,85 @@
program backgrounds;
{$L build/drunkenlogo.o}
{$L build/devkitlogo.o}
{$mode objfpc}
uses
ctypes, nds9;
{$include inc/drunkenlogo.inc}
{$include inc/devkitlogo.inc}
var
bg: array [0..3] of integer = (0,0,0,0);
i: integer;
frames: integer = 0;
begin
// initialize video
videoSetMode(MODE_0_2D);
videoSetModeSub(MODE_0_2D);
vramSetBankA(VRAM_A_MAIN_BG);
vramSetBankC(VRAM_C_SUB_BG);
// enable extended palettes
bgExtPaletteEnable();
bgExtPaletteEnableSub();
// initialize backgrounds
// extended palettes only work on 8bpp tiled bg's with 16-bit map entries
// this means you can only use BgType_Text8bpp or BgType_ExRotation
// http://mtheall.com/vram.html#T0=1&NT0=192&MB0=6&TB0=0&S0=0&T1=1&NT1=576&MB1=7&TB1=1&S1=0
bg[0] := bgInit (0, BgType_Text8bpp, BgSize_T_256x256, 6, 0);
bg[1] := bgInit (1, BgType_Text8bpp, BgSize_T_256x256, 7, 1);
// we're using identical settings on the sub screen
bg[2] := bgInitSub(0, BgType_Text8bpp, BgSize_T_256x256, 6, 0);
bg[3] := bgInitSub(1, BgType_Text8bpp, BgSize_T_256x256, 7, 1);
// copy graphics to vram
dmaCopy(@devkitlogoTiles, bgGetGfxPtr(bg[0]), devkitlogoTilesLen);
dmaCopy(@drunkenlogoTiles, bgGetGfxPtr(bg[1]), drunkenlogoTilesLen);
// same for sub engine
dmaCopy(@devkitlogoTiles, bgGetGfxPtr(bg[2]), devkitlogoTilesLen);
dmaCopy(@drunkenlogoTiles, bgGetGfxPtr(bg[3]), drunkenlogoTilesLen);
// copy maps to vram
dmaCopy(@devkitlogoMap, bgGetMapPtr(bg[0]), devkitlogoMapLen);
dmaCopy(@drunkenlogoMap, bgGetMapPtr(bg[1]), drunkenlogoMapLen);
// same for sub engine
dmaCopy(@devkitlogoMap, bgGetMapPtr(bg[2]), devkitlogoMapLen);
dmaCopy(@drunkenlogoMap, bgGetMapPtr(bg[3]), drunkenlogoMapLen);
// you can only access extended palettes in LCD mode
vramSetBankE(VRAM_E_LCD); // for main engine
vramSetBankH(VRAM_H_LCD); // for sub engine
// copy palettes to extended palette area
// there are 16 256-color palettes per bg
// use '-mp #' to make grit use # for the slot number
// we used '-mp 12' for drunkenlogo for demonstrative purposes
dmaCopy(@devkitlogoPal, @(VRAM_E_EXT_PALETTE[0, 0]), devkitlogoPalLen); // bg 0, slot 0
dmaCopy(@drunkenlogoPal, @(VRAM_E_EXT_PALETTE[1, 12]), drunkenlogoPalLen); // bg 1, slot 12
// same for sub engine
dmaCopy(@devkitlogoPal, @(VRAM_H_EXT_PALETTE[0, 0]), devkitlogoPalLen); // bg 0, slot 0
dmaCopy(@drunkenlogoPal, @(VRAM_H_EXT_PALETTE[1, 12]), drunkenlogoPalLen); // bg 1, slot 12
// map vram banks to extended palettes
// http://mtheall.com/banks.html#A=MBG0&C=MBG2&E=BGEPAL&H=SBGEPAL
vramSetBankE(VRAM_E_BG_EXT_PALETTE); // for main engine
vramSetBankH(VRAM_H_SUB_BG_EXT_PALETTE); // for sub engine
while keysDown() = 0 do
begin
swiWaitForVBlank();
inc(frames);
bgUpdate();
scanKeys();
// let's make it obvious there are multiple backgrounds
for i := 0 to 7 do
bgSetScroll(i, frames div ((i and 3) + 1), frames div ((i and 3) + 1));
end;
end.

View File

@ -0,0 +1,5 @@
# extended palettes only work on 8bpp tiled bg with 16-bit map entries
# this means you can only use BgType_Text8bpp or BgType_ExRotation
-g -gt -gB8
-m -mR8
-p

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

View File

@ -0,0 +1,8 @@
# extended palettes only work on 8bpp tiled bg with 16-bit map entries
# this means you can only use BgType_Text8bpp or BgType_ExRotation
-g -gt -gB8
-m -mR8
-p
# let's use palette slot 12 for demonstrative purposes
-mp 12

Binary file not shown.

After

Width:  |  Height:  |  Size: 193 KiB

View File

@ -0,0 +1,35 @@
{%REGION devkitlogo}
//======================================================================
//
// devkitlogo, 256x192@8,
// + palette 256 entries, not compressed
// + 180 tiles (t|f reduced) not compressed
// + regular map (flat), not compressed, 32x24
// Total size: 512 + 11520 + 1536 = 13568
//
// Time-stamp: 2014-08-04, 20:56:23
// Exported by Cearn's GBA Image Transmogrifier, v0.8.10
// ( http://www.coranac.com/projects/#grit )
//
//======================================================================
{$IFNDEF GRIT_DEVKITLOGO_INC}
{$DEFINE GRIT_DEVKITLOGO_INC}
const devkitlogoTilesLen = 11520;
devkitlogoTilesMax = 2880;
var devkitlogoTiles: array [0..0] of cuint32; cvar; external;
const devkitlogoMapLen = 1536;
devkitlogoMapMax = 768;
var devkitlogoMap: array [0..0] of cuint16; cvar; external;
const devkitlogoPalLen = 512;
devkitlogoPalMax = 256;
var devkitlogoPal: array [0..0] of cuint16; cvar; external;
{$ENDIF GRIT_DEVKITLOGO_INC}
{%ENDREGION devkitlogo}

View File

@ -0,0 +1,35 @@
{%REGION drunkenlogo}
//======================================================================
//
// drunkenlogo, 256x192@8,
// + palette 256 entries, not compressed
// + 547 tiles (t|f reduced) not compressed
// + regular map (flat), not compressed, 32x24
// Total size: 512 + 35008 + 1536 = 37056
//
// Time-stamp: 2014-08-04, 20:56:22
// Exported by Cearn's GBA Image Transmogrifier, v0.8.10
// ( http://www.coranac.com/projects/#grit )
//
//======================================================================
{$IFNDEF GRIT_DRUNKENLOGO_INC}
{$DEFINE GRIT_DRUNKENLOGO_INC}
const drunkenlogoTilesLen = 35008;
drunkenlogoTilesMax = 8752;
var drunkenlogoTiles: array [0..0] of cuint32; cvar; external;
const drunkenlogoMapLen = 1536;
drunkenlogoMapMax = 768;
var drunkenlogoMap: array [0..0] of cuint16; cvar; external;
const drunkenlogoPalLen = 512;
drunkenlogoPalMax = 256;
var drunkenlogoPal: array [0..0] of cuint16; cvar; external;
{$ENDIF GRIT_DRUNKENLOGO_INC}
{%ENDREGION drunkenlogo}

File diff suppressed because it is too large Load Diff

View File

@ -3,7 +3,7 @@
#
[target]
dirs=3D Backgrounds Printing Sprites
dirs=3D Backgrounds Effects Ext_Palettes Printing Sprites
[require]
packages=libndsfpc

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More