GithubHelp home page GithubHelp logo

trevorjay / marios-binary-factory Goto Github PK

View Code? Open in Web Editor NEW
9.0 5.0 0.0 36 KB

Extremely simple (no expressions or macros) strict 3-column assembler for the Sharp SM510.

License: GNU Affero General Public License v3.0

Haxe 13.23% Assembly 0.69% Python 86.08%

marios-binary-factory's Introduction

marios-binary-factory

Extremely simple (no expressions or macros) strict 3-column assembler for the Sharp SM510.

Description

Mario's Binary Factory (mbf) is an extremely simple assembler for the Sharp SM510. It is a strictly 3-column assembler. Odd things will happen if your code breaks it's expected [LABEL] [OPCODE] [OPERAND] format (though a few corner cases involving comments are handled correctly).

It produces mame-compatible ROMs that are padded to 64 bytes per "page" and padded overall to 4096 bytes. I'm not sure of the format for the original ROMs but since these already account for the SM510's unique program counter order, conversion should be straight-forward.

Requirements

  • to assemble: Python 3
  • to run the ROMs: mame and the SVG overlay files from a suitable donor system that uses the SM510.
  • to build: haxe

Example Usage

This example assembles the test.asm program. In this example, we'll use "Mickey & Donald" as the donor system but any SM510 system that mame supports should work. Start by copying the needed zipfile (gnw_mickdon.zip in this case) to the same directory as mbf.py. Make sure to make a back-up of the zipfile as this process will replace the original ROM and keep only the overlay art.

Explode gnw_mickdon.zip in the local directory:

python3 -m zipfile -e gnw_mickdon.zip .

Assemble test.asm, overriding the original ROM:

python3 mbf.py test.asm dm-53_565

Re-zip gnw_mickdon.zip with the replacement ROM:

python3 -m zipfile -c gnw_mickdon.zip dm-53_565 gnw_mickdon_*

Run mame with the replacement ROM

mame -rompath . gnw_mickdon

Note that I haven't found a way to launch original ROMs via the GUI. However, you can do so with the command line. If you launch the ROM directly from the command line as I've done here, you'll be given a chance to type "OK" and run despite the hash not being what mame expects.

The test ROM should work with any SM510-based system (not just "Mickey & Donald") for which overlay art is available and should flash every (non-bs) LCD segment all at once. The filenames of the ROM to replace and the SVG to include will change from system to system.

Features

Comments

; Comments begin with ; and continue to the end of the line.
        SKIP ; Comments should be able to follow any other content.

Global Labels

LOOP
        EXC     $0
        T       LOOP

or

LOOP    EXC     $0
        T       LOOP

Global Constants

FOO     equ     $2
        LAX     FOO

Direct writes

        .word   $0

Note that even though the CPU is 4-bit, the ROM-space is 8-bit and thus .word writes a full byte and not a nibble.

Location Counter Control

.org    $DC0

Supported Opcodes

ADD, ADD11, ADX, ATBP, ATFC, ATL, ATPL, ATR, BDC, CEND, COMA, DC, DECB, EXBLA, EXC, EXCD, EXCI, IDIV, INCB, KTA, LAX, LB, LBL, LDA, RC, RM, ROT, RTN0, RTN1, SBM, SC, SKIP, SM, T, TA0, TABL, TAL, TAM, TB, TC, TF1, TF4, TIS, TL, TM, TMI, TML, WR, WS

Limitations

Layout

The assembler depends on a strict 3-column [LABEL] [OPCODE] [OPERAND] format. Even having trailing space (that doesn't lead into a comment) is likely to cause problems. If you're having trouble getting correct output, look for extraneous whitespace in your assembly. This includes "empty" lines (i.e. lines which just have a newline) which are interpreted as SKIPs. If you want an empty line, make ; its first character.

Numbers

The assembler only understands hexadecimal numbers of the form $XXXX. It will handle shorter numbers appropriately. For example: $0045 is 69 but so is $45, $2 is 2, and so on. It doesn't do size checking. It's up to you to know if an operation can handle two bytes ($XXXX), a byte ($XX), a nibble ($X), 2-bits ($X <= 3), or a single bit ($X <= 1). You're always free to use leading zeroes regardless.

Creating the Python script

The mbf.py script is generated from Haxe source:

haxe build.hxml

Thanks

Many thanks to Sean Riddle, Paul Robson, and hap. Their research has made homebrew LCD game development and emulation "practical".

Special thanks to everyone at the MAME project working hard to preserve handheld history as accurately as possible.

marios-binary-factory's People

Contributors

harrylime avatar trevorjay avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.