diff options
| author | Legolas <Legolas@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2009-08-23 13:57:45 +0000 |
|---|---|---|
| committer | Legolas <Legolas@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2009-08-23 13:57:45 +0000 |
| commit | 8c206a09ada489fd0032708e073d3398993fa89e (patch) | |
| tree | 2650b2225bab72de1e8003f8db058ad00294cb85 /packages/libndsfpc | |
| parent | 8c482d4fd69a092e01c8b9770a154ee4abff4b65 (diff) | |
| download | fpc-8c206a09ada489fd0032708e073d3398993fa89e.tar.gz | |
* NDS: updated the rtl, libnds and fixed the examples. Now it should work fine with devkitARM r26
- Removed (again) old libgba examples
git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@13585 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'packages/libndsfpc')
66 files changed, 331 insertions, 475 deletions
diff --git a/packages/libndsfpc/examples/RealTimeClock/Watch/watch.pp b/packages/libndsfpc/examples/RealTimeClock/Watch/watch.pp index 70fea7d2d6..b29ffaad48 100644 --- a/packages/libndsfpc/examples/RealTimeClock/Watch/watch.pp +++ b/packages/libndsfpc/examples/RealTimeClock/Watch/watch.pp @@ -1,5 +1,7 @@ program watch; +{$mode objfpc} + uses ctypes, nds9; diff --git a/packages/libndsfpc/examples/audio/maxmod/audio_modes/Makefile.fpc b/packages/libndsfpc/examples/audio/maxmod/audio_modes/Makefile.fpc index 4f0a0c535c..2c4810ef2e 100644 --- a/packages/libndsfpc/examples/audio/maxmod/audio_modes/Makefile.fpc +++ b/packages/libndsfpc/examples/audio/maxmod/audio_modes/Makefile.fpc @@ -20,8 +20,9 @@ target=nds fpcdir=../../../../../.. [clean] -files=*.elf *.o *.s *.nds *.nef *.h *.bin \ - $(BUILD)/* +files=*.elf *.o *.s *.nds *.nef *.h *.bin *.map \ + $(BUILD)/* \ + $(INC)/* units=* [prerules] @@ -31,7 +32,16 @@ GFX_FILES = $(foreach dir,gfx,$(notdir $(wildcard $(dir)/*.png))) [rules] .NOTPARALLEL: +clean: dir_delete fpc_clean fpc_cleanall all: direc fpc_all + +# +# Delete temp directories +# +dir_delete: + @$(DELTREE) $(CURDIR)/$(BUILD) + @$(DELTREE) $(CURDIR)/$(INC) + direc: ifneq ($(BUILD), $(CURDIR)) $(MKDIR) $(BUILD) diff --git a/packages/libndsfpc/examples/audio/maxmod/audio_modes/audio_modes.pp b/packages/libndsfpc/examples/audio/maxmod/audio_modes/audio_modes.pp index 3e04d4aad0..a4de9cfdde 100644 --- a/packages/libndsfpc/examples/audio/maxmod/audio_modes/audio_modes.pp +++ b/packages/libndsfpc/examples/audio/maxmod/audio_modes/audio_modes.pp @@ -1,6 +1,7 @@ program AudioModes; {$L build/soundbank.bin.o} +{$mode objfpc} uses ctypes, nds9, maxmod9; @@ -42,31 +43,22 @@ const MSL_NSAMPS = 65; MSL_BANKSIZE = 68; - - -//--------------------------------------------- - SHOW_TEXT = #10 + - -' Maxmod Audio Modes Example'#10#10 + - -' Song: '#10 + -' Mode: '#10#10 + - -' Left/Right: Select Song'#10 + -' Up/Down: Change Audio Mode'#10 + -' A: Start Playback'#10 + -' B: Stop Playback'#10#10 + - -' Tip: Play subtonal with the'#10 + -' extended mode or else it won''t'#10 + -' sound right.'#10#10 + - -' Another Tip: The interpolated'#10 + -' mode doesn''t work in current'#10 + -' emulators.'; -//--------------------------------------------- - - + SHOW_TEXT: pchar = #10 + + ' Maxmod Audio Modes Example'#10#10 + + ' Song: '#10 + + ' Mode: '#10#10 + + ' Left/Right: Select Song'#10 + + ' Up/Down: Change Audio Mode'#10 + + ' A: Start Playback'#10 + + ' B: Stop Playback'#10#10 + + + ' Tip: Play subtonal with the'#10 + + ' extended mode or else it won''t'#10 + + ' sound right.'#10#10 + + + ' Another Tip: The interpolated'#10 + + ' mode doesn''t work in current'#10 + + ' emulators.'; var diff --git a/packages/libndsfpc/examples/audio/maxmod/basic_sound/basic_sound.pp b/packages/libndsfpc/examples/audio/maxmod/basic_sound/basic_sound.pp index e148864fd2..162a2772ea 100644 --- a/packages/libndsfpc/examples/audio/maxmod/basic_sound/basic_sound.pp +++ b/packages/libndsfpc/examples/audio/maxmod/basic_sound/basic_sound.pp @@ -59,13 +59,13 @@ begin // ansi escape sequence to clear screen and home cursor // /x1b[line;columnH - iprintf(#27 + '[2J'); + iprintf(#$1b'[2J'); // ansi escape sequence to set print co-ordinates // /x1b[line;columnH - iprintf(#27 + '[0;8HMaxMod Audio demo'); - iprintf(#27 + '[3;0HHold A for ambulance sound'); - iprintf(#27 + '[4;0HPress B for boom sound'); + iprintf(#$1b'[0;8HMaxMod Audio demo'); + iprintf(#$1b'[3;0HHold A for ambulance sound'); + iprintf(#$1b'[4;0HPress B for boom sound'); // sound effect handle (for cancelling it later) amb := 0; diff --git a/packages/libndsfpc/examples/audio/maxmod/song_events_example/song_events_example.pp b/packages/libndsfpc/examples/audio/maxmod/song_events_example/song_events_example.pp index b5cc199eda..46ad293f63 100644 --- a/packages/libndsfpc/examples/audio/maxmod/song_events_example/song_events_example.pp +++ b/packages/libndsfpc/examples/audio/maxmod/song_events_example/song_events_example.pp @@ -33,7 +33,7 @@ var //--------------------------------------------------------------------------------- // callback function to handle song events //--------------------------------------------------------------------------------- -function myEventHandler(msg, param: mm_word): pmm_word; +function myEventHandler(msg, param: mm_word): mm_callback;//pmm_word; begin case msg of diff --git a/packages/libndsfpc/examples/audio/maxmod/song_events_example2/song_events_example2.pp b/packages/libndsfpc/examples/audio/maxmod/song_events_example2/song_events_example2.pp index 293cdc04d4..279ab05574 100644 --- a/packages/libndsfpc/examples/audio/maxmod/song_events_example2/song_events_example2.pp +++ b/packages/libndsfpc/examples/audio/maxmod/song_events_example2/song_events_example2.pp @@ -37,7 +37,7 @@ var sprites: array[0..4] of MySprite; -function myEventHandler(msg, param: mm_word): mm_word; +function myEventHandler(msg, param: mm_word): mm_callback; begin case msg of MMCB_SONGMESSAGE: // process song messages @@ -50,7 +50,7 @@ begin end; MMCB_SONGFINISHED:; // process song finish message (only triggered in songs played with MM_PLAY_ONCE) end; - result := 0; + result := nil; end; diff --git a/packages/libndsfpc/examples/audio/micrecord/micrecord.pp b/packages/libndsfpc/examples/audio/micrecord/micrecord.pp index a022ecab26..441d78b6f5 100644 --- a/packages/libndsfpc/examples/audio/micrecord/micrecord.pp +++ b/packages/libndsfpc/examples/audio/micrecord/micrecord.pp @@ -1,5 +1,7 @@ program micrecord; +{$mode objfpc} + uses ctypes, nds9, maxmod9; diff --git a/packages/libndsfpc/examples/card/eeprom/eeprom.pp b/packages/libndsfpc/examples/card/eeprom/eeprom.pp index 736d5eb4ec..82afe327fe 100644 --- a/packages/libndsfpc/examples/card/eeprom/eeprom.pp +++ b/packages/libndsfpc/examples/card/eeprom/eeprom.pp @@ -1,5 +1,7 @@ program eeprom; +{$mode objfpc} + uses ctypes, nds9, sysutils; diff --git a/packages/libndsfpc/examples/debugging/exceptionTest/exceptionTest.pp b/packages/libndsfpc/examples/debugging/exceptionTest/exceptionTest.pp index 086a1c6307..8ddd5e6cbd 100644 --- a/packages/libndsfpc/examples/debugging/exceptionTest/exceptionTest.pp +++ b/packages/libndsfpc/examples/debugging/exceptionTest/exceptionTest.pp @@ -1,6 +1,5 @@ -program main; +program exceptionTest; -{$apptype arm9} {$mode objfpc} uses diff --git a/packages/libndsfpc/examples/ds_motion/dsMotion.pp b/packages/libndsfpc/examples/ds_motion/dsMotion.pp index 18f8baae05..4ea2239f8e 100644 --- a/packages/libndsfpc/examples/ds_motion/dsMotion.pp +++ b/packages/libndsfpc/examples/ds_motion/dsMotion.pp @@ -1,5 +1,6 @@ program dsMotion; +{$mode objfpc} uses ctypes, nds9; diff --git a/packages/libndsfpc/examples/dswifi/ap_search/apSearch.pp b/packages/libndsfpc/examples/dswifi/ap_search/apSearch.pp index 1d63d8b340..de76752e1d 100644 --- a/packages/libndsfpc/examples/dswifi/ap_search/apSearch.pp +++ b/packages/libndsfpc/examples/dswifi/ap_search/apSearch.pp @@ -1,11 +1,7 @@ program apSearch; -{$apptype arm9} -{$define ARM9} - {$mode objfpc} - uses ctypes, nds9, dswifi9; @@ -57,7 +53,7 @@ begin end; //--------------------------------------------------------------------------------- -function keyPressed(c: cint): pointer; +procedure keyPressed(c: cint); begin if (c > 0) then iprintf('%c', c); diff --git a/packages/libndsfpc/examples/dswifi/autoconnect/autoconnect.pp b/packages/libndsfpc/examples/dswifi/autoconnect/autoconnect.pp index 8cfef65e91..320f17d1f1 100644 --- a/packages/libndsfpc/examples/dswifi/autoconnect/autoconnect.pp +++ b/packages/libndsfpc/examples/dswifi/autoconnect/autoconnect.pp @@ -1,15 +1,10 @@ program autoconnect; -{$apptype arm9} -{$define ARM9} - {$mode objfpc} - uses ctypes, nds9, dswifi9; - var ip, gateway, mask, dns1, dns2: in_addr; diff --git a/packages/libndsfpc/examples/filesystem/embedded_gbfs/embedded_gbfs.pp b/packages/libndsfpc/examples/filesystem/embedded_gbfs/embedded_gbfs.pp index 5c1d3461d9..45b5ae26c4 100644 --- a/packages/libndsfpc/examples/filesystem/embedded_gbfs/embedded_gbfs.pp +++ b/packages/libndsfpc/examples/filesystem/embedded_gbfs/embedded_gbfs.pp @@ -1,4 +1,5 @@ program embedded_gbfs; +{$mode objfpc} {$L build/data.gbfs.o} uses ctypes, nds9, gbfs; diff --git a/packages/libndsfpc/examples/filesystem/libfat/access_dir/access_dir.pp b/packages/libndsfpc/examples/filesystem/libfat/access_dir/access_dir.pp index af65fd1cc4..f8f924c7d9 100644 --- a/packages/libndsfpc/examples/filesystem/libfat/access_dir/access_dir.pp +++ b/packages/libndsfpc/examples/filesystem/libfat/access_dir/access_dir.pp @@ -1,6 +1,5 @@ program access_dir; -{$apptype arm9} {$mode objfpc} uses diff --git a/packages/libndsfpc/examples/graphics/3D/3D_Both_Screens/3DBothScreens.pp b/packages/libndsfpc/examples/graphics/3D/3D_Both_Screens/3DBothScreens.pp index 49454d5cce..7310542d7c 100644 --- a/packages/libndsfpc/examples/graphics/3D/3D_Both_Screens/3DBothScreens.pp +++ b/packages/libndsfpc/examples/graphics/3D/3D_Both_Screens/3DBothScreens.pp @@ -1,5 +1,7 @@ program BothScreens3D; +{$mode objfpc} + uses ctypes, nds9; diff --git a/packages/libndsfpc/examples/graphics/3D/BoxTest/BoxTest.pp b/packages/libndsfpc/examples/graphics/3D/BoxTest/BoxTest.pp index c84dcb461c..6a6c8a5e49 100644 --- a/packages/libndsfpc/examples/graphics/3D/BoxTest/BoxTest.pp +++ b/packages/libndsfpc/examples/graphics/3D/BoxTest/BoxTest.pp @@ -1,5 +1,7 @@ program Box_Test; +{$mode objfpc} + uses ctypes, nds9; diff --git a/packages/libndsfpc/examples/graphics/3D/Display_List/DisplayList.pp b/packages/libndsfpc/examples/graphics/3D/Display_List/DisplayList.pp index bdf3068f92..119e58565c 100644 --- a/packages/libndsfpc/examples/graphics/3D/Display_List/DisplayList.pp +++ b/packages/libndsfpc/examples/graphics/3D/Display_List/DisplayList.pp @@ -1,5 +1,7 @@ program DisplayList; +{$mode objfpc} + uses ctypes, nds9; diff --git a/packages/libndsfpc/examples/graphics/3D/Display_List_2/DisplayList2.pp b/packages/libndsfpc/examples/graphics/3D/Display_List_2/DisplayList2.pp index 9d9f13ed22..d61890480d 100644 --- a/packages/libndsfpc/examples/graphics/3D/Display_List_2/DisplayList2.pp +++ b/packages/libndsfpc/examples/graphics/3D/Display_List_2/DisplayList2.pp @@ -1,5 +1,7 @@ program DisplayList2; {$L build/teapot.bin.o} +{$mode objfpc} + uses ctypes, nds9; diff --git a/packages/libndsfpc/examples/graphics/3D/Env_Mapping/EnvMapping.pp b/packages/libndsfpc/examples/graphics/3D/Env_Mapping/EnvMapping.pp index 14bddced35..3d4602b8b6 100644 --- a/packages/libndsfpc/examples/graphics/3D/Env_Mapping/EnvMapping.pp +++ b/packages/libndsfpc/examples/graphics/3D/Env_Mapping/EnvMapping.pp @@ -2,6 +2,8 @@ program EnvMapping; {$L build/teapot.bin.o} {$L build/cafe.bin.o} +{$mode objfpc} + uses ctypes, nds9; diff --git a/packages/libndsfpc/examples/graphics/3D/Mixed_Text_3D/MixedText3D.pp b/packages/libndsfpc/examples/graphics/3D/Mixed_Text_3D/MixedText3D.pp index a3668624c5..ad713cc621 100644 --- a/packages/libndsfpc/examples/graphics/3D/Mixed_Text_3D/MixedText3D.pp +++ b/packages/libndsfpc/examples/graphics/3D/Mixed_Text_3D/MixedText3D.pp @@ -1,5 +1,7 @@ program MixedText3D; +{$mode objfpc} + uses ctypes, nds9, math; diff --git a/packages/libndsfpc/examples/graphics/3D/Paletted_Cube/PalettedCube.pp b/packages/libndsfpc/examples/graphics/3D/Paletted_Cube/PalettedCube.pp index 55c1296b71..4ef79b1e1e 100644 --- a/packages/libndsfpc/examples/graphics/3D/Paletted_Cube/PalettedCube.pp +++ b/packages/libndsfpc/examples/graphics/3D/Paletted_Cube/PalettedCube.pp @@ -19,6 +19,8 @@ program PalettedCube; {$L build/texture9_RGB32_A3_pal.bin.o} {$L build/texture9_RGB32_A3_tex.bin.o} +{$mode objfpc} + uses ctypes, nds9; diff --git a/packages/libndsfpc/examples/graphics/3D/Picking/Picking.pp b/packages/libndsfpc/examples/graphics/3D/Picking/Picking.pp index 419d30712c..01c2357436 100644 --- a/packages/libndsfpc/examples/graphics/3D/Picking/Picking.pp +++ b/packages/libndsfpc/examples/graphics/3D/Picking/Picking.pp @@ -3,6 +3,8 @@ program picking; {$L build/cylinder.bin.o} {$L build/sphere.bin.o} +{$mode objfpc} + uses ctypes, nds9; diff --git a/packages/libndsfpc/examples/graphics/3D/Simple_Quad/SimpleQuad.pp b/packages/libndsfpc/examples/graphics/3D/Simple_Quad/SimpleQuad.pp index 956db8516c..bcb0d2e806 100644 --- a/packages/libndsfpc/examples/graphics/3D/Simple_Quad/SimpleQuad.pp +++ b/packages/libndsfpc/examples/graphics/3D/Simple_Quad/SimpleQuad.pp @@ -1,9 +1,10 @@ program SimpleQuad; +{$mode objfpc} + uses ctypes, nds9; - var rotateX: cfloat = 0.0; rotateY: cfloat = 0.0; diff --git a/packages/libndsfpc/examples/graphics/3D/Simple_Tri/SimpleTri.pp b/packages/libndsfpc/examples/graphics/3D/Simple_Tri/SimpleTri.pp index 0217adfbab..7a8e19d47c 100644 --- a/packages/libndsfpc/examples/graphics/3D/Simple_Tri/SimpleTri.pp +++ b/packages/libndsfpc/examples/graphics/3D/Simple_Tri/SimpleTri.pp @@ -1,5 +1,7 @@ program SimpleTri; +{$mode objfpc} + uses ctypes, nds9; diff --git a/packages/libndsfpc/examples/graphics/3D/Textured_Cube/TexturedCube.pp b/packages/libndsfpc/examples/graphics/3D/Textured_Cube/TexturedCube.pp index d12c2707e3..01f2c70f35 100644 --- a/packages/libndsfpc/examples/graphics/3D/Textured_Cube/TexturedCube.pp +++ b/packages/libndsfpc/examples/graphics/3D/Textured_Cube/TexturedCube.pp @@ -2,8 +2,6 @@ program TexturedCube; {$L build/texture.bin.o} -{$apptype arm9} - {$mode objfpc} uses diff --git a/packages/libndsfpc/examples/graphics/3D/Textured_Quad/TexturedQuad.pp b/packages/libndsfpc/examples/graphics/3D/Textured_Quad/TexturedQuad.pp index c8c63e7959..da51d3cd59 100644 --- a/packages/libndsfpc/examples/graphics/3D/Textured_Quad/TexturedQuad.pp +++ b/packages/libndsfpc/examples/graphics/3D/Textured_Quad/TexturedQuad.pp @@ -1,6 +1,6 @@ program TextureQuad; {$L build/texture.bin.o} - +{$mode objfpc} uses ctypes, nds9; diff --git a/packages/libndsfpc/examples/graphics/3D/Toon_Shading/ToonShading.pp b/packages/libndsfpc/examples/graphics/3D/Toon_Shading/ToonShading.pp index 4588ba003e..80d217dd0a 100644 --- a/packages/libndsfpc/examples/graphics/3D/Toon_Shading/ToonShading.pp +++ b/packages/libndsfpc/examples/graphics/3D/Toon_Shading/ToonShading.pp @@ -2,6 +2,7 @@ program ToonShading; //NB: This would look better if the object had a bit of texturing too (eyes, nose etc) {$L build/statue.bin.o} +{$mode objfpc} uses ctypes, nds9; diff --git a/packages/libndsfpc/examples/graphics/Backgrounds/16bit_color_bmp/16bitColorBmp.pp b/packages/libndsfpc/examples/graphics/Backgrounds/16bit_color_bmp/16bitColorBmp.pp index daea693512..07f3e79293 100644 --- a/packages/libndsfpc/examples/graphics/Backgrounds/16bit_color_bmp/16bitColorBmp.pp +++ b/packages/libndsfpc/examples/graphics/Backgrounds/16bit_color_bmp/16bitColorBmp.pp @@ -1,6 +1,8 @@ program bmp_16bit_color; {$L build/drunkenlogo.o} +{$mode objfpc} + uses ctypes, nds9; diff --git a/packages/libndsfpc/examples/graphics/Backgrounds/256_color_bmp/256ColorBmp.pp b/packages/libndsfpc/examples/graphics/Backgrounds/256_color_bmp/256ColorBmp.pp index 6c1c5232e3..2b793689cd 100644 --- a/packages/libndsfpc/examples/graphics/Backgrounds/256_color_bmp/256ColorBmp.pp +++ b/packages/libndsfpc/examples/graphics/Backgrounds/256_color_bmp/256ColorBmp.pp @@ -1,8 +1,6 @@ program bmp_256_color; {$L build/drunkenlogo.o} -{$apptype arm9} - {$mode objfpc} uses diff --git a/packages/libndsfpc/examples/graphics/Backgrounds/Double_Buffer/DoubleBuffer.pp b/packages/libndsfpc/examples/graphics/Backgrounds/Double_Buffer/DoubleBuffer.pp index 91585ea6ec..fc36e116ad 100644 --- a/packages/libndsfpc/examples/graphics/Backgrounds/Double_Buffer/DoubleBuffer.pp +++ b/packages/libndsfpc/examples/graphics/Backgrounds/Double_Buffer/DoubleBuffer.pp @@ -1,5 +1,7 @@ program DoubleBuffer; +{$mode objfpc} + uses ctypes, nds9; diff --git a/packages/libndsfpc/examples/graphics/Backgrounds/all_in_one/BackgroundAllInOne.pp b/packages/libndsfpc/examples/graphics/Backgrounds/all_in_one/BackgroundAllInOne.pp index 58e6311279..4d749f33d3 100644 --- a/packages/libndsfpc/examples/graphics/Backgrounds/all_in_one/BackgroundAllInOne.pp +++ b/packages/libndsfpc/examples/graphics/Backgrounds/all_in_one/BackgroundAllInOne.pp @@ -3,6 +3,8 @@ program AllInOne; {$L build/TextBackgrounds.o} {$L build/Multilayer.o} +{$mode objfpc} + uses ctypes, nds9, basic, advanced, handmade, scrolling; diff --git a/packages/libndsfpc/examples/graphics/Backgrounds/rotation/Rotation.pp b/packages/libndsfpc/examples/graphics/Backgrounds/rotation/Rotation.pp index f20cb4b1a9..940ed8125d 100644 --- a/packages/libndsfpc/examples/graphics/Backgrounds/rotation/Rotation.pp +++ b/packages/libndsfpc/examples/graphics/Backgrounds/rotation/Rotation.pp @@ -2,6 +2,8 @@ program BG_Rotation; {$L build/drunkenlogo.bin.o} {$L build/palette.bin.o} +{$mode objfpc} + uses ctypes, nds9; diff --git a/packages/libndsfpc/examples/graphics/Printing/ansi_console/AnsiConsole.pp b/packages/libndsfpc/examples/graphics/Printing/ansi_console/AnsiConsole.pp index caf0f450e4..614fe813e5 100644 --- a/packages/libndsfpc/examples/graphics/Printing/ansi_console/AnsiConsole.pp +++ b/packages/libndsfpc/examples/graphics/Printing/ansi_console/AnsiConsole.pp @@ -1,5 +1,7 @@ program AnsiConsole; +{$mode objfpc} + uses ctypes, nds9; diff --git a/packages/libndsfpc/examples/graphics/Printing/console_windows/ConsoleWindows.pp b/packages/libndsfpc/examples/graphics/Printing/console_windows/ConsoleWindows.pp index 830db2628b..f38c4252df 100644 --- a/packages/libndsfpc/examples/graphics/Printing/console_windows/ConsoleWindows.pp +++ b/packages/libndsfpc/examples/graphics/Printing/console_windows/ConsoleWindows.pp @@ -1,5 +1,7 @@ program ConsoleWindows; +{$mode objfpc} + uses ctypes, nds9; diff --git a/packages/libndsfpc/examples/graphics/Printing/custom_font/CustomFont.pp b/packages/libndsfpc/examples/graphics/Printing/custom_font/CustomFont.pp index cdfb207cff..02bba9dba8 100644 --- a/packages/libndsfpc/examples/graphics/Printing/custom_font/CustomFont.pp +++ b/packages/libndsfpc/examples/graphics/Printing/custom_font/CustomFont.pp @@ -1,6 +1,8 @@ program custom_font; {$L build/font.o} +{$mode objfpc} + uses ctypes, nds9; @@ -19,8 +21,8 @@ var begin - videoSetModeSub(MODE_0_2D); - vramSetBankC(VRAM_C_SUB_BG); + videoSetModeSub(MODE_0_2D); + vramSetBankC(VRAM_C_SUB_BG); console := consoleInit(nil, 0, BgType_Text4bpp, BgSize_T_256x256, map_base, tile_base, false, false); @@ -33,7 +35,7 @@ begin font.convertSingleColor := false; consoleSetFont(console, @font); - + printf('Custom Font Demo'#10); printf(' by Poffy'#10); printf('modified by WinterMute'#10); diff --git a/packages/libndsfpc/examples/graphics/Printing/print_both_screens/printBothScreens.pp b/packages/libndsfpc/examples/graphics/Printing/print_both_screens/printBothScreens.pp index 0964142730..a9a72013a8 100644 --- a/packages/libndsfpc/examples/graphics/Printing/print_both_screens/printBothScreens.pp +++ b/packages/libndsfpc/examples/graphics/Printing/print_both_screens/printBothScreens.pp @@ -1,7 +1,5 @@ program printBothScreens; -{$apptype arm9} - {$mode objfpc} uses @@ -10,7 +8,6 @@ uses var touch: touchPosition; topScreen, bottomScreen: PrintConsole; -// p: PrintConsole; begin videoSetMode(MODE_0_2D); @@ -22,13 +19,6 @@ begin consoleInit(@topScreen, 3,BgType_Text4bpp, BgSize_T_256x256, 31, 0, true, true); consoleInit(@bottomScreen, 3,BgType_Text4bpp, BgSize_T_256x256, 31, 0, false, true); - -{ - topScreen := consoleInit(nil, 3, BgType_Text4bpp, BgSize_T_256x256, 31, 0, true); - p := topScreen^; - bottomScreen := consoleInit(nil, 3, BgType_Text4bpp, BgSize_T_256x256, 31, 0, false); - topScreen := @p; -} consoleSelect(@topScreen); iprintf(#10#10#9'Hello DS dev''rs'#10); diff --git a/packages/libndsfpc/examples/graphics/Printing/rotscale_text/RotscaleText.pp b/packages/libndsfpc/examples/graphics/Printing/rotscale_text/RotscaleText.pp index 1dc4af6e4c..4cc2b900ac 100644 --- a/packages/libndsfpc/examples/graphics/Printing/rotscale_text/RotscaleText.pp +++ b/packages/libndsfpc/examples/graphics/Printing/rotscale_text/RotscaleText.pp @@ -1,6 +1,8 @@ program RotscaleText; {$L build/font.o} +{$mode objfpc} + uses ctypes, nds9; diff --git a/packages/libndsfpc/examples/graphics/Sprites/allocation_test/AllocationTest.pp b/packages/libndsfpc/examples/graphics/Sprites/allocation_test/AllocationTest.pp index e2951fca2a..0da475774d 100644 --- a/packages/libndsfpc/examples/graphics/Sprites/allocation_test/AllocationTest.pp +++ b/packages/libndsfpc/examples/graphics/Sprites/allocation_test/AllocationTest.pp @@ -1,6 +1,7 @@ program AllocationTest; {$mode objfpc} + uses ctypes, nds9; @@ -120,7 +121,7 @@ var begin //sort our sprites on z //a more efficient way would be to keep a sorted list of sprites - qsort(@sprites, SPRITE_MAX, sizeof(TMySprite), @zsort); + qsort(@sprites, SPRITE_MAX, sizeof(TMySprite), TSort(@zsort)); //set oam to values required by my sprite for i := 0 to SPRITE_MAX - 1 do @@ -178,7 +179,7 @@ begin end; var - memUsageTemp: cint;// = $FFFFFFFF; + memUsageTemp: longint;// = $FFFFFFFF; begin randomize; diff --git a/packages/libndsfpc/examples/graphics/Sprites/animate_simple/AnimateSimple.pp b/packages/libndsfpc/examples/graphics/Sprites/animate_simple/AnimateSimple.pp index 4b410d2dee..ab3beeaf49 100644 --- a/packages/libndsfpc/examples/graphics/Sprites/animate_simple/AnimateSimple.pp +++ b/packages/libndsfpc/examples/graphics/Sprites/animate_simple/AnimateSimple.pp @@ -42,10 +42,11 @@ program AnimateSimple; {$L build/man.o} {$L build/woman.o} +{$mode objfpc} + uses ctypes, nds9; - var manTiles: array [0..3071] of cuint; cvar; external; manPal: array [0..255] of cushort; cvar; external; diff --git a/packages/libndsfpc/examples/graphics/Sprites/bitmap_sprites/BitmapSprites.pp b/packages/libndsfpc/examples/graphics/Sprites/bitmap_sprites/BitmapSprites.pp index 261e6c08ab..03424e54da 100644 --- a/packages/libndsfpc/examples/graphics/Sprites/bitmap_sprites/BitmapSprites.pp +++ b/packages/libndsfpc/examples/graphics/Sprites/bitmap_sprites/BitmapSprites.pp @@ -1,5 +1,7 @@ program BitmapSprites; +{$mode objfpc} + uses ctypes, nds9; diff --git a/packages/libndsfpc/examples/graphics/Sprites/fire_and_sprites/FireAndSprites.pp b/packages/libndsfpc/examples/graphics/Sprites/fire_and_sprites/FireAndSprites.pp index a5ceb5dcea..11b1e3b454 100644 --- a/packages/libndsfpc/examples/graphics/Sprites/fire_and_sprites/FireAndSprites.pp +++ b/packages/libndsfpc/examples/graphics/Sprites/fire_and_sprites/FireAndSprites.pp @@ -1,6 +1,8 @@ program FireAndSprites; {$L build/ball.pcx.o} +{$mode objfpc} + uses ctypes, nds9; diff --git a/packages/libndsfpc/examples/graphics/Sprites/simple/Simple.pp b/packages/libndsfpc/examples/graphics/Sprites/simple/Simple.pp index 348ea1c630..f2c3a4faa4 100644 --- a/packages/libndsfpc/examples/graphics/Sprites/simple/Simple.pp +++ b/packages/libndsfpc/examples/graphics/Sprites/simple/Simple.pp @@ -1,9 +1,10 @@ program Simple; +{$mode objfpc} + uses ctypes, nds9; - var i: integer; touch: touchPosition; @@ -39,42 +40,42 @@ begin touchRead(touch); oamSet(oamMain, //main graphics engine context - 0, //oam index (0 to 127) + 0, //oam index (0 to 127) touch.px, touch.py, //x and y pixle location of the sprite 0, //priority, lower renders last (on top) - 0, //this is the palette index if multiple palettes or the alpha value if bmp sprite - SpriteSize_16x16, - SpriteColorFormat_256Color, + 0, //this is the palette index if multiple palettes or the alpha value if bmp sprite + SpriteSize_16x16, + SpriteColorFormat_256Color, gfx, //pointer to the loaded graphics - -1, //sprite rotation data + -1, //sprite rotation data false, //double the size when rotating? false, //hide the sprite? false, false, //vflip, hflip false //apply mosaic - ); - - + ); + + oamSet(oamSub, - 0, - touch.px, - touch.py, - 0, 0, - SpriteSize_16x16, - SpriteColorFormat_256Color, - gfxSub, - -1, - false, - false, - false, false, - false - ); - + touch.px, + touch.py, + 0, + 0, + SpriteSize_16x16, + SpriteColorFormat_256Color, + gfxSub, + -1, + false, + false, + false, false, + false + ); + swiWaitForVBlank(); - + oamUpdate(oamMain); oamUpdate(oamSub); end; -end. +end.
\ No newline at end of file diff --git a/packages/libndsfpc/examples/graphics/Sprites/sprite_extended_palettes/SpriteExtendedPalettes.pp b/packages/libndsfpc/examples/graphics/Sprites/sprite_extended_palettes/SpriteExtendedPalettes.pp index b742c3f02a..0c3221136a 100644 --- a/packages/libndsfpc/examples/graphics/Sprites/sprite_extended_palettes/SpriteExtendedPalettes.pp +++ b/packages/libndsfpc/examples/graphics/Sprites/sprite_extended_palettes/SpriteExtendedPalettes.pp @@ -1,5 +1,7 @@ program SpriteExtendedPalettes; +{$mode objfpc} + uses ctypes, nds9; @@ -32,8 +34,8 @@ begin //------------------------------------------------------------------ vramSetBankF(VRAM_F_LCD); - VRAM_F_EXT_PALETTE[0][1] := RGB15(31,0,0); - VRAM_F_EXT_PALETTE[1][1] := RGB15(0,31,0); + VRAM_F_EXT_PALETTE^[0][1] := RGB15(31,0,0); + VRAM_F_EXT_PALETTE^[1][1] := RGB15(0,31,0); // set vram to ex palette vramSetBankF(VRAM_F_SPRITE_EXT_PALETTE); @@ -46,40 +48,40 @@ begin touchRead(touch); oamSet(oamMain, //main graphics engine context - 0, //oam index (0 to 127) + 0, //oam index (0 to 127) touch.px, touch.py, //x and y pixle location of the sprite 0, //priority, lower renders last (on top) - 0, //this is the palette index if multiple palettes or the alpha value if bmp sprite - SpriteSize_16x16, - SpriteColorFormat_256Color, + 0, //this is the palette index if multiple palettes or the alpha value if bmp sprite + SpriteSize_16x16, + SpriteColorFormat_256Color, gfx1, //pointer to the loaded graphics - -1, //sprite rotation data + -1, //sprite rotation data false, //double the size when rotating? false, //hide the sprite? false, false, //vflip, hflip false //apply mosaic - ); - - + ); + + oamSet(oamMain, - 1, - SCREEN_WIDTH - touch.px, - SCREEN_HEIGHT - touch.py, - 0, + 1, + SCREEN_WIDTH - touch.px, + SCREEN_HEIGHT - touch.py, + 0, 1, //use second palette - SpriteSize_16x16, - SpriteColorFormat_256Color, - gfx2, - -1, - false, - false, - false, false, - false - ); - + SpriteSize_16x16, + SpriteColorFormat_256Color, + gfx2, + -1, + false, + false, + false, false, + false + ); + swiWaitForVBlank(); - + oamUpdate(oamMain); end; -end. +end.
\ No newline at end of file diff --git a/packages/libndsfpc/examples/graphics/Sprites/sprite_rotate/SpriteRotate.pp b/packages/libndsfpc/examples/graphics/Sprites/sprite_rotate/SpriteRotate.pp index decc5d9ba6..e5d6e12d04 100644 --- a/packages/libndsfpc/examples/graphics/Sprites/sprite_rotate/SpriteRotate.pp +++ b/packages/libndsfpc/examples/graphics/Sprites/sprite_rotate/SpriteRotate.pp @@ -1,5 +1,7 @@ program SpriteRotate; +{$mode objfpc} + uses ctypes, nds9; @@ -40,43 +42,43 @@ begin // width (20 - 16, 20 - 16, ) //------------------------------------------------------------------------- oamRotateScale(oamMain, 0, angle, intToFixed(1, 8), intToFixed(1, 8)); - + oamSet(oamMain, //main graphics engine context - 0, //oam index (0 to 127) + 0, //oam index (0 to 127) 20 - 16, 20 - 16, //x and y pixle location of the sprite 0, //priority, lower renders last (on top) - 0, //this is the palette index if multiple palettes or the alpha value if bmp sprite - SpriteSize_32x32, - SpriteColorFormat_256Color, + 0, //this is the palette index if multiple palettes or the alpha value if bmp sprite + SpriteSize_32x32, + SpriteColorFormat_256Color, gfx, //pointer to the loaded graphics - 0, //sprite rotation/scale matrix index + 0, //sprite rotation/scale matrix index true, //double the size when rotating? false, //hide the sprite? false, false, //vflip, hflip false //apply mosaic - ); - + ); + //------------------------------------------------------------------------- // Because the sprite below has size double set to false it can never be larger than - // 32x32 causing it to clip as it rotates. + // 32x32 causing it to clip as it rotates. //------------------------------------------------------------------------- oamSet(oamMain, //main graphics engine context - 1, //oam index (0 to 127) + 1, //oam index (0 to 127) 204, 20, //x and y pixle location of the sprite 0, //priority, lower renders last (on top) - 0, //this is the palette index if multiple palettes or the alpha value if bmp sprite - SpriteSize_32x32, - SpriteColorFormat_256Color, + 0, //this is the palette index if multiple palettes or the alpha value if bmp sprite + SpriteSize_32x32, + SpriteColorFormat_256Color, gfx, //pointer to the loaded graphics - 0, //sprite rotation/scale matrix index + 0, //sprite rotation/scale matrix index false, //double the size when rotating? false, //hide the sprite? false, false, //vflip, hflip false //apply mosaic - ); + ); swiWaitForVBlank(); - + oamUpdate(oamMain); end; -end. +end.
\ No newline at end of file diff --git a/packages/libndsfpc/examples/hello_world/helloWorld.pp b/packages/libndsfpc/examples/hello_world/helloWorld.pp index d556d20cac..51969878b4 100644 --- a/packages/libndsfpc/examples/hello_world/helloWorld.pp +++ b/packages/libndsfpc/examples/hello_world/helloWorld.pp @@ -1,5 +1,7 @@ program hello_world; +{$mode objfpc} + uses ctypes, nds9; diff --git a/packages/libndsfpc/examples/input/keyboard/keyboard_async/keyboardAsync.pp b/packages/libndsfpc/examples/input/keyboard/keyboard_async/keyboardAsync.pp index de174f1e62..a4b73671b8 100644 --- a/packages/libndsfpc/examples/input/keyboard/keyboard_async/keyboardAsync.pp +++ b/packages/libndsfpc/examples/input/keyboard/keyboard_async/keyboardAsync.pp @@ -1,5 +1,7 @@ program keyboardAsync; +{$mode objfpc} + uses ctypes, nds9; diff --git a/packages/libndsfpc/examples/input/keyboard/keyboard_stdin/keyboardStdin.pp b/packages/libndsfpc/examples/input/keyboard/keyboard_stdin/keyboardStdin.pp index 1346d08ba7..55c5d2da4c 100644 --- a/packages/libndsfpc/examples/input/keyboard/keyboard_stdin/keyboardStdin.pp +++ b/packages/libndsfpc/examples/input/keyboard/keyboard_stdin/keyboardStdin.pp @@ -1,9 +1,11 @@ program keyboardStdin; +{$mode objfpc} + uses ctypes, nds9; -function OnKeyPressed(key: cint): pointer; +procedure OnKeyPressed(key: cint); begin if (key > 0) then iprintf('%c', key); diff --git a/packages/libndsfpc/src/fat/fat.pp b/packages/libndsfpc/src/fat/fat.pp index 9728cca946..d5a635f775 100644 --- a/packages/libndsfpc/src/fat/fat.pp +++ b/packages/libndsfpc/src/fat/fat.pp @@ -21,14 +21,14 @@ uses {$linklib sysbase} {$define NDS_INTERFACE} -{$include fathelper.inc} +{ $include fathelper.inc} {$include ../nds/disc_io.inc} {$include fat.inc} {$undef NDS_INTERFACE} implementation {$define NDS_IMPLEMENTATION} -{$include fathelper.inc} +{ $include fathelper.inc} {$include ../nds/disc_io.inc} {$include fat.inc} {$undef NDS_IMPLEMENTATION} diff --git a/packages/libndsfpc/src/fat/filesystem.pp b/packages/libndsfpc/src/fat/filesystem.pp index 60dd9e5ef2..fda4901ec5 100644 --- a/packages/libndsfpc/src/fat/filesystem.pp +++ b/packages/libndsfpc/src/fat/filesystem.pp @@ -21,14 +21,14 @@ uses {$linklib sysbase} {$define NDS_INTERFACE} -{$include fathelper.inc} +{ $include fathelper.inc} {$include ../nds/disc_io.inc} {$include filesystem.inc} {$undef NDS_INTERFACE} implementation {$define NDS_IMPLEMENTATION} -{$include fathelper.inc} +{ $include fathelper.inc} {$include ../nds/disc_io.inc} {$include filesystem.inc} {$undef NDS_IMPLEMENTATION} diff --git a/packages/libndsfpc/src/maxmod/inc/maxmod.inc b/packages/libndsfpc/src/maxmod/inc/maxmod.inc index bded1a0140..6d46718599 100644 --- a/packages/libndsfpc/src/maxmod/inc/maxmod.inc +++ b/packages/libndsfpc/src/maxmod/inc/maxmod.inc @@ -59,7 +59,7 @@ procedure mmSetModuleTempo(tempo: mm_word); cdecl; external; procedure mmSetModulePitch(pitch: mm_word); cdecl; external; procedure mmPlayModule(address, mode, layer: mm_word); cdecl; external; function mmEffect(sample_ID: mm_word): mm_sfxhand; cdecl; external; -function mmEffectEx(sound: pmm_sound_effect): mm_sfxhand; cdecl; external; +function mmEffectEx(var sound: mm_sound_effect): mm_sfxhand; cdecl; external; procedure mmEffectVolume(handle: mm_sfxhand; volume: mm_word); cdecl; external; procedure mmEffectPanning(handle: mm_sfxhand; panning: mm_byte); cdecl; external; procedure mmEffectRate(handle: mm_sfxhand; rate: mm_word); cdecl; external; diff --git a/packages/libndsfpc/src/nds/arm7/clock.inc b/packages/libndsfpc/src/nds/arm7/clock.inc index 18bea363f1..0d3a801dc3 100644 --- a/packages/libndsfpc/src/nds/arm7/clock.inc +++ b/packages/libndsfpc/src/nds/arm7/clock.inc @@ -104,4 +104,5 @@ procedure BCDToInteger(var data: cuint8; length: cuint32); cdecl; external; procedure integerToBCD(var data: cuint8; length: cuint32); cdecl; external; procedure initClockIRQ(); cdecl; external; +procedure resyncClock(); cdecl; external; {$endif NDS_INTERFACE} diff --git a/packages/libndsfpc/src/nds/arm9/background.inc b/packages/libndsfpc/src/nds/arm9/background.inc index 4d50611514..012b5b0579 100644 --- a/packages/libndsfpc/src/nds/arm9/background.inc +++ b/packages/libndsfpc/src/nds/arm9/background.inc @@ -515,15 +515,15 @@ end; procedure bgSetMosaic(dx, dy: cuint); inline; begin sassert( (dx < 16) and (dy < 16), 'Mosaic range is 0 to 15'); - MOSAIC_CR^ := MOSAIC_CR^ and not $FF; - MOSAIC_CR^ := MOSAIC_CR^ or (dx or (dy shl 4)); + mosaicShadow := (mosaicShadow and $ff00) or (dx or (dy shl 4)); + REG_MOSAIC^ := mosaicShadow; end; procedure bgSetMosaicSub(dx, dy: cuint); inline; begin sassert( (dx < 16) and (dy < 16), 'Mosaic range is 0 to 15'); - SUB_MOSAIC_CR^ := SUB_MOSAIC_CR^ and not $FF; - SUB_MOSAIC_CR^ := SUB_MOSAIC_CR^ or (dx or (dy shl 4)); + mosaicShadowSub := (mosaicShadowSub and $ff00) or (dx or (dy shl 4)); + REG_MOSAIC_SUB^ := mosaicShadowSub; end; diff --git a/packages/libndsfpc/src/nds/arm9/keyboard.inc b/packages/libndsfpc/src/nds/arm9/keyboard.inc index cf64767718..b8660dd7c6 100644 --- a/packages/libndsfpc/src/nds/arm9/keyboard.inc +++ b/packages/libndsfpc/src/nds/arm9/keyboard.inc @@ -42,8 +42,8 @@ {$ifdef NDS_INTERFACE} type - KeyChangeCallback = function(key: cint): pointer; -// KeyChangeCallback = procedure(key: cint) of object; +// KeyChangeCallback = function(key: cint): pointer; + KeyChangeCallback = procedure(key: cint); PKeyChangeCallback = ^KeyChangeCallback; KeyboardState = integer; @@ -99,6 +99,6 @@ procedure keyboardShow(); cdecl; external; procedure keyboardHide(); cdecl; external; function keyboardGetKey(x, y: cint): cint; cdecl; external; procedure keyboardGetString(buffer: pchar; maxLen: cint); cdecl; external; -function keboardGetChar(): cint; cdecl; external; +function keyboardGetChar(): cint; cdecl; external; function keyboardUpdate(): cint; cdecl; external; {$endif NDS_INTERFACE} diff --git a/packages/libndsfpc/src/nds/arm9/sound.inc b/packages/libndsfpc/src/nds/arm9/sound.inc index b2cde137ae..34b18a9a29 100644 --- a/packages/libndsfpc/src/nds/arm9/sound.inc +++ b/packages/libndsfpc/src/nds/arm9/sound.inc @@ -80,6 +80,8 @@ function soundPlayNoise(freq: cuint16; volume, pan: cuint8): cint; cdecl; extern procedure soundPause(soundId: cint); cdecl; external; +procedure soundSetWaveDuty(soundId: cint; cycle: DutyCycle); cdecl; external; + procedure soundKill(soundId: cint); cdecl; external; procedure soundResume(soundId: cint); cdecl; external; diff --git a/packages/libndsfpc/src/nds/arm9/sprite.inc b/packages/libndsfpc/src/nds/arm9/sprite.inc index 28b532e8ad..79eb8df2a9 100644 --- a/packages/libndsfpc/src/nds/arm9/sprite.inc +++ b/packages/libndsfpc/src/nds/arm9/sprite.inc @@ -299,6 +299,7 @@ function oamAllocateGfx(var oam: OamState; size: SpriteSize; colorFormat: Sprite procedure oamFreeGfx(var oam: OamState; const gfxOffset: pointer); cdecl; external; procedure oamSetMosaic(dx, dy: cuint); inline; +procedure oamSetMosaicSub(dx, dy: cuint); inline; procedure oamSet( var oam: OamState; id, x, y, priority, palette_alpha: cint; @@ -310,6 +311,8 @@ procedure oamSet( var oam: OamState; procedure oamClear(var oam: OamState; start, count: cint); cdecl; external; procedure oamUpdate(var oam: OamState); cdecl; external; procedure oamRotateScale(var oam: OamState; rotId, angle, sx, sy: cint); cdecl; external; +procedure oamAffineTransformation(var oam: OamState; rotId, hdx, hdy, vdx, vdy: cint); inline; + function oamCountFragments(var oam: OamState): cint; cdecl; external; procedure oamAllocReset(var oam: OamState); cdecl; external; function oamGfxPtrToOffset(const offset: pointer): cuint; cdecl; external; @@ -364,8 +367,25 @@ end; procedure oamSetMosaic(dx, dy: cuint); inline; begin sassert((dx < 16) and (dy < 16), 'Mosaic range is 0 to 15'); - MOSAIC_CR^ := MOSAIC_CR^ and not ($FF00); - MOSAIC_CR^ := MOSAIC_CR^ or ((dx shl 8) or (dy shl 12)); + mosaicShadow := ( mosaicShadow and $00ff) or (dx shl 8) or (dy shl 12); + REG_MOSAIC^ := mosaicShadow; +end; + +procedure oamSetMosaicSub(dx, dy: cuint); inline; +begin + sassert((dx < 16) and (dy < 16), 'Mosaic range is 0 to 15'); + mosaicShadowSub := (mosaicShadowSub and $00ff) or (dx shl 8) or (dy shl 12); + REG_MOSAIC_SUB^ := mosaicShadowSub; end; +procedure oamAffineTransformation(var oam: OamState; rotId, hdx, hdy, vdx, vdy: cint); inline; +begin + sassert((rotId >= 0) and (rotId < 32), 'oamAffineTransformation() rotId is out of bounds, must be 0-31'); + oam.oamRotationMemory[rotId].hdx := hdx shr 12; + oam.oamRotationMemory[rotId].hdy := hdy shr 12; + oam.oamRotationMemory[rotId].vdx := vdx shr 12; + oam.oamRotationMemory[rotId].vdy := vdy shr 12; +end; + + {$endif NDS_IMPLEMENTATION} diff --git a/packages/libndsfpc/src/nds/arm9/video.inc b/packages/libndsfpc/src/nds/arm9/video.inc index 8eaec5a298..f8ff9565dc 100644 --- a/packages/libndsfpc/src/nds/arm9/video.inc +++ b/packages/libndsfpc/src/nds/arm9/video.inc @@ -43,6 +43,10 @@ {$endif ARM9} {$ifdef NDS_INTERFACE} +var + mosaicShadow: cuint16; cvar; external; + mosaicShadowSub: cuint16; cvar; external; + const BG_PALETTE : pcuint16 = pointer($05000000); BG_PALETTE_SUB : pcuint16 = pointer($05000400); @@ -244,10 +248,10 @@ type P_ext_palette = ^_ext_palette; var - VRAM_E_EXT_PALETTE : P_palette absolute VRAM_E; - VRAM_F_EXT_PALETTE : P_palette absolute VRAM_F; - VRAM_G_EXT_PALETTE : P_palette absolute VRAM_G; - VRAM_H_EXT_PALETTE : P_palette absolute VRAM_H; + VRAM_E_EXT_PALETTE : P_ext_palette absolute VRAM_E; + VRAM_F_EXT_PALETTE : P_ext_palette absolute VRAM_F; + VRAM_G_EXT_PALETTE : P_ext_palette absolute VRAM_G; + VRAM_H_EXT_PALETTE : P_ext_palette absolute VRAM_H; function vramSetMainBanks(a: VRAM_A_TYPE; b: VRAM_B_TYPE; c: VRAM_C_TYPE; d: VRAM_D_TYPE): cuint32; cdecl; external; procedure vramRestoreMainBanks(vramTemp: cuint32); cdecl; external; @@ -375,8 +379,8 @@ const SUB_WIN_IN : pcuint16 = pointer($04001048); SUB_WIN_OUT : pcuint16 = pointer($0400104A); - MOSAIC_CR : pcuint16 = pointer($0400004C); - SUB_MOSAIC_CR : pcuint16 = pointer($0400104C); + REG_MOSAIC : pcuint16 = pointer($0400004C); + REG_MOSAIC_SUB : pcuint16 = pointer($0400104C); REG_BLDCNT : pcuint16 = pointer($04000050); REG_BLDY : pcuint16 = pointer($04000054); diff --git a/packages/libndsfpc/src/nds/arm9/videoGL.inc b/packages/libndsfpc/src/nds/arm9/videoGL.inc index 4be9d7a90c..669680b6bf 100644 --- a/packages/libndsfpc/src/nds/arm9/videoGL.inc +++ b/packages/libndsfpc/src/nds/arm9/videoGL.inc @@ -75,7 +75,7 @@ const function inttof32(n: cint): cint32; inline; function f32toint(n: cint32): cint; inline; -function floattof32(n: cfloat): cint32; inline; +function floattof32(n: cfloat): cint32; inline; //inlining it makes impossible to pass it to another function :/ function f32tofloat(n: cint32): cfloat; inline; type @@ -89,7 +89,7 @@ function TEXTURE_PACK(u, v: cint): cint; inline; //function TEXTURE_PACK(u, v: cshort): cuint; inline; type - v16 = cuint16; //cshort? // vertex 4.12 fixed format + v16 = cshort;//cuint16? // vertex 4.12 fixed format function inttov16(n: cint): cint{v16}; inline; function f32tov16(n: cint32): v16; inline; diff --git a/packages/libndsfpc/src/nds/bios.inc b/packages/libndsfpc/src/nds/bios.inc index 975b75b76d..f44d3721f1 100644 --- a/packages/libndsfpc/src/nds/bios.inc +++ b/packages/libndsfpc/src/nds/bios.inc @@ -69,10 +69,6 @@ procedure swiSoftReset(); cdecl; external; procedure swiDelay(duration: cuint32); cdecl; external; -procedure swiIntrWait(waitForSet: cint; flags: cuint32); cdecl; external; - -procedure swiWaitForVBlank(); cdecl; external; - function swiDivide(numerator, divisor: cint): cint; cdecl; external; function swiRemainder(numerator, divisor: cint): cint; cdecl; external; procedure swiDivMod(numerator, divisor: cint; var result, remainder: cint); cdecl; external; diff --git a/packages/libndsfpc/src/nds/dynamicArray.inc b/packages/libndsfpc/src/nds/dynamicArray.inc index e8dd592d13..a8340d19f9 100644 --- a/packages/libndsfpc/src/nds/dynamicArray.inc +++ b/packages/libndsfpc/src/nds/dynamicArray.inc @@ -86,11 +86,15 @@ var begin if (index >= v^.cur_size) then begin + v^.data := ReAllocMem(v^.data, sizeof(pointer) * v^.cur_size * 2); + FillChar(pointer(integer(v^.data^^) + v^.cur_size)^, sizeof(pointer) * v^.cur_size, 0); v^.cur_size := v^.cur_size * 2; - v^.data := ReAllocMem(v^.data, sizeof(pointer) * v^.cur_size); end; + { i := integer(v^.data); i := i + index; pointer(i) := item; + } + v^.data[index] := item; end; {$endif NDS_IMPLEMENTATION} diff --git a/packages/libndsfpc/src/nds/fifocommon.inc b/packages/libndsfpc/src/nds/fifocommon.inc index d92cbe7a16..59c2ca1568 100644 --- a/packages/libndsfpc/src/nds/fifocommon.inc +++ b/packages/libndsfpc/src/nds/fifocommon.inc @@ -47,11 +47,11 @@ const FIFO_PM : FifoChannels = 0; FIFO_SOUND : FifoChannels = 1; FIFO_SYSTEM : FifoChannels = 2; - FIFO_RSDV_01: FifoChannels = 3; - FIFO_RSVD_02: FifoChannels = 4; - FIFO_RSVD_03: FifoChannels = 5; - FIFO_DSWIFI : FifoChannels = 6; - FIFO_MAXMOD : FifoChannels = 7; + FIFO_MAXMOD : FifoChannels = 3; + FIFO_DSWIFI : FifoChannels = 4; + FIFO_RSVD_01: FifoChannels = 5; + FIFO_RSVD_02: FifoChannels = 6; + FIFO_RSVD_03: FifoChannels = 7; FIFO_USER_01: FifoChannels = 8; FIFO_USER_02: FifoChannels = 9; FIFO_USER_03: FifoChannels = 10; @@ -65,16 +65,17 @@ const type FifoSoundCommand = integer; const - SOUND_SET_PAN : FifoSoundCommand = (0 shl 20); - SOUND_SET_VOLUME : FifoSoundCommand = (1 shl 20); - SOUND_SET_FREQ : FifoSoundCommand = (2 shl 20); - SOUND_MASTER_ENABLE : FifoSoundCommand = (3 shl 20); - SOUND_MASTER_DISABLE : FifoSoundCommand = (4 shl 20); - SOUND_PAUSE : FifoSoundCommand = (5 shl 20); - SOUND_RESUME : FifoSoundCommand = (6 shl 20); - SOUND_KILL : FifoSoundCommand = (7 shl 20); - SOUND_SET_MASTER_VOL : FifoSoundCommand = (8 shl 20); - MIC_STOP : FifoSoundCommand = (9 shl 20); + SOUND_SET_PAN : FifoSoundCommand = ( 0 shl 20); + SOUND_SET_VOLUME : FifoSoundCommand = ( 1 shl 20); + SOUND_SET_FREQ : FifoSoundCommand = ( 2 shl 20); + SOUND_SET_WAVEDUTY : FifoSoundCommand = ( 3 shl 20); + SOUND_MASTER_ENABLE : FifoSoundCommand = ( 4 shl 20); + SOUND_MASTER_DISABLE : FifoSoundCommand = ( 5 shl 20); + SOUND_PAUSE : FifoSoundCommand = ( 6 shl 20); + SOUND_RESUME : FifoSoundCommand = ( 7 shl 20); + SOUND_KILL : FifoSoundCommand = ( 8 shl 20); + SET_MASTER_VOL : FifoSoundCommand = ( 9 shl 20); + MIC_STOP : FifoSoundCommand = (10 shl 20); type FifoSystemCommands = integer; @@ -99,6 +100,7 @@ const WIFI_ENABLE : FifoWifiCommands = 0; WIFI_DISABLE : FifoWifiCommands = 1; WIFI_SYNC : FifoWifiCommands = 2; + WIFI_STARTUP : FifoWifiCommands = 3; type PM_LedBlinkMode = integer; @@ -107,18 +109,8 @@ const PM_LED_SLEEP: PM_LedBlinkMode = (1 shl 4); PM_LED_BLINK: PM_LedBlinkMode = (3 shl 4); -const - FIFO_CHANNEL_BITS = 4; - FIFO_MAX_DATA_BYTES = 128; - -{$ifdef ARM9} - FIFO_BUFFER_ENTRIES = 512; -{$else ARM9} // ARM7 - FIFO_BUFFER_ENTRIES = 256; -{$endif ARM9} - -var - fifo_buffer: array [0..FIFO_BUFFER_ENTRIES*2-1] of cuint32; cvar; external; +//var +// fifo_buffer: array [0..FIFO_BUFFER_ENTRIES*2-1] of cuint32; cvar; external; {$ifdef FIFO_RIGOROUS_ERROR_CHECKING} @@ -140,237 +132,23 @@ function fifoSetAddressHandler(channel: integer; newhandler: FifoAddressHandlerF function fifoSetValue32Handler(channel: integer; newhandler: FifoValue32HandlerFunc; userdata: pointer): cbool; cdecl; external; function fifoSetDatamsgHandler(channel: integer; newhandler: FifoDatamsgHandlerFunc; userdata: pointer): cbool; cdecl; external; -procedure fifoForceAddressHandler(channel: integer; newhandler: FifoAddressHandlerFunc; userdata: pointer); cdecl; external; -procedure fifoForceValue32Handler(channel: integer; newhandler: FifoValue32HandlerFunc; userdata: pointer); cdecl; external; -procedure fifoForceDatamsgHandler(channel: integer; newhandler: FifoDatamsgHandlerFunc; userdata: pointer); cdecl; external; - function fifoCheckAddress(channel: integer): cbool; cdecl; external; function fifoCheckValue32(channel: integer): cbool; cdecl; external; function fifoCheckDatamsg(channel: integer): cbool; cdecl; external; function fifoCheckDatamsgLength(channel: integer): cint; cdecl; external; -function fifoCountDatamsg(channel: integer): cint; cdecl; external; - function fifoGetAddress(channel: integer): pointer; cdecl; external; function fifoGetValue32(channel: integer): cuint32; cdecl; external; - function fifoGetDatamsg(channel, buffersize: cint; destbuffer: pcuint8): cint; cdecl; external; -function fifoGetBufferUsage(): cint; cdecl; external; - -function fifoGetLostWordCount(): cint; cdecl; external; - - - -procedure fifoInternalSendInterrupt(); cdecl; external; -procedure fifoInternalRecvInterrupt(); cdecl; external; -procedure fifoInternalProtect(); cdecl; external; -procedure fifoInternalUnprotect(); cdecl; external; -function fifoInternalSend(firstword: cuint32; extrawordcount: cint; wordlist: pcuint32): cbool; cdecl; external; -procedure fifoInternalBeginSend(); cdecl; external; -function fifoInternalRecvPeek(): cuint32; cdecl; external; -function fifoInternalRecvPopFirst(): cuint32; cdecl; external; -function fifoInternalRecvWordCount(): cint; cdecl; external; -function fifoInternalRecvPushBack(word: cuint32): cbool; cdecl; external; -function fifoInternalSendEmpty(): cbool; cdecl; external; -function fifoInternalSendDeque(): cuint32; cdecl; external; -function fifoInternalSendEnqueue(word: cuint32): cbool; cdecl; external; -function fifoInternalAllocFreeBlock(): cint; cdecl; external; -procedure fifoInternalFreeBlock(blockid: cint); cdecl; external; -function fifoInternalFreeCheck(num_words: cint): cbool; cdecl; external; - - - - -// And some aspects of the configuration can't be changed -// please don't edit below this line. - -const - FIFO_ADDRESSDATA_SHIFT = 0; - FIFO_MINADDRESSDATABITS = 22; - FIFO_ADDRESSDATA_MASK = $003FFFFF; - FIFO_ADDRESSBASE = $02000000; - FIFO_ADDRESSCOMPATIBLE = $FFC00000; - - FIFO_NUM_CHANNELS = (1 shl FIFO_CHANNEL_BITS); - FIFO_CHANNEL_SHIFT = (32 - FIFO_CHANNEL_BITS); - FIFO_CHANNEL_MASK = ((1 shl FIFO_CHANNEL_BITS) - 1); - - FIFO_ADDRESSBIT_SHIFT = (FIFO_CHANNEL_SHIFT - 1); - FIFO_ADDRESSBIT = (1 shl FIFO_ADDRESSBIT_SHIFT); - - FIFO_IMMEDIATEBIT_SHIFT = (FIFO_CHANNEL_SHIFT - 2); - FIFO_IMMEDIATEBIT = (1 shl FIFO_IMMEDIATEBIT_SHIFT); - - FIFO_EXTRABIT_SHIFT = (FIFO_CHANNEL_SHIFT - 3); - FIFO_EXTRABIT = (1 shl FIFO_EXTRABIT_SHIFT); - - - FIFO_VALUE32_MASK = (FIFO_EXTRABIT - 1); - - - FIFO_BUFFER_TERMINATE = $FFFF; - FIFO_BUFFER_NEXTMASK = $FFFF; - - -{ $IF (FIFO_MINADDRESSDATABITS + FIFO_CHANNEL_BITS + 1) > 32} - { $ERROR Too many channel bits - control word isn't big enough for address packet} -{ $ENDIF} - - - - -function FIFO_PACK_ADDRESS(channel, address: cint): cint; inline; -function FIFO_VALUE32_NEEDEXTRA(value32: cint32): boolean; inline; -function FIFO_PACK_VALUE32(channel, value32: cint): cint; inline; -function FIFO_PACK_VALUE32_EXTRA(channel: cint): cint; inline; -function FIFO_IS_ADDRESS_COMPATIBLE(address: cint): boolean; inline; -function FIFO_PACK_DATAMSG_HEADER(channel, numwords: cint): cint; inline; -function FIFO_IS_ADDRESS(dataword: cint): boolean; inline; -function FIFO_IS_VALUE32(dataword: cint): boolean; inline; -function FIFO_IS_DATA(dataword: cint): boolean; inline; -function FIFO_UNPACK_CHANNEL(dataword: cint): cint; inline; -function FIFO_UNPACK_ADDRESS(dataword: cint): pointer; inline; -function FIFO_UNPACK_VALUE32_NEEDEXTRA(dataword: cint): boolean; inline; -function FIFO_UNPACK_VALUE32_NOEXTRA(dataword: cint): cint; inline; -function FIFO_UNPACK_DATALENGTH(dataword: cint): cint; inline; - -const - FIFO_BUFFERCONTROL_UNUSED = 0; - FIFO_BUFFERCONTROL_SENDWORD = 1; - FIFO_BUFFERCONTROL_RECVWORD = 2; - FIFO_BUFFERCONTROL_ADDRESS = 3; - FIFO_BUFFERCONTROL_VALUE32 = 4; - FIFO_BUFFERCONTROL_DATASTART = 5; - FIFO_BUFFERCONTROL_DATA = 6; - -function FIFO_BUFFER_DATA(index: cint): cint; inline; -function FIFO_BUFFER_DATA_BYTE(index, byteindex: cint): pcuint8; inline; -function FIFO_BUFFER_GETNEXT(index: cint): cint; inline; -function FIFO_BUFFER_GETCONTROL(index: cint): cint; inline; -function FIFO_BUFFER_GETEXTRA(index: cint): cint; inline; -procedure FIFO_BUFFER_SETCONTROL(index,next,control,extra: cint); inline; -procedure FIFO_BUFFER_SETNEXT(index, next: cint); inline; - - {$endif NDS_INTERFACE} {$ifdef NDS_IMPLEMENTATION} -function FIFO_PACK_ADDRESS(channel, address: cint): cint; inline; -begin - result := ((channel) shl FIFO_CHANNEL_SHIFT) or - FIFO_ADDRESSBIT or - ((address shr FIFO_ADDRESSDATA_SHIFT) and FIFO_ADDRESSDATA_MASK); -end; - -function FIFO_VALUE32_NEEDEXTRA(value32: cint32): boolean; inline; -begin - result := (value32 and (not FIFO_VALUE32_MASK)) <> 0; -end; - -function FIFO_PACK_VALUE32(channel, value32: cint): cint; inline; -begin - result := (channel shl FIFO_CHANNEL_SHIFT) or - FIFO_IMMEDIATEBIT or - (value32 and FIFO_VALUE32_MASK); -end; - -function FIFO_PACK_VALUE32_EXTRA(channel: cint): cint; inline; -begin - result := (channel shl FIFO_CHANNEL_SHIFT) or FIFO_IMMEDIATEBIT or FIFO_EXTRABIT; -end; - -function FIFO_IS_ADDRESS_COMPATIBLE(address: cint): boolean; inline; -begin - result := (address and FIFO_ADDRESSCOMPATIBLE) = FIFO_ADDRESSBASE; -end; - -function FIFO_PACK_DATAMSG_HEADER(channel, numwords: cint): cint; inline; -begin - result := (channel shl FIFO_CHANNEL_SHIFT) or (numwords and FIFO_VALUE32_MASK); -end; - -function FIFO_IS_ADDRESS(dataword: cint): boolean; inline; -begin - result := (dataword and FIFO_ADDRESSBIT) <> 0; -end; - -function FIFO_IS_VALUE32(dataword: cint): boolean; inline; -begin - result := ((dataword and FIFO_ADDRESSBIT) = 0) and ((dataword and FIFO_IMMEDIATEBIT) <> 0); -end; - -function FIFO_IS_DATA(dataword: cint): boolean; inline; -begin - result := (dataword and (FIFO_ADDRESSBIT or FIFO_IMMEDIATEBIT)) = 0; -end; - -function FIFO_UNPACK_CHANNEL(dataword: cint): cint; inline; -begin - result := (dataword shr FIFO_CHANNEL_SHIFT) and FIFO_CHANNEL_MASK; -end; - -function FIFO_UNPACK_ADDRESS(dataword: cint): pointer; inline; -begin - result := pointer(((dataword and FIFO_ADDRESSDATA_MASK) shl FIFO_ADDRESSDATA_SHIFT) or FIFO_ADDRESSBASE); -end; - -function FIFO_UNPACK_VALUE32_NEEDEXTRA(dataword: cint): boolean; inline; -begin - result := (dataword and FIFO_EXTRABIT) <> 0; -end; - -function FIFO_UNPACK_VALUE32_NOEXTRA(dataword: cint): cint; inline; -begin - result := (dataword and FIFO_VALUE32_MASK); -end; - -function FIFO_UNPACK_DATALENGTH(dataword: cint): cint; inline; -begin - result := (dataword and FIFO_VALUE32_MASK); -end; - -function FIFO_BUFFER_DATA(index: cint): cint; inline; -begin - result := fifo_buffer[(index)*2+1]; -end; - -function FIFO_BUFFER_DATA_BYTE(index, byteindex: cint): pcuint8; inline; -begin -// ((u8*)(&fifo_buffer[(index)*2+1]))[(byteindex)] -///////// result := pcuint8(pointer(fifo_buffer[index*2+1]))[byteindex]; -end; - - -function FIFO_BUFFER_GETNEXT(index: cint): cint; inline; -begin - result := (fifo_buffer[(index)*2] and FIFO_BUFFER_NEXTMASK); -end; - -function FIFO_BUFFER_GETCONTROL(index: cint): cint; inline; -begin - result := (fifo_buffer[(index)*2] shr 28); -end; - -function FIFO_BUFFER_GETEXTRA(index: cint): cint; inline; -begin - result := ((fifo_buffer[(index)*2] shr 16) and $FFF); -end; - -procedure FIFO_BUFFER_SETCONTROL(index,next,control,extra: cint); inline; -begin - fifo_buffer[(index)*2] := (next and FIFO_BUFFER_NEXTMASK) or (control shl 28) or ((extra and $FFF) shl 16); -end; - -procedure FIFO_BUFFER_SETNEXT(index, next: cint); inline; -begin - fifo_buffer[(index)*2] := (next and FIFO_BUFFER_NEXTMASK) or (fifo_buffer[(index)*2] and (not FIFO_BUFFER_NEXTMASK)); -end; {$endif NDS_IMPLEMENTATION} diff --git a/packages/libndsfpc/src/nds/fifomessages.inc b/packages/libndsfpc/src/nds/fifomessages.inc index 4827b22aa7..ca54b212bc 100644 --- a/packages/libndsfpc/src/nds/fifomessages.inc +++ b/packages/libndsfpc/src/nds/fifomessages.inc @@ -43,62 +43,52 @@ type {$PACKRECORDS 4} FifoMessage = record _type: cuint16; - empty: array[0..31] of cuint8; + case integer of + 0: ( + SundPlay: record + _type: cuint16; + data: pointer; + loopPoint: cuint16; + dataSize: cuint16; + freq: cuint16; + volume: cuint8; + pan: cuint8; + loop: cbool; + format: cuint8; + end; + ); + 1: ( + SoundPsg: record + freq: cuint16; + dutyCycle: cuint8; + volume: cuint8; + pan: cuint8; + end; + ); + 2: ( + MicRecord: record + buffer: pointer; + bufferLength: cuint32; + freq: cuint16; + format: cuint8; + end; + ); + 3: ( + MicBufferFull: record + buffer: pointer; + length: cuint32; + end; + ); + 4: ( + SystemInput: record + touch: touchPosition; + keys: cuint16; + end; + ); end; TFifoMessage = FifoMessage; PFifoMessage = ^FifoMessage; - SoundPlayMsg = record - _type: cuint16; - data: pointer; - loopPoint: cuint16; - dataSize: cuint16; - freq: cuint16; - volume: cuint8; - pan: cuint8; - loop: cbool; - format: cuint8; - end; - TSoundPlayMsg = SoundPlayMsg; - PSoundPlayMsg = ^SoundPlayMsg; - - SoundPsgMsg = record - _type: cuint16; - freq: cuint16; - dutyCycle: cuint8; - volume: cuint8; - pan: cuint8; - end; - TSoundPsgMsg = SoundPsgMsg; - PSoundPsgMsg = ^SoundPsgMsg; - - MicRecordMsg = record - _type: cuint16; - buffer: pointer; - bufferLength: cuint32; - freq: cuint16; - format: cuint8; - end; - TMicRecordMsg = MicRecordMsg; - PMicRecordMsg = ^MicRecordMsg; - - MicBufferFullMsg = record - _type: cuint16; - buffer: pointer; - length: cuint32; - end; - TMicBufferFullMsg = MicBufferFullMsg; - PMicBufferFullMsg = ^MicBufferFullMsg; - - - SystemInputMsg = record - _type: cuint16; - touch: touchPosition; - keys: cuint16; - end; - TSystemInputMsg = SystemInputMsg; - PSystemInputMsg = ^SystemInputMsg; - {$PACKRECORDS C} {$endif NDS_INTERFACE} diff --git a/packages/libndsfpc/src/nds/interrupts.inc b/packages/libndsfpc/src/nds/interrupts.inc index 5e0d6f7f23..4863929f1c 100644 --- a/packages/libndsfpc/src/nds/interrupts.inc +++ b/packages/libndsfpc/src/nds/interrupts.inc @@ -122,6 +122,11 @@ procedure irqInitHandler(handler: TVoidFunctionPointer); cdecl; external; procedure irqInitHandler(handler: pointer); cdecl; external; procedure irqEnable(irq: cuint32); cdecl; external; procedure irqDisable(irq: cuint32); cdecl; external; + +procedure swiIntrWait(waitForSet: cint; flags: cuint32); cdecl; external; +procedure swiWaitForVBlank(); cdecl; external; +function enterCriticalSection(): cint; inline; +procedure leaveCriticalSection(oldIME: cint); inline; {$endif NDS_INTERFACE} {$ifdef NDS_IMPLEMENTATION} @@ -131,5 +136,19 @@ begin result := (1 shl (n + 3)); end; +function enterCriticalSection(): cint; inline; +var + oldIME: cint; +begin + oldIME := REG_IME^; + REG_IME^ := 0; + result := oldIME; +end; + +procedure leaveCriticalSection(oldIME: cint); inline; +begin + REG_IME^ := oldIME; +end; + {$endif NDS_IMPLEMENTATION} diff --git a/packages/libndsfpc/src/nds/ndsinclude.inc b/packages/libndsfpc/src/nds/ndsinclude.inc index 7b6531d5bd..2a244917c2 100644 --- a/packages/libndsfpc/src/nds/ndsinclude.inc +++ b/packages/libndsfpc/src/nds/ndsinclude.inc @@ -1,5 +1,5 @@ -{$include helper.inc} +{ $include helper.inc} {$include ndstypes.inc} {$include bios.inc} {$include card.inc} diff --git a/packages/libndsfpc/src/nds/registers_alt.inc b/packages/libndsfpc/src/nds/registers_alt.inc index 3415cfd143..01b258a348 100644 --- a/packages/libndsfpc/src/nds/registers_alt.inc +++ b/packages/libndsfpc/src/nds/registers_alt.inc @@ -111,10 +111,8 @@ const REG_WININ : pcuint16 = pointer($4000048); REG_WINOUT : pcuint16 = pointer($400004A); - REG_MOSAIC : pcuint32 = pointer($400004C); - REG_MOSAIC_L : pcuint32 = pointer($400004C); - REG_MOSAIC_H : pcuint32 = pointer($400004E); - + MOSAIC_CR = REG_MOSAIC; + BLEND_CR = REG_BLDCNT; BLEND_AB = REG_BLDALPHA; BLEND_Y = REG_BLDY; @@ -171,13 +169,11 @@ const REG_WIN0V_SUB : pcuint16 = pointer($4001044); REG_WIN1V_SUB : pcuint16 = pointer($4001046); REG_WININ_SUB : pcuint16 = pointer($4001048); - REG_WINOUT_SUB : pcuint16 = pointer($400104A); + REG_WINOUT_SUB : pcuint16 = pointer($400104A); - REG_MOSAIC_SUB : pcuint32 = pointer($400104C); - REG_MOSAIC_L_SUB : pcuint16 = pointer($400104C); - REG_MOSAIC_H_SUB : pcuint16 = pointer($400104E); + SUB_MOSAIC_CR = REG_MOSAIC_SUB; - REG_BLDMOD_SUB : pcuint16 = pointer($4001050); + REG_BLDMOD_SUB: pcuint16 = pointer($4001050); REG_COLV_SUB : pcuint16 = pointer($4001052); REG_COLY_SUB : pcuint16 = pointer($4001054); diff --git a/packages/libndsfpc/src/nds/system.inc b/packages/libndsfpc/src/nds/system.inc index d2d440d25d..8442e11fa0 100644 --- a/packages/libndsfpc/src/nds/system.inc +++ b/packages/libndsfpc/src/nds/system.inc @@ -76,15 +76,17 @@ const POWER_3D_CORE : PM_Bits = PM_ARM9_DIRECT or (1 shl 3); POWER_2D_B : PM_Bits = PM_ARM9_DIRECT or (1 shl 9); POWER_SWAP_LCDS: PM_Bits = PM_ARM9_DIRECT or (1 shl 15); - POWER_ALL_2D : PM_Bits = PM_ARM9_DIRECT or (1 shl 0) or (1 shl 1) or (1 shl 9); - POWER_ALL : PM_Bits = PM_ARM9_DIRECT or (1 shl 0) or (1 shl 1) or (1 shl 9) or (1 shl 3) or (1 shl 2); +// POWER_ALL_2D : PM_Bits = PM_ARM9_DIRECT or POWER_LCD or POWER_2D_A or POWER_2D_B; + POWER_ALL_2D : PM_Bits = (1 shl 16) or (1 shl 0) or (1 shl 1) or (1 shl 9); +// POWER_ALL : PM_Bits = PM_ARM9_DIRECT or POWER_ALL_2D or POWER_3D_CORE or POWER_MATRIX; + POWER_ALL : PM_Bits = (1 shl 16) or (1 shl 0) or (1 shl 1) or (1 shl 9) or (1 shl 3) or (1 shl 2); procedure sleep(); cdecl; external; {$ifdef ARM9} -procedure powerOn(bits: PM_Bits); cdecl; external; -procedure powerOff(bits: PM_Bits); cdecl; external; -procedure ledBlink(bm: PM_LedBlinkMode); cdecl; external; +procedure powerOn(bits: cint); cdecl; external; +procedure powerOff(bits: cint); cdecl; external; +procedure ledBlink(bm: cint); cdecl; external; procedure systemMsgHandler(bytes: cint; user_data: pointer); cdecl; external; procedure powerValueHandler(value: cuint32; data: pointer); cdecl; external; @@ -143,7 +145,7 @@ function readPowerManagement(reg: cint): cint; inline; procedure powerOn(bits: PM_Bits); inline; procedure powerOff(bits: PM_Bits); inline; - +procedure systemShutDown(); inline; procedure readUserSettings(); cdecl; external; {$endif ARM7} @@ -277,6 +279,11 @@ procedure powerOff(bits: PM_Bits); inline; begin REG_POWERCNT^ := REG_POWERCNT^ and not bits; end; + +procedure systemShutDown(); inline; +begin + powerOn(PM_SYSTEM_PWR); +end; {$endif ARM7} {$endif NDS_IMPLEMENTATION} diff --git a/packages/libndsfpc/src/nds/timers.inc b/packages/libndsfpc/src/nds/timers.inc index 8e5b051638..7e11397e9b 100644 --- a/packages/libndsfpc/src/nds/timers.inc +++ b/packages/libndsfpc/src/nds/timers.inc @@ -86,7 +86,8 @@ const TIMER_DIV_1024 = (3); procedure timerStop(channel: cint); inline; - +procedure cpuStartTiming(timer: cuint32); cdecl; external; +function cpuEndTiming(): cuint32; cdecl; external; {$endif NDS_INTERFACE} |
