├── .gitattributes ├── .gitignore ├── .gitmodules ├── LICENSE ├── Makefile ├── README.md ├── docs ├── README.md ├── favicon.ico ├── files │ ├── CPU-i.html │ ├── CPU_DataStructures-i.html │ ├── CPU_Def-i.html │ ├── CPU_Math-i.html │ ├── CPU_Memory-i.html │ ├── CPU_PPU-i.html │ ├── CPU_Runtime-i.html │ ├── CPU_SMP-i.html │ ├── Configurations │ │ ├── Map-cfg.html │ │ └── libSFX-cfg.html │ ├── Docs │ │ └── Make-txt.html │ ├── Packages │ │ ├── LZ4 │ │ │ └── LZ4-i.html │ │ └── Mouse │ │ │ └── Mouse-i.html │ ├── SMP_ADSR-i.html │ ├── SMP_Def-i.html │ ├── SMP_Util-i.html │ └── libSFX-i.html ├── index.html └── styles │ └── main.css ├── examples ├── Hello-Mode7 │ ├── Data │ │ ├── Music.spc │ │ └── SNES-Mode7.png │ ├── Hello-Mode7.s │ └── Makefile ├── Hello │ ├── Data │ │ ├── Music.spc │ │ └── SNES.png │ ├── Hello.s │ └── Makefile ├── MSU-1 │ ├── .gitignore │ ├── MSU1.s │ ├── Makefile │ └── SMP │ │ └── SMP.s700 ├── Mode7-Transform │ ├── Data │ │ ├── Background.png │ │ └── Music.spc │ ├── Makefile │ ├── Math.i │ ├── Mode7-Transform.s │ ├── Sin.py │ └── libSFX.cfg ├── Mouse │ ├── Data │ │ ├── Music.spc │ │ ├── SNES.png │ │ └── Sprites.png │ ├── Makefile │ ├── Mouse.s │ ├── OAM.i │ └── libSFX.cfg ├── SMP-Test │ ├── Makefile │ ├── Map.cfg │ ├── Normal.s700 │ ├── SMP-Nop │ │ └── Test.s700 │ ├── SMP-Play │ │ ├── Data │ │ │ ├── Sample1.wav │ │ │ └── Sample2.wav │ │ ├── Directory.s700 │ │ ├── Play.s700 │ │ └── SMP-Map.cfg │ ├── SMP-Test.s │ └── libSFX.cfg ├── SixteenMegaPower │ ├── Makefile │ ├── Map.cfg │ ├── SixteenMegaPower.s │ ├── Subfolders │ │ └── With │ │ │ └── Code.s │ └── libSFX.cfg ├── Template-Mode21 │ ├── Makefile │ ├── Map.cfg │ ├── Template-Mode21.s │ └── libSFX.cfg ├── Template │ ├── Makefile │ └── Template.s └── X-GSU │ ├── Makefile │ ├── Map.cfg │ ├── SuperFX.s │ ├── SuperFX.sgs │ └── libSFX.cfg ├── extras ├── Ideas.md ├── NaturalDocs │ ├── bin │ │ ├── Config │ │ │ ├── Languages.txt │ │ │ └── Topics.txt │ │ ├── License.txt │ │ ├── Modules │ │ │ └── NaturalDocs │ │ │ │ ├── BinaryFile.pm │ │ │ │ ├── Builder.pm │ │ │ │ ├── Builder │ │ │ │ ├── Base.pm │ │ │ │ ├── FramedHTML.pm │ │ │ │ ├── HTML.pm │ │ │ │ └── HTMLBase.pm │ │ │ │ ├── ClassHierarchy.pm │ │ │ │ ├── ClassHierarchy │ │ │ │ ├── Class.pm │ │ │ │ └── File.pm │ │ │ │ ├── ConfigFile.pm │ │ │ │ ├── Constants.pm │ │ │ │ ├── DefineMembers.pm │ │ │ │ ├── Error.pm │ │ │ │ ├── File.pm │ │ │ │ ├── ImageReferenceTable.pm │ │ │ │ ├── ImageReferenceTable │ │ │ │ ├── Reference.pm │ │ │ │ └── String.pm │ │ │ │ ├── Languages.pm │ │ │ │ ├── Languages │ │ │ │ ├── ActionScript.pm │ │ │ │ ├── Ada.pm │ │ │ │ ├── Advanced.pm │ │ │ │ ├── Advanced │ │ │ │ │ ├── Scope.pm │ │ │ │ │ └── ScopeChange.pm │ │ │ │ ├── Base.pm │ │ │ │ ├── CSharp.pm │ │ │ │ ├── PLSQL.pm │ │ │ │ ├── Pascal.pm │ │ │ │ ├── Perl.pm │ │ │ │ ├── Prototype.pm │ │ │ │ ├── Prototype │ │ │ │ │ └── Parameter.pm │ │ │ │ ├── Simple.pm │ │ │ │ └── Tcl.pm │ │ │ │ ├── LineReader.pm │ │ │ │ ├── Menu.pm │ │ │ │ ├── Menu │ │ │ │ └── Entry.pm │ │ │ │ ├── NDMarkup.pm │ │ │ │ ├── Parser.pm │ │ │ │ ├── Parser │ │ │ │ ├── JavaDoc.pm │ │ │ │ ├── Native.pm │ │ │ │ └── ParsedTopic.pm │ │ │ │ ├── Project.pm │ │ │ │ ├── Project │ │ │ │ ├── ImageFile.pm │ │ │ │ └── SourceFile.pm │ │ │ │ ├── ReferenceString.pm │ │ │ │ ├── Settings.pm │ │ │ │ ├── Settings │ │ │ │ └── BuildTarget.pm │ │ │ │ ├── SourceDB.pm │ │ │ │ ├── SourceDB │ │ │ │ ├── Extension.pm │ │ │ │ ├── File.pm │ │ │ │ ├── Item.pm │ │ │ │ ├── ItemDefinition.pm │ │ │ │ └── WatchedFileDefinitions.pm │ │ │ │ ├── StatusMessage.pm │ │ │ │ ├── SymbolString.pm │ │ │ │ ├── SymbolTable.pm │ │ │ │ ├── SymbolTable │ │ │ │ ├── File.pm │ │ │ │ ├── IndexElement.pm │ │ │ │ ├── Reference.pm │ │ │ │ ├── ReferenceTarget.pm │ │ │ │ ├── Symbol.pm │ │ │ │ └── SymbolDefinition.pm │ │ │ │ ├── Topics.pm │ │ │ │ ├── Topics │ │ │ │ └── Type.pm │ │ │ │ └── Version.pm │ │ └── NaturalDocs │ └── config │ │ ├── Languages.txt │ │ ├── Menu.txt │ │ ├── README.md │ │ ├── Topics.txt │ │ ├── favicon.ico │ │ ├── libsfx.css │ │ ├── libsfx.scss │ │ └── readme ├── SublimeText │ ├── README.md │ ├── ca65-65816.sublime-settings │ ├── ca65-65816.tmLanguage │ ├── ca65-gsu.sublime-settings │ ├── ca65-gsu.tmLanguage │ ├── ca65-spc700.sublime-settings │ └── ca65-spc700.tmLanguage └── VisualStudioCode │ ├── README.md │ ├── ca65-65816 │ ├── .vscode │ │ └── launch.json │ ├── README.md │ ├── language-configuration.json │ ├── package.json │ └── syntaxes │ │ └── ca65-65816.tmLanguage │ ├── ca65-gsu │ ├── .vscode │ │ └── launch.json │ ├── README.md │ ├── language-configuration.json │ ├── package.json │ └── syntaxes │ │ └── ca65-gsu.tmLanguage │ └── ca65-spc700 │ ├── .vscode │ └── launch.json │ ├── README.md │ ├── language-configuration.json │ ├── package.json │ └── syntaxes │ └── ca65-spc700.tmLanguage ├── include ├── CPU.i ├── CPU │ ├── Header.s │ ├── Library.s │ ├── Runtime.s │ └── SMP.s ├── CPU_DSP.i ├── CPU_DataStructures.i ├── CPU_Def.i ├── CPU_GSU.i ├── CPU_MSU.i ├── CPU_Math.i ├── CPU_Memory.i ├── CPU_PPU.i ├── CPU_Runtime.i ├── CPU_SMP.i ├── Configurations │ ├── Map.cfg │ ├── Map_Mode20_1mbit.cfg │ ├── Map_Mode20_1mbit_GSU.cfg │ ├── Map_Mode20_2mbit.cfg │ ├── Map_Mode21_1mbit.cfg │ ├── Map_Mode21_2mbit.cfg │ ├── SMP-Map.cfg │ └── libSFX.cfg ├── Docs │ └── Make.txt ├── GSU_Assembler.i ├── Packages │ ├── LZ4 │ │ ├── LZ4.i │ │ ├── LZ4.s │ │ └── config │ └── Mouse │ │ ├── Mouse.i │ │ ├── Mouse.s │ │ └── config ├── SMP │ └── System.s700 ├── SMP_ADSR.i ├── SMP_Assembler.i ├── SMP_Def.i ├── SMP_Util.i ├── libSFX.defaults.i ├── libSFX.defines.i └── libSFX.i ├── libSFX.make ├── tests ├── Mode20 │ ├── Data │ │ ├── Graphics.palette │ │ ├── Graphics.tilemap.lz4 │ │ ├── Graphics.tiles.lz4 │ │ ├── Music.spc │ │ ├── Repetetive.bin │ │ └── TheEyesHaveIt.txt │ ├── Makefile │ └── Tests.s ├── Mode21 │ ├── Data │ │ ├── Graphics.palette │ │ ├── Graphics.tilemap.lz4 │ │ ├── Graphics.tiles.lz4 │ │ ├── Music.spc │ │ ├── Repetetive.bin │ │ └── TheEyesHaveIt.txt │ ├── Makefile │ ├── Map.cfg │ ├── Tests.s │ └── libSFX.cfg └── README.md └── tools └── make_breakpoints /.gitattributes: -------------------------------------------------------------------------------- 1 | *.i linguist-language=asm 2 | *.s linguist-language=asm 3 | *.s700 linguist-language=asm 4 | *.sgs linguist-language=asm 5 | extras/** linguist-vendored 6 | extras/** linguist-documentation 7 | tools/** linguist-vendored 8 | tools/** linguist-documentation 9 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | **/.o 2 | **/.build 3 | **/.build_libsfx 4 | examples/**/*.sfc 5 | examples/**/*.sym 6 | examples/**/*.cpu.sym 7 | examples/**/*.smp.sym 8 | examples/**/*.dmap 9 | examples/**/*.dnfo 10 | examples/**/*.srm 11 | examples/**/*.bin 12 | tests/**/*.sfc 13 | tests/**/*.sym 14 | tests/**/*.dsym 15 | tests/**/*.dmap 16 | tests/**/*.srm 17 | extras/NaturalDocs/config/Data 18 | dsp1b.bin 19 | examples/X-WIP 20 | *.psd 21 | *.swp 22 | *.dnfo 23 | **/_build_* 24 | **/*.palette 25 | **/*.tiles 26 | **/*.map 27 | **/*.m7d 28 | **/*.brr 29 | **/*.lz4 30 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "tools/cc65"] 2 | path = tools/cc65 3 | url = https://github.com/cc65/cc65.git 4 | [submodule "tools/superfamicheck"] 5 | path = tools/superfamicheck 6 | url = https://github.com/Optiroc/SuperFamicheck 7 | [submodule "tools/brrtools"] 8 | path = tools/brrtools 9 | url = https://github.com/Optiroc/BRRtools.git 10 | [submodule "tools/lz4"] 11 | path = tools/lz4 12 | url = https://github.com/lz4/lz4.git 13 | [submodule "tools/superfamiconv"] 14 | path = tools/superfamiconv 15 | url = https://github.com/Optiroc/SuperFamiconv.git 16 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015-2017 David Lindecrantz 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: clean submodules docs 2 | 3 | default: cc65 superfamiconv superfamicheck brrtools lz4 4 | 5 | all: clean default 6 | 7 | cc65: submodules 8 | @$(MAKE) -C tools/cc65 bin -j4 9 | 10 | superfamiconv: submodules 11 | @$(MAKE) -C tools/superfamiconv -j4 12 | 13 | superfamicheck: submodules 14 | @$(MAKE) -C tools/superfamicheck 15 | 16 | brrtools: submodules 17 | @$(MAKE) -C tools/brrtools 18 | 19 | lz4: submodules 20 | @$(MAKE) lz4 -C tools/lz4/programs -j4 21 | 22 | submodules: 23 | git submodule update --init --recursive 24 | 25 | docs: 26 | @rm -frd docs 27 | @mkdir -pv docs 28 | sassc extras/NaturalDocs/config/libsfx.scss extras/NaturalDocs/config/libsfx.css 29 | extras/NaturalDocs/bin/NaturalDocs -r -i include -o HTML docs -p extras/NaturalDocs/config -s libsfx -t 2 30 | @rm -frd ./docs/index && rm -frd ./docs/search && rm -frd ./docs/javascript 31 | @cp ./extras/NaturalDocs/config/readme ./docs/README.md 32 | @cp ./extras/NaturalDocs/config/favicon.ico ./docs/favicon.ico 33 | 34 | clean: 35 | @$(MAKE) clean -C tools/cc65 36 | @$(MAKE) clean -C tools/superfamiconv 37 | @$(MAKE) clean -C tools/superfamicheck 38 | @$(MAKE) clean -C tools/brrtools 39 | @$(MAKE) clean -C tools/lz4/programs 40 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # libSFX 2 | A Super Nintendo assembler development framework featuring: 3 | 4 | * Basic system runtime for initialization and interrupt handling 5 | * 65816 register size tracking macros to minimize rep/sep instructions (and mental overhead) 6 | * Full set of memcpy/memset routines for efficiently transferring data to different parts of the system 7 | * Some useful data structures with allocation and accessor macros (FIFO and FILO are currently implemented) 8 | * S-SMP communication and SPC playing routines. 9 | * LZ4 decompression 10 | * Mouse driver 11 | * Graphics conversion via [SuperFamiconv](https://github.com/Optiroc/SuperFamiconv) 12 | * BRR audio encoding using [BRRtools](https://github.com/Optiroc/BRRtools) 13 | * ROM image validation via [SuperFamicheck](https://github.com/Optiroc/SuperFamicheck) 14 | * Sublime Text [syntax definitions](./extras/SublimeText) 15 | 16 | Documentation available at [optiroc.github.io/libSFX](https://optiroc.github.io/libSFX). 17 | 18 | libSFX is developed by David Lindecrantz and distributed under the terms of the [MIT license](./LICENSE). 19 | 20 | 21 | ## dependencies 22 | A C/C++ toolchain, make, git and a decent command line interface. 23 | 24 | Unix-like (Mac, Linux, etc.) systems should be ready to go out of the box. If you're running Windows the best option is to install [Cygwin](https://cygwin.com/install.html) and make sure you include the `git` and `mingw64` toolchain (`mingw64-x86_64-binutils`, `mingw64-x86_64-gcc-core` and `mingw64-x86_64-gcc-g++`) packages. 25 | 26 | 27 | ## building 28 | First you need to build the bundled tools, which are included as git submodules. Simply run `make` from the libSFX root path to initialize the submodules and build the tools. 29 | 30 | Now the toolchain is in place and you should be able to run `make` from any of the example directories to assemble the source files and link a Super Nintendo ROM image (*.sfc). 31 | 32 | 33 | ## setting up a project 34 | For the most basic setup, copy `examples/Template` to a location of your liking. Then edit `Makefile` and make sure that `libsfx_dir` points to the libSFX root directory. 35 | 36 | For project customization – for example extending the ROM size, adding SRAM or special code segments, or changing the default stack and scratchpad sizes – the build script looks for two files in the project directory; `libSFX.cfg` and `Map.cfg`. If these aren't found (like in the Template project), the defaults inside `$(libsfx_dir)/include/Configurations` are used. 37 | 38 | To override the defaults, simply copy these two files into your project directory and edit them to your liking. In [include/Configurations](./include/Configurations/) there's a few additional Map.cfg examples. You may also check out the [example](./examples/SixteenMegaPower) [projects](./examples/SuperFX) to see how a project can be customized. 39 | 40 | 41 | ## acknowledgments 42 | libSFX includes the following code and snippets: 43 | 44 | * SPC-700 assembler for ca65 and S-SMP transfer routines by [Blargg](http://blargg.8bitalley.com) 45 | * GSU assembler for ca65 by [ARM9](https://github.com/ARM9/casfx) 46 | * ca65 define/undefine macros by [Movax12](http://forums.nesdev.com/memberlist.php?mode=viewprofile&u=4680) 47 | 48 | 49 | ## resources 50 | * [fullsnes](http://problemkaputt.de/fullsnes.htm) - comprehensive SNES reference 51 | * [ca65 users guide](https://cc65.github.io/doc/ca65.html) 52 | * [SNESdev forum](http://forums.nesdev.com/viewforum.php?f=12) 53 | -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- 1 | libSFX documentation: [optiroc.github.io/libSFX](http://optiroc.github.io/libSFX) 2 | 3 | Generated with [NaturalDocs](http://www.naturaldocs.org) 4 | -------------------------------------------------------------------------------- /docs/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/docs/favicon.ico -------------------------------------------------------------------------------- /docs/files/CPU_Math-i.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | CPU_Math.i 4 | 5 | 6 | 7 |

CPU_Math.i

Summary
CPU_Math.i
Macros
muluUnsigned multiplication (S-CPU MMIO)
divuUnsigned division (S-CPU MMIO)
mulsSigned multiplication (S-PPU MMIO)
8 | 9 |

Macros

10 | 11 |

mulu

Unsigned multiplication (S-CPU MMIO)

If :out: parameter is omitted, get result in RDMPYL/H (uint16) after 5 cycles

Parameters

:in:    n1    Multiplicand (uint8)    a/x/y     Requires RW a8 or i8
12 |                                       constant  Uses a, sets RW a8
13 | :in:    n2    Multiplier (uint8)      a/x/y     Requires RW a8 or i8
14 |                                       constant  Uses a, sets RW a8
15 | :out?:  ret   Product (uint16)        a/x/y     Sets RW a16 or i16

Example

lda      #$88
16 | mulu     a,$7f, x      ;Returns x = #$4378
17 | 18 |

divu

Unsigned division (S-CPU MMIO)

If :out: parameters are omitted, get quotient in RDDIVL (uint16) and remainder in RDMPYL (uint16) after 13 cycles

Parameters

:in:    n1    Dividend (uint16)       a/x/y     Requires RW a16 or i16
19 |                                       constant  Uses x, sets RW i16
20 | :in:    n2    Divisor (uint8)         a/x/y     Requires RW a8 or i8
21 |                                       constant  Uses a, sets RW a8
22 | :out?:  ret   Quotient (uint16)       a/x/y     Sets RW a16 or i16
23 | :out?:  retr  Remainder (uint16)      a/x/y     Sets RW a16 or i16
24 | 25 |

muls

Signed multiplication (S-PPU MMIO)

Not available during Mode 7 rendering If :out: parameter is omitted, result available in MPYL/M/H (sint24) immediately

Parameters

:in:    n1    Multiplicand (sint16)   x/y       Uses a, sets RW a8
26 |                                       constant  Uses a, sets RW a8
27 | :in:    n2    Multiplier (sint8)      a         Requires RW a8
28 |                                       constant  Uses a, sets RW a8
29 | :out?:  ret   Product (sint24)        ax/ay     Sets RW a8i16
30 | 31 |
32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /docs/files/Configurations/Map-cfg.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Map.cfg 4 | 5 | 6 | 7 |

Map.cfg

Map.cfg is the configuration file passed to the ld65 linker.

It consists of two main parts∶

  • MEMORY describes the memory layout of the SNES and the cartridge
  • SEGMENTS assigns segments to the memory areas specified

In include/Configurations there are several template configuration files for different ROM sizes and memory layouts.

For full documentation of ld65 and its configuration refer to the official documentation.

8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /docs/files/Packages/Mouse/Mouse-i.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Mouse 4 | 5 | 6 | 7 |

Mouse

Optional package adding SNES SFM1 Mouse support

To link mouse support in a project, simply add Mouse to libsfx_packages in the project makefile.

Makefile

# Use packages
 8 | libsfx_packages := Mouse

The mouse package adds mouse polling to the regular automatic joypad polling.  By default the driver will look for a mouse in port 1.  This is configurable with the SFX_MOUSE variable∶

libSFX.cfg

SFX_MOUSE = MOUSE1 | MOUSE2

Mouse read-out data is stored in MOUSE_data structs with the following members∶

.struct MOUSE_data
 9 |     status          .byte
10 |     sensitivity     .byte
11 |     buttons_cont    .byte
12 |     buttons_trig    .byte
13 |     delta_x         .byte
14 |     delta_y         .byte
15 |     cursor_x        .word
16 |     cursor_y        .word
17 | .endstruct
18 | 
19 | Possible status values:
20 | .define MOUSE_status_nc         $00 ;Mouse not connected
21 | .define MOUSE_status_ok         $01 ;Mouse connected and working
22 | .define MOUSE_status_error      $80 ;Hardware error
23 | 
24 | Button presses are stored in the follwing bits of buttons_cont/buttons_trig:
25 | Bit
26 | 7         Right button
27 | 6         Left button

The driver updates all members during each VBlank interval at zero page locations SFX_mouse1 and SFX_mouse2.  The data can be addressed like this∶

;Load cursor vertical position
28 | lda     z:SFX_mouse1+MOUSE_data::cursor_y

The ‘sensitivity’ member is used to set the mouse acceleration curve.

;Set normal mouse sensitivty
29 | lda     #MOUSE_sensitivity_normal
30 | sta     SFX_mouse1+MOUSE_data::sensitivity
31 | 
32 | ;Possible values
33 | .define MOUSE_sensitivity_slow    0
34 | .define MOUSE_sensitivity_normal  1
35 | .define MOUSE_sensitivity_fast    2

All other members are read-only.

If no mouse is detected and SFX_JOY is set for the port, the driver automatically falls back to joypad input.  D-pad input is then mapped to delta and cursor, and the A/X buttons is mapped to the left/right buttons.

The driver can optionally be “hugged” by special strings that – I suppose – some emulators rely on to automatically enable mouse input.  Real hardware (and consequently, real emulators) doesn’t care.

libSFX.cfg

SFX_MOUSE_STRINGS = ENABLE
36 | 37 |
38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /docs/files/SMP_Util-i.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | SMP_Util.i 4 | 5 | 6 | 7 |

SMP_Util.i

Summary
SMP_Util.i
Macros
DSP_getGet DSP register
DSP_setSet DSP register
SMP_exitReturn to IPL (clears timers, zeropage)
8 | 9 |

Macros

10 | 11 |

DSP_get

Get DSP register

Parameters

:in:    dsp_reg    Register (uint8)     constant
12 | :in:    spc_reg    Register (uint8)     a/x/y
13 | 14 |

DSP_set

Set DSP register

Parameters

:in:    reg     Register (uint8)        constant
15 | :in:    val     Value (uint8)           constant
16 |                                         direct page address
17 |                                         a/x/y
18 | 19 |

SMP_exit

Return to IPL (clears timers, zeropage)

20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /docs/files/libSFX-i.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | libSFX documentation 4 | 5 | 6 | 7 |

libSFX documentation

libSFX is a Super Nintendo assembler development framework.  It aims to add as little magic and abstraction to the programming as possible while removing the tedium of boilerplate and mandatory micro management of configuration files.

By leveraging the ca65 assembler and several macro packs it can create object code for∶

  • WDC65816 - also known as S-CPU, the main processor
  • SPC700 - the Sony 8-bit CPU (S-SMP) controlling the sound DSP (S-DSP)
  • GSU - Graphics Support Unit, also known as “SuperFX”

Using (and optionally extending) the included makefiles and configurations it’s a relative breeze to get SNES code up and running!

Anatomy libSFX consists of a small runtime that mainly initializes the system and handles hardware interrupts (which can be redirected in software).  The real rice of the library are the macros included and documented here.

Packages There are also opt-in packages, adding a bit more to the object code size, for non-core features like input peripherals and data decompression.  These are documented in the “Packages” section.

Tools The ca65 toolchain and a couple of support tools are included as submodules in the libSFX/tools directory.  These are the only tools used by the libSFX.make makefile, making libSFX pretty much self contained.  Running make from the repository root will sync the submodules and build the tools.

SFX 🤷‍️ Why is it called libSFX?  That sounds like a library of sound effects.  Well, yes it does.  However, “SFX” was also how Nintendo refered to the SNES/SFC in the very early developer documentation.  It was through photocopied binders of those documents – with severe generation loss!  – I first learned about the innards of the Super Nintendo, and I have lovingly cultivated a habit of using SFX to prefix and suffix my SNES code over the years.

Get started Clone, fork or download the repository at github.com/Optiroc/libSFX and dive into the Make documentation.

libSFX is developed by David Lindecrantz and distributed under the terms of the MIT license.

8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |
Building with libSFX involves three major parts∶
18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /docs/index.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/Hello-Mode7/Data/Music.spc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/examples/Hello-Mode7/Data/Music.spc -------------------------------------------------------------------------------- /examples/Hello-Mode7/Data/SNES-Mode7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/examples/Hello-Mode7/Data/SNES-Mode7.png -------------------------------------------------------------------------------- /examples/Hello-Mode7/Hello-Mode7.s: -------------------------------------------------------------------------------- 1 | ; Hello Mode 7 2 | ; David Lindecrantz 3 | ; 4 | ; Mode 7 infinite zoom 5 | 6 | .include "libSFX.i" 7 | 8 | ;VRAM destination address 9 | VRAM_MODE7_LOC = $0000 10 | 11 | ;Mode 7 center and offset 12 | CENTER_X = 524 13 | CENTER_Y = 538 14 | SCROLL_X = (CENTER_X - (256/2)) - 8 15 | SCROLL_Y = (CENTER_Y - (224/2)) - 12 16 | 17 | Main: 18 | ;Transfer and execute SPC file 19 | SMP_playspc SPC_State, SPC_Image_Lo, SPC_Image_Hi 20 | 21 | ;Decompress graphics and transfer to VRAM 22 | LZ4_decompress Tiles, EXRAM, y 23 | VRAM_memcpy VRAM_MODE7_LOC, EXRAM, y, $80, 0, $19 ;Transfer tiles to odd VRAM addresses 24 | 25 | LZ4_decompress Map, EXRAM, y 26 | VRAM_memcpy VRAM_MODE7_LOC, EXRAM, y, 0, 0, $18 ;Transfer map to even VRAM addresses 27 | 28 | CGRAM_memcpy 0, Palette, sizeof_Palette 29 | 30 | ;Set up screen mode 31 | lda #bgmode(BG_MODE_7, BG3_PRIO_NORMAL, BG_SIZE_8X8, BG_SIZE_8X8, BG_SIZE_8X8, BG_SIZE_8X8) 32 | sta BGMODE 33 | lda #bgsc(VRAM_MODE7_LOC, SC_SIZE_32X32) 34 | sta BG1SC 35 | ldx #bgnba(VRAM_MODE7_LOC, 0, 0, 0) 36 | stx BG12NBA 37 | lda #tm(ON, OFF, OFF, OFF, OFF) 38 | sta TM 39 | 40 | ;Set scroll and mode 7 center 41 | lda #SCROLL_X 44 | sta BG1HOFS 45 | lda #SCROLL_Y 48 | sta BG1VOFS 49 | 50 | lda #CENTER_X 53 | sta M7X 54 | lda #CENTER_Y 57 | sta M7Y 58 | 59 | ldx #$0000 60 | stx scale 61 | 62 | ldx #$0001 63 | stx speed 64 | 65 | ;Set VBlank handler 66 | VBL_set VBL 67 | 68 | ;Turn on screen 69 | lda #inidisp(ON, DISP_BRIGHTNESS_MAX) 70 | sta SFX_inidisp 71 | VBL_on 72 | 73 | : wai ;Simply wait in main loop 74 | bra :- ;VBL is called in each vertical blanking period 75 | 76 | ;------------------------------------------------------------------------------- 77 | VBL: 78 | RW a16 79 | 80 | lda scale 81 | add speed 82 | sta scale 83 | 84 | and #$003f ;Increase speed every 64 frames 85 | bne :+ 86 | inc speed 87 | : 88 | lda speed ;Start flashing after a while 89 | and #$fff0 90 | beq :+ 91 | 92 | inc speed 93 | lda color 94 | sub speed 95 | and #%0011110011101111 96 | sta color 97 | tax 98 | CGRAM_setcolor 0, x 99 | : 100 | RW a8 ;Set mode 7 registers 101 | lda scale 102 | sta M7A 103 | lda scale+1 104 | sta M7A 105 | lda scale 106 | sta M7D 107 | lda scale+1 108 | sta M7D 109 | 110 | rtl 111 | 112 | ;------------------------------------------------------------------------------- 113 | .segment "LORAM" 114 | scale: .res 2 115 | color: .res 2 116 | speed: .res 2 117 | 118 | ;------------------------------------------------------------------------------- 119 | ;Import graphics 120 | .segment "RODATA" 121 | incbin Palette, "Data/SNES-Mode7.png.palette" 122 | incbin Tiles, "Data/SNES-Mode7.png.tiles.lz4" 123 | incbin Map, "Data/SNES-Mode7.png.map.lz4" 124 | 125 | ;Import music 126 | .define spc_file "Data/Music.spc" 127 | .segment "RODATA" 128 | SPC_State: SPC_incbin_state spc_file 129 | .segment "ROM2" 130 | SPC_Image_Lo: SPC_incbin_lo spc_file 131 | .segment "ROM3" 132 | SPC_Image_Hi: SPC_incbin_hi spc_file 133 | -------------------------------------------------------------------------------- /examples/Hello-Mode7/Makefile: -------------------------------------------------------------------------------- 1 | # Name 2 | name := Hello-Mode7 3 | debug := 1 4 | 5 | # Use packages 6 | libsfx_packages := LZ4 7 | 8 | # Derived data files 9 | derived_files += Data/SNES-Mode7.png.palette Data/SNES-Mode7.png.tiles Data/SNES-Mode7.png.map 10 | derived_files += Data/SNES-Mode7.png.tiles.lz4 Data/SNES-Mode7.png.map.lz4 11 | 12 | Data/SNES-Mode7.png.palette: palette_flags = -v --colors 128 13 | Data/SNES-Mode7.png.tiles: tiles_flags = -v -M snes_mode7 14 | Data/SNES-Mode7.png.map: map_flags = -v -M snes_mode7 15 | 16 | # Include libSFX.make 17 | libsfx_dir := ../.. 18 | include $(libsfx_dir)/libSFX.make 19 | -------------------------------------------------------------------------------- /examples/Hello/Data/Music.spc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/examples/Hello/Data/Music.spc -------------------------------------------------------------------------------- /examples/Hello/Data/SNES.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/examples/Hello/Data/SNES.png -------------------------------------------------------------------------------- /examples/Hello/Hello.s: -------------------------------------------------------------------------------- 1 | ; Hello 2 | ; David Lindecrantz 3 | ; 4 | ; Super basic example that decompresses and displays some graphics and plays an SPC song 5 | 6 | .include "libSFX.i" 7 | 8 | ;VRAM destination addresses 9 | VRAM_MAP_LOC = $0000 10 | VRAM_TILES_LOC = $8000 11 | 12 | Main: 13 | ;Transfer and execute SPC file 14 | SMP_playspc SPC_State, SPC_Image_Lo, SPC_Image_Hi 15 | 16 | ;Decompress graphics and upload to VRAM 17 | LZ4_decompress Map, EXRAM, y 18 | VRAM_memcpy VRAM_MAP_LOC, EXRAM, y 19 | LZ4_decompress Tiles, EXRAM, y 20 | VRAM_memcpy VRAM_TILES_LOC, EXRAM, y 21 | CGRAM_memcpy 0, Palette, sizeof_Palette 22 | 23 | ;Set up screen mode 24 | lda #bgmode(BG_MODE_1, BG3_PRIO_NORMAL, BG_SIZE_8X8, BG_SIZE_8X8, BG_SIZE_8X8, BG_SIZE_8X8) 25 | sta BGMODE 26 | lda #bgsc(VRAM_MAP_LOC, SC_SIZE_32X32) 27 | sta BG1SC 28 | ldx #bgnba(VRAM_TILES_LOC, 0, 0, 0) 29 | stx BG12NBA 30 | lda #tm(ON, OFF, OFF, OFF, OFF) 31 | sta TM 32 | 33 | ;Turn on screen 34 | lda #inidisp(ON, DISP_BRIGHTNESS_MAX) 35 | sta SFX_inidisp 36 | VBL_on 37 | 38 | : wai 39 | bra :- 40 | 41 | ;------------------------------------------------------------------------------- 42 | 43 | ;Import graphics 44 | .segment "RODATA" 45 | incbin Palette, "Data/SNES.png.palette" 46 | incbin Tiles, "Data/SNES.png.tiles.lz4" 47 | incbin Map, "Data/SNES.png.map.lz4" 48 | 49 | ;Import music 50 | .define spc_file "Data/Music.spc" 51 | .segment "RODATA" 52 | SPC_State: SPC_incbin_state spc_file 53 | .segment "ROM2" 54 | SPC_Image_Lo: SPC_incbin_lo spc_file 55 | .segment "ROM3" 56 | SPC_Image_Hi: SPC_incbin_hi spc_file 57 | -------------------------------------------------------------------------------- /examples/Hello/Makefile: -------------------------------------------------------------------------------- 1 | # Name 2 | name := Hello 3 | debug := 1 4 | 5 | # Use packages 6 | libsfx_packages := LZ4 7 | 8 | # Derived data files 9 | derived_files := Data/SNES.png.palette Data/SNES.png.tiles Data/SNES.png.map 10 | derived_files += Data/SNES.png.tiles.lz4 Data/SNES.png.map.lz4 11 | 12 | # Include libSFX.make 13 | libsfx_dir := ../.. 14 | include $(libsfx_dir)/libSFX.make 15 | -------------------------------------------------------------------------------- /examples/MSU-1/.gitignore: -------------------------------------------------------------------------------- 1 | *.pcm 2 | SMP.bin 3 | *.msu 4 | -------------------------------------------------------------------------------- /examples/MSU-1/MSU1.s: -------------------------------------------------------------------------------- 1 | ; MSU-1 2 | ; Kyle Swanson 3 | ; 4 | ; MSU-1 example 5 | 6 | .include "libSFX.i" 7 | 8 | init_with_MSU: 9 | lda #$FF 10 | sta MSU_VOLUME 11 | ldy #$0001 12 | jsr PlayTrack 13 | CGRAM_setcolor_rgb 0, 0,255,0 14 | rts 15 | 16 | init_without_MSU: 17 | CGRAM_setcolor_rgb 0, 255,0,0 18 | rts 19 | 20 | Main: 21 | ;Transfer and execute SMP code 22 | SMP_exec SMP_RAM, SMP, sizeof_SMP, SMP_RAM 23 | 24 | ;Detect MSU-1, fire a callback 25 | MSU_detect init_with_MSU, init_without_MSU 26 | 27 | ;Turn on screen 28 | lda #inidisp(ON, DISP_BRIGHTNESS_MAX) 29 | sta SFX_inidisp 30 | VBL_on 31 | 32 | : wai 33 | ldx z:SFX_joy1trig 34 | cpx #$00 35 | beq :- 36 | @l: cpx #JOY_L 37 | bne @r 38 | ldy #$0001 39 | jsr PlayTrack 40 | @r: cpx #JOY_R 41 | bne @end 42 | ldy #$0002 43 | jsr PlayTrack 44 | @end: bra :- 45 | 46 | PlayTrack: 47 | sty MSU_TRACK 48 | @bsy: lda MSU_STATUS 49 | bit #$40 50 | bne @bsy 51 | lda MSU_STATUS 52 | bit #$08 53 | bne @ret 54 | lda #$03 55 | sta MSU_CONTROL 56 | @ret: rts 57 | 58 | .segment "RODATA" 59 | incbin SMP, "SMP.bin" 60 | -------------------------------------------------------------------------------- /examples/MSU-1/Makefile: -------------------------------------------------------------------------------- 1 | # Name 2 | name := MSU1 3 | 4 | # SMP sub-projects 5 | smp_overlays := SMP 6 | 7 | # Cleanup MSU files 8 | clean_files := $(name)-*.pcm $(name).msu 9 | 10 | # Include libSFX.make 11 | libsfx_dir := ../.. 12 | include $(libsfx_dir)/libSFX.make 13 | 14 | # https://voyager.jpl.nasa.gov/golden-record/whats-on-the-record/greetings/ 15 | msu: 16 | touch $(name).msu 17 | printf "MSU1\0\0\0\0" > $(name)-1.pcm 18 | ffmpeg -i https://voyager.jpl.nasa.gov/assets/audio/golden-record/english.au -ar 44.1k -ac 2 -f s16le -acodec pcm_s16le - >> $(name)-1.pcm 19 | printf "MSU1\0\0\0\0" > $(name)-2.pcm 20 | ffmpeg -i https://voyager.jpl.nasa.gov/assets/audio/golden-record/swedish.au -ar 44.1k -ac 2 -f s16le -acodec pcm_s16le - >> $(name)-2.pcm 21 | -------------------------------------------------------------------------------- /examples/MSU-1/SMP/SMP.s700: -------------------------------------------------------------------------------- 1 | .include "libSFX.i" 2 | 3 | DSP_set FLG, #$20 4 | DSP_set MVOLL, #$7F 5 | DSP_set MVOLR, #$7F 6 | jmp !IPL_INIT 7 | -------------------------------------------------------------------------------- /examples/Mode7-Transform/Data/Background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/examples/Mode7-Transform/Data/Background.png -------------------------------------------------------------------------------- /examples/Mode7-Transform/Data/Music.spc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/examples/Mode7-Transform/Data/Music.spc -------------------------------------------------------------------------------- /examples/Mode7-Transform/Makefile: -------------------------------------------------------------------------------- 1 | # Name 2 | name := Mode7-Transform 3 | debug := 1 4 | 5 | # Use packages 6 | libsfx_packages := LZ4 Mouse 7 | 8 | # Derived data files 9 | derived_files += Data/Background.png.palette Data/Background.png.tiles Data/Background.png.map 10 | derived_files += Data/Background.png.tiles.lz4 Data/Background.png.map.lz4 11 | 12 | Data/Background.png.palette: palette_flags = -v --colors 128 13 | Data/Background.png.tiles: tiles_flags = -v -M snes_mode7 14 | Data/Background.png.map: map_flags = -v -M snes_mode7 15 | 16 | # Sine table 17 | derived_files += Data/Sin.bin 18 | 19 | # Include libSFX.make 20 | libsfx_dir := ../.. 21 | include $(libsfx_dir)/libSFX.make 22 | 23 | # Custom rules 24 | Data/Sin.bin : Sin.py 25 | ./$< $@ 26 | -------------------------------------------------------------------------------- /examples/Mode7-Transform/Math.i: -------------------------------------------------------------------------------- 1 | .ifndef ::__SNIPPETS_MATH__ 2 | ::__SNIPPETS_MATH__ = 1 3 | 4 | /** 5 | sign_extend 6 | Sign extend 8 bit accumulator to 16 bits 7 | 8 | Expects 8 bit accumulator. 9 | Exits with 8 bit accumulator. 10 | */ 11 | .macro sign_extend 12 | RW_assume a8 13 | bpl :+ 14 | xba 15 | lda #$ff 16 | xba 17 | bra :++ 18 | : 19 | xba 20 | lda #$00 21 | xba 22 | : 23 | .endmac 24 | 25 | .endif; __SNIPPETS_MATH__ 26 | -------------------------------------------------------------------------------- /examples/Mode7-Transform/Mode7-Transform.s: -------------------------------------------------------------------------------- 1 | ; Mode 7 Transform 2 | ; David Lindecrantz 3 | ; 4 | ; Mode 7 zoom and rotate using joypad or mouse in port 1 5 | ; Building requires python to generate sine table 6 | 7 | .include "libSFX.i" 8 | .include "Math.i" 9 | 10 | ;VRAM destination address 11 | VRAM_MODE7_LOC = $0000 12 | 13 | ;Mode 7 center and offset 14 | CENTER_X = 64 15 | CENTER_Y = 64 16 | SCROLL_X = (CENTER_X - (256/2)) 17 | SCROLL_Y = (CENTER_Y - (224/2)) 18 | 19 | Main: 20 | ;Transfer and execute SPC file 21 | SMP_playspc SPC_State, SPC_Image_Lo, SPC_Image_Hi 22 | 23 | ;Decompress graphics and transfer to VRAM 24 | LZ4_decompress Tiles, EXRAM, y 25 | VRAM_memcpy VRAM_MODE7_LOC, EXRAM, y, $80, 0, $19 ;Transfer tiles to odd VRAM addresses 26 | 27 | LZ4_decompress Map, EXRAM, y 28 | VRAM_memcpy VRAM_MODE7_LOC, EXRAM, y, 0, 0, $18 ;Transfer map to even VRAM addresses 29 | 30 | CGRAM_memcpy 0, Palette, sizeof_Palette 31 | 32 | ;Set up screen mode 33 | lda #bgmode(BG_MODE_7, BG3_PRIO_NORMAL, BG_SIZE_8X8, BG_SIZE_8X8, BG_SIZE_8X8, BG_SIZE_8X8) 34 | sta BGMODE 35 | lda #bgsc(VRAM_MODE7_LOC, SC_SIZE_32X32) 36 | sta BG1SC 37 | ldx #bgnba(VRAM_MODE7_LOC, 0, 0, 0) 38 | stx BG12NBA 39 | lda #tm(ON, OFF, OFF, OFF, OFF) 40 | sta TM 41 | 42 | ;Set scroll and mode 7 center 43 | lda #SCROLL_X 46 | sta BG1HOFS 47 | lda #SCROLL_Y 50 | sta BG1VOFS 51 | 52 | lda #CENTER_X 55 | sta M7X 56 | lda #CENTER_Y 59 | sta M7Y 60 | 61 | ldx #$0100 62 | stx scale 63 | 64 | ;Set VBlank handler 65 | VBL_set VBL 66 | 67 | ;Turn on screen 68 | lda #inidisp(ON, DISP_BRIGHTNESS_MAX) 69 | sta SFX_inidisp 70 | VBL_on 71 | 72 | : wai ;Simply wait in main loop 73 | bra :- ;VBL is called in each vertical blanking period 74 | 75 | ;------------------------------------------------------------------------------- 76 | VBL: RW_assume a8i16 77 | 78 | ;Controller deltas -> angle and scale 79 | RW a8 80 | lda z:SFX_mouse1+MOUSE_data::delta_x 81 | neg 82 | sign_extend 83 | RW a16 84 | add angle 85 | sta angle 86 | 87 | RW a8 88 | lda z:SFX_mouse1+MOUSE_data::delta_y 89 | asl 90 | asl 91 | sign_extend 92 | RW a16 93 | add scale 94 | sta scale 95 | RW a8 96 | 97 | ;angle -> x 98 | lda #$00 99 | xba 100 | lda angle 101 | tax 102 | 103 | ;scale -> M7 multiplicand 104 | lda scale 105 | sta WRMPYM7A 106 | lda scale+1 107 | sta WRMPYM7A 108 | 109 | ;-sin(angle) * scale -> m7b 110 | lda Sin,x 111 | neg 112 | sta WRMPYM7B 113 | ldy MPYM 114 | sty m7b 115 | 116 | ;sin(angle) * scale -> m7c 117 | lda Sin,x 118 | sta WRMPYM7B 119 | ldy MPYM 120 | sty m7c 121 | 122 | ;cos index -> x 123 | lda #$00 124 | xba 125 | txa 126 | add #$40 127 | tax 128 | 129 | ;cos(angle) * scale -> m7a 130 | lda Sin,x 131 | sta WRMPYM7B 132 | ldy MPYM 133 | sty m7a 134 | 135 | ;cos(angle) * scale -> m7d 136 | lda Sin,x 137 | sta WRMPYM7B 138 | ldy MPYM 139 | sty m7d 140 | 141 | ;set registers 142 | lda m7a 143 | sta M7A 144 | lda m7a+1 145 | sta M7A 146 | 147 | lda m7b 148 | sta M7B 149 | lda m7b+1 150 | sta M7B 151 | 152 | lda m7c 153 | sta M7C 154 | lda m7c+1 155 | sta M7C 156 | 157 | lda m7d 158 | sta M7D 159 | lda m7d+1 160 | sta M7D 161 | 162 | rtl 163 | 164 | ;------------------------------------------------------------------------------- 165 | .segment "LORAM" 166 | angle: .res 2 167 | scale: .res 2 168 | 169 | m7a: .res 2 170 | m7b: .res 2 171 | m7c: .res 2 172 | m7d: .res 2 173 | 174 | ;------------------------------------------------------------------------------- 175 | ;.segment "RODATA_ALIGN" 176 | 177 | ;Import graphics 178 | .segment "RODATA" 179 | 180 | incbin Sin, "Data/Sin.bin" 181 | 182 | incbin Palette, "Data/Background.png.palette" 183 | incbin Tiles, "Data/Background.png.tiles.lz4" 184 | incbin Map, "Data/Background.png.map.lz4" 185 | 186 | 187 | ;Import music 188 | .define spc_file "Data/Music.spc" 189 | .segment "RODATA" 190 | SPC_State: SPC_incbin_state spc_file 191 | .segment "ROM2" 192 | SPC_Image_Lo: SPC_incbin_lo spc_file 193 | .segment "ROM3" 194 | SPC_Image_Hi: SPC_incbin_hi spc_file 195 | -------------------------------------------------------------------------------- /examples/Mode7-Transform/Sin.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | import sys 4 | import math 5 | import struct 6 | 7 | steps = 256 8 | 9 | try: 10 | fname = sys.argv[1] 11 | f = open(fname, 'wb') 12 | for x in range(0, steps): 13 | sine = int(127.5 * math.sin(math.radians(float(x) * (360.0 / float(steps))))) 14 | f.write(struct.pack('b', sine)) 15 | f.close() 16 | 17 | except Exception as e: 18 | sys.exit(e) 19 | -------------------------------------------------------------------------------- /examples/Mode7-Transform/libSFX.cfg: -------------------------------------------------------------------------------- 1 | ; libSFX Custom Configuration 2 | 3 | ;-------------------------------------------------------------------- 4 | ;ROM Header 5 | 6 | ;Title (21 chars) 7 | ; "123456789012345678901" 8 | define "ROM_TITLE", "JOY MOUSE SUPERSCALER" 9 | 10 | ;Enable joypad and mouse in port 1 11 | SFX_JOY = JOY1 12 | SFX_MOUSE = MOUSE1 13 | -------------------------------------------------------------------------------- /examples/Mouse/Data/Music.spc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/examples/Mouse/Data/Music.spc -------------------------------------------------------------------------------- /examples/Mouse/Data/SNES.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/examples/Mouse/Data/SNES.png -------------------------------------------------------------------------------- /examples/Mouse/Data/Sprites.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/examples/Mouse/Data/Sprites.png -------------------------------------------------------------------------------- /examples/Mouse/Makefile: -------------------------------------------------------------------------------- 1 | # Name 2 | name := Mouse 3 | debug := 1 4 | 5 | # Use packages 6 | libsfx_packages := LZ4 Mouse 7 | 8 | # Derived data files 9 | derived_files := Data/SNES.png.palette Data/SNES.png.tiles Data/SNES.png.map 10 | derived_files += Data/SNES.png.tiles.lz4 Data/SNES.png.map.lz4 11 | 12 | derived_files += Data/Sprites.png.palette Data/Sprites.png.tiles 13 | derived_files += Data/Sprites.png.tiles.lz4 14 | 15 | # Use --sprite-mode flag for sprite sheets 16 | Data/Sprites.png.tiles: tiles_flags = -v --sprite-mode 17 | 18 | # Include libSFX.make 19 | libsfx_dir := ../.. 20 | include $(libsfx_dir)/libSFX.make 21 | -------------------------------------------------------------------------------- /examples/Mouse/Mouse.s: -------------------------------------------------------------------------------- 1 | ; Hello 2 | ; David Lindecrantz 3 | ; 4 | ; Example using the Mouse package to control two animated sprites 5 | ; using either mouse or joypad in either port 6 | 7 | .include "libSFX.i" 8 | .include "OAM.i" 9 | 10 | ;VRAM destination addresses 11 | VRAM_MAP_LOC = $0000 12 | VRAM_TILES_LOC = $8000 13 | VRAM_SPRITES_LOC = $C000 14 | 15 | Main: 16 | ;Set normal mouse sensitivty 17 | lda #MOUSE_sensitivity_normal 18 | sta SFX_mouse1+MOUSE_data::sensitivity 19 | sta SFX_mouse2+MOUSE_data::sensitivity 20 | 21 | ;Init shadow oam 22 | OAM_init shadow_oam, 0, 0, 0 23 | 24 | ;Set initial cursor positions 25 | lda #78 26 | ldx #45 27 | sta z:SFX_mouse1+MOUSE_data::cursor_y 28 | stx z:SFX_mouse1+MOUSE_data::cursor_x 29 | lda #45 30 | ldx #208 31 | sta z:SFX_mouse2+MOUSE_data::cursor_y 32 | stx z:SFX_mouse2+MOUSE_data::cursor_x 33 | 34 | ;Transfer and execute SPC file 35 | SMP_playspc SPC_State, SPC_Image_Lo, SPC_Image_Hi 36 | 37 | ;Decompress graphics and upload to VRAM 38 | LZ4_decompress Map, EXRAM, y 39 | VRAM_memcpy VRAM_MAP_LOC, EXRAM, y 40 | 41 | LZ4_decompress Tiles, EXRAM, y 42 | VRAM_memcpy VRAM_TILES_LOC, EXRAM, y 43 | 44 | LZ4_decompress Sprites, EXRAM, y 45 | VRAM_memcpy VRAM_SPRITES_LOC, EXRAM, y 46 | 47 | CGRAM_memcpy 0, Palette, sizeof_Palette 48 | CGRAM_memcpy 128, Palette_spr, sizeof_Palette_spr 49 | 50 | ;Set up screen mode 51 | lda #bgmode(BG_MODE_1, BG3_PRIO_NORMAL, BG_SIZE_8X8, BG_SIZE_8X8, BG_SIZE_8X8, BG_SIZE_8X8) 52 | sta BGMODE 53 | lda #bgsc(VRAM_MAP_LOC, SC_SIZE_32X32) 54 | sta BG1SC 55 | ldx #bgnba(VRAM_TILES_LOC, 0, 0, 0) 56 | stx BG12NBA 57 | lda #objsel(VRAM_SPRITES_LOC, OBJ_8x8_32x32, 0) 58 | sta OBJSEL 59 | lda #tm(ON, OFF, OFF, OFF, ON) 60 | sta TM 61 | 62 | ;Set VBlank handler 63 | VBL_set VBL 64 | 65 | ;Turn on screen 66 | lda #inidisp(ON, DISP_BRIGHTNESS_MAX) 67 | sta SFX_inidisp 68 | VBL_on 69 | : wai 70 | bra :- 71 | 72 | ;------------------------------------------------------------------------------- 73 | VBL: 74 | ;Set sprite attributes 75 | lda SFX_tick 76 | ror 77 | and #$0c 78 | tay 79 | lda z:SFX_mouse1+MOUSE_data::cursor_y 80 | ldx z:SFX_mouse1+MOUSE_data::cursor_x 81 | OAM_set shadow_oam, 0, 0, 0, 0, 1, 3 82 | 83 | lda SFX_tick 84 | ror 85 | ror 86 | and #$0c 87 | tay 88 | lda z:SFX_mouse2+MOUSE_data::cursor_y 89 | ldx z:SFX_mouse2+MOUSE_data::cursor_x 90 | OAM_set shadow_oam, 1, 0, 0, 0, 1, 3 91 | 92 | ;Copy shadow OAM 93 | OAM_memcpy shadow_oam 94 | 95 | rtl 96 | 97 | ;------------------------------------------------------------------------------- 98 | .segment "LORAM" 99 | shadow_oam: .res 512+32 100 | 101 | ;------------------------------------------------------------------------------- 102 | 103 | ;Import graphics 104 | .segment "RODATA" 105 | incbin Palette, "Data/SNES.png.palette" 106 | incbin Tiles, "Data/SNES.png.tiles.lz4" 107 | incbin Map, "Data/SNES.png.map.lz4" 108 | 109 | incbin Sprites, "Data/Sprites.png.tiles.lz4" 110 | incbin Palette_spr, "Data/Sprites.png.palette" 111 | 112 | ;Import music 113 | .define spc_file "Data/Music.spc" 114 | .segment "RODATA" 115 | SPC_State: SPC_incbin_state spc_file 116 | .segment "ROM2" 117 | SPC_Image_Lo: SPC_incbin_lo spc_file 118 | .segment "ROM3" 119 | SPC_Image_Hi: SPC_incbin_hi spc_file 120 | -------------------------------------------------------------------------------- /examples/Mouse/OAM.i: -------------------------------------------------------------------------------- 1 | .ifndef ::__SNIPPETS_OAM__ 2 | ::__SNIPPETS_OAM__ = 1 3 | 4 | /** 5 | OAM_set 6 | Set values for OAM entry in RAM 7 | 8 | NB! It's very inefficient to set OAM entries one by one like this. 9 | Only viable for simple proof of concept scenarios. 10 | 11 | Parameters: 12 | >:in: xpos X position (9 bits) x 13 | >:in: ypos Y position (8 bits) a 14 | >:in: tile Tile index (9 bits) y 15 | >:in: table Table address (uint24) constant 16 | >:in: entry Table entry (8 bits) constant 17 | >:in?: xflip X-flip bit constant 18 | >:in?: yflip Y-flip bit constant 19 | >:in?: size Size bit constant 20 | >:in?: prio Priority (2 bits) constant 21 | */ 22 | .macro OAM_set table, entry, palette, xflip, yflip, size, prio 23 | sta a:.loword((table + (entry << 2)) + 1) 24 | tya 25 | sta a:.loword((table + (entry << 2)) + 2) 26 | xba 27 | asl 28 | rol 29 | ora #.lobyte(((palette & $7) << 1) | ((prio & $3) << 4) | ((yflip & $1) << 6) | ((xflip & $1) << 7)) 30 | sta a:.loword((table + (entry << 2)) + 3) 31 | txa 32 | sta a:.loword((table + (entry << 2)) + 0) 33 | 34 | lda #.lobyte(~($3 << ((entry & 3) * 2))) 35 | and a:.loword(table + 512 + (entry >> 4)) 36 | sta a:.loword(table + 512 + (entry >> 4)) 37 | xba 38 | and #1 39 | ora #(size << 1) 40 | .repeat (entry & 3) 41 | asl 42 | asl 43 | .endrepeat 44 | ora a:.loword(table + 512 + (entry >> 4)) 45 | sta a:.loword(table + 512 + (entry >> 4)) 46 | .endmac 47 | 48 | .endif; __SNIPPETS_OAM__ 49 | -------------------------------------------------------------------------------- /examples/Mouse/libSFX.cfg: -------------------------------------------------------------------------------- 1 | ; libSFX Custom Configuration 2 | 3 | ;-------------------------------------------------------------------- 4 | ;ROM Header 5 | 6 | ;Title (21 chars) 7 | ; "123456789012345678901" 8 | define "ROM_TITLE", "MOUSE+JOYPAD=HARMONY!" 9 | 10 | ;Enable joypad and mice in both ports 11 | SFX_JOY = JOY1 | JOY2 12 | SFX_MOUSE = MOUSE1 | MOUSE2 13 | -------------------------------------------------------------------------------- /examples/SMP-Test/Makefile: -------------------------------------------------------------------------------- 1 | # Name 2 | name := SMP-Test 3 | debug := 1 4 | 5 | run_args := --show-debugger --break-on-wdm 6 | breakpoints := SMP-Test:@xbr SMP-Play:@xbr:x:smp SMP-Play:@rwbr:rw:smp 7 | 8 | # Use packages 9 | libsfx_packages := LZ4 10 | 11 | # SMP sub-projects 12 | smp_overlays := SMP-Play SMP-Nop 13 | 14 | # Example of custom options for derived files 15 | SMP-Play/Data/Sample2.brr: brrflags = -rs1.2 -g 16 | 17 | # Derived data files 18 | derived_files := SMP-Play/Data/Sample1.brr SMP-Play/Data/Sample2.brr 19 | 20 | # Explicit cleanup 21 | clean_files := SMP-Play-ZP.bin 22 | 23 | # Include libSFX.make 24 | libsfx_dir := ../.. 25 | include $(libsfx_dir)/libSFX.make 26 | -------------------------------------------------------------------------------- /examples/SMP-Test/Map.cfg: -------------------------------------------------------------------------------- 1 | # libSFX Memory Map (Mode 20 "LoROM" mapping with 8*32kB banks) 2 | # David Lindecrantz 3 | 4 | # Using a custom config here to make sure that S-CPU and S-SMP maps do not interfere 5 | 6 | SYMBOLS { 7 | __STACKSIZE__: type = weak, value = $100; 8 | __ZPADSIZE__: type = weak, value = $10; 9 | __ZNMISIZE__: type = weak, value = $10; 10 | __RPADSIZE__: type = weak, value = $100; 11 | } 12 | 13 | MEMORY { 14 | ZPAD: start = $000000, size = __ZPADSIZE__, define = yes; 15 | ZNMI: start = __ZPADSIZE__, size = __ZNMISIZE__, define = yes; 16 | ZPAGE: start = __ZPADSIZE__ + __ZNMISIZE__, size = $100 - (__ZPADSIZE__ + __ZNMISIZE__), define = yes; 17 | LORAM: start = $000100, size = $1f00 - __STACKSIZE__, define = yes; 18 | STACK: start = $002000 - __STACKSIZE__, size = __STACKSIZE__, define = yes; 19 | HIRAM: start = $7e2000, size = $e000, define = yes; 20 | EXRAM: start = $7f0000, size = $10000, define = yes; 21 | 22 | ROM0: start = $808000, size = $8000, fill = yes, fillval = $ff; 23 | ROM1: start = $818000, size = $8000, fill = yes, fillval = $ff; 24 | ROM2: start = $828000, size = $8000, fill = yes, fillval = $ff; 25 | ROM3: start = $838000, size = $8000, fill = yes, fillval = $ff; 26 | ROM4: start = $838000, size = $8000, fill = yes, fillval = $ff; 27 | ROM5: start = $838000, size = $8000, fill = yes, fillval = $ff; 28 | ROM6: start = $838000, size = $8000, fill = yes, fillval = $ff; 29 | ROM7: start = $838000, size = $8000, fill = yes, fillval = $ff; 30 | 31 | SMPZPAGE: start = $0002, size = $00ee; 32 | SMPMMIO: start = $00f0, size = $0010; 33 | SMPSTACK: start = $0100, size = $0100; 34 | SMPRAM: start = $0200, size = $fdc0; 35 | } 36 | 37 | SEGMENTS { 38 | ZPAD: load = ZPAD, type = zp, optional = yes; 39 | ZNMI: load = ZNMI, type = zp, optional = yes; 40 | ZEROPAGE: load = ZPAGE, type = zp, optional = yes; 41 | BSS: load = LORAM, type = bss, optional = yes; 42 | LORAM: load = LORAM, type = bss, optional = yes; 43 | HIRAM: load = HIRAM, type = bss, optional = yes; 44 | EXRAM: load = EXRAM, type = bss, optional = yes; 45 | 46 | CODE: load = ROM0, type = ro; 47 | RODATA: load = ROM0, type = ro; 48 | LIBSFX: load = ROM0, type = ro, optional = yes; 49 | LIBSFX_PKG: load = ROM0, type = ro, optional = yes; 50 | LIBSFX_SMP: load = ROM0, type = rw, run = SMPZPAGE, optional = yes, define = yes; 51 | SMPCODE: load = ROM0, type = rw, run = SMPRAM, optional = yes, define = yes; 52 | HEADER: load = ROM0, type = ro, start = $80ffb0; 53 | VECTORS: load = ROM0, type = ro, start = $80ffe0; 54 | 55 | ROM1: load = ROM1, type = ro, optional = yes; 56 | ROM2: load = ROM2, type = ro, optional = yes; 57 | ROM3: load = ROM3, type = ro, optional = yes; 58 | ROM4: load = ROM3, type = ro, optional = yes; 59 | ROM5: load = ROM3, type = ro, optional = yes; 60 | ROM6: load = ROM3, type = ro, optional = yes; 61 | ROM7: load = ROM3, type = ro, optional = yes; 62 | 63 | SMPZPAGE: load = SMPZPAGE, type = zp, optional = yes; 64 | SMPRAM: load = SMPRAM, type = bss, optional = yes; 65 | } 66 | -------------------------------------------------------------------------------- /examples/SMP-Test/Normal.s700: -------------------------------------------------------------------------------- 1 | .include "libSFX.i" 2 | 3 | .segment "SMPCODE" 4 | 5 | Normal: 6 | nop 7 | nop 8 | SMP_exit 9 | 10 | .byte "This should assemble in S-SCPU space" 11 | -------------------------------------------------------------------------------- /examples/SMP-Test/SMP-Nop/Test.s700: -------------------------------------------------------------------------------- 1 | .include "libSFX.i" 2 | 3 | .segment "CODE" 4 | 5 | Nothing: 6 | nop 7 | nop 8 | SMP_exit 9 | 10 | .byte "Nothing to see here" 11 | -------------------------------------------------------------------------------- /examples/SMP-Test/SMP-Play/Data/Sample1.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/examples/SMP-Test/SMP-Play/Data/Sample1.wav -------------------------------------------------------------------------------- /examples/SMP-Test/SMP-Play/Data/Sample2.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/examples/SMP-Test/SMP-Play/Data/Sample2.wav -------------------------------------------------------------------------------- /examples/SMP-Test/SMP-Play/Directory.s700: -------------------------------------------------------------------------------- 1 | .include "libSFX.i" 2 | 3 | .export Directory 4 | 5 | .segment "DATA" 6 | sample1: 7 | sample1_loop: 8 | .incbin "Data/Sample1.brr" 9 | 10 | sample2: 11 | sample2_loop: 12 | .incbin "Data/Sample2.brr" 13 | 14 | .segment "DIR" 15 | Directory: 16 | .word sample1, sample1_loop 17 | .word sample2, sample2_loop 18 | -------------------------------------------------------------------------------- /examples/SMP-Test/SMP-Play/Play.s700: -------------------------------------------------------------------------------- 1 | .include "libSFX.i" 2 | .import Directory 3 | 4 | ;------------------------------------------------------------------------------- 5 | .segment "MAIN" 6 | 7 | ;Init 8 | ;The MAIN segment should be linked before CODE, BSS, etc 9 | ;So if used only once it should be guaranteed to be linked at $0200 10 | 11 | DSP_set FLG, #$20 12 | DSP_set KON, #$00 13 | DSP_set KOF, #$FF 14 | DSP_set DIR, #>Directory 15 | DSP_set KOF, #00 16 | DSP_set NON, #00 17 | DSP_set EON, #00 18 | DSP_set MVOLL, #$7F 19 | DSP_set MVOLR, #$7F 20 | DSP_set EVOLL, #00 21 | DSP_set EVOLR, #00 22 | 23 | DSP_set V0SRCN, #$00 24 | DSP_set V0VOLL, #$7f 25 | DSP_set V0VOLR, #$7f 26 | DSP_set V0GAIN, #$7f 27 | 28 | DSP_set V1SRCN, #$00 29 | DSP_set V1VOLL, #$4f 30 | DSP_set V1VOLR, #$1f 31 | DSP_set V1GAIN, #$7f 32 | 33 | DSP_set V2SRCN, #$00 34 | DSP_set V2VOLL, #$10 35 | DSP_set V2VOLR, #$2f 36 | DSP_set V2GAIN, #$7f 37 | 38 | ;Test zeropage addressing 39 | @xbr1: 40 | mov ZP_test, #$7f 41 | mov ZP_ptr, #Directory 43 | movw ya, ZP_ptr 44 | 45 | ;Play sample 46 | DSP_set V0PITCHL, #<(3000) 47 | DSP_set V0PITCHH, #>(3000) 48 | DSP_set V1PITCHL, #<(2600) 49 | DSP_set V1PITCHH, #>(2600) 50 | DSP_set V2PITCHL, #<(2500) 51 | DSP_set V2PITCHH, #>(2500) 52 | DSP_set KON, #7 53 | 54 | mov y, #$a0 55 | call !wait 56 | 57 | ;Play another sample 58 | @xbr2: 59 | DSP_set V0SRCN, #$01 60 | DSP_set KON, #1 61 | 62 | mov y, #$50 63 | call !wait 64 | 65 | SMP_exit 66 | 67 | wait: 68 | mov x, #$ff 69 | : nop 70 | nop 71 | nop 72 | dec x 73 | bne :- 74 | dec y 75 | bne :- 76 | ret 77 | 78 | ;------------------------------------------------------------------------------- 79 | .segment "ZEROPAGE" 80 | ZP_test: .res 1 81 | ZP_ptr: .res 2 82 | 83 | .segment "ZPDATA" 84 | ZP_data: 85 | .byte "Zero!" 86 | -------------------------------------------------------------------------------- /examples/SMP-Test/SMP-Play/SMP-Map.cfg: -------------------------------------------------------------------------------- 1 | # libSFX SCP700 Memory Map 2 | # David Lindecrantz 3 | 4 | # Testing SMP map override 5 | 6 | MEMORY { 7 | ZP: start = $0002, size = $00ee, file = "SMP-Play-ZP.bin"; 8 | MMIO: start = $00f0, size = $0010; 9 | STACK: start = $0100, size = $0100; 10 | RAM: start = $0200, size = $fdc0, file = "%O"; 11 | } 12 | 13 | SEGMENTS { 14 | ZPDATA: load = ZP, type = ro; 15 | ZEROPAGE: load = ZP, type = zp; 16 | MAIN: load = RAM, type = rw, define = yes; 17 | BSS: load = RAM, type = bss, define = yes; 18 | CODE: load = RAM, type = rw, define = yes; 19 | DATA: load = RAM, type = ro, define = yes; 20 | DIR: load = RAM, type = ro, align=$100, optional = yes, define = yes; 21 | } 22 | -------------------------------------------------------------------------------- /examples/SMP-Test/SMP-Test.s: -------------------------------------------------------------------------------- 1 | ; SMP-Test 2 | ; David Lindecrantz 3 | ; 4 | ; Test for the smp_overlays build feature 5 | 6 | .include "libSFX.i" 7 | 8 | Main: 9 | ;Execute SMP payloads in sequence 10 | SMP_exec SMP_RAM, SMP_nop, sizeof_SMP_nop, SMP_RAM 11 | SMP_exec SMP_RAM, SMP_play, sizeof_SMP_play, SMP_RAM 12 | break 13 | SMP_exec SMP_RAM, SMP_nop, sizeof_SMP_nop, SMP_RAM 14 | @xbr: 15 | SMP_exec SMP_RAM, SMP_play, sizeof_SMP_play, SMP_RAM 16 | 17 | ;Turn on screen 18 | CGRAM_setcolor_rgb 0, 31,7,31 19 | 20 | lda #inidisp(ON, DISP_BRIGHTNESS_MAX) 21 | sta SFX_inidisp 22 | VBL_on 23 | 24 | ;Execute SMP payloads in sequence, forever 25 | SMP_memcpy $02, SMP_zp, sizeof_SMP_zp 26 | : SMP_exec SMP_RAM, SMP_play, sizeof_SMP_play, SMP_RAM 27 | SMP_exec SMP_RAM, SMP_nop, sizeof_SMP_nop, SMP_RAM 28 | bra :- 29 | 30 | .segment "RODATA" 31 | incbin SMP_play, "SMP-Play.bin" 32 | incbin SMP_nop, "SMP-Nop.bin" 33 | incbin SMP_zp, "SMP-Play-ZP.bin" 34 | -------------------------------------------------------------------------------- /examples/SMP-Test/libSFX.cfg: -------------------------------------------------------------------------------- 1 | ; libSFX Configuration 2 | ; David Lindecrantz 3 | 4 | ;------------------------------------------------------------------------------- 5 | ;ROM Header 6 | 7 | ;Title (21 chars) 8 | ; "123456789012345678901" 9 | define "ROM_TITLE", "THE SPC700 MEGA SHOCK" 10 | 11 | ;ROM map mode (4 bits) 12 | ;Make sure that Map.cfg corresponds to the map mode selected 13 | ; Common modes: 14 | ; $0 = Mode 20/30 (32k/bank Mode 20 "LoROM" mapping) 15 | ; $1 = Mode 21/31 (64k/bank Mode 21 "HiROM" mapping) 16 | ROM_MAPMODE = $0 17 | 18 | ;ROM Size 19 | ;Make sure that Map.cfg corresponds to the ROM size selected 20 | ; $07 = 1 Mbit (128 kB) 21 | ; $08 = 2 Mbit (256 kB) 22 | ; $09 = 4 Mbit (512 kB) 23 | ; $0a = 8 Mbit (1 MB) 24 | ; $0b = 16 Mbit (2 MB) 25 | ; $0c = 32 Mbit (4 MB) 26 | ROM_ROMSIZE = $06 27 | -------------------------------------------------------------------------------- /examples/SixteenMegaPower/Makefile: -------------------------------------------------------------------------------- 1 | # Name 2 | name := SixteenMegaPower 3 | debug := 1 4 | 5 | # Stack space allocated from $2000 and downwards 6 | stack_size := 200 7 | 8 | # Set custom dir for intermediate build files 9 | obj_dir := _build_ 10 | 11 | # Include libSFX.make 12 | libsfx_dir := ../.. 13 | include $(libsfx_dir)/libSFX.make 14 | -------------------------------------------------------------------------------- /examples/SixteenMegaPower/SixteenMegaPower.s: -------------------------------------------------------------------------------- 1 | ; SixteenMegaPower 2 | ; David Lindecrantz 3 | ; 4 | ; Example showing: 5 | ; - Customized memory map (Map.cfg) 6 | ; - Customized libSFX.cfg 7 | ; - Customized Makefile 8 | ; - Calling out to code in other source file 9 | ; - Nothing on screen! 10 | 11 | .include "libSFX.i" 12 | 13 | Main: 14 | jsr InitScreen ;Jump to subroutine defined elsewhere 15 | VBL_on ;Turn on vblank interrupt 16 | 17 | : wai 18 | bra :- 19 | -------------------------------------------------------------------------------- /examples/SixteenMegaPower/Subfolders/With/Code.s: -------------------------------------------------------------------------------- 1 | .include "libSFX.i" 2 | 3 | .export InitScreen 4 | 5 | InitScreen: 6 | CGRAM_setcolor_rgb 0, 7,31,31 ;Set color 0 7 | 8 | lda #$0f ;Turn on screen 9 | sta SFX_inidisp 10 | 11 | rts 12 | -------------------------------------------------------------------------------- /examples/SixteenMegaPower/libSFX.cfg: -------------------------------------------------------------------------------- 1 | ; libSFX Custom Configuration 2 | 3 | ;-------------------------------------------------------------------- 4 | ;ROM Header 5 | 6 | ;Title (21 chars) 7 | ; "123456789012345678901" 8 | define "ROM_TITLE", "16 MEGA PRO-GEAR SPEC" 9 | 10 | ;ROM map mode (4 bits) 11 | ; Common modes: 12 | ; $0 = Mode 20 (32k/bank "LoROM" mapping) 13 | ; $1 = Mode 21 (64k/bank "HiROM" mapping) 14 | ROM_MAPMODE = $0 15 | 16 | ;Chipset (2 bytes) 17 | ; $00 = ROM 18 | ; $01 = ROM+RAM 19 | ; $02 = ROM+SRAM 20 | ; $03 = ROM+DSP 21 | ; $04 = ROM+DSP+RAM 22 | ; $05 = ROM+DSP+SRAM 23 | ; $13 = ROM+GSU 24 | ; $14 = ROM+GSU+RAM 25 | ; $15 = ROM+GSU+SRAM 26 | ; $33 = ROM+SA1 27 | ; $34 = ROM+SA1+RAM 28 | ; $35 = ROM+SA1+SRAM 29 | ; $10f3 = ROM+CX4 30 | ROM_CHIPSET = $02 31 | 32 | ;ROM Size 33 | ; $07 = 1 Mbit (128 kB) 34 | ; $08 = 2 Mbit (256 kB) 35 | ; $09 = 4 Mbit (512 kB) 36 | ; $0a = 8 Mbit (1 MB) 37 | ; $0b = 16 Mbit (2 MB) 38 | ; $0c = 32 Mbit (4 MB) 39 | ROM_ROMSIZE = $0b 40 | 41 | ;RAM Size 42 | ; $00 = None 43 | ; $01 = 16 Kbit (2 kB) 44 | ; $02 = 32 Kbit (4 kB) 45 | ; $03 = 64 Kbit (8 kB) 46 | ; $04 = 128 Kbit (16 kB) 47 | ; $05 = 256 Kbit (32 kB) 48 | ; ...etc 49 | ROM_RAMSIZE = $05 50 | 51 | -------------------------------------------------------------------------------- /examples/Template-Mode21/Makefile: -------------------------------------------------------------------------------- 1 | # Name 2 | name := Template-Mode21 3 | 4 | # Include libSFX.make 5 | libsfx_dir := ../.. 6 | include $(libsfx_dir)/libSFX.make 7 | -------------------------------------------------------------------------------- /examples/Template-Mode21/Map.cfg: -------------------------------------------------------------------------------- 1 | # libSFX Memory Map (Mode 21 "HiROM" mapping with 2*64kB banks) 2 | # David Lindecrantz 3 | 4 | SYMBOLS { 5 | __STACKSIZE__: type = weak, value = $100; 6 | __ZPADSIZE__: type = weak, value = $10; 7 | __ZNMISIZE__: type = weak, value = $10; 8 | __RPADSIZE__: type = weak, value = $100; 9 | } 10 | 11 | MEMORY { 12 | ZPAD: start = $000000, size = __ZPADSIZE__, define = yes; 13 | ZNMI: start = __ZPADSIZE__, size = __ZNMISIZE__, define = yes; 14 | ZPAGE: start = __ZPADSIZE__ + __ZNMISIZE__, size = $100 - (__ZPADSIZE__ + __ZNMISIZE__), define = yes; 15 | LORAM: start = $000100, size = $1f00 - __STACKSIZE__, define = yes; 16 | STACK: start = $002000 - __STACKSIZE__, size = __STACKSIZE__, define = yes; 17 | HIRAM: start = $7e2000, size = $e000, define = yes; 18 | EXRAM: start = $7f0000, size = $10000, define = yes; 19 | 20 | ROM0: start = $c00000, size = $10000, fill = yes, fillval = $ff; 21 | ROM1: start = $c10000, size = $10000, fill = yes, fillval = $ff; 22 | 23 | SMPZPAGE: start = $0002, size = $00ee; 24 | SMPMMIO: start = $00f0, size = $0010; 25 | SMPSTACK: start = $0100, size = $0100; 26 | SMPRAM: start = $0200, size = $fdc0; 27 | } 28 | 29 | SEGMENTS { 30 | ZPAD: load = ZPAD, type = zp, optional = yes; 31 | ZNMI: load = ZNMI, type = zp, optional = yes; 32 | ZEROPAGE: load = ZPAGE, type = zp, optional = yes; 33 | BSS: load = LORAM, type = bss, optional = yes; 34 | LORAM: load = LORAM, type = bss, optional = yes; 35 | HIRAM: load = HIRAM, type = bss, optional = yes; 36 | EXRAM: load = EXRAM, type = bss, optional = yes; 37 | 38 | CODE: load = ROM0, type = ro; 39 | RODATA: load = ROM0, type = ro; 40 | LIBSFX: load = ROM0, type = ro, start = $c08000, optional = yes; 41 | LIBSFX_PKG: load = ROM0, type = ro, optional = yes; 42 | LIBSFX_SMP: load = ROM0, type = rw, run = SMPZPAGE, optional = yes, define = yes; 43 | SMPCODE: load = ROM0, type = rw, run = SMPRAM, optional = yes, define = yes; 44 | HEADER: load = ROM0, type = ro, start = $c0ffb0; 45 | VECTORS: load = ROM0, type = ro, start = $c0ffe0; 46 | 47 | ROM1: load = ROM1, type = ro, optional = yes; 48 | 49 | SMPZPAGE: load = SMPZPAGE, type = zp, optional = yes; 50 | SMPRAM: load = SMPRAM, type = bss, optional = yes; 51 | } 52 | -------------------------------------------------------------------------------- /examples/Template-Mode21/Template-Mode21.s: -------------------------------------------------------------------------------- 1 | .include "libSFX.i" 2 | 3 | Main: 4 | ;libSFX calls Main after CPU/PPU registers, memory and interrupt handlers are initialized. 5 | 6 | ;Set color 0 7 | CGRAM_setcolor_rgb 0, 7,31,31 8 | 9 | ;Turn on screen 10 | ;The vblank interrupt handler will copy the value in SFX_inidisp to INIDISP ($2100) 11 | lda #inidisp(ON, DISP_BRIGHTNESS_MAX) 12 | sta SFX_inidisp 13 | 14 | ;Turn on vblank interrupt 15 | VBL_on 16 | 17 | : wai 18 | bra :- 19 | -------------------------------------------------------------------------------- /examples/Template-Mode21/libSFX.cfg: -------------------------------------------------------------------------------- 1 | ; libSFX Custom Configuration 2 | 3 | ;------------------------------------------------------------------------------- 4 | ;ROM Header 5 | 6 | ;Title (21 chars) 7 | ; "123456789012345678901" 8 | define "ROM_TITLE", "64KBSHOCK!HIROMSHOCK!" 9 | 10 | ;ROM map mode (4 bits) 11 | ;Make sure that Map.cfg corresponds to the map mode selected 12 | ; Common modes: 13 | ; $0 = Mode 20/30 (32k/bank "LoROM" mapping) 14 | ; $1 = Mode 21/31 (64k/bank "HiROM" mapping) 15 | ROM_MAPMODE = $1 16 | 17 | ;ROM Size 18 | ;Make sure that Map.cfg corresponds to the ROM size selected 19 | ; $07 = 1 Mbit (128 kB) 20 | ; $08 = 2 Mbit (256 kB) 21 | ; $09 = 4 Mbit (512 kB) 22 | ; $0a = 8 Mbit (1 MB) 23 | ; $0b = 16 Mbit (2 MB) 24 | ; $0c = 32 Mbit (4 MB) 25 | ROM_ROMSIZE = $07 26 | -------------------------------------------------------------------------------- /examples/Template/Makefile: -------------------------------------------------------------------------------- 1 | # Name 2 | name := Template 3 | debug := 0 4 | 5 | # Include libSFX.make 6 | libsfx_dir := ../.. 7 | include $(libsfx_dir)/libSFX.make 8 | -------------------------------------------------------------------------------- /examples/Template/Template.s: -------------------------------------------------------------------------------- 1 | .include "libSFX.i" 2 | 3 | Main: 4 | ;libSFX calls Main after CPU/PPU registers, memory and interrupt handlers are initialized. 5 | 6 | ;Set color 0 7 | CGRAM_setcolor_rgb 0, 7,31,31 8 | 9 | ;Turn on screen 10 | ;The vblank interrupt handler will copy the value in SFX_inidisp to INIDISP ($2100) 11 | lda #inidisp(ON, DISP_BRIGHTNESS_MAX) 12 | sta SFX_inidisp 13 | 14 | ;Turn on vblank interrupt 15 | VBL_on 16 | 17 | : wai 18 | bra :- 19 | -------------------------------------------------------------------------------- /examples/X-GSU/Makefile: -------------------------------------------------------------------------------- 1 | # Name 2 | name := SuperFX 3 | debug := 1 4 | 5 | # Include libSFX.make 6 | libsfx_dir := ../.. 7 | include $(libsfx_dir)/libSFX.make 8 | -------------------------------------------------------------------------------- /examples/X-GSU/Map.cfg: -------------------------------------------------------------------------------- 1 | # libSFX Memory Map (Mode 20 "LoROM" mapping with 4*32kB banks and GSU segment) 2 | # David Lindecrantz 3 | 4 | SYMBOLS { 5 | __STACKSIZE__: type = weak, value = $100; 6 | __ZPADSIZE__: type = weak, value = $10; 7 | __ZNMISIZE__: type = weak, value = $10; 8 | __RPADSIZE__: type = weak, value = $100; 9 | } 10 | 11 | MEMORY { 12 | ZPAD: start = $000000, size = __ZPADSIZE__, define = yes; 13 | ZNMI: start = __ZPADSIZE__, size = __ZNMISIZE__, define = yes; 14 | ZPAGE: start = __ZPADSIZE__ + __ZNMISIZE__, size = $100 - (__ZPADSIZE__ + __ZNMISIZE__), define = yes; 15 | LORAM: start = $000100, size = $1f00 - __STACKSIZE__, define = yes; 16 | STACK: start = $002000 - __STACKSIZE__, size = __STACKSIZE__, define = yes; 17 | SRAM: start = $700000, size = $8000, define = yes; 18 | HIRAM: start = $7e2000, size = $e000, define = yes; 19 | EXRAM: start = $7f0000, size = $10000, define = yes; 20 | 21 | ROM0: start = $808000, size = $8000, fill = yes, fillval = $ff; 22 | ROM1: start = $818000, size = $8000, fill = yes, fillval = $ff; 23 | ROM2: start = $828000, size = $8000, fill = yes, fillval = $ff; 24 | ROM3: start = $838000, size = $8000, fill = yes, fillval = $ff; 25 | 26 | SMPZPAGE: start = $0002, size = $00ee; 27 | SMPMMIO: start = $00f0, size = $0010; 28 | SMPSTACK: start = $0100, size = $0100; 29 | SMPRAM: start = $0200, size = $fdc0; 30 | } 31 | 32 | SEGMENTS { 33 | ZPAD: load = ZPAD, type = zp, optional = yes; 34 | ZNMI: load = ZNMI, type = zp, optional = yes; 35 | ZEROPAGE: load = ZPAGE, type = zp, optional = yes; 36 | BSS: load = LORAM, type = bss, optional = yes; 37 | LORAM: load = LORAM, type = bss, optional = yes; 38 | HIRAM: load = HIRAM, type = bss, optional = yes; 39 | EXRAM: load = EXRAM, type = bss, optional = yes; 40 | 41 | CODE: load = ROM0, type = ro; 42 | RODATA: load = ROM0, type = ro; 43 | LIBSFX: load = ROM0, type = ro, optional = yes; 44 | LIBSFX_PKG: load = ROM0, type = ro, optional = yes; 45 | LIBSFX_SMP: load = ROM0, type = rw, run = SMPZPAGE, optional = yes, define = yes; 46 | SMPCODE: load = ROM0, type = rw, run = SMPRAM, optional = yes, define = yes; 47 | GSUCODE: load = ROM0, type = rw, run = SRAM, optional = yes, define = yes; 48 | HEADER: load = ROM0, type = ro, start = $80ffb0; 49 | VECTORS: load = ROM0, type = ro, start = $80ffe0; 50 | 51 | ROM1: load = ROM1, type = ro, optional = yes; 52 | ROM2: load = ROM2, type = ro, optional = yes; 53 | ROM3: load = ROM3, type = ro, optional = yes; 54 | 55 | SMPZPAGE: load = SMPZPAGE, type = zp, optional = yes; 56 | SMPRAM: load = SMPRAM, type = bss, optional = yes; 57 | } 58 | -------------------------------------------------------------------------------- /examples/X-GSU/SuperFX.s: -------------------------------------------------------------------------------- 1 | ; SuperFX 2 | ; David Lindecrantz 3 | ; 4 | ; For now this merely gets code running on the GSU 5 | 6 | .include "libSFX.i" 7 | 8 | Main: 9 | ;Copy GSU code 10 | memcpy GSU_SRAM, __GSUCODE_LOAD__, __GSUCODE_SIZE__ 11 | 12 | ;Configure GSU 13 | lda #$70 14 | sta GSU_PBR 15 | lda #$10 16 | sta GSU_SCBR 17 | lda #%00001000 18 | sta GSU_SCMR 19 | lda #%10000000 20 | sta GSU_CFGR 21 | lda #$00 22 | sta GSU_CLSR 23 | 24 | ;Start GSU 25 | break 26 | ldx __GSUCODE_RUN__ 27 | stx GSU_R15 28 | 29 | ;Turn on screen 30 | CGRAM_setcolor_rgb 0, 31,7,31 31 | 32 | lda #inidisp(ON, DISP_BRIGHTNESS_MAX) 33 | sta SFX_inidisp 34 | VBL_on 35 | 36 | : wai 37 | bra :- 38 | -------------------------------------------------------------------------------- /examples/X-GSU/SuperFX.sgs: -------------------------------------------------------------------------------- 1 | ; SuperFX 2 | ; David Lindecrantz 3 | ; 4 | ; Noperator-GS1 5 | 6 | .include "libSFX.i" 7 | 8 | .segment "GSUCODE" 9 | 10 | GSU_Code: 11 | nop 12 | nop 13 | alt1 14 | nop 15 | alt2 16 | nop 17 | nop 18 | alt3 19 | nop 20 | stop 21 | -------------------------------------------------------------------------------- /examples/X-GSU/libSFX.cfg: -------------------------------------------------------------------------------- 1 | ; libSFX Configuration 2 | ; David Lindecrantz 3 | 4 | ;------------------------------------------------------------------------------- 5 | ;ROM Header 6 | 7 | ;Title (21 chars) 8 | ; "123456789012345678901" 9 | define "ROM_TITLE", "PLAY WITH MARIO POWER" 10 | 11 | ;ROM map mode (4 bits) 12 | ;Make sure that Map.cfg corresponds to the map mode selected 13 | ; Common modes: 14 | ; $0 = Mode 20/30 (32k/bank Mode 20 "LoROM" mapping) 15 | ; $1 = Mode 21/31 (64k/bank Mode 21 "HiROM" mapping) 16 | ROM_MAPMODE = $0 17 | 18 | ;ROM speed (1 bit) 19 | ; $0 = Slow (200ns access) 20 | ; $1 = Fast (120ns access) 21 | ROM_SPEED = $0 22 | 23 | ;Chipset (2 bytes) 24 | ; $00 = ROM 25 | ; $01 = ROM+RAM 26 | ; $02 = ROM+SRAM 27 | ; $03 = ROM+DSP 28 | ; $04 = ROM+DSP+RAM 29 | ; $05 = ROM+DSP+SRAM 30 | ; $13 = ROM+GSU 31 | ; $14 = ROM+GSU+RAM 32 | ; $15 = ROM+GSU+SRAM 33 | ; $33 = ROM+SA1 34 | ; $34 = ROM+SA1+RAM 35 | ; $35 = ROM+SA1+SRAM 36 | ; $10f3 = ROM+CX4 37 | ROM_CHIPSET = $14 38 | 39 | ;ROM Size 40 | ;Make sure that Map.cfg corresponds to the ROM size selected 41 | ; $07 = 1 Mbit (128 kB) 42 | ; $08 = 2 Mbit (256 kB) 43 | ; $09 = 4 Mbit (512 kB) 44 | ; $0a = 8 Mbit (1 MB) 45 | ; $0b = 16 Mbit (2 MB) 46 | ; $0c = 32 Mbit (4 MB) 47 | ROM_ROMSIZE = $07 48 | 49 | ;Expansion RAM Size 50 | ; $00 = None 51 | ; $01 = 16 Kbit (2 kB) 52 | ; $02 = 32 Kbit (4 kB) 53 | ; $03 = 64 Kbit (8 kB) 54 | ; $04 = 128 Kbit (16 kB) 55 | ; $05 = 256 Kbit (32 kB) 56 | ; ...etc 57 | ROM_EXPRAMSIZE = $05 58 | -------------------------------------------------------------------------------- /extras/Ideas.md: -------------------------------------------------------------------------------- 1 | #Ideas for possible additions to libSFX code/macro library 2 | 3 | 4 | ##Automate tests 5 | Build, invoke emulator, dump RAM and diff against known good output..? 6 | 7 | 8 | ##Decent PRG 9 | Go for pcg-random or settle for something simpler? 10 | 11 | 12 | ##Graphics pipeline 13 | Make "SuperFamiconv" public and usable... :) 14 | Or maybe integrate one of the existing and working python scripts instead. 15 | 16 | 17 | ##Move "meta-instruction" 18 | Probably not a good idea after all, since while debugging code it will look too different from source. 19 | 20 | Registers: 21 | a 22 | x 23 | y 24 | d Direct page 25 | db Data bank 26 | pb Program bank 27 | s Stack 28 | 29 | 30 | ;Register to register move 31 | move a, x ;tax 32 | move a, y ;tay 33 | move x, a ;txa 34 | move y, a ;tya 35 | move x, y ;txy 36 | move y, x ;tyx 37 | 38 | move a, d ;tcd 39 | move x, d ;phx pld 40 | move y, d ;phy pld 41 | move d, a ;tdc 42 | move d, x ;phd plx 43 | move d, y ;phd ply 44 | 45 | move a, db ;pha plb 46 | move db, a ;phb pla 47 | 48 | 49 | ;Move to stack (implicit pre-decrement) 50 | move a, s ;pha 51 | move x, s ;phx 52 | move y, s ;phy 53 | move d, s ;phd 54 | move db, s ;phb 55 | move pb, s ;phk 56 | 57 | move #$aabb, s ;pea #$aabb 58 | move ($20), s ;pei ($20) 59 | move label, s ;per label 60 | 61 | ;Move from stack (implicit post-increment) 62 | move s, a ;pla 63 | move s, x ;plx 64 | move s, y ;ply 65 | move s, d ;pld 66 | move s, db ;plb 67 | 68 | ;Immediate 69 | move #$ca, a ;lda #$ca 70 | move #$c0d3, x ;ldx #$c0d3 71 | 72 | move $4000, a ;lda $4000 73 | move a, $4000 ;sta $4000 74 | 75 | move a:$4000, a ;lda a:$4000 76 | move a, z:$40 ;sta z:$40 77 | 78 | move a, $4000+x ;sta $4000,x 79 | move $6000+y, a ;lda $6000,y 80 | 81 | move a, f:$804000+x ;sta f:$804000,x 82 | 83 | move ($40)+y, a ;lda ($40),y 84 | move ($40+x), a ;lda ($40,x) 85 | 86 | ;Stack relative 87 | move s+3, a ;lda 3,s 88 | move (s+3)+y, a ;lda (3,s),y 89 | -------------------------------------------------------------------------------- /extras/NaturalDocs/bin/License.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/extras/NaturalDocs/bin/License.txt -------------------------------------------------------------------------------- /extras/NaturalDocs/bin/Modules/NaturalDocs/BinaryFile.pm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/extras/NaturalDocs/bin/Modules/NaturalDocs/BinaryFile.pm -------------------------------------------------------------------------------- /extras/NaturalDocs/bin/Modules/NaturalDocs/Builder.pm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/extras/NaturalDocs/bin/Modules/NaturalDocs/Builder.pm -------------------------------------------------------------------------------- /extras/NaturalDocs/bin/Modules/NaturalDocs/Builder/Base.pm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/extras/NaturalDocs/bin/Modules/NaturalDocs/Builder/Base.pm -------------------------------------------------------------------------------- /extras/NaturalDocs/bin/Modules/NaturalDocs/Builder/FramedHTML.pm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/extras/NaturalDocs/bin/Modules/NaturalDocs/Builder/FramedHTML.pm -------------------------------------------------------------------------------- /extras/NaturalDocs/bin/Modules/NaturalDocs/Builder/HTML.pm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/extras/NaturalDocs/bin/Modules/NaturalDocs/Builder/HTML.pm -------------------------------------------------------------------------------- /extras/NaturalDocs/bin/Modules/NaturalDocs/Builder/HTMLBase.pm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/extras/NaturalDocs/bin/Modules/NaturalDocs/Builder/HTMLBase.pm -------------------------------------------------------------------------------- /extras/NaturalDocs/bin/Modules/NaturalDocs/ClassHierarchy.pm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/extras/NaturalDocs/bin/Modules/NaturalDocs/ClassHierarchy.pm -------------------------------------------------------------------------------- /extras/NaturalDocs/bin/Modules/NaturalDocs/ClassHierarchy/Class.pm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/extras/NaturalDocs/bin/Modules/NaturalDocs/ClassHierarchy/Class.pm -------------------------------------------------------------------------------- /extras/NaturalDocs/bin/Modules/NaturalDocs/ClassHierarchy/File.pm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/extras/NaturalDocs/bin/Modules/NaturalDocs/ClassHierarchy/File.pm -------------------------------------------------------------------------------- /extras/NaturalDocs/bin/Modules/NaturalDocs/ConfigFile.pm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/extras/NaturalDocs/bin/Modules/NaturalDocs/ConfigFile.pm -------------------------------------------------------------------------------- /extras/NaturalDocs/bin/Modules/NaturalDocs/Constants.pm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/extras/NaturalDocs/bin/Modules/NaturalDocs/Constants.pm -------------------------------------------------------------------------------- /extras/NaturalDocs/bin/Modules/NaturalDocs/DefineMembers.pm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/extras/NaturalDocs/bin/Modules/NaturalDocs/DefineMembers.pm -------------------------------------------------------------------------------- /extras/NaturalDocs/bin/Modules/NaturalDocs/Error.pm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/extras/NaturalDocs/bin/Modules/NaturalDocs/Error.pm -------------------------------------------------------------------------------- /extras/NaturalDocs/bin/Modules/NaturalDocs/File.pm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/extras/NaturalDocs/bin/Modules/NaturalDocs/File.pm -------------------------------------------------------------------------------- /extras/NaturalDocs/bin/Modules/NaturalDocs/ImageReferenceTable.pm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/extras/NaturalDocs/bin/Modules/NaturalDocs/ImageReferenceTable.pm -------------------------------------------------------------------------------- /extras/NaturalDocs/bin/Modules/NaturalDocs/ImageReferenceTable/Reference.pm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/extras/NaturalDocs/bin/Modules/NaturalDocs/ImageReferenceTable/Reference.pm -------------------------------------------------------------------------------- /extras/NaturalDocs/bin/Modules/NaturalDocs/ImageReferenceTable/String.pm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/extras/NaturalDocs/bin/Modules/NaturalDocs/ImageReferenceTable/String.pm -------------------------------------------------------------------------------- /extras/NaturalDocs/bin/Modules/NaturalDocs/Languages.pm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/extras/NaturalDocs/bin/Modules/NaturalDocs/Languages.pm -------------------------------------------------------------------------------- /extras/NaturalDocs/bin/Modules/NaturalDocs/Languages/ActionScript.pm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/extras/NaturalDocs/bin/Modules/NaturalDocs/Languages/ActionScript.pm -------------------------------------------------------------------------------- /extras/NaturalDocs/bin/Modules/NaturalDocs/Languages/Ada.pm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/extras/NaturalDocs/bin/Modules/NaturalDocs/Languages/Ada.pm -------------------------------------------------------------------------------- /extras/NaturalDocs/bin/Modules/NaturalDocs/Languages/Advanced.pm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/extras/NaturalDocs/bin/Modules/NaturalDocs/Languages/Advanced.pm -------------------------------------------------------------------------------- /extras/NaturalDocs/bin/Modules/NaturalDocs/Languages/Advanced/Scope.pm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/extras/NaturalDocs/bin/Modules/NaturalDocs/Languages/Advanced/Scope.pm -------------------------------------------------------------------------------- /extras/NaturalDocs/bin/Modules/NaturalDocs/Languages/Advanced/ScopeChange.pm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/extras/NaturalDocs/bin/Modules/NaturalDocs/Languages/Advanced/ScopeChange.pm -------------------------------------------------------------------------------- /extras/NaturalDocs/bin/Modules/NaturalDocs/Languages/Base.pm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/extras/NaturalDocs/bin/Modules/NaturalDocs/Languages/Base.pm -------------------------------------------------------------------------------- /extras/NaturalDocs/bin/Modules/NaturalDocs/Languages/CSharp.pm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/extras/NaturalDocs/bin/Modules/NaturalDocs/Languages/CSharp.pm -------------------------------------------------------------------------------- /extras/NaturalDocs/bin/Modules/NaturalDocs/Languages/PLSQL.pm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/extras/NaturalDocs/bin/Modules/NaturalDocs/Languages/PLSQL.pm -------------------------------------------------------------------------------- /extras/NaturalDocs/bin/Modules/NaturalDocs/Languages/Pascal.pm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/extras/NaturalDocs/bin/Modules/NaturalDocs/Languages/Pascal.pm -------------------------------------------------------------------------------- /extras/NaturalDocs/bin/Modules/NaturalDocs/Languages/Perl.pm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/extras/NaturalDocs/bin/Modules/NaturalDocs/Languages/Perl.pm -------------------------------------------------------------------------------- /extras/NaturalDocs/bin/Modules/NaturalDocs/Languages/Prototype.pm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/extras/NaturalDocs/bin/Modules/NaturalDocs/Languages/Prototype.pm -------------------------------------------------------------------------------- /extras/NaturalDocs/bin/Modules/NaturalDocs/Languages/Prototype/Parameter.pm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/extras/NaturalDocs/bin/Modules/NaturalDocs/Languages/Prototype/Parameter.pm -------------------------------------------------------------------------------- /extras/NaturalDocs/bin/Modules/NaturalDocs/Languages/Simple.pm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/extras/NaturalDocs/bin/Modules/NaturalDocs/Languages/Simple.pm -------------------------------------------------------------------------------- /extras/NaturalDocs/bin/Modules/NaturalDocs/Languages/Tcl.pm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/extras/NaturalDocs/bin/Modules/NaturalDocs/Languages/Tcl.pm -------------------------------------------------------------------------------- /extras/NaturalDocs/bin/Modules/NaturalDocs/LineReader.pm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/extras/NaturalDocs/bin/Modules/NaturalDocs/LineReader.pm -------------------------------------------------------------------------------- /extras/NaturalDocs/bin/Modules/NaturalDocs/Menu.pm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/extras/NaturalDocs/bin/Modules/NaturalDocs/Menu.pm -------------------------------------------------------------------------------- /extras/NaturalDocs/bin/Modules/NaturalDocs/Menu/Entry.pm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/extras/NaturalDocs/bin/Modules/NaturalDocs/Menu/Entry.pm -------------------------------------------------------------------------------- /extras/NaturalDocs/bin/Modules/NaturalDocs/NDMarkup.pm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/extras/NaturalDocs/bin/Modules/NaturalDocs/NDMarkup.pm -------------------------------------------------------------------------------- /extras/NaturalDocs/bin/Modules/NaturalDocs/Parser.pm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/extras/NaturalDocs/bin/Modules/NaturalDocs/Parser.pm -------------------------------------------------------------------------------- /extras/NaturalDocs/bin/Modules/NaturalDocs/Parser/JavaDoc.pm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/extras/NaturalDocs/bin/Modules/NaturalDocs/Parser/JavaDoc.pm -------------------------------------------------------------------------------- /extras/NaturalDocs/bin/Modules/NaturalDocs/Parser/Native.pm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/extras/NaturalDocs/bin/Modules/NaturalDocs/Parser/Native.pm -------------------------------------------------------------------------------- /extras/NaturalDocs/bin/Modules/NaturalDocs/Parser/ParsedTopic.pm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/extras/NaturalDocs/bin/Modules/NaturalDocs/Parser/ParsedTopic.pm -------------------------------------------------------------------------------- /extras/NaturalDocs/bin/Modules/NaturalDocs/Project.pm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/extras/NaturalDocs/bin/Modules/NaturalDocs/Project.pm -------------------------------------------------------------------------------- /extras/NaturalDocs/bin/Modules/NaturalDocs/Project/ImageFile.pm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/extras/NaturalDocs/bin/Modules/NaturalDocs/Project/ImageFile.pm -------------------------------------------------------------------------------- /extras/NaturalDocs/bin/Modules/NaturalDocs/Project/SourceFile.pm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/extras/NaturalDocs/bin/Modules/NaturalDocs/Project/SourceFile.pm -------------------------------------------------------------------------------- /extras/NaturalDocs/bin/Modules/NaturalDocs/ReferenceString.pm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/extras/NaturalDocs/bin/Modules/NaturalDocs/ReferenceString.pm -------------------------------------------------------------------------------- /extras/NaturalDocs/bin/Modules/NaturalDocs/Settings.pm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/extras/NaturalDocs/bin/Modules/NaturalDocs/Settings.pm -------------------------------------------------------------------------------- /extras/NaturalDocs/bin/Modules/NaturalDocs/Settings/BuildTarget.pm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/extras/NaturalDocs/bin/Modules/NaturalDocs/Settings/BuildTarget.pm -------------------------------------------------------------------------------- /extras/NaturalDocs/bin/Modules/NaturalDocs/SourceDB.pm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/extras/NaturalDocs/bin/Modules/NaturalDocs/SourceDB.pm -------------------------------------------------------------------------------- /extras/NaturalDocs/bin/Modules/NaturalDocs/SourceDB/Extension.pm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/extras/NaturalDocs/bin/Modules/NaturalDocs/SourceDB/Extension.pm -------------------------------------------------------------------------------- /extras/NaturalDocs/bin/Modules/NaturalDocs/SourceDB/File.pm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/extras/NaturalDocs/bin/Modules/NaturalDocs/SourceDB/File.pm -------------------------------------------------------------------------------- /extras/NaturalDocs/bin/Modules/NaturalDocs/SourceDB/Item.pm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/extras/NaturalDocs/bin/Modules/NaturalDocs/SourceDB/Item.pm -------------------------------------------------------------------------------- /extras/NaturalDocs/bin/Modules/NaturalDocs/SourceDB/ItemDefinition.pm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/extras/NaturalDocs/bin/Modules/NaturalDocs/SourceDB/ItemDefinition.pm -------------------------------------------------------------------------------- /extras/NaturalDocs/bin/Modules/NaturalDocs/SourceDB/WatchedFileDefinitions.pm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/extras/NaturalDocs/bin/Modules/NaturalDocs/SourceDB/WatchedFileDefinitions.pm -------------------------------------------------------------------------------- /extras/NaturalDocs/bin/Modules/NaturalDocs/StatusMessage.pm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/extras/NaturalDocs/bin/Modules/NaturalDocs/StatusMessage.pm -------------------------------------------------------------------------------- /extras/NaturalDocs/bin/Modules/NaturalDocs/SymbolString.pm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/extras/NaturalDocs/bin/Modules/NaturalDocs/SymbolString.pm -------------------------------------------------------------------------------- /extras/NaturalDocs/bin/Modules/NaturalDocs/SymbolTable.pm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/extras/NaturalDocs/bin/Modules/NaturalDocs/SymbolTable.pm -------------------------------------------------------------------------------- /extras/NaturalDocs/bin/Modules/NaturalDocs/SymbolTable/File.pm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/extras/NaturalDocs/bin/Modules/NaturalDocs/SymbolTable/File.pm -------------------------------------------------------------------------------- /extras/NaturalDocs/bin/Modules/NaturalDocs/SymbolTable/IndexElement.pm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/extras/NaturalDocs/bin/Modules/NaturalDocs/SymbolTable/IndexElement.pm -------------------------------------------------------------------------------- /extras/NaturalDocs/bin/Modules/NaturalDocs/SymbolTable/Reference.pm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/extras/NaturalDocs/bin/Modules/NaturalDocs/SymbolTable/Reference.pm -------------------------------------------------------------------------------- /extras/NaturalDocs/bin/Modules/NaturalDocs/SymbolTable/ReferenceTarget.pm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/extras/NaturalDocs/bin/Modules/NaturalDocs/SymbolTable/ReferenceTarget.pm -------------------------------------------------------------------------------- /extras/NaturalDocs/bin/Modules/NaturalDocs/SymbolTable/Symbol.pm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/extras/NaturalDocs/bin/Modules/NaturalDocs/SymbolTable/Symbol.pm -------------------------------------------------------------------------------- /extras/NaturalDocs/bin/Modules/NaturalDocs/SymbolTable/SymbolDefinition.pm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/extras/NaturalDocs/bin/Modules/NaturalDocs/SymbolTable/SymbolDefinition.pm -------------------------------------------------------------------------------- /extras/NaturalDocs/bin/Modules/NaturalDocs/Topics.pm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/extras/NaturalDocs/bin/Modules/NaturalDocs/Topics.pm -------------------------------------------------------------------------------- /extras/NaturalDocs/bin/Modules/NaturalDocs/Topics/Type.pm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/extras/NaturalDocs/bin/Modules/NaturalDocs/Topics/Type.pm -------------------------------------------------------------------------------- /extras/NaturalDocs/bin/Modules/NaturalDocs/Version.pm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/extras/NaturalDocs/bin/Modules/NaturalDocs/Version.pm -------------------------------------------------------------------------------- /extras/NaturalDocs/bin/NaturalDocs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/extras/NaturalDocs/bin/NaturalDocs -------------------------------------------------------------------------------- /extras/NaturalDocs/config/Menu.txt: -------------------------------------------------------------------------------- 1 | Format: 1.52 2 | 3 | 4 | # You can add a title and sub-title to your menu like this: 5 | # Title: [project name] 6 | # SubTitle: [subtitle] 7 | 8 | Footer: libSFX 9 | 10 | # You can add a timestamp to your documentation like one of these: 11 | # Timestamp: Generated on month day, year 12 | # Timestamp: Updated mm/dd/yyyy 13 | # Timestamp: Last updated mon day 14 | # 15 | # m - One or two digit month. January is "1" 16 | # mm - Always two digit month. January is "01" 17 | # mon - Short month word. January is "Jan" 18 | # month - Long month word. January is "January" 19 | # d - One or two digit day. 1 is "1" 20 | # dd - Always two digit day. 1 is "01" 21 | # day - Day with letter extension. 1 is "1st" 22 | # yy - Two digit year. 2006 is "06" 23 | # yyyy - Four digit year. 2006 is "2006" 24 | # year - Four digit year. 2006 is "2006" 25 | 26 | # These are indexes you deleted, so Natural Docs will not add them again 27 | # unless you remove them from this line. 28 | 29 | Don't Index: Registers, Files, Macros, General, Memory locations, Meta Instructions, Variables 30 | 31 | 32 | # -------------------------------------------------------------------------- 33 | # 34 | # Cut and paste the lines below to change the order in which your files 35 | # appear on the menu. Don't worry about adding or removing files, Natural 36 | # Docs will take care of that. 37 | # 38 | # You can further organize the menu by grouping the entries. Add a 39 | # "Group: [name] {" line to start a group, and add a "}" to end it. 40 | # 41 | # You can add text and web links to the menu by adding "Text: [text]" and 42 | # "Link: [name] ([URL])" lines, respectively. 43 | # 44 | # The formatting and comments are auto-generated, so don't worry about 45 | # neatness when editing the file. Natural Docs will clean it up the next 46 | # time it is run. When working with groups, just deal with the braces and 47 | # forget about the indentation and comments. 48 | # 49 | # -------------------------------------------------------------------------- 50 | 51 | 52 | File: libSFX documentation (no auto-title, libSFX.i) 53 | 54 | Group: Configuration { 55 | 56 | File: Make (no auto-title, Docs/Make.txt) 57 | File: libSFX.cfg (no auto-title, Configurations/libSFX.cfg) 58 | File: Map.cfg (no auto-title, Configurations/Map.cfg) 59 | } # Group: Configuration 60 | 61 | Group: S-CPU { 62 | 63 | File: CPU (no auto-title, CPU.i) 64 | File: CPU_Def (no auto-title, CPU_Def.i) 65 | File: CPU_Memory (no auto-title, CPU_Memory.i) 66 | File: CPU_Math (no auto-title, CPU_Math.i) 67 | File: CPU_PPU (no auto-title, CPU_PPU.i) 68 | File: CPU_SMP (no auto-title, CPU_SMP.i) 69 | File: CPU_Runtime (no auto-title, CPU_Runtime.i) 70 | File: CPU_DataStructures (no auto-title, CPU_DataStructures.i) 71 | } # Group: S-CPU 72 | 73 | Group: S-SMP { 74 | 75 | File: SMP_Def (no auto-title, SMP_Def.i) 76 | File: SMP_ADSR (no auto-title, SMP_ADSR.i) 77 | File: SMP_Util (no auto-title, SMP_Util.i) 78 | } # Group: S-SMP 79 | 80 | Group: Packages { 81 | 82 | File: LZ4 (no auto-title, Packages/LZ4/LZ4.i) 83 | File: Mouse (no auto-title, Packages/Mouse/Mouse.i) 84 | } # Group: Packages 85 | 86 | -------------------------------------------------------------------------------- /extras/NaturalDocs/config/README.md: -------------------------------------------------------------------------------- 1 | Configuration files for automatic documentation generation. Build docs with `make docs` in the repository root directory. 2 | -------------------------------------------------------------------------------- /extras/NaturalDocs/config/Topics.txt: -------------------------------------------------------------------------------- 1 | Format: 1.52 2 | 3 | # This is the Natural Docs topics file for this project. If you change anything 4 | # here, it will apply to THIS PROJECT ONLY. If you'd like to change something 5 | # for all your projects, edit the Topics.txt in Natural Docs' Config directory 6 | # instead. 7 | 8 | 9 | # If you'd like to prevent keywords from being recognized by Natural Docs, you 10 | # can do it like this: 11 | # Ignore Keywords: [keyword], [keyword], ... 12 | # 13 | # Or you can use the list syntax like how they are defined: 14 | # Ignore Keywords: 15 | # [keyword] 16 | # [keyword], [plural keyword] 17 | # ... 18 | 19 | 20 | #------------------------------------------------------------------------------- 21 | # SYNTAX: 22 | # 23 | # Topic Type: [name] 24 | # Alter Topic Type: [name] 25 | # Creates a new topic type or alters one from the main file. Each type gets 26 | # its own index and behavior settings. Its name can have letters, numbers, 27 | # spaces, and these charaters: - / . ' 28 | # 29 | # Plural: [name] 30 | # Sets the plural name of the topic type, if different. 31 | # 32 | # Keywords: 33 | # [keyword] 34 | # [keyword], [plural keyword] 35 | # ... 36 | # Defines or adds to the list of keywords for the topic type. They may only 37 | # contain letters, numbers, and spaces and are not case sensitive. Plural 38 | # keywords are used for list topics. You can redefine keywords found in the 39 | # main topics file. 40 | # 41 | # Index: [yes|no] 42 | # Whether the topics get their own index. Defaults to yes. Everything is 43 | # included in the general index regardless of this setting. 44 | # 45 | # Scope: [normal|start|end|always global] 46 | # How the topics affects scope. Defaults to normal. 47 | # normal - Topics stay within the current scope. 48 | # start - Topics start a new scope for all the topics beneath it, 49 | # like class topics. 50 | # end - Topics reset the scope back to global for all the topics 51 | # beneath it. 52 | # always global - Topics are defined as global, but do not change the scope 53 | # for any other topics. 54 | # 55 | # Class Hierarchy: [yes|no] 56 | # Whether the topics are part of the class hierarchy. Defaults to no. 57 | # 58 | # Page Title If First: [yes|no] 59 | # Whether the topic's title becomes the page title if it's the first one in 60 | # a file. Defaults to no. 61 | # 62 | # Break Lists: [yes|no] 63 | # Whether list topics should be broken into individual topics in the output. 64 | # Defaults to no. 65 | # 66 | # Can Group With: [type], [type], ... 67 | # Defines a list of topic types that this one can possibly be grouped with. 68 | # Defaults to none. 69 | #------------------------------------------------------------------------------- 70 | 71 | # The following topics are defined in the main file, if you'd like to alter 72 | # their behavior or add keywords: 73 | # 74 | # Generic, Class, Interface, Section, File, Group, Function, Variable, 75 | # Property, Type, Constant, Enumeration, Event, Delegate, Macro, 76 | # Database, Database Table, Database View, Database Index, Database 77 | # Cursor, Database Trigger, Cookie, Build Target 78 | 79 | # If you add something that you think would be useful to other developers 80 | # and should be included in Natural Docs by default, please e-mail it to 81 | # topics [at] naturaldocs [dot] org. 82 | 83 | 84 | Topic Type: Registers 85 | 86 | Keywords: 87 | register, registers 88 | 89 | 90 | Topic Type: Memory locations 91 | 92 | Keywords: 93 | memory location, memory locations 94 | 95 | 96 | Topic Type: Routines 97 | 98 | Keywords: 99 | routine, routines 100 | 101 | 102 | Topic Type: Meta Instructions 103 | 104 | Keywords: 105 | metainstruction, metainstructions 106 | meta, metas 107 | -------------------------------------------------------------------------------- /extras/NaturalDocs/config/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/extras/NaturalDocs/config/favicon.ico -------------------------------------------------------------------------------- /extras/NaturalDocs/config/readme: -------------------------------------------------------------------------------- 1 | libSFX documentation: [optiroc.github.io/libSFX](http://optiroc.github.io/libSFX) 2 | 3 | Generated with [NaturalDocs](http://www.naturaldocs.org) 4 | -------------------------------------------------------------------------------- /extras/SublimeText/README.md: -------------------------------------------------------------------------------- 1 | #libSFX sublime text extras 2 | 3 | Syntax definitions for the ca65 assembler with 65816, SPC700 and GSU-1 (SuperFX) instruction sets. 4 | 5 | ###installation 6 | 7 | Copy the *.tmLanguage (and optionally *.sublime-settings) files to the Sublime Text user package dir (e.g. "~/Library/Application Support/Sublime Text 3/Packages/User" on OS X with Sublime Text 3). 8 | -------------------------------------------------------------------------------- /extras/SublimeText/ca65-65816.sublime-settings: -------------------------------------------------------------------------------- 1 | { 2 | "auto_complete": false, 3 | "extensions": 4 | [ 5 | "s", "s816" ,"i", "i816" 6 | ], 7 | "tab_completion": false, 8 | "tab_size": 8, 9 | "translate_tabs_to_spaces": true 10 | } 11 | -------------------------------------------------------------------------------- /extras/SublimeText/ca65-65816.tmLanguage: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | fileTypes 6 | 7 | s 8 | s816 9 | i 10 | i816 11 | 12 | name 13 | ca65-65816 14 | patterns 15 | 16 | 17 | comment 18 | 65816 instructions 19 | match 20 | (?i)\b(adc|and|asl|bcc|beq|bge|bit|blt|bmi|bne|bpl|bra|brk|brl|bvc|bvs|clc|cld|cli|clv|cmp|cop|cpa|cpx|cpy|dea|dec|dex|dey|eor|ina|inc|inx|iny|jml|jmp|jsl|jsr|lda|ldx|ldy|lsr|mvn|mvp|nop|ora|pea|pei|per|pha|phb|phd|phk|php|phx|phy|pla|plb|pld|plp|plx|ply|rep|rol|ror|rti|rtl|rts|sbc|sec|sed|sei|sep|sta|stp|stx|sty|stz|swa|tad|tas|tax|tay|tcd|tcs|tda|tdc|trb|tsa|tsb|tsc|tsx|txa|txs|txy|tya|tyx|wai|wdm|xba|xce)\b 21 | name 22 | keyword.mnenomic.ca65-65816 23 | 24 | 25 | comment 26 | ca65 pseudo functions 27 | match 28 | (?i)\.(addrsize|and|bank|bankbyte|blank|concat|const|hibyte|hiword|ident|left|lobyte|loword|match|max|mid|min|not|or|ref|referenced|right|sizeof|strat|sprintf|string|strlen|tcount|xmatch)\b 29 | name 30 | keyword.directives.ca65-65816 31 | 32 | 33 | comment 34 | ca65 control commands 35 | match 36 | (?i)^[\s]*\.(a16|a8|addr|align|asciiz|assert|autoimport|bankbytes|bss|byt|byte|case|charmap|code|condes|constructor|data|dbyt|debuginfo|define|def|defined|delmacro|delmac|destructor|dword|else|elseif|end|endenum|endif|endmac|endmacro|endproc|endrep|endrepeat|endscope|endstruct|enum|error|exitmac|exitmacro|export|exportzp|faraddr|fatal|feature|fileopt|fopt|forceimport|global|globalzp|hibytes|i16|i8|if|ifblank|ifconst|ifdef|ifnblank|ifndef|ifnref|ifp02|ifp816|ifpc02|ifpcs02|ifref|import|importzp|incbin|include|interruptor|linecont|list|listbytes|lobytes|local|localchar|macpack|mac|macro|org|out|p02|p816|pagelen|pagelength|pc02|popcpu|popseg|proc|psc02|pushcpu|pushseg|reloc|repeat|res|rodata|scope|segment|set|setcpu|smart|struct|tag|undef|undefine|union|warning|word|zeropage)\b 37 | name 38 | keyword.directives.ca65-65816 39 | 40 | 41 | comment 42 | 65816 libSFX meta instructions 43 | match 44 | (?i)\b(bgt|bsr|bsl|add|sub|asr|neg)\b 45 | name 46 | keyword.metamnenomic.ca65-65816 47 | 48 | 49 | comment 50 | Labels 51 | match 52 | (^|\n)([a-zA-Z0-9_\\@]*): 53 | name 54 | support.class.ca65-65816 55 | 56 | 57 | comment 58 | String 59 | match 60 | (^|\s)"[\w\s\W]*" 61 | name 62 | string.ca65-65816 63 | 64 | 65 | comment 66 | Hexadecimal number 67 | match 68 | (?i)\$((\d|[A-F])+)\b 69 | name 70 | constant.numeric.hex.ca65-65816 71 | 72 | 73 | comment 74 | Binary number 75 | match 76 | (?i)\%([0|1]+)\b 77 | name 78 | constant.numeric.bin.ca65-65816 79 | 80 | 81 | comment 82 | Decimal number 83 | match 84 | (?i)\#([0-9a-f$%]+)\b 85 | name 86 | constant.numeric.dec.ca65-65816 87 | 88 | 89 | comment 90 | Block comment 91 | begin 92 | /\* 93 | end 94 | \*/ 95 | name 96 | comment.block.ca65-65816 97 | 98 | 99 | comment 100 | Documentation comment 101 | begin 102 | /\*\*(?!/) 103 | end 104 | \*/ 105 | name 106 | comment.block.documentation.ca65-65816 107 | 108 | 109 | comment 110 | Line comment 111 | begin 112 | ; 113 | end 114 | \n 115 | name 116 | comment.line.ca65-65816 117 | 118 | 119 | scopeName 120 | source.ca65-65816 121 | uuid 122 | 9aef490b-df42-445f-ca65-1b6b48b9d3e4 123 | 124 | 125 | -------------------------------------------------------------------------------- /extras/SublimeText/ca65-gsu.sublime-settings: -------------------------------------------------------------------------------- 1 | { 2 | "auto_complete": false, 3 | "extensions": 4 | [ 5 | "sgs" ,"igs" 6 | ], 7 | "tab_completion": false, 8 | "tab_size": 8, 9 | "translate_tabs_to_spaces": true 10 | } 11 | -------------------------------------------------------------------------------- /extras/SublimeText/ca65-gsu.tmLanguage: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | fileTypes 6 | 7 | sgs 8 | igs 9 | 10 | name 11 | ca65-gsu 12 | patterns 13 | 14 | 15 | comment 16 | GSU instructions 17 | match 18 | (?i)\b(adc|add|alt1|alt2|alt3|and|asr|bcc|bcs|beq|bge|bic|blt|bmi|bne|bpl|bra|bvc|bvs|cache|cmode|cmp|color|dec|div2|fmult|from|getb|getbh|getbl|getbs|getc|hib|ibt|inc|iwt|jmp|ldb|ldw|lea|link|ljmp|lm|lms|lmult|lob|loop|lsr|merge|move|moveb|moves|movew|mult|nop|not|or|or|plot|ramb|rol|romb|ror|rpix|sbc|sbk|sex|sm|and|sms|stb|stop|stw|sub|swap|to|umult|with|xor)\b 19 | name 20 | keyword.mnenomic.ca65-gsu 21 | 22 | 23 | comment 24 | GSU casfx pseudo-instructions 25 | match 26 | (?i)\b(pop|push|jal|ret)\b 27 | name 28 | keyword.pseudoinstructions.ca65-gsu 29 | 30 | 31 | comment 32 | ca65 pseudo functions 33 | match 34 | (?i)\.(addrsize|and|bank|bankbyte|blank|concat|const|hibyte|hiword|ident|left|lobyte|loword|match|max|mid|min|not|or|ref|referenced|right|sizeof|strat|sprintf|string|strlen|tcount|xmatch)\b 35 | name 36 | keyword.directives.ca65-gsu 37 | 38 | 39 | comment 40 | ca65 control commands 41 | match 42 | (?i)^[\s]*\.(a16|a8|addr|align|asciiz|assert|autoimport|bankbytes|bss|byt|byte|case|charmap|code|condes|constructor|data|dbyt|debuginfo|define|def|defined|delmacro|delmac|destructor|dword|else|elseif|end|endenum|endif|endmac|endmacro|endproc|endrep|endrepeat|endscope|endstruct|enum|error|exitmac|exitmacro|export|exportzp|faraddr|fatal|feature|fileopt|fopt|forceimport|global|globalzp|hibytes|i16|i8|if|ifblank|ifconst|ifdef|ifnblank|ifndef|ifnref|ifp02|ifp816|ifpc02|ifpcs02|ifref|import|importzp|incbin|include|interruptor|linecont|list|listbytes|lobytes|local|localchar|macpack|mac|macro|org|out|p02|p816|pagelen|pagelength|pc02|popcpu|popseg|proc|psc02|pushcpu|pushseg|reloc|repeat|res|rodata|scope|segment|set|setcpu|smart|struct|tag|undef|undefine|union|warning|word|zeropage)\b 43 | name 44 | keyword.directives.ca65-gsu 45 | 46 | 47 | comment 48 | Labels 49 | match 50 | (^|\n)([a-zA-Z0-9_\\@]*): 51 | name 52 | support.class.ca65-gsu 53 | 54 | 55 | comment 56 | String 57 | match 58 | (^|\s)"[\w\s\W]*" 59 | name 60 | string.ca65-gsu 61 | 62 | 63 | comment 64 | Hexadecimal number 65 | match 66 | (?i)\$((\d|[A-F])+)\b 67 | name 68 | constant.numeric.hex.ca65-gsu 69 | 70 | 71 | comment 72 | Binary number 73 | match 74 | (?i)\%([0|1]+)\b 75 | name 76 | constant.numeric.bin.ca65-gsu 77 | 78 | 79 | comment 80 | Decimal number 81 | match 82 | (?i)\#([0-9a-f$%]+)\b 83 | name 84 | constant.numeric.dec.ca65-gsu 85 | 86 | 87 | comment 88 | Block comment 89 | begin 90 | /\* 91 | end 92 | \*/ 93 | name 94 | comment.block.ca65-gsu 95 | 96 | 97 | comment 98 | Documentation comment 99 | begin 100 | /\*\*(?!/) 101 | end 102 | \*/ 103 | name 104 | comment.block.documentation.ca65-gsu 105 | 106 | 107 | comment 108 | Line comment 109 | begin 110 | ; 111 | end 112 | \n 113 | name 114 | comment.line.ca65-gsu 115 | 116 | 117 | scopeName 118 | source.ca65-gsu 119 | uuid 120 | 9aef490b-df42-445f-ca65-725148a9d3e4 121 | 122 | 123 | -------------------------------------------------------------------------------- /extras/SublimeText/ca65-spc700.sublime-settings: -------------------------------------------------------------------------------- 1 | { 2 | "auto_complete": false, 3 | "extensions": 4 | [ 5 | "s700" ,"i700" 6 | ], 7 | "tab_completion": false, 8 | "tab_size": 8, 9 | "translate_tabs_to_spaces": true 10 | } 11 | -------------------------------------------------------------------------------- /extras/SublimeText/ca65-spc700.tmLanguage: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | fileTypes 6 | 7 | s700 8 | i700 9 | 10 | name 11 | ca65-spc700 12 | patterns 13 | 14 | 15 | comment 16 | SPC700 instructions 17 | match 18 | (?i)\b(adc|addw|and1|and|asl|bbc|bbs|bcc|bcs|beq|bmi|bne|bpl|bra|brk|bvc|bvs|call|cbne|clr1|clrc|clrp|clrv|cmp|cmpw|daa|das|dbnz|dec|decw|di|div|ei|eor1|eor|inc|incw|jmp|lsr|mov1|mov|movw|mul|nop|not1|notc|or1|or|pcall|pop|push|ret1|ret|rol|ror|sbc|set1|setc|setp|sleep|stop|subw|tcall|tclr1|tset1|xcn)\b 19 | name 20 | keyword.mnenomic.ca65-spc700 21 | 22 | 23 | comment 24 | ca65 pseudo functions 25 | match 26 | (?i)\.(addrsize|and|bank|bankbyte|blank|concat|const|hibyte|hiword|ident|left|lobyte|loword|match|max|mid|min|not|or|ref|referenced|right|sizeof|strat|sprintf|string|strlen|tcount|xmatch)\b 27 | name 28 | keyword.directives.ca65-spc700 29 | 30 | 31 | comment 32 | ca65 control commands 33 | match 34 | (?i)^[\s]*\.(a16|a8|addr|align|asciiz|assert|autoimport|bankbytes|bss|byt|byte|case|charmap|code|condes|constructor|data|dbyt|debuginfo|define|def|defined|delmacro|delmac|destructor|dword|else|elseif|end|endenum|endif|endmac|endmacro|endproc|endrep|endrepeat|endscope|endstruct|enum|error|exitmac|exitmacro|export|exportzp|faraddr|fatal|feature|fileopt|fopt|forceimport|global|globalzp|hibytes|i16|i8|if|ifblank|ifconst|ifdef|ifnblank|ifndef|ifnref|ifp02|ifp816|ifpc02|ifpcs02|ifref|import|importzp|incbin|include|interruptor|linecont|list|listbytes|lobytes|local|localchar|macpack|mac|macro|org|out|p02|p816|pagelen|pagelength|pc02|popcpu|popseg|proc|psc02|pushcpu|pushseg|reloc|repeat|res|rodata|scope|segment|set|setcpu|smart|struct|tag|undef|undefine|union|warning|word|zeropage)\b 35 | name 36 | keyword.directives.ca65-spc700 37 | 38 | 39 | comment 40 | Labels 41 | match 42 | (^|\n)([a-zA-Z0-9_\\@]*): 43 | name 44 | support.class.ca65-spc700 45 | 46 | 47 | comment 48 | String 49 | match 50 | (^|\s)"[\w\s\W]*" 51 | name 52 | string.ca65-spc700 53 | 54 | 55 | comment 56 | Hexadecimal number 57 | match 58 | (?i)\$((\d|[A-F])+)\b 59 | name 60 | constant.numeric.hex.ca65-spc700 61 | 62 | 63 | comment 64 | Binary number 65 | match 66 | (?i)\%([0|1]+)\b 67 | name 68 | constant.numeric.bin.ca65-spc700 69 | 70 | 71 | comment 72 | Decimal number 73 | match 74 | (?i)\#([0-9a-f$%]+)\b 75 | name 76 | constant.numeric.dec.ca65-spc700 77 | 78 | 79 | comment 80 | Block comment 81 | begin 82 | /\* 83 | end 84 | \*/ 85 | name 86 | comment.block.ca65-spc700 87 | 88 | 89 | comment 90 | Documentation comment 91 | begin 92 | /\*\*(?!/) 93 | end 94 | \*/ 95 | name 96 | comment.block.documentation.ca65-spc700 97 | 98 | 99 | comment 100 | Line comment 101 | begin 102 | ; 103 | end 104 | \n 105 | name 106 | comment.line.ca65-spc700 107 | 108 | 109 | scopeName 110 | source.ca65-spc700 111 | uuid 112 | 9aef490b-df42-445f-ca65-765348b9d3e4 113 | 114 | 115 | -------------------------------------------------------------------------------- /extras/VisualStudioCode/README.md: -------------------------------------------------------------------------------- 1 | #libSFX VS Code extras 2 | 3 | Visual Studio Code syntax definitions for the ca65 assembler with 65816, SPC700 and GSU-1 (SuperFX) instruction sets. 4 | 5 | ###installation 6 | 7 | Copy the folders to the Visual Studio Code extensions directory at `~/.vscode/extensions`. 8 | -------------------------------------------------------------------------------- /extras/VisualStudioCode/ca65-65816/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | // A launch configuration that launches the extension inside a new window 2 | { 3 | "version": "0.1.0", 4 | "configurations": [ 5 | { 6 | "name": "Launch Extension", 7 | "type": "extensionHost", 8 | "request": "launch", 9 | "runtimeExecutable": "${execPath}", 10 | "args": ["--extensionDevelopmentPath=${workspaceRoot}" ] 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /extras/VisualStudioCode/ca65-65816/README.md: -------------------------------------------------------------------------------- 1 | # ca65-65816 2 | 3 | Syntax highlighting for ca65-flavored 65816 assembler. 4 | -------------------------------------------------------------------------------- /extras/VisualStudioCode/ca65-65816/language-configuration.json: -------------------------------------------------------------------------------- 1 | { 2 | "comments": { 3 | // symbol used for single line comment. Remove this entry if your language does not support line comments 4 | "lineComment": "//", 5 | // symbols used for start and end a block comment. Remove this entry if your language does not support block comments 6 | "blockComment": [ "/*", "*/" ] 7 | }, 8 | // symbols used as brackets 9 | "brackets": [ 10 | ["{", "}"], 11 | ["[", "]"], 12 | ["(", ")"] 13 | ], 14 | // symbols that are auto closed when typing 15 | "autoClosingPairs": [ 16 | ["{", "}"], 17 | ["[", "]"], 18 | ["(", ")"], 19 | ["\"", "\""], 20 | ["'", "'"] 21 | ], 22 | // symbols that that can be used to surround a selection 23 | "surroundingPairs": [ 24 | ["{", "}"], 25 | ["[", "]"], 26 | ["(", ")"], 27 | ["\"", "\""], 28 | ["'", "'"] 29 | ] 30 | } -------------------------------------------------------------------------------- /extras/VisualStudioCode/ca65-65816/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ca65-65816", 3 | "displayName": "ca65-65816", 4 | "description": "ca65/65816 syntax highlighting", 5 | "version": "1.0.0", 6 | "publisher": "optiroc", 7 | "author": { 8 | "name": "David Lindecrantz", 9 | "email": "optiroc@gmail.com" 10 | }, 11 | "engines": { 12 | "vscode": "^1.5.0" 13 | }, 14 | "keywords": [ 15 | "assembler", 16 | "console", 17 | "super nintendo" 18 | ], 19 | "categories": [ 20 | "Languages" 21 | ], 22 | "contributes": { 23 | "languages": [{ 24 | "id": "ca65-65816", 25 | "aliases": ["ca65-65816", "ca65-65816"], 26 | "extensions": [".s",".s816",".i",".i816"], 27 | "configuration": "./language-configuration.json" 28 | }], 29 | "grammars": [{ 30 | "language": "ca65-65816", 31 | "scopeName": "source.ca65-65816", 32 | "path": "./syntaxes/ca65-65816.tmLanguage" 33 | }] 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /extras/VisualStudioCode/ca65-65816/syntaxes/ca65-65816.tmLanguage: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | fileTypes 6 | 7 | s 8 | s816 9 | i 10 | i816 11 | 12 | name 13 | ca65-65816 14 | patterns 15 | 16 | 17 | comment 18 | 65816 instructions 19 | match 20 | (?i)\b(adc|and|asl|bcc|beq|bge|bit|blt|bmi|bne|bpl|bra|brk|brl|bvc|bvs|clc|cld|cli|clv|cmp|cop|cpa|cpx|cpy|dea|dec|dex|dey|eor|ina|inc|inx|iny|jml|jmp|jsl|jsr|lda|ldx|ldy|lsr|mvn|mvp|nop|ora|pea|pei|per|pha|phb|phd|phk|php|phx|phy|pla|plb|pld|plp|plx|ply|rep|rol|ror|rti|rtl|rts|sbc|sec|sed|sei|sep|sta|stp|stx|sty|stz|swa|tad|tas|tax|tay|tcd|tcs|tda|tdc|trb|tsa|tsb|tsc|tsx|txa|txs|txy|tya|tyx|wai|wdm|xba|xce)\b 21 | name 22 | keyword.mnenomic.ca65-65816 23 | 24 | 25 | comment 26 | ca65 pseudo functions 27 | match 28 | (?i)\.(addrsize|and|bank|bankbyte|blank|concat|const|hibyte|hiword|ident|left|lobyte|loword|match|max|mid|min|not|or|ref|referenced|right|sizeof|strat|sprintf|string|strlen|tcount|xmatch)\b 29 | name 30 | keyword.directives.ca65-65816 31 | 32 | 33 | comment 34 | ca65 control commands 35 | match 36 | (?i)^[\s]*\.(a16|a8|addr|align|asciiz|assert|autoimport|bankbytes|bss|byt|byte|case|charmap|code|condes|constructor|data|dbyt|debuginfo|define|def|defined|delmacro|delmac|destructor|dword|else|elseif|end|endenum|endif|endmac|endmacro|endproc|endrep|endrepeat|endscope|endstruct|enum|error|exitmac|exitmacro|export|exportzp|faraddr|fatal|feature|fileopt|fopt|forceimport|global|globalzp|hibytes|i16|i8|if|ifblank|ifconst|ifdef|ifnblank|ifndef|ifnref|ifp02|ifp816|ifpc02|ifpcs02|ifref|import|importzp|incbin|include|interruptor|linecont|list|listbytes|lobytes|local|localchar|macpack|mac|macro|org|out|p02|p816|pagelen|pagelength|pc02|popcpu|popseg|proc|psc02|pushcpu|pushseg|reloc|repeat|res|rodata|scope|segment|set|setcpu|smart|struct|tag|undef|undefine|union|warning|word|zeropage)\b 37 | name 38 | keyword.directives.ca65-65816 39 | 40 | 41 | comment 42 | 65816 libSFX meta instructions 43 | match 44 | (?i)\b(bgt|bsr|bsl|add|sub|asr|neg)\b 45 | name 46 | keyword.metamnenomic.ca65-65816 47 | 48 | 49 | comment 50 | Labels 51 | match 52 | (^|\n)([a-zA-Z0-9_\\@]*): 53 | name 54 | support.class.ca65-65816 55 | 56 | 57 | comment 58 | String 59 | match 60 | (^|\s)"[\w\s\W]*" 61 | name 62 | string.ca65-65816 63 | 64 | 65 | comment 66 | Hexadecimal number 67 | match 68 | (?i)\$((\d|[A-F])+)\b 69 | name 70 | constant.numeric.hex.ca65-65816 71 | 72 | 73 | comment 74 | Binary number 75 | match 76 | (?i)\%([0|1]+)\b 77 | name 78 | constant.numeric.bin.ca65-65816 79 | 80 | 81 | comment 82 | Decimal number 83 | match 84 | (?i)\#([0-9a-f$%]+)\b 85 | name 86 | constant.numeric.dec.ca65-65816 87 | 88 | 89 | comment 90 | Block comment 91 | begin 92 | /\* 93 | end 94 | \*/ 95 | name 96 | comment.block.ca65-65816 97 | 98 | 99 | comment 100 | Documentation comment 101 | begin 102 | /\*\*(?!/) 103 | end 104 | \*/ 105 | name 106 | comment.block.documentation.ca65-65816 107 | 108 | 109 | comment 110 | Line comment 111 | begin 112 | ; 113 | end 114 | \n 115 | name 116 | comment.line.ca65-65816 117 | 118 | 119 | scopeName 120 | source.ca65-65816 121 | uuid 122 | 9aef490b-df42-445f-ca65-1b6b48b9d3e4 123 | 124 | 125 | -------------------------------------------------------------------------------- /extras/VisualStudioCode/ca65-gsu/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | // A launch configuration that launches the extension inside a new window 2 | { 3 | "version": "0.1.0", 4 | "configurations": [ 5 | { 6 | "name": "Launch Extension", 7 | "type": "extensionHost", 8 | "request": "launch", 9 | "runtimeExecutable": "${execPath}", 10 | "args": ["--extensionDevelopmentPath=${workspaceRoot}" ] 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /extras/VisualStudioCode/ca65-gsu/README.md: -------------------------------------------------------------------------------- 1 | # ca65-gsu 2 | 3 | Syntax highlighting for ca65-flavored GSU-1 (SuperFX) assembler. 4 | -------------------------------------------------------------------------------- /extras/VisualStudioCode/ca65-gsu/language-configuration.json: -------------------------------------------------------------------------------- 1 | { 2 | "comments": { 3 | // symbol used for single line comment. Remove this entry if your language does not support line comments 4 | "lineComment": "//", 5 | // symbols used for start and end a block comment. Remove this entry if your language does not support block comments 6 | "blockComment": [ "/*", "*/" ] 7 | }, 8 | // symbols used as brackets 9 | "brackets": [ 10 | ["{", "}"], 11 | ["[", "]"], 12 | ["(", ")"] 13 | ], 14 | // symbols that are auto closed when typing 15 | "autoClosingPairs": [ 16 | ["{", "}"], 17 | ["[", "]"], 18 | ["(", ")"], 19 | ["\"", "\""], 20 | ["'", "'"] 21 | ], 22 | // symbols that that can be used to surround a selection 23 | "surroundingPairs": [ 24 | ["{", "}"], 25 | ["[", "]"], 26 | ["(", ")"], 27 | ["\"", "\""], 28 | ["'", "'"] 29 | ] 30 | } -------------------------------------------------------------------------------- /extras/VisualStudioCode/ca65-gsu/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ca65-gsu", 3 | "displayName": "ca65-gsu", 4 | "description": "ca65/GSU-1 syntax highlighting", 5 | "version": "1.0.0", 6 | "publisher": "optiroc", 7 | "author": { 8 | "name": "David Lindecrantz", 9 | "email": "optiroc@gmail.com" 10 | }, 11 | "engines": { 12 | "vscode": "^1.5.0" 13 | }, 14 | "keywords": [ 15 | "assembler", 16 | "console", 17 | "super nintendo", 18 | "superfx" 19 | ], 20 | "categories": [ 21 | "Languages" 22 | ], 23 | "contributes": { 24 | "languages": [{ 25 | "id": "ca65-gsu", 26 | "aliases": ["ca65-gsu", "ca65-gsu"], 27 | "extensions": [".sgs",".igs"], 28 | "configuration": "./language-configuration.json" 29 | }], 30 | "grammars": [{ 31 | "language": "ca65-gsu", 32 | "scopeName": "source.ca65-gsu", 33 | "path": "./syntaxes/ca65-gsu.tmLanguage" 34 | }] 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /extras/VisualStudioCode/ca65-gsu/syntaxes/ca65-gsu.tmLanguage: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | fileTypes 6 | 7 | sgs 8 | igs 9 | 10 | name 11 | ca65-gsu 12 | patterns 13 | 14 | 15 | comment 16 | GSU instructions 17 | match 18 | (?i)\b(adc|add|alt1|alt2|alt3|and|asr|bcc|bcs|beq|bge|bic|blt|bmi|bne|bpl|bra|bvc|bvs|cache|cmode|cmp|color|dec|div2|fmult|from|getb|getbh|getbl|getbs|getc|hib|ibt|inc|iwt|jmp|ldb|ldw|lea|link|ljmp|lm|lms|lmult|lob|loop|lsr|merge|move|moveb|moves|movew|mult|nop|not|or|or|plot|ramb|rol|romb|ror|rpix|sbc|sbk|sex|sm|and|sms|stb|stop|stw|sub|swap|to|umult|with|xor)\b 19 | name 20 | keyword.mnenomic.ca65-gsu 21 | 22 | 23 | comment 24 | GSU casfx pseudo-instructions 25 | match 26 | (?i)\b(pop|push|jal|ret)\b 27 | name 28 | keyword.pseudoinstructions.ca65-gsu 29 | 30 | 31 | comment 32 | ca65 pseudo functions 33 | match 34 | (?i)\.(addrsize|and|bank|bankbyte|blank|concat|const|hibyte|hiword|ident|left|lobyte|loword|match|max|mid|min|not|or|ref|referenced|right|sizeof|strat|sprintf|string|strlen|tcount|xmatch)\b 35 | name 36 | keyword.directives.ca65-gsu 37 | 38 | 39 | comment 40 | ca65 control commands 41 | match 42 | (?i)^[\s]*\.(a16|a8|addr|align|asciiz|assert|autoimport|bankbytes|bss|byt|byte|case|charmap|code|condes|constructor|data|dbyt|debuginfo|define|def|defined|delmacro|delmac|destructor|dword|else|elseif|end|endenum|endif|endmac|endmacro|endproc|endrep|endrepeat|endscope|endstruct|enum|error|exitmac|exitmacro|export|exportzp|faraddr|fatal|feature|fileopt|fopt|forceimport|global|globalzp|hibytes|i16|i8|if|ifblank|ifconst|ifdef|ifnblank|ifndef|ifnref|ifp02|ifp816|ifpc02|ifpcs02|ifref|import|importzp|incbin|include|interruptor|linecont|list|listbytes|lobytes|local|localchar|macpack|mac|macro|org|out|p02|p816|pagelen|pagelength|pc02|popcpu|popseg|proc|psc02|pushcpu|pushseg|reloc|repeat|res|rodata|scope|segment|set|setcpu|smart|struct|tag|undef|undefine|union|warning|word|zeropage)\b 43 | name 44 | keyword.directives.ca65-gsu 45 | 46 | 47 | comment 48 | Labels 49 | match 50 | (^|\n)([a-zA-Z0-9_\\@]*): 51 | name 52 | support.class.ca65-gsu 53 | 54 | 55 | comment 56 | String 57 | match 58 | (^|\s)"[\w\s\W]*" 59 | name 60 | string.ca65-gsu 61 | 62 | 63 | comment 64 | Hexadecimal number 65 | match 66 | (?i)\$((\d|[A-F])+)\b 67 | name 68 | constant.numeric.hex.ca65-gsu 69 | 70 | 71 | comment 72 | Binary number 73 | match 74 | (?i)\%([0|1]+)\b 75 | name 76 | constant.numeric.bin.ca65-gsu 77 | 78 | 79 | comment 80 | Decimal number 81 | match 82 | (?i)\#([0-9a-f$%]+)\b 83 | name 84 | constant.numeric.dec.ca65-gsu 85 | 86 | 87 | comment 88 | Block comment 89 | begin 90 | /\* 91 | end 92 | \*/ 93 | name 94 | comment.block.ca65-gsu 95 | 96 | 97 | comment 98 | Documentation comment 99 | begin 100 | /\*\*(?!/) 101 | end 102 | \*/ 103 | name 104 | comment.block.documentation.ca65-gsu 105 | 106 | 107 | comment 108 | Line comment 109 | begin 110 | ; 111 | end 112 | \n 113 | name 114 | comment.line.ca65-gsu 115 | 116 | 117 | scopeName 118 | source.ca65-gsu 119 | uuid 120 | 9aef490b-df42-445f-ca65-725148a9d3e4 121 | 122 | 123 | -------------------------------------------------------------------------------- /extras/VisualStudioCode/ca65-spc700/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | // A launch configuration that launches the extension inside a new window 2 | { 3 | "version": "0.1.0", 4 | "configurations": [ 5 | { 6 | "name": "Launch Extension", 7 | "type": "extensionHost", 8 | "request": "launch", 9 | "runtimeExecutable": "${execPath}", 10 | "args": ["--extensionDevelopmentPath=${workspaceRoot}" ] 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /extras/VisualStudioCode/ca65-spc700/README.md: -------------------------------------------------------------------------------- 1 | # ca65-spc700 2 | 3 | Syntax highlighting for ca65-flavored SPC700 assembler. 4 | -------------------------------------------------------------------------------- /extras/VisualStudioCode/ca65-spc700/language-configuration.json: -------------------------------------------------------------------------------- 1 | { 2 | "comments": { 3 | // symbol used for single line comment. Remove this entry if your language does not support line comments 4 | "lineComment": "//", 5 | // symbols used for start and end a block comment. Remove this entry if your language does not support block comments 6 | "blockComment": [ "/*", "*/" ] 7 | }, 8 | // symbols used as brackets 9 | "brackets": [ 10 | ["{", "}"], 11 | ["[", "]"], 12 | ["(", ")"] 13 | ], 14 | // symbols that are auto closed when typing 15 | "autoClosingPairs": [ 16 | ["{", "}"], 17 | ["[", "]"], 18 | ["(", ")"], 19 | ["\"", "\""], 20 | ["'", "'"] 21 | ], 22 | // symbols that that can be used to surround a selection 23 | "surroundingPairs": [ 24 | ["{", "}"], 25 | ["[", "]"], 26 | ["(", ")"], 27 | ["\"", "\""], 28 | ["'", "'"] 29 | ] 30 | } -------------------------------------------------------------------------------- /extras/VisualStudioCode/ca65-spc700/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ca65-spc700", 3 | "displayName": "ca65-spc700", 4 | "description": "ca65/SPC700 syntax highlighting", 5 | "version": "1.0.0", 6 | "publisher": "optiroc", 7 | "author": { 8 | "name": "David Lindecrantz", 9 | "email": "optiroc@gmail.com" 10 | }, 11 | "engines": { 12 | "vscode": "^1.5.0" 13 | }, 14 | "keywords": [ 15 | "assembler", 16 | "console", 17 | "super nintendo" 18 | ], 19 | "categories": [ 20 | "Languages" 21 | ], 22 | "contributes": { 23 | "languages": [{ 24 | "id": "ca65-spc700", 25 | "aliases": ["ca65-spc700", "ca65-spc700"], 26 | "extensions": [".s700",".i700"], 27 | "configuration": "./language-configuration.json" 28 | }], 29 | "grammars": [{ 30 | "language": "ca65-spc700", 31 | "scopeName": "source.ca65-spc700", 32 | "path": "./syntaxes/ca65-spc700.tmLanguage" 33 | }] 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /extras/VisualStudioCode/ca65-spc700/syntaxes/ca65-spc700.tmLanguage: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | fileTypes 6 | 7 | s700 8 | i700 9 | 10 | name 11 | ca65-spc700 12 | patterns 13 | 14 | 15 | comment 16 | SPC700 instructions 17 | match 18 | (?i)\b(adc|addw|and1|and|asl|bbc|bbs|bcc|bcs|beq|bmi|bne|bpl|bra|brk|bvc|bvs|call|cbne|clr1|clrc|clrp|clrv|cmp|cmpw|daa|das|dbnz|dec|decw|di|div|ei|eor1|eor|inc|incw|jmp|lsr|mov1|mov|movw|mul|nop|not1|notc|or1|or|pcall|pop|push|ret1|ret|rol|ror|sbc|set1|setc|setp|sleep|stop|subw|tcall|tclr1|tset1|xcn)\b 19 | name 20 | keyword.mnenomic.ca65-spc700 21 | 22 | 23 | comment 24 | ca65 pseudo functions 25 | match 26 | (?i)\.(addrsize|and|bank|bankbyte|blank|concat|const|hibyte|hiword|ident|left|lobyte|loword|match|max|mid|min|not|or|ref|referenced|right|sizeof|strat|sprintf|string|strlen|tcount|xmatch)\b 27 | name 28 | keyword.directives.ca65-spc700 29 | 30 | 31 | comment 32 | ca65 control commands 33 | match 34 | (?i)^[\s]*\.(a16|a8|addr|align|asciiz|assert|autoimport|bankbytes|bss|byt|byte|case|charmap|code|condes|constructor|data|dbyt|debuginfo|define|def|defined|delmacro|delmac|destructor|dword|else|elseif|end|endenum|endif|endmac|endmacro|endproc|endrep|endrepeat|endscope|endstruct|enum|error|exitmac|exitmacro|export|exportzp|faraddr|fatal|feature|fileopt|fopt|forceimport|global|globalzp|hibytes|i16|i8|if|ifblank|ifconst|ifdef|ifnblank|ifndef|ifnref|ifp02|ifp816|ifpc02|ifpcs02|ifref|import|importzp|incbin|include|interruptor|linecont|list|listbytes|lobytes|local|localchar|macpack|mac|macro|org|out|p02|p816|pagelen|pagelength|pc02|popcpu|popseg|proc|psc02|pushcpu|pushseg|reloc|repeat|res|rodata|scope|segment|set|setcpu|smart|struct|tag|undef|undefine|union|warning|word|zeropage)\b 35 | name 36 | keyword.directives.ca65-spc700 37 | 38 | 39 | comment 40 | Labels 41 | match 42 | (^|\n)([a-zA-Z0-9_\\@]*): 43 | name 44 | support.class.ca65-spc700 45 | 46 | 47 | comment 48 | String 49 | match 50 | (^|\s)"[\w\s\W]*" 51 | name 52 | string.ca65-spc700 53 | 54 | 55 | comment 56 | Hexadecimal number 57 | match 58 | (?i)\$((\d|[A-F])+)\b 59 | name 60 | constant.numeric.hex.ca65-spc700 61 | 62 | 63 | comment 64 | Binary number 65 | match 66 | (?i)\%([0|1]+)\b 67 | name 68 | constant.numeric.bin.ca65-spc700 69 | 70 | 71 | comment 72 | Decimal number 73 | match 74 | (?i)\#([0-9a-f$%]+)\b 75 | name 76 | constant.numeric.dec.ca65-spc700 77 | 78 | 79 | comment 80 | Block comment 81 | begin 82 | /\* 83 | end 84 | \*/ 85 | name 86 | comment.block.ca65-spc700 87 | 88 | 89 | comment 90 | Documentation comment 91 | begin 92 | /\*\*(?!/) 93 | end 94 | \*/ 95 | name 96 | comment.block.documentation.ca65-spc700 97 | 98 | 99 | comment 100 | Line comment 101 | begin 102 | ; 103 | end 104 | \n 105 | name 106 | comment.line.ca65-spc700 107 | 108 | 109 | scopeName 110 | source.ca65-spc700 111 | uuid 112 | 9aef490b-df42-445f-ca65-765348b9d3e4 113 | 114 | 115 | -------------------------------------------------------------------------------- /include/CPU/Header.s: -------------------------------------------------------------------------------- 1 | ; libSFX ROM Header 2 | ; David Lindecrantz 3 | 4 | .include "../libSFX.i" 5 | 6 | ;------------------------------------------------------------------------------- 7 | .segment "HEADER" 8 | ROM_HEADER: 9 | .byte ROM_MAKERCODE ;$ffb0-$ffb1 Maker code 10 | .byte ROM_GAMECODE ;$ffb2-$ffb5 Game code 11 | .byte 0,0,0,0,0,0 ;$ffb6-$ffbb Reserved 12 | .byte $00 ;$ffbc Expansion flash size 13 | .byte ROM_EXPRAMSIZE ;$ffbd Expansion RAM size 14 | .byte $00 ;$ffbe Special version 15 | .byte >ROM_CHIPSET ;$ffbf Chipset sub-type 16 | .byte ROM_TITLE ;$ffc0-$ffd4 ROM title 17 | .byte ROM_MAPMODESPEED ;$ffd5 Map mode / ROM speed 18 | .byte 3 | 4 | .ifndef ::__MBSFX_CPU_DSP__ 5 | ::__MBSFX_CPU_DSP__ = 1 6 | 7 | ;------------------------------------------------------------------------------- 8 | ;DSP MMIO Registers 9 | 10 | .if ROM_MAPMODE <> 1 11 | ;DSP with Mode 20 "LoROM" mapping 12 | DSP_BANK = $bf 13 | DSP_STATUS = $8000 ;Status register 14 | DSP_DATA = $c000 ;Data register 15 | 16 | .else 17 | ;DSP with Mode 21 "HiROM) mapping 18 | DSP_BANK = $80 19 | DSP_STATUS = $6000 ;Status register 20 | DSP_DATA = $7000 ;Data register 21 | 22 | .endif 23 | 24 | ;------------------------------------------------------------------------------- 25 | ;DSP Commands 26 | 27 | ;General calculation 28 | DSP_CMD_multiply = $00; Fixed point (Q0.15?) multiplication 29 | DSP_CMD_inverse = $10 30 | 31 | ;Trigonometric calculation 32 | DSP_CMD_triangle = $04 33 | 34 | ;Vector calculation 35 | DSP_CMD_radius = $08 36 | DSP_CMD_range = $18 37 | DSP_CMD_distance = $28 38 | 39 | ;Coordinate calculation 40 | DSP_CMD_rotate = $0c 41 | DSP_CMD_polar = $1c 42 | DSP_CMD_rotate2d = DSP_CMD_rotate 43 | DSP_CMD_rotate3d = DSP_CMD_polar 44 | 45 | ;Projection calculation 46 | DSP_CMD_parameter = $02 47 | DSP_CMD_project = $06 48 | 49 | ;Matrix 50 | DSP_CMD_attitude_a = $01 51 | DSP_CMD_attitude_b = $11 52 | DSP_CMD_attitude_c = $21 53 | DSP_CMD_objective_a = $0d 54 | DSP_CMD_objective_b = $1d 55 | DSP_CMD_objective_c = $2d 56 | DSP_CMD_subjective_a = $03 57 | DSP_CMD_subjective_b = $13 58 | DSP_CMD_subjective_c = $23 59 | DSP_CMD_scalar_a = $0b 60 | DSP_CMD_scalar_b = $1b 61 | DSP_CMD_scalar_c = $2b 62 | 63 | DSP_CMD_gyrate = $14 64 | 65 | ;Screen space calculation 66 | DSP_CMD_raster = $1a 67 | DSP_CMD_target = $0e 68 | 69 | .endif;__MBSFX_CPU_DSP__ 70 | -------------------------------------------------------------------------------- /include/CPU_GSU.i: -------------------------------------------------------------------------------- 1 | ; libSFX S-CPU to GSU Register Definitions 2 | ; David Lindecrantz 3 | 4 | .ifndef ::__MBSFX_CPU_GSU__ 5 | ::__MBSFX_CPU_GSU__ = 1 6 | 7 | GSU_SRAM = $700000 8 | 9 | ;------------------------------------------------------------------------------- 10 | ;GSU MMIO Registers (mirrored in banks 00h-3Fh and 80h-BFh) 11 | ;During GSU operation, only SFR, SCMR, and VCR may be accessed 12 | 13 | GSU_R0 = $3000 ;Default source/destination 14 | GSU_R1 = $3002 ;PLOT instruction X coordinate 15 | GSU_R2 = $3004 ;PLOT instruction Y coordinate 16 | GSU_R3 = $3006 ;General purpose 17 | GSU_R4 = $3008 ;LMULT instruction, lower 16 bits of result 18 | GSU_R5 = $300a ;General purpose 19 | GSU_R6 = $300c ;FMULT and LMULT instructions, multiplication 20 | GSU_R7 = $300e ;MERGE instruction, source 1 21 | GSU_R8 = $3010 ;MERGE instruction, source 2 22 | GSU_R9 = $3012 ;General purpose 23 | GSU_R10 = $3014 ;General purpose (stack pointer by convention) 24 | GSU_R11 = $3016 ;LINK instruction destination 25 | GSU_R12 = $3018 ;LOOP instruction counter 26 | GSU_R13 = $301a ;LOOP instruction branch address 27 | GSU_R14 = $301c ;Game Pak ROM address pointer (for GETxx instructions) 28 | GSU_R15 = $301e ;Program counter, write MSB to start operation 29 | 30 | GSU_SFR = $3030 ;Status/Flag Register 31 | GSU_PBR = $3034 ;Program Bank Register 32 | GSU_ROMBR = $3036 ;Game Pak ROM Bank Register 33 | GSU_RAMBR = $303c ;Game Pak RAM Bank Register 34 | GSU_CBR = $303e ;Cache Base Register 35 | GSU_SCBR = $3038 ;Screen Base Register 36 | GSU_SCMR = $303a ;Screen Mode Register 37 | 38 | GSU_BRAMR = $3033 ;Back-up RAM Register 39 | GSU_VCR = $303b ;Version Code Register 40 | GSU_CFGR = $3037 ;Config Register 41 | GSU_CLSR = $3039 ;Clock Select Register 42 | 43 | GSU_CACHE = $3100 ;GSU Cache RAM 44 | 45 | .endif;__MBSFX_CPU_GSU__ 46 | -------------------------------------------------------------------------------- /include/CPU_MSU.i: -------------------------------------------------------------------------------- 1 | ; libSFX S-CPU to MSU-1 Communication 2 | ; Kyle Swanson 3 | 4 | .ifndef ::__MBSFX_CPU_MSU__ 5 | ::__MBSFX_CPU_MSU__ = 1 6 | 7 | ;------------------------------------------------------------------------------- 8 | ;MSU-1 MMIO Registers 9 | 10 | MSU_STATUS = $2000 11 | MSU_READ = $2001 12 | MSU_ID = $2002 13 | MSU_SEEK = $2000 14 | MSU_TRACK = $2004 15 | MSU_VOLUME = $2006 16 | MSU_CONTROL = $2007 17 | 18 | ;------------------------------------------------------------------------------- 19 | ;MSU-1 Macros 20 | 21 | .macro MSU_detect MSU_detected, MSU_not_detected 22 | RW_push set:i16 23 | ldx MSU_ID 24 | cpx #$2D53 ; 'S-' 25 | bne :+ 26 | ldx MSU_ID+2 27 | cpx #$534D ; 'MS' 28 | bne :+ 29 | ldx MSU_ID+4 30 | cpx #$3155 ; 'U1' 31 | 32 | : RW_pull 33 | bne :+ 34 | jsr MSU_detected 35 | bra :++ 36 | : jsr MSU_not_detected 37 | : 38 | .endmac 39 | 40 | 41 | .endif;__MBSFX_CPU_MSU__ 42 | -------------------------------------------------------------------------------- /include/Configurations/Map.cfg: -------------------------------------------------------------------------------- 1 | # libSFX Default Memory Map (Mode 20 "LoROM" mapping with 4*32kB banks) 2 | # David Lindecrantz 3 | 4 | # Copy this file (or any of the supplied examples) to your source path as "Map.cfg" and edit as necessary 5 | # If no custom "Map.cfg" is found, this default file is included (from $(libsfx_dir)/Configurations/Map.cfg) 6 | 7 | SYMBOLS { 8 | __STACKSIZE__: type = weak, value = $100; 9 | __ZPADSIZE__: type = weak, value = $10; 10 | __ZNMISIZE__: type = weak, value = $10; 11 | __RPADSIZE__: type = weak, value = $100; 12 | } 13 | 14 | MEMORY { 15 | ZPAD: start = $000000, size = __ZPADSIZE__, define = yes; 16 | ZNMI: start = __ZPADSIZE__, size = __ZNMISIZE__, define = yes; 17 | ZPAGE: start = __ZPADSIZE__ + __ZNMISIZE__, size = $100 - (__ZPADSIZE__ + __ZNMISIZE__), define = yes; 18 | LORAM: start = $000100, size = $1f00 - __STACKSIZE__, define = yes; 19 | STACK: start = $002000 - __STACKSIZE__, size = __STACKSIZE__, define = yes; 20 | HIRAM: start = $7e2000, size = $e000, define = yes; 21 | EXRAM: start = $7f0000, size = $10000, define = yes; 22 | 23 | ROM0: start = $808000, size = $8000, fill = yes, fillval = $ff; 24 | ROM1: start = $818000, size = $8000, fill = yes, fillval = $ff; 25 | ROM2: start = $828000, size = $8000, fill = yes, fillval = $ff; 26 | ROM3: start = $838000, size = $8000, fill = yes, fillval = $ff; 27 | 28 | SMPZPAGE: start = $0002, size = $00ee; 29 | SMPMMIO: start = $00f0, size = $0010; 30 | SMPSTACK: start = $0100, size = $0100; 31 | SMPRAM: start = $0200, size = $fdc0; 32 | } 33 | 34 | SEGMENTS { 35 | ZPAD: load = ZPAD, type = zp, optional = yes; 36 | ZNMI: load = ZNMI, type = zp, optional = yes; 37 | ZEROPAGE: load = ZPAGE, type = zp, optional = yes; 38 | BSS: load = LORAM, type = bss, optional = yes; 39 | LORAM: load = LORAM, type = bss, optional = yes; 40 | HIRAM: load = HIRAM, type = bss, optional = yes; 41 | EXRAM: load = EXRAM, type = bss, optional = yes; 42 | 43 | CODE: load = ROM0, type = ro; 44 | RODATA: load = ROM0, type = ro; 45 | LIBSFX: load = ROM0, type = ro, optional = yes; 46 | LIBSFX_PKG: load = ROM0, type = ro, optional = yes; 47 | LIBSFX_SMP: load = ROM0, type = rw, run = SMPZPAGE, optional = yes, define = yes; 48 | SMPCODE: load = ROM0, type = rw, run = SMPRAM, optional = yes, define = yes; 49 | HEADER: load = ROM0, type = ro, start = $80ffb0; 50 | VECTORS: load = ROM0, type = ro, start = $80ffe0; 51 | 52 | ROM1: load = ROM1, type = ro, optional = yes; 53 | ROM2: load = ROM2, type = ro, optional = yes; 54 | ROM3: load = ROM3, type = ro, optional = yes; 55 | 56 | SMPZPAGE: load = SMPZPAGE, type = zp, optional = yes; 57 | SMPRAM: load = SMPRAM, type = bss, optional = yes; 58 | } 59 | 60 | # Group: Map.cfg 61 | # 62 | # Map.cfg is the configuration file passed to the ld65 linker. 63 | # 64 | # It consists of two main parts∶ 65 | # * MEMORY describes the memory layout of the SNES and the cartridge 66 | # * SEGMENTS assigns segments to the memory areas specified 67 | # 68 | # In include/Configurations there are several template configuration 69 | # files for different ROM sizes and memory layouts. 70 | # 71 | # For full documentation of ld65 and its configuration refer to 72 | # the . 73 | -------------------------------------------------------------------------------- /include/Configurations/Map_Mode20_1mbit.cfg: -------------------------------------------------------------------------------- 1 | # libSFX Memory Map (Mode 20 "LoROM" mapping with 4*32kB banks) 2 | # David Lindecrantz 3 | 4 | SYMBOLS { 5 | __STACKSIZE__: type = weak, value = $100; 6 | __ZPADSIZE__: type = weak, value = $10; 7 | __ZNMISIZE__: type = weak, value = $10; 8 | __RPADSIZE__: type = weak, value = $100; 9 | } 10 | 11 | MEMORY { 12 | ZPAD: start = $000000, size = __ZPADSIZE__, define = yes; 13 | ZNMI: start = __ZPADSIZE__, size = __ZNMISIZE__, define = yes; 14 | ZPAGE: start = __ZPADSIZE__ + __ZNMISIZE__, size = $100 - (__ZPADSIZE__ + __ZNMISIZE__), define = yes; 15 | LORAM: start = $000100, size = $1f00 - __STACKSIZE__, define = yes; 16 | STACK: start = $002000 - __STACKSIZE__, size = __STACKSIZE__, define = yes; 17 | HIRAM: start = $7e2000, size = $e000, define = yes; 18 | EXRAM: start = $7f0000, size = $10000, define = yes; 19 | 20 | ROM0: start = $808000, size = $8000, fill = yes, fillval = $ff; 21 | ROM1: start = $818000, size = $8000, fill = yes, fillval = $ff; 22 | ROM2: start = $828000, size = $8000, fill = yes, fillval = $ff; 23 | ROM3: start = $838000, size = $8000, fill = yes, fillval = $ff; 24 | 25 | SMPZPAGE: start = $0002, size = $00ee; 26 | SMPMMIO: start = $00f0, size = $0010; 27 | SMPSTACK: start = $0100, size = $0100; 28 | SMPRAM: start = $0200, size = $fdc0; 29 | } 30 | 31 | SEGMENTS { 32 | ZPAD: load = ZPAD, type = zp, optional = yes; 33 | ZNMI: load = ZNMI, type = zp, optional = yes; 34 | ZEROPAGE: load = ZPAGE, type = zp, optional = yes; 35 | BSS: load = LORAM, type = bss, optional = yes; 36 | LORAM: load = LORAM, type = bss, optional = yes; 37 | HIRAM: load = HIRAM, type = bss, optional = yes; 38 | EXRAM: load = EXRAM, type = bss, optional = yes; 39 | 40 | CODE: load = ROM0, type = ro; 41 | RODATA: load = ROM0, type = ro; 42 | LIBSFX: load = ROM0, type = ro, optional = yes; 43 | LIBSFX_PKG: load = ROM0, type = ro, optional = yes; 44 | LIBSFX_SMP: load = ROM0, type = rw, run = SMPZPAGE, optional = yes, define = yes; 45 | SMPCODE: load = ROM0, type = rw, run = SMPRAM, optional = yes, define = yes; 46 | HEADER: load = ROM0, type = ro, start = $80ffb0; 47 | VECTORS: load = ROM0, type = ro, start = $80ffe0; 48 | 49 | ROM1: load = ROM1, type = ro, optional = yes; 50 | ROM2: load = ROM2, type = ro, optional = yes; 51 | ROM3: load = ROM3, type = ro, optional = yes; 52 | 53 | SMPZPAGE: load = SMPZPAGE, type = zp, optional = yes; 54 | SMPRAM: load = SMPRAM, type = bss, optional = yes; 55 | } 56 | -------------------------------------------------------------------------------- /include/Configurations/Map_Mode20_1mbit_GSU.cfg: -------------------------------------------------------------------------------- 1 | # libSFX Memory Map (Mode 20 "LoROM" mapping with 4*32kB banks and GSU segment) 2 | # David Lindecrantz 3 | 4 | SYMBOLS { 5 | __STACKSIZE__: type = weak, value = $100; 6 | __ZPADSIZE__: type = weak, value = $10; 7 | __ZNMISIZE__: type = weak, value = $10; 8 | __RPADSIZE__: type = weak, value = $100; 9 | } 10 | 11 | MEMORY { 12 | ZPAD: start = $000000, size = __ZPADSIZE__, define = yes; 13 | ZNMI: start = __ZPADSIZE__, size = __ZNMISIZE__, define = yes; 14 | ZPAGE: start = __ZPADSIZE__ + __ZNMISIZE__, size = $100 - (__ZPADSIZE__ + __ZNMISIZE__), define = yes; 15 | LORAM: start = $000100, size = $1f00 - __STACKSIZE__, define = yes; 16 | STACK: start = $002000 - __STACKSIZE__, size = __STACKSIZE__, define = yes; 17 | HIRAM: start = $7e2000, size = $e000, define = yes; 18 | EXRAM: start = $7f0000, size = $10000, define = yes; 19 | 20 | ROM0: start = $808000, size = $8000, fill = yes, fillval = $ff; 21 | ROM1: start = $818000, size = $8000, fill = yes, fillval = $ff; 22 | ROM2: start = $828000, size = $8000, fill = yes, fillval = $ff; 23 | ROM3: start = $838000, size = $8000, fill = yes, fillval = $ff; 24 | 25 | SMPZPAGE: start = $0002, size = $00ee; 26 | SMPMMIO: start = $00f0, size = $0010; 27 | SMPSTACK: start = $0100, size = $0100; 28 | SMPRAM: start = $0200, size = $fdc0; 29 | } 30 | 31 | SEGMENTS { 32 | ZPAD: load = ZPAD, type = zp, optional = yes; 33 | ZNMI: load = ZNMI, type = zp, optional = yes; 34 | ZEROPAGE: load = ZPAGE, type = zp, optional = yes; 35 | BSS: load = LORAM, type = bss, optional = yes; 36 | LORAM: load = LORAM, type = bss, optional = yes; 37 | HIRAM: load = HIRAM, type = bss, optional = yes; 38 | EXRAM: load = EXRAM, type = bss, optional = yes; 39 | 40 | CODE: load = ROM0, type = ro; 41 | RODATA: load = ROM0, type = ro; 42 | LIBSFX: load = ROM0, type = ro, optional = yes; 43 | LIBSFX_PKG: load = ROM0, type = ro, optional = yes; 44 | LIBSFX_SMP: load = ROM0, type = rw, run = SMPZPAGE, optional = yes, define = yes; 45 | SMPCODE: load = ROM0, type = rw, run = SMPRAM, optional = yes, define = yes; 46 | GSUCODE: load = ROM0, type = rw, run = SRAM, optional = yes, define = yes; 47 | HEADER: load = ROM0, type = ro, start = $80ffb0; 48 | VECTORS: load = ROM0, type = ro, start = $80ffe0; 49 | 50 | ROM1: load = ROM1, type = ro, optional = yes; 51 | ROM2: load = ROM2, type = ro, optional = yes; 52 | ROM3: load = ROM3, type = ro, optional = yes; 53 | 54 | SMPZPAGE: load = SMPZPAGE, type = zp, optional = yes; 55 | SMPRAM: load = SMPRAM, type = bss, optional = yes; 56 | } 57 | -------------------------------------------------------------------------------- /include/Configurations/Map_Mode20_2mbit.cfg: -------------------------------------------------------------------------------- 1 | # libSFX Memory Map (Mode 20 "LoROM" mapping with 8*32kB banks) 2 | # David Lindecrantz 3 | 4 | SYMBOLS { 5 | __STACKSIZE__: type = weak, value = $100; 6 | __ZPADSIZE__: type = weak, value = $10; 7 | __ZNMISIZE__: type = weak, value = $10; 8 | __RPADSIZE__: type = weak, value = $100; 9 | } 10 | 11 | MEMORY { 12 | ZPAD: start = $000000, size = __ZPADSIZE__, define = yes; 13 | ZNMI: start = __ZPADSIZE__, size = __ZNMISIZE__, define = yes; 14 | ZPAGE: start = __ZPADSIZE__ + __ZNMISIZE__, size = $100 - (__ZPADSIZE__ + __ZNMISIZE__), define = yes; 15 | LORAM: start = $000100, size = $1f00 - __STACKSIZE__, define = yes; 16 | STACK: start = $002000 - __STACKSIZE__, size = __STACKSIZE__, define = yes; 17 | HIRAM: start = $7e2000, size = $e000, define = yes; 18 | EXRAM: start = $7f0000, size = $10000, define = yes; 19 | 20 | ROM0: start = $808000, size = $8000, fill = yes, fillval = $ff; 21 | ROM1: start = $818000, size = $8000, fill = yes, fillval = $ff; 22 | ROM2: start = $828000, size = $8000, fill = yes, fillval = $ff; 23 | ROM3: start = $838000, size = $8000, fill = yes, fillval = $ff; 24 | ROM4: start = $838000, size = $8000, fill = yes, fillval = $ff; 25 | ROM5: start = $838000, size = $8000, fill = yes, fillval = $ff; 26 | ROM6: start = $838000, size = $8000, fill = yes, fillval = $ff; 27 | ROM7: start = $838000, size = $8000, fill = yes, fillval = $ff; 28 | 29 | SMPZPAGE: start = $0002, size = $00ee; 30 | SMPMMIO: start = $00f0, size = $0010; 31 | SMPSTACK: start = $0100, size = $0100; 32 | SMPRAM: start = $0200, size = $fdc0; 33 | } 34 | 35 | SEGMENTS { 36 | ZPAD: load = ZPAD, type = zp, optional = yes; 37 | ZNMI: load = ZNMI, type = zp, optional = yes; 38 | ZEROPAGE: load = ZPAGE, type = zp, optional = yes; 39 | BSS: load = LORAM, type = bss, optional = yes; 40 | LORAM: load = LORAM, type = bss, optional = yes; 41 | HIRAM: load = HIRAM, type = bss, optional = yes; 42 | EXRAM: load = EXRAM, type = bss, optional = yes; 43 | 44 | CODE: load = ROM0, type = ro; 45 | RODATA: load = ROM0, type = ro; 46 | LIBSFX: load = ROM0, type = ro, optional = yes; 47 | LIBSFX_PKG: load = ROM0, type = ro, optional = yes; 48 | LIBSFX_SMP: load = ROM0, type = rw, run = SMPZPAGE, optional = yes, define = yes; 49 | SMPCODE: load = ROM0, type = rw, run = SMPRAM, optional = yes, define = yes; 50 | HEADER: load = ROM0, type = ro, start = $80ffb0; 51 | VECTORS: load = ROM0, type = ro, start = $80ffe0; 52 | 53 | ROM1: load = ROM1, type = ro, optional = yes; 54 | ROM2: load = ROM2, type = ro, optional = yes; 55 | ROM3: load = ROM3, type = ro, optional = yes; 56 | ROM4: load = ROM3, type = ro, optional = yes; 57 | ROM5: load = ROM3, type = ro, optional = yes; 58 | ROM6: load = ROM3, type = ro, optional = yes; 59 | ROM7: load = ROM3, type = ro, optional = yes; 60 | 61 | SMPZPAGE: load = SMPZPAGE, type = zp, optional = yes; 62 | SMPRAM: load = SMPRAM, type = bss, optional = yes; 63 | } 64 | -------------------------------------------------------------------------------- /include/Configurations/Map_Mode21_1mbit.cfg: -------------------------------------------------------------------------------- 1 | # libSFX Memory Map (Mode 21 "HiROM" mapping with 2*64kB banks) 2 | # David Lindecrantz 3 | 4 | SYMBOLS { 5 | __STACKSIZE__: type = weak, value = $100; 6 | __ZPADSIZE__: type = weak, value = $10; 7 | __ZNMISIZE__: type = weak, value = $10; 8 | __RPADSIZE__: type = weak, value = $100; 9 | } 10 | 11 | MEMORY { 12 | ZPAD: start = $000000, size = __ZPADSIZE__, define = yes; 13 | ZNMI: start = __ZPADSIZE__, size = __ZNMISIZE__, define = yes; 14 | ZPAGE: start = __ZPADSIZE__ + __ZNMISIZE__, size = $100 - (__ZPADSIZE__ + __ZNMISIZE__), define = yes; 15 | LORAM: start = $000100, size = $1f00 - __STACKSIZE__, define = yes; 16 | STACK: start = $002000 - __STACKSIZE__, size = __STACKSIZE__, define = yes; 17 | HIRAM: start = $7e2000, size = $e000, define = yes; 18 | EXRAM: start = $7f0000, size = $10000, define = yes; 19 | 20 | ROM0: start = $c00000, size = $10000, fill = yes, fillval = $ff; 21 | ROM1: start = $c10000, size = $10000, fill = yes, fillval = $ff; 22 | 23 | SMPZPAGE: start = $0002, size = $00ee; 24 | SMPMMIO: start = $00f0, size = $0010; 25 | SMPSTACK: start = $0100, size = $0100; 26 | SMPRAM: start = $0200, size = $fdc0; 27 | } 28 | 29 | SEGMENTS { 30 | ZPAD: load = ZPAD, type = zp, optional = yes; 31 | ZNMI: load = ZNMI, type = zp, optional = yes; 32 | ZEROPAGE: load = ZPAGE, type = zp, optional = yes; 33 | BSS: load = LORAM, type = bss, optional = yes; 34 | LORAM: load = LORAM, type = bss, optional = yes; 35 | HIRAM: load = HIRAM, type = bss, optional = yes; 36 | EXRAM: load = EXRAM, type = bss, optional = yes; 37 | 38 | CODE: load = ROM0, type = ro; 39 | RODATA: load = ROM0, type = ro; 40 | LIBSFX: load = ROM0, type = ro, start = $c08000, optional = yes; 41 | LIBSFX_PKG: load = ROM0, type = ro, optional = yes; 42 | LIBSFX_SMP: load = ROM0, type = rw, run = SMPZPAGE, optional = yes, define = yes; 43 | SMPCODE: load = ROM0, type = rw, run = SMPRAM, optional = yes, define = yes; 44 | HEADER: load = ROM0, type = ro, start = $c0ffb0; 45 | VECTORS: load = ROM0, type = ro, start = $c0ffe0; 46 | 47 | ROM1: load = ROM1, type = ro, optional = yes; 48 | 49 | SMPZPAGE: load = SMPZPAGE, type = zp, optional = yes; 50 | SMPRAM: load = SMPRAM, type = bss, optional = yes; 51 | } 52 | -------------------------------------------------------------------------------- /include/Configurations/Map_Mode21_2mbit.cfg: -------------------------------------------------------------------------------- 1 | # libSFX Memory Map (Mode 21 "HiROM" mapping with 4*64kB banks) 2 | # David Lindecrantz 3 | 4 | SYMBOLS { 5 | __STACKSIZE__: type = weak, value = $100; 6 | __ZPADSIZE__: type = weak, value = $10; 7 | __ZNMISIZE__: type = weak, value = $10; 8 | __RPADSIZE__: type = weak, value = $100; 9 | } 10 | 11 | MEMORY { 12 | ZPAD: start = $000000, size = __ZPADSIZE__, define = yes; 13 | ZNMI: start = __ZPADSIZE__, size = __ZNMISIZE__, define = yes; 14 | ZPAGE: start = __ZPADSIZE__ + __ZNMISIZE__, size = $100 - (__ZPADSIZE__ + __ZNMISIZE__), define = yes; 15 | LORAM: start = $000100, size = $1f00 - __STACKSIZE__, define = yes; 16 | STACK: start = $002000 - __STACKSIZE__, size = __STACKSIZE__, define = yes; 17 | HIRAM: start = $7e2000, size = $e000, define = yes; 18 | EXRAM: start = $7f0000, size = $10000, define = yes; 19 | 20 | ROM0: start = $c00000, size = $10000, fill = yes, fillval = $ff; 21 | ROM1: start = $c10000, size = $10000, fill = yes, fillval = $ff; 22 | ROM2: start = $c20000, size = $10000, fill = yes, fillval = $ff; 23 | ROM3: start = $c30000, size = $10000, fill = yes, fillval = $ff; 24 | 25 | SMPZPAGE: start = $0002, size = $00ee; 26 | SMPMMIO: start = $00f0, size = $0010; 27 | SMPSTACK: start = $0100, size = $0100; 28 | SMPRAM: start = $0200, size = $fdc0; 29 | } 30 | 31 | SEGMENTS { 32 | ZPAD: load = ZPAD, type = zp, optional = yes; 33 | ZNMI: load = ZNMI, type = zp, optional = yes; 34 | ZEROPAGE: load = ZPAGE, type = zp, optional = yes; 35 | BSS: load = LORAM, type = bss, optional = yes; 36 | LORAM: load = LORAM, type = bss, optional = yes; 37 | HIRAM: load = HIRAM, type = bss, optional = yes; 38 | EXRAM: load = EXRAM, type = bss, optional = yes; 39 | 40 | CODE: load = ROM0, type = ro; 41 | RODATA: load = ROM0, type = ro; 42 | LIBSFX: load = ROM0, type = ro, start = $c08000, optional = yes; 43 | LIBSFX_PKG: load = ROM0, type = ro, optional = yes; 44 | LIBSFX_SMP: load = ROM0, type = rw, run = SMPZPAGE, optional = yes, define = yes; 45 | SMPCODE: load = ROM0, type = rw, run = SMPRAM, optional = yes, define = yes; 46 | HEADER: load = ROM0, type = ro, start = $c0ffb0; 47 | VECTORS: load = ROM0, type = ro, start = $c0ffe0; 48 | 49 | ROM1: load = ROM1, type = ro, optional = yes; 50 | ROM2: load = ROM1, type = ro, optional = yes; 51 | ROM3: load = ROM1, type = ro, optional = yes; 52 | 53 | SMPZPAGE: load = SMPZPAGE, type = zp, optional = yes; 54 | SMPRAM: load = SMPRAM, type = bss, optional = yes; 55 | } 56 | -------------------------------------------------------------------------------- /include/Configurations/SMP-Map.cfg: -------------------------------------------------------------------------------- 1 | # libSFX SCP700 Memory Map 2 | # David Lindecrantz 3 | 4 | MEMORY { 5 | ZP: start = $0002, size = $00ee; 6 | MMIO: start = $00f0, size = $0010; 7 | STACK: start = $0100, size = $0100; 8 | RAM: start = $0200, size = $fdc0; 9 | } 10 | 11 | SEGMENTS { 12 | ZEROPAGE: load = ZP, type = zp; 13 | MAIN: load = RAM, type = rw, define = yes; 14 | BSS: load = RAM, type = bss, define = yes; 15 | CODE: load = RAM, type = rw, define = yes; 16 | DATA: load = RAM, type = ro, define = yes; 17 | DIR: load = RAM, type = ro, align=$100, optional = yes, define = yes; 18 | } 19 | -------------------------------------------------------------------------------- /include/Configurations/libSFX.cfg: -------------------------------------------------------------------------------- 1 | ; libSFX Default Configuration 2 | ; David Lindecrantz 3 | ; 4 | ; Copy this file to your source path and edit as necessary 5 | 6 | /** 7 | Group: About 8 | 9 | This optional file is used to override the default ROM configuration and some 10 | library features. 11 | 12 | If libSFX.cfg is not found in the same directory as the Makefile, the default 13 | configuration file is included from $(libsfx_dir)/Configurations/libSFX.cfg. 14 | Any setting not defined will fall back to the default. 15 | */ 16 | 17 | ;------------------------------------------------------------------------------- 18 | /** 19 | Group: ROM Header 20 | */ 21 | 22 | /** 23 | Define: ROM_TITLE 24 | ROM title 25 | 26 | Must be 21 chars. 27 | >define "ROM_TITLE", "TO THE 65816 ON FIRE!" 28 | */ 29 | ; "123456789012345678901" 30 | define "ROM_TITLE", "TO THE 65816 ON FIRE!" 31 | 32 | /** 33 | Define: ROM_MAPMODE 34 | ROM map mode (4 bits) 35 | 36 | Make sure that Map.cfg corresponds to the map mode selected. Common modes∶ 37 | 38 | >$0 = Mode 20/30 (32k/bank "LoROM" mapping) 39 | >$1 = Mode 21/31 (64k/bank "HiROM" mapping) 40 | 41 | >ROM_MAPMODE = $0 42 | */ 43 | ROM_MAPMODE = $0 44 | 45 | /** 46 | Define: ROM_SPEED 47 | ROM speed (1 bit) 48 | 49 | >$0 = Slow (200ns access) 50 | >$1 = Fast (120ns access) 51 | 52 | >ROM_SPEED = $1 53 | */ 54 | ROM_SPEED = $1 55 | 56 | /** 57 | Define: ROM_CHIPSET 58 | Chipset (2 bytes) 59 | 60 | >$00 = ROM 61 | >$01 = ROM+RAM 62 | >$02 = ROM+SRAM 63 | >$03 = ROM+DSP 64 | >$04 = ROM+DSP+RAM 65 | >$05 = ROM+DSP+SRAM 66 | >$13 = ROM+GSU 67 | >$14 = ROM+GSU+RAM 68 | >$15 = ROM+GSU+SRAM 69 | >$33 = ROM+SA1 70 | >$34 = ROM+SA1+RAM 71 | >$35 = ROM+SA1+SRAM 72 | >$10f3 = ROM+CX4 73 | 74 | >ROM_CHIPSET = $00 75 | */ 76 | ROM_CHIPSET = $00 77 | 78 | /** 79 | Define: ROM_ROMSIZE 80 | ROM size (1 byte) 81 | 82 | >$07 = 1 Mbit (128 kB) 83 | >$08 = 2 Mbit (256 kB) 84 | >$09 = 4 Mbit (512 kB) 85 | >$0a = 8 Mbit (1 MB) 86 | >$0b = 16 Mbit (2 MB) 87 | >$0c = 32 Mbit (4 MB) 88 | 89 | Make sure that Map.cfg corresponds to the ROM size selected. 90 | 91 | >ROM_ROMSIZE = $07 92 | */ 93 | ROM_ROMSIZE = $07 94 | 95 | /** 96 | Define: ROM_RAMSIZE 97 | RAM size (1 byte) 98 | 99 | >$00 = None 100 | >$01 = 16 Kbit (2 kB) 101 | >$02 = 32 Kbit (4 kB) 102 | >$03 = 64 Kbit (8 kB) 103 | >$04 = 128 Kbit (16 kB) 104 | >$05 = 256 Kbit (32 kB) 105 | >...etc 106 | 107 | >ROM_RAMSIZE = $00 108 | */ 109 | ROM_RAMSIZE = $00 110 | 111 | /** 112 | Define: ROM_EXPRAMSIZE 113 | Expansion RAM size (1 byte) 114 | 115 | >$00 = None 116 | >$01 = 16 Kbit (2 kB) 117 | >$02 = 32 Kbit (4 kB) 118 | >$03 = 64 Kbit (8 kB) 119 | >$04 = 128 Kbit (16 kB) 120 | >$05 = 256 Kbit (32 kB) 121 | >...etc 122 | 123 | >ROM_EXPRAMSIZE = $00 124 | */ 125 | ROM_EXPRAMSIZE = $00 126 | 127 | /** 128 | Define: ROM_GAMECODE 129 | Game code (4 chars) 130 | 131 | >define "ROM_GAMECODE", "SFXJ" 132 | */ 133 | ; "1234" 134 | define "ROM_GAMECODE", "SFXJ" 135 | 136 | /** 137 | Define: ROM_MAKERCODE 138 | Maker code (2 chars) 139 | 140 | >define "ROM_MAKERCODE", "MB" 141 | */ 142 | ; "12" 143 | define "ROM_MAKERCODE", "MB" 144 | 145 | /** 146 | Define: ROM_VERSION 147 | Software minor version (1 byte) 148 | 149 | >ROM_VERSION = $00 150 | */ 151 | ROM_VERSION = $00 152 | 153 | /** 154 | Define: ROM_COUNTRY 155 | Country code (1 byte) 156 | 157 | >$00 = Japan 158 | >$01 = USA 159 | >$02 = Europe/PAL territories 160 | >...etc 161 | 162 | >ROM_COUNTRY = $00 163 | */ 164 | ROM_COUNTRY = $00 165 | 166 | 167 | ;-------------------------------------------------------------------- 168 | /** 169 | Group: libSFX Settings 170 | */ 171 | 172 | /** 173 | Define: SFX_JOY 174 | Automatic joypad read-out 175 | 176 | (start code) 177 | Bitwise OR each joypad to be read: JOY1 | JOY2 | JOY3 | JOY4 178 | 179 | Disable by setting SFX_JOY to DISABLE. 180 | To disable all automatic joypad/serial port read-out set SFX_AUTO_READOUT to DISABLE. 181 | 182 | Read joypad bits from zero-page locations (16 bits each)∶ 183 | * SFX_joy1trig 184 | * SFX_joy1cont 185 | * SFX_joy2trig 186 | * SFX_joy2cont 187 | ..etc 188 | 189 | *trig = bits are on during one frame when buttons are triggered 190 | *cont = bits are held continously as long as buttons are pushed 191 | (end) 192 | 193 | More info at 194 | 195 | >SFX_JOY = JOY1 | JOY2 196 | */ 197 | SFX_JOY = JOY1 | JOY2 198 | 199 | /** 200 | Define: SFX_AUTO_READOUT_FIRST 201 | Joypad read-out ordering 202 | 203 | Perform joypad read-out before or after calling soft NMI. 204 | * NO (default) will call NMI trampoline before automatic joypad read 205 | * YES will perform automatic joypad read before NMI trampoline call 206 | 207 | Note that while YES decreases joypad latency by one frame, 208 | it will incur a longer wait state within the NMI handler. 209 | 210 | >SFX_AUTO_READOUT_FIRST = NO 211 | */ 212 | SFX_AUTO_READOUT_FIRST = NO 213 | 214 | /** 215 | Define: SFX_AUTO_READOUT 216 | Fully disable automatic read-out 217 | 218 | Set to DISABLE to turn off automatic joypad port read-out completely. 219 | May be useful for that special occasion when you add custom serial 220 | port code, for instance a MIDI or keyboard interface driver... 221 | 222 | >SFX_AUTO_READOUT = ENABLE 223 | */ 224 | SFX_AUTO_READOUT = ENABLE 225 | -------------------------------------------------------------------------------- /include/Docs/Make.txt: -------------------------------------------------------------------------------- 1 | ; libSFX Makefile documentation 2 | 3 | /** 4 | Group: Make 5 | 6 | Building with libSFX involves three major parts∶ 7 | 8 | * (GNU)Make is invoked and does 9 | ... which in this case mostly involves: 10 | * Assembling source files to object code files with ca65 11 | * Linking the object code files into an sfc image with ld65 12 | 13 | These three steps are configured with the Makefile, libSFX.cfg and Map.cfg respectively. 14 | 15 | The 16 | doesn't need the latter two, as all configurable settings fall back to reasonable defaults. 17 | 18 | Make needs some input, but in the simplest case it's not much∶ 19 | 20 | Makefile: 21 | (start code) 22 | # Include libSFX.make 23 | libsfx_dir := ../.. 24 | include $(libsfx_dir)/libSFX.make 25 | (end) 26 | 27 | These are the two crucial statements needed to kick off the libSFX.make build script∶ 28 | * The "libsfx_dir" variable must point to the libSFX root directory. 29 | * The second statement includes "libSFX.make", which contain the rules needed to 30 | transform source files to object code and link the final binary. 31 | 32 | There are also a couple of special configuration variables that was best suited to put 33 | in the makefile, mostly because they are needed by both the assembler and the linker. 34 | 35 | The makefile can of course be used like makefiles usually are – to define rules and 36 | prerequisites for your particular project. In a lot of cases this will not be necessary 37 | for source code files, since libSFX.make will recursively add all source files with the 38 | appropriate file extensions (.s, .s700, .sgs) if none are explicitly added. 39 | 40 | 41 | *Configuration variables* 42 | 43 | _name_ 44 | Sets the name of the output file. 45 | 46 | (start code) 47 | name := Mode7-Madness 48 | (end) 49 | 50 | _debug_ 51 | If set debug information ($name.dsym, $name.dmap) will be written. Also, in debug 52 | configuration the "break" macro will output the otherwise unused WDM instruction which 53 | is used by the bsnes+ emulator to break the debugger. 54 | 55 | (start code) 56 | debug := 1 57 | (end) 58 | 59 | _libsfx_packages_ 60 | List of optional packages to link, as well as make available to the assembler with 61 | additional macros, memory locations et cetera. 62 | 63 | (start code) 64 | libsfx_packages := LZ4 Mouse 65 | (end) 66 | 67 | _stack_size_ 68 | Set space reserved for 65816 stack at memory location 00:2000 and downwards. 69 | Default is 100 bytes. 70 | 71 | (start code) 72 | stack_size := 200 73 | (end) 74 | 75 | _zpad_size_ 76 | Set space reserved for zero page scratchpad, addressable at label "ZPAD". 77 | Default is 10 bytes. 78 | 79 | (start code) 80 | zpad_size := 20 81 | (end) 82 | 83 | _znmi_size_ 84 | Set space reserved for zero page scratchpad for use inside interrupts. Addressable at label "ZNMI". 85 | Default is 10 bytes. 86 | 87 | (start code) 88 | znmi_size := 20 89 | (end) 90 | 91 | _rpad_size_ 92 | Set space reserved for LORAM scratchpad, addressable at label "RPAD". 93 | Default is 100 bytes. 94 | 95 | (start code) 96 | rpad_size := 20 97 | (end) 98 | 99 | _obj_dir_ 100 | Set custom directory for intermediate build files. 101 | Default is ".build". 102 | 103 | (start code) 104 | obj_dir := build 105 | (end) 106 | 107 | _src_ 108 | 65816 source files. If not set libSFX.make will automatically add all files named *.s. 109 | 110 | _src_smp_ 111 | SPC700 source files. If not set libSFX.make will automatically add all files named *.s700. 112 | 113 | _src_gsu_ 114 | GSU-1 source files. If not set libSFX.make will automatically add all files named *.sgs. 115 | 116 | */ 117 | -------------------------------------------------------------------------------- /include/Packages/LZ4/config: -------------------------------------------------------------------------------- 1 | libsfx_src += $(libsfx_inc)/Packages/LZ4/LZ4.s 2 | pkg_asflags += -D SFXPKG_LZ4 3 | -------------------------------------------------------------------------------- /include/Packages/Mouse/Mouse.i: -------------------------------------------------------------------------------- 1 | ; libSFX Super Nintendo SFM1 Mouse Support 2 | ; David Lindecrantz 3 | 4 | .ifndef ::__MBSFX_MOUSE__ 5 | ::__MBSFX_MOUSE__ = 1 6 | 7 | .ifndef SFX_MOUSE 8 | SFX_MOUSE = MOUSE1 9 | .endif 10 | 11 | .if SFX_JOY <> DISABLE 12 | .if (SFX_JOY < 0) || (SFX_JOY > (JOY1 | JOY2)) 13 | SFX_error "SFX_JOY: Bad configuration (only JOY1 and JOY2 is supported in conjunction with the mouse driver)" 14 | .endif 15 | .endif 16 | 17 | .if SFX_AUTO_READOUT = DISABLE 18 | SFX_error "SFX_AUTO_READOUT: Bad configuration (the mouse driver relies on automatic read-out)" 19 | .endif 20 | 21 | .ifndef MOUSE_cursor_x_min 22 | .define MOUSE_cursor_x_min $0000 23 | .endif 24 | .ifndef MOUSE_cursor_x_max 25 | .define MOUSE_cursor_x_max $00f4 26 | .endif 27 | .ifndef MOUSE_cursor_y_min 28 | .define MOUSE_cursor_y_min $0000 29 | .endif 30 | .ifndef MOUSE_cursor_y_max 31 | .define MOUSE_cursor_y_max $00d6 32 | .endif 33 | 34 | .define MOUSE_sensitivity_slow 0 35 | .define MOUSE_sensitivity_normal 1 36 | .define MOUSE_sensitivity_fast 2 37 | 38 | .define MOUSE_status_nc $00 39 | .define MOUSE_status_ok $01 40 | .define MOUSE_status_error $80 41 | 42 | .struct MOUSE_data 43 | status .byte 44 | sensitivity .byte 45 | buttons_cont .byte 46 | buttons_trig .byte 47 | delta_x .byte 48 | delta_y .byte 49 | cursor_x .word 50 | cursor_y .word 51 | .endstruct 52 | 53 | .global SFX_MOUSE_nmi_hook 54 | 55 | .if SFX_MOUSE & MOUSE1 56 | .globalzp SFX_mouse1 57 | .endif 58 | .if SFX_MOUSE & MOUSE2 59 | .globalzp SFX_mouse2 60 | .endif 61 | 62 | ;------------------------------------------------------------------------------- 63 | /** 64 | Group: Mouse 65 | Optional package adding SNES SFM1 Mouse support 66 | 67 | To link mouse support in a project, simply add Mouse to libsfx_packages in 68 | the project makefile. 69 | 70 | Makefile: 71 | (start code) 72 | # Use packages 73 | libsfx_packages := Mouse 74 | (end) 75 | 76 | The mouse package adds mouse polling to the regular automatic joypad polling. 77 | By default the driver will look for a mouse in port 1. This is configurable 78 | with the SFX_MOUSE variable∶ 79 | 80 | libSFX.cfg: 81 | (start code) 82 | SFX_MOUSE = MOUSE1 | MOUSE2 83 | (end) 84 | 85 | Mouse read-out data is stored in MOUSE_data structs with the following members∶ 86 | 87 | (start code) 88 | .struct MOUSE_data 89 | status .byte 90 | sensitivity .byte 91 | buttons_cont .byte 92 | buttons_trig .byte 93 | delta_x .byte 94 | delta_y .byte 95 | cursor_x .word 96 | cursor_y .word 97 | .endstruct 98 | 99 | Possible status values: 100 | .define MOUSE_status_nc $00 ;Mouse not connected 101 | .define MOUSE_status_ok $01 ;Mouse connected and working 102 | .define MOUSE_status_error $80 ;Hardware error 103 | 104 | Button presses are stored in the follwing bits of buttons_cont/buttons_trig: 105 | Bit 106 | 7 Right button 107 | 6 Left button 108 | (end) 109 | 110 | The driver updates all members during each VBlank interval at zero page 111 | locations SFX_mouse1 and SFX_mouse2. The data can be addressed like this∶ 112 | 113 | (start code) 114 | ;Load cursor vertical position 115 | lda z:SFX_mouse1+MOUSE_data::cursor_y 116 | (end) 117 | 118 | The 'sensitivity' member is used to set the mouse acceleration curve. 119 | 120 | (start code) 121 | ;Set normal mouse sensitivty 122 | lda #MOUSE_sensitivity_normal 123 | sta SFX_mouse1+MOUSE_data::sensitivity 124 | 125 | ;Possible values 126 | .define MOUSE_sensitivity_slow 0 127 | .define MOUSE_sensitivity_normal 1 128 | .define MOUSE_sensitivity_fast 2 129 | (end) 130 | 131 | All other members are read-only. 132 | 133 | If no mouse is detected and SFX_JOY is set for the port, the driver 134 | automatically falls back to joypad input. D-pad input is then mapped to 135 | delta and cursor, and the A/X buttons is mapped to the left/right buttons. 136 | 137 | The driver can optionally be "hugged" by special strings that – I suppose – some 138 | emulators rely on to automatically enable mouse input. Real hardware (and 139 | consequently, real emulators) doesn't care. 140 | 141 | libSFX.cfg: 142 | (start code) 143 | SFX_MOUSE_STRINGS = ENABLE 144 | (end) 145 | */ 146 | 147 | .endif;__MBSFX_MOUSE__ 148 | -------------------------------------------------------------------------------- /include/Packages/Mouse/config: -------------------------------------------------------------------------------- 1 | libsfx_src += $(libsfx_inc)/Packages/Mouse/Mouse.s 2 | pkg_asflags += -D SFXPKG_MOUSE 3 | -------------------------------------------------------------------------------- /include/SMP/System.s700: -------------------------------------------------------------------------------- 1 | ; Relocatable snippets that will load into $0002 of SPC700 RAM 2 | 3 | .include "../libSFX.i" 4 | .segment "LIBSFX_SMP" 5 | 6 | .export SMP_Burst, SMP_Burst_END, SMP_SetDSP, SMP_SetDSP_END 7 | 8 | ;------------------------------------------------------------------------------- 9 | ; Burst transfer S-CPU to S-SMP 10 | ; by Shay Green 11 | 12 | SMP_Burst: 13 | mov x,#$fe ;Transfer 254 pages 14 | 15 | @page: mov y,#$3f ;Transfer four-byte chunks 16 | @quad: mov a,CPUIO0 17 | @movA: mov !$0200+y,a 18 | mov a,CPUIO1 19 | @movB: mov !$0240+y,a 20 | mov a,CPUIO2 21 | @movC: mov !$0280+y,a 22 | mov a,CPUIO3 ;Tell S-CPU we're ready for more 23 | mov CPUIO3,y 24 | @movD: mov !$02C0+y,a 25 | dec y 26 | bpl @quad 27 | 28 | inc .lobyte(@movA)+2 ;Increment MSBs of addresses 29 | inc .lobyte(@movB)+2 30 | inc .lobyte(@movC)+2 31 | inc .lobyte(@movD)+2 32 | dec x 33 | bne @page 34 | 35 | jmp !IPL_INIT ;Back to IPL 36 | 37 | SMP_Burst_END: 38 | 39 | ;------------------------------------------------------------------------------- 40 | ; Upload DSP registers 41 | ; by Shay Green 42 | 43 | LOADER_DATA = $21 44 | 45 | SMP_SetDSP: 46 | mov x,LOADER_DATA 47 | mov sp,x 48 | mov x,#LOADER_DATA+1 49 | 50 | mov a,(x)+ ;Push PC and PSW from SPC header 51 | push a 52 | mov a,(x)+ 53 | push a 54 | mov a,(x)+ 55 | push a 56 | 57 | mov a,#$60 ;Set FLG to $60 rather than value from SPC 58 | mov FLG+x,a 59 | 60 | mov y,#$00 ;Restore DSP registers 61 | : mov a,(x)+ 62 | mov DSPADDR,y 63 | mov DSPDATA,a 64 | inc y 65 | bpl :- 66 | 67 | mov DSPADDR,#FLG ;Set for later 68 | jmp !IPL_INIT ;Back to IPL 69 | 70 | SMP_SetDSP_END: 71 | -------------------------------------------------------------------------------- /include/SMP_Util.i: -------------------------------------------------------------------------------- 1 | ; libSFX S-SMP Utility Macros 2 | ; David Lindecrantz 3 | ; Kyle Swanson 4 | 5 | .ifndef ::__MBSFX_SMP_Util__ 6 | ::__MBSFX_SMP_Util__ = 1 7 | 8 | ;------------------------------------------------------------------------------- 9 | ;DSP access 10 | 11 | /** 12 | Macro: DSP_get 13 | Get DSP register 14 | 15 | Parameters: 16 | >:in: dsp_reg Register (uint8) constant 17 | >:in: spc_reg Register (uint8) a/x/y 18 | */ 19 | .macro DSP_get dsp_reg, spc_reg 20 | .if (.blank({dsp_reg}) .or .blank({spc_reg})) 21 | SFX_error "DSP_get: Missing required parameter(s)" 22 | .elseif .not (.xmatch({spc_reg}, {a}) .or .xmatch({spc_reg}, {x}) .or .xmatch({spc_reg}, {y})) 23 | SFX_error "DSP_get: Invalid SPC-700 register (a/x/y)" 24 | .elseif ((dsp_reg < $00) .or (dsp_reg > $7F)) 25 | SFX_error "DSP_get: Invalid DSP register" 26 | .else 27 | mov DSPADDR,#dsp_reg 28 | .if .xmatch({spc_reg}, {x}) 29 | mov x,DSPDATA 30 | .elseif .xmatch({spc_reg}, {y}) 31 | mov y,DSPDATA 32 | .elseif .xmatch({spc_reg}, {a}) 33 | mov a,DSPDATA 34 | .else 35 | .endif 36 | .endif 37 | .endmac 38 | 39 | /** 40 | Macro: DSP_set 41 | Set DSP register 42 | 43 | Parameters: 44 | >:in: reg Register (uint8) constant 45 | >:in: val Value (uint8) constant 46 | > direct page address 47 | > a/x/y 48 | */ 49 | .macro DSP_set reg, val 50 | .if (.blank({val}) .or .blank({reg})) 51 | SFX_error "DSP_set: Missing required parameter(s)" 52 | .elseif ((reg < $00) .or (reg > $7F)) 53 | SFX_error "DSP_set: Invalid DSP register" 54 | .else 55 | mov DSPADDR,#reg 56 | .if (.xmatch({val}, {a}) .or .xmatch({val}, {x}) .or .xmatch({val}, {y})) 57 | .if .xmatch({val}, {x}) 58 | mov DSPDATA,x 59 | .elseif .xmatch({val}, {y}) 60 | mov DSPDATA,y 61 | .else 62 | mov DSPDATA,a 63 | .endif 64 | .else 65 | mov DSPDATA,val 66 | .endif 67 | .endif 68 | .endmac 69 | 70 | 71 | ;------------------------------------------------------------------------------- 72 | ;Misc 73 | 74 | /** 75 | Macro: SMP_exit 76 | Return to IPL (clears timers, zeropage) 77 | */ 78 | .macro SMP_exit 79 | mov CONTROL,#$80 80 | pcall 3 | 4 | .ifndef ::__MBSFX_DEFAULTS__ 5 | ::__MBSFX_DEFAULTS__ = 1 6 | 7 | ;------------------------------------------------------------------------------- 8 | ;Set defaults for any missing configuration symbols 9 | 10 | .if isnotdefined "ROM_TITLE" 11 | define "ROM_TITLE", "TO THE 65816 ON FIRE!" 12 | .endif 13 | .if .strlen(ROM_TITLE) <> 21 14 | SFX_warning "ROM_TITLE must be 21 characters" 15 | define "ROM_TITLE", "MEGABOYS STILL ALIVE!" 16 | .endif 17 | 18 | .ifndef ROM_MAPMODE 19 | ROM_MAPMODE = $0 20 | .endif 21 | 22 | .ifndef ROM_SPEED 23 | ROM_SPEED = $1 24 | .endif 25 | 26 | ROM_MAPMODESPEED = (ROM_MAPMODE & $0f) + ((ROM_SPEED & $01) << 4) + $20 27 | 28 | .ifndef ROM_CHIPSET 29 | ROM_CHIPSET = $00 30 | .endif 31 | 32 | .ifndef ROM_ROMSIZE 33 | ROM_ROMSIZE = $07 34 | .endif 35 | 36 | .ifndef ROM_RAMSIZE 37 | ROM_RAMSIZE = $00 38 | .endif 39 | 40 | .ifndef ROM_EXPRAMSIZE 41 | ROM_EXPRAMSIZE = $00 42 | .endif 43 | 44 | .if isnotdefined "ROM_GAMECODE" 45 | define "ROM_GAMECODE", "SFXJ" 46 | .endif 47 | .if .strlen(ROM_GAMECODE) <> 4 48 | SFX_warning "ROM_GAMECODE must be 4 characters" 49 | define "ROM_GAMECODE", "SFXJ" 50 | .endif 51 | 52 | .if isnotdefined "ROM_MAKERCODE" 53 | define "ROM_MAKERCODE", "MB" 54 | .endif 55 | .if .strlen(ROM_MAKERCODE) <> 2 56 | SFX_warning "ROM_MAKERCODE must be 2 characters" 57 | define "ROM_MAKERCODE", "MB" 58 | .endif 59 | 60 | .ifndef ROM_VERSION 61 | ROM_VERSION = $00 62 | .endif 63 | 64 | .ifndef ROM_COUNTRY 65 | ROM_COUNTRY = $00 66 | .endif 67 | 68 | .ifndef SFX_JOY 69 | SFX_JOY = JOY1 | JOY2 70 | .endif 71 | 72 | .if (SFX_JOY < 0) || (SFX_JOY > (JOY1 | JOY2 | JOY3 | JOY4)) 73 | SFX_error "SFX_JOY: Bad configuration" 74 | .endif 75 | 76 | .ifndef SFX_AUTO_READOUT 77 | SFX_AUTO_READOUT = ENABLE 78 | .endif 79 | 80 | .ifndef SFX_AUTO_READOUT_FIRST 81 | SFX_AUTO_READOUT_FIRST = NO 82 | .endif 83 | 84 | .endif;__MBSFX_DEFAULTS__ 85 | -------------------------------------------------------------------------------- /include/libSFX.defines.i: -------------------------------------------------------------------------------- 1 | ; libSFX Global Defines 2 | ; David Lindecrantz 3 | 4 | .ifndef ::__MBSFX_DEFINES__ 5 | ::__MBSFX_DEFINES__ = 1 6 | 7 | .define ON 1 8 | .define OFF 0 9 | .define YES 1 10 | .define NO 0 11 | .define ENABLE 1 12 | .define DISABLE 0 13 | 14 | .define JOY1 %00000001 15 | .define JOY2 %00000010 16 | .define JOY3 %00000100 17 | .define JOY4 %00001000 18 | 19 | .define MOUSE1 %00000001 20 | .define MOUSE2 %00000010 21 | 22 | .macro SFX_warning description 23 | .assert 0, warning, description 24 | .endmac 25 | 26 | .macro SFX_error description 27 | .assert 0, error, description 28 | .endmac 29 | 30 | ;------------------------------------------------------------------------------- 31 | ;Utility macros 32 | 33 | /** 34 | incbin 35 | Include binary file and create "name:" label and "sizeof_name" constant. 36 | 37 | :in: name Name identifier 38 | :in: file Filename string 39 | :in?: offset File offset constant 40 | :in?: size Data size constant 41 | */ 42 | .macro incbin name, file, offset, size 43 | .ident(.sprintf("%s", .string(name))): 44 | .if .not .blank(size) 45 | .incbin file, offset, size 46 | .elseif .not .blank(offset) 47 | .incbin file, offset 48 | .else 49 | .incbin file 50 | .endif 51 | .ident(.sprintf("sizeof_%s", .string(name))) = * - .ident(.sprintf("%s", .string(name))) 52 | .endmac 53 | 54 | ;------------------------------------------------------------------------------- 55 | ;isdefined/define/undefine 56 | ;By Movax12 (http://forums.nesdev.com/viewtopic.php?f=2&t=11112&start=15#p127674) 57 | 58 | .define isdefined(i) ( .defined(::.ident(.sprintf("_ISDEFINED_%s", i) )) .and ::.ident(.sprintf("_ISDEFINED_%s", i) ) ) 59 | 60 | .define isnotdefined(i) (.not (.defined(::.ident(.sprintf("_ISDEFINED_%s", i) )) .and ::.ident(.sprintf("_ISDEFINED_%s", i) ) ) ) 61 | 62 | .macro define i, v 63 | .if isdefined i 64 | .undefine .ident(i) 65 | .endif 66 | .define .ident(i) v 67 | ::.ident(.sprintf("_ISDEFINED_%s", i)) .set 1 68 | .endmacro 69 | 70 | .macro undefine i 71 | .if isdefined i 72 | .undefine .ident(i) 73 | .endif 74 | ::.ident(.sprintf("_ISDEFINED_%s", i)) .set 0 75 | .endmacro 76 | 77 | 78 | .endif;__MBSFX_DEFINES__ 79 | -------------------------------------------------------------------------------- /include/libSFX.i: -------------------------------------------------------------------------------- 1 | ; libSFX 2 | ; Super Famicom Development Framework 3 | ; David Lindecrantz 4 | 5 | .feature c_comments 6 | .p816 7 | .smart - 8 | .linecont + 9 | 10 | .ifndef ::__MBSFX_INC__ 11 | ::__MBSFX_INC__ = 1 12 | 13 | ;------------------------------------------------------------------------------- 14 | /** 15 | Group: libSFX documentation 16 | 17 | libSFX is a Super Nintendo assembler development framework. It aims to 18 | add as little magic and abstraction to the programming as possible while 19 | removing the tedium of boilerplate and mandatory micro management of 20 | configuration files. 21 | 22 | By leveraging the ca65 assembler and several macro packs it can 23 | create object code for∶ 24 | 25 | * WDC65816 - also known as S-CPU, the main processor 26 | * SPC700 - the Sony 8-bit CPU (S-SMP) controlling the sound DSP (S-DSP) 27 | * GSU - Graphics Support Unit, also known as "SuperFX" 28 | 29 | Using (and optionally extending) the included makefiles and configurations 30 | it's a relative breeze to get SNES code up and running! 31 | 32 | *Anatomy* 33 | libSFX consists of a small runtime that mainly initializes the system and 34 | handles hardware interrupts (which can be redirected in software). The real 35 | rice of the library are the macros included and documented here. 36 | 37 | _Packages_ 38 | There are also opt-in packages, adding a bit more to the object code size, 39 | for non-core features like input peripherals and data decompression. 40 | These are documented in the "Packages" section. 41 | 42 | _Tools_ 43 | The ca65 toolchain and a couple of support tools are included as submodules 44 | in the libSFX/tools directory. These are the only tools used by the libSFX.make 45 | makefile, making libSFX pretty much self contained. Running make from the 46 | repository root will sync the submodules and build the tools. 47 | 48 | _SFX 🤷‍️_ 49 | Why is it called libSFX? That sounds like a library of sound effects. Well, 50 | yes it does. However, "SFX" was also how Nintendo refered to the SNES/SFC in 51 | the very early developer documentation. It was through photocopied binders of 52 | those documents – with severe generation loss! – I first learned about the innards 53 | of the Super Nintendo, and I have lovingly cultivated a habit of using SFX to prefix 54 | and suffix my SNES code over the years. 55 | 56 | *Get started* 57 | Clone, fork or download the repository at 58 | and dive into the documentation. 59 | 60 | libSFX is developed by David Lindecrantz and distributed under the terms of 61 | the . 62 | */ 63 | ;------------------------------------------------------------------------------- 64 | 65 | .include "libSFX.defines.i" 66 | .include "libSFX.cfg" 67 | .include "libSFX.defaults.i" 68 | 69 | .if .defined(TARGET_SMP) 70 | ;S-SMP includes 71 | .include "SMP_Def.i" 72 | .include "SMP_Util.i" 73 | .include "SMP_ADSR.i" 74 | .include "SMP_Assembler.i" 75 | 76 | .elseif .defined(TARGET_GSU) 77 | ;GSU includes 78 | .include "GSU_Assembler.i" 79 | 80 | .else 81 | ;S-CPU includes 82 | .include "CPU_Def.i" 83 | .include "CPU.i" 84 | .include "CPU_Runtime.i" 85 | .include "CPU_Memory.i" 86 | .include "CPU_PPU.i" 87 | .include "CPU_Math.i" 88 | .include "CPU_DataStructures.i" 89 | .include "CPU_SMP.i" 90 | .include "CPU_DSP.i" 91 | .include "CPU_GSU.i" 92 | .include "CPU_MSU.i" 93 | 94 | ;S-CPU optional packages 95 | .if .defined(SFXPKG_LZ4) 96 | .include "Packages/LZ4/LZ4.i" 97 | .endif 98 | .if .defined(SFXPKG_MOUSE) 99 | .include "Packages/Mouse/Mouse.i" 100 | .endif 101 | 102 | ;Initial register widths 103 | RW_init 104 | 105 | .endif 106 | 107 | .endif;__MBSFX_INC__ 108 | -------------------------------------------------------------------------------- /tests/Mode20/Data/Graphics.palette: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/tests/Mode20/Data/Graphics.palette -------------------------------------------------------------------------------- /tests/Mode20/Data/Graphics.tilemap.lz4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/tests/Mode20/Data/Graphics.tilemap.lz4 -------------------------------------------------------------------------------- /tests/Mode20/Data/Graphics.tiles.lz4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/tests/Mode20/Data/Graphics.tiles.lz4 -------------------------------------------------------------------------------- /tests/Mode20/Data/Music.spc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/tests/Mode20/Data/Music.spc -------------------------------------------------------------------------------- /tests/Mode20/Data/Repetetive.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/tests/Mode20/Data/Repetetive.bin -------------------------------------------------------------------------------- /tests/Mode20/Makefile: -------------------------------------------------------------------------------- 1 | # Name 2 | name := Tests-Mode20 3 | debug := 1 4 | 5 | # Derived data files 6 | derived_files := Data/Repetetive.bin.lz4 Data/TheEyesHaveIt.txt.lz4 7 | 8 | # Use packages 9 | libsfx_packages := LZ4 10 | 11 | # Include libSFX.make 12 | libsfx_dir := ../.. 13 | include $(libsfx_dir)/libSFX.make 14 | -------------------------------------------------------------------------------- /tests/Mode21/Data/Graphics.palette: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/tests/Mode21/Data/Graphics.palette -------------------------------------------------------------------------------- /tests/Mode21/Data/Graphics.tilemap.lz4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/tests/Mode21/Data/Graphics.tilemap.lz4 -------------------------------------------------------------------------------- /tests/Mode21/Data/Graphics.tiles.lz4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/tests/Mode21/Data/Graphics.tiles.lz4 -------------------------------------------------------------------------------- /tests/Mode21/Data/Music.spc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/tests/Mode21/Data/Music.spc -------------------------------------------------------------------------------- /tests/Mode21/Data/Repetetive.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Optiroc/libSFX/35440f9274f6b6d609ae0b3f51721b03a6b27892/tests/Mode21/Data/Repetetive.bin -------------------------------------------------------------------------------- /tests/Mode21/Makefile: -------------------------------------------------------------------------------- 1 | # Name 2 | name := Tests-Mode21 3 | debug := 1 4 | 5 | # Derived data files 6 | derived_files := Data/Repetetive.bin.lz4 Data/TheEyesHaveIt.txt.lz4 7 | 8 | # Use packages 9 | libsfx_packages := LZ4 10 | 11 | # Include libSFX.make 12 | libsfx_dir := ../.. 13 | include $(libsfx_dir)/libSFX.make 14 | -------------------------------------------------------------------------------- /tests/Mode21/Map.cfg: -------------------------------------------------------------------------------- 1 | # libSFX Memory Map (Mode 21 "HiROM" mapping with 2*64kB banks) 2 | # David Lindecrantz 3 | 4 | SYMBOLS { 5 | __STACKSIZE__: type = weak, value = $100; 6 | __ZPADSIZE__: type = weak, value = $10; 7 | __ZNMISIZE__: type = weak, value = $10; 8 | __RPADSIZE__: type = weak, value = $100; 9 | } 10 | 11 | MEMORY { 12 | ZPAD: start = $000000, size = __ZPADSIZE__, define = yes; 13 | ZNMI: start = __ZPADSIZE__, size = __ZNMISIZE__, define = yes; 14 | ZPAGE: start = __ZPADSIZE__ + __ZNMISIZE__, size = $100 - (__ZPADSIZE__ + __ZNMISIZE__), define = yes; 15 | LORAM: start = $000100, size = $1f00 - __STACKSIZE__, define = yes; 16 | STACK: start = $002000 - __STACKSIZE__, size = __STACKSIZE__, define = yes; 17 | HIRAM: start = $7e2000, size = $e000, define = yes; 18 | EXRAM: start = $7f0000, size = $10000, define = yes; 19 | 20 | ROM0: start = $c00000, size = $10000, fill = yes, fillval = $ff; 21 | ROM1: start = $c10000, size = $10000, fill = yes, fillval = $ff; 22 | 23 | SMPZPAGE: start = $0002, size = $00ee; 24 | SMPMMIO: start = $00f0, size = $0010; 25 | SMPSTACK: start = $0100, size = $0100; 26 | SMPRAM: start = $0200, size = $fdc0; 27 | } 28 | 29 | SEGMENTS { 30 | ZPAD: load = ZPAD, type = zp, optional = yes; 31 | ZNMI: load = ZNMI, type = zp, optional = yes; 32 | ZEROPAGE: load = ZPAGE, type = zp, optional = yes; 33 | BSS: load = LORAM, type = bss, optional = yes; 34 | LORAM: load = LORAM, type = bss, optional = yes; 35 | HIRAM: load = HIRAM, type = bss, optional = yes; 36 | EXRAM: load = EXRAM, type = bss, optional = yes; 37 | 38 | CODE: load = ROM0, type = ro; 39 | RODATA: load = ROM0, type = ro; 40 | LIBSFX: load = ROM0, type = ro, start = $c08000, optional = yes; 41 | LIBSFX_PKG: load = ROM0, type = ro, optional = yes; 42 | LIBSFX_SMP: load = ROM0, type = rw, run = SMPZPAGE, optional = yes, define = yes; 43 | SMPCODE: load = ROM0, type = rw, run = SMPRAM, optional = yes, define = yes; 44 | HEADER: load = ROM0, type = ro, start = $c0ffb0; 45 | VECTORS: load = ROM0, type = ro, start = $c0ffe0; 46 | 47 | ROM1: load = ROM1, type = ro, optional = yes; 48 | 49 | SMPZPAGE: load = SMPZPAGE, type = zp, optional = yes; 50 | SMPRAM: load = SMPRAM, type = bss, optional = yes; 51 | } 52 | -------------------------------------------------------------------------------- /tests/Mode21/libSFX.cfg: -------------------------------------------------------------------------------- 1 | ; libSFX Configuration 2 | ; David Lindecrantz 3 | 4 | ;------------------------------------------------------------------------------- 5 | ;ROM Header 6 | 7 | ;ROM map mode (4 bits) 8 | ;Make sure that Map.cfg corresponds to the map mode selected 9 | ; Common modes: 10 | ; $0 = Mode 20/30 (32k/bank Mode 20 "LoROM" mapping) 11 | ; $1 = Mode 21/31 (64k/bank Mode 21 "HiROM" mapping) 12 | ROM_MAPMODE = $1 13 | 14 | ;ROM Size 15 | ;Make sure that Map.cfg corresponds to the ROM size selected 16 | ; $07 = 1 Mbit (128 kB) 17 | ; $08 = 2 Mbit (256 kB) 18 | ; $09 = 4 Mbit (512 kB) 19 | ; $0a = 8 Mbit (1 MB) 20 | ; $0b = 16 Mbit (2 MB) 21 | ; $0c = 32 Mbit (4 MB) 22 | ROM_ROMSIZE = $07 23 | -------------------------------------------------------------------------------- /tests/README.md: -------------------------------------------------------------------------------- 1 | Tests for most library features. At some point these will all be automated with hooks into bsnes+... 2 | -------------------------------------------------------------------------------- /tools/make_breakpoints: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Extracts a list of bsnes+ breakpoints from ca65 symbol files in file:label:rwx?:source? format 4 | # 5 | # ca65 symbol format: 6 | # al 000249 .label 7 | # 8 | # bsnes breakpoint format: 9 | # [-][:[:]] 10 | # rwx = read / write / execute flags 11 | # source = cpu, smp, vram, oam, cgram, sa1, sfx 12 | 13 | for bp in "$@" 14 | do 15 | # split on comma 16 | IFS=":" read -ra arr <<< "$bp" 17 | if (( ${#arr[@]} < 2 )); then 18 | continue 19 | fi 20 | 21 | # symbol file existance test 22 | symfile="${arr[0]}.dsym" 23 | if [ ! -f "$symfile" ]; then 24 | continue 25 | fi 26 | 27 | # parameters 28 | rwx="x" 29 | if (( ${#arr[@]} > 2 )); then 30 | rwx="${arr[2]}" 31 | fi 32 | mem="cpu" 33 | if (( ${#arr[@]} > 3 )); then 34 | mem="${arr[3]}" 35 | fi 36 | 37 | # extract 38 | echo -n $(grep ".${arr[1]}" ${arr[0]}.dsym | awk -v rwx="$rwx" -v mem="$mem" '{ print "-b " $2 ":" rwx ":" mem }') 39 | echo -n " " 40 | done 41 | --------------------------------------------------------------------------------