-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Code is imported from untech-engine Had to modify: * reset_handler.inc * Reset routines do not enable NMI or autoJoy * Removed inidispAfterWaitFrame store * dma_forceblank.inc * Removed AssertForceBlank() * Removed Dma.ForceBlank.FillTilemap * Removed Dma.ForceBlank.DirtyWram
- Loading branch information
0 parents
commit 37322da
Showing
18 changed files
with
3,429 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
*.swp | ||
*~ | ||
|
||
bin/ | ||
gen/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "tools/bass-untech"] | ||
path = tools/bass-untech | ||
url = https://github.com/undisbeliever/bass-untech |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
|
||
rwildcard_all = $(foreach d,$(wildcard $(addsuffix /*,$(1))),$d $(call rwildcard_all, $d)) | ||
|
||
ASM_SRC := $(wildcard src/*.asm) | ||
BINARIES := $(patsubst src/%.asm,bin/%.sfc,$(ASM_SRC)) | ||
|
||
INC_FILES := $(wildcard src/*/*.inc src/*/*/*.inc) | ||
|
||
|
||
# If VANILLA_BASS is not 'n' then the Makefile will use vanilla bass instead of bass-untech | ||
VANILLA_BASS ?= n | ||
# If LOCAL_TOOLS is not 'n' then the Makefile will use the tools installed in the user's $PATH | ||
LOCAL_TOOLS ?= n | ||
|
||
|
||
ifneq ($(VANILLA_BASS), n) | ||
bass ?= bass | ||
else ifneq ($(LOCAL_TOOLS), n) | ||
bass := bass-untech | ||
endif | ||
|
||
ifndef bass | ||
BASS_DIR := tools/bass-untech | ||
bass := $(BASS_DIR)/bass/out/bass-untech | ||
endif | ||
|
||
|
||
.DELETE_ON_ERROR: | ||
.SUFFIXES: | ||
|
||
|
||
.PHONY: all | ||
all: directories $(BINARIES) | ||
|
||
|
||
|
||
ifeq ($(VANILLA_BASS), n) | ||
bin/%.sfc bin/%.symbols: src/*.asm bin/ | ||
$(bass) -strict -o $@ -sym $(@:.sfc=.symbols) $< | ||
else | ||
bin/%.sfc: src/*.asm bin/ | ||
$(bass) -strict -o $@ $< | ||
endif | ||
|
||
$(BINARIES): $(INC_FILES) | ||
|
||
|
||
|
||
ifdef BASS_DIR | ||
tools: bass | ||
|
||
$(BINARIES): bass | ||
|
||
.INTERMEDIATE: bass | ||
bass: $(call rwildcard_all $(BASS_DIR)) | ||
$(MAKE) -C "$(BASS_DIR)/bass" | ||
|
||
$(bass): bass | ||
endif | ||
|
||
|
||
.PHONY: directories | ||
DIRS := $(sort $(dir $(BINARIES) $(RESOURCES) $(TABLE_INCS))) | ||
DIRS := $(patsubst %/,%,$(DIRS)) | ||
directories: $(DIRS) | ||
$(DIRS): | ||
ifeq ($(OS),Windows_NT) | ||
mkdir $(subst /,\,$@) | ||
else | ||
mkdir -p $@ | ||
endif | ||
|
||
|
||
|
||
.PHONY: clean-all | ||
clean-all: clean | ||
|
||
.PHONY: clean | ||
clean: | ||
$(RM) $(BINARIES) $(BINARIES:.sfc=.symbols) | ||
$(RM) $(sort $(TABLE_INCS)) | ||
$(RM) $(sort $(RESOURCES)) | ||
|
||
ifdef BASS_DIR | ||
clean-all: clean-tools | ||
|
||
.PHONY: clean-tools | ||
clean-tools: | ||
$(MAKE) -C "$(BASS_DIR)/bass" clean | ||
endif | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2019, Marcus Rowe <[email protected]> | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// common/assert.inc | ||
// ================= | ||
// | ||
// Macros that break assembly if a test fails. | ||
// | ||
// | ||
// This file is part of the UnTech Game Engine. | ||
// Copyright (c) 2016 - 2019, Marcus Rowe <[email protected]>. | ||
// Distributed under The MIT License: https://opensource.org/licenses/MIT | ||
|
||
|
||
// Asserts than an expression is true | ||
// Breaks assembly if expression if false | ||
macro assert(test) { | ||
if !({test}) { | ||
error "{test}" | ||
} | ||
} | ||
|
||
// Asserts than an expression is a power of two | ||
// Breaks assembly if expression if false | ||
macro assertPowerOfTwo(evaluate test) { | ||
if ({test} & ({test} - 1)) != 0 { | ||
error "{test} is not a power of 2" | ||
} | ||
} | ||
|
||
// Asserts that a variable is inside zero page | ||
// Breaks assembly if variable is not zero page | ||
macro assertZeroPage(var) { | ||
evaluate addr = {var} | ||
if {addr} >= 0x100 && ({addr} < 0x7e0000 || {addr} >= 0x7e0100) { | ||
error "{var} is not inside zero page" | ||
} | ||
} | ||
|
||
// vim: ft=bass-65816 ts=4 sw=4 et: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
|
||
include "assert.inc" | ||
include "cpu.inc" | ||
include "enum.inc" | ||
include "memory.inc" | ||
include "print.inc" | ||
include "registers.inc" | ||
include "snes_header.inc" | ||
include "struct.inc" | ||
include "functiontable.inc" | ||
include "tmp_words.inc" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
// common/cpu.inc | ||
// ============== | ||
// | ||
// Provides a mechanism for managing the processor register sizes. | ||
// | ||
// | ||
// This file is part of the UnTech Game Engine. | ||
// Copyright (c) 2016 - 2019, Marcus Rowe <[email protected]>. | ||
// Distributed under The MIT License: https://opensource.org/licenses/MIT | ||
|
||
|
||
variable __CPU__.aSize = 0 | ||
variable __CPU__.iSize = 0 | ||
|
||
macro sep(evaluate v) { | ||
if ({v} & 0x20) { | ||
__CPU__.aSize = 8 | ||
} | ||
if ({v} & 0x10) { | ||
__CPU__.iSize = 8 | ||
} | ||
|
||
sep #{v} | ||
} | ||
|
||
macro rep(evaluate v) { | ||
if ({v} & 0x20) { | ||
__CPU__.aSize = 16 | ||
} | ||
if ({v} & 0x10) { | ||
__CPU__.iSize = 16 | ||
} | ||
|
||
rep #{v} | ||
} | ||
|
||
macro a8() { | ||
__CPU__.aSize = 8 | ||
} | ||
|
||
macro a16() { | ||
__CPU__.aSize = 16 | ||
} | ||
|
||
macro au() { | ||
__CPU__.aSize = 0 | ||
} | ||
|
||
macro i8() { | ||
__CPU__.iSize = 8 | ||
} | ||
|
||
macro i16() { | ||
__CPU__.iSize = 16 | ||
} | ||
|
||
macro iu() { | ||
__CPU__.iSize = 0 | ||
} | ||
|
||
macro punknown() { | ||
__CPU__.aSize = 0 | ||
__CPU__.iSize = 0 | ||
} | ||
|
||
macro assert8a() { | ||
if __CPU__.aSize != 8 { | ||
error "require an 8 bit A" | ||
} | ||
} | ||
|
||
macro assert16a() { | ||
if __CPU__.aSize != 16 { | ||
error "require a 16 bit A" | ||
} | ||
} | ||
|
||
macro assert8i() { | ||
if __CPU__.iSize != 8 { | ||
error "require an 8 bit Index register" | ||
} | ||
} | ||
|
||
macro assert16i() { | ||
if __CPU__.iSize != 16 { | ||
error "require a 16 bit Index register" | ||
} | ||
} | ||
|
||
// vim: ft=bass-65816 ts=4 sw=4 et: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
// common/enum.inc | ||
// =============== | ||
// | ||
// Turns the current scope into an enumeration. | ||
// | ||
// Enum constants are declared with the enum macro. | ||
// | ||
// NOTE: An enum cannot be nested in a scope | ||
// | ||
// usage: | ||
// namespace functionTable { | ||
// createEnum(0, 2) | ||
// enum(initPtr) // 0 | ||
// enum(deletePtr) // 2 | ||
// enum(processPtr) // 4 | ||
// endEnum() // (optional but highly recommended) | ||
// } | ||
// | ||
// The `createEnum()`/`endEnum()` pair will create the following constants: | ||
// | ||
// * `__ENUM__.first`: the first value in the enum | ||
// * `__ENUM__.last`: the last value in the enum | ||
// * `__ENUM__.increment`: the difference between two successive enum values | ||
// * `__ENUM__.count`: the number of items in the enum | ||
// | ||
// | ||
// This file is part of the UnTech Game Engine. | ||
// Copyright (c) 2016 - 2019, Marcus Rowe <[email protected]>. | ||
// Distributed under The MIT License: https://opensource.org/licenses/MIT | ||
|
||
|
||
inline createEnum(start, increment) { | ||
if {increment} < 1 { | ||
error "increment is invalid" | ||
} | ||
|
||
constant __ENUM__.first = {start} | ||
constant __ENUM__.increment = {increment} | ||
evaluate __ENUM__.current = {start} | ||
} | ||
inline createEnum(start) { | ||
createEnum({start}, 1) | ||
} | ||
inline createEnum() { | ||
createEnum(0, 1) | ||
} | ||
|
||
// NOTE: This tag is optional but highly recommended | ||
inline endEnum() { | ||
if !{defined __ENUM__.current} { | ||
error "Current scope is not an enum" | ||
} | ||
if {defined __ENUM__.closed} { | ||
error "Enum already closed" | ||
} | ||
if {__ENUM__.current} == __ENUM__.first { | ||
error "Expected at least one enum()" | ||
} | ||
evaluate __ENUM__.closed = 1 | ||
constant __ENUM__.last = {__ENUM__.current} - __ENUM__.increment | ||
constant __ENUM__.count = ({__ENUM__.current} - __ENUM__.first) / __ENUM__.increment | ||
} | ||
|
||
inline enum(id) { | ||
if {defined __ENUM__.closed} { | ||
error "Enum is closed, cannot add more values" | ||
} | ||
if !{defined __ENUM__.current} { | ||
error "Current scope is not an enum" | ||
} | ||
|
||
constant {id} = {__ENUM__.current} | ||
evaluate __ENUM__.current = {__ENUM__.current} + __ENUM__.increment | ||
} | ||
|
||
// vim: ft=bass-65816 ts=4 sw=4 et: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// common/functiontable.inc | ||
// ======================== | ||
// | ||
// Macros to build a function table from a given struct. | ||
// | ||
// | ||
// This file is part of the UnTech Game Engine. | ||
// Copyright (c) 2016 - 2019, Marcus Rowe <[email protected]>. | ||
// Distributed under The MIT License: https://opensource.org/licenses/MIT | ||
|
||
|
||
// Automatically builds the function table from a given struct | ||
// | ||
// NOTE: will change the current romblock to code. | ||
// | ||
// PARAM: struct - the struct that contains the function table | ||
// PARAM: module - the struct that the table is called in (solves visibility problem) | ||
// PARAM: tableName - the name of the function table (defualt FunctionTable) | ||
inline buildFunctionTable(struct, module, tableName) { | ||
code() | ||
{tableName}: { | ||
_buildFunctionTable_structs({struct}, {module}) | ||
} | ||
} | ||
inline buildFunctionTable(struct, module) { | ||
buildFunctionTable({struct}, {module}, FunctionTable) | ||
} | ||
|
||
macro _buildFunctionTable_structs(struct, module) { | ||
validateStructIsBase({struct}) | ||
|
||
evaluate n = 0 | ||
while {n} < {{struct}.__STRUCT__.fields.size} { | ||
assert({{struct}.__STRUCT__.fields.{n}.size} == 2) | ||
dw {module}.{{struct}.__STRUCT__.fields.{n}.name} | ||
|
||
evaluate n = {n} + 1 | ||
} | ||
} | ||
|
||
// vim: ft=bass-65816 ts=4 sw=4 et: | ||
|
Oops, something went wrong.