ruby2600:一个实验性的 Atari:trade_mark: 2600 模拟器,100% 用 Ruby 编写

  • K1_736433
    了解作者
  • 67.1KB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-05-24 05:43
    上传日期
Ruby2600 一个实验性的 Atari:trade_mark: 2600 模拟器,100% 用 Ruby 编写。 这些展示了一般架构和基本原理。 当前状态 没有明显的毛刺工作游戏包括: 陷阱! 太空侵略者 河流突袭 吃豆人 网球 大金刚 您可以加载大多数 2K 和 4K 推车并试用它们。 速度非常低:在 2.3Ghz 的计算机上大约 ~2 FPS(从预期的 60)。 展示了模拟器如何全速运行。 此外,没有模拟声音,也没有模拟除控制台开关和播放器 0 操纵杆以外的任何控制器。 查看下面的和以获取更多信息。 安装 标准 Ruby (MRI) 将使用来显示帧并捕获用户输入,因此您需要确保已安装其依赖项。 在 OS X 上,这可以解决问题: brew install sdl2 libogg libvorbis (如果您在使用内置 SWT 的 JRuby 上运行,或者您将无头运行,则不需要它)
ruby2600-main.zip
内容介绍
# ruby2600 An experimental Atari™ 2600 emulator, 100% written in Ruby. [![ruby2600](http://i.imgur.com/Zjgibpr.png "ruby2600")](http://www.slideshare.net/chesterbr/ruby2600-an-atari-2600-emulator-written-in-ruby) These [RubyConfBr 2013 slides](http://www.slideshare.net/chesterbr/ruby2600-an-atari-2600-emulator-written-in-ruby) showcase the general architecture and rationale. ## Current status [![Build Status](https://travis-ci.com/chesterbr/ruby2600.svg?branch=master)](https://travis-ci.com/chesterbr/ruby2600) Games **working** with no noticeable glitches include: - *Pitfall!* - *Space Invaders* - *River Raid* - *Pac-Man* - *Tennis* - *Donkey Kong* You can load most 2K and 4K carts and try them out. Speed is very low: about ~2 FPS (from the expected 60) on a 2.3Ghz computer. An [accelerated video](http://www.youtube.com/watch?v=S3qAOu41CxE) shows how the emulator would run in full speed. Also, no sound is emulated, nor any controllers other than the console switches and player 0 joystick. Check the [Known Issues](#known-issues) and [FAQ](#faq) below for more information. ![screenshot](http://i.imgur.com/kN9Yxsi.png "Pitfall! on ruby2600, as of Aug 4") ## Installation Standard Ruby (MRI) will use [Gosu](http://www.libgosu.org/) to display the frames and capture user input, so you need to ensure its dependencies are installed. On OS X, this does the trick: brew install sdl2 libogg libvorbis (you don't need that if you run on JRuby - which uses the built-in SWT - or if you will run headless) git clone git@github.com:chesterbr/ruby2600.git cd ruby2600 # cp .ruby-version-for-jruby .ruby-version # Only for JRuby rvm install # (or rbenv install, or whatever you need to install the Ruby in .ruby-version) gem install bundler bundle ## Usage To run on MRI: bundle exec ruby -Ilib bin/ruby2600 /path/of/your/romfile.bin If you're using JRuby: bundle exec jruby -J-XstartOnFirstThread -Ilib bin/ruby2600-swt /path/of/your/romfile.bin For profiling/performance testing, you'll likely prefer headless mode, e.g.: bundle exec ruby-prof bin/ruby2600-headless /path/of/your/romfile.bin 1 (the number in the end is the number of frames to run; an extra one will be added, since first frame of most games is kind of bogus) Notice you can add support to other VMs by creating a run script under [`/bin`][https://github.com/chesterbr/ruby2600/tree/master/bin]. ### Keys - *↑ ← ↓ →* - Player 0 joystick - *Space* - Player 0 fire button - *1* - GAME SELECT switch - *2* - GAME RESET switch - *3/4* - Color switch (3 = Color; 4 = black and white) - *5/6* - Player 0 difficulty switch (5 = Beginner, 6 = Advanced) - *7/8* - Player 1 difficulty switch (7 = Beginner, 8 = Advanced) - *W/A/S/D* - "Sticky" Player 0 joystick (to stop moving, press the non-sticky matching arrow) ## Technical details - Full 650x CPU instruction set emulation and test, [cloc](http://cloc.sourceforge.net/)-ing less than 380 lines of code. (hardware interrupts not emulated, since the 2600 does not have those); - RIOT fully implemented and tested; - All bus mirrorings implemented and tested; console switches and P0 joystick bindings available for any pluggable front-end. - TIA registers are all emulated, with the exception of audio (AU*) and hardware test (RSYNC); - Every single aspect of the emulated code is spec-ed, except for some TIA parts I am still figuring out. CPU/RIOT are pretty final, TIA might still be refactored since it suffered a lot of crazy stabs due to the lack of documentation (see below). ## Known issues - Objects rendered close to the left side (counter zeroing during HBLANK, I suppose) sometimes render in wrong positon (see diagonal.bin test); - Some games display an artifact at the left side (late hblank area) where there should be nothing (Freeway, Boxing); - Donkey Kong is rendered one pixel off its Stella position; - Seaquest renders a full scanline with the diver (missile?) at some specific situations. This bug and the three above it might be related (some odd rendering on a specific postion); - Enduro and Jawbreaker render their frames a few dozen scanlines after the right position (Enduro leaves some trash behind, Jawbreaker leaves a black space), cutting the lower part; - Maybe UI should dynamically adjust to games that (intentionally) generate larger/smaller frames; - Emulator only supports NTSC games - not sure if it's worth the hassle of supporting PAL/SECAM anyway, as most(all?) PAL games are NTSC versions, and SECAM, well… sucks. - Should display the logo during startup (either by overriding first few calls to frame, or by running a bootstrap ROM that shows it). ### Technical debt: - MRI startup script could be improved (just quickly slapped a [Gosu](http://www.libgosu.org/) script on /bin to make it playable; - Add an Opal generation/running script (see [this post](http://chester.me/archives/2014/02/running-ruby2600-in-a-browser-with-opal/) on running ruby2600 on Opal) - TIA tests don't cover a few aspects (see "Pending" specs); - `Bus` should auto-initialize the components when receiving a string (either on initialize or on a separate method); - *Maybe* `Player`/`Ball`/`Missile`/`Playfield` should not be separate classes, since most of their code is "configuration" for the generic `Graphic` (and its `Counter`). - There is some overuse of "magic" in CPU tests (mostly syntatic sugar to keep them descritive). Maybe it should be more properly encapsulated (outside of the test class itself). - RSpec 3 would improve the semantics (and even make some of the aforementioned magic unnecessary) - Convert this list to Github issues. ## FAQ #### Why? I had two (somewhat) unrelated goals for this year: - Learning more about the 2600 (to write a game in the future); - Getting more proficient with Ruby and RSpec. The emulator is the way I found to tackle both at once. Also, I wanted to test how well such tools coped with emulator development. Performance aside, it was a huge success: an emulator for a very tricky and under-documented system in ~3 months, written by someone that never wrote a full emulator before. #### How good is it? Not really good if your goal is playing games. Keep in mind that: - It is **slow** (~1/30 of a real Atari on my computer). - It has **no sound**. - It has **a few glitches**. It is good, however, if you want to learn more about the 2600, as the lack of concerns with speed makes the code more accessible than the average emulator. #### Will you make it faster/add sound? Now that ruby2600 reached reasonable compatibility with general games (remaining glitches are unlikely to change the emulator structure in any aspect related to performance), it can be worked. See the slides mentioned above for some planned strategies. If you want a full-speed emulator with sound and compatible with every single game under the sun, I wholehartedly recommend [Stella](http://stella.sourceforge.net/) - which has been an invaluable source of inspiration, debug help and implementation reference. It's what I use to play (other than my real Atari). #### Is this logo renderable on an Atari? Not sure, I did it one day I was too bored to write code or slides. I'd say yes (as a playfield), as long as you are flexible with the background color (or use another object to render the characters). But I liked it, so I might eventually try to make a ROM that displays it. #### How to browse the source code? The slides mentioned above will give you an overview of the core classes. If you understand Atari architecture well, you may start with [`Bus`](https://github.com/chesterbr/ruby2600/blob/master/lib/ruby2600/bus.rb) (which, unsurprisingly, connects all the pieces together). [`CPU`](https://github.com/chesterbr/ruby2600/blob/master/lib/ruby2600/cpu.rb) is completely independent and may also be a good starting point. ## Optimization Ideas Here is a backlog of things that may help towards increasing perform
评论
    相关推荐
    • trailblazer:Ruby的高级架构
      Trailblazer为Ruby框架提供了新的高级抽象。 它轻柔地执行封装,直观的代码结构,并以功能性思维方式对复杂的业务工作流进行建模。 文献资料 本文档讨论Trailblazer 2.1。 有关新增功能的概述。 我们正在开发几个新...
    • oxford_dictionary:牛津字典API的Ruby包装器
      Ruby包装器使用 入门 $ gem install oxford_dictionary # To use in your script/application require 'oxford_dictionary' 注册API密钥后,请设置客户端: client = OxfordDictionary :: Client . new ( app_id ...
    • Ruby_向ruby之父学程序设计(第二版)(经典入门)
      第一部分:通过简单的Ruby程序来介绍程序的基本架构。  第二部分:介绍基础语法规则,以及类、模块等面向对象程序设计的思考方法与用词。   第三部分:对一些基础类逐一介绍其功能与用法。 第四部分:介绍一些...
    • 为使用和弦输入的ANSI键盘设计的Rime Nihongo输入架构。-Ruby开发
      日本和弦是一款为ANSI、ISO、60%、40% 键盘设计的多键并击输入日本语的方法, 日本和弦日本语コード配方:℞ nihonchord Rime 日本和弦输入方案简介日本和弦是一款为ANSI 、ISO、60%、40% 键盘设计的多键并击输入...
    • dotenv-schema:为 dotenv 定义架构
      dotenv 模式 Dotenv-schema 使模式化。 安装 编写.env和.env_schema : $ cat .env ...DB_PORT=3306 $ cat .env_schema DB_HOST: ...Sinatra 或Plain ol' Ruby $ gem install dotenv require 'dotenv-
    • 从RSpec请求规范生成OpenAPI模式-Ruby开发
      根据RSpec请求规范生成OpenAPI架构。 rspec-openapi根据RSpec请求规范生成OpenAPI架构。 这是什么? 有一些宝石可以根据RSpec请求规范生成OpenAPI规范。 但是,它们需要专用于这些gem的特殊DSL,并且我们无法按原样...
    • parametric:Ruby应用程序的声明式输入模式
      Ruby对象中声明性地定义数据模式,并使用它们将白名单,验证或转换为程序的输入。 对于构建自定义API,搜索或表单对象很有用。 或者可以替代Rails的强参数(它不依赖于Rails,可以独立使用)。 架构图 定义架构 ...
    • Ruby-Trailblazer构建在Rails之让提供一个直观的代码结构并给你一个面向对象的架构
      Trailblazer 构建在Rails之让,提供一个直观的代码结构并给你一个面向对象的架构
    • 榴弹炮:基于Ruby的验收测试框架
      快速安装和配置完整的测试基础架构(不到5分钟)。 下方是优雅,直观且功能强大的Ruby语言。 可以选择您喜欢的BDD工具(Cucumber,RSpec或芜菁)。 与SauceLabs,Testingbot,BrowserStack,CrossBrowserTesting...
    • GaussDB_100_1.0.1-DATABASE-REDHAT-64bit.tar.gz
      guassdb100在redhat上安装包,单机部署的包,安装步骤请看我的文中介绍,经过大量实验搭建总结出来的文档