The Nintendo DS - Computer

  • 500 views
Uploaded on

 

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
500
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
2
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide
  • Introduce: We’re Luke Walker and Craig Schroeder You all know the Nintendo DS as a fun, portable game system [Insert Mario] But: This is a computer science class -- We are serious engineers -- This is a serious presentation about computer science. [Delete Mario; Delete “fun and games”]
  • What we are going to talk about today is the organization and architecture of a special-purpose computer system… And how people -- like you -- who take the time to understand this computer, can program it -- and control it. [Insert subtitle] Introduce Julie: Other presenters had diagrams from HowStuffWorks.com, videos from YouTube, even Flash animations. We have a spokesmodel, who has graciously agreed to play the Nintendo DS throughout our presentation.
  • In college professor handbook -- before you get into too much detail of topic, explain the motivation. 65 million DSs sold since introduction = more than $8.5 Billion in sales!
  • The video game industry employs thousands of people worldwide Constantly recruiting for new talent (including computer science graduates at top universities!)
  • But money and jobs aren’t the most important reasons This presentation is about the importance of understanding the technology you use -- And once you understand it, controlling it -- making it do the things you want. Because the DS is small and manageable, it is a great introduction to homebrew computing.
  • So before we talk about the DS specifically, let’s talk about the Homebrew Computing movement. Homebrew computing is about fun, intellectual challenge, and bragging rights. It is about empowering the individual. People do it as a hobby, not to get paid --so games particularly appealing because they are fun and challenging at the same time. And throughout the history of computing, this fun has led to serious results - innovations from homebrew computing have changed the computer business and changed the world.
  • Almost as long as there have been computers, there have been people who found ways in their own free time to make them play games. In 1962, students and staff at MIT developed Spacewar! on a donated DEC PDP-1 computer -- first shooting game, first space game Pong created in 1966 by Ralph Baer, designed TV sets for Sanders Company. 1972: Commercialized for home use; also first successful coin-operated video game (Atari)
  • Digital Equipment Company PDP-7 computer, Bell Labs Dennis Richie and Ken Thompson Developed a file system and multi-tasking operating system, in part to be able to play Thomson’s Space Travel game Travel through solar system and land on planets Needed to be able to accommodate multiple users and save files This operating system is know today as Unix!!
  • “ The Apple I and II were designed strictly on a hobby, for-fun basis, not to be a product for a company. They were meant to bring down to the[Homebrew Comupting] club…and demonstrate: Look at this, it uses very few chips. It's got a video screen. You can type stuff on it. Personal computer keyboards and video screens were not well established then. There was a lot of showing off to other members of the club. Schematics of the Apple I were passed around freely, and I'd even go over to people's houses and help them build their own.” [Add Apple I photo] “ Steve [Jobs] and I had done a game for Atari-Breakout for the arcades-before games were on microprocessors. We were running the Apple II down at the Homebrew Club, so I thought it would be neat if you could write Breakout in BASIC. I added graphics mode commands to the Integer BASIC I was writing… So that was the reason that color was added in first -- so that games could be programmed... Breakout needs paddles : I had to add a little circuitry for paddle and push button. You need sound : when the ball hits the bricks, ping; when you lose, ehhhh. So I put a speaker in. All of these features were basically just to play one game. These turned out to be common features for the personal computers that have come out since that time.“ So a lot of these features that really made the Apple II stand out in its day came from a game, and the fun features that were built in were only to do one pet project, which was to program a BASIC version of Breakout and show it off at the club. Steve Wozniak
  • The realization of "the personal computer" was brought about by a progressive movement aimed towards bringing the power of computing to the people. 60s Student protests -> 70s computer power to the people Does this "power" still exist today? The early pioneers, The Homebrew Computer Club, believed they could use their skills with bits and chips to change things. Back then, large corporations were the sole wielders of computer power. In many ways this tension between corporate computing interests, and "the people's" computing goals still exists today
  • ARM9 – 67 MHz, 200 - 300 MIPS, RISC 16/32 bit takes care of most computation-intensive tasks, including graphic-related operations (it is the only one that can interact with the 3D rendering engine) ARM7 – 33 MHz, approx. 20 MIPS, RISC 16/32 bit concentrates on input management (touchscreen, most keys), wireless communications, audio output and any GameBoy Advance* emulation. Both ARM processors have optional 16 Bit "Thumb" mode, which is recommended mode to use for homebrewers due to  DS's limited  memory space. . . *The DS is backwards compatible with GameBoy Advance, which had a single ARM7 processor
  • ARM9 – 67 MHz, 200 - 300 MIPS, RISC 16/32 bit takes care of most computation-intensive tasks, including graphic-related operations (it is the only one that can interact with the 3D rendering engine) ARM7 – 33 MHz, approx. 20 MIPS, RISC 16/32 bit concentrates on input management (touchscreen, most keys), wireless communications, audio output and any GameBoy Advance* emulation. Both ARM processors have optional 16 Bit "Thumb" mode, which is recommended mode to use for homebrewers due to  DS's limited  memory space. . . *The DS is backwards compatible with GameBoy Advance, which had a single ARM7 processor
  • 4MB of built-in RAM (main memory) Accessed by both ARMs (but one at a time) When both are trying to access, one will have priority of other Default is ARM7 Rather slow compared to ARM9 caches and ARM7 IWRAM Internal Working RAM This bank stores: ARM9's executable & most game data. NOT: ARM9's stack, or data declared read-only. Could also store ARM7's executable For performance reasons this is usually stored in ARM7's IWRAM ( Internal Working RAM )
  • 656KB of video RAM Divided into 9 Banks A-I Accessed indirectly by the GPU in different ways dpending on different video modes
  • Various other banks ARM 7 Fast RAM (IWRAM) 64KB directly linked to ARM7 Fast Shared RAM two 16KB banks of fast memory Can be assigned to either (not both) ARM7 or ARM9 Usually  assigned to ARM7 -- bringing ARM7 up to 96KB ARM9 Caches DTCM, ITCM (ARM9's stack & complex instructions) Data/Instruction Tightly Coupled Memory DTCM holds ARM9s local Variable stack only 16KB -- careful with your locals! No deep recursion ITCM set aside for often-used 32 bit instructions NVRAM (Non-Volatile) To store flashable firmware
  • Two slots for FLASH cards Slot-1: 'DS specific' 256MB Slot-2: GBA (legacy) port (can serve as 32MB ROM) Homebrewers use tricks for mass storage (i.e. 2GB SD) using this slot.
  • Gaming Tech Guru Best known for his work on Doom, Quake and Wolfenstein 3D
  • Nintendo – No Homebrew Support -- Why not? Device Cost: New: $115 - 130 Used: $40 - $75 (ebay)‏ Apple – Open SDK-- Why can/do they do this? Device Cost: New: $399 8GB (with 2yr service contract) $499 16GB (with 2yr contract)‏ Used: $500 - $800 (unlocked) good luck ;)‏
  • The DS is not meant to be a homebrew device Wifi Demos & Download Play games are protected by an RSA check. Nintendo encrypts these programs with a private key The DS decrypts them with an embedded public key before running them. Many ways have been developed to circumvent these obstacles
  • devkitARM preprocessor, compiler & linker for ARM that knows the DS ROM formats and memory layout libnds a low-level NDS library supports nearly all the NDS features: touchscreen, microphone, 2D/3D hardware a 'thin layer' basically gives names to addresses libfat -- filesystem manager for  r/w to media dswifi an add-on to libnds for wi-fi support PAlib   An optional higher level library Makes coding less tedious with some performance tradeoffs DeSmuME -- an emulator for testing NO$GBA -- an emulator for testing
  • Programming on the DS is possibly the purest experience out there now. There's no OS in the way. Even with the available libraries, it not possible to write code that will work without some knowledge of what is happening at a very low-level within the DS. Programming Options: ARM assembly not practical, although even with the higher level languages knowledge of bit operations and other low-level procedures is required C/C++ requires full build toolchain, so coding, compiling, and linking must be done on a pc DS emulators allow testing in place
  • At the core of any application written for the DS must be two main() functions. One for each CPU. ARM7 Role: The ARM7 is solely responsible for touch screen input, microphone, sound playback, wireless communications, and the real-time clock. The readily available libraries make it so there is rarely a need to write custom code for the ARM7. ARM9 Role: As the main processor, ARM9 runs most of the application specific code. A single ARM9 main() function usually defines: an initialization stage: setting up resources, mem. banks, interrupt handlers, screen modes, wi-fi connections etc. a main loop: game logic, input management (read from ARM7 partly), A/V rendering (with help of 2D/3D engines), etc. a shutdown stage: to stop all systems properly

Transcript

  • 1. The Nintendo DS More than just fun and games.
  • 2. The Nintendo DS Programming and controlling a dedicated-purpose computer system.
  • 3. Why Should I Care?
    •    
    65 million units $8.5 billion sales
  • 4. Why Should I Care?
    •    
  • 5. Why Should I Care?
    •    
  • 6. "Homebrew" Computing The Importance of Fiddling with Things
  • 7. Spacewar (1962) Pong (1966/1972)
  • 8. Space Travel game (1969)
  • 9. Apple I (1976)
  • 10. Who is Into Homebrew Computing?
    • Engineers
    Computer Enthusiasts Tinkerers Geeks Innovators!
  • 11. Inside the Nintendo DS: Hardware
  • 12. Two TFT back-lighted screens Including a resistive touchpad integrated in the bottom screen
  • 13. Integrated wireless networking via Wi-Fi 12 buttons for game-play inputs
  • 14. 16-channel sound output Integrated microphone with limited speech recognition
  • 15. Inside the Nintendo DS: System Architecture and Design
  • 16. First CPU: ARM9 67 MHz, 200-300 MIPS, 16/32 bit
  • 17. Second CPU: ARM7 33 MHz, 20 MIPS, 16/32 bit
  • 18. Main memory: 4MB of built-in RAM
  • 19. Dedicated video RAM 656 KB in 9 memory banks
  • 20. Other memory banks: ARM9 caches, ARM7 Fast RAM, shared Fast RAM, DTCM and ITCM
  • 21. Two slots for external Flash memory: DS software port and legacy GBA software port
  • 22.  
  • 23. Developing for the DS The Nintendo DS Software Development Environment
  • 24. “ It is a shame that homebrew development can't be officially sanctioned and supported, because it would be a wonderful platform for a modern generation of programmers to be able to get a real feel for low level design work, to be contrasted with the high level web and application work that so many entry level people start with.” John Carmack
  • 25. Today's Homebrew Devices
  • 26. Open SDK $399 - $499 (New) $500 - $800 (Used/Unlocked) No Homebrew Support $115 - $130 (New) $40 - $75 (Used) Nintendo DS Apple iPhone
  • 27. The DS is not meant to be a homebrew device… because Nintendo is concerned that people will use homebrew innovations to access and play pirated games .
  • 28.
    • No floating point unit
    • Encryption
    • Dynamic libraries NOT supported
      • Need to synchronize two CPUs
    DS Homebrew Challenges
  • 29. Libraries are available for Homebrew coding
        • devkitARM: ARM preprocessor, compiler & linker
        • libnds: a low-level NDS library
        • palib:  an optional higher level library
        • dswifi: an add-on to libnds for wi-fi support
        • libfat: filesystem manager for  r/w to media
        • DeSmuME and NO$GBA: emulators for testing
  • 30. Just You and the Bits & Chips
    • Even with the available libraries, you must understand
    • what is happening at a very low level, in order to
    • write code that will work.
    • Programming Options:
      • ARM assembly
      • C/C++
    DS TV tuner
  • 31. Two CPUs = Two (main) functions ARM7 ARM9
  • 32. Check out what you can program on a Nintendo DS!
  • 33. GPS on the DS (using Google Maps)
  • 34. Any questions?
  • 35.