A apresentação está carregando. Por favor, espere

A apresentação está carregando. Por favor, espere

Programação de homebrews

Apresentações semelhantes


Apresentação em tema: "Programação de homebrews"— Transcrição da apresentação:

1 Programação de homebrews
Nintendo DS Diversão & Jogos Programação de homebrews 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”] Bernardo Bosak de Rezende Tiago Moreira Totti

2 Agenda Homebrews Nintendo DS Desenvolvimento de homebrews no NDS
Conceito, exemplos ao decorrer da história Nintendo DS Aparência, Arquitetura Desenvolvimento de homebrews no NDS Bibliotecas, exemplos de código e demonstrações Links, referências

3 Homebrew O que é? Para que serve?
Software desenvolvido (em geral por fãs de video- game) para hardwares proprietários, com auxílio de kits de desenvolvimento (oficiais ou não- oficiais). Para que serve? Estudo da arquitetura e funcionamento dos hardwares proprietários. Desenvolvimento livre de aplicativos como: Media Players (mp3, Video, ...) Clientes IRC VNC Software de PDA Mensageiros Instantâneos Vários tipos de jogos Emuladores (ScummVM, SNES, Mac+, Commodore64)

4 Exemplos Spacewar (1962) Pong (1966/1972)
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 : Commercialized for home use; also first successful coin-operated video game (Atari) Pong (1966/1972)

5 Space Travel game (1969) 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!!

6 “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 Apple I (1976)

7 Dispositivos atuais para homebrews

8 Aparência e Interface com humano
Nintendo DS: Aparência e Interface com humano

9 Tela inferior é sensível a toque (touch screen)
Duas telas TFT Tela inferior é sensível a toque (touch screen) OBS: TFT = Thin-film Transistor

10 Suporte integrado à redes wireless via Wi-Fi
12 botões para interação

11 16 canais de saída de som Microfone integrado para reconhecimento de voz

12 Arquitetura e funcionamento
Nintendo DS: Arquitetura e funcionamento

13 CPU primária: ARM9 67 MHz, 200-300 MIPS, 16/32 bit
ARM9 – 67 MHz, 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 CPU primária: ARM9 67 MHz, MIPS, 16/32 bit

14 CPU secundária: ARM7 33 MHz, 20 MIPS, 16/32 bit
ARM9 – 67 MHz, 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 CPU secundária: ARM7 33 MHz, 20 MIPS, 16/32 bit

15 Memória principal: 4MB RAM
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) Memória principal: 4MB RAM

16 Memória de vídeo dedicada 656 KB
656KB of video RAM Divided into 9 Banks A-I Accessed indirectly by the GPU in different ways dpending on different video modes Memória de vídeo dedicada 656 KB

17 Outros bancos de memória:
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 Outros bancos de memória: ARM9 caches, ARM7 Fast RAM, shared Fast RAM, DTCM and ITCM

18 Duas portas para memoria Flash externa:
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. Duas portas para memoria Flash externa: Porta p/ software DS software & Porta p/ software GBA (legado)

19

20 Duas CPUs = Duas funções main()
ARM7 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 ARM9

21 Desenvolvimento de Homebrews no NDS

22 Nintendo DS Apple iPhone
Open SDK $399 - $499 (Novo) $500 - $800 (Usado/Destravado) Nintendo – No Homebrew Support -- Why not? Device Cost: New: $ 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 ;)‏ Sem Suporte a Homebrews $115 - $130 (Novo) $40 - $75 (Usado)

23 O DS não foi concebido para ser um dispositivo de homebrews
Preocupações da Nintendo com uso de inovações homebrew para acessar e jogar jogos pirateados

24 Bibliotecas disponíveis para programação de homebrew
devkitARM: ARM preprocessor, compiler & linker libnds: biblioteca baixo-nível do NDS palib:  biblioteca alto-nível do NDS dswifi: suporte para wifi da libnds libfat: gerenciador do sistema de arquivos para i/o DeSmuME and NO$GBA: emuladores para teste 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

25 Apenas Você e os Bits & Chips
Mesmo com as bibliotecas, você deve ter alguma idéia do que está acontecendo em baixo nível, para garantir que o código irá funcionar  Opções para programação: ARM assembly C/C++ 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 DS TV tuner

26 PAlib

27 PAlib Biblioteca utilizada para criar jogos e aplicativos homebrew para o Nintendo DS. Projetada para ser utilizada fácilmente por leigos na arquitetura DS Não é suportada oficialmente pela Nintentdo

28 Ambiente de Desenvolvimento
Podemos utilizar Windows, Linux e MacOS como ambiente de desenvolvimento Ambiente Windows: Instalar o devkitPro =114505&package_id=160396 Deletar o diretório “devkitARM” e substituí-lo pelo devkitARM r21 =114505&package_id=124207&release_id=549080 Baixar o instalador da Palib aller.zip

29 Template de Projeto Para escrever código com a biblioteca Palib, podemos partir de um modelo localizado no diretório \Palib\template. Este modelo é composto por: Diretórios source -> contém os arquivos de código fonte(.c ou .cpp) include-> conterá os arquivos header (.h) data-> arquivos para imagens, som, etc. Arquivos Makefile Logo.bmp Build.bat Clean.bat Project.vhw

30 DEMO Hello World

31 Recursos PAlib A Biblioteca traz suporte a: Sprites Planos de Fundo
Funções matemáticas Trabalhar com sons Trabalhar com sistema de arquivos Leitura de Vídeos Manipulação da Stylus Transferência de Dados & Multiplayer

32 DEMO Follow Stylus

33 DEMO Grafitti Recognizement

34 GPS on the DS (using Google Maps)
Cool Stuff GPS on the DS (using Google Maps)

35 Perguntas & Dúvidas

36 Referências & Links http://www.cis.upenn.edu/~palsetia/cit595s 08/
terS3.zip zip o_DS_Homebrew

37 Obrigado! Bernardo Bosak de Rezende Tiago Moreira Totti
Tiago Moreira Totti


Carregar ppt "Programação de homebrews"

Apresentações semelhantes


Anúncios Google