Skip to content

Commit

Permalink
Init two attempts at per-pixel drawing
Browse files Browse the repository at this point in the history
  • Loading branch information
goudreinette committed Feb 15, 2024
0 parents commit adf0d11
Show file tree
Hide file tree
Showing 25 changed files with 766 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.DS_Store

*.nds
*.elf
*.img
*.map
*.pal

build/

1-dream/
2-spiders/
3-path/
sint/
63 changes: 63 additions & 0 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
"env": {

},

"configurations": [
{
"name": "Mac",
"includePath": [
"${workspaceFolder}/**",
"/opt/devkitpro/libnds/include/**",
"/opt/devkitpro/nflib/include/**",
"/opt/devkitpro/devkitARM/include/**",
"/opt/devkitpro/devkitARM/arm-none-eabi/include/**"
],
"defines": [
"ARM9"
],
"cStandard": "c11",
"cppStandard": "c++11",
"compilerPath": "/opt/devkitpro/devkitARM/bin/arm-none-eabi-gcc",
"configurationProvider": "ms-vscode.makefile-tools"
},
{
"name": "Win32",
"includePath": [
"${workspaceFolder}\\**",
"C:\\devkitPro\\libnds\\include\\**",
"C:\\devkitPro\\libctru\\include\\**",
"C:\\devkitPro\\devkitARM\\include\\**",
"C:\\devkitPro\\devkitARM\\arm-none-eabi\\include\\**"
],
"defines": [
"ARM9"
],
"cStandard": "c11",
"cppStandard": "c++11",
"compilerPath": "/opt/devkitpro/devkitARM/bin/arm-none-eabi-gcc",
"configurationProvider": "ms-vscode.makefile-tools"
},

{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**",
"/opt/devkitpro/libnds/include/**",
"/opt/devkitpro/nflib/include/**",
"/opt/devkitpro/devkitARM/include/**",
"/opt/devkitpro/devkitARM/arm-none-eabi/include/**"
],
"defines": [
"ARM9"
],
"cStandard": "c11",
"cppStandard": "c++11",
"compilerPath": "/opt/devkitpro/devkitARM/bin/arm-none-eabi-gcc",
"configurationProvider": "ms-vscode.makefile-tools"
}
],


"version": 4
}
13 changes: 13 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"files.associations": {
"vector": "cpp",
"filesystem": "cpp",
"cmath": "cpp"
},
"terminal.integrated.defaultProfile.windows": "MSYS2",
"terminal.integrated.profiles.windows": {
"MSYS2": {
"path": "C:\\msys64\\usr\\bin\\bash.exe",
}
}
}
30 changes: 30 additions & 0 deletions nds_framebuffer_bitmaps/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#binaries and stuff
*.elf
*.nds
*.out
build/

#OS X
.DS_Store
.AppleDouble
.LSOverride

# Icon must ends with two \r.
Icon


# Thumbnails
._*

# Files that might appear on external disk
.Spotlight-V100

.Trashes

#vim
[._]*.s[a-w][a-z]
[._]s[a-w][a-z]
*.un~
Session.vim
.netrwhist
*~
22 changes: 22 additions & 0 deletions nds_framebuffer_bitmaps/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
The MIT License (MIT)

Copyright (c) 2013 Philip Mallory

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

167 changes: 167 additions & 0 deletions nds_framebuffer_bitmaps/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------

ifeq ($(strip $(DEVKITARM)),)
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
endif

include $(DEVKITARM)/ds_rules

#---------------------------------------------------------------------------------
# TARGET is the name of the output
# BUILD is the directory where object files & intermediate files will be placed
# SOURCES is a list of directories containing source code
# INCLUDES is a list of directories containing extra header files
# DATA is a list of directories containing binary data
# GRAPHICS is a list of directories containing files to be processed by grit
#
# All directories are specified relative to the project directory where
# the makefile is found
#
#---------------------------------------------------------------------------------
TARGET := $(notdir $(CURDIR))
BUILD := build
SOURCES := source
DATA := data
INCLUDES := include
GRAPHICS :=

#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------
ARCH := -mthumb -mthumb-interwork

CFLAGS := -g -Wall -O2\
-march=armv5te -mtune=arm946e-s -fomit-frame-pointer\
-ffast-math \
$(ARCH)

CFLAGS += $(INCLUDE) -DARM9 -DDEBUG
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions

ASFLAGS := -g $(ARCH)
LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)

#---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project
#---------------------------------------------------------------------------------
LIBS := -lnds9


#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS := $(LIBNDS)

#---------------------------------------------------------------------------------
# no real need to edit anything past this point unless you need to add additional
# rules for different file extensions
#---------------------------------------------------------------------------------


ifneq ($(BUILDDIR), $(CURDIR))
#---------------------------------------------------------------------------------

export OUTPUT := $(CURDIR)/$(TARGET)

export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
$(foreach dir,$(DATA),$(CURDIR)/$(dir)) \
$(foreach dir,$(GRAPHICS),$(CURDIR)/$(dir))

export DEPSDIR := $(CURDIR)/$(BUILD)

CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
BMPFILES := $(foreach dir,$(GRAPHICS),$(notdir $(wildcard $(dir)/*.bmp)))

#---------------------------------------------------------------------------------
# use CXX for linking C++ projects, CC for standard C
#---------------------------------------------------------------------------------
ifeq ($(strip $(CPPFILES)),)
#---------------------------------------------------------------------------------
export LD := $(CC)
#---------------------------------------------------------------------------------
else
#---------------------------------------------------------------------------------
export LD := $(CXX)
#---------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------

export OFILES := $(addsuffix .o,$(BINFILES)) \
$(BMPFILES:.bmp=.o) \
$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)

export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
-I$(CURDIR)/$(BUILD)

export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)

.PHONY: $(BUILD) clean

#---------------------------------------------------------------------------------
$(BUILD):
@[ -d $@ ] || mkdir -p $@
@make BUILDDIR=`cd $(BUILD) && pwd` --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile

#---------------------------------------------------------------------------------
clean:
@echo clean ...
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(TARGET).ds.gba


#---------------------------------------------------------------------------------
else

DEPENDS := $(OFILES:.o=.d)

#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
$(OUTPUT).nds : $(OUTPUT).elf
$(OUTPUT).elf : $(OFILES)


#---------------------------------------------------------------------------------
# The bin2o rule should be copied and modified
# for each extension used in the data directories
#---------------------------------------------------------------------------------

#---------------------------------------------------------------------------------
# This rule links in binary data with the .bin extension
#---------------------------------------------------------------------------------
%.bin.o : %.bin
#---------------------------------------------------------------------------------
@echo $(notdir $<)
@$(bin2o)

#---------------------------------------------------------------------------------
# This rule links in binary data with the .raw extension
#---------------------------------------------------------------------------------
%.raw.o : %.raw
#---------------------------------------------------------------------------------
@echo $(notdir $<)
@$(bin2o)

#---------------------------------------------------------------------------------
# This rule creates assembly source files using grit
# grit takes an image file and a .grit describing how the file is to be processed
# add additional rules like this for each image extension
# you use in the graphics folders
#---------------------------------------------------------------------------------
%.s %.h : %.bmp %.grit
#---------------------------------------------------------------------------------
grit $< -fts -o$*


-include $(DEPENDS)

#---------------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------------
6 changes: 6 additions & 0 deletions nds_framebuffer_bitmaps/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Nintendo DS Framebuffer Mode Demo
=================================

A demonstration of how to draw bitmap graphics on the Nintendo DS.

Read all about it at www.pmallory.com/bitmap-graphics-on-the-nintendo-ds-part-1-framebuffer-mode.html
Loading

0 comments on commit adf0d11

Please sign in to comment.