Enable drawing of backgroud tiles.
This commit is contained in:
		
							
								
								
									
										2
									
								
								.liccor
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								.liccor
									
									
									
									
									
								
							| @@ -1,4 +1,4 @@ | ||||
| Copyright 2016 gtalent2@gmail.com | ||||
| Copyright 2016-2017 gtalent2@gmail.com | ||||
|  | ||||
| This Source Code Form is subject to the terms of the Mozilla Public | ||||
| License, v. 2.0. If a copy of the MPL was not distributed with this | ||||
|   | ||||
							
								
								
									
										14
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								Makefile
									
									
									
									
									
								
							| @@ -15,12 +15,14 @@ install: | ||||
| clean: | ||||
| 	${ENV_RUN} make -j -C build ARGS="clean" HOST_ENV=${HOST_ENV} | ||||
| purge: | ||||
| 	${ENV_RUN} rm -rf $(shell find build -mindepth 1 -maxdepth 1 -type d) | ||||
| 	${ENV_RUN} rm -rf $$(find build -mindepth 1 -maxdepth 1 -type d) | ||||
| test: | ||||
| 	${ENV_RUN} make -j -C build ARGS="test" HOST_ENV=${HOST_ENV} | ||||
|  | ||||
| run: make | ||||
| 	./build/current/src/wombat/wombat -debug | ||||
| 	./build/current/src/player/nostalgia -debug | ||||
| gba-run: make | ||||
| 	${ENV_RUN} mgba-qt build/current/src/player/nostalgia.bin | ||||
| gdb: make | ||||
| 	gdb ./build/current/src/wombat/wombat | ||||
|  | ||||
| @@ -28,7 +30,13 @@ devenv: | ||||
| 	docker pull ${DEVENV_IMAGE} | ||||
| 	docker run -d -v $(shell pwd):/usr/src/project \ | ||||
| 		-e LOCAL_USER_ID=$(shell id -u ${USER}) \ | ||||
| 		--restart=always --name ${DEVENV} \ | ||||
| 		-e DISPLAY=$(DISPLAY) \ | ||||
| 		-e QT_AUTO_SCREEN_SCALE_FACTOR=1 \ | ||||
| 		-v /tmp/.X11-unix:/tmp/.X11-unix \ | ||||
| 		-v /run/dbus/:/run/dbus/ \ | ||||
| 		-v /dev/shm:/dev/shm \ | ||||
| 		--restart=always \ | ||||
| 		--name ${DEVENV} \ | ||||
| 		-t ${DEVENV_IMAGE} bash | ||||
| devenv-destroy: | ||||
| 	docker rm -f ${DEVENV} | ||||
|   | ||||
| @@ -7,9 +7,8 @@ if len(sys.argv) < 3: | ||||
|  | ||||
| pkg = sys.argv[1] | ||||
| name = sys.argv[2] | ||||
| ifdef = "WOMBAT_%s_%s_HPP" % (pkg.upper(), name.upper()) | ||||
| namespace = "namespace wombat {\nnamespace %s {\n\n}\n}" % pkg | ||||
| hpp = "#ifndef %s\n#define %s\n\n%s\n\n#endif" % (ifdef, ifdef, namespace) | ||||
| hpp = "#pragma once\n" | ||||
| cpp = "#include \"%s.hpp\"\n\n%s" % (name, namespace) | ||||
|  | ||||
| open("src/%s/%s.hpp" % (pkg, name), "w").write(hpp) | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| /* | ||||
|  * Copyright 2016 gtalent2@gmail.com | ||||
|  * Copyright 2016-2017 gtalent2@gmail.com | ||||
|  * | ||||
|  * This Source Code Form is subject to the terms of the Mozilla Public | ||||
|  * License, v. 2.0. If a copy of the MPL was not distributed with this | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| /* | ||||
|  * Copyright 2016 gtalent2@gmail.com | ||||
|  * Copyright 2016-2017 gtalent2@gmail.com | ||||
|  * | ||||
|  * This Source Code Form is subject to the terms of the Mozilla Public | ||||
|  * License, v. 2.0. If a copy of the MPL was not distributed with this | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| /* | ||||
|  * Copyright 2016 gtalent2@gmail.com | ||||
|  * Copyright 2016-2017 gtalent2@gmail.com | ||||
|  * | ||||
|  * This Source Code Form is subject to the terms of the Mozilla Public | ||||
|  * License, v. 2.0. If a copy of the MPL was not distributed with this | ||||
| @@ -9,7 +9,6 @@ | ||||
| #define NOSTALGIA_COMMON_COMMON_HPP | ||||
|  | ||||
| #include "bounds.hpp" | ||||
| #include "flyweight.hpp" | ||||
| #include "point.hpp" | ||||
|  | ||||
| #endif | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| /* | ||||
|  * Copyright 2016 gtalent2@gmail.com | ||||
|  * Copyright 2016-2017 gtalent2@gmail.com | ||||
|  * | ||||
|  * This Source Code Form is subject to the terms of the Mozilla Public | ||||
|  * License, v. 2.0. If a copy of the MPL was not distributed with this | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| /* | ||||
|  * Copyright 2016 gtalent2@gmail.com | ||||
|  * Copyright 2016-2017 gtalent2@gmail.com | ||||
|  * | ||||
|  * This Source Code Form is subject to the terms of the Mozilla Public | ||||
|  * License, v. 2.0. If a copy of the MPL was not distributed with this | ||||
|   | ||||
| @@ -5,6 +5,7 @@ if(WOMBAT_BUILD_TYPE STREQUAL "GBA") | ||||
| 	set( | ||||
| 		CPP | ||||
| 			gba/gfx.cpp | ||||
| 			gba/dirt.s | ||||
| 	) | ||||
| elseif(WOMBAT_BUILD_TYPE STREQUAL "Native") | ||||
| endif() | ||||
| @@ -16,6 +17,8 @@ add_library(NostalgiaCore | ||||
|  | ||||
| install( | ||||
| 	FILES | ||||
| 		core.hpp | ||||
| 		gfx.hpp | ||||
| 	DESTINATION | ||||
| 		include/nostalgia/core | ||||
| ) | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| /* | ||||
|  * Copyright 2016 gtalent2@gmail.com | ||||
|  * Copyright 2016-2017 gtalent2@gmail.com | ||||
|  * | ||||
|  * This Source Code Form is subject to the terms of the Mozilla Public | ||||
|  * License, v. 2.0. If a copy of the MPL was not distributed with this | ||||
| @@ -12,7 +12,7 @@ namespace nostalgia { | ||||
| namespace core { | ||||
|  | ||||
| ox::std::Error init() { | ||||
|    auto err = initGfx(); | ||||
| 	auto err = initGfx(); | ||||
| 	return err; | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| /* | ||||
|  * Copyright 2016 gtalent2@gmail.com | ||||
|  * Copyright 2016-2017 gtalent2@gmail.com | ||||
|  * | ||||
|  * This Source Code Form is subject to the terms of the Mozilla Public | ||||
|  * License, v. 2.0. If a copy of the MPL was not distributed with this | ||||
|   | ||||
							
								
								
									
										35
									
								
								src/core/gba/dirt.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								src/core/gba/dirt.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,35 @@ | ||||
| /* | ||||
|  * Copyright 2016-2017 gtalent2@gmail.com | ||||
|  * | ||||
|  * This Source Code Form is subject to the terms of the Mozilla Public | ||||
|  * License, v. 2.0. If a copy of the MPL was not distributed with this | ||||
|  * file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||||
|  */ | ||||
|  | ||||
| //{{BLOCK(dirt) | ||||
|  | ||||
| //====================================================================== | ||||
| // | ||||
| //	dirt, 80x72@4,  | ||||
| //	+ palette 256 entries, not compressed | ||||
| //	+ 90 tiles not compressed | ||||
| //	Total size: 512 + 2880 = 3392 | ||||
| // | ||||
| //	Time-stamp: 2016-07-06, 22:51:35 | ||||
| //	Exported by Cearn's GBA Image Transmogrifier, v0.8.12 | ||||
| //	( http://www.coranac.com/projects/#grit ) | ||||
| // | ||||
| //====================================================================== | ||||
|  | ||||
| #ifndef GRIT_DIRT_H | ||||
| #define GRIT_DIRT_H | ||||
|  | ||||
| #define dirtTilesLen 2880 | ||||
| extern const unsigned int dirtTiles[720]; | ||||
|  | ||||
| #define dirtPalLen 512 | ||||
| extern const unsigned short dirtPal[256]; | ||||
|  | ||||
| #endif // GRIT_DIRT_H | ||||
|  | ||||
| //}}BLOCK(dirt) | ||||
							
								
								
									
										165
									
								
								src/core/gba/dirt.s
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										165
									
								
								src/core/gba/dirt.s
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,165 @@ | ||||
|  | ||||
| @{{BLOCK(dirt) | ||||
|  | ||||
| @======================================================================= | ||||
| @ | ||||
| @	dirt, 80x72@4,  | ||||
| @	+ palette 256 entries, not compressed | ||||
| @	+ 90 tiles not compressed | ||||
| @	Total size: 512 + 2880 = 3392 | ||||
| @ | ||||
| @	Time-stamp: 2016-07-06, 22:51:35 | ||||
| @	Exported by Cearn's GBA Image Transmogrifier, v0.8.12 | ||||
| @	( http://www.coranac.com/projects/#grit ) | ||||
| @ | ||||
| @======================================================================= | ||||
|  | ||||
| 	.section .rodata | ||||
| 	.align	2 | ||||
| 	.global dirtTiles		@ 2880 unsigned chars | ||||
| 	.hidden dirtTiles | ||||
| dirtTiles: | ||||
| 	.word 0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444 | ||||
| 	.word 0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444 | ||||
| 	.word 0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444 | ||||
| 	.word 0x44444444,0x44444444,0x44444444,0x23324444,0x31134444,0x31134444,0x23324444,0x44444444 | ||||
| 	.word 0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444 | ||||
| 	.word 0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444 | ||||
| 	.word 0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444 | ||||
| 	.word 0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x24444444 | ||||
|  | ||||
| 	.word 0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444233 | ||||
| 	.word 0x00000444,0x00000444,0x00000444,0x00000444,0x00000444,0x00000444,0x00000444,0x00000444 | ||||
| 	.word 0x44444444,0x32444444,0x13444444,0x13444444,0x32444444,0x44444444,0x44444444,0x44444444 | ||||
| 	.word 0x44444444,0x44444423,0x44444431,0x44444431,0x44444423,0x44444444,0x44444444,0x44444444 | ||||
| 	.word 0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444 | ||||
| 	.word 0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444 | ||||
| 	.word 0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444 | ||||
| 	.word 0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444 | ||||
|  | ||||
| 	.word 0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444 | ||||
| 	.word 0x34444444,0x34444444,0x24444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444 | ||||
| 	.word 0x44444311,0x44444311,0x44444233,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444 | ||||
| 	.word 0x00000444,0x00000444,0x00000444,0x00000444,0x00000444,0x00000444,0x00000444,0x00000444 | ||||
| 	.word 0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444 | ||||
| 	.word 0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444 | ||||
| 	.word 0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444 | ||||
| 	.word 0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444 | ||||
|  | ||||
| 	.word 0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444 | ||||
| 	.word 0x32444444,0x13444444,0x13444444,0x32444444,0x44444444,0x44444444,0x44444444,0x44444444 | ||||
| 	.word 0x44444423,0x44444431,0x44444431,0x44444423,0x44444444,0x44444444,0x44444444,0x44444444 | ||||
| 	.word 0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444 | ||||
| 	.word 0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444 | ||||
| 	.word 0x00000444,0x00000444,0x00000444,0x00000444,0x00000444,0x00000444,0x00000444,0x00000444 | ||||
| 	.word 0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444 | ||||
| 	.word 0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444 | ||||
|  | ||||
| 	.word 0x44444444,0x44444444,0x33244444,0x11344444,0x11344444,0x33244444,0x44444444,0x44444444 | ||||
| 	.word 0x44444444,0x44444444,0x44444442,0x44444443,0x44444443,0x44444442,0x44444444,0x44444444 | ||||
| 	.word 0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444 | ||||
| 	.word 0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44233244,0x44311344 | ||||
| 	.word 0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444 | ||||
| 	.word 0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x42332444,0x43113444,0x43113444 | ||||
| 	.word 0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444 | ||||
| 	.word 0x00000444,0x00000444,0x00000444,0x00000444,0x00000444,0x00000444,0x00000444,0x00000444 | ||||
|  | ||||
| 	.word 0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444 | ||||
| 	.word 0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444 | ||||
| 	.word 0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444 | ||||
| 	.word 0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444 | ||||
| 	.word 0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444 | ||||
| 	.word 0x44311344,0x44233244,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444 | ||||
| 	.word 0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444 | ||||
| 	.word 0x42332444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444 | ||||
|  | ||||
| 	.word 0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444 | ||||
| 	.word 0x00000444,0x00000444,0x00000444,0x00000444,0x00000444,0x00000444,0x00000444,0x00000444 | ||||
| 	.word 0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444 | ||||
| 	.word 0x44444444,0x44442332,0x44443113,0x44443113,0x44442332,0x44444444,0x44444444,0x44444444 | ||||
| 	.word 0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444 | ||||
| 	.word 0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444 | ||||
| 	.word 0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444 | ||||
| 	.word 0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444 | ||||
|  | ||||
| 	.word 0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444 | ||||
| 	.word 0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444 | ||||
| 	.word 0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444 | ||||
| 	.word 0x00000444,0x00000444,0x00000444,0x00000444,0x00000444,0x00000444,0x00000444,0x00000444 | ||||
| 	.word 0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444 | ||||
| 	.word 0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444 | ||||
| 	.word 0x44444444,0x33244444,0x11344444,0x11344444,0x33244444,0x44444444,0x44444444,0x44444444 | ||||
| 	.word 0x44444444,0x44444442,0x44444443,0x44444443,0x44444442,0x44444444,0x44444444,0x44444444 | ||||
|  | ||||
| 	.word 0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444 | ||||
| 	.word 0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444 | ||||
| 	.word 0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444 | ||||
| 	.word 0x42332444,0x43113444,0x43113444,0x42332444,0x44444444,0x44444444,0x44444444,0x44444444 | ||||
| 	.word 0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444 | ||||
| 	.word 0x00000444,0x00000444,0x00000444,0x00000444,0x00000444,0x00000444,0x00000444,0x00000444 | ||||
| 	.word 0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444 | ||||
| 	.word 0x44444444,0x44444444,0x44444444,0x44444444,0x23324444,0x31134444,0x31134444,0x23324444 | ||||
|  | ||||
| 	.word 0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444 | ||||
| 	.word 0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444 | ||||
| 	.word 0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444 | ||||
| 	.word 0x42332444,0x43113444,0x43113444,0x42332444,0x44444444,0x44444444,0x44444444,0x44444444 | ||||
| 	.word 0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444 | ||||
| 	.word 0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444 | ||||
| 	.word 0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444 | ||||
| 	.word 0x00000444,0x00000444,0x00000444,0x00000444,0x00000444,0x00000444,0x00000444,0x00000444 | ||||
|  | ||||
| 	.word 0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x00000000,0x00000000 | ||||
| 	.word 0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x00000000,0x00000000 | ||||
| 	.word 0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x00000000,0x00000000 | ||||
| 	.word 0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x00000000,0x00000000 | ||||
| 	.word 0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x00000000,0x00000000 | ||||
| 	.word 0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x00000000,0x00000000 | ||||
| 	.word 0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x00000000,0x00000000 | ||||
| 	.word 0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x00000000,0x00000000 | ||||
|  | ||||
| 	.word 0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x44444444,0x00000000,0x00000000 | ||||
| 	.word 0x00000444,0x00000444,0x00000444,0x00000444,0x00000444,0x00000444,0x00000000,0x00000000 | ||||
|  | ||||
| 	.section .rodata | ||||
| 	.align	2 | ||||
| 	.global dirtPal		@ 512 unsigned chars | ||||
| 	.hidden dirtPal | ||||
| dirtPal: | ||||
| 	.hword 0x0000,0x5EF7,0x7BDE,0x739C,0x7FFF,0x0000,0x0000,0x0000 | ||||
| 	.hword 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000 | ||||
| 	.hword 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000 | ||||
| 	.hword 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000 | ||||
| 	.hword 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000 | ||||
| 	.hword 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000 | ||||
| 	.hword 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000 | ||||
| 	.hword 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000 | ||||
|  | ||||
| 	.hword 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000 | ||||
| 	.hword 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000 | ||||
| 	.hword 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000 | ||||
| 	.hword 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000 | ||||
| 	.hword 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000 | ||||
| 	.hword 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000 | ||||
| 	.hword 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000 | ||||
| 	.hword 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000 | ||||
|  | ||||
| 	.hword 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000 | ||||
| 	.hword 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000 | ||||
| 	.hword 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000 | ||||
| 	.hword 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000 | ||||
| 	.hword 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000 | ||||
| 	.hword 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000 | ||||
| 	.hword 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000 | ||||
| 	.hword 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000 | ||||
|  | ||||
| 	.hword 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000 | ||||
| 	.hword 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000 | ||||
| 	.hword 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000 | ||||
| 	.hword 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000 | ||||
| 	.hword 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000 | ||||
| 	.hword 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000 | ||||
| 	.hword 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000 | ||||
| 	.hword 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000 | ||||
|  | ||||
| @}}BLOCK(dirt) | ||||
| @@ -1,5 +1,5 @@ | ||||
| /* | ||||
|  * Copyright 2016 gtalent2@gmail.com | ||||
|  * Copyright 2016-2017 gtalent2@gmail.com | ||||
|  * | ||||
|  * This Source Code Form is subject to the terms of the Mozilla Public | ||||
|  * License, v. 2.0. If a copy of the MPL was not distributed with this | ||||
| @@ -8,17 +8,46 @@ | ||||
|  | ||||
| #include <ox/std/types.hpp> | ||||
| #include "registers.hpp" | ||||
| #include "dirt.h" | ||||
|  | ||||
| namespace nostalgia { | ||||
| namespace core { | ||||
|  | ||||
| using namespace ox::std; | ||||
|  | ||||
| typedef struct { uint32_t data[8]; } Tile, Tile4; | ||||
| // d-tile: double-sized tile (8bpp) | ||||
| typedef struct { uint32_t data[16]; } Tile8; | ||||
| // tile block: 32x16 tiles, 16x16 d-tiles | ||||
| typedef struct { unsigned short data[256]; } Pallete; | ||||
| typedef Tile  CharBlock[512]; | ||||
| typedef Tile8 CharBlock8[256]; | ||||
|  | ||||
| #define TILE_ADDR  ((CharBlock*) 0x06000000) | ||||
| #define TILE8_ADDR ((CharBlock8*) 0x06000000) | ||||
|  | ||||
| #define PALLETE_BG     ((unsigned short*) 0x05000000) | ||||
| #define PALLETE_SPRITE ((unsigned short*) 0x05000200) | ||||
|  | ||||
| typedef uint16_t BgMapTile[1024]; | ||||
| #define BG_MAP ((BgMapTile*) 0x06000000) | ||||
|  | ||||
| ox::std::Error initGfx() { | ||||
| 	/* Sprite Mode ----\ */ | ||||
| 	/*             ---\| */ | ||||
| 	/* Background 2 -\|| */ | ||||
| 	/* Background 0 -\|| */ | ||||
| 	/* Objects -----\||| */ | ||||
| 	/*              |||| */ | ||||
| 	REG_DISPCNT = 0x1400; | ||||
| 	REG_DISPCNT = 0x1100; | ||||
|  | ||||
| 	TILE_ADDR[0][1] = *(Tile*) dirtTiles; | ||||
|  | ||||
| 	for (auto i = 0; i < (dirtPalLen / 2); i++) { | ||||
| 		PALLETE_BG[i] = dirtPal[i]; | ||||
| 	} | ||||
|  | ||||
| 	BG_MAP[28][52] = 1; | ||||
| 	REG_BG0CNT = (28 << 8) | 1; | ||||
|  | ||||
| 	return 0; | ||||
| } | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| /* | ||||
|  * Copyright 2016 gtalent2@gmail.com | ||||
|  * Copyright 2016-2017 gtalent2@gmail.com | ||||
|  * | ||||
|  * This Source Code Form is subject to the terms of the Mozilla Public | ||||
|  * License, v. 2.0. If a copy of the MPL was not distributed with this | ||||
| @@ -10,4 +10,25 @@ | ||||
|  | ||||
| #define REG_DISPCNT *((volatile unsigned int*) 0x04000000) | ||||
|  | ||||
| ///////////////////////////////////////////////////////////////// | ||||
| // background registers | ||||
|  | ||||
| // control registers | ||||
| #define REG_BG0CNT *((volatile unsigned int*) 0x04000008) | ||||
| #define REG_BG1CNT *((volatile unsigned int*) 0x0400000a) | ||||
| #define REG_BG2CNT *((volatile unsigned int*) 0x0400000c) | ||||
| #define REG_BG3CNT *((volatile unsigned int*) 0x0400000e) | ||||
|  | ||||
| // horizontal scrolling registers | ||||
| #define REG_BG0HOFS *((volatile unsigned int*) 0x04000010) | ||||
| #define REG_BG1HOFS *((volatile unsigned int*) 0x04000014) | ||||
| #define REG_BG2HOFS *((volatile unsigned int*) 0x04000018) | ||||
| #define REG_BG3HOFS *((volatile unsigned int*) 0x0400001a) | ||||
|  | ||||
| // vertical scrolling registers | ||||
| #define REG_BG0VOFS *((volatile unsigned int*) 0x04000012) | ||||
| #define REG_BG1VOFS *((volatile unsigned int*) 0x04000016) | ||||
| #define REG_BG2VOFS *((volatile unsigned int*) 0x0400001a) | ||||
| #define REG_BG3VOFS *((volatile unsigned int*) 0x0400001c) | ||||
|  | ||||
| #endif | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| /* | ||||
|  * Copyright 2016 gtalent2@gmail.com | ||||
|  * Copyright 2016-2017 gtalent2@gmail.com | ||||
|  * | ||||
|  * This Source Code Form is subject to the terms of the Mozilla Public | ||||
|  * License, v. 2.0. If a copy of the MPL was not distributed with this | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| /* | ||||
|  * Copyright 2016 gtalent2@gmail.com | ||||
|  * Copyright 2016-2017 gtalent2@gmail.com | ||||
|  * | ||||
|  * This Source Code Form is subject to the terms of the Mozilla Public | ||||
|  * License, v. 2.0. If a copy of the MPL was not distributed with this | ||||
| @@ -12,10 +12,5 @@ using namespace nostalgia; | ||||
|  | ||||
| int main() { | ||||
| 	core::init(); | ||||
|  | ||||
| 	((unsigned short*)0x06000000)[120+80*240] = 0x001F; | ||||
| 	((unsigned short*)0x06000000)[136+80*240] = 0x03E0; | ||||
| 	((unsigned short*)0x06000000)[120+96*240] = 0x7C00; | ||||
|  | ||||
| 	return 0; | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user