├── .github └── images │ ├── GTE_Logo.jpg │ ├── armada.gif │ └── finder.png ├── .gitignore ├── .vscode └── settings.json ├── ORCACDefs └── gte.h ├── README.md ├── _FileInformation.txt ├── archive └── gtearchive.2mg ├── build-image.bat ├── demos ├── chrisv │ ├── .gitignore │ ├── _FileInformation.txt │ ├── assets │ │ └── tileset.png │ ├── build-image.bat │ ├── gte.h │ ├── package.json │ ├── test.c │ └── tileData.c ├── fatdog-rpg │ ├── App.s │ ├── Main.s │ ├── _FileInformation.txt │ ├── assets │ │ ├── fatdog-rpg.tiled-project │ │ ├── fatdog-rpg.tiled-session │ │ ├── world-map.tmx │ │ ├── world-tiles.tsx │ │ └── world-tileset.png │ ├── build-image.bat │ ├── build-sprites.bat │ └── package.json ├── fatdog │ ├── .gitignore │ ├── App.s │ ├── Main.s │ ├── _FileInformation.txt │ ├── assets │ │ ├── all-sprites.gif │ │ ├── all-sprites.png │ │ ├── base_scroll.png │ │ ├── shooter-bg.png │ │ ├── shooter-fg.png │ │ ├── shooter-sprites.gif │ │ └── shooter-sprites.png │ ├── build-image.bat │ ├── build-sprites.bat │ ├── package.json │ └── sprites │ │ ├── Ship_Wallpaper.gif │ │ └── Ships.s ├── kfest-2022 │ ├── StartUp.s │ ├── demo-1 │ │ ├── .gitignore │ │ ├── App.Main.s │ │ ├── App.s │ │ ├── README.txt │ │ ├── _FileInformation.txt │ │ ├── assets │ │ │ ├── tiled │ │ │ │ ├── Overworld.tsx │ │ │ │ ├── world_1-1.json │ │ │ │ └── world_1-1.tmx │ │ │ └── tilesets │ │ │ │ └── smb-256-128-4bpp.png │ │ ├── build-image.bat │ │ ├── gen │ │ │ ├── App.TileMapBG0.s │ │ │ ├── App.TileSet.s │ │ │ ├── App.TileSetAnim.s │ │ │ └── bg1.bin │ │ └── package.json │ ├── demo-10 │ │ ├── .gitignore │ │ ├── App.Main.s │ │ ├── App.s │ │ ├── _FileInformation.txt │ │ ├── assets │ │ │ ├── tiled │ │ │ │ ├── smw-256x128-4bpp.tsx │ │ │ │ ├── yoshi-1.json │ │ │ │ └── yoshi-1.tmx │ │ │ └── tilesets │ │ │ │ ├── bg1.png │ │ │ │ ├── full.png │ │ │ │ └── smw-256x128-4bpp.png │ │ ├── build-image.bat │ │ ├── gen │ │ │ ├── App.TileMapBG0.s │ │ │ ├── App.TileSet.s │ │ │ ├── _FileInformation.txt │ │ │ └── bg1.bin │ │ └── package.json │ ├── demo-2 │ │ ├── .gitignore │ │ ├── App.Main.s │ │ ├── App.s │ │ ├── _FileInformation.txt │ │ ├── assets │ │ │ ├── tiled │ │ │ │ ├── Overworld.tsx │ │ │ │ ├── world_1-1.json │ │ │ │ └── world_1-1.tmx │ │ │ └── tilesets │ │ │ │ └── smb-256-128-4bpp.png │ │ ├── build-image.bat │ │ ├── gen │ │ │ ├── App.TileMapBG0.s │ │ │ ├── App.TileSet.s │ │ │ └── App.TileSetAnim.s │ │ └── package.json │ ├── demo-3 │ │ ├── .gitignore │ │ ├── App.Main.s │ │ ├── App.s │ │ ├── _FileInformation.txt │ │ ├── assets │ │ │ ├── tiled │ │ │ │ ├── MetalStore.tsx │ │ │ │ ├── level-1.json │ │ │ │ └── level-1.tmx │ │ │ └── tilesets │ │ │ │ └── tile-sheet.png │ │ ├── build-image.bat │ │ ├── gen │ │ │ ├── App.TileMapBG0.s │ │ │ ├── App.TileSet.s │ │ │ └── MetalStoreAnim.s │ │ └── package.json │ ├── demo-4 │ │ ├── .gitignore │ │ ├── App.Main.s │ │ ├── App.s │ │ ├── _FileInformation.txt │ │ ├── assets │ │ │ ├── tiled │ │ │ │ ├── smw-256x128-4bpp.tsx │ │ │ │ ├── yoshi-1.json │ │ │ │ └── yoshi-1.tmx │ │ │ └── tilesets │ │ │ │ ├── bg1.png │ │ │ │ ├── full.png │ │ │ │ └── smw-256x128-4bpp.png │ │ ├── build-image.bat │ │ ├── gen │ │ │ ├── App.TileMapBG0.s │ │ │ ├── App.TileSet.s │ │ │ ├── _FileInformation.txt │ │ │ └── bg1.bin │ │ └── package.json │ ├── demo-5 │ │ ├── .gitignore │ │ ├── App.Main.s │ │ ├── App.s │ │ ├── README.txt │ │ ├── _FileInformation.txt │ │ ├── assets │ │ │ ├── _FileInformation.txt │ │ │ ├── overworld.ntp │ │ │ ├── tiled │ │ │ │ ├── Overworld.tsx │ │ │ │ ├── world_1-1.json │ │ │ │ └── world_1-1.tmx │ │ │ └── tilesets │ │ │ │ └── smb-256-128-4bpp.png │ │ ├── build-image.bat │ │ ├── gen │ │ │ ├── App.TileMapBG0.s │ │ │ ├── App.TileSet.s │ │ │ └── App.TileSetAnim.s │ │ ├── package-lock.json │ │ └── package.json │ ├── demo-8 │ │ ├── .gitignore │ │ ├── App.Main.s │ │ ├── App.s │ │ ├── _FileInformation.txt │ │ ├── assets │ │ │ ├── tiled │ │ │ │ ├── smw-256x128-4bpp.tsx │ │ │ │ ├── yoshi-1.json │ │ │ │ └── yoshi-1.tmx │ │ │ └── tilesets │ │ │ │ ├── bg1.png │ │ │ │ ├── bg2.png │ │ │ │ ├── full.png │ │ │ │ └── smw-256x128-4bpp.png │ │ ├── build-image.bat │ │ ├── gen │ │ │ ├── App.TileMapBG0.s │ │ │ ├── App.TileSet.s │ │ │ ├── _FileInformation.txt │ │ │ ├── bg1.bin │ │ │ └── bg2.bin │ │ └── package.json │ └── demo-9 │ │ ├── .gitignore │ │ ├── App.Main.s │ │ ├── App.s │ │ ├── _FileInformation.txt │ │ ├── assets │ │ ├── tiled │ │ │ ├── smw-256x128-4bpp.tsx │ │ │ ├── yoshi-1.json │ │ │ └── yoshi-1.tmx │ │ └── tilesets │ │ │ ├── bg1.png │ │ │ ├── full.png │ │ │ └── smw-256x128-4bpp.png │ │ ├── build-image.bat │ │ ├── gen │ │ ├── App.TileMapBG0.s │ │ ├── App.TileSet.s │ │ ├── _FileInformation.txt │ │ └── bg1.bin │ │ └── package.json ├── pacman │ ├── App.s │ ├── Main.s │ ├── README.md │ ├── _FileInformation.txt │ └── package.json ├── shell │ ├── .gitignore │ ├── Actions.s │ ├── App.Main.s │ ├── App.Msg.s │ ├── App.s │ ├── Overlay.s │ ├── _FileInformation.txt │ ├── assets │ │ ├── armada-7-color-shift.png │ │ ├── armada-7-color-shuffle.png │ │ ├── armada-7-color.png │ │ ├── armada.png │ │ ├── assets.tiled-project │ │ ├── assets.tiled-session │ │ ├── donut-plains-1-6-color.png │ │ ├── donut-plains-1png.png │ │ ├── donut-plains-2-8-color-shift.png │ │ ├── donut-plains-2-8-color.png │ │ ├── donut-plains-2.png │ │ ├── fatdog-1.png │ │ ├── fatdog-2.png │ │ ├── gba-cloud-bgnd-8-color.png │ │ ├── gba-cloud-bgnd.png │ │ ├── mario-face-2-color.png │ │ ├── mario-face.png │ │ ├── music │ │ │ ├── _FileInformation.txt │ │ │ ├── main-nfc.ntp │ │ │ └── main.ntp │ │ ├── plant.png │ │ ├── rotopattern.png │ │ ├── smb-2bit-328x208-shift.png │ │ ├── smb-2bit-328x208.png │ │ ├── smb-2bit-512x223.png │ │ ├── smw-bg-1-bw.png │ │ ├── smw-bg-1.png │ │ ├── tiled │ │ │ ├── Overworld.tsx │ │ │ ├── world_1-1.json │ │ │ └── world_1-1.tmx │ │ ├── tilesets │ │ │ ├── smb-256-128-1bpp.png │ │ │ └── smb-256-128-4bpp.png │ │ ├── woz-pixelated.png │ │ ├── woz-shifted.png │ │ ├── woz.png │ │ └── woz2.png │ ├── build-image.bat │ ├── font.s │ ├── gen │ │ ├── App.TileMapBG0.s │ │ ├── App.TileMapBG1.s │ │ ├── App.TileSet.s │ │ ├── App.TileSetAnim.s │ │ ├── _FileInformation.txt │ │ ├── bg1a.bin │ │ ├── bg1b.bin │ │ ├── fg1.bin │ │ └── test.pic │ ├── package-lock.json │ └── package.json ├── smb │ ├── .gitignore │ ├── App.s │ ├── Externals.s │ ├── Main.s │ ├── _FileInformation.txt │ ├── build-image.bat │ ├── chr.s │ ├── package.json │ ├── rom.s │ └── wrapper.s ├── sprites │ ├── .gitignore │ ├── App.Main.s │ ├── App.s │ ├── README.md │ ├── SprData.s │ ├── SprMask.s │ ├── _FileInformation.txt │ ├── assets │ │ ├── _FileInformation.txt │ │ ├── mario1.c1 │ │ ├── octane.c1 │ │ ├── pix.forest.c1 │ │ ├── sunset.c1 │ │ └── tiled │ │ │ ├── Overworld.tsx │ │ │ ├── world_1-1.json │ │ │ └── world_1-1.tmx │ ├── build-image.bat │ ├── gen │ │ ├── App.TileMapBG0.s │ │ ├── App.TileSet.s │ │ └── App.TileSetAnim.s │ └── package.json ├── tf4 │ ├── .gitignore │ ├── App.Main.s │ ├── App.s │ ├── GTETF4 │ ├── README.txt │ ├── Tiles.s │ ├── _FileInformation.txt │ ├── assets │ │ ├── tiled │ │ │ ├── Overworld.tsx │ │ │ ├── world_1-1.json │ │ │ └── world_1-1.tmx │ │ └── tilesets │ │ │ └── smb-256-128-4bpp.png │ ├── build-image.bat │ └── package.json ├── tool │ ├── .gitignore │ ├── App.Main.s │ ├── App.Msg.s │ ├── App.s │ ├── Zelda.TileSet.s │ ├── _FileInformation.txt │ ├── build-image.bat │ ├── font.s │ └── package.json └── zelda │ ├── .gitignore │ ├── App.Main.s │ ├── App.s │ ├── README.md │ ├── SprData.s │ ├── SprMask.s │ ├── TileStore.s │ ├── _FileInformation.txt │ ├── assets │ ├── Zelda.tsx │ ├── overworld.json │ ├── overworld.tmx │ └── sprites-256x128.png │ ├── build-image.bat │ ├── gen │ ├── App.TileMapBG0.s │ └── App.TileSet.s │ ├── package-lock.json │ └── package.json ├── docs ├── .gitignore ├── 404.html ├── Gemfile ├── Gemfile.lock ├── _config.yml ├── about.markdown ├── assets │ └── css │ │ └── toolref.css ├── getting_started.markdown ├── index.markdown ├── live.markdown ├── samples │ └── basic_c_sample.markdown ├── toolboxref.html └── tutorials.markdown ├── emu ├── Target.2mg └── _FileInformation.txt ├── macros ├── CORE.MACS.S ├── EDS.GSOS.MACS.S ├── GTE.Macs.s ├── Load.Macs.s ├── Locator.Macs.s ├── Mem.Macs.s ├── Misc.Macs.s ├── Tool222.Macs.s └── Util.Macs.s ├── package-lock.json ├── package.json ├── ref ├── GTE.Inline.s └── GTE.Line.s ├── src ├── Anim.s ├── CoreImpl.s ├── Defs.s ├── FastCopies.s ├── Graphics.s ├── Master.s ├── Math.s ├── Memory.s ├── README.md ├── Render.s ├── RotData.s ├── Script.s ├── Sprite.s ├── Sprite2.s ├── SpriteRender.s ├── TileMap.s ├── Tiles.s ├── Timer.s ├── Tool.s ├── _FileInformation.txt ├── blitter │ ├── BG0.s │ ├── BG1.s │ ├── Blitter.s │ ├── Horz.s │ ├── PEISlammer.s │ ├── Rotation.s │ ├── SCB.s │ ├── Template.s │ ├── TemplateUtils.s │ ├── TilesBG1.s │ └── Vert.s ├── render │ ├── Dirty.s │ ├── Dynamic.s │ ├── Fast.s │ ├── README.txt │ ├── Render.s │ ├── Slow.s │ ├── Sprite1.s │ ├── Sprite2.s │ ├── Sprite3.s │ ├── Sprite4.s │ └── TwoLayer.s ├── static │ ├── SprData.s │ ├── SprMask.s │ ├── TileData.s │ ├── TileStore.s │ └── TileStoreDefs.s └── tiles │ └── DirtyTileQueue.s └── tools ├── fatdog2iigs.js ├── mkrot.js ├── mkscales.js ├── mksprite.js ├── png2iigs.js ├── scanline-test.py └── tiled2iigs.js /.github/images/GTE_Logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/.github/images/GTE_Logo.jpg -------------------------------------------------------------------------------- /.github/images/armada.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/.github/images/armada.gif -------------------------------------------------------------------------------- /.github/images/finder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/.github/images/finder.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | emu 3 | .vscode 4 | *_Output.txt 5 | src/GTETestApp 6 | *.2mg 7 | Tool160.SHK 8 | src/Tool160 -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "emeraldwalk.runonsave": { 3 | "commands": [ 4 | { 5 | "match": "\\.s$", 6 | "isAsync": true, 7 | "cmd": "C:\\\\Programs\\\\IIgsXDev\\\\bin\\\\Cadius.exe INDENTFILE ${file}" 8 | }, 9 | { 10 | "match": "\\.S$", 11 | "isAsync": true, 12 | "cmd": "C:\\\\Programs\\\\IIgsXDev\\\\bin\\\\Cadius.exe INDENTFILE ${file}" 13 | }, 14 | { 15 | "match": "\\.MACS\\.S$", 16 | "isAsync": true, 17 | "cmd": "C:\\\\Programs\\\\IIgsXDev\\\\bin\\\\Cadius.exe INDENTFILE ${file}" 18 | } 19 | ] 20 | } 21 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 |
3 | Generic Tile Engine for the Apple IIgs 4 |

5 |

A high-performance library for writing tile-based games for the Apple IIgs personal computer in 65816 assembly langugage. Unlock the full, 16-bit potential of the last machine of the Apple ][ line.

6 | 7 | # Introduction 8 | 9 | The Generic Tile Engine (GTE) project is a tile engine built to exploit the unique hardware capabilities of the Apple IIgs personal computer. It supports the Apple IIgs super hires graphics mode (320x200, 16/256 colors) and provides two full-screen independent scrolling layers along with software sprites. The API and core functionality of the library is inspired by the graphics hardware of the NES/SMS/SNES/Genesis console era. 10 | 11 | An overview of GTE was presented at [KansasFest 2022](http://www.youtube.com/watch?v=2x65JymFklk). 12 | 13 |

14 |
15 | Parallax scrolling of two full-screen static layers 16 |

17 | 18 | # Building from Source 19 | 20 | The library iscurrently implemented as a set of source files that must be compiled into a GS/OS application. A set of example project can be found under the `demos` folder. Each demo folder uses a `package.json` file to define the build targets and a build of each application can be created by executing a `npm run build` command. 21 | 22 | Each demo application has a build script that also builds the toolset and copies it, along with the demo S16 application file, to the target disk image. 23 | 24 | ## Dependencies 25 | 26 | * node 27 | * merlin32 (1.1.10+) 28 | * cadius 29 | 30 | GTE uses the [merlin32](https://brutaldeluxe.fr/products/crossdevtools/merlin/) [1.1.10](https://github.com/digarok/merlin32/releases/tag/v1.1.10) assembler to compile its source into GS/OS OMF files and [Cadius](https://brutaldeluxe.fr/products/crossdevtools/cadius/index.html) to copy those files onto a ProDOS disk image. The paths to these tool can be set in the `package.json` file. 31 | 32 | An empty 2MG disk image is included in `emu/Target.2mg` and is used as the default location for copying demo applications. This image can be mounted in any IIgs emulator. 33 | 34 |

35 |
36 | Build of demo app in the IIgs Finder 37 |

38 | 39 | # Documentation 40 | 41 | Please refer to the GTE Toolbox documentation. 42 | 43 | # References 44 | 45 | * [Apple IIgs Tech Note #70: Fast Graphics Hints](http://www.1000bit.it/support/manuali/apple/technotes/iigs/tn.iigs.070.html) 46 | * [Super Merryo Trolls](http://garote.bdmonkeys.net/merryo_trolls/) 47 | * [Coding Secrets of Wolfenstein IIgs](https://www.kansasfest.org/wp-content/uploads/2004-sheppy-wolf3d.pdf) 48 | * [Apple IIgs Graphics and Sound College](https://www.kansasfest.org/wp-content/uploads/1992-heineman-gs.pdf) 49 | * [John Brooks' Fast GS graphics notes](https://groups.google.com/g/comp.sys.apple2/c/6HWlRPkuuDY/m/NNc1msmmCwAJ) 50 | * [Adaptive Tile Refresh](https://en.wikipedia.org/wiki/Adaptive_tile_refresh) 51 | * [A Guide to the Graphics of the Sega Mega Drive / Genesis](https://rasterscroll.com/mdgraphics/) 52 | * [Jon Burton / Traveller's Tales / Coding Secrets](https://ttjontt.wixsite.com/gamehut/coding-secrets) 53 | * [Lou's Pseudo 3d Page](http://www.extentofthejam.com/pseudo/) 54 | * [A Great Old-Timey Game-Programming Hack](https://blog.moertel.com/posts/2013-12-14-great-old-timey-game-programming-hack.html) 55 | * [Tilengine: 2D retro graphics](https://www.tilengine.org/) 56 | * [ZX Spectrum Ghost 'n Goblins: Graphics Routines](https://www.emix8.org/ggdisasm/) 57 | -------------------------------------------------------------------------------- /_FileInformation.txt: -------------------------------------------------------------------------------- 1 | GTETool.SHK=Type(E0),AuxType(8002),VersionCreate(00),MinVersion(87),Access(E3),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000) 2 | Tool160.SHK=Type(E0),AuxType(8002),VersionCreate(00),MinVersion(B8),Access(E3),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000) 3 | CCode.SHK=Type(E0),AuxType(8002),VersionCreate(00),MinVersion(9C),Access(E3),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000) 4 | ChrisV.SHK=Type(E0),AuxType(8002),VersionCreate(00),MinVersion(BC),Access(E3),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000) 5 | -------------------------------------------------------------------------------- /archive/gtearchive.2mg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/archive/gtearchive.2mg -------------------------------------------------------------------------------- /build-image.bat: -------------------------------------------------------------------------------- 1 | echo off 2 | 3 | REM Copy all of the assets into the ProDOS image for emulator testing 4 | REM 5 | REM Pass the path of the Cadius tool as the first argument (%1) 6 | 7 | set CADIUS="%1" 8 | set IMAGE=".\\emu\\Target.2mg" 9 | set FOLDER="/GTEDEV/Toolbox" 10 | 11 | REM Cadius does not overwrite files, so clear the root folder first 12 | %CADIUS% DELETEFOLDER %IMAGE% %FOLDER% 13 | %CADIUS% CREATEFOLDER %IMAGE% %FOLDER% 14 | 15 | REM Now copy files and folders as needed 16 | %CADIUS% ADDFILE %IMAGE% %FOLDER% .\src\Tool160 17 | 18 | REM Copy in the image assets 19 | -------------------------------------------------------------------------------- /demos/chrisv/.gitignore: -------------------------------------------------------------------------------- 1 | App 2 | main 3 | *.root 4 | *.sym 5 | *.a -------------------------------------------------------------------------------- /demos/chrisv/_FileInformation.txt: -------------------------------------------------------------------------------- 1 | App=Type(B3),AuxType(0000),VersionCreate(70),MinVersion(BE),Access(E3) -------------------------------------------------------------------------------- /demos/chrisv/assets/tileset.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/demos/chrisv/assets/tileset.png -------------------------------------------------------------------------------- /demos/chrisv/build-image.bat: -------------------------------------------------------------------------------- 1 | echo off 2 | 3 | REM Copy all of the assets into the ProDOS image for emulator testing 4 | REM 5 | REM Pass the path of the Cadius tool as the first argument (%1) 6 | 7 | set CADIUS="%1" 8 | set IMAGE="..\\..\\emu\\Target.2mg" 9 | set FOLDER="/GTEDEV/ChrisV" 10 | 11 | REM Cadius does not overwrite files, so clear the root folder first 12 | %CADIUS% DELETEFOLDER %IMAGE% %FOLDER% 13 | %CADIUS% CREATEFOLDER %IMAGE% %FOLDER% 14 | 15 | REM Now copy files and folders as needed 16 | %CADIUS% ADDFILE %IMAGE% %FOLDER% .\App 17 | %CADIUS% ADDFILE %IMAGE% %FOLDER% ..\..\src\Tool160 -------------------------------------------------------------------------------- /demos/chrisv/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "chrisv-c-demo", 3 | "version": "1.0.0", 4 | "description": "Using GTE from C", 5 | "main": "index.js", 6 | "config": { 7 | "merlin32": "C:\\Programs\\IIgsXDev\\bin\\Merlin32-1.1.10.exe", 8 | "cadius": "C:\\Programs\\IIgsXDev\\bin\\Cadius.exe", 9 | "gsport": "C:\\Programs\\gsport\\gsport_0.31\\GSPort.exe", 10 | "macros": "../../macros", 11 | "crossrunner": "C:\\Programs\\Crossrunner\\Crossrunner.exe", 12 | "png2iigs": "../../tools/png2iigs.js" 13 | }, 14 | "scripts": { 15 | "gsport": "%npm_package_config_gsport%", 16 | "test:all": "npm run build && npm run build:image && %npm_package_config_gsport%", 17 | "build": "npm run build:tool && npm run build:sys16", 18 | "test": "npm run build:sys16 && npm run build:image && %npm_package_config_gsport%", 19 | "build:image": "build-image.bat %npm_package_config_cadius%", 20 | "build:sys16": "iix compile foo.c test.c && iix -DKeepType=S16 link test foo keep=App", 21 | "build:tiles": "node %npm_package_config_png2iigs% ./assets/tileset.png --format orcac --max-tiles 160 --as-tile-data --verbose > tileData.c", 22 | "build:tool": "%npm_package_config_merlin32% -V %npm_package_config_macros% ../../src/Master.s", 23 | "debug": "%npm_package_config_crossrunner% ./App -Debug -CompatibilityLayer" 24 | } 25 | } -------------------------------------------------------------------------------- /demos/chrisv/test.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | /* #define GTE_IS_SYSTEM_TOOLS_INSTALL 1 */ 8 | #include "gte.h" 9 | 10 | #ifdef GTE_IS_SYSTEM_TOOLS_INSTALL 11 | #define ENGINE_STARTUP_MODE 0x0000 12 | #else 13 | #define ENGINE_STARTUP_MODE ENGINE_MODE_USER_TOOL 14 | #endif 15 | 16 | /* toolbox fail handler */ 17 | #define TOOLFAIL(string) if (toolerror()) SysFailMgr(toolerror(), "\p" string "\n\r Error Code -> $"); 18 | 19 | /* path to the local GTE toolset */ 20 | Str32 toolPath = {9, "1/Tool160" }; 21 | 22 | /* Helper function to load GTE as a user tool or system tool */ 23 | #ifdef GTE_IS_SYSTEM_TOOLS_INSTALL 24 | void LoadGTEToolSet(Word unused) { 25 | LoadOneTool(160, 0); 26 | TOOLFAIL("Unable to load GTE toolset"); 27 | } 28 | #else 29 | void LoadGTEToolSet(Word userId) { 30 | InitialLoadOutputRec loadRec; 31 | 32 | // Load the tool from the local directory 33 | loadRec = InitialLoad(userId, (Pointer) (&toolPath), 1); 34 | TOOLFAIL("Unable to load Tool160 from local path"); 35 | 36 | // Install the tool using the user tool vector 37 | SetTSPtr(0x8000, 160, loadRec.startAddr); 38 | TOOLFAIL("Could not install tool"); 39 | } 40 | #endif // GTE_IS_SYSTEM_TOOLS_INSTALL 41 | 42 | #ifdef GTE_IS_SYSTEM_TOOLS_INSTALL 43 | void UnloadGTEToolSet() { 44 | UnloadOneTool(160); 45 | TOOLFAIL("Unable to unload GTE toolset"); 46 | } 47 | #else 48 | void UnloadGTEToolSet() { 49 | } 50 | #endif // GTE_IS_SYSTEM_TOOLS_INSTALL 51 | 52 | extern Byte tiles[]; 53 | extern Word tilesPalette[16]; 54 | 55 | void main(void) { 56 | Word userId; 57 | Word tileId; 58 | Word controlMask, keyPress; 59 | Handle dpHandle; 60 | Word dpAddr; 61 | int a, b; 62 | 63 | TLStartUp(); 64 | TOOLFAIL("Unable to start tool locator"); 65 | 66 | userId = MMStartUp(); 67 | TOOLFAIL("Unable to start memory manager"); 68 | 69 | MTStartUp(); 70 | TOOLFAIL("Unable to start misc tools"); 71 | 72 | LoadGTEToolSet(userId); 73 | 74 | dpHandle = NewHandle(0x200L, userId, attrBank + attrPage + attrFixed + attrLocked + attrNoCross, 0); 75 | TOOLFAIL("Could not allocate direct page memory for GTE"); 76 | dpAddr = (Word) (*dpHandle); 77 | 78 | GTEStartUp(dpAddr, (Word) ENGINE_STARTUP_MODE, userId); 79 | 80 | /* GTESetScreenMode(160, 200); /* 160x200 is the default screen mode */ 81 | GTESetPalette(0, (Pointer)tilesPalette); 82 | GTELoadTileSet(0, 160, tiles); /* Load in the tiles */ 83 | 84 | GTEFillTileStore(1); 85 | GTERender(0); 86 | 87 | for (a = 3; a < 18; a++) { 88 | GTESetTile(a, a, 5); 89 | } 90 | GTESetTile(1, 0, 34); 91 | GTESetTile(2, 0, 33); 92 | GTERender(0); 93 | 94 | GTESetTile(0, 3, 3); 95 | GTESetTile(0, 4, 4); 96 | for (b = 4; b < 6; b++) { 97 | for (a = 1; a < 10; a++) { 98 | GTESetBG0Origin(a, b); 99 | tileId = (((b - 1) * 32) + a) | TILE_SOLID_BIT | TILE_HFLIP_BIT; 100 | GTESetTile(a, b, tileId); 101 | GTERender(0); 102 | } 103 | } 104 | 105 | do { 106 | controlMask = GTEReadControl(); 107 | keyPress = controlMask & 0x007F; 108 | } while (keyPress != 'Q'); 109 | 110 | GTEShutDown(); 111 | UnloadGTEToolSet(); 112 | 113 | DisposeHandle(dpHandle); 114 | MTShutDown(); 115 | MMShutDown(userId); 116 | TLShutDown(); 117 | } 118 | -------------------------------------------------------------------------------- /demos/fatdog-rpg/App.s: -------------------------------------------------------------------------------- 1 | ; Fatdog Demos 2 | 3 | TYP $B3 ; S16 file 4 | DSK FatDogRPG 5 | XPL 6 | 7 | ; Segment #1 -- Main execution block 8 | 9 | ASM Main.s 10 | 11 | ; Segment #2 -- Core GTE Code 12 | 13 | ASM ..\..\src\Core.s 14 | 15 | ; Segment #3 -- GTE Rotation Table Data 16 | 17 | ASM ..\..\src\RotData.s 18 | DS 0 19 | KND #$1001 ; Type and Attributes ($11=Static+Bank Relative,$01=Data) 20 | ALI BANK 21 | SNA RotData 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /demos/fatdog-rpg/Main.s: -------------------------------------------------------------------------------- 1 | REL 2 | DSK MAINSEG 3 | 4 | use EDS.GSOS.MACS.s 5 | use Tool222.Macs.s 6 | use ../../src/GTE.s 7 | use ../../src/Defs.s 8 | 9 | 10 | mx %00 11 | 12 | ; Space for player position variables 13 | PlayerX equ AppSpace 14 | PlayerY equ AppSpace+2 15 | 16 | ; Timer handle 17 | TimerHndl dw $FFFF 18 | IntroCounter ds 2 19 | 20 | phk 21 | plb 22 | 23 | jsl EngineStartUp 24 | 25 | stz PlayerX 26 | stz PlayerY 27 | 28 | ldx #0 ; Use full-screen mode 29 | jsl SetScreenMode 30 | bcs *+5 31 | sta TimerHndl 32 | 33 | 34 | stz IntroCounter 35 | ldx #^IntroTask 36 | lda #IntroTask 37 | ldy #10 ; Play at 6 fps 38 | jsl AddTimer 39 | bcs *+5 40 | sta TimerHndl 41 | 42 | :loop 43 | jsl DoTimers 44 | jsl ReadControl 45 | and #$007F ; Ignore the buttons for now 46 | 47 | cmp #'q' 48 | beq :exit 49 | 50 | ; Just keep drawing the player. The timer task will animate the position 51 | 52 | jsr DrawPlayer 53 | bra :loop 54 | 55 | :moveup 56 | lda PlayerY 57 | dec 58 | bpl *+5 59 | lda #0 60 | sta PlayerY 61 | jmp DrawPlayer 62 | 63 | :movedown 64 | lda PlayerY 65 | inc 66 | cmp #160 67 | bcc *+5 68 | lda #160 69 | sta PlayerY 70 | jmp DrawPlayer 71 | 72 | :moveleft 73 | lda PlayerX 74 | dec 75 | bpl *+5 76 | lda #0 77 | sta PlayerX 78 | jmp DrawPlayer 79 | 80 | :moveright 81 | lda PlayerX 82 | inc 83 | cmp #140 84 | bcc *+5 85 | lda #140 86 | sta PlayerX 87 | jmp DrawPlayer 88 | 89 | ; Clean up and do a GS/OS Quit 90 | :exit 91 | jsl EngineShutDown 92 | 93 | :quit 94 | _QuitGS qtRec 95 | bcs :fatal 96 | :fatal brk $00 97 | 98 | qtRec adrl $0000 99 | da $00 100 | 101 | ; Play a scripted animation 102 | IntroTask 103 | phb 104 | phk 105 | plb 106 | 107 | lda IntroCounter 108 | and #$0007 109 | asl 110 | asl 111 | tax 112 | 113 | lda IntroPath,x ; X coordinate 114 | sta PlayerX 115 | lda IntroPath+2,x ; Y coordinate 116 | sta PlayerY 117 | 118 | inc IntroCounter 119 | plb 120 | rtl 121 | 122 | IntroPath dw 0,0,10,0,20,0,20,5,20,7,35,15,50,17,80,20 123 | 124 | DrawPlayer 125 | rts 126 | ; lda PlayerY 127 | ; asl 128 | ; tax 129 | ; ldal ScreenAddr,x 130 | ; clc 131 | ; adc PlayerX 132 | ; tay 133 | ; jsl Spr_001 134 | ; rts 135 | 136 | ; Storage for tiles (not used in this demo) 137 | tiledata ENT 138 | 139 | ; Storage for sprites 140 | ;StackAddress ds 2 141 | ; PUT sprites/Ships.s 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | -------------------------------------------------------------------------------- /demos/fatdog-rpg/_FileInformation.txt: -------------------------------------------------------------------------------- 1 | FatDogRPG=Type(B3),AuxType(0000),VersionCreate(70),MinVersion(BE),Access(E3),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000) -------------------------------------------------------------------------------- /demos/fatdog-rpg/assets/fatdog-rpg.tiled-project: -------------------------------------------------------------------------------- 1 | { 2 | "automappingRulesFile": "", 3 | "commands": [ 4 | ], 5 | "extensionsPath": "extensions", 6 | "folders": [ 7 | "." 8 | ], 9 | "objectTypesFile": "" 10 | } 11 | -------------------------------------------------------------------------------- /demos/fatdog-rpg/assets/fatdog-rpg.tiled-session: -------------------------------------------------------------------------------- 1 | { 2 | "Map/SizeTest": { 3 | "height": 4300, 4 | "width": 2 5 | }, 6 | "activeFile": "world-map.tmx", 7 | "expandedProjectPaths": [ 8 | "." 9 | ], 10 | "file.lastUsedOpenFilter": "All Files (*)", 11 | "fileStates": { 12 | "world-map.tmx": { 13 | "scale": 4, 14 | "selectedLayer": 1, 15 | "viewCenter": { 16 | "x": 143.375, 17 | "y": 120.75 18 | } 19 | }, 20 | "world-tiles.tsx": { 21 | "scaleInDock": 4, 22 | "scaleInEditor": 1 23 | } 24 | }, 25 | "last.imagePath": "C:/checkout/iigs-game-engine/demos/fatdog-rpg/assets", 26 | "map.height": 128, 27 | "map.lastUsedFormat": "tmx", 28 | "map.tileHeight": 8, 29 | "map.tileWidth": 8, 30 | "map.width": 128, 31 | "openFiles": [ 32 | "world-map.tmx", 33 | "world-tiles.tsx" 34 | ], 35 | "project": "fatdog-rpg.tiled-project", 36 | "recentFiles": [ 37 | "world-tiles.tsx", 38 | "world-map.tmx" 39 | ], 40 | "tileset.lastUsedFormat": "tsx", 41 | "tileset.tileSize": { 42 | "height": 8, 43 | "width": 8 44 | }, 45 | "tileset.useTransparentColor": true 46 | } 47 | -------------------------------------------------------------------------------- /demos/fatdog-rpg/assets/world-tiles.tsx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /demos/fatdog-rpg/assets/world-tileset.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/demos/fatdog-rpg/assets/world-tileset.png -------------------------------------------------------------------------------- /demos/fatdog-rpg/build-image.bat: -------------------------------------------------------------------------------- 1 | echo off 2 | 3 | REM Copy all of the assets into the ProDOS image for emulator testing 4 | REM 5 | REM Pass the path of the Cadius tool as the first argument (%1) 6 | 7 | set CADIUS="%1" 8 | set IMAGE="..\\..\\emu\\Target.2mg" 9 | set FOLDER="/GTEDEV/FatdogRPG" 10 | 11 | REM Cadius does not overwrite files, so clear the root folder first 12 | %CADIUS% DELETEFOLDER %IMAGE% %FOLDER% 13 | %CADIUS% CREATEFOLDER %IMAGE% %FOLDER% 14 | 15 | REM Now copy files and folders as needed 16 | %CADIUS% ADDFILE %IMAGE% %FOLDER% .\\FatDogRPG 17 | -------------------------------------------------------------------------------- /demos/fatdog-rpg/build-sprites.bat: -------------------------------------------------------------------------------- 1 | echo off 2 | 3 | set MRSPRITE="%1" 4 | 5 | mkdir build 6 | copy assets\all-sprites.gif build\all-sprites.gif 7 | %MRSPRITE% EXTRACT build\all-sprites.gif 0026FF FC0204 8 | %MRSPRITE% RENAME build\all-sprites_spr*.gif Ship 9 | %MRSPRITE% CODE build\Ship_*.gif 0026FF 09162A 181425 293C5A 3A455B 5400D9 9C44FF A50989 FC0204 FF00AF FFCA00 FFFFFF 10 | type build\Ship_*.txt > sprites\Ships.s 11 | 12 | REM Create a wallpaper and copy that for reference 13 | %MRSPRITE% WALLPAPER build\Ship_*.gif 0026FF FC0204 14 | copy build\Ship_Wall.gif sprites\Ship_Wallpaper.gif 15 | del /q build\* 16 | -------------------------------------------------------------------------------- /demos/fatdog-rpg/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "fatdog-rpg", 3 | "version": "1.0.0", 4 | "description": "Horizontal shoot-em-up", 5 | "main": "index.js", 6 | "config": { 7 | "merlin32": "C:\\Programs\\IIgsXDev\\bin\\Merlin32-1.1.10.exe", 8 | "cadius": "C:\\Programs\\IIgsXDev\\bin\\Cadius.exe", 9 | "gsport": "C:\\Programs\\gsport\\gsport_0.31\\GSPort.exe", 10 | "macros": "../../macros", 11 | "crossrunner": "C:\\Programs\\Crossrunner\\Crossrunner.exe", 12 | "mrsprite": "C:\\Programs\\IIgsXDev\\bin\\MrSprite.exe" 13 | }, 14 | "scripts": { 15 | "build:app": "%npm_package_config_merlin32% -V %npm_package_config_macros% App.s", 16 | "build:image": "build-image.bat %npm_package_config_cadius%", 17 | "build:all": "npm run build:app && npm run build:image", 18 | "build": "npm run build:app && npm run build:image", 19 | "test": "npm run build && %npm_package_config_gsport%", 20 | "debug": "%npm_package_config_crossrunner% GTEShooter -Source GTEShooter_S02_MAINSEG_Output.txt -Debug -CompatibilityLayer" 21 | }, 22 | "repository": { 23 | "type": "git", 24 | "url": "git+https://github.com/lscharen/iigs-game-engine.git" 25 | }, 26 | "author": "Lucas Scharenbroich", 27 | "license": "Apache-2.0", 28 | "bugs": { 29 | "url": "https://github.com/lscharen/iigs-game-engine/issues" 30 | }, 31 | "homepage": "https://github.com/lscharen/iigs-game-engine#readme", 32 | "devDependencies": { 33 | } 34 | } -------------------------------------------------------------------------------- /demos/fatdog/.gitignore: -------------------------------------------------------------------------------- 1 | GTEShooter -------------------------------------------------------------------------------- /demos/fatdog/App.s: -------------------------------------------------------------------------------- 1 | ; Fatdog Demos 2 | 3 | TYP $B3 ; S16 file 4 | DSK GTEShooter 5 | XPL 6 | 7 | ; Segment #1 -- Main execution block 8 | 9 | ASM Main.s 10 | 11 | ; Segment #2 -- Core GTE Code 12 | 13 | ASM ..\..\src\Core.s 14 | 15 | ; Segment #3 -- GTE Rotation Table Data 16 | 17 | ASM ..\..\src\RotData.s 18 | DS 0 19 | KND #$1001 ; Type and Attributes ($11=Static+Bank Relative,$01=Data) 20 | ALI BANK 21 | SNA RotData 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /demos/fatdog/Main.s: -------------------------------------------------------------------------------- 1 | REL 2 | DSK MAINSEG 3 | 4 | use EDS.GSOS.MACS.s 5 | use Tool222.Macs.s 6 | use ../../src/GTE.s 7 | use ../../src/Defs.s 8 | 9 | 10 | mx %00 11 | 12 | ; Space for player position variables 13 | PlayerX equ AppSpace 14 | PlayerY equ AppSpace+2 15 | 16 | ; Timer handle 17 | TimerHndl dw $FFFF 18 | IntroCounter ds 2 19 | 20 | phk 21 | plb 22 | 23 | jsl EngineStartUp 24 | 25 | stz PlayerX 26 | stz PlayerY 27 | 28 | ldx #0 ; Use full-screen mode 29 | jsl SetScreenMode 30 | bcs *+5 31 | sta TimerHndl 32 | 33 | 34 | stz IntroCounter 35 | ldx #^IntroTask 36 | lda #IntroTask 37 | ldy #10 ; Play at 6 fps 38 | jsl AddTimer 39 | bcs *+5 40 | sta TimerHndl 41 | 42 | :loop 43 | jsl DoTimers 44 | jsl ReadControl 45 | and #$007F ; Ignore the buttons for now 46 | 47 | cmp #'q' 48 | beq :exit 49 | 50 | ; Just keep drawing the player. The timer task will animate the position 51 | 52 | jsr DrawPlayer 53 | bra :loop 54 | 55 | :moveup 56 | lda PlayerY 57 | dec 58 | bpl *+5 59 | lda #0 60 | sta PlayerY 61 | jmp DrawPlayer 62 | 63 | :movedown 64 | lda PlayerY 65 | inc 66 | cmp #160 67 | bcc *+5 68 | lda #160 69 | sta PlayerY 70 | jmp DrawPlayer 71 | 72 | :moveleft 73 | lda PlayerX 74 | dec 75 | bpl *+5 76 | lda #0 77 | sta PlayerX 78 | jmp DrawPlayer 79 | 80 | :moveright 81 | lda PlayerX 82 | inc 83 | cmp #140 84 | bcc *+5 85 | lda #140 86 | sta PlayerX 87 | jmp DrawPlayer 88 | 89 | ; Clean up and do a GS/OS Quit 90 | :exit 91 | jsl EngineShutDown 92 | 93 | :quit 94 | _QuitGS qtRec 95 | bcs :fatal 96 | :fatal brk $00 97 | 98 | qtRec adrl $0000 99 | da $00 100 | 101 | ; Play a scripted animation 102 | IntroTask 103 | phb 104 | phk 105 | plb 106 | 107 | lda IntroCounter 108 | and #$0007 109 | asl 110 | asl 111 | tax 112 | 113 | lda IntroPath,x ; X coordinate 114 | sta PlayerX 115 | lda IntroPath+2,x ; Y coordinate 116 | sta PlayerY 117 | 118 | inc IntroCounter 119 | plb 120 | rtl 121 | 122 | IntroPath dw 0,0,10,0,20,0,20,5,20,7,35,15,50,17,80,20 123 | 124 | DrawPlayer 125 | lda PlayerY 126 | asl 127 | tax 128 | ldal ScreenAddr,x 129 | clc 130 | adc PlayerX 131 | tay 132 | jsl Spr_001 133 | rts 134 | 135 | ; Storage for tiles (not used in this demo) 136 | tiledata ENT 137 | 138 | ; Storage for sprites 139 | StackAddress ds 2 140 | PUT sprites/Ships.s 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | -------------------------------------------------------------------------------- /demos/fatdog/_FileInformation.txt: -------------------------------------------------------------------------------- 1 | GTEShooter=Type(B3),AuxType(0000),VersionCreate(70),MinVersion(BE),Access(E3),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000) 2 | -------------------------------------------------------------------------------- /demos/fatdog/assets/all-sprites.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/demos/fatdog/assets/all-sprites.gif -------------------------------------------------------------------------------- /demos/fatdog/assets/all-sprites.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/demos/fatdog/assets/all-sprites.png -------------------------------------------------------------------------------- /demos/fatdog/assets/base_scroll.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/demos/fatdog/assets/base_scroll.png -------------------------------------------------------------------------------- /demos/fatdog/assets/shooter-bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/demos/fatdog/assets/shooter-bg.png -------------------------------------------------------------------------------- /demos/fatdog/assets/shooter-fg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/demos/fatdog/assets/shooter-fg.png -------------------------------------------------------------------------------- /demos/fatdog/assets/shooter-sprites.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/demos/fatdog/assets/shooter-sprites.gif -------------------------------------------------------------------------------- /demos/fatdog/assets/shooter-sprites.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/demos/fatdog/assets/shooter-sprites.png -------------------------------------------------------------------------------- /demos/fatdog/build-image.bat: -------------------------------------------------------------------------------- 1 | echo off 2 | 3 | REM Copy all of the assets into the ProDOS image for emulator testing 4 | REM 5 | REM Pass the path of the Cadius tool as the first argument (%1) 6 | 7 | set CADIUS="%1" 8 | set IMAGE="..\\..\\emu\\Target.2mg" 9 | set FOLDER="/GTEDEV/Fatdog" 10 | 11 | REM Cadius does not overwrite files, so clear the root folder first 12 | %CADIUS% DELETEFOLDER %IMAGE% %FOLDER% 13 | %CADIUS% CREATEFOLDER %IMAGE% %FOLDER% 14 | 15 | REM Now copy files and folders as needed 16 | %CADIUS% ADDFILE %IMAGE% %FOLDER% .\\GTEShooter 17 | -------------------------------------------------------------------------------- /demos/fatdog/build-sprites.bat: -------------------------------------------------------------------------------- 1 | echo off 2 | 3 | set MRSPRITE="%1" 4 | 5 | mkdir build 6 | copy assets\all-sprites.gif build\all-sprites.gif 7 | %MRSPRITE% EXTRACT build\all-sprites.gif 0026FF FC0204 8 | %MRSPRITE% RENAME build\all-sprites_spr*.gif Ship 9 | %MRSPRITE% CODE build\Ship_*.gif 0026FF 09162A 181425 293C5A 3A455B 5400D9 9C44FF A50989 FC0204 FF00AF FFCA00 FFFFFF 10 | type build\Ship_*.txt > sprites\Ships.s 11 | 12 | REM Create a wallpaper and copy that for reference 13 | %MRSPRITE% WALLPAPER build\Ship_*.gif 0026FF FC0204 14 | copy build\Ship_Wall.gif sprites\Ship_Wallpaper.gif 15 | del /q build\* 16 | -------------------------------------------------------------------------------- /demos/fatdog/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "fatdog-shooter", 3 | "version": "1.0.0", 4 | "description": "Horizontal shoot-em-up", 5 | "main": "index.js", 6 | "config": { 7 | "merlin32": "C:\\Programs\\IIgsXDev\\bin\\Merlin32-1.1.10.exe", 8 | "cadius": "C:\\Programs\\IIgsXDev\\bin\\Cadius.exe", 9 | "gsport": "C:\\Programs\\gsport\\gsport_0.31\\GSPort.exe", 10 | "macros": "../../macros", 11 | "crossrunner": "C:\\Programs\\Crossrunner\\Crossrunner.exe", 12 | "mrsprite": "C:\\Programs\\IIgsXDev\\bin\\MrSprite.exe" 13 | }, 14 | "scripts": { 15 | "build:app": "%npm_package_config_merlin32% -V %npm_package_config_macros% App.s", 16 | "build:sprites": "build-sprites.bat %npm_package_config_mrsprite%", 17 | "build:image": "build-image.bat %npm_package_config_cadius%", 18 | "build:all": "npm run build:sprites && npm run build:app && npm run build:image", 19 | "build": "npm run build:app && npm run build:image", 20 | "test": "npm run build && %npm_package_config_gsport%", 21 | "debug": "%npm_package_config_crossrunner% GTEShooter -Source GTEShooter_S02_MAINSEG_Output.txt -Debug -CompatibilityLayer" 22 | }, 23 | "repository": { 24 | "type": "git", 25 | "url": "git+https://github.com/lscharen/iigs-game-engine.git" 26 | }, 27 | "author": "Lucas Scharenbroich", 28 | "license": "Apache-2.0", 29 | "bugs": { 30 | "url": "https://github.com/lscharen/iigs-game-engine/issues" 31 | }, 32 | "homepage": "https://github.com/lscharen/iigs-game-engine#readme", 33 | "devDependencies": { 34 | } 35 | } -------------------------------------------------------------------------------- /demos/fatdog/sprites/Ship_Wallpaper.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/demos/fatdog/sprites/Ship_Wallpaper.gif -------------------------------------------------------------------------------- /demos/kfest-2022/demo-1/.gitignore: -------------------------------------------------------------------------------- 1 | GTEDemo1 -------------------------------------------------------------------------------- /demos/kfest-2022/demo-1/App.s: -------------------------------------------------------------------------------- 1 | ; KFest 2022: Demo #1 2 | 3 | TYP $B3 ; S16 file 4 | DSK GTEDemo1 5 | XPL 6 | 7 | ; Segment #1 -- Main execution block 8 | 9 | ASM App.Main.s 10 | SNA Main 11 | 12 | ; Segment #2 -- Tileset 13 | 14 | ASM gen\App.TileSet.s 15 | SNA TSET -------------------------------------------------------------------------------- /demos/kfest-2022/demo-1/README.txt: -------------------------------------------------------------------------------- 1 | Basic scroller with SMB background 2 | - q to quit; arrows to scroll, numbers to select screen size 3 | - make sure Overlay is present -------------------------------------------------------------------------------- /demos/kfest-2022/demo-1/_FileInformation.txt: -------------------------------------------------------------------------------- 1 | GTEDemo1=Type(B3),AuxType(0000),VersionCreate(70),MinVersion(BE),Access(E3),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000) 2 | -------------------------------------------------------------------------------- /demos/kfest-2022/demo-1/assets/tiled/Overworld.tsx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /demos/kfest-2022/demo-1/assets/tilesets/smb-256-128-4bpp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/demos/kfest-2022/demo-1/assets/tilesets/smb-256-128-4bpp.png -------------------------------------------------------------------------------- /demos/kfest-2022/demo-1/build-image.bat: -------------------------------------------------------------------------------- 1 | echo off 2 | 3 | REM Copy all of the assets into the ProDOS image for emulator testing 4 | REM 5 | REM Pass the path of the Cadius tool as the first argument (%1) 6 | 7 | set CADIUS="%1" 8 | set IMAGE="..\\..\\..\\emu\\Target.2mg" 9 | set FOLDER="/GTEDEV/KFestDemo01" 10 | 11 | REM Cadius does not overwrite files, so clear the root folder first 12 | %CADIUS% DELETEFOLDER %IMAGE% %FOLDER% 13 | %CADIUS% CREATEFOLDER %IMAGE% %FOLDER% 14 | 15 | REM Now copy files and folders as needed 16 | %CADIUS% ADDFILE %IMAGE% %FOLDER% .\GTEDemo1 17 | %CADIUS% ADDFILE %IMAGE% %FOLDER% .\gen\bg1.bin 18 | %CADIUS% ADDFILE %IMAGE% %FOLDER% ..\..\..\src\Tool160 19 | -------------------------------------------------------------------------------- /demos/kfest-2022/demo-1/gen/App.TileSetAnim.s: -------------------------------------------------------------------------------- 1 | 2 | TileAnimInit ENT 3 | 4 | ldx #137 5 | ldy #0 6 | jsl CopyTileToDyn 7 | ldx #138 8 | ldy #1 9 | jsl CopyTileToDyn 10 | ldx #169 11 | ldy #2 12 | jsl CopyTileToDyn 13 | ldx #170 14 | ldy #3 15 | jsl CopyTileToDyn 16 | lda #TileAnim_136 17 | ldx #^TileAnim_136 18 | ldy #15 19 | jsl StartScript 20 | lda #TileAnim_137 21 | ldx #^TileAnim_137 22 | ldy #15 23 | jsl StartScript 24 | lda #TileAnim_168 25 | ldx #^TileAnim_168 26 | ldy #15 27 | jsl StartScript 28 | lda #TileAnim_169 29 | ldx #^TileAnim_169 30 | ldy #15 31 | jsl StartScript 32 | rts 33 | TileAnim_136 34 | dw $8006,137,0,0 35 | dw $8006,139,0,0 36 | dw $8006,141,0,0 37 | dw $cd06,143,0,0 38 | TileAnim_137 39 | dw $8006,138,1,0 40 | dw $8006,140,1,0 41 | dw $8006,142,1,0 42 | dw $cd06,144,1,0 43 | TileAnim_168 44 | dw $8006,169,2,0 45 | dw $8006,171,2,0 46 | dw $8006,173,2,0 47 | dw $cd06,175,2,0 48 | TileAnim_169 49 | dw $8006,170,3,0 50 | dw $8006,172,3,0 51 | dw $8006,174,3,0 52 | dw $cd06,176,3,0 -------------------------------------------------------------------------------- /demos/kfest-2022/demo-1/gen/bg1.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/demos/kfest-2022/demo-1/gen/bg1.bin -------------------------------------------------------------------------------- /demos/kfest-2022/demo-1/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "kfest-demo-1", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "config": { 7 | "merlin32": "C:\\Programs\\IIgsXDev\\bin\\Merlin32-1.1.10.exe", 8 | "cadius": "C:\\Programs\\IIgsXDev\\bin\\Cadius.exe", 9 | "gsport": "C:\\Programs\\gsport\\gsport_0.31\\GSPort.exe", 10 | "macros": "../../../macros", 11 | "crossrunner": "C:\\Programs\\Crossrunner\\Crossrunner.exe", 12 | "png2iigs": "../../../tools/png2iigs.js", 13 | "tiled2iigs": "../../../tools/tiled2iigs.js" 14 | }, 15 | "scripts": { 16 | "test": "npm run build && npm run build:image && npm run gsport", 17 | "gsport": "%npm_package_config_gsport%", 18 | "debug": "%npm_package_config_crossrunner% GTETestSprites -Source GTETestSprites_S02_MAINSEG_Output.txt -Debug -CompatibilityLayer", 19 | "build:all": "npm run build:tiles && npm run build:map && npm run build:tool && npm run build:sys16 && npm run build:image", 20 | "build:map": "node %npm_package_config_tiled2iigs% ./assets/tiled/world_1-1.json --empty-tile 33 --no-gen-tiles --output-dir ./gen", 21 | "build:map:masked": "node %npm_package_config_tiled2iigs% ./assets/tiled/world_1-1.json --force-masked --empty-tile 33 --no-gen-tiles --output-dir ./gen", 22 | "build:tiles": "node %npm_package_config_png2iigs% ./assets/tilesets/smb-256-128-4bpp.png --max-tiles 360 --as-tile-data --transparent-color FF00FF --background-color 6B8CFF --verbose > ./gen/App.TileSet.s", 23 | "build:sys16": "%npm_package_config_merlin32% -V %npm_package_config_macros% App.s", 24 | "build": "npm run build:tool && npm run build:sys16", 25 | "build:tool": "%npm_package_config_merlin32% -V %npm_package_config_macros% ../../../src/Master.s", 26 | "build:image": "build-image.bat %npm_package_config_cadius%" 27 | }, 28 | "repository": { 29 | "type": "git", 30 | "url": "git+https://github.com/lscharen/iigs-game-engine.git" 31 | }, 32 | "author": "Lucas Scharenbroich", 33 | "license": "Apache-2.0", 34 | "bugs": { 35 | "url": "https://github.com/lscharen/iigs-game-engine/issues" 36 | }, 37 | "homepage": "https://github.com/lscharen/iigs-game-engine#readme", 38 | "devDependencies": { 39 | "pngjs": "^6.0.0", 40 | "string-builder": "^0.1.8", 41 | "watch": "latest", 42 | "xml2json": "^0.12.0" 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /demos/kfest-2022/demo-10/.gitignore: -------------------------------------------------------------------------------- 1 | GTEDemo10 -------------------------------------------------------------------------------- /demos/kfest-2022/demo-10/App.s: -------------------------------------------------------------------------------- 1 | ; KFest 2022: Demo #10 2 | 3 | TYP $B3 ; S16 file 4 | DSK GTEDemo10 5 | XPL 6 | 7 | ; Segment #1 -- Main execution block 8 | 9 | ASM App.Main.s 10 | SNA Main 11 | 12 | ; Segment #2 -- Tileset 13 | 14 | ASM gen\App.TileSet.s 15 | SNA TSET -------------------------------------------------------------------------------- /demos/kfest-2022/demo-10/_FileInformation.txt: -------------------------------------------------------------------------------- 1 | GTEDemo4=Type(B3),AuxType(0000),VersionCreate(70),MinVersion(BE),Access(E3),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000) 2 | GTEDemo9=Type(B3),AuxType(0000),VersionCreate(70),MinVersion(BE),Access(E3),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000) 3 | GTEDemo10=Type(B3),AuxType(0000),VersionCreate(70),MinVersion(BE),Access(E3),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000) 4 | -------------------------------------------------------------------------------- /demos/kfest-2022/demo-10/assets/tiled/smw-256x128-4bpp.tsx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /demos/kfest-2022/demo-10/assets/tilesets/bg1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/demos/kfest-2022/demo-10/assets/tilesets/bg1.png -------------------------------------------------------------------------------- /demos/kfest-2022/demo-10/assets/tilesets/full.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/demos/kfest-2022/demo-10/assets/tilesets/full.png -------------------------------------------------------------------------------- /demos/kfest-2022/demo-10/assets/tilesets/smw-256x128-4bpp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/demos/kfest-2022/demo-10/assets/tilesets/smw-256x128-4bpp.png -------------------------------------------------------------------------------- /demos/kfest-2022/demo-10/build-image.bat: -------------------------------------------------------------------------------- 1 | echo off 2 | 3 | REM Copy all of the assets into the ProDOS image for emulator testing 4 | REM 5 | REM Pass the path of the Cadius tool as the first argument (%1) 6 | 7 | set CADIUS="%1" 8 | set IMAGE="..\\..\\..\\emu\\Target.2mg" 9 | set FOLDER="/GTEDEV/KFestDemo10" 10 | 11 | REM Cadius does not overwrite files, so clear the root folder first 12 | %CADIUS% DELETEFOLDER %IMAGE% %FOLDER% 13 | %CADIUS% CREATEFOLDER %IMAGE% %FOLDER% 14 | 15 | REM Now copy files and folders as needed 16 | %CADIUS% ADDFILE %IMAGE% %FOLDER% .\GTEDemo10 17 | %CADIUS% ADDFILE %IMAGE% %FOLDER% .\gen\bg1.bin 18 | %CADIUS% ADDFILE %IMAGE% %FOLDER% ..\..\..\src\Tool160 19 | -------------------------------------------------------------------------------- /demos/kfest-2022/demo-10/gen/_FileInformation.txt: -------------------------------------------------------------------------------- 1 | bg1.bin=Type(06),AuxType(0000),Access(E3) -------------------------------------------------------------------------------- /demos/kfest-2022/demo-10/gen/bg1.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/demos/kfest-2022/demo-10/gen/bg1.bin -------------------------------------------------------------------------------- /demos/kfest-2022/demo-10/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "kfest-demo-10", 3 | "version": "1.0.0", 4 | "description": "Rotation secodary background", 5 | "main": "index.js", 6 | "config": { 7 | "merlin32": "C:\\Programs\\IIgsXDev\\bin\\Merlin32-1.1.10.exe", 8 | "cadius": "C:\\Programs\\IIgsXDev\\bin\\Cadius.exe", 9 | "gsport": "C:\\Programs\\gsport\\gsport_0.31\\GSPort.exe", 10 | "macros": "../../../macros", 11 | "crossrunner": "C:\\Programs\\Crossrunner\\Crossrunner.exe", 12 | "png2iigs": "../../../tools/png2iigs.js", 13 | "tiled2iigs": "../../../tools/tiled2iigs.js" 14 | }, 15 | "scripts": { 16 | "test": "npm run build && npm run build:image && npm run gsport", 17 | "gsport": "%npm_package_config_gsport%", 18 | "debug": "%npm_package_config_crossrunner% GTEDemo4 -Source GTEDemo4_S02_MAINSEG_Output.txt -Debug -CompatibilityLayer", 19 | "build:all": "npm run build:tiles && npm run build:map && npm run build:tool && npm run build:sys16 && npm run build:image", 20 | "build:map": "node %npm_package_config_tiled2iigs% ./assets/tiled/yoshi-1.json --force-masked --no-gen-tiles --output-dir ./gen", 21 | "build:tiles": "node %npm_package_config_png2iigs% ./assets/tilesets/smw-256x128-4bpp.png --max-tiles 360 --as-tile-data --verbose --transparent-color FF00FF --background-color 216058 > ./gen/App.TileSet.s", 22 | "build:tiles:blocky": "node %npm_package_config_png2iigs% ./assets/tilesets/smw-256x128-4bpp.png --max-tiles 360 --as-tile-data --verbose --force-word-alignment --transparent-color FF00FF --background-color 216058 > ./gen/App.TileSet.s", 23 | "build:sys16": "%npm_package_config_merlin32% -V %npm_package_config_macros% App.s", 24 | "build": "npm run build:tool && npm run build:sys16", 25 | "build:tool": "%npm_package_config_merlin32% -V %npm_package_config_macros% ../../../src/Master.s", 26 | "build:image": "build-image.bat %npm_package_config_cadius%", 27 | "build:background": "node %npm_package_config_png2iigs% ./assets/tilesets/bg1.png ./gen/bg1.bin --force-color-match --palette FF00FF,0B0B0B,216058,636363,C14F4A,008000,00E100,C89858,F5D56C,20308F,F80080,2D2D2D,4080A0,909090,A0CDCC,DAE6E" 28 | }, 29 | "repository": { 30 | "type": "git", 31 | "url": "git+https://github.com/lscharen/iigs-game-engine.git" 32 | }, 33 | "author": "Lucas Scharenbroich", 34 | "license": "Apache-2.0", 35 | "bugs": { 36 | "url": "https://github.com/lscharen/iigs-game-engine/issues" 37 | }, 38 | "homepage": "https://github.com/lscharen/iigs-game-engine#readme", 39 | "devDependencies": { 40 | "pngjs": "^6.0.0", 41 | "string-builder": "^0.1.8", 42 | "watch": "latest", 43 | "xml2json": "^0.12.0" 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /demos/kfest-2022/demo-2/.gitignore: -------------------------------------------------------------------------------- 1 | GTEDemo2 -------------------------------------------------------------------------------- /demos/kfest-2022/demo-2/App.s: -------------------------------------------------------------------------------- 1 | ; KFest 2022: Demo #1 2 | 3 | TYP $B3 ; S16 file 4 | DSK GTEDemo2 5 | XPL 6 | 7 | ; Segment #1 -- Main execution block 8 | 9 | ASM App.Main.s 10 | SNA Main 11 | 12 | ; Segment #2 -- Tileset 13 | 14 | ASM gen\App.TileSet.s 15 | SNA TSET -------------------------------------------------------------------------------- /demos/kfest-2022/demo-2/_FileInformation.txt: -------------------------------------------------------------------------------- 1 | GTEDemo1=Type(B3),AuxType(0000),VersionCreate(70),MinVersion(BE),Access(E3),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000) 2 | GTEDemo2=Type(B3),AuxType(0000),VersionCreate(70),MinVersion(BE),Access(E3),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000) 3 | -------------------------------------------------------------------------------- /demos/kfest-2022/demo-2/assets/tiled/Overworld.tsx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /demos/kfest-2022/demo-2/assets/tilesets/smb-256-128-4bpp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/demos/kfest-2022/demo-2/assets/tilesets/smb-256-128-4bpp.png -------------------------------------------------------------------------------- /demos/kfest-2022/demo-2/build-image.bat: -------------------------------------------------------------------------------- 1 | echo off 2 | 3 | REM Copy all of the assets into the ProDOS image for emulator testing 4 | REM 5 | REM Pass the path of the Cadius tool as the first argument (%1) 6 | 7 | set CADIUS="%1" 8 | set IMAGE="..\\..\\..\\emu\\Target.2mg" 9 | set FOLDER="/GTEDEV/KFestDemo02" 10 | 11 | REM Cadius does not overwrite files, so clear the root folder first 12 | %CADIUS% DELETEFOLDER %IMAGE% %FOLDER% 13 | %CADIUS% CREATEFOLDER %IMAGE% %FOLDER% 14 | 15 | REM Now copy files and folders as needed 16 | %CADIUS% ADDFILE %IMAGE% %FOLDER% .\GTEDemo2 17 | %CADIUS% ADDFILE %IMAGE% %FOLDER% ..\..\..\src\Tool160 18 | -------------------------------------------------------------------------------- /demos/kfest-2022/demo-2/gen/App.TileSetAnim.s: -------------------------------------------------------------------------------- 1 | 2 | TileAnimInit 3 | pea #137 4 | pea #0 5 | _GTECopyTileToDynamic 6 | pea #138 7 | pea #1 8 | _GTECopyTileToDynamic 9 | pea #169 10 | pea #2 11 | _GTECopyTileToDynamic 12 | pea #170 13 | pea #3 14 | _GTECopyTileToDynamic 15 | 16 | pea #15 17 | pea #^TileAnim 18 | pea #TileAnim 19 | _GTEStartScript 20 | rts 21 | TileAnim 22 | dw $0006,137,0,0 23 | dw $0006,138,1,0 24 | dw $0006,169,2,0 25 | dw $8006,170,3,0 26 | 27 | dw $0006,139,0,0 28 | dw $0006,140,1,0 29 | dw $0006,171,2,0 30 | dw $8006,172,3,0 31 | 32 | dw $0006,141,0,0 33 | dw $0006,142,1,0 34 | dw $0006,173,2,0 35 | dw $8006,174,3,0 36 | 37 | dw $0006,143,0,0 38 | dw $0006,144,1,0 39 | dw $0006,175,2,0 40 | dw $cc46,176,3,0 ; STOP; JUMP(-15) -15 = $31 (6 bit) = %110001 = 1100 0100 = C4 41 | -------------------------------------------------------------------------------- /demos/kfest-2022/demo-2/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "kfest-demo-2", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "config": { 7 | "merlin32": "C:\\Programs\\IIgsXDev\\bin\\Merlin32-1.1.10.exe", 8 | "cadius": "C:\\Programs\\IIgsXDev\\bin\\Cadius.exe", 9 | "gsport": "C:\\Programs\\gsport\\gsport_0.31\\GSPort.exe", 10 | "macros": "../../../macros", 11 | "crossrunner": "C:\\Programs\\Crossrunner\\Crossrunner.exe", 12 | "png2iigs": "../../../tools/png2iigs.js", 13 | "tiled2iigs": "../../../tools/tiled2iigs.js" 14 | }, 15 | "scripts": { 16 | "test": "npm run build && npm run build:image && npm run gsport", 17 | "gsport": "%npm_package_config_gsport%", 18 | "debug": "%npm_package_config_crossrunner% GTETestSprites -Source GTETestSprites_S02_MAINSEG_Output.txt -Debug -CompatibilityLayer", 19 | "build:all": "npm run build:tiles && npm run build:map && npm run build:tool && npm run build:sys16 && npm run build:image", 20 | "build:map": "node %npm_package_config_tiled2iigs% ./assets/tiled/world_1-1.json --empty-tile 33 --no-gen-tiles --output-dir ./gen", 21 | "build:map:masked": "node %npm_package_config_tiled2iigs% ./assets/tiled/world_1-1.json --force-masked --empty-tile 33 --no-gen-tiles --output-dir ./gen", 22 | "build:tiles": "node %npm_package_config_png2iigs% ./assets/tilesets/smb-256-128-4bpp.png --max-tiles 360 --as-tile-data --transparent-color FF00FF --background-color 6B8CFF --verbose > ./gen/App.TileSet.s", 23 | "build:sys16": "%npm_package_config_merlin32% -V %npm_package_config_macros% App.s", 24 | "build": "npm run build:tool && npm run build:sys16", 25 | "build:tool": "%npm_package_config_merlin32% -V %npm_package_config_macros% ../../../src/Master.s", 26 | "build:image": "build-image.bat %npm_package_config_cadius%" 27 | }, 28 | "repository": { 29 | "type": "git", 30 | "url": "git+https://github.com/lscharen/iigs-game-engine.git" 31 | }, 32 | "author": "Lucas Scharenbroich", 33 | "license": "Apache-2.0", 34 | "bugs": { 35 | "url": "https://github.com/lscharen/iigs-game-engine/issues" 36 | }, 37 | "homepage": "https://github.com/lscharen/iigs-game-engine#readme", 38 | "devDependencies": { 39 | "pngjs": "^6.0.0", 40 | "string-builder": "^0.1.8", 41 | "watch": "latest", 42 | "xml2json": "^0.12.0" 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /demos/kfest-2022/demo-3/.gitignore: -------------------------------------------------------------------------------- 1 | GTEDemo3 -------------------------------------------------------------------------------- /demos/kfest-2022/demo-3/App.s: -------------------------------------------------------------------------------- 1 | ; KFest 2022: Demo #1 2 | 3 | TYP $B3 ; S16 file 4 | DSK GTEDemo3 5 | XPL 6 | 7 | ; Segment #1 -- Main execution block 8 | 9 | ASM App.Main.s 10 | SNA Main 11 | 12 | ; Segment #2 -- Tileset 13 | 14 | ASM gen\App.TileSet.s 15 | SNA TSET -------------------------------------------------------------------------------- /demos/kfest-2022/demo-3/_FileInformation.txt: -------------------------------------------------------------------------------- 1 | GTEDemo1=Type(B3),AuxType(0000),VersionCreate(70),MinVersion(BE),Access(E3),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000) 2 | GTEDemo2=Type(B3),AuxType(0000),VersionCreate(70),MinVersion(BE),Access(E3),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000) 3 | GTEDemo3=Type(B3),AuxType(0000),VersionCreate(70),MinVersion(BE),Access(E3),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000) 4 | -------------------------------------------------------------------------------- /demos/kfest-2022/demo-3/assets/tiled/MetalStore.tsx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | -------------------------------------------------------------------------------- /demos/kfest-2022/demo-3/assets/tilesets/tile-sheet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/demos/kfest-2022/demo-3/assets/tilesets/tile-sheet.png -------------------------------------------------------------------------------- /demos/kfest-2022/demo-3/build-image.bat: -------------------------------------------------------------------------------- 1 | echo off 2 | 3 | REM Copy all of the assets into the ProDOS image for emulator testing 4 | REM 5 | REM Pass the path of the Cadius tool as the first argument (%1) 6 | 7 | set CADIUS="%1" 8 | set IMAGE="..\\..\\..\\emu\\Target.2mg" 9 | set FOLDER="/GTEDEV/KFestDemo03" 10 | 11 | REM Cadius does not overwrite files, so clear the root folder first 12 | %CADIUS% DELETEFOLDER %IMAGE% %FOLDER% 13 | %CADIUS% CREATEFOLDER %IMAGE% %FOLDER% 14 | 15 | REM Now copy files and folders as needed 16 | %CADIUS% ADDFILE %IMAGE% %FOLDER% .\GTEDemo3 17 | %CADIUS% ADDFILE %IMAGE% %FOLDER% ..\..\..\src\Tool160 18 | -------------------------------------------------------------------------------- /demos/kfest-2022/demo-3/gen/MetalStoreAnim.s: -------------------------------------------------------------------------------- 1 | 2 | TileAnimInit 3 | 4 | pea 129 5 | pea 0 6 | _GTECopyTileToDynamic 7 | pea 130 8 | pea 1 9 | _GTECopyTileToDynamic 10 | pea 131 11 | pea 2 12 | _GTECopyTileToDynamic 13 | pea 132 14 | pea 3 15 | _GTECopyTileToDynamic 16 | pea 161 17 | pea 4 18 | _GTECopyTileToDynamic 19 | pea 162 20 | pea 5 21 | _GTECopyTileToDynamic 22 | pea 163 23 | pea 6 24 | _GTECopyTileToDynamic 25 | pea 164 26 | pea 7 27 | _GTECopyTileToDynamic 28 | pea 193 29 | pea 8 30 | _GTECopyTileToDynamic 31 | pea 194 32 | pea 9 33 | _GTECopyTileToDynamic 34 | pea 195 35 | pea 10 36 | _GTECopyTileToDynamic 37 | pea 196 38 | pea 11 39 | _GTECopyTileToDynamic 40 | pea 225 41 | pea 12 42 | _GTECopyTileToDynamic 43 | pea 226 44 | pea 13 45 | _GTECopyTileToDynamic 46 | pea 227 47 | pea 14 48 | _GTECopyTileToDynamic 49 | pea 228 50 | pea 15 51 | _GTECopyTileToDynamic 52 | pea 15 53 | pea ^TileAnim_128 54 | pea TileAnim_128 55 | _GTEStartScript 56 | pea 15 57 | pea ^TileAnim_129 58 | pea TileAnim_129 59 | _GTEStartScript 60 | pea 15 61 | pea ^TileAnim_130 62 | pea TileAnim_130 63 | _GTEStartScript 64 | pea 15 65 | pea ^TileAnim_131 66 | pea TileAnim_131 67 | _GTEStartScript 68 | pea 15 69 | pea ^TileAnim_160 70 | pea TileAnim_160 71 | _GTEStartScript 72 | pea 15 73 | pea ^TileAnim_161 74 | pea TileAnim_161 75 | _GTEStartScript 76 | pea 15 77 | pea ^TileAnim_162 78 | pea TileAnim_162 79 | _GTEStartScript 80 | pea 15 81 | pea ^TileAnim_163 82 | pea TileAnim_163 83 | _GTEStartScript 84 | pea 15 85 | pea ^TileAnim_192 86 | pea TileAnim_192 87 | _GTEStartScript 88 | pea 15 89 | pea ^TileAnim_193 90 | pea TileAnim_193 91 | _GTEStartScript 92 | pea 15 93 | pea ^TileAnim_194 94 | pea TileAnim_194 95 | _GTEStartScript 96 | pea 15 97 | pea ^TileAnim_195 98 | pea TileAnim_195 99 | _GTEStartScript 100 | pea 15 101 | pea ^TileAnim_224 102 | pea TileAnim_224 103 | _GTEStartScript 104 | pea 15 105 | pea ^TileAnim_225 106 | pea TileAnim_225 107 | _GTEStartScript 108 | pea 15 109 | pea ^TileAnim_226 110 | pea TileAnim_226 111 | _GTEStartScript 112 | pea 15 113 | pea ^TileAnim_227 114 | pea TileAnim_227 115 | _GTEStartScript 116 | rts 117 | TileAnim_128 118 | dw $c006,129,0,0 119 | TileAnim_129 120 | dw $c006,130,1,0 121 | TileAnim_130 122 | dw $c006,131,2,0 123 | TileAnim_131 124 | dw $c006,132,3,0 125 | TileAnim_160 126 | dw $c006,161,4,0 127 | TileAnim_161 128 | dw $c006,162,5,0 129 | TileAnim_162 130 | dw $c006,163,6,0 131 | TileAnim_163 132 | dw $c006,164,7,0 133 | TileAnim_192 134 | dw $c006,193,8,0 135 | TileAnim_193 136 | dw $c006,194,9,0 137 | TileAnim_194 138 | dw $c006,195,10,0 139 | TileAnim_195 140 | dw $c006,196,11,0 141 | TileAnim_224 142 | dw $c006,225,12,0 143 | TileAnim_225 144 | dw $c006,226,13,0 145 | TileAnim_226 146 | dw $c006,227,14,0 147 | TileAnim_227 148 | dw $c006,228,15,0 -------------------------------------------------------------------------------- /demos/kfest-2022/demo-3/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "kfest-demo-3", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "config": { 7 | "merlin32": "C:\\Programs\\IIgsXDev\\bin\\Merlin32-1.1.10.exe", 8 | "cadius": "C:\\Programs\\IIgsXDev\\bin\\Cadius.exe", 9 | "gsport": "C:\\Programs\\gsport\\gsport_0.31\\GSPort.exe", 10 | "macros": "../../../macros", 11 | "crossrunner": "C:\\Programs\\Crossrunner\\Crossrunner.exe", 12 | "png2iigs": "../../../tools/png2iigs.js", 13 | "tiled2iigs": "../../../tools/tiled2iigs.js" 14 | }, 15 | "scripts": { 16 | "test": "npm run build && npm run build:image && npm run gsport", 17 | "gsport": "%npm_package_config_gsport%", 18 | "debug": "%npm_package_config_crossrunner% GTETestSprites -Source GTETestSprites_S02_MAINSEG_Output.txt -Debug -CompatibilityLayer", 19 | "build:all": "npm run build:tiles && npm run build:map && npm run build:tool && npm run build:sys16 && npm run build:image", 20 | "build:map": "node %npm_package_config_tiled2iigs% ./assets/tiled/level-1.json --no-gen-tiles --output-dir ./gen", 21 | "build:tiles": "node %npm_package_config_png2iigs% ./assets/tilesets/tile-sheet.png --max-tiles 360 --as-tile-data --verbose > ./gen/App.TileSet.s", 22 | "build:sys16": "%npm_package_config_merlin32% -V %npm_package_config_macros% App.s", 23 | "build": "npm run build:tool && npm run build:sys16", 24 | "build:tool": "%npm_package_config_merlin32% -V %npm_package_config_macros% ../../../src/Master.s", 25 | "build:image": "build-image.bat %npm_package_config_cadius%" 26 | }, 27 | "repository": { 28 | "type": "git", 29 | "url": "git+https://github.com/lscharen/iigs-game-engine.git" 30 | }, 31 | "author": "Lucas Scharenbroich", 32 | "license": "Apache-2.0", 33 | "bugs": { 34 | "url": "https://github.com/lscharen/iigs-game-engine/issues" 35 | }, 36 | "homepage": "https://github.com/lscharen/iigs-game-engine#readme", 37 | "devDependencies": { 38 | "pngjs": "^6.0.0", 39 | "string-builder": "^0.1.8", 40 | "watch": "latest", 41 | "xml2json": "^0.12.0" 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /demos/kfest-2022/demo-4/.gitignore: -------------------------------------------------------------------------------- 1 | GTEDemo4 -------------------------------------------------------------------------------- /demos/kfest-2022/demo-4/App.s: -------------------------------------------------------------------------------- 1 | ; KFest 2022: Demo #4 2 | 3 | TYP $B3 ; S16 file 4 | DSK GTEDemo4 5 | XPL 6 | 7 | ; Segment #1 -- Main execution block 8 | 9 | ASM App.Main.s 10 | SNA Main 11 | 12 | ; Segment #2 -- Tileset 13 | 14 | ASM gen\App.TileSet.s 15 | SNA TSET -------------------------------------------------------------------------------- /demos/kfest-2022/demo-4/_FileInformation.txt: -------------------------------------------------------------------------------- 1 | GTEDemo4=Type(B3),AuxType(0000),VersionCreate(70),MinVersion(BE),Access(E3),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000) 2 | -------------------------------------------------------------------------------- /demos/kfest-2022/demo-4/assets/tiled/smw-256x128-4bpp.tsx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /demos/kfest-2022/demo-4/assets/tilesets/bg1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/demos/kfest-2022/demo-4/assets/tilesets/bg1.png -------------------------------------------------------------------------------- /demos/kfest-2022/demo-4/assets/tilesets/full.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/demos/kfest-2022/demo-4/assets/tilesets/full.png -------------------------------------------------------------------------------- /demos/kfest-2022/demo-4/assets/tilesets/smw-256x128-4bpp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/demos/kfest-2022/demo-4/assets/tilesets/smw-256x128-4bpp.png -------------------------------------------------------------------------------- /demos/kfest-2022/demo-4/build-image.bat: -------------------------------------------------------------------------------- 1 | echo off 2 | 3 | REM Copy all of the assets into the ProDOS image for emulator testing 4 | REM 5 | REM Pass the path of the Cadius tool as the first argument (%1) 6 | 7 | set CADIUS="%1" 8 | set IMAGE="..\\..\\..\\emu\\Target.2mg" 9 | set FOLDER="/GTEDEV/KFestDemo04" 10 | 11 | REM Cadius does not overwrite files, so clear the root folder first 12 | %CADIUS% DELETEFOLDER %IMAGE% %FOLDER% 13 | %CADIUS% CREATEFOLDER %IMAGE% %FOLDER% 14 | 15 | REM Now copy files and folders as needed 16 | %CADIUS% ADDFILE %IMAGE% %FOLDER% .\GTEDemo4 17 | %CADIUS% ADDFILE %IMAGE% %FOLDER% .\gen\bg1.bin 18 | %CADIUS% ADDFILE %IMAGE% %FOLDER% ..\..\..\src\Tool160 19 | -------------------------------------------------------------------------------- /demos/kfest-2022/demo-4/gen/_FileInformation.txt: -------------------------------------------------------------------------------- 1 | bg1.bin=Type(06),AuxType(0000),Access(E3) -------------------------------------------------------------------------------- /demos/kfest-2022/demo-4/gen/bg1.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/demos/kfest-2022/demo-4/gen/bg1.bin -------------------------------------------------------------------------------- /demos/kfest-2022/demo-4/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "kfest-demo-4", 3 | "version": "1.0.0", 4 | "description": "Two Layer scrilling with snippets and without", 5 | "main": "index.js", 6 | "config": { 7 | "merlin32": "C:\\Programs\\IIgsXDev\\bin\\Merlin32-1.1.10.exe", 8 | "cadius": "C:\\Programs\\IIgsXDev\\bin\\Cadius.exe", 9 | "gsport": "C:\\Programs\\gsport\\gsport_0.31\\GSPort.exe", 10 | "macros": "../../../macros", 11 | "crossrunner": "C:\\Programs\\Crossrunner\\Crossrunner.exe", 12 | "png2iigs": "../../../tools/png2iigs.js", 13 | "tiled2iigs": "../../../tools/tiled2iigs.js" 14 | }, 15 | "scripts": { 16 | "test": "npm run build && npm run build:image && npm run gsport", 17 | "gsport": "cross-var $npm_package_config_gsport", 18 | "debug": "cross-var $npm_package_config_crossrunner GTEDemo4 -Source GTEDemo4_S02_MAINSEG_Output.txt -Debug -CompatibilityLayer", 19 | "build:all": "npm run build:tiles && npm run build:map && npm run build:tool && npm run build:sys16 && npm run build:image", 20 | "build:map": "cross-var node $npm_package_config_tiled2iigs ./assets/tiled/yoshi-1.json --force-masked --no-gen-tiles --output-dir ./gen", 21 | "build:tiles": "cross-var node $npm_package_config_png2iigs ./assets/tilesets/smw-256x128-4bpp.png --max-tiles 360 --as-tile-data --var-name tiledata --verbose --transparent-color FF00FF --background-color 216058 > ./gen/App.TileSet.s", 22 | "build:tiles:blocky": "cross-var node $npm_package_config_png2iigs ./assets/tilesets/smw-256x128-4bpp.png --max-tiles 360 --as-tile-data --var-name tiledata --verbose --force-word-alignment --transparent-color FF00FF --background-color 216058 > ./gen/App.TileSet.s", 23 | "build:sys16": "cross-var $npm_package_config_merlin32 -V $npm_package_config_macros App.s", 24 | "build": "npm run build:tool && npm run build:sys16", 25 | "build:tool": "cross-var $npm_package_config_merlin32 -V $npm_package_config_macros ../../../src/Master.s", 26 | "build:image": "cross-var build-image.bat $npm_package_config_cadius", 27 | "build:background": "cross-var node $npm_package_config_png2iigs ./assets/tilesets/bg1.png ./gen/bg1.bin --force-color-match --palette FF00FF,C14F4A,020202,00E100,C89858,216058,DCE9EE,008000,F80080,F5D56C,20308F,A0CDCC,4080A0,70B0D0" 28 | }, 29 | "repository": { 30 | "type": "git", 31 | "url": "git+https://github.com/lscharen/iigs-game-engine.git" 32 | }, 33 | "author": "Lucas Scharenbroich", 34 | "license": "Apache-2.0", 35 | "bugs": { 36 | "url": "https://github.com/lscharen/iigs-game-engine/issues" 37 | }, 38 | "homepage": "https://github.com/lscharen/iigs-game-engine#readme", 39 | "devDependencies": { 40 | "cross-var": "^1.1.0", 41 | "pngjs": "^6.0.0", 42 | "string-builder": "^0.1.8", 43 | "watch": "latest", 44 | "xml2json": "^0.12.0" 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /demos/kfest-2022/demo-5/.gitignore: -------------------------------------------------------------------------------- 1 | GTEDemo5 -------------------------------------------------------------------------------- /demos/kfest-2022/demo-5/App.s: -------------------------------------------------------------------------------- 1 | ; KFest 2022: Demo #5 2 | 3 | TYP $B3 ; S16 file 4 | DSK GTEDemo5 5 | XPL 6 | 7 | ; Segment #1 -- Main execution block 8 | 9 | ASM App.Main.s 10 | SNA Main 11 | 12 | ; Segment #2 -- Tileset 13 | 14 | ASM gen\App.TileSet.s 15 | SNA TSET -------------------------------------------------------------------------------- /demos/kfest-2022/demo-5/README.txt: -------------------------------------------------------------------------------- 1 | Basic scroller with SMB background 2 | - q to quit; arrows to scroll, numbers to select screen size 3 | - make sure Overlay is present -------------------------------------------------------------------------------- /demos/kfest-2022/demo-5/_FileInformation.txt: -------------------------------------------------------------------------------- 1 | GTEDemo1=Type(B3),AuxType(0000),VersionCreate(70),MinVersion(BE),Access(E3),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000) 2 | GTEDemo5=Type(B3),AuxType(0000),VersionCreate(70),MinVersion(BE),Access(E3),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000) 3 | -------------------------------------------------------------------------------- /demos/kfest-2022/demo-5/assets/_FileInformation.txt: -------------------------------------------------------------------------------- 1 | overworld.ntp=Type(D5),AuxType(0008),Access(E3) -------------------------------------------------------------------------------- /demos/kfest-2022/demo-5/assets/overworld.ntp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/demos/kfest-2022/demo-5/assets/overworld.ntp -------------------------------------------------------------------------------- /demos/kfest-2022/demo-5/assets/tiled/Overworld.tsx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /demos/kfest-2022/demo-5/assets/tilesets/smb-256-128-4bpp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/demos/kfest-2022/demo-5/assets/tilesets/smb-256-128-4bpp.png -------------------------------------------------------------------------------- /demos/kfest-2022/demo-5/build-image.bat: -------------------------------------------------------------------------------- 1 | echo off 2 | 3 | REM Copy all of the assets into the ProDOS image for emulator testing 4 | REM 5 | REM Pass the path of the Cadius tool as the first argument (%1) 6 | 7 | set CADIUS="%1" 8 | set IMAGE="..\\..\\..\\emu\\Target.2mg" 9 | set FOLDER="/GTEDEV/KFestDemo05" 10 | 11 | REM Cadius does not overwrite files, so clear the root folder first 12 | %CADIUS% DELETEFOLDER %IMAGE% %FOLDER% 13 | %CADIUS% CREATEFOLDER %IMAGE% %FOLDER% 14 | 15 | REM Now copy files and folders as needed 16 | %CADIUS% ADDFILE %IMAGE% %FOLDER% .\GTEDemo5 17 | %CADIUS% ADDFILE %IMAGE% %FOLDER% ..\..\..\src\Tool160 18 | %CADIUS% ADDFILE %IMAGE% %FOLDER% .\assets\overworld.ntp 19 | -------------------------------------------------------------------------------- /demos/kfest-2022/demo-5/gen/App.TileSetAnim.s: -------------------------------------------------------------------------------- 1 | 2 | TileAnimInit 3 | 4 | pea 137 5 | pea 0 6 | _GTECopyTileToDynamic 7 | pea 138 8 | pea 1 9 | _GTECopyTileToDynamic 10 | pea 169 11 | pea 2 12 | _GTECopyTileToDynamic 13 | pea 170 14 | pea 3 15 | _GTECopyTileToDynamic 16 | pea 15 17 | pea ^TileAnim_136 18 | pea TileAnim_136 19 | _GTEStartScript 20 | pea 15 21 | pea ^TileAnim_137 22 | pea TileAnim_137 23 | _GTEStartScript 24 | pea 15 25 | pea ^TileAnim_168 26 | pea TileAnim_168 27 | _GTEStartScript 28 | pea 15 29 | pea ^TileAnim_169 30 | pea TileAnim_169 31 | _GTEStartScript 32 | rts 33 | TileAnim_136 34 | dw $8006,137,0,0 35 | dw $8006,139,0,0 36 | dw $8006,141,0,0 37 | dw $cd06,143,0,0 38 | TileAnim_137 39 | dw $8006,138,1,0 40 | dw $8006,140,1,0 41 | dw $8006,142,1,0 42 | dw $cd06,144,1,0 43 | TileAnim_168 44 | dw $8006,169,2,0 45 | dw $8006,171,2,0 46 | dw $8006,173,2,0 47 | dw $cd06,175,2,0 48 | TileAnim_169 49 | dw $8006,170,3,0 50 | dw $8006,172,3,0 51 | dw $8006,174,3,0 52 | dw $cd06,176,3,0 -------------------------------------------------------------------------------- /demos/kfest-2022/demo-5/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "kfest-demo-5", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "config": { 7 | "merlin32": "C:\\Programs\\IIgsXDev\\bin\\Merlin32-1.1.10.exe", 8 | "cadius": "C:\\Programs\\IIgsXDev\\bin\\Cadius.exe", 9 | "gsport": "C:\\Programs\\gsport\\gsport_0.31\\GSPort.exe", 10 | "macros": "../../../macros", 11 | "crossrunner": "C:\\Programs\\Crossrunner\\Crossrunner.exe", 12 | "png2iigs": "../../../tools/png2iigs.js", 13 | "tiled2iigs": "../../../tools/tiled2iigs.js" 14 | }, 15 | "scripts": { 16 | "test": "npm run build && npm run build:image && npm run gsport", 17 | "gsport": "%npm_package_config_gsport%", 18 | "debug": "%npm_package_config_crossrunner% GTETestSprites -Source GTETestSprites_S02_MAINSEG_Output.txt -Debug -CompatibilityLayer", 19 | "build:all": "npm run build:tiles && npm run build:map && npm run build:tool && npm run build:sys16 && npm run build:image", 20 | "build:map": "node %npm_package_config_tiled2iigs% ./assets/tiled/world_1-1.json --empty-tile 33 --no-gen-tiles --output-dir ./gen", 21 | "build:map:masked": "node %npm_package_config_tiled2iigs% ./assets/tiled/world_1-1.json --force-masked --empty-tile 33 --no-gen-tiles --output-dir ./gen", 22 | "build:tiles": "node %npm_package_config_png2iigs% ./assets/tilesets/smb-256-128-4bpp.png --max-tiles 360 --as-tile-data --transparent-color FF00FF --background-color 6B8CFF --verbose > ./gen/App.TileSet.s", 23 | "build:sys16": "%npm_package_config_merlin32% -V %npm_package_config_macros% App.s", 24 | "build": "npm run build:tool && npm run build:sys16", 25 | "build:tool": "%npm_package_config_merlin32% -V %npm_package_config_macros% ../../../src/Master.s", 26 | "build:image": "build-image.bat %npm_package_config_cadius%" 27 | }, 28 | "repository": { 29 | "type": "git", 30 | "url": "git+https://github.com/lscharen/iigs-game-engine.git" 31 | }, 32 | "author": "Lucas Scharenbroich", 33 | "license": "Apache-2.0", 34 | "bugs": { 35 | "url": "https://github.com/lscharen/iigs-game-engine/issues" 36 | }, 37 | "homepage": "https://github.com/lscharen/iigs-game-engine#readme", 38 | "devDependencies": { 39 | "pngjs": "^6.0.0", 40 | "string-builder": "^0.1.8", 41 | "watch": "latest", 42 | "xml2json": "^0.12.0" 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /demos/kfest-2022/demo-8/.gitignore: -------------------------------------------------------------------------------- 1 | GTEDemo8 -------------------------------------------------------------------------------- /demos/kfest-2022/demo-8/App.s: -------------------------------------------------------------------------------- 1 | ; KFest 2022: Demo #8 2 | 3 | TYP $B3 ; S16 file 4 | DSK GTEDemo8 5 | XPL 6 | 7 | ; Segment #1 -- Main execution block 8 | 9 | ASM App.Main.s 10 | SNA Main 11 | 12 | ; Segment #2 -- Tileset 13 | 14 | ASM gen\App.TileSet.s 15 | SNA TSET -------------------------------------------------------------------------------- /demos/kfest-2022/demo-8/_FileInformation.txt: -------------------------------------------------------------------------------- 1 | GTEDemo4=Type(B3),AuxType(0000),VersionCreate(70),MinVersion(BE),Access(E3),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000) 2 | GTEDemo8=Type(B3),AuxType(0000),VersionCreate(70),MinVersion(BE),Access(E3),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000) 3 | -------------------------------------------------------------------------------- /demos/kfest-2022/demo-8/assets/tiled/smw-256x128-4bpp.tsx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /demos/kfest-2022/demo-8/assets/tilesets/bg1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/demos/kfest-2022/demo-8/assets/tilesets/bg1.png -------------------------------------------------------------------------------- /demos/kfest-2022/demo-8/assets/tilesets/bg2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/demos/kfest-2022/demo-8/assets/tilesets/bg2.png -------------------------------------------------------------------------------- /demos/kfest-2022/demo-8/assets/tilesets/full.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/demos/kfest-2022/demo-8/assets/tilesets/full.png -------------------------------------------------------------------------------- /demos/kfest-2022/demo-8/assets/tilesets/smw-256x128-4bpp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/demos/kfest-2022/demo-8/assets/tilesets/smw-256x128-4bpp.png -------------------------------------------------------------------------------- /demos/kfest-2022/demo-8/build-image.bat: -------------------------------------------------------------------------------- 1 | echo off 2 | 3 | REM Copy all of the assets into the ProDOS image for emulator testing 4 | REM 5 | REM Pass the path of the Cadius tool as the first argument (%1) 6 | 7 | set CADIUS="%1" 8 | set IMAGE="..\\..\\..\\emu\\Target.2mg" 9 | set FOLDER="/GTEDEV/KFestDemo08" 10 | 11 | REM Cadius does not overwrite files, so clear the root folder first 12 | %CADIUS% DELETEFOLDER %IMAGE% %FOLDER% 13 | %CADIUS% CREATEFOLDER %IMAGE% %FOLDER% 14 | 15 | REM Now copy files and folders as needed 16 | %CADIUS% ADDFILE %IMAGE% %FOLDER% .\GTEDemo8 17 | %CADIUS% ADDFILE %IMAGE% %FOLDER% .\gen\bg1.bin 18 | %CADIUS% ADDFILE %IMAGE% %FOLDER% .\gen\bg2.bin 19 | %CADIUS% ADDFILE %IMAGE% %FOLDER% ..\..\..\src\Tool160 20 | -------------------------------------------------------------------------------- /demos/kfest-2022/demo-8/gen/_FileInformation.txt: -------------------------------------------------------------------------------- 1 | bg1.bin=Type(06),AuxType(0000),Access(E3) 2 | bg2.bin=Type(06),AuxType(0000),Access(E3) -------------------------------------------------------------------------------- /demos/kfest-2022/demo-8/gen/bg1.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/demos/kfest-2022/demo-8/gen/bg1.bin -------------------------------------------------------------------------------- /demos/kfest-2022/demo-8/gen/bg2.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/demos/kfest-2022/demo-8/gen/bg2.bin -------------------------------------------------------------------------------- /demos/kfest-2022/demo-8/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "kfest-demo-8", 3 | "version": "1.0.0", 4 | "description": "Single pixel BG scrolling", 5 | "main": "index.js", 6 | "config": { 7 | "merlin32": "C:\\Programs\\IIgsXDev\\bin\\Merlin32-1.1.10.exe", 8 | "cadius": "C:\\Programs\\IIgsXDev\\bin\\Cadius.exe", 9 | "gsport": "C:\\Programs\\gsport\\gsport_0.31\\GSPort.exe", 10 | "macros": "../../../macros", 11 | "crossrunner": "C:\\Programs\\Crossrunner\\Crossrunner.exe", 12 | "png2iigs": "../../../tools/png2iigs.js", 13 | "tiled2iigs": "../../../tools/tiled2iigs.js" 14 | }, 15 | "scripts": { 16 | "test": "npm run build && npm run build:image && npm run gsport", 17 | "gsport": "%npm_package_config_gsport%", 18 | "debug": "%npm_package_config_crossrunner% GTEDemo4 -Source GTEDemo4_S02_MAINSEG_Output.txt -Debug -CompatibilityLayer", 19 | "build:all": "npm run build:tiles && npm run build:map && npm run build:tool && npm run build:sys16 && npm run build:image", 20 | "build:map": "node %npm_package_config_tiled2iigs% ./assets/tiled/yoshi-1.json --force-masked --no-gen-tiles --output-dir ./gen", 21 | "build:tiles": "node %npm_package_config_png2iigs% ./assets/tilesets/smw-256x128-4bpp.png --max-tiles 360 --as-tile-data --verbose --transparent-color FF00FF --background-color 216058 > ./gen/App.TileSet.s", 22 | "build:tiles:blocky": "node %npm_package_config_png2iigs% ./assets/tilesets/smw-256x128-4bpp.png --max-tiles 360 --as-tile-data --verbose --force-word-alignment --transparent-color FF00FF --background-color 216058 > ./gen/App.TileSet.s", 23 | "build:sys16": "%npm_package_config_merlin32% -V %npm_package_config_macros% App.s", 24 | "build": "npm run build:tool && npm run build:sys16", 25 | "build:tool": "%npm_package_config_merlin32% -V %npm_package_config_macros% ../../../src/Master.s", 26 | "build:image": "build-image.bat %npm_package_config_cadius%", 27 | "build:background": "npm run build:background:1 && npm run build:background:2", 28 | "build:background:1": "node %npm_package_config_png2iigs% ./assets/tilesets/bg1.png ./gen/bg1.bin --force-color-match --palette FF00FF,C14F4A,020202,00E100,C89858,216058,DCE9EE,008000,F80080,F5D56C,20308F,A0CDCC,4080A0,70B0D0", 29 | "build:background:2": "node %npm_package_config_png2iigs% ./assets/tilesets/bg2.png ./gen/bg2.bin --force-color-match --palette FF00FF,C14F4A,020202,00E100,C89858,216058,DCE9EE,008000,F80080,F5D56C,20308F,A0CDCC,4080A0,70B0D0" 30 | }, 31 | "repository": { 32 | "type": "git", 33 | "url": "git+https://github.com/lscharen/iigs-game-engine.git" 34 | }, 35 | "author": "Lucas Scharenbroich", 36 | "license": "Apache-2.0", 37 | "bugs": { 38 | "url": "https://github.com/lscharen/iigs-game-engine/issues" 39 | }, 40 | "homepage": "https://github.com/lscharen/iigs-game-engine#readme", 41 | "devDependencies": { 42 | "pngjs": "^6.0.0", 43 | "string-builder": "^0.1.8", 44 | "watch": "latest", 45 | "xml2json": "^0.12.0" 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /demos/kfest-2022/demo-9/.gitignore: -------------------------------------------------------------------------------- 1 | GTEDemo9 -------------------------------------------------------------------------------- /demos/kfest-2022/demo-9/App.s: -------------------------------------------------------------------------------- 1 | ; KFest 2022: Demo #9 2 | 3 | TYP $B3 ; S16 file 4 | DSK GTEDemo9 5 | XPL 6 | 7 | ; Segment #1 -- Main execution block 8 | 9 | ASM App.Main.s 10 | SNA Main 11 | 12 | ; Segment #2 -- Tileset 13 | 14 | ASM gen\App.TileSet.s 15 | SNA TSET -------------------------------------------------------------------------------- /demos/kfest-2022/demo-9/_FileInformation.txt: -------------------------------------------------------------------------------- 1 | GTEDemo4=Type(B3),AuxType(0000),VersionCreate(70),MinVersion(BE),Access(E3),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000) 2 | GTEDemo9=Type(B3),AuxType(0000),VersionCreate(70),MinVersion(BE),Access(E3),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000) 3 | -------------------------------------------------------------------------------- /demos/kfest-2022/demo-9/assets/tiled/smw-256x128-4bpp.tsx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /demos/kfest-2022/demo-9/assets/tilesets/bg1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/demos/kfest-2022/demo-9/assets/tilesets/bg1.png -------------------------------------------------------------------------------- /demos/kfest-2022/demo-9/assets/tilesets/full.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/demos/kfest-2022/demo-9/assets/tilesets/full.png -------------------------------------------------------------------------------- /demos/kfest-2022/demo-9/assets/tilesets/smw-256x128-4bpp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/demos/kfest-2022/demo-9/assets/tilesets/smw-256x128-4bpp.png -------------------------------------------------------------------------------- /demos/kfest-2022/demo-9/build-image.bat: -------------------------------------------------------------------------------- 1 | echo off 2 | 3 | REM Copy all of the assets into the ProDOS image for emulator testing 4 | REM 5 | REM Pass the path of the Cadius tool as the first argument (%1) 6 | 7 | set CADIUS="%1" 8 | set IMAGE="..\\..\\..\\emu\\Target.2mg" 9 | set FOLDER="/GTEDEV/KFestDemo09" 10 | 11 | REM Cadius does not overwrite files, so clear the root folder first 12 | %CADIUS% DELETEFOLDER %IMAGE% %FOLDER% 13 | %CADIUS% CREATEFOLDER %IMAGE% %FOLDER% 14 | 15 | REM Now copy files and folders as needed 16 | %CADIUS% ADDFILE %IMAGE% %FOLDER% .\GTEDemo9 17 | %CADIUS% ADDFILE %IMAGE% %FOLDER% .\gen\bg1.bin 18 | %CADIUS% ADDFILE %IMAGE% %FOLDER% ..\..\..\src\Tool160 19 | -------------------------------------------------------------------------------- /demos/kfest-2022/demo-9/gen/_FileInformation.txt: -------------------------------------------------------------------------------- 1 | bg1.bin=Type(06),AuxType(0000),Access(E3) -------------------------------------------------------------------------------- /demos/kfest-2022/demo-9/gen/bg1.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/demos/kfest-2022/demo-9/gen/bg1.bin -------------------------------------------------------------------------------- /demos/kfest-2022/demo-9/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "kfest-demo-4", 3 | "version": "1.0.0", 4 | "description": "Two Layer scrolling with BG1 scanline offsets and sprite", 5 | "main": "index.js", 6 | "config": { 7 | "merlin32": "C:\\Programs\\IIgsXDev\\bin\\Merlin32-1.1.10.exe", 8 | "cadius": "C:\\Programs\\IIgsXDev\\bin\\Cadius.exe", 9 | "gsport": "C:\\Programs\\gsport\\gsport_0.31\\GSPort.exe", 10 | "macros": "../../../macros", 11 | "crossrunner": "C:\\Programs\\Crossrunner\\Crossrunner.exe", 12 | "png2iigs": "../../../tools/png2iigs.js", 13 | "tiled2iigs": "../../../tools/tiled2iigs.js" 14 | }, 15 | "scripts": { 16 | "test": "npm run build && npm run build:image && npm run gsport", 17 | "gsport": "cross-var $npm_package_config_gsport", 18 | "debug": "cross-var $npm_package_config_crossrunner GTEDemo4 -Source GTEDemo4_S02_MAINSEG_Output.txt -Debug -CompatibilityLayer", 19 | "build:all": "npm run build:tiles && npm run build:map && npm run build:tool && npm run build:sys16 && npm run build:image", 20 | "build:map": "cross-var node $npm_package_config_tiled2iigs ./assets/tiled/yoshi-1.json --force-masked --no-gen-tiles --output-dir ./gen", 21 | "build:tiles": "cross-var node $npm_package_config_png2iigs ./assets/tilesets/smw-256x128-4bpp.png --max-tiles 360 --as-tile-data --verbose --transparent-color FF00FF --background-color 216058 > ./gen/App.TileSet.s", 22 | "build:tiles:blocky": "cross-var node $npm_package_config_png2iigs ./assets/tilesets/smw-256x128-4bpp.png --max-tiles 360 --as-tile-data --verbose --force-word-alignment --transparent-color FF00FF --background-color 216058 > ./gen/App.TileSet.s", 23 | "build:sys16": "cross-var $npm_package_config_merlin32 -V $npm_package_config_macros App.s", 24 | "build": "npm run build:tool && npm run build:sys16", 25 | "build:tool": "cross-var $npm_package_config_merlin32 -V $npm_package_config_macros ../../../src/Master.s", 26 | "build:image": "cross-var build-image.bat $npm_package_config_cadius", 27 | "build:background": "cross-var node $npm_package_config_png2iigs ./assets/tilesets/bg1.png ./gen/bg1.bin --force-color-match --palette FF00FF,C14F4A,020202,00E100,C89858,216058,DCE9EE,008000,F80080,F5D56C,20308F,A0CDCC,4080A0,70B0D0" 28 | }, 29 | "repository": { 30 | "type": "git", 31 | "url": "git+https://github.com/lscharen/iigs-game-engine.git" 32 | }, 33 | "author": "Lucas Scharenbroich", 34 | "license": "Apache-2.0", 35 | "bugs": { 36 | "url": "https://github.com/lscharen/iigs-game-engine/issues" 37 | }, 38 | "homepage": "https://github.com/lscharen/iigs-game-engine#readme", 39 | "devDependencies": { 40 | "cross-var": "^1.1.0", 41 | "pngjs": "^6.0.0", 42 | "string-builder": "^0.1.8", 43 | "watch": "latest", 44 | "xml2json": "^0.12.0" 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /demos/pacman/App.s: -------------------------------------------------------------------------------- 1 | ; IIgs Shooter 2 | 3 | TYP $B3 ; S16 file 4 | DSK GTEShooter 5 | XPL 6 | 7 | ; Segment #1 -- Main execution block 8 | 9 | ASM Main.s 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /demos/pacman/Main.s: -------------------------------------------------------------------------------- 1 | REL 2 | DSK MAINSEG 3 | 4 | rtl 5 | 6 | -------------------------------------------------------------------------------- /demos/pacman/README.md: -------------------------------------------------------------------------------- 1 | Experimental implementation of a dynamically scaline Pac-Man playfield 2 | that fits the IIgs native screen size. -------------------------------------------------------------------------------- /demos/pacman/_FileInformation.txt: -------------------------------------------------------------------------------- 1 | GTEPacMan=Type(B3),AuxType(0000),VersionCreate(70),MinVersion(BE),Access(E3),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000) -------------------------------------------------------------------------------- /demos/pacman/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "pac-man-demo", 3 | "version": "1.0.0", 4 | "description": "A few ways of displaying a Pac-Man style playfield using GTE", 5 | "main": "index.js", 6 | "config": { 7 | "merlin32": "C:\\Programs\\IIgsXDev\\bin\\Merlin32-1.1.10.exe", 8 | "cadius": "C:\\Programs\\IIgsXDev\\bin\\Cadius.exe", 9 | "gsport": "C:\\Programs\\gsport\\gsport_0.31\\GSPort.exe", 10 | "macros": "C:\\Programs\\BrutalDeluxe\\Merlin32\\Library", 11 | "crossrunner": "C:\\Programs\\Crossrunner\\Crossrunner.exe" 12 | }, 13 | "scripts": { 14 | "build": "%npm_package_config_merlin32% -V %npm_package_config_macros% App.s" 15 | }, 16 | "repository": { 17 | "type": "git", 18 | "url": "git+https://github.com/lscharen/iigs-game-engine.git" 19 | }, 20 | "author": "Lucas Scharenbroich", 21 | "license": "Apache-2.0", 22 | "bugs": { 23 | "url": "https://github.com/lscharen/iigs-game-engine/issues" 24 | }, 25 | "homepage": "https://github.com/lscharen/iigs-game-engine#readme", 26 | "devDependencies": { 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /demos/shell/.gitignore: -------------------------------------------------------------------------------- 1 | GTETestApp -------------------------------------------------------------------------------- /demos/shell/App.Msg.s: -------------------------------------------------------------------------------- 1 | HexToChar dfb '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F' 2 | 3 | ; Convert a byte (Acc) into a string and store at (Y) 4 | ByteToString and #$00FF 5 | sep #$20 6 | pha 7 | lsr 8 | lsr 9 | lsr 10 | lsr 11 | and #$0F 12 | tax 13 | ldal HexToChar,x 14 | sta: $0000,y 15 | 16 | pla 17 | and #$0F 18 | tax 19 | ldal HexToChar,x 20 | sta: $0001,y 21 | 22 | rep #$20 23 | rts 24 | 25 | ; Convert a word (Acc) into a hexadecimal string and store at (Y) 26 | WordToString pha 27 | bra Addr2ToString 28 | 29 | ; Pass in Acc = High, X = low 30 | Addr3ToString phx 31 | jsr ByteToString 32 | iny 33 | iny 34 | lda 1,s 35 | Addr2ToString xba 36 | jsr ByteToString 37 | iny 38 | iny 39 | pla 40 | jsr ByteToString 41 | rts 42 | 43 | ; A=Value 44 | ; X=Screen offset 45 | DrawWord phx ; Save register value 46 | phy 47 | ldy #WordBuff+1 48 | jsr WordToString 49 | ply 50 | plx 51 | lda #WordBuff 52 | jsr DrawString 53 | rts 54 | 55 | ; Render out the bank addresses of all the blitter fields 56 | DumpBanks 57 | 58 | :addr = 1 59 | :count = 3 60 | :ptr = 5 61 | 62 | pea #^BlitBuff ; pointer to address table 63 | pea #BlitBuff 64 | pea #13 ; count = 13 65 | pea $0000 ; addr = 0 66 | 67 | tsc 68 | phd ; save the direct page 69 | tcd ; set the direct page 70 | 71 | :loop lda [:ptr] 72 | tax 73 | ldy #2 74 | lda [:ptr],y 75 | 76 | ldy #Addr3Buff+1 77 | jsr Addr3ToString 78 | 79 | lda #Addr3Buff 80 | ldx :addr 81 | ldy #$7777 82 | jsr DrawString 83 | 84 | lda :addr 85 | clc 86 | adc #160*8 87 | sta :addr 88 | 89 | lda #4 90 | adc :ptr 91 | sta :ptr 92 | 93 | dec :count 94 | bne :loop 95 | 96 | pld ; restore the direct page 97 | tsc ; restore the stack pointer 98 | clc 99 | adc #8 100 | tcs 101 | rts 102 | 103 | WordBuff str '0000' 104 | Addr3Buff str '000000' ; str adds leading length byte 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | -------------------------------------------------------------------------------- /demos/shell/App.s: -------------------------------------------------------------------------------- 1 | ; IIgs Game Engine 2 | 3 | TYP $B3 ; S16 file 4 | DSK GTETestApp 5 | XPL 6 | 7 | ; Segment #1 -- Main execution block 8 | 9 | ASM App.Main.s 10 | SNA Main 11 | 12 | ; Segment #2 -- Tileset 13 | 14 | ASM gen\App.TileSet.s 15 | SNA TSET -------------------------------------------------------------------------------- /demos/shell/_FileInformation.txt: -------------------------------------------------------------------------------- 1 | GTETestApp=Type(B3),AuxType(0000),VersionCreate(70),MinVersion(BE),Access(E3),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000) 2 | -------------------------------------------------------------------------------- /demos/shell/assets/armada-7-color-shift.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/demos/shell/assets/armada-7-color-shift.png -------------------------------------------------------------------------------- /demos/shell/assets/armada-7-color-shuffle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/demos/shell/assets/armada-7-color-shuffle.png -------------------------------------------------------------------------------- /demos/shell/assets/armada-7-color.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/demos/shell/assets/armada-7-color.png -------------------------------------------------------------------------------- /demos/shell/assets/armada.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/demos/shell/assets/armada.png -------------------------------------------------------------------------------- /demos/shell/assets/assets.tiled-project: -------------------------------------------------------------------------------- 1 | { 2 | "automappingRulesFile": "", 3 | "commands": [ 4 | ], 5 | "extensionsPath": "extensions", 6 | "folders": [ 7 | "tiled" 8 | ], 9 | "objectTypesFile": "" 10 | } 11 | -------------------------------------------------------------------------------- /demos/shell/assets/donut-plains-1-6-color.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/demos/shell/assets/donut-plains-1-6-color.png -------------------------------------------------------------------------------- /demos/shell/assets/donut-plains-1png.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/demos/shell/assets/donut-plains-1png.png -------------------------------------------------------------------------------- /demos/shell/assets/donut-plains-2-8-color-shift.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/demos/shell/assets/donut-plains-2-8-color-shift.png -------------------------------------------------------------------------------- /demos/shell/assets/donut-plains-2-8-color.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/demos/shell/assets/donut-plains-2-8-color.png -------------------------------------------------------------------------------- /demos/shell/assets/donut-plains-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/demos/shell/assets/donut-plains-2.png -------------------------------------------------------------------------------- /demos/shell/assets/fatdog-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/demos/shell/assets/fatdog-1.png -------------------------------------------------------------------------------- /demos/shell/assets/fatdog-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/demos/shell/assets/fatdog-2.png -------------------------------------------------------------------------------- /demos/shell/assets/gba-cloud-bgnd-8-color.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/demos/shell/assets/gba-cloud-bgnd-8-color.png -------------------------------------------------------------------------------- /demos/shell/assets/gba-cloud-bgnd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/demos/shell/assets/gba-cloud-bgnd.png -------------------------------------------------------------------------------- /demos/shell/assets/mario-face-2-color.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/demos/shell/assets/mario-face-2-color.png -------------------------------------------------------------------------------- /demos/shell/assets/mario-face.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/demos/shell/assets/mario-face.png -------------------------------------------------------------------------------- /demos/shell/assets/music/_FileInformation.txt: -------------------------------------------------------------------------------- 1 | main.ntp=Type(D5),AuxType(0008),Access(E3) 2 | CONRAD.NTP=Type(D5),AuxType(0008),VersionCreate(05),MinVersion(00),Access(E3),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000) 3 | -------------------------------------------------------------------------------- /demos/shell/assets/music/main-nfc.ntp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/demos/shell/assets/music/main-nfc.ntp -------------------------------------------------------------------------------- /demos/shell/assets/music/main.ntp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/demos/shell/assets/music/main.ntp -------------------------------------------------------------------------------- /demos/shell/assets/plant.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/demos/shell/assets/plant.png -------------------------------------------------------------------------------- /demos/shell/assets/rotopattern.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/demos/shell/assets/rotopattern.png -------------------------------------------------------------------------------- /demos/shell/assets/smb-2bit-328x208-shift.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/demos/shell/assets/smb-2bit-328x208-shift.png -------------------------------------------------------------------------------- /demos/shell/assets/smb-2bit-328x208.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/demos/shell/assets/smb-2bit-328x208.png -------------------------------------------------------------------------------- /demos/shell/assets/smb-2bit-512x223.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/demos/shell/assets/smb-2bit-512x223.png -------------------------------------------------------------------------------- /demos/shell/assets/smw-bg-1-bw.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/demos/shell/assets/smw-bg-1-bw.png -------------------------------------------------------------------------------- /demos/shell/assets/smw-bg-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/demos/shell/assets/smw-bg-1.png -------------------------------------------------------------------------------- /demos/shell/assets/tiled/Overworld.tsx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /demos/shell/assets/tilesets/smb-256-128-1bpp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/demos/shell/assets/tilesets/smb-256-128-1bpp.png -------------------------------------------------------------------------------- /demos/shell/assets/tilesets/smb-256-128-4bpp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/demos/shell/assets/tilesets/smb-256-128-4bpp.png -------------------------------------------------------------------------------- /demos/shell/assets/woz-pixelated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/demos/shell/assets/woz-pixelated.png -------------------------------------------------------------------------------- /demos/shell/assets/woz-shifted.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/demos/shell/assets/woz-shifted.png -------------------------------------------------------------------------------- /demos/shell/assets/woz.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/demos/shell/assets/woz.png -------------------------------------------------------------------------------- /demos/shell/assets/woz2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/demos/shell/assets/woz2.png -------------------------------------------------------------------------------- /demos/shell/build-image.bat: -------------------------------------------------------------------------------- 1 | echo off 2 | 3 | REM Copy all of the assets into the ProDOS image for emulator testing 4 | REM 5 | REM Pass the path of the Cadius tool as the first argument (%1) 6 | 7 | set CADIUS="%1" 8 | set IMAGE="..\\..\\emu\\Target.2mg" 9 | set FOLDER="/GTEDEV/Build" 10 | 11 | REM Cadius does not overwrite files, so clear the root folder first 12 | %CADIUS% DELETEFOLDER %IMAGE% %FOLDER% 13 | %CADIUS% CREATEFOLDER %IMAGE% %FOLDER% 14 | 15 | REM Now copy files and folders as needed 16 | %CADIUS% ADDFILE %IMAGE% %FOLDER% .\GTETestApp 17 | %CADIUS% ADDFILE %IMAGE% %FOLDER% gen\test.pic 18 | %CADIUS% ADDFILE %IMAGE% %FOLDER% gen\bg1a.bin 19 | %CADIUS% ADDFILE %IMAGE% %FOLDER% gen\bg1b.bin 20 | %CADIUS% ADDFILE %IMAGE% %FOLDER% gen\fg1.bin 21 | %CADIUS% ADDFILE %IMAGE% %FOLDER% assets\music\main.ntp 22 | -------------------------------------------------------------------------------- /demos/shell/gen/App.TileSetAnim.s: -------------------------------------------------------------------------------- 1 | 2 | TileAnimInit ENT 3 | 4 | ldx #169 5 | ldy #0 6 | jsl CopyTileToDyn 7 | ldx #170 8 | ldy #1 9 | jsl CopyTileToDyn 10 | ldx #209 11 | ldy #2 12 | jsl CopyTileToDyn 13 | ldx #210 14 | ldy #3 15 | jsl CopyTileToDyn 16 | lda #TileAnim_168 17 | ldx #^TileAnim_168 18 | ldy #15 19 | jsl StartScript 20 | lda #TileAnim_169 21 | ldx #^TileAnim_169 22 | ldy #15 23 | jsl StartScript 24 | lda #TileAnim_208 25 | ldx #^TileAnim_208 26 | ldy #15 27 | jsl StartScript 28 | lda #TileAnim_209 29 | ldx #^TileAnim_209 30 | ldy #15 31 | jsl StartScript 32 | rts 33 | TileAnim_168 34 | dw $8006,169,0,0 35 | dw $8006,171,0,0 36 | dw $8006,173,0,0 37 | dw $cd06,175,0,0 38 | TileAnim_169 39 | dw $8006,170,1,0 40 | dw $8006,172,1,0 41 | dw $8006,174,1,0 42 | dw $cd06,176,1,0 43 | TileAnim_208 44 | dw $8006,209,2,0 45 | dw $8006,211,2,0 46 | dw $8006,213,2,0 47 | dw $cd06,215,2,0 48 | TileAnim_209 49 | dw $8006,210,3,0 50 | dw $8006,212,3,0 51 | dw $8006,214,3,0 52 | dw $cd06,216,3,0 -------------------------------------------------------------------------------- /demos/shell/gen/_FileInformation.txt: -------------------------------------------------------------------------------- 1 | bg1a.bin=Type(06),Access(E3) 2 | bg1b.bin=Type(06),Access(E3) 3 | fg1.bin=Type(06),Access(E3) 4 | test.pic=Type(C0),Access(E3) -------------------------------------------------------------------------------- /demos/shell/gen/bg1a.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/demos/shell/gen/bg1a.bin -------------------------------------------------------------------------------- /demos/shell/gen/bg1b.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/demos/shell/gen/bg1b.bin -------------------------------------------------------------------------------- /demos/shell/gen/test.pic: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/demos/shell/gen/test.pic -------------------------------------------------------------------------------- /demos/shell/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "iigs-game-engine", 3 | "version": "1.0.0", 4 | "description": "A game engine for the Applie IIgs written in 65816 assembly language", 5 | "main": "index.js", 6 | "config": { 7 | "merlin32": "C:\\Programs\\IIgsXDev\\bin\\Merlin32-1.1.10.exe", 8 | "cadius": "C:\\Programs\\IIgsXDev\\bin\\Cadius.exe", 9 | "gsport": "C:\\Programs\\gsport\\gsport_0.31\\GSPort.exe", 10 | "macros": "../../macros", 11 | "crossrunner": "C:\\Programs\\Crossrunner\\Crossrunner.exe", 12 | "png2iigs": "../../tools/png2iigs.js", 13 | "tiled2iigs": "../../tools/tiled2iigs.js" 14 | }, 15 | "scripts": { 16 | "test": "npm run build && build-image.bat %npm_package_config_cadius% && %npm_package_config_gsport%", 17 | "debug": "%npm_package_config_crossrunner% GTETestApp -Source GTETestApp_S02_MAINSEG_Output.txt -Debug -CompatibilityLayer", 18 | "build": "%npm_package_config_merlin32% -V %npm_package_config_macros% App.s", 19 | "build:watch": "watch \"npm run build\" src", 20 | "build:assets-smw": "node %npm_package_config_png2iigs% ./assets/donut-plains-2-8-color.png ./emu/bg1a.bin --start-index 6 && node %npm_package_config_png2iigs% ./assets/donut-plains-2-8-color-shift.png ./emu/bg1b.bin --start-index 6 && node %npm_package_config_png2iigs% ./assets/donut-plains-1-6-color.png ./emu/fg1.bin", 21 | "build:assets-fatdog": "node %npm_package_config_png2iigs% ./assets/armada-7-color.png ./emu/bg1a.bin --start-index 8 && node %npm_package_config_png2iigs% ./assets/armada-7-color-shift.png ./emu/bg1b.bin --start-index 8 && node %npm_package_config_png2iigs% ./assets/armada-7-color-shuffle.png ./emu/fg1.bin --start-index 1", 22 | "build:assets-plant": "node %npm_package_config_png2iigs% ./assets/plant.png ./emu/bg1a.bin --start-index 6 && node %npm_package_config_png2iigs% ./assets/woz-shifted.png ./emu/bg1b.bin --start-index 6 && node %npm_package_config_png2iigs% ./assets/donut-plains-1-6-color.png ./emu/fg1.bin", 23 | "build:assets-woz": "node %npm_package_config_png2iigs% ./assets/woz.png ./emu/bg1a.bin --start-index 6 && node %npm_package_config_png2iigs% ./assets/woz-shifted.png ./emu/bg1b.bin --start-index 6 && node %npm_package_config_png2iigs% ./assets/donut-plains-1-6-color.png ./emu/fg1.bin", 24 | "build:assets-woz-fatbits": "node %npm_package_config_png2iigs% ./assets/woz-pixelated.png ./emu/bg1a.bin --start-index 6 && node %npm_package_config_png2iigs% ./assets/woz-shifted.png ./emu/bg1b.bin --start-index 6 && node %npm_package_config_png2iigs% ./assets/donut-plains-1-6-color.png ./emu/fg1.bin", 25 | "build:assets-color-cycle": "node %npm_package_config_png2iigs% ./assets/rotopattern.png ./emu/bg1a.bin --start-index 6 && node %npm_package_config_png2iigs% ./assets/woz-shifted.png ./emu/bg1b.bin --start-index 6 && node %npm_package_config_png2iigs% ./assets/donut-plains-1-6-color.png ./emu/fg1.bin", 26 | "build:map": "node %npm_package_config_tiled2iigs% ./assets/tiled/world_1-1.json --output-dir ./gen", 27 | "build:tiles": "node %npm_package_config_png2iigs% ./assets/tilesets/smb-16.png --max-tiles 360 --as-tile-data --transparent-color-index 11 > ./gen/App.TileSet.s" 28 | }, 29 | "repository": { 30 | "type": "git", 31 | "url": "git+https://github.com/lscharen/iigs-game-engine.git" 32 | }, 33 | "author": "Lucas Scharenbroich", 34 | "license": "Apache-2.0", 35 | "bugs": { 36 | "url": "https://github.com/lscharen/iigs-game-engine/issues" 37 | }, 38 | "homepage": "https://github.com/lscharen/iigs-game-engine#readme", 39 | "devDependencies": { 40 | "pngjs": "^6.0.0", 41 | "string-builder": "^0.1.8", 42 | "xml2json": "^0.12.0" 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /demos/smb/.gitignore: -------------------------------------------------------------------------------- 1 | GTETestApp -------------------------------------------------------------------------------- /demos/smb/App.s: -------------------------------------------------------------------------------- 1 | ; IIgs Game Engine 2 | 3 | TYP $B3 ; S16 file 4 | DSK SuperMarioGS 5 | XPL 6 | 7 | ; Segment #1 -- Main execution block 8 | 9 | ASM Main.s 10 | KND #$1100 11 | SNA MAIN 12 | 13 | ; Segment #2 -- ROM 14 | 15 | ASM rom.s 16 | KND #$1100 17 | SNA SMBROM 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /demos/smb/Externals.s: -------------------------------------------------------------------------------- 1 | SMBStart EXT ; Base address of the ROM. Should be XX/8000 in the bank the ROM is loaded into -------------------------------------------------------------------------------- /demos/smb/Main.s: -------------------------------------------------------------------------------- 1 | REL 2 | 3 | use Locator.Macs 4 | use Load.Macs 5 | use Mem.Macs 6 | use Misc.Macs 7 | use Util.Macs 8 | use EDS.GSOS.Macs 9 | use GTE.Macs 10 | use Externals.s 11 | 12 | mx %00 13 | 14 | ; Direct page space 15 | MyUserId equ 0 16 | 17 | phk 18 | plb 19 | sta MyUserId ; GS/OS passes the memory manager user ID for the application into the program 20 | 21 | _MTStartUp ; GTE requires the miscellaneous toolset to be running 22 | 23 | pea $00A0 ; Load from System:Tools 24 | pea $0100 ; Tool160, version 1.0 25 | _LoadOneTool 26 | 27 | clc ; Give GTE a page of direct page memory 28 | tdc 29 | adc #$0100 30 | pha 31 | pea $0000 ; Default fast mode 32 | lda MyUserId ; Pass the userId for memory allocation 33 | pha 34 | _GTEStartUp 35 | 36 | ; Initialize the graphics screen playfield (256x160). The NES is 240 lines high, so 160 37 | ; is a reasonable compromise. 38 | 39 | pea #160 40 | pea #200 41 | _GTESetScreenMode 42 | 43 | ; Convert the CHR ROM from the cart into GTE tiles 44 | 45 | ; jsr LoadTilesFromROM 46 | 47 | 48 | _GTEShutDown 49 | _QuitGS qtRec 50 | qtRec adrl $0000 51 | da $00 -------------------------------------------------------------------------------- /demos/smb/_FileInformation.txt: -------------------------------------------------------------------------------- 1 | SuperMarioGS=Type(B3),AuxType(0000),VersionCreate(70),MinVersion(BE),Access(E3),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000) 2 | -------------------------------------------------------------------------------- /demos/smb/build-image.bat: -------------------------------------------------------------------------------- 1 | echo off 2 | 3 | REM Copy all of the assets into the ProDOS image for emulator testing 4 | REM 5 | REM Pass the path of the Cadius tool as the first argument (%1) 6 | 7 | set CADIUS="%1" 8 | set IMAGE="..\\..\\emu\\Target.2mg" 9 | set FOLDER="/GTEDEV/SMB" 10 | 11 | REM Cadius does not overwrite files, so clear the root folder first 12 | %CADIUS% DELETEFOLDER %IMAGE% %FOLDER% 13 | %CADIUS% CREATEFOLDER %IMAGE% %FOLDER% 14 | 15 | REM Now copy files and folders as needed 16 | %CADIUS% ADDFILE %IMAGE% %FOLDER% .\SuperMarioGS 17 | -------------------------------------------------------------------------------- /demos/smb/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "super-mario-bros-nes-demo", 3 | "version": "1.0.0", 4 | "description": "Wrapping the SMB 6502 ROM in GTE", 5 | "main": "index.js", 6 | "config": { 7 | "merlin32": "C:\\Programs\\IIgsXDev\\bin\\Merlin32-1.1.10.exe", 8 | "cadius": "C:\\Programs\\IIgsXDev\\bin\\Cadius.exe", 9 | "gsport": "C:\\Programs\\gsport\\gsport_0.31\\GSPort.exe", 10 | "macros": "../../macros", 11 | "crossrunner": "C:\\Programs\\Crossrunner\\Crossrunner.exe" 12 | }, 13 | "scripts": { 14 | "test": "npm run build && npm run build:image && npm run gsport", 15 | "gsport": "%npm_package_config_gsport%", 16 | "build": "%npm_package_config_merlin32% -V %npm_package_config_macros% App.s", 17 | "build:image": "build-image.bat %npm_package_config_cadius%" 18 | }, 19 | "repository": { 20 | "type": "git", 21 | "url": "git+https://github.com/lscharen/iigs-game-engine.git" 22 | }, 23 | "author": "Lucas Scharenbroich", 24 | "license": "Apache-2.0", 25 | "bugs": { 26 | "url": "https://github.com/lscharen/iigs-game-engine/issues" 27 | }, 28 | "homepage": "https://github.com/lscharen/iigs-game-engine#readme", 29 | "devDependencies": { 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /demos/smb/wrapper.s: -------------------------------------------------------------------------------- 1 | ; Wrapper around the SMB ROM code. This takes care of setting any memory locations 2 | ; in the SMB ROM address space that interact with the system (like controller inputs). 3 | ; 4 | ; We also shim many of the LDA/STA instruction that modify the NES I/O to be 5 | ; JSRs to small subroutines that enqueue any changes that are handled once 6 | ; control returns. The queues are important, because we try to run the game 7 | ; logic at 60 fps, but the screen will update significantly slower than that. 8 | ; 9 | ; By queuing the changes, we can "catch up" to the game logic and prioritize 10 | ; audio output at 60 fps since audio stutter is much more disruptive that slow 11 | ; FPS. 12 | 13 | -------------------------------------------------------------------------------- /demos/sprites/.gitignore: -------------------------------------------------------------------------------- 1 | GTETestSprites -------------------------------------------------------------------------------- /demos/sprites/App.s: -------------------------------------------------------------------------------- 1 | ; IIgs Sprite Testbed 2 | 3 | TYP $B3 ; S16 file 4 | DSK GTETestSprites 5 | XPL 6 | 7 | ; Segment #1 -- Main execution block 8 | 9 | ASM App.Main.s 10 | SNA Main 11 | 12 | ; Segment #2 -- Tileset 13 | 14 | ASM gen\App.TileSet.s 15 | SNA TSET -------------------------------------------------------------------------------- /demos/sprites/README.md: -------------------------------------------------------------------------------- 1 | = Sprite Demos 2 | 3 | A project to work on the initial sprite implementation and exercise different sprite modes. -------------------------------------------------------------------------------- /demos/sprites/SprData.s: -------------------------------------------------------------------------------- 1 | spritedata ENT 2 | ds 65536 -------------------------------------------------------------------------------- /demos/sprites/SprMask.s: -------------------------------------------------------------------------------- 1 | spritemask ENT 2 | ds 65536 -------------------------------------------------------------------------------- /demos/sprites/_FileInformation.txt: -------------------------------------------------------------------------------- 1 | GTEZelda=Type(B3),AuxType(0000),VersionCreate(70),MinVersion(BE),Access(E3),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000) 2 | GTETestSprites=Type(B3),AuxType(0000),VersionCreate(70),MinVersion(BE),Access(E3),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000) 3 | -------------------------------------------------------------------------------- /demos/sprites/assets/_FileInformation.txt: -------------------------------------------------------------------------------- 1 | mario1.c1=Type(C1),AuxType(0000),VersionCreate(70),MinVersion(BE),Access(E3),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000) 2 | octane.c1=Type(C1),AuxType(0000),VersionCreate(70),MinVersion(BE),Access(E3),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000) 3 | pix.forest.c1=Type(C1),AuxType(0000),VersionCreate(70),MinVersion(BE),Access(E3),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000) 4 | sunset.c1=Type(C1),AuxType(0000),VersionCreate(70),MinVersion(BE),Access(E3),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000) 5 | -------------------------------------------------------------------------------- /demos/sprites/assets/mario1.c1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/demos/sprites/assets/mario1.c1 -------------------------------------------------------------------------------- /demos/sprites/assets/octane.c1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/demos/sprites/assets/octane.c1 -------------------------------------------------------------------------------- /demos/sprites/assets/pix.forest.c1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/demos/sprites/assets/pix.forest.c1 -------------------------------------------------------------------------------- /demos/sprites/assets/sunset.c1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/demos/sprites/assets/sunset.c1 -------------------------------------------------------------------------------- /demos/sprites/assets/tiled/Overworld.tsx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /demos/sprites/build-image.bat: -------------------------------------------------------------------------------- 1 | echo off 2 | 3 | REM Copy all of the assets into the ProDOS image for emulator testing 4 | REM 5 | REM Pass the path of the Cadius tool as the first argument (%1) 6 | 7 | set CADIUS="%1" 8 | set IMAGE="..\\..\\emu\\Target.2mg" 9 | set FOLDER="/GTEDEV/Sprites" 10 | 11 | REM Cadius does not overwrite files, so clear the root folder first 12 | %CADIUS% DELETEFOLDER %IMAGE% %FOLDER% 13 | %CADIUS% CREATEFOLDER %IMAGE% %FOLDER% 14 | 15 | REM Now copy files and folders as needed 16 | %CADIUS% ADDFILE %IMAGE% %FOLDER% .\GTETestSprites 17 | %CADIUS% ADDFILE %IMAGE% %FOLDER% ..\..\src\Tool160 18 | 19 | REM Copy in the image assets 20 | %CADIUS% ADDFILE %IMAGE% %FOLDER% .\assets\mario1.c1 21 | %CADIUS% ADDFILE %IMAGE% %FOLDER% .\assets\octane.c1 22 | %CADIUS% ADDFILE %IMAGE% %FOLDER% .\assets\pix.forest.c1 23 | %CADIUS% ADDFILE %IMAGE% %FOLDER% .\assets\sunset.c1 24 | -------------------------------------------------------------------------------- /demos/sprites/gen/App.TileSetAnim.s: -------------------------------------------------------------------------------- 1 | 2 | TileAnimInit 3 | pea #137 4 | pea #0 5 | _GTECopyTileToDynamic 6 | pea #138 7 | pea #1 8 | _GTECopyTileToDynamic 9 | pea #169 10 | pea #2 11 | _GTECopyTileToDynamic 12 | pea #170 13 | pea #3 14 | _GTECopyTileToDynamic 15 | 16 | pea #15 17 | pea #^TileAnim 18 | pea #TileAnim 19 | _GTEStartScript 20 | rts 21 | TileAnim 22 | dw $0006,137,0,0 23 | dw $0006,138,1,0 24 | dw $0006,169,2,0 25 | dw $8006,170,3,0 26 | 27 | dw $0006,139,0,0 28 | dw $0006,140,1,0 29 | dw $0006,171,2,0 30 | dw $8006,172,3,0 31 | 32 | dw $0006,141,0,0 33 | dw $0006,142,1,0 34 | dw $0006,173,2,0 35 | dw $8006,174,3,0 36 | 37 | dw $0006,143,0,0 38 | dw $0006,144,1,0 39 | dw $0006,175,2,0 40 | dw $cc46,176,3,0 ; STOP; JUMP(-15) -15 = $31 (6 bit) = %110001 = 1100 0100 = C4 41 | -------------------------------------------------------------------------------- /demos/sprites/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "iigs-sprite-demo", 3 | "version": "1.0.0", 4 | "description": "A testbed for sprite development", 5 | "main": "index.js", 6 | "config": { 7 | "merlin32": "C:\\Programs\\IIgsXDev\\bin\\Merlin32-1.1.10.exe", 8 | "cadius": "C:\\Programs\\IIgsXDev\\bin\\Cadius.exe", 9 | "gsport": "C:\\Programs\\gsport\\gsport_0.31\\GSPort.exe", 10 | "macros": "../../macros", 11 | "crossrunner": "C:\\Programs\\Crossrunner\\Crossrunner.exe", 12 | "png2iigs": "../../tools/png2iigs.js", 13 | "tiled2iigs": "../../tools/tiled2iigs.js" 14 | }, 15 | "scripts": { 16 | "test": "npm run build && build-image.bat %npm_package_config_cadius% && %npm_package_config_gsport%", 17 | "debug": "%npm_package_config_crossrunner% GTETestSprites -Source GTETestSprites_S02_MAINSEG_Output.txt -Debug -CompatibilityLayer", 18 | "build:sys16": "%npm_package_config_merlin32% -V %npm_package_config_macros% App.s", 19 | "build:map": "node %npm_package_config_tiled2iigs% ./assets/tiled/world_1-1.json --output-dir ./gen", 20 | "build:map:masked": "node %npm_package_config_tiled2iigs% ./assets/tiled/world_1-1.json --force-masked --empty-tile 33 --no-gen-tiles --output-dir ./gen", 21 | "build:tiles": "node %npm_package_config_png2iigs% ../shell/assets/tilesets/smb-256-128-4bpp.png --max-tiles 360 --as-tile-data --transparent-color FF00FF --background-color 6B8CFF > ./gen/App.TileSet.s", 22 | "build:tiles:1bpp": "node %npm_package_config_png2iigs% ../shell/assets/tilesets/smb-256-128-1bpp.png --max-tiles 360 --as-tile-data --transparent-color FF00FF --palette 010102,00000,000000,000000,000000,000000,000000,000000,000000,000000,000000,000000,000000,000000,000000,FDFEFE > ./gen/App.TileSet.s", 23 | "build": "npm run build:tool && npm run build:sys16", 24 | "build:tool": "%npm_package_config_merlin32% -V %npm_package_config_macros% ../../src/Master.s" 25 | }, 26 | "repository": { 27 | "type": "git", 28 | "url": "git+https://github.com/lscharen/iigs-game-engine.git" 29 | }, 30 | "author": "Lucas Scharenbroich", 31 | "license": "Apache-2.0", 32 | "bugs": { 33 | "url": "https://github.com/lscharen/iigs-game-engine/issues" 34 | }, 35 | "homepage": "https://github.com/lscharen/iigs-game-engine#readme", 36 | "devDependencies": { 37 | "pngjs": "^6.0.0", 38 | "string-builder": "^0.1.8", 39 | "watch": "latest", 40 | "xml2json": "^0.12.0" 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /demos/tf4/.gitignore: -------------------------------------------------------------------------------- 1 | GTETF4 -------------------------------------------------------------------------------- /demos/tf4/App.Main.s: -------------------------------------------------------------------------------- 1 | ; Test driver to exercise graphics routines. 2 | 3 | REL 4 | DSK MAINSEG 5 | 6 | use Locator.Macs 7 | use Load.Macs 8 | use Mem.Macs 9 | use Misc.Macs 10 | use Util.Macs 11 | use EDS.GSOS.Macs 12 | use GTE.Macs 13 | 14 | mx %00 15 | 16 | tiledata EXT ; tileset buffer 17 | ;TileSetPalette EXT 18 | 19 | ; Keycodes 20 | LEFT_ARROW equ $08 21 | RIGHT_ARROW equ $15 22 | UP_ARROW equ $0B 23 | DOWN_ARROW equ $0A 24 | 25 | ; Direct page space 26 | MyUserId equ 0 27 | BankLoad equ 2 28 | StartX equ 4 29 | StartY equ 6 30 | TileMapWidth equ 8 31 | TileMapHeight equ 10 32 | ScreenWidth equ 12 33 | ScreenHeight equ 14 34 | MaxGlobalX equ 16 35 | MaxGlobalY equ 18 36 | MaxBG0X equ 20 37 | MaxBG0Y equ 22 38 | OldOneSecondCounter equ 26 39 | appTmp0 equ 28 40 | appTmp1 equ 30 41 | appTmp2 equ 32 42 | 43 | phk 44 | plb 45 | 46 | sta MyUserId ; GS/OS passes the memory manager user ID for the application into the program 47 | tdc 48 | sta MyDirectPage ; Keep a copy for the overlay callback 49 | 50 | _MTStartUp ; GTE requires the miscellaneous toolset to be running 51 | 52 | lda #ENGINE_MODE_USER_TOOL+ENGINE_MODE_TWO_LAYER 53 | jsr GTEStartUp ; Load and install the GTE User Tool 54 | 55 | pea $0000 ; Set the first two tiles 56 | pea $0002 57 | pea #^TileData 58 | pea #TileData 59 | _GTELoadTileSet 60 | 61 | pea $0000 62 | pea #^TileSetPalette 63 | pea #TileSetPalette 64 | _GTESetPalette 65 | 66 | ; Fill in the field with a checkboard pattern 67 | 68 | stz appTmp1 69 | 70 | :tloop0 stz appTmp0 71 | :tloop1 lda appTmp0 ; X 72 | pha 73 | pei appTmp1 ; Y 74 | eor appTmp1 75 | and #$0001 76 | pha ; tile ID 77 | _GTESetTile 78 | 79 | inc appTmp0 80 | lda #40 81 | cmp appTmp0 82 | bcs :tloop1 83 | 84 | inc appTmp1 85 | lda #25 86 | cmp appTmp1 87 | bcs :tloop0 88 | 89 | ; Set up a very specific test. First, we draw a sprite into the sprite plane, and then 90 | ; leave it alone. We are just testing the ability to merge sprite plane data into 91 | ; the play field tiles. 92 | EvtLoop 93 | pha 94 | _GTEReadControl 95 | pla 96 | 97 | jsr HandleKeys ; Do the generic key handlers 98 | 99 | pea #RENDER_PER_SCANLINE ; Scanline rendering 100 | ; pea $0000 101 | _GTERender 102 | 103 | brl EvtLoop 104 | 105 | ; Exit code 106 | Exit 107 | _GTEShutDown 108 | Quit 109 | _QuitGS qtRec 110 | 111 | bcs Fatal 112 | Fatal brk $00 113 | 114 | qtRec adrl $0000 115 | da $00 116 | 117 | ; Color palette 118 | TileSetPalette dw $0000,$0FFF,$0FFF,$0FFF,$0FFF,$0FFF,$0FFF,$0FFF,$0FFF,$0FFF,$0FFF,$0FFF,$0FFF,$0FFF,$0FFF,$0FFF 119 | 120 | MyDirectPage ds 2 121 | 122 | ; Stub 123 | SetLimits rts 124 | 125 | PUT ../kfest-2022/StartUp.s 126 | PUT Tiles.s 127 | -------------------------------------------------------------------------------- /demos/tf4/App.s: -------------------------------------------------------------------------------- 1 | ; Thunder Force IV Demo 2 | 3 | TYP $B3 ; S16 file 4 | DSK GTETF4 5 | XPL 6 | 7 | ; Segment #1 -- Main execution block 8 | 9 | ASM App.Main.s 10 | SNA Main 11 | -------------------------------------------------------------------------------- /demos/tf4/GTETF4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/demos/tf4/GTETF4 -------------------------------------------------------------------------------- /demos/tf4/README.txt: -------------------------------------------------------------------------------- 1 | Thunder Force IV scanline demo 2 | - q to quit; arrows to scroll, numbers to select screen size 3 | - make sure Overlay is present -------------------------------------------------------------------------------- /demos/tf4/Tiles.s: -------------------------------------------------------------------------------- 1 | 2 | TileData 3 | ; Reserved space (tile 0 is special... 4 | ds 128 5 | ; Tile ID 1 6 | ; From image coordinates 0, 0 7 | hex ffffffff 8 | hex ffffffff 9 | hex ffffffff 10 | hex ffffffff 11 | hex ffffffff 12 | hex ffffffff 13 | hex ffffffff 14 | hex ffffffff 15 | 16 | hex 00000000 17 | hex 00000000 18 | hex 00000000 19 | hex 00000000 20 | hex 00000000 21 | hex 00000000 22 | hex 00000000 23 | hex 00000000 24 | 25 | hex ffffffff 26 | hex ffffffff 27 | hex ffffffff 28 | hex ffffffff 29 | hex ffffffff 30 | hex ffffffff 31 | hex ffffffff 32 | hex ffffffff 33 | 34 | hex 00000000 35 | hex 00000000 36 | hex 00000000 37 | hex 00000000 38 | hex 00000000 39 | hex 00000000 40 | hex 00000000 41 | hex 00000000 -------------------------------------------------------------------------------- /demos/tf4/_FileInformation.txt: -------------------------------------------------------------------------------- 1 | GTETF4=Type(B3),AuxType(0000),VersionCreate(70),MinVersion(BE),Access(E3),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000) 2 | -------------------------------------------------------------------------------- /demos/tf4/assets/tiled/Overworld.tsx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /demos/tf4/assets/tilesets/smb-256-128-4bpp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/demos/tf4/assets/tilesets/smb-256-128-4bpp.png -------------------------------------------------------------------------------- /demos/tf4/build-image.bat: -------------------------------------------------------------------------------- 1 | echo off 2 | 3 | REM Copy all of the assets into the ProDOS image for emulator testing 4 | REM 5 | REM Pass the path of the Cadius tool as the first argument (%1) 6 | 7 | set CADIUS="%1" 8 | set IMAGE="..\\..\\emu\\Target.2mg" 9 | set FOLDER="/GTEDEV/TF4" 10 | 11 | REM Cadius does not overwrite files, so clear the root folder first 12 | %CADIUS% DELETEFOLDER %IMAGE% %FOLDER% 13 | %CADIUS% CREATEFOLDER %IMAGE% %FOLDER% 14 | 15 | REM Now copy files and folders as needed 16 | %CADIUS% ADDFILE %IMAGE% %FOLDER% .\GTETF4 17 | %CADIUS% ADDFILE %IMAGE% %FOLDER% ..\..\src\Tool160 18 | -------------------------------------------------------------------------------- /demos/tf4/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "tf4-demo", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "config": { 7 | "merlin32": "C:\\Programs\\IIgsXDev\\bin\\Merlin32-1.1.10.exe", 8 | "cadius": "C:\\Programs\\IIgsXDev\\bin\\Cadius.exe", 9 | "gsport": "C:\\Programs\\gsport\\gsport_0.31\\GSPort.exe", 10 | "macros": "../../macros", 11 | "crossrunner": "C:\\Programs\\Crossrunner\\Crossrunner.exe", 12 | "png2iigs": "../../tools/png2iigs.js", 13 | "tiled2iigs": "../../tools/tiled2iigs.js" 14 | }, 15 | "scripts": { 16 | "test": "npm run build && npm run build:image && npm run gsport", 17 | "gsport": "%npm_package_config_gsport%", 18 | "debug": "%npm_package_config_crossrunner% GTETestSprites -Source GTETestSprites_S02_MAINSEG_Output.txt -Debug -CompatibilityLayer", 19 | "build:all": "npm run build:tiles && npm run build:map && npm run build:tool && npm run build:sys16 && npm run build:image", 20 | "build:map": "node %npm_package_config_tiled2iigs% ./assets/tiled/world_1-1.json --empty-tile 33 --no-gen-tiles --output-dir ./gen", 21 | "build:map:masked": "node %npm_package_config_tiled2iigs% ./assets/tiled/world_1-1.json --force-masked --empty-tile 33 --no-gen-tiles --output-dir ./gen", 22 | "build:tiles": "node %npm_package_config_png2iigs% ./assets/tilesets/smb-256-128-4bpp.png --max-tiles 360 --as-tile-data --transparent-color FF00FF --background-color 6B8CFF --verbose > ./gen/App.TileSet.s", 23 | "build:sys16": "%npm_package_config_merlin32% -V %npm_package_config_macros% App.s", 24 | "build": "npm run build:tool && npm run build:sys16", 25 | "build:tool": "%npm_package_config_merlin32% -V %npm_package_config_macros% ../../src/Master.s", 26 | "build:image": "build-image.bat %npm_package_config_cadius%" 27 | }, 28 | "repository": { 29 | "type": "git", 30 | "url": "git+https://github.com/lscharen/iigs-game-engine.git" 31 | }, 32 | "author": "Lucas Scharenbroich", 33 | "license": "Apache-2.0", 34 | "bugs": { 35 | "url": "https://github.com/lscharen/iigs-game-engine/issues" 36 | }, 37 | "homepage": "https://github.com/lscharen/iigs-game-engine#readme", 38 | "devDependencies": { 39 | "pngjs": "^6.0.0", 40 | "string-builder": "^0.1.8", 41 | "watch": "latest", 42 | "xml2json": "^0.12.0" 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /demos/tool/.gitignore: -------------------------------------------------------------------------------- 1 | GTEToolDemo -------------------------------------------------------------------------------- /demos/tool/App.Msg.s: -------------------------------------------------------------------------------- 1 | HexToChar dfb '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F' 2 | 3 | ; Convert a byte (Acc) into a string and store at (Y) 4 | ByteToString and #$00FF 5 | sep #$20 6 | pha 7 | lsr 8 | lsr 9 | lsr 10 | lsr 11 | and #$0F 12 | tax 13 | ldal HexToChar,x 14 | sta: $0000,y 15 | 16 | pla 17 | and #$0F 18 | tax 19 | ldal HexToChar,x 20 | sta: $0001,y 21 | 22 | rep #$20 23 | rts 24 | 25 | ; Convert a word (Acc) into a hexadecimal string and store at (Y) 26 | WordToString pha 27 | bra Addr2ToString 28 | 29 | ; Pass in Acc = High, X = low 30 | Addr3ToString phx 31 | jsr ByteToString 32 | iny 33 | iny 34 | lda 1,s 35 | Addr2ToString xba 36 | jsr ByteToString 37 | iny 38 | iny 39 | pla 40 | jsr ByteToString 41 | rts 42 | 43 | ; A=Value 44 | ; X=Screen offset 45 | DrawWord phx ; Save register value 46 | phy 47 | ldy #WordBuff+1 48 | jsr WordToString 49 | ply 50 | plx 51 | lda #WordBuff 52 | jsr DrawString 53 | rts 54 | 55 | WordBuff str '0000' 56 | Addr3Buff str '000000' ; str adds leading length byte 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | -------------------------------------------------------------------------------- /demos/tool/App.s: -------------------------------------------------------------------------------- 1 | ; IIgs Sprite Testbed 2 | 3 | TYP $B3 ; S16 file 4 | DSK GTEToolDemo 5 | XPL 6 | 7 | ; Segment #1 -- Main execution block 8 | 9 | ASM App.Main.s 10 | SNA Main 11 | 12 | ; Segment #2 -- Tileset 13 | 14 | ASM Zelda.TileSet.s 15 | SNA TSET 16 | -------------------------------------------------------------------------------- /demos/tool/_FileInformation.txt: -------------------------------------------------------------------------------- 1 | GTEToolDemo=Type(B3),AuxType(0000),VersionCreate(70),MinVersion(BE),Access(E3),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000) 2 | -------------------------------------------------------------------------------- /demos/tool/build-image.bat: -------------------------------------------------------------------------------- 1 | echo off 2 | 3 | REM Copy all of the assets into the ProDOS image for emulator testing 4 | REM 5 | REM Pass the path of the Cadius tool as the first argument (%1) 6 | 7 | set CADIUS="%1" 8 | set IMAGE="..\\..\\emu\\Target.2mg" 9 | set FOLDER="/GTEDEV/Tool" 10 | 11 | REM Cadius does not overwrite files, so clear the root folder first 12 | %CADIUS% DELETEFOLDER %IMAGE% %FOLDER% 13 | %CADIUS% CREATEFOLDER %IMAGE% %FOLDER% 14 | 15 | REM Now copy files and folders as needed 16 | %CADIUS% ADDFILE %IMAGE% %FOLDER% .\GTEToolDemo 17 | %CADIUS% ADDFILE %IMAGE% %FOLDER% ..\..\src\Tool160 18 | 19 | REM Copy in the image assets 20 | -------------------------------------------------------------------------------- /demos/tool/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "gte-toolbox-demo", 3 | "version": "1.0.0", 4 | "description": "A testbed for developing a toolbox wrapper around the GTE library", 5 | "main": "index.js", 6 | "config": { 7 | "merlin32": "C:\\Programs\\IIgsXDev\\bin\\Merlin32-1.1.10.exe", 8 | "cadius": "C:\\Programs\\IIgsXDev\\bin\\Cadius.exe", 9 | "gsport": "C:\\Programs\\gsport\\gsport_0.31\\GSPort.exe", 10 | "macros": "../../macros", 11 | "crossrunner": "C:\\Programs\\Crossrunner\\Crossrunner.exe" 12 | }, 13 | "scripts": { 14 | "test": "npm run build && build-image.bat %npm_package_config_cadius% && %npm_package_config_gsport%", 15 | "debug": "%npm_package_config_crossrunner% GTEToolDemo -Source MAINSEG_Output.txt -Debug -CompatibilityLayer -Map App.s", 16 | "build": "npm run build:tool && npm run build:sys16", 17 | "build:sys16": "%npm_package_config_merlin32% -V %npm_package_config_macros% App.s", 18 | "build:tool": "%npm_package_config_merlin32% -V %npm_package_config_macros% ../../src/Master.s" 19 | }, 20 | "repository": { 21 | "type": "git", 22 | "url": "git+https://github.com/lscharen/iigs-game-engine.git" 23 | }, 24 | "author": "Lucas Scharenbroich", 25 | "license": "Apache-2.0", 26 | "bugs": { 27 | "url": "https://github.com/lscharen/iigs-game-engine/issues" 28 | }, 29 | "homepage": "https://github.com/lscharen/iigs-game-engine#readme", 30 | "devDependencies": { 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /demos/zelda/.gitignore: -------------------------------------------------------------------------------- 1 | GTEZelda -------------------------------------------------------------------------------- /demos/zelda/App.s: -------------------------------------------------------------------------------- 1 | ; IIgs Sprite Testbed 2 | 3 | TYP $B3 ; S16 file 4 | DSK GTEZelda 5 | XPL 6 | 7 | ; Segment #1 -- Main execution block 8 | 9 | ASM App.Main.s 10 | SNA Main 11 | 12 | ; Segment #2 -- Tileset 13 | 14 | ASM gen\App.TileSet.s 15 | SNA TSET -------------------------------------------------------------------------------- /demos/zelda/README.md: -------------------------------------------------------------------------------- 1 | A demo the exercises the dirty update capabilities of GTE to provide very fast updates 2 | for non-scrolling play fields. 3 | 4 | Also, the ability to seamless switch between dirty and scrolling updates to perform screen 5 | transitions and the ability to specify a split screen to keep the inventory/status area fixed 6 | at the top and the scrolling play field at the bottom. 7 | 8 | The active playfield in zelda is 256x176 -------------------------------------------------------------------------------- /demos/zelda/SprData.s: -------------------------------------------------------------------------------- 1 | spritedata ENT 2 | ds 65536 -------------------------------------------------------------------------------- /demos/zelda/SprMask.s: -------------------------------------------------------------------------------- 1 | spritemask ENT 2 | ds 65536 -------------------------------------------------------------------------------- /demos/zelda/TileStore.s: -------------------------------------------------------------------------------- 1 | TileStore ENT 2 | ds 65536 -------------------------------------------------------------------------------- /demos/zelda/_FileInformation.txt: -------------------------------------------------------------------------------- 1 | GTETestSprites=Type(B3),AuxType(0000),VersionCreate(70),MinVersion(BE),Access(E3),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000) 2 | GTEZelda=Type(B3),AuxType(0000),VersionCreate(70),MinVersion(BE),Access(E3),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000) 3 | -------------------------------------------------------------------------------- /demos/zelda/assets/Zelda.tsx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /demos/zelda/assets/sprites-256x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/demos/zelda/assets/sprites-256x128.png -------------------------------------------------------------------------------- /demos/zelda/build-image.bat: -------------------------------------------------------------------------------- 1 | echo off 2 | 3 | REM Copy all of the assets into the ProDOS image for emulator testing 4 | REM 5 | REM Pass the path of the Cadius tool as the first argument (%1) 6 | 7 | set CADIUS="%1" 8 | set IMAGE="..\\..\\emu\\Target.2mg" 9 | set FOLDER="/GTEDEV/Zelda" 10 | 11 | REM Cadius does not overwrite files, so clear the root folder first 12 | %CADIUS% DELETEFOLDER %IMAGE% %FOLDER% 13 | %CADIUS% CREATEFOLDER %IMAGE% %FOLDER% 14 | 15 | REM Now copy files and folders as needed 16 | %CADIUS% ADDFILE %IMAGE% %FOLDER% .\GTEZelda 17 | %CADIUS% ADDFILE %IMAGE% %FOLDER% ..\..\src\Tool160 18 | 19 | REM Copy in the image assets 20 | -------------------------------------------------------------------------------- /demos/zelda/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "iigs-zelda-demo", 3 | "version": "1.0.0", 4 | "description": "A testbed for dirty rectangle rendering", 5 | "main": "index.js", 6 | "config": { 7 | "merlin32": "C:\\Programs\\IIgsXDev\\bin\\Merlin32-1.1.10.exe", 8 | "cadius": "C:\\Programs\\IIgsXDev\\bin\\Cadius.exe", 9 | "gsport": "C:\\Programs\\gsport\\gsport_0.31\\GSPort.exe", 10 | "macros": "../../macros", 11 | "crossrunner": "C:\\Programs\\Crossrunner\\Crossrunner.exe", 12 | "png2iigs": "../../tools/png2iigs.js", 13 | "tiled2iigs": "../../tools/tiled2iigs.js" 14 | }, 15 | "scripts": { 16 | "test": "npm run build && build-image.bat %npm_package_config_cadius% && %npm_package_config_gsport%", 17 | "debug": "%npm_package_config_crossrunner% GTEZelda -Source GTEZelda_S02_MAINSEG_Output.txt -Debug -CompatibilityLayer", 18 | "build:sys16": "%npm_package_config_merlin32% -V %npm_package_config_macros% App.s", 19 | "build:map": "node %npm_package_config_tiled2iigs% ./assets/overworld.json --no-gen-tiles --output-dir ./gen", 20 | "build:tiles": "node %npm_package_config_png2iigs% ./assets/sprites-256x128.png --max-tiles 256 --as-tile-data --transparent-color FF00FF > ./gen/App.TileSet.s", 21 | "build": "npm run build:tool && npm run build:sys16", 22 | "build:tool": "%npm_package_config_merlin32% -V %npm_package_config_macros% ../../src/Master.s" 23 | }, 24 | "repository": { 25 | "type": "git", 26 | "url": "git+https://github.com/lscharen/iigs-game-engine.git" 27 | }, 28 | "author": "Lucas Scharenbroich", 29 | "license": "Apache-2.0", 30 | "bugs": { 31 | "url": "https://github.com/lscharen/iigs-game-engine/issues" 32 | }, 33 | "homepage": "https://github.com/lscharen/iigs-game-engine#readme", 34 | "devDependencies": { 35 | "pngjs": "^6.0.0", 36 | "string-builder": "^0.1.8", 37 | "watch": "latest", 38 | "xml2json": "^0.12.0" 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /docs/.gitignore: -------------------------------------------------------------------------------- 1 | _site 2 | .sass-cache 3 | .jekyll-cache 4 | .jekyll-metadata 5 | vendor 6 | -------------------------------------------------------------------------------- /docs/404.html: -------------------------------------------------------------------------------- 1 | --- 2 | permalink: /404.html 3 | layout: default 4 | --- 5 | 6 | 19 | 20 |
21 |

404

22 | 23 |

Page not found :(

24 |

The requested page could not be found.

25 |
26 | -------------------------------------------------------------------------------- /docs/Gemfile: -------------------------------------------------------------------------------- 1 | source "https://rubygems.org" 2 | # Hello! This is where you manage which Jekyll version is used to run. 3 | # When you want to use a different version, change it below, save the 4 | # file and run `bundle install`. Run Jekyll with `bundle exec`, like so: 5 | # 6 | # bundle exec jekyll serve 7 | # 8 | # This will help ensure the proper Jekyll version is running. 9 | # Happy Jekylling! 10 | #gem "jekyll", "~> 4.3.2" 11 | gem "github-pages", "~> 223", group: :jekyll_plugins 12 | # This is the default theme for new Jekyll sites. You may change this to anything you like. 13 | gem "minima", "~> 2.5" 14 | 15 | # If you want to use GitHub Pages, remove the "gem "jekyll"" above and 16 | # uncomment the line below. To upgrade, run `bundle update github-pages`. 17 | # gem "github-pages", group: :jekyll_plugins 18 | # If you have any plugins, put them here! 19 | group :jekyll_plugins do 20 | gem "jekyll-feed", "~> 0.12" 21 | end 22 | 23 | # Windows and JRuby does not include zoneinfo files, so bundle the tzinfo-data gem 24 | # and associated library. 25 | platforms :mingw, :x64_mingw, :mswin, :jruby do 26 | gem "tzinfo", "~> 1.2" 27 | gem "tzinfo-data" 28 | end 29 | 30 | # Performance-booster for watching directories on Windows 31 | gem "wdm", "~> 0.1.1", :platforms => [:mingw, :x64_mingw, :mswin] 32 | 33 | # Lock `http_parser.rb` gem to `v0.6.x` on JRuby builds since newer versions of the gem 34 | # do not have a Java counterpart. 35 | gem "http_parser.rb", "~> 0.6.0", :platforms => [:jruby] 36 | -------------------------------------------------------------------------------- /docs/_config.yml: -------------------------------------------------------------------------------- 1 | # Welcome to Jekyll! 2 | # 3 | # This config file is meant for settings that affect your whole blog, values 4 | # which you are expected to set up once and rarely edit after that. If you find 5 | # yourself editing this file very often, consider using Jekyll's data files 6 | # feature for the data you need to update frequently. 7 | # 8 | # For technical reasons, this file is *NOT* reloaded automatically when you use 9 | # 'bundle exec jekyll serve'. If you change this file, please restart the server process. 10 | # 11 | # If you need help with YAML syntax, here are some quick references for you: 12 | # https://learn-the-web.algonquindesign.ca/topics/markdown-yaml-cheat-sheet/#yaml 13 | # https://learnxinyminutes.com/docs/yaml/ 14 | # 15 | # Site settings 16 | # These are used to personalize your new site. If you look in the HTML files, 17 | # you will see them accessed via {{ site.title }}, {{ site.email }}, and so on. 18 | # You can create any custom variable you would like, and they will be accessible 19 | # in the templates via {{ site.myvariable }}. 20 | 21 | title: Generic Tile Engine for the Apple IIgs 22 | email: lscharen@gmail.com 23 | description: >- # this means to ignore newlines until "baseurl:" 24 | A high-performance library for writing tile-based games for the Apple IIgs personal computer in 65816 assembly langugage. Unlock the full, 16-bit potential of the last machine of the Apple ][ line. 25 | baseurl: "/iigs-game-engine" # the subpath of your site, e.g. /blog 26 | url: "https://lscharen.github.io" # the base hostname & protocol for your site, e.g. http://example.com 27 | 28 | twitter_username: ljscharen 29 | github_username: lscharen 30 | 31 | # Build settings 32 | theme: minima 33 | #plugins: 34 | # - jekyll-feed 35 | 36 | markdown: kramdown 37 | highlighter: rogue 38 | input: GFM 39 | 40 | # Exclude from processing. 41 | # The following items will not be processed, by default. 42 | # Any item listed under the `exclude:` key here will be automatically added to 43 | # the internal "default list". 44 | # 45 | # Excluded items can be processed by explicitly listing the directories or 46 | # their entries' file path in the `include:` list. 47 | # 48 | # exclude: 49 | # - .sass-cache/ 50 | # - .jekyll-cache/ 51 | # - gemfiles/ 52 | # - Gemfile 53 | # - Gemfile.lock 54 | # - node_modules/ 55 | # - vendor/bundle/ 56 | # - vendor/cache/ 57 | # - vendor/gems/ 58 | # - vendor/ruby/ 59 | -------------------------------------------------------------------------------- /docs/about.markdown: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | title: About 4 | --- 5 | 6 | This is the main documentation page for the Generic Tile Engine project for the Apple IIgs. 7 | -------------------------------------------------------------------------------- /docs/getting_started.markdown: -------------------------------------------------------------------------------- 1 | --- 2 | permalink: /getting-started 3 | layout: page 4 | --- 5 | 6 | # Getting Started 7 | * Set Up 8 | * Windows 9 | * Linux 10 | * Native 11 | 12 | This tutorial page will walk through the process of setting up your computer to build Apple IIgs applications 13 | that leverage the GTE toolset. 14 | ## Set Up 15 | 16 | ### Windows 17 | 18 | ### Linux 19 | 20 | ### Native 21 | 22 | If you are developing directly on an Apple IIgs machine, dowload the GTE-1.0.shk archive into your GS/OS environment. There 23 | are several ways of getting the file onto your system. 24 | 25 | 1. Use the [NetDisk](https://sheumann.github.io/NetDisk/) utility to mount to the remote disk image directly from GS/OS and copy the Tool160 file 26 | 1. Use [ADTPro](https://adtpro.com/index.html) to transfer the disk image to the apple IIgs and write it onto a physical floppy disk 27 | 28 | ## Installing GTE 29 | 30 | Copy the `Tool160` file into the `System:Tools` folder of your GS/OS boot volume. It is also possible to load the toolset from the application's folder (or any file system location), which will be covered later. 31 | 32 | ## Your First Program 33 | 34 | ```c 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | 41 | /* create two solid tiles */ 42 | extern Byte tiles[] = { STATIC_TILE(0x00), STATIC_TILE(0xFF) }; 43 | 44 | /* define a couple of key codes for the arrow keys */ 45 | #define LEFT_ARROW 0x08 46 | #define RIGHT_ARROW 0x15 47 | #define UP_ARROW 0x0B 48 | #define DOWN_ARROW 0x0A 49 | 50 | Word userId; 51 | Handle dpHandle; 52 | 53 | void startUp(void) { 54 | TLStartUp(); 55 | userId = MMStartUp(); 56 | MTStartUp(); 57 | 58 | LoadOneTool(160, 0x0100); 59 | dpHandle = NewHandle(0x200L, userId, attrBank + attrPage + attrFixed + attrLocked + attrNoCross, 0); 60 | GTEStartUp((Word) *dpHandle, (Word) 0, userId); 61 | } 62 | 63 | void shutDown(void) { 64 | GTEShutDown(); 65 | DisposeHandle(dpHandle); 66 | UnloadOneTool(160); 67 | MTShutDown(); 68 | MMShutDown(userId); 69 | TLShutDown(); 70 | } 71 | 72 | void main(void) { 73 | Word keyPress; 74 | int x, y; 75 | 76 | /* Start up GTE and its dependencies */ 77 | startUp(); 78 | 79 | /* Create a 256x160 playfield (128 bytes x 160 lines) */ 80 | GTESetScreenMode(128, 160); 81 | 82 | /* Load in two tiles */ 83 | GTELoadTileSet(0, 2, tiles); 84 | 85 | /* Fill the tile store with a checkerboard pattern */ 86 | for (y = 0; y < GTE_TILE_STORE_HEIGHT; y++) { 87 | for (x = 0; x < GTE_TILE_STORE_WIDTH; x++) { 88 | GTESetTile(x, y, (x + y) & 1); 89 | } 90 | } 91 | 92 | /* Enter into the main loop */ 93 | x = y = 0; 94 | do { 95 | keyPress = GTEReadControl() & PAD_KEY_CODE; 96 | 97 | if (keyPress == LEFT_ARROW && x > 0) x--; 98 | if (keyPress == RIGHT_ARROW && x < 1000) x++; 99 | if (keyPress == UP_ARROW && y > 0) y--; 100 | if (keyPress == DOWN_ARROW && y < 1000) y++; 101 | 102 | /* Position the screen and render */ 103 | GTESetBG0Origin(x, y); 104 | GTERender(0); 105 | } 106 | while (keyPress != 'Q' && keyPress != 'q'); 107 | 108 | shutDown(); 109 | } 110 | ``` -------------------------------------------------------------------------------- /docs/index.markdown: -------------------------------------------------------------------------------- 1 | --- 2 | # Feel free to add content and custom Front Matter to this file. 3 | # To modify the layout, see https://jekyllrb.com/docs/themes/#overriding-theme-defaults 4 | 5 | layout: home 6 | --- 7 | 8 | * [Getting Started]({{ site.baseurl }}/getting-started.html) 9 | -------------------------------------------------------------------------------- /docs/live.markdown: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | --- 4 | 5 | 17 | -------------------------------------------------------------------------------- /docs/samples/basic_c_sample.markdown: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | style: sample 4 | --- 5 | 6 | ```c 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | #include "gte.h" 14 | #include "demo_data.h" 15 | 16 | #define TOOLFAIL(string) if (toolerror()) SysFailMgr(toolerror(), "\p" string "\n\r Error Code -> $"); 17 | 18 | #define SPRITE_START_TILE 2 19 | #define SPRITE_SLOT 0 20 | #define SPRITE_VBUFF (GTE_VBUFF_SPRITE_START+0*GTE_VBUFF_SPRITE_STEP) 21 | 22 | int main (void) { 23 | Word controlMask; 24 | Word keyPress; 25 | Word userId; 26 | Handle dpHndl; 27 | Word dpWord; 28 | Word x = 0, y = 0; 29 | Word px = 0, py = 0; 30 | Word sec; 31 | 32 | TLStartUp(); 33 | TOOLFAIL("Unable to start tool locator"); 34 | 35 | userId = MMStartUp(); 36 | TOOLFAIL("Unable to start memory manager"); 37 | 38 | MTStartUp(); 39 | TOOLFAIL("Unable to start misc tools"); 40 | 41 | LoadGTEToolSet(userId); 42 | 43 | dpHndl = NewHandle(0x0200, userId, 0x4015, 0); 44 | if (dpHndl == NULL) { 45 | TOOLFAIL("Unable to allocate page 0 memory"); 46 | } 47 | dpWord = (Word)(*dpHndl); 48 | if ((dpWord & 0x00FF) != 0x0000) { 49 | TOOLFAIL("Allocated page 0 memory is not aligned"); 50 | } 51 | 52 | GTEStartUp(dpWord, 0x0000, userId); 53 | TOOLFAIL("Unable to start GTE"); 54 | 55 | GTESetScreenMode(160, 200); 56 | GTELoadTileSet(tiles); 57 | GTESetPalette(0, (Pointer)palette); 58 | GTEFillTileStore(1); 59 | 60 | GTECreateSpriteStamp(GTE_SPRITE_8X8 | SPRITE_START_TILE, SPRITE_VBUFF); 61 | GTEAddSprite(SPRITE_SLOT, 0, SPRITE_VBUFF, px, py); 62 | 63 | do { 64 | controlMask = GTEReadControl(); 65 | keyPress = controlMask & 0x007F; 66 | 67 | switch (keyPress) { 68 | case ' ': // Toggle background 69 | sec = GTEGetSeconds(); 70 | GTEFillTileStore(1 + (sec & 1)); 71 | break; 72 | 73 | case 'a': if (x > 0) { x--; } 74 | break; 75 | 76 | case 'd': if (x < 1000) { x++; } 77 | break; 78 | 79 | case 'w': if (y > 0) { y--; } 80 | break; 81 | 82 | case 's': if (y < 1000) { y++; } 83 | break; 84 | 85 | 86 | case 'j': if (px > 0) { px--; } 87 | break; 88 | 89 | case 'l': if (px < 154) { px++; } 90 | break; 91 | 92 | case 'i': if (py > 0) { py--; } 93 | break; 94 | 95 | case 'k': if (py < 192) { py++; } 96 | break; 97 | } 98 | 99 | GTESetBG0Origin(x, y); 100 | GTEMoveSprite(SPRITE_SLOT, px, py); 101 | GTERender(0); 102 | 103 | } while (keyPress != 'q' && keyPress != 'Q'); 104 | 105 | GTEShutDown(); 106 | 107 | DisposeHandle(dpHndl); 108 | 109 | MTShutDown(); 110 | TOOLFAIL("Unable to shutdown misc tool"); 111 | 112 | MMShutDown(userId); 113 | TOOLFAIL("Unable to shutdown memory manager"); 114 | 115 | TLShutDown(); 116 | TOOLFAIL("Unable to shutdown tool locator"); 117 | } 118 | ``` -------------------------------------------------------------------------------- /docs/tutorials.markdown: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | title: Examples 4 | --- 5 | 6 | -------------------------------------------------------------------------------- /emu/Target.2mg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/emu/Target.2mg -------------------------------------------------------------------------------- /emu/_FileInformation.txt: -------------------------------------------------------------------------------- 1 | bg1a.bin=Type(06),Access(E3) 2 | bg1b.bin=Type(06),Access(E3) 3 | fg1.bin=Type(06),Access(E3) -------------------------------------------------------------------------------- /macros/Load.Macs.s: -------------------------------------------------------------------------------- 1 | * Load Manager macros 2 | * by Dave Klimas 3 | ; 4 | ; Copyright Apple Computer, Inc. 1986, 1987 5 | ; and Roger Wagner Publishing, Inc. 1988 6 | ; All Rights Reserved 7 | ; 8 | _LoaderInitialization MAC 9 | Tool $111 10 | <<< 11 | _LoaderStartUp MAC 12 | Tool $211 13 | <<< 14 | _LoaderShutDown MAC 15 | Tool $311 16 | <<< 17 | ~LoaderVersion MAC 18 | PHA 19 | _LoaderVersion MAC 20 | Tool $411 21 | <<< 22 | _LoaderReset MAC 23 | Tool $511 24 | <<< 25 | ~LoaderStatus MAC 26 | PHA 27 | _LoaderStatus MAC 28 | Tool $611 29 | <<< 30 | ~InitialLoad MAC 31 | PHS 5 32 | PHWL ]1;]2 33 | PHW ]3 34 | _InitialLoad MAC 35 | Tool $911 36 | <<< 37 | ~InitialLoad2 MAC 38 | PHS 5 39 | PHWL ]1;]2 40 | PxW ]3;]4 41 | _InitialLoad2 MAC 42 | Tool $2011 43 | <<< 44 | ~Restart MAC 45 | PHS 5 46 | PHW ]1 47 | _Restart MAC 48 | Tool $A11 49 | <<< 50 | ~LoadSegNum MAC 51 | PHS 2 52 | PxW ]1;]2;]3 53 | _LoadSegNum MAC 54 | Tool $B11 55 | <<< 56 | ~UnloadSegNum MAC 57 | PxW ]1;]2;]3 58 | _UnloadSegNum MAC 59 | Tool $C11 60 | <<< 61 | ~LoadSegName MAC 62 | PHS 4 63 | PHW ]1 64 | PxL ]2;]3 65 | _LoadSegName MAC 66 | Tool $D11 67 | <<< 68 | ~UnloadSeg MAC 69 | PHS 3 70 | PHL ]1 71 | _UnloadSeg MAC 72 | Tool $E11 73 | <<< 74 | ~GetLoadSegInfo MAC 75 | PxW ]1;]2;]3 76 | PHL ]4 77 | _GetLoadSegInfo MAC 78 | Tool $F11 79 | <<< 80 | ~GetUserID MAC 81 | P1SL ]1 82 | _GetUserID MAC 83 | Tool $1011 84 | <<< 85 | ~GetUserID2 MAC 86 | P1SL ]1 87 | _GetUserID2 MAC 88 | Tool $2111 89 | <<< 90 | ~LGetPathname MAC 91 | PHS 2 92 | PxW ]1;]2 93 | _LGetPathname MAC 94 | Tool $1111 95 | <<< 96 | ~LGetPathname2 MAC 97 | PHS 2 98 | PxW ]1;]2 99 | _LGetPathname2 MAC 100 | Tool $2211 101 | <<< 102 | ~UserShutDown MAC 103 | PHA 104 | PxW ]1;]2 105 | _UserShutDown MAC 106 | Tool $1211 107 | <<< 108 | ~RenamePathname MAC 109 | PxL ]1;]2 110 | _RenamePathname MAC 111 | Tool $1311 112 | <<< 113 | 114 | -------------------------------------------------------------------------------- /macros/Locator.Macs.s: -------------------------------------------------------------------------------- 1 | * Tool Locator macros 2 | * by Dave Klimas 3 | ; 4 | ; Copyright Apple Computer, Inc. 1986, 1987 5 | ; and Roger Wagner Publishing, Inc. 1988 6 | ; All Rights Reserved 7 | ; 8 | _TLBootInit MAC 9 | Tool $101 10 | <<< 11 | _TLStartUp MAC 12 | Tool $201 13 | <<< 14 | _TLShutDown MAC 15 | Tool $301 16 | <<< 17 | ~TLVersion MAC 18 | PHA 19 | _TLVersion MAC 20 | Tool $401 21 | <<< 22 | _TLReset MAC 23 | Tool $501 24 | <<< 25 | ~TLStatus MAC 26 | PHA 27 | _TLStatus MAC 28 | Tool $601 29 | <<< 30 | ~GetTSPtr MAC 31 | PHS 2 32 | PxW ]1;]2 33 | _GetTSPtr MAC 34 | Tool $901 35 | <<< 36 | ~SetTSPtr MAC 37 | PxW ]1;]2 38 | PHL ]3 39 | _SetTSPtr MAC 40 | Tool $A01 41 | <<< 42 | ~GetFuncPtr MAC 43 | PHS 2 44 | PxW ]1;]2 45 | _GetFuncPtr MAC 46 | Tool $B01 47 | <<< 48 | ~GetWAP MAC 49 | PHS 2 50 | PxW ]1;]2 51 | _GetWAP MAC 52 | Tool $C01 53 | <<< 54 | ~SetWAP MAC 55 | PxW ]1;]2 56 | PHL ]3 57 | _SetWAP MAC 58 | Tool $D01 59 | <<< 60 | ~LoadTools MAC 61 | PHL ]1 62 | _LoadTools MAC 63 | Tool $E01 64 | <<< 65 | ~LoadOneTool MAC 66 | PxW ]1;]2 67 | _LoadOneTool MAC 68 | Tool $F01 69 | <<< 70 | ~UnloadOneTool MAC 71 | PHW ]1 72 | _UnloadOneTool MAC 73 | Tool $1001 74 | <<< 75 | ~TLMountVolume MAC 76 | PHA 77 | PxW ]1;]2 78 | PxL ]3;]4;]5;]6 79 | _TLMountVolume MAC 80 | Tool $1101 81 | <<< 82 | ~TLTextMountVolume MAC 83 | PHA 84 | PxL ]1;]2;]3;]4 85 | _TLTextMountVolume MAC 86 | Tool $1201 87 | <<< 88 | ~SaveTextState MAC 89 | PHS 2 90 | _SaveTextState MAC 91 | Tool $1301 92 | <<< 93 | ~RestoreTextState MAC 94 | PHL ]1 95 | _RestoreTextState MAC 96 | Tool $1401 97 | <<< 98 | ~MessageCenter MAC 99 | PxW ]1;]2 100 | PHL ]3 101 | _MessageCenter MAC 102 | Tool $1501 103 | <<< 104 | _SetDefaultTPT MAC 105 | Tool $1601 106 | <<< 107 | ~MessageByName MAC 108 | PHS 2 109 | PHWL ]1;]2 110 | PxW ]3;]4 111 | _MessageByName MAC 112 | Tool $1701 113 | <<< 114 | ~StartUpTools MAC 115 | PHA 116 | PxW ]1;]2 117 | PxL ]3;]4 118 | _StartUpTools MAC 119 | Tool $1801 120 | <<< 121 | ~ShutDownTools MAC 122 | PHWL ]1;]2 123 | _ShutDownTools MAC 124 | Tool $1901 125 | <<< 126 | _GetMsgHandle MAC 127 | Tool $1A01 128 | <<< 129 | _AcceptRequests MAC 130 | Tool $1B01 131 | <<< 132 | _SendRequest MAC 133 | Tool $1C01 134 | <<< 135 | 136 | -------------------------------------------------------------------------------- /macros/Tool222.Macs.s: -------------------------------------------------------------------------------- 1 | * NinjaTrackerPlus Tool 2 | * Ninjaforce, 2018 3 | * Brutal Deluxe, 2018 4 | * FTA, 1991 5 | 6 | _NTPBootInit mac 7 | Tool $01DE 8 | <<< 9 | 10 | ~NTPStartUp mac 11 | PHW ]1 12 | _NTPStartUp mac 13 | Tool $02DE 14 | <<< 15 | 16 | _NTPShutDown mac 17 | Tool $03DE 18 | <<< 19 | 20 | ~NTPVersion mac 21 | phd ; WordResult 22 | _NTPVersion mac 23 | Tool $04DE 24 | <<< 25 | 26 | _NTPReset mac 27 | Tool $05DE 28 | <<< 29 | 30 | ~NTPStatus mac 31 | phd ; WordResult 32 | _NTPStatus mac 33 | Tool $06DE 34 | <<< 35 | 36 | ~NTPLoadOneMusic mac 37 | PHL ]1 38 | _NTPLoadOneMusic mac 39 | Tool $09DE 40 | <<< 41 | 42 | ~NTPPlayMusic mac 43 | PHW ]1 44 | _NTPPlayMusic mac 45 | Tool $0ADE 46 | <<< 47 | 48 | _NTPStopMusic mac 49 | Tool $0BDE 50 | <<< 51 | 52 | ~NTPGetEOfMusic mac 53 | phd ; WordResult 54 | _NTPGetEOfMusic mac 55 | Tool $0CDE 56 | <<< 57 | 58 | ~NTPAddToBatch mac 59 | PHLW ]1;]2 60 | _NTPAddToBatch mac 61 | Tool $0DDE 62 | <<< 63 | 64 | ~NTPSelectBatch mac 65 | PHW ]1 66 | _NTPSelectBatch mac 67 | Tool $0EDE 68 | <<< 69 | 70 | ~NTPKillBatch mac 71 | PHW ]1 72 | _NTPKillBatch mac 73 | Tool $0FDE 74 | <<< 75 | 76 | ~NTPGetPlayingMusic mac 77 | phd ; WordResult 78 | _NTPGetPlayingMusic mac 79 | Tool $10DE 80 | <<< 81 | 82 | ~NTPPlayBatch mac 83 | PHL ]1 84 | _NTPPlayBatch mac 85 | Tool $11DE 86 | <<< 87 | 88 | ~NTPGetTrackVu mac 89 | phd ;Long 90 | phd ; Result 91 | _NTPGetTrackVu mac 92 | Tool $12DE 93 | <<< 94 | 95 | _NTPPauseMusic mac 96 | Tool $13DE 97 | <<< 98 | 99 | _NTPContinueMusic mac 100 | Tool $14DE 101 | <<< 102 | 103 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "generic-tile-engine", 3 | "version": "1.0.0", 4 | "description": "A tile-base game engine for the Apple IIgs", 5 | "main": "index.js", 6 | "config": { 7 | "merlin32": "C:\\Programs\\IIgsXDev\\bin\\Merlin32-1.1.10.exe", 8 | "cadius": "C:\\Programs\\IIgsXDev\\bin\\Cadius.exe", 9 | "gsport": "C:\\Programs\\gsport\\gsport_0.31\\GSPort.exe", 10 | "macros": "./macros", 11 | "crossrunner": "C:\\Programs\\Crossrunner\\Crossrunner.exe" 12 | }, 13 | "scripts": { 14 | "gsport": "%npm_package_config_gsport%", 15 | "build:image": "npm run build && build-image.bat %npm_package_config_cadius%", 16 | "build:docs": "cd docs && bundle exec jekyll serve", 17 | "archive": "%npm_package_config_cadius% EXTRACTFILE ./emu/Target.2mg /GTEDev/Tool160.SHK .", 18 | "test": "npm run build && build-image.bat %npm_package_config_cadius% && %npm_package_config_gsport%", 19 | "build": "%npm_package_config_merlin32% -V %npm_package_config_macros% ./src/Master.s", 20 | "build:debug": "%npm_package_config_merlin32% -V %npm_package_config_macros% ./src/Debug.s", 21 | "debug": "%npm_package_config_crossrunner% ./src/Debug160 -Source ./src/Debug160_S02__Output.txt -Debug -CompatibilityLayer" 22 | }, 23 | "repository": { 24 | "type": "git", 25 | "url": "git+https://github.com/lscharen/iigs-game-engine.git" 26 | }, 27 | "author": "Lucas Scharenbroich", 28 | "license": "Apache-2.0", 29 | "bugs": { 30 | "url": "https://github.com/lscharen/iigs-game-engine/issues" 31 | }, 32 | "homepage": "https://github.com/lscharen/iigs-game-engine#readme", 33 | "devDependencies": { 34 | "pngjs": "^6.0.0", 35 | "string-builder": "^0.1.8", 36 | "watch": "latest", 37 | "xml2json": "^0.12.0" 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Anim.s: -------------------------------------------------------------------------------- 1 | ; Animation helpers 2 | ; 3 | ; These provide animation sequencing and pathing support for animations. Some function are 4 | ; sprite-specific, but the functions are generally applicable to any kind of animation support 5 | ; by the engine, such as swapping tiles or even just having an asynchronous method of updating 6 | ; game data. 7 | ; 8 | ; Depends on the Timers and Script sub-systems 9 | 10 | 11 | ; AnimatePath 12 | ; 13 | ; Moves a sprite between two keyframe point over a specificed number of steps 14 | ; 15 | ; X = YYXX ; start position 16 | ; A = YYXX ; end position 17 | ; Y = duration ; number of steps from start to end (must be > 0) 18 | AnimatePath 19 | 20 | pha ; Store the starting point 21 | and #$00FF 22 | sta AnimX0 23 | pla 24 | xba 25 | and #$00FF 26 | sta AnimY0 27 | 28 | txa ; Store the ending point 29 | and #$00FF 30 | sta AnimX1 31 | txa 32 | xba 33 | and #$00FF 34 | sta AnimY1 35 | 36 | sty AnimDuration 37 | 38 | ; Calculate the steps for the X and Y positions. This is line drawing two lines 39 | ; at a time . The slope of the lines are (X1 - X0) / Duration and (Y1 - Y0) / Duration. 40 | ; 41 | ; The tricky bit is that we *always* single-step in the "Y" direction (duration), so we 42 | ; actually need to use two differenct algorithms. 43 | ; 44 | ; If |X1 - X0| <= Duration, use a standard Bresenham's 45 | ; If |X1 - X0| > Duration, use the Run-Length Slice algorithm (https://www.phatcode.net/res/224/files/html/ch36/36-02.html) 46 | 47 | lda AnimX1 48 | 49 | lda AnimY 50 | cmp AnimDuration ; Handle the two cases 51 | -------------------------------------------------------------------------------- /src/Master.s: -------------------------------------------------------------------------------- 1 | ; IIgs Generic Tile Engine User Toolset 2 | 3 | TYP $BA ; Tool set file 4 | DSK Tool160 5 | XPL 6 | 7 | ; Main toolbox interface and code 8 | 9 | ASM Tool.s 10 | SNA Main 11 | 12 | ; 64KB Tile Memory 13 | 14 | ASM static/TileData.s 15 | KND #$1101 ; Type and Attributes ($10=Static,$01=Data) 16 | ALI BANK 17 | SNA TDATA 18 | 19 | ; 64KB Sprite Plane Data 20 | 21 | ASM static/SprData.s 22 | KND #$1101 ; Type and Attributes ($11=Static+Bank Relative,$01=Data) 23 | ALI BANK 24 | SNA SDATA 25 | 26 | ; 64KB Sprite Mask Data 27 | 28 | ASM static/SprMask.s 29 | KND #$1101 ; Type and Attributes ($11=Static+Bank Relative,$01=Data) 30 | ALI BANK 31 | SNA SMASK 32 | 33 | ; 64KB Tile Store 34 | 35 | ASM static/TileStore.s 36 | KND #$1101 ; Type and Attributes ($11=Static+Bank Relative,$01=Data) 37 | ALI BANK 38 | SNA TSTORE 39 | 40 | ; 64KB Rotation Data Tables 41 | 42 | ASM RotData.s 43 | KND #$1101 ; Type and Attributes ($11=Static+Bank Relative,$01=Data) 44 | ALI BANK 45 | SNA ROTDATA 46 | 47 | ; Additional code 48 | 49 | ; ASM FastCopies.s 50 | ; KND #$1101 ; Type and Attributes ($11=Static+Bank Relative,$01=Data) 51 | ; ALI BANK 52 | ; SNA FASTCPY 53 | -------------------------------------------------------------------------------- /src/Math.s: -------------------------------------------------------------------------------- 1 | ; Math-y functions 2 | 3 | mx %00 4 | 5 | ; Special subroutine to divide the accumulator by 164 and return remainder in the Accumulator 6 | ; 7 | ; 164 = $A4 = 1010_0100 8 | Mod164 cmp #%1010010000000000 9 | bcc *+5 10 | sbc #%1010010000000000 11 | 12 | cmp #%0101001000000000 13 | bcc *+5 14 | sbc #%0101001000000000 15 | 16 | cmp #%0010100100000000 17 | bcc *+5 18 | sbc #%0010100100000000 19 | 20 | cmp #%0001010010000000 21 | bcc *+5 22 | sbc #%0001010010000000 23 | 24 | cmp #%0000101001000000 25 | bcc *+5 26 | sbc #%0000101001000000 27 | 28 | cmp #%0000010100100000 29 | bcc *+5 30 | sbc #%0000010100100000 31 | 32 | cmp #%0000001010010000 33 | bcc *+5 34 | sbc #%0000001010010000 35 | 36 | cmp #%0000000101001000 37 | bcc *+5 38 | sbc #%0000000101001000 39 | 40 | cmp #%0000000010100100 41 | bcc *+5 42 | sbc #%0000000010100100 43 | rts 44 | 45 | ; Special subroutine to divide the accumulator by 208 and return remainder in the Accumulator 46 | ; 47 | ; 208 = $D0 = 1101_0000 48 | ; 49 | ; There are probably faster hacks to divide a 16-bit unsigned value by 208 50 | ; https://www.drdobbs.com/parallel/optimizing-integer-division-by-a-constan/184408499 51 | ; https://embeddedgurus.com/stack-overflow/2009/06/division-of-integers-by-constants/ 52 | 53 | Mod208 cmp #%1101000000000000 54 | bcc *+5 55 | sbc #%1101000000000000 56 | 57 | cmp #%0110100000000000 58 | bcc *+5 59 | sbc #%0110100000000000 60 | 61 | cmp #%0011010000000000 62 | bcc *+5 63 | sbc #%0011010000000000 64 | 65 | cmp #%0001101000000000 66 | bcc *+5 67 | sbc #%0001101000000000 68 | 69 | cmp #%0000110100000000 70 | bcc *+5 71 | sbc #%0000110100000000 72 | 73 | cmp #%0000011010000000 74 | bcc *+5 75 | sbc #%0000011010000000 76 | 77 | cmp #%0000001101000000 78 | bcc *+5 79 | sbc #%0000001101000000 80 | 81 | cmp #%0000000110100000 82 | bcc *+5 83 | sbc #%0000000110100000 84 | 85 | cmp #%0000000011010000 86 | bcc *+5 87 | sbc #%0000000011010000 88 | rts 89 | -------------------------------------------------------------------------------- /src/_FileInformation.txt: -------------------------------------------------------------------------------- 1 | Tool160=Type(BA),AuxType(0000),VersionCreate(70),MinVersion(BE),Access(E3),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000) 2 | -------------------------------------------------------------------------------- /src/blitter/Blitter.s: -------------------------------------------------------------------------------- 1 | ; This is the method that is most useful from the high-level code. We want the 2 | ; freedom to blit a range of lines. This subroutine can assume that all of the 3 | ; data in the code fields is set up properly. 4 | ; 5 | ; X = first line (inclusive), valid range of 0 to 199 6 | ; Y = last line (exclusive), valid range >X up to 200 7 | ; 8 | ; The lines are based on the appearance of lines in the play field, so blitting lines 0 through 9 | ; 19 will draw the first 20 lines on the play field, regardless of where the playfield is physically 10 | ; on the SHR screen or the current value of StartY 11 | _BltRange 12 | 13 | :exit_ptr equ tmp0 14 | :jmp_low_save equ tmp2 15 | 16 | sty :jmp_low_save ; Steal some temp space and check for empty ranges 17 | cpx :jmp_low_save ; This makes it simpler for some callers 18 | bcc *+3 19 | rts 20 | 21 | phb ; preserve the bank register 22 | clc` 23 | 24 | dey 25 | tya ; Get the address of the line that we want to return from 26 | adc StartYMod208 ; and create a pointer to it 27 | asl 28 | tay 29 | lda BTableLow,y 30 | sta :exit_ptr 31 | lda BTableHigh,y 32 | sta :exit_ptr+2 33 | 34 | txa ; get the first line (0 - 199) 35 | adc StartYMod208 ; add in the virtual offset (0, 207) -- max value of 406 36 | asl 37 | tax ; this is the offset into the blitter table 38 | 39 | sep #$20 ; 8-bit Acc 40 | lda BTableHigh,x ; patch in the bank 41 | stal blt_entry+3 42 | 43 | lda BTableLow+1,x ; patch in the page 44 | stal blt_entry+2 45 | 46 | ; The way we patch the exit code is subtle, but very fast. The CODE_EXIT offset points to 47 | ; an JMP/JML instruction that transitions to the next line after all of the code has been 48 | ; executed. 49 | ; 50 | ; The trick we use is to patch the low byte to force the code to jump to a special return 51 | ; function (jml blt_return) in the *next* code field line. 52 | 53 | ldy #CODE_EXIT+1 ; this is a JMP or JML instruction that points to the next line. 54 | lda [:exit_ptr],y 55 | sta :jmp_low_save 56 | lda #FULL_RETURN ; this is the offset of the return code 57 | sta [:exit_ptr],y ; patch out the low byte of the JMP/JML 58 | 59 | ; Now we need to set up the Bank, Stack Pointer and Direct Page registers for calling into 60 | ; the code field 61 | 62 | lda EngineMode 63 | bit #ENGINE_MODE_TWO_LAYER 64 | beq :skip_bank 65 | 66 | ; TODO: Switch to loading the selected BG1 bank. No special "Alt" bank 67 | ; 68 | ; lda RenderFlags 69 | ; bit #RENDER_ALT_BG1 70 | ; beq :primary 71 | ; 72 | ; lda BG1AltBank 73 | ; bra :alt 74 | ; 75 | ;:primary lda BG1DataBank 76 | ;:alt 77 | lda BG1DataBank 78 | pha 79 | plb 80 | 81 | :skip_bank 82 | rep #$20 83 | 84 | phd ; Save the application direct page 85 | lda BlitterDP ; Set the direct page to the blitter data 86 | tcd 87 | 88 | sei ; disable interrupts 89 | _R0W1 90 | tsc ; save the stack pointer 91 | stal stk_save+1 92 | 93 | blt_entry jml $000000 ; Jump into the blitter code $XX/YY00 94 | 95 | blt_return _R0W0 96 | stk_save lda #0000 ; load the stack 97 | tcs 98 | cli ; re-enable interrupts 99 | pld ; restore the direct page 100 | 101 | sep #$20 102 | ldy #CODE_EXIT+1 103 | lda :jmp_low_save 104 | sta [:exit_ptr],y 105 | rep #$20 106 | 107 | plb ; restore the bank 108 | rts 109 | -------------------------------------------------------------------------------- /src/blitter/SCB.s: -------------------------------------------------------------------------------- 1 | ; SCB binding. Really just a fast copy from an array in memory to the SCBs for a range of 2 | ; physical lines. Follow the same calling conventions as _BltRange 3 | ; 4 | ; X = first line (inclusive), valid range of 0 to 199 5 | ; Y = last line (exclusive), valid range >X up to 200 6 | ; 7 | ; The lines are based on the appearance of lines in the play field, so blitting lines 0 through 8 | ; 19 will draw the first 20 lines on the play field, regardless of where the playfield is physically 9 | ; on the SHR screen or the current value of StartY 10 | ; 11 | ; This could be made faster by forcing a SCB array to be copied into PEAs ahead of time, but this 12 | ; is a bit more flexible 13 | _BltSCBOut 14 | rts 15 | _BltSCB 16 | lda SCBArrayPtr 17 | ora SCBArrayPtr+2 18 | beq _BltSCBOut 19 | 20 | phb ; preserve the bank register 21 | tsc ; save the stack pointer 22 | stal :stk_save+1 23 | 24 | sep #$20 ; Get the offset into the SCB array 25 | lda SCBArrayPtr+2 26 | pha ; Stash the bank to set later 27 | rep #$20 28 | 29 | lda SCBArrayPtr+2 30 | bpl :bind_to_bg0 31 | lda BG1StartYMod208 32 | bra :bind_to_bg1 33 | :bind_to_bg0 34 | lda StartYMod208 35 | :bind_to_bg1 36 | clc 37 | adc SCBArrayPtr 38 | tax 39 | 40 | lda ScreenHeight ; Calculate the number of scan lines / entry point 41 | asl 42 | and #$FFFC ; Make sure it's a multiple of 4 43 | eor #$FFFF 44 | inc 45 | clc 46 | adc #:scb_end 47 | stal :entry+1 48 | 49 | lda ScreenY1 ; Get the SCB address to put into the stack register 50 | dec 51 | clc 52 | adc #SHADOW_SCREEN_SCB 53 | 54 | plb ; Pop the bank with the SCB array 55 | sei ; turn off interrupts while we slam SCBs 56 | tcs ; set the stack to teh SCB area in Bank 01 57 | _R0W1 58 | :entry jmp :scb_end 59 | 60 | ; 100 lda/pha to cover, potentialls, the full screen 61 | ]line equ 198 62 | lup 100 63 | lda: ]line,x 64 | pha 65 | ]line equ ]line-2 66 | --^ 67 | :scb_end 68 | 69 | _R0W0 70 | :stk_save lda #0000 ; load the stack 71 | tcs 72 | cli ; re-enable interrupts 73 | 74 | plb ; restore the bank 75 | rts 76 | 77 | _BindSCBArray 78 | stx SCBArrayPtr 79 | sta SCBArrayPtr+2 80 | rts 81 | -------------------------------------------------------------------------------- /src/blitter/TilesBG1.s: -------------------------------------------------------------------------------- 1 | 2 | ; On entry 3 | ; 4 | ; B is set to the correct BG1 data bank 5 | ; A is set to the the tile descriptor 6 | ; Y is set to the top-left address of the tile in the BG1 data bank 7 | ; 8 | ; tmp0/tmp1 is reserved 9 | _RenderTileBG1 10 | pha ; Save the tile descriptor 11 | 12 | and #TILE_VFLIP_BIT+TILE_HFLIP_BIT ; Only horizontal and vertical flips are supported for BG1 13 | xba 14 | tax 15 | 16 | pla 17 | and #TILE_ID_MASK ; Mask out the ID and save just that 18 | _Mul128 ; multiplied by 128 19 | jmp (:actions,x) 20 | :actions dw _TBSolidBG1_00,_TBSolidBG1_0H,_TBSolidBG1_V0,_TBSolidBG1_VH 21 | 22 | _TBSolidBG1_00 23 | tax 24 | ]line equ 0 25 | lup 8 26 | ldal tiledata+{]line*4},x 27 | sta: $0000+{]line*$0100},y 28 | ldal tiledata+{]line*4}+2,x 29 | sta: $0002+{]line*$0100},y 30 | ]line equ ]line+1 31 | --^ 32 | rts 33 | 34 | _TBSolidBG1_0H 35 | tax 36 | ]line equ 0 37 | lup 8 38 | ldal tiledata+{]line*4}+64,x 39 | sta: $0000+{]line*$0100},y 40 | ldal tiledata+{]line*4}+64+2,x 41 | sta: $0002+{]line*$0100},y 42 | ]line equ ]line+1 43 | --^ 44 | rts 45 | 46 | _TBSolidBG1_V0 47 | tax 48 | ]src equ 7 49 | ]dest equ 0 50 | lup 8 51 | ldal tiledata+{]src*4},x 52 | sta: $0000+{]dest*$0100},y 53 | ldal tiledata+{]src*4}+2,x 54 | sta: $0002+{]dest*$0100},y 55 | ]src equ ]src-1 56 | ]dest equ ]dest+1 57 | --^ 58 | rts 59 | 60 | _TBSolidBG1_VH 61 | tax 62 | ]src equ 7 63 | ]dest equ 0 64 | lup 8 65 | ldal tiledata+{]src*4}+64,x 66 | sta: $0000+{]dest*$0100},y 67 | ldal tiledata+{]src*4}+64+2,x 68 | sta: $0002+{]dest*$0100},y 69 | ]src equ ]src-1 70 | ]dest equ ]dest+1 71 | --^ 72 | rts 73 | -------------------------------------------------------------------------------- /src/render/README.txt: -------------------------------------------------------------------------------- 1 | This folder contains the rendering tuples for the different type of tile rendering modes 2 | that are defined by both the engine mode and the specific tile attributes. There are 3 | a *lot* or variants, so they are cataloged here. 4 | 5 | The top-level TileRender function in the main entry point that defined the overal tile render 6 | flow as well as the register parameters and calling conventions for each of the modular 7 | components. 8 | 9 | There are 5 pluggable functions that make up a rendering mode 10 | 11 | 1. K_TS_BASE_TILE_DISP 12 | 13 | An address to a function that will render a tile into the code field. There are no 14 | sprites to handle in this case. 15 | 16 | Arguments: 17 | A: TileData/TileMask address 18 | B: code field bank 19 | Y: address of the tile in the code bank 20 | X: TileStore offset 21 | 22 | Return: 23 | None 24 | 25 | If additional TileStore properties are needed for the renderer, they can be read using the X 26 | register. 27 | 28 | 2. K_TS_SPRITE_TILE_DISP 29 | 30 | Selects the top-level handler for rendering a tile with a sprite. Currently, this is used to 31 | select between rendering a sprite above the tile, or under the tile based on the value of the 32 | TILE_PRIORITY_BIT. 33 | 34 | Arguments: 35 | A: TileStore+TS_SPRITE_FLAG 36 | X: TileStore offset 37 | 38 | Return: 39 | Y: TileStore offset 40 | sprite_ptrX dirct page values set to the sprite VBuff addresses 41 | 42 | The handler routine is responsible for examining the TS_SPRITE_FLAG value and dispatching 43 | to an appropriate routine to handle the number of sprites intersecting the tile. 44 | 45 | 3. K_TS_ONE_SPRITE 46 | 47 | A specialized routine when K_TS_SPRITE_TILE_DISP determines there is only one sprite to render 48 | it MUST dispatch to this function. The K_TS_ONE_SPRITE routine MAY make use of the K_TS_COPY_TILE_DATA 49 | and K_TS_APPLY_TILE_DATA functions, but is not required to do so. 50 | 51 | 4. K_TS_COPY_TILE_DATA & K_TS_APPLY_TILE_DATA 52 | 53 | A pair of function that copye tile data (and possible mask information) into a temporary 54 | direct page space and then render that workspace into the code field. 55 | 56 | These functions are used as building blocks by the generic Over/Under multi-sprite 57 | rendering code. 58 | 59 | K_TS_COPY_TILE_DATA 60 | Arguments: 61 | B: Set to the TileData bank 62 | Y: Set to the tile address 63 | Return: 64 | X: preserve the X register 65 | 66 | K_TS_APPLY_TILE_DATA 67 | Arguments: 68 | B: code field bank 69 | Y: address of the tile in the code bank 70 | Return: 71 | None 72 | 73 | 74 | 75 | Generic Flow 76 | 77 | 1. Is there a sprite? 78 | No -> Call K_TS_BASE_TILE_DISP to render a tile into the code field 79 | 80 | Yes -> Call K_TS_SPRITE_TILE_DISP 81 | 82 | Over : Copy tile data + mask to DP, Copy sprite data + mask to DP, render tile to code field 83 | Under : Copy sprite data to DP, -------------------------------------------------------------------------------- /src/render/Render.s: -------------------------------------------------------------------------------- 1 | ; If there are no sprites, then we copy the tile data into the code field as fast as possible. 2 | ; If there are sprites, then additional work is required 3 | _RenderTile 4 | lda TileStore+TS_SPRITE_FLAG,x ; any sprites on this tile? 5 | bne _HasSprites 6 | 7 | ; Probably best to rework this to just jump to the tile routine directly, even if there 8 | ; is some boilerplate code because it is useful to be able to access the data bank before 9 | ; switching to the code field bank. 10 | 11 | lda TileStore+TS_CODE_ADDR_HIGH,x ; load the bank of the target code field line 12 | pha ; and put on the stack for later. Has TileStore bank in high byte. 13 | ldy TileStore+TS_CODE_ADDR_LOW,x ; load the address of the code field 14 | lda TileStore+TS_TILE_ADDR,x ; load the address of this tile's data (pre-calculated) 15 | plb ; set the code field bank 16 | jmp (K_TS_BASE_TILE_DISP,x) ; go to the tile copy routine 17 | 18 | ; This is the specialized renderer for the dirty tile rendering mode. The difference is that 19 | ; it is assumed that the screen is static and the tiles are aligned with the graphics screen. 20 | ; The engine must be in "Fast" tile mode for dirty tile rendering to work. It is possible 21 | ; to switch the engine into this mode by rendering a full screen of solid tiles and then 22 | ; doing a dirty tile rendering. 23 | ; 24 | ; The main result is that this renderer skips copying tile data into the play field and 25 | ; just draws to the screen directly, and only draws tiles in the dirty tile queue 26 | _RenderDirtyTile 27 | lda TileStore+TS_SPRITE_FLAG,x ; any sprites on this tile? 28 | bne _HasSprites 29 | jmp (K_TS_BASE_TILE_DISP,x) ; This is just to select between H/V flips 30 | 31 | ; Execute the sprite tree. If there is only one sprite, control will immediately be passed to 32 | ; the routine at K_TS_ONE_SPRITE. Otherwise, the control is passed to a routine based on the 33 | ; different number of sprites. These routines need to copy the flattened sprite data and mask 34 | ; into the direct page workspace to be used by the K_TS_SPRITE_TILE_DISP routine 35 | _HasSprites txy 36 | SpriteBitsToVBuffAddrs $0000;TwoSprites;ThreeSprites;FourSprites 37 | 38 | ; Dispatch vectors for the two, three and four sprite functions. These just 39 | ; flatten the sprite data into the direct page workspace and then pass control 40 | ; to the configurable routine which is set in SetTile and knows what to do 41 | ; based on the tile properties (over/under, engine mode, etc.) 42 | ; 43 | ; NOTE: Could pull the CopyXXXSprites function inline and save the 3 cycles for the JMP, 44 | ; - or - put the TYX into the macro and jump directly from there. 45 | TwoSprites tyx 46 | jmp CopyTwoSpritesDataAndMaskToDP 47 | 48 | ThreeSprites tyx 49 | jmp CopyThreeSpritesDataAndMaskToDP 50 | 51 | FourSprites tyx 52 | jmp CopyFourSpritesDataAndMaskToDP 53 | -------------------------------------------------------------------------------- /src/render/Slow.s: -------------------------------------------------------------------------------- 1 | ; Identical routines to those in Fast.s, but also set the opcode. Used to render solid 2 | ; tiles when the engine mode has other capabilities turned on 3 | ; 4 | ; The following functions are defined here 5 | ; 6 | ; GenericOverSlow : Places data from tmp_sprite_data on top of the TileStore's tile 7 | ; GenericUnderSlow : Places the TileStore's tile on top of tmp_sprite_data 8 | 9 | ConstTile0Slow 10 | jsr FillPEAOpcode ; Could these be slightly faster to do PEA ConstTile0Fast-1 ; JMP FillPEAOpcode? 11 | jmp ConstTile0Fast ; Currently it's 6 + 6 + 3 + 6, improved would be 5 + 3 + 6 + 6 = 1 cycle saved. :( 12 | 13 | SpriteOverASlow 14 | lda TileStore+TS_CODE_ADDR_HIGH,x ; load the bank of the target code field line 15 | pha ; and put on the stack for later. Has TileStore bank in high byte. 16 | ldy TileStore+TS_CODE_ADDR_LOW,x ; load the address of the code field 17 | lda TileStore+TS_TILE_ADDR,x 18 | tax 19 | plb 20 | jsr FillPEAOpcode 21 | jmp _SpriteOverAFast 22 | 23 | SpriteOverVSlow 24 | lda TileStore+TS_CODE_ADDR_HIGH,x ; load the bank of the target code field line 25 | pha ; and put on the stack for later. Has TileStore bank in high byte. 26 | ldy TileStore+TS_CODE_ADDR_LOW,x ; load the address of the code field 27 | lda TileStore+TS_TILE_ADDR,x 28 | tax 29 | plb 30 | jsr FillPEAOpcode 31 | jmp _SpriteOverVFast 32 | 33 | SpriteOver0Slow 34 | lda TileStore+TS_CODE_ADDR_HIGH,x ; load the bank of the target code field line 35 | pha ; and put on the stack for later. Has TileStore bank in high byte. 36 | ldy TileStore+TS_CODE_ADDR_LOW,x ; load the address of the code field 37 | plb 38 | jsr FillPEAOpcode 39 | jmp _SpriteOver0Fast 40 | 41 | SpriteUnderASlow 42 | lda TileStore+TS_CODE_ADDR_HIGH,x ; load the bank of the target code field line 43 | pha ; and put on the stack for later. Has TileStore bank in high byte. 44 | ldy TileStore+TS_CODE_ADDR_LOW,x ; load the address of the code field 45 | lda TileStore+TS_TILE_ADDR,x 46 | tax 47 | plb 48 | jsr FillPEAOpcode 49 | jmp _SpriteUnderAFast 50 | 51 | SpriteUnderVSlow 52 | lda TileStore+TS_CODE_ADDR_HIGH,x ; load the bank of the target code field line 53 | pha ; and put on the stack for later. Has TileStore bank in high byte. 54 | ldy TileStore+TS_CODE_ADDR_LOW,x ; load the address of the code field 55 | lda TileStore+TS_TILE_ADDR,x 56 | tax 57 | plb 58 | jsr FillPEAOpcode 59 | jmp _SpriteUnderVFast 60 | 61 | SpriteUnder0Slow 62 | lda TileStore+TS_CODE_ADDR_HIGH,x ; load the bank of the target code field line 63 | pha ; and put on the stack for later. Has TileStore bank in high byte. 64 | ldy TileStore+TS_CODE_ADDR_LOW,x ; load the address of the code field 65 | plb 66 | jsr FillPEAOpcode 67 | jmp _SpriteUnder0Fast 68 | 69 | ; Helper function; no stack manipulation 70 | FillPEAOpcode 71 | sep #$20 72 | lda #$F4 73 | ]line equ 0 74 | lup 8 75 | sta: $0000+{]line*$1000},y 76 | sta: $0003+{]line*$1000},y 77 | ]line equ ]line+1 78 | --^ 79 | rep #$20 80 | rts 81 | 82 | CopyTileASlow 83 | tax 84 | jsr FillPEAOpcode 85 | jmp _CopyTileAFast 86 | 87 | 88 | CopyTileVSlow 89 | tax 90 | jsr FillPEAOpcode 91 | jmp _CopyTileVFast -------------------------------------------------------------------------------- /src/render/Sprite2.s: -------------------------------------------------------------------------------- 1 | ; Specialize routines for handling two sprites. 2 | TwoSpriteData mac 3 | lda (sprite_ptr1),y 4 | db $37,sprite_ptr0 ; and [sprite_ptr0],y 5 | ora (sprite_ptr0),y 6 | <<< 7 | 8 | TwoSpriteMask mac 9 | db $B7,sprite_ptr1 ; lda [sprite_ptr1],y 10 | db $37,sprite_ptr0 ; and [sprite_ptr0],y 11 | <<< 12 | 13 | CopyFourSpritesDataAndMaskToDP 14 | CopyThreeSpritesDataAndMaskToDP 15 | CopyTwoSpritesDataAndMaskToDP 16 | pei DP2_SPRITEDATA_AND_TILESTORE_BANKS 17 | plb 18 | 19 | ]line equ 0 20 | lup 8 21 | ldy #{]line*SPRITE_PLANE_SPAN} 22 | TwoSpriteData 23 | sta tmp_sprite_data+{]line*4} 24 | TwoSpriteMask 25 | sta tmp_sprite_mask+{]line*4} 26 | 27 | ldy #{]line*SPRITE_PLANE_SPAN}+2 28 | TwoSpriteData 29 | sta tmp_sprite_data+{]line*4}+2 30 | TwoSpriteMask 31 | sta tmp_sprite_mask+{]line*4}+2 32 | ]line equ ]line+1 33 | --^ 34 | 35 | plb 36 | jmp (K_TS_SPRITE_TILE_DISP,x) 37 | 38 | -------------------------------------------------------------------------------- /src/render/Sprite3.s: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/src/render/Sprite3.s -------------------------------------------------------------------------------- /src/render/Sprite4.s: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lscharen/iigs-game-engine/aae8fed1c1a558007a680de990dfa3af827f651e/src/render/Sprite4.s -------------------------------------------------------------------------------- /src/static/SprData.s: -------------------------------------------------------------------------------- 1 | ; sprite stamp pixel data 2 | spritedata ENT 3 | ; ds 65535 4 | ds 65536 5 | 6 | -------------------------------------------------------------------------------- /src/static/SprMask.s: -------------------------------------------------------------------------------- 1 | ; sprite stamp masks 2 | spritemask ENT 3 | ; ds 65535 4 | ds 65536 5 | 6 | -------------------------------------------------------------------------------- /src/static/TileData.s: -------------------------------------------------------------------------------- 1 | ; Bank of memory that holds the 8x8 tile data 2 | tiledata ENT 3 | ; ds 65535 4 | ds 65536 5 | 6 | -------------------------------------------------------------------------------- /tools/mkscales.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Generated data tables for BG1 scaling 3 | */ 4 | const RATIOS = [0.5, 0.63, 0.75, 0.87, 1.0, 1.125, 1.25, 1.375, 1.5, 1.66, 1.83, 2.0, 2.5, 3.0, 3.5, 4.0]; 5 | const NUM_SCALES = RATIOS.length; 6 | 7 | main(process.argv.slice(2)).then( 8 | () => process.exit(0), 9 | (e) => { 10 | console.error(e); 11 | process.exit(1); 12 | } 13 | ); 14 | 15 | function toHex(n) { 16 | return '$' + n.toString(16).toUpperCase().padStart(4, '0'); 17 | } 18 | 19 | async function main(argv) { 20 | 21 | const _ = console.log; 22 | 23 | for (let i = 0; i < NUM_SCALES; i += 1) { 24 | const arr = gen_scale_table(RATIOS[i]).map(n => toHex(n)).join(','); 25 | _(`Scale${i} dw ${arr}`); 26 | } 27 | } 28 | 29 | function gen_scale_table(ratio) { 30 | // Take a bunch of values from 0 to 162 (82 total). Use the middle as a reference 31 | // and scale out based on the (inverse) ratio, e.g. a ratio of 2 will double the pixels 32 | const ref = Array.from({ length: 82 }, (_, i) => i * 2); 33 | const center = 40.5; 34 | const factor = 1. / ratio; 35 | 36 | const table = []; 37 | for (let i = 0; i < 82; i++) { 38 | 39 | let index = 2 * Math.floor(center + (factor * (i - center))); 40 | while (index < 0) { 41 | index += 162; 42 | } 43 | while (index > 162) { 44 | index -= 162; 45 | } 46 | table.push(index); 47 | } 48 | 49 | return table; 50 | } 51 | -------------------------------------------------------------------------------- /tools/scanline-test.py: -------------------------------------------------------------------------------- 1 | # Playground for working through scanline decomposition algorithm 2 | 3 | # 1. Shadow Off 4 | # 2. Draw Playfield (sprite OR overlay) AND NOT solid_overlay 5 | # 3. Draw sprites 6 | 7 | sprites = [ 8 | { 'top': 10, 'bottom': 17 }, 9 | { 'top': 14, 'bottom': 29 } 10 | ] 11 | 12 | overlays = [ 13 | { 'top': 0, 'bottom': 7 } 14 | ] 15 | 16 | MAX_HEIGHT = 199 17 | 18 | # Combine a list on ranges into a minimal list by merging overlapping ranges 19 | def simplify(a): 20 | b = [] 21 | if len(a) > 0: 22 | last = a[0] 23 | start = last['top'] 24 | for r in a[1:]: 25 | if r['top'] <= last['bottom']: 26 | last = r 27 | continue 28 | 29 | b.append([start, last['bottom']]) 30 | last = r 31 | start = r['top'] 32 | 33 | b.append([start, last['bottom']]) 34 | 35 | return b 36 | 37 | # Given two sorted lists, merge them together into a minimal set of ranges. This could 38 | # be done as a list merge and then a combine step, but we want to be more efficient and 39 | # do the merge-and-combine at the same time 40 | def merge(a, b): 41 | if len(a) == 0: 42 | return simplify(b) 43 | 44 | if len(b) == 0: 45 | return simplify(a) 46 | 47 | c = [] 48 | i = j = 0 49 | 50 | while i < len(a) and j < len(b): 51 | if a[i]['top'] <= b[j]['top']: 52 | c.append(a[i]) 53 | i += 1 54 | else: 55 | c.append(b[j]) 56 | j += 1 57 | 58 | if i < len(a): 59 | c.extend(a[i:]) 60 | 61 | if j < len(b): 62 | c.extend(b[j:]) 63 | 64 | return simplify(c) 65 | 66 | # Find the lines that need to be drawn with shadowing off 67 | def get_shadow_off_bg(sprites): 68 | ranges = [] 69 | 70 | if len(sprites) > 0: 71 | last = sprites[0] 72 | start = last['top'] 73 | 74 | for sprite in sprites[1:]: 75 | if sprite['top'] <= last['bottom']: 76 | last = sprite 77 | continue 78 | 79 | ranges.push([start, last['bottom']]) 80 | start = sprite['top'] 81 | last = sprite 82 | 83 | ranges.append([start, last['bottom']]) 84 | 85 | return ranges 86 | 87 | def complement(ranges): 88 | comp = [] 89 | if len(ranges) > 0: 90 | if ranges[0][0] > 0: 91 | comp.append([0, ranges[0][0]]) 92 | for i in range(1, len(ranges)): 93 | comp.append([ranges[i-1][1]+1, ranges[i][0]]) 94 | last = ranges[len(ranges)-1] 95 | if last[1] < MAX_HEIGHT: 96 | comp.append([last[1]+1, MAX_HEIGHT]) 97 | return comp 98 | else: 99 | return [0, MAX_HEIGHT] 100 | 101 | r = get_shadow_off_bg(sprites) 102 | print(r) 103 | print(complement(r)) 104 | 105 | print(merge(sprites, overlays)) --------------------------------------------------------------------------------