### memory_view setup Source: https://docs.mamedev.org/techspecs/memory.html Example of setting up a memory view object. ```cpp memory_view m_view; [device constructor] m_view(*this, "name"), ``` -------------------------------- ### Loading software list from cartridge slot Source: https://docs.mamedev.org/usingmame/usingmame.html Example of starting MAME for a system and selecting software from the cartridge slot. ```bash mame.exe nes ``` -------------------------------- ### Producing Example Settings Source: https://docs.mamedev.org/usingmame/ui.html Step-by-step examples for creating specific input assignments. ```text Kbd 1 ``` ```text Kbd F12 Kbd Shift Keyboard Alt ``` ```text Kbd P not Kbd Shift not Kbd Right Shift ``` -------------------------------- ### Background Input Example Source: https://docs.mamedev.org/commandline/commandline-all.html Example of enabling background input. ```bash mame -background_input ssf2tb ``` -------------------------------- ### Keyboard Provider Example Source: https://docs.mamedev.org/commandline/commandline-all.html Example of choosing a keyboard input provider. ```bash mame c64 -keyboardprovider win32 ``` -------------------------------- ### wpenable examples Source: https://docs.mamedev.org/debugger/watchpoint.html Examples demonstrating the usage of the wpenable command. ```text wpenable 3 Enable the watchpoint with index 3. ``` ```text wpenable Enable all watchpoints. ``` -------------------------------- ### Mouse Provider Example Source: https://docs.mamedev.org/commandline/commandline-all.html Example of choosing a mouse input provider. ```bash mame indy_4610 -mouseprovider win32 ``` -------------------------------- ### HTTP Server Enable Example Source: https://docs.mamedev.org/commandline/commandline-all.html Example of enabling the HTTP server. ```bash mame -http ``` -------------------------------- ### Mouse Input Example Source: https://docs.mamedev.org/commandline/commandline-all.html Example of enabling mouse input. ```bash mame centiped -mouse ``` -------------------------------- ### Command prompt example for Unitron 1024 Source: https://docs.mamedev.org/usingmame/assetsearch.html Demonstrates how MAME reports missing ROMs when starting a system from the command line, including search paths. ```bash mame utrn1024 -kbd frp 342-0341-a.u6d NOT FOUND (tried in utrn1024 macplus) 342-0342-a.u8d NOT FOUND (tried in utrn1024 macplus) 341-0332-a.bin NOT FOUND (tried in mackbd_m0110a_f mackbd_m0110a utrn1024 macplus) ``` -------------------------------- ### Controller Configuration Example Source: https://docs.mamedev.org/commandline/commandline-all.html Example of specifying a controller configuration file. ```bash mame dkong -ctrlr xarcade ``` -------------------------------- ### wpset examples Source: https://docs.mamedev.org/debugger/watchpoint.html Examples demonstrating the usage of the wpset command with different parameters. ```text wp 1234,6,rw Set a watchpoint for the visible CPU that will halt execution whenever a read or write to the first address space occurs in the address range 1234-1239, inclusive. ``` ```text wp 23456:data,a,w,wpdata == 1 Set a watchpoint for the visible CPU that will halt execution whenever a write to the `data` space occurs in the address range 23456-2345f and the data written is equal to 1. ``` ```text wp 3456:maincpu,20,r,1,{ printf "Read @ %08X\n",wpaddr ; g } Set a watchpoint for the CPU with the absolute tag path `:maincpu` that will halt execution whenever a read from the first address space occurs in the address range 3456-3475. When this happens, print **Read @ ** to the debugger console and resume execution. ``` ```text temp0 = 0 ; wp 45678,1,w,wpdata==f0,{ temp0++ ; g } Set a watchpoint for the visible CPU that will halt execution whenever a write to the first address space occurs at address 45678 where the value being written is equal to f0. When this happens, increment the variable **temp0** and resume execution. ``` -------------------------------- ### wpclear examples Source: https://docs.mamedev.org/debugger/watchpoint.html Examples demonstrating the usage of the wpclear command. ```text wpclear 3 Clear the watchpoint with index 3. ``` ```text wpclear Clear all watchpoints. ``` -------------------------------- ### Plugins Enable Example Source: https://docs.mamedev.org/commandline/commandline-all.html Example of enabling the use of Lua Plugins. ```bash mame apple2e -plugins ``` -------------------------------- ### Lightgun Input Example Source: https://docs.mamedev.org/commandline/commandline-all.html Example of enabling lightgun input. ```bash mame lethalen -lightgun ``` -------------------------------- ### wpdisable examples Source: https://docs.mamedev.org/debugger/watchpoint.html Examples demonstrating the usage of the wpdisable command. ```text wpdisable 3 Disable the watchpoint with index 3. ``` ```text wpdisable Disable all watchpoints. ``` -------------------------------- ### Joystick Input Example Source: https://docs.mamedev.org/commandline/commandline-all.html Example of enabling joystick input. ```bash mame mappy -joystick ``` -------------------------------- ### Network Provider Example Source: https://docs.mamedev.org/commandline/commandline-all.html Example of setting the network provider to pcap. ```bash mame -networkprovider pcap apple2ee -sl3 uthernet ``` -------------------------------- ### Controller Map Example Source: https://docs.mamedev.org/commandline/commandline-all.html Example of specifying a controller mapping file. ```bash mame -controller_map gamecontrollerdb.txt sf2ce ``` -------------------------------- ### Joystick Provider Example Source: https://docs.mamedev.org/commandline/commandline-all.html Example of setting the joystick provider to winhybrid. ```bash mame mk2 -joystickprovider winhybrid ``` -------------------------------- ### Using a non-standard GCC/GNU libstdc++ installation on Linux example Source: https://docs.mamedev.org/initialsetup/compilingmame.html Example command for building MAME with an alternate GCC installation in a custom location on Linux. ```bash make OVERRIDE_CC=/opt/local/gcc72/bin/gcc OVERRIDE_CXX=/opt/local/gcc72/bin/g++ ARCHOPTS=-Wl,-R,/opt/local/gcc72/lib64 ``` -------------------------------- ### Using Object Finders After Start Source: https://docs.mamedev.org/techspecs/object_finders.html Example of using object finders after the emulated machine has started. ```cpp void a2bus_parprn_device::write_c0nx(u8 offset, u8 data) { ioport_value const cfg(m_input_config->read()); m_printer_out->write(data & (BIT(cfg, 8) ? 0xffU : 0x7fU)); m_printer_conn->write_strobe(BIT(~cfg, 3)); } u8 a2bus_parprn_device::read_cnxx(u8 offset) { offset ^= 0x40U; return m_prom[offset]; } ``` -------------------------------- ### Get attotime as a double Source: https://docs.mamedev.org/luascript/ref-core.html Example of getting the time interval in seconds as a floating-point value. ```lua t:as_double() ``` -------------------------------- ### Generator Parameter Examples Source: https://docs.mamedev.org/techspecs/layout_files.html Examples of generator parameters with different start, increment, and shift attributes. ```xml ``` ```xml ``` ```xml ``` -------------------------------- ### trace command examples Source: https://docs.mamedev.org/debugger/execution.html Examples of how to use the trace command to start or stop execution tracing for CPUs. ```bash trace joust.tr ``` ```bash trace dribling.tr,maincpu ``` ```bash trace starswep.tr,,noloop ``` ```bash trace starswep.tr,1,logerror ``` ```bash trace starswep.tr,0,logerror|noloop ``` ```bash trace >>pigskin.tr ``` ```bash trace off,0 ``` ```bash trace asteroid.tr,,,{tracelog "A=%02X ",a} ``` -------------------------------- ### UI Font Provider Example Source: https://docs.mamedev.org/commandline/commandline-all.html Example of choosing a UI font provider. ```bash mame ajax -uifontprovider dwrite ``` -------------------------------- ### Get the running machine instance Source: https://docs.mamedev.org/luascript/ref-core.html Example of getting the running machine instance for the current emulation session. ```lua manager.machine ``` -------------------------------- ### Get attotime as ticks Source: https://docs.mamedev.org/luascript/ref-core.html Example of getting the attotime interval as a whole number of periods at a specified frequency. ```lua t:as_ticks(frequency) ``` -------------------------------- ### View Instantiation Example Source: https://docs.mamedev.org/techspecs/layout_files.html This example demonstrates how to instantiate and position a screen, an individual layout element, and two element groups within a view. ```xml ``` -------------------------------- ### Loading software from a software list Source: https://docs.mamedev.org/usingmame/usingmame.html Example of loading a specific game from a software list. ```bash mame.exe nes metroidu ``` -------------------------------- ### Get attotime as megahertz Source: https://docs.mamedev.org/luascript/ref-core.html Example of interpreting an attotime interval as a period and getting the corresponding frequency in megahertz. ```lua t:as_mhz() ``` -------------------------------- ### Get attotime as kilohertz Source: https://docs.mamedev.org/luascript/ref-core.html Example of interpreting an attotime interval as a period and getting the corresponding frequency in kilohertz. ```lua t:as_khz() ``` -------------------------------- ### Aspect Ratio Option Example 2 Source: https://docs.mamedev.org/commandline/commandline-all.html Example of setting different aspect ratios for multiple windows. ```bash mame pc_cntra -numscreens 2 -aspect0 16:9 -aspect1 5:4 ``` -------------------------------- ### Get attotime as Hertz Source: https://docs.mamedev.org/luascript/ref-core.html Example of interpreting an attotime interval as a period and getting the corresponding frequency in Hertz. ```lua t:as_hz() ``` -------------------------------- ### Memory bank creator for dynamic installation Source: https://docs.mamedev.org/techspecs/object_finders.html Example of using memory_bank_creator to dynamically install a memory bank in a MAME driver. ```cpp class vegaeo_state : public eolith_state { public: vegaeo_state(machine_config const &mconfig, device_type type, char const *tag) : eolith_state(mconfig, type, tag), m_qs1000_bank(*this, "qs1000_bank") { } void init_vegaeo(); private: memory_bank_creator m_qs1000_bank; }; void vegaeo_state::init_vegaeo() { // Set up the QS1000 program ROM banking, taking care not to overlap the internal RAM m_qs1000->cpu().space(AS_IO).install_read_bank(0x0100, 0xffff, m_qs1000_bank); m_qs1000_bank->configure_entries(0, 8, memregion("qs1000:cpu")->base() + 0x100, 0x10000); init_speedup(); } ``` -------------------------------- ### Lightgun Provider Example Source: https://docs.mamedev.org/commandline/commandline-all.html Example of choosing a light gun input provider. ```bash mame lethalen -lightgunprovider x11 ``` -------------------------------- ### Get Software List Command Example Source: https://docs.mamedev.org/commandline/commandline-all.html Example of using the -getsoftlist command to display the contents of a specific software list. ```bash mame -getsoftlist apple2_flop_orig ... ``` -------------------------------- ### HTTP Root Example Source: https://docs.mamedev.org/commandline/commandline-all.html Example of choosing a custom HTTP server document root folder. ```bash mame apple2 -http -http_port 6502 -http_root C:\Users\me\appleweb\root ``` -------------------------------- ### Live I/O port field state instantiation Source: https://docs.mamedev.org/luascript/ref-input.html Example of how to get the live state for an I/O port field using its tag and mask. ```Lua manager.machine.ioport.ports[tag]:field(mask).live ``` -------------------------------- ### View setup Source: https://docs.mamedev.org/techspecs/memory.html Setting up a view in an address map. ```C++ map(start, end).view(m_view); m_view[0](start1, end1).[...]; ``` -------------------------------- ### Loading a loose software file (NES) Source: https://docs.mamedev.org/usingmame/assetsearch.html Example of starting the Nintendo Entertainment System/Famicom system with a specific loose software file mounted in the cartridge slot. ```bash mame nes -cart amazon_diet_EN.nes ``` -------------------------------- ### Loading a loose software file from an archive (Osborne-1) Source: https://docs.mamedev.org/usingmame/assetsearch.html Example of starting the Osborne-1 system with the first file from a ZIP archive mounted in the first floppy disk drive. ```bash mame osborne1 -flop1 os1xutils.zip ``` -------------------------------- ### Layout File Events - Resolve Tags Callback Source: https://docs.mamedev.org/techspecs/layout_script.html Example of setting a callback function for the resolve tags event in MAME layout scripting. This function is called after the emulated system starts and tags are resolved. ```lua file:set_resolve_tags_callback(cb) ``` -------------------------------- ### Listing clones of systems Source: https://docs.mamedev.org/commandline/commandline-all.html Demonstrates how to list clones of MAME systems, with examples showing how to list all clones or clones matching a specific pattern. ```bash mame pacman -listclones ``` ```bash mame puckman -listclones ``` -------------------------------- ### Go Command Examples Source: https://docs.mamedev.org/debugger/execution.html Examples demonstrating the usage of the 'go' command to resume execution. ```text g Resume execution until a breakpoint/watchpoint is triggered, or a break is manually requested. g 1234 Resume execution, stopping at address 1234, unless another condition causes execution to stop before then. ``` -------------------------------- ### Loading a loose software file from a specific file within an archive (Macintosh Plus) Source: https://docs.mamedev.org/usingmame/assetsearch.html Example of starting the Macintosh Plus system with a specific file from a ZIP archive mounted in the first floppy disk drive. ```bash mame macplus -flop1 "sys603.zip/system tools.img" ``` -------------------------------- ### hardreset command example Source: https://docs.mamedev.org/debugger/general.html Example of executing a hard reset. ```bash hardreset Executes a hard reset. ``` -------------------------------- ### UI Active Example Source: https://docs.mamedev.org/commandline/commandline-all.html Example of enabling user interface on top of emulated keyboard. ```bash mame apple2e -ui_active ``` -------------------------------- ### softreset command example Source: https://docs.mamedev.org/debugger/general.html Example of executing a soft reset. ```bash softreset Executes a soft reset. ``` -------------------------------- ### Resolution Option Example Source: https://docs.mamedev.org/commandline/commandline-all.html Example of setting specific resolutions for multiple windows. ```bash mame pc_cntra -numscreens 2 -resolution0 1920x1080 -resolution1 1280x1024 ``` -------------------------------- ### Keyboard Base Example Source: https://docs.mamedev.org/techspecs/object_finders.html Example of a keyboard_base class using required_ioport_array for rows. ```cpp class keyboard_base : public device_t, public device_mac_keyboard_interface { protected: keyboard_base(machine_config const &mconfig, device_type type, char const *tag, device_t *owner, u32 clock) : device_t(mconfig, type, tag, owner, clock), device_mac_keyboard_interface(mconfig, *this), m_rows(*this, "ROW%u", 0U) { } u8 bus_r() { u8 result(0xffU); for (unsigned i = 0U; m_rows.size() > i; ++i) { if (!BIT(m_row_drive, i)) result &= m_rows[i]->read(); } return result; } required_ioport_array<10> m_rows; }; ``` -------------------------------- ### Console Enable Example Source: https://docs.mamedev.org/commandline/commandline-all.html Example of enabling the emulator Lua Console window. ```bash mame ibm5150 -console ``` -------------------------------- ### traceflush command example Source: https://docs.mamedev.org/debugger/execution.html Example demonstrating the usage of the traceflush command. ```bash traceflush ``` -------------------------------- ### Listing available media for a system Source: https://docs.mamedev.org/usingmame/usingmame.html Command to list available media switches for a given system. ```bash mame.exe < system> -listmedia ``` -------------------------------- ### View Installation Source: https://docs.mamedev.org/techspecs/memory.html Functions to install a view into a space. Views can be installed once per space and must not have been set up via the address map API. Variants can be selected by indexing. ```cpp space.install_view(addrstart, addrend, view) space.install_view(addrstart, addrend, addrmirror, view) view[0].install... ``` -------------------------------- ### Resolution Switching Example Source: https://docs.mamedev.org/commandline/commandline-all.html Example of enabling resolution switching for full-screen mode. ```bash mame kof97 -video d3d -switchres -resolution 1280x1024 ``` -------------------------------- ### Listing system driver names and descriptions Source: https://docs.mamedev.org/commandline/commandline-all.html Demonstrates how to list system driver names and their corresponding descriptions, with an option to filter by a pattern. ```bash mame -listfull galaxian* ```