0.0.2 • Published 4 years ago

@gct256/mbtools v0.0.2

Weekly downloads
4
License
MIT
Repository
github
Last release
4 years ago

mbtools

Development tools for MSX.

Features

  • Build system: Generate Makefile and use make command to building.
  • Preprocessor: Generate assembler files from various source files.
  • Watch: Watch files, build project and reload emulator.

System required

Install

$ npm install -g @gct256/mbtools

Usage

$ mkdir my-project
$ cd my-project
$ mbtools setup
$ make watch

Main commands

mbtools config

Generate global configuration in interactive. Other command needs global configuration.

namedescriptiondefaultnote
asm.typeType of assembler.pasmocurrently only pasmo
asm.pathFile path of assembler executable.
asm.extExtname of assembler source file..asm
emu.typeType of emulator.openmsxcurrently only openmsx
emu.pathFile path of emulator executable.
pp.extExtname of preprocessor result file..inc
dest.extExtname of destination file..rom

mbtools setup

Generate Makefile on current directory in interactive.

After setup, use make to build.

command lineaction
makeBuild project.
make cleanRemove generated files.
make watchStart watch mode.

Other command.

Normally not used. (used by Makefile)

mbtools watch

Start watch mode.

  • Watch file in current directory.
    • If add/update preprocess target file, start preprocess.
    • If add/update assembler source file, build project.
    • If add/update destination file, reload emulator.

mbtools js2asm FILE EXT

Generate assembler source file from JavaScript code.

FILE is file include JavaScript code. EXT is output file's extname.

  • Example:
    • FILE: foo/bar/baz.js
    • EXT: .inc
    • output: foo/bar/baz.js.inc
Convert rules
JavaScript valueresult
boolean, boolean[]DB directive. (0 or 1)
number, number[]DB directive.
Int8Array, Uint8Array, Uint8ClampedArrayDB directive.
Int16Array, Unt16ArrayDW directive.
string, string[]DB directive. (single quoted string)
otherIgnore.

NOTE: nested array flatten.

mbtools png2asm FILE EXT

Generate assembler source file from PNG image file.

FILE is image file. EXT is output file's extname.

  • Example 1: single result
    • FILE: foo/bar/baz.png
    • EXT: .inc
    • output: foo/bar/baz.png.inc
  • Example 2: multiple result
    • FILE: foo/bar/baz.png
    • EXT: .inc
    • output: foo/bar/baz.png.inc, foo/bar/baz.png.qux.inc
Convert rules

Convertion method is desided according end of file name.

end on file namemethodresult
.msx_sprite_8.png8x8 bit patternsingle
.msx_sprite_16.png16x16 bit patternsingle
.msx_screen_2.png8x8 bit pattern and 8x8 color datamultiple (.color)

mbtools shrink SIZE IN OUT

Adjust file size.

SIZE is file size by KiB IN is input file path. OUT is output file path.

TODO

  • Add assembler types.
  • Add emulator types.