BYO Java RetroPi Console
Stephen Chin (@steveonjava)
Lead Java Community Manager
JavaOne Conference Co-Chair
Java Community Management is pretty hard…
314
Java User Groups 9M+Java
Developers
150+ 150+
Java Champions
50+ JUG groups
contributing
to JCP
2
Community
3
NEW CHALLENGER!!!
Emulating the NES is a real challenge!
826
ROMs to Test
Plus Homebrew!
92M
61 Million Units
Sold Worldwide
3,510
Transistors
Synchronization
Points
4
Nintendo
Entertainment
System
https://commons.wikimedia.org/wiki/File:RP2A07.jpg
5
6
7
Up-Up-Down-Down-Left-Right-
Left-Right B, A, Start
8
9
Electronics
10
https://commons.wikimedia.org/wiki/File:Raspberry_Pi_2_Model_B_v1.1_front_angle_new.jpg
=
Have Java With Your Dessert
http://elinux.org/File:Raspi-Model-AB-Mono-2-699x1024.png
And what are these for?
http://i.imgur.com/k0Puu.jpg
Portable Display Options
Graphics Bus Quality Speed Power Usage
Composite Low Fast High
HDMI High Fast High
SPI High Slow Low
Device Tree High Fast Low
14
Adafruit Kippah
• Connects to 40 pin LCD connector
• Connects display via Device Tree GPIO
• Powers Display off Raspberry Pi 5V VCC
• Optional touch support via USB
• Uses I2C, UART, and SPI pins… only 6 GPIO left over
15
NES Controller
16
1
2
3
45
6
7
8
17
Diodes to the Rescue!
19
Left
Right
Start
20
Button Layout
21
Soldering to the Kippah
22
All Wires Connected
23
24
Java HalfNes Emulator
25
HalfNes Project
26
https://github.com/andrew-hoffman/halfnes
27
28
29
30
32
Which Are the Real Performance Bottlenecks?
• Swing Video via X-Windows
• Synchronization between CPU, PPU, APU
– Return to per-line instead of per-pixel
• Bitwise Helper Functions
• Extracting PPU Operations
• Replace APU Double Math with Longs
• Array Access via Unsafe
• Replace loops with System.arraycopy
• PWM Audio
33
HalfNes Performance Bottlenecks
• Swing Video via X-Windows
• Synchronization between CPU, PPU, APU
– Return to per-line instead of per-pixel
• Bitwise Helper Functions
• Extracting PPU Operations
• Replace APU Double Math with Longs
• Array Access via Unsafe (Doesn't actually help)
• Replace loops with System.arraycopy
• PWM Audio
34
3D Printing a Case
35http://vidal-design.deviantart.com/art/Mario-Versus-Bullet-Bill-3D-printed-402524749
Ultimaker 2
36
37
38
39
40
Hinge Design
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
Instructions on Thingiverse
69
http://www.thingiverse.com/thing:993901
Raspberry Pi with Java
70
raspberrypiwithjava.com
Stephen Chin
tweet: @steveonjava
blog: http://steveonjava.com
nighthacking.com
Real Geeks
Live Hacking
NightHacking Tour
Safe Harbor Statement
The preceding is intended to outline our general product direction. It is intended for
information purposes only, and may not be incorporated into any contract. It is not a
commitment to deliver any material, code, or functionality, and should not be relied upon
in making purchasing decisions. The development, release, and timing of any features or
functionality described for Oracle’s products remains at the sole discretion of Oracle.
72

RetroPi Handheld Raspberry Pi Gaming Console

Editor's Notes

  • #5 You would think easy because 2D and slow CPU No because mappers Separate buses for PPU and CPU, everything is memory mapped, need to emulate all accesses bankswitching program code and graphics in the middle of the screen sometimes even inside a line makes static recompilation impossible sloppy and clever coding synchronization Quirky hardware and analog effects (that flickering line in Super Mario Bros only happens when a register is written to during a single specific pixel) Input and video lag and synchronization
  • #12 The Raspberry Pi is a single board computer developed in UK by Raspberry Pi Foundation with the intention to stimulate the teaching of basic computer science in schools. It has a slightly slower ARM processor (ARMv6 700Mhz), but a better GPU than the BeagleBoard. Connectivity is via HDMI/Component, USBx2, Ethernet, and Audio out.
  • #13 Specs: 700 Mhz ARM1176JZF-S core, Broadcom VideoCore IV, OpenGL EX 2.0 512mb RAM, 3.5Watts@5v, 8 x GPIO, UART, I2C bus, SPI bus 2 USB 2.0, SD / MMC / SDIO, 10/100 Ethernet HDMI, DSI, Composite VideoCore IV, 3.5 mm Audio Jack Cost $35 + Shipping
  • #35 Swing video is slow at scaling output, not done in hardware on Linux, unnecessary buffer copies -> switch to JavaFX Synchronization wastes time constantly context switching, 90% of games don't need it Use of GetBit everywhere to make writing it easier but it wasn't being optimized out Double and Long math are same speed on PC but not Pi