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
//! The main API of GGBASM is the [RomBuilder] struct. //! //! Various methods are called on the RomBuilder to insert assembly, graphics and raw bytes. //! //!``` //! # fn foo() -> Result<(), failure::Error> { //! # use ggbasm::header::*; //! # let colors_map = std::collections::HashMap::new(); //! # let header = Header { //! # title: String::from(""), //! # color_support: ColorSupport::Unsupported, //! # licence: String::new(), //! # sgb_support: false, //! # cartridge_type: CartridgeType::Mbc5Ram, //! # ram_type: RamType::Some32KB, //! # japanese: false, //! # version_number: 0, //! # }; //! //! use ggbasm::RomBuilder; //! //! RomBuilder::new()? //! // Starts off in the first rom bank //! // A simple example doesnt need to deal with interrupts and jumps, so generate a dummy //! .add_basic_interrupts_and_jumps()? //! //! // generate a header from data in the passed header struct //! .add_header(header)? //! //! // Add game code via an asm file //! .add_asm_file("main.asm")? //! //! // Add an image to the second rom bank //! .advance_address(1, 0)? //! .add_image("tiles.png", "Tileset", &colors_map)? //! //! // Consume the RomBuilder and write the rom to disk //! .write_to_disk("my_cool_game.gb")?; //! # Ok(()) //! # } //!``` //! //! The RomBuilder searches for images in the `graphics` directory and assembly files in the //! `gbasm` directory. //! These directories are in the root directory of the crate, the innermost directory containing a //! `Cargo.toml` file. //! //! ## Parser //! //! If you are after a lower level api, the [parser] and [ast] modules can be used without the RomBuilder. //! You can also construct the ast types yourself and give them to the RomBuilder. #![recursion_limit="1024"] // Used for large nom parsers pub mod constants; pub mod header; pub mod ast; pub mod parser; pub mod audio; mod rom_builder; pub use self::rom_builder::Color; pub use self::rom_builder::RomBuilder;