SlideShare una empresa de Scribd logo
1 de 17
Pysx: A Psx emulator written in
            python
  Should be: “why you should not write a psx
             emulator in python”
          But you already know why.
      So let’s talk about why I wrote it.
My plan is writing a javascript/webgl psx emulator.
Sounds like a cool project.
But I know nothing about Psx emulation.
Python is my tool for understanding.
So my first step is writing a psx emulator in python.
OK, but there are lots of cool projects, why this one?
You might ask.
It’s a long story.
It all began one year ago.
actually, 1 year and 1 month ago, May 9, 2011.
I had a several hobby projects back then.
Chinese handwriting recognition algorithm in python
Web browser and GTK+ for Kindle DX
Chewing Chinese input for Kindle
Cracking kindle’s DRM
Hacking Acer Stream’s HDMI port
ClockWorkMod Recovery for Acer stream
Custom roms for Acer Stream
Unpacking tools for Bin format for Acer firmwares
On May 9, 2011
I was working on upgrading the kernel of Acer Stream, 90%
done.
I remember I got a phone call, and have go out and to
pause the work.
Then something happened and my life was never the same
again.
Something about a night with blood, screaming
women, knifes, scissors.
Something good.
But not a very good for other Acer stream owners.
The next thing I remember was




     Happy 10m old!
Not much time for hobby projects.
And free time are fragmented.
I choose Psx emulator as my project
because I don’t have much choice.
Modifying a kernel for a smart device is not possible.
need to concentrate for a fairly long time.
Writing a Psx emulator is different.
Each components like CPU, GPU, memory are fairly
independent.
Each instruction of CPU are fairly independent.
Implement on demand
Seeing how far can the emulation go is kind of fun
bfc00000 : LUI 00000000 (t0), 0013 (19),
bfc00004 : ORI 00130000 (t0), 00130000 (t0), 243f (9279),
bfc00008 : LUI 00000000 (at), 1f80 (8064),
bfc0000c : SW 0013243f (t0), 1010 (1f800000 (at)) [1f801010]
bfc00010 : NOP
bfc00014 : ADDIU 0013243f (t0), 00000000 (r0), 0b88 (2952),
bfc00018 : LUI 1f800000 (at), 1f80 (8064),
bfc0001c : SW 00000b88 (t0), 1060 (1f800000 (at)) [1f801060]
bfc00020 : NOP
bfc00024 : NOP
bfc00028 : NOP
bfc0002c : NOP
bfc00030 : NOP
bfc00034 : NOP
bfc00038 : NOP
bfc0003c : NOP
bfc00040 : NOP
bfc00044 : NOP
bfc00048 : NOP
bfc0004c : NOP
Ctypes helps to load psemu plugins.
Pypy is 10x faster than CPython
Otherwise, the video can not fit in a lightening talk.
I use some ad hoc meta programming
What I wrote


self.optbl=[

"SPECIAL", "BCOND", "J", "JAL", "BEQ", "BNE", "BLEZ"
, "BGTZ",

"ADDI", "ADDIU", "SLTI", "SLTIU","ANDI", "ORI", "XOR
I", "LUI",
      "COP0", "COP1", "COP2", "COP3"]+ [""]*12+[
      "LB", "LH", "LWL", "LW", "LBU", "LHU", "LWR", "",
      "SB", "SH", "SWL", "SW", "", "", "SWR", "",
      "LWC0", "LWC1", "LWC2", "LWC3"]+ [""]*4+[
      "SWC0", "SWC1", "SWC2", "SWC3"]+ [""]*4
...
    @expand_dispatch
    def run(self):
...
         getattr(self, self.optbl[op])()
What Python Runs
Pypy’s rpython can “JIT” interpreters.
But it has only signed 32bit integers.
Using unsigned 32bit need to rewrite the code
The expanded “switch statement” works for shedskin.
But no ctypes in shedskin
Shedskin does not support nested functions.
Using opengl, sdl on shedskin is tricky.
TODO:
GTE
CDROM
HLE
Dynamic recompiling
Plugins in pure python

Más contenido relacionado

La actualidad más candente

5 Time Saving Bash Tricks
5 Time Saving Bash Tricks5 Time Saving Bash Tricks
5 Time Saving Bash TricksNikhil Mungel
 
An Introduction to PHP Dependency Management With Composer
An Introduction to PHP Dependency Management With ComposerAn Introduction to PHP Dependency Management With Composer
An Introduction to PHP Dependency Management With ComposerOomph, Inc.
 
WebAssembly: In a Nutshell
WebAssembly: In a NutshellWebAssembly: In a Nutshell
WebAssembly: In a NutshellRangHo Lee
 
Adding to your Python Armory - OpenWest 2013
Adding to your Python Armory - OpenWest 2013Adding to your Python Armory - OpenWest 2013
Adding to your Python Armory - OpenWest 2013SaltStack
 
Bash Scripting Gabrovo
Bash Scripting GabrovoBash Scripting Gabrovo
Bash Scripting GabrovoMarian Marinov
 
Go初心者がGoでコマンドラインツールの作成に挑戦した話
Go初心者がGoでコマンドラインツールの作成に挑戦した話Go初心者がGoでコマンドラインツールの作成に挑戦した話
Go初心者がGoでコマンドラインツールの作成に挑戦した話dcubeio
 
Algorithm cup 2010
Algorithm cup 2010Algorithm cup 2010
Algorithm cup 2010Wizche
 

La actualidad más candente (14)

Javantura v3 - Just say it – using language to communicate with the computer ...
Javantura v3 - Just say it – using language to communicate with the computer ...Javantura v3 - Just say it – using language to communicate with the computer ...
Javantura v3 - Just say it – using language to communicate with the computer ...
 
5 Time Saving Bash Tricks
5 Time Saving Bash Tricks5 Time Saving Bash Tricks
5 Time Saving Bash Tricks
 
An Introduction to PHP Dependency Management With Composer
An Introduction to PHP Dependency Management With ComposerAn Introduction to PHP Dependency Management With Composer
An Introduction to PHP Dependency Management With Composer
 
An Intro to Swift
An Intro to SwiftAn Intro to Swift
An Intro to Swift
 
WebAssembly: In a Nutshell
WebAssembly: In a NutshellWebAssembly: In a Nutshell
WebAssembly: In a Nutshell
 
Zram
ZramZram
Zram
 
Adding to your Python Armory - OpenWest 2013
Adding to your Python Armory - OpenWest 2013Adding to your Python Armory - OpenWest 2013
Adding to your Python Armory - OpenWest 2013
 
Bash Scripting Gabrovo
Bash Scripting GabrovoBash Scripting Gabrovo
Bash Scripting Gabrovo
 
GPU is CPU.
GPU is CPU.GPU is CPU.
GPU is CPU.
 
Go初心者がGoでコマンドラインツールの作成に挑戦した話
Go初心者がGoでコマンドラインツールの作成に挑戦した話Go初心者がGoでコマンドラインツールの作成に挑戦した話
Go初心者がGoでコマンドラインツールの作成に挑戦した話
 
Algorithm cup 2010
Algorithm cup 2010Algorithm cup 2010
Algorithm cup 2010
 
earthquake.gem
earthquake.gemearthquake.gem
earthquake.gem
 
XRobots
XRobotsXRobots
XRobots
 
Pokemon wonder
Pokemon wonderPokemon wonder
Pokemon wonder
 

Destacado

Introduction Discrete-Event Simulation Using SimPy
Introduction Discrete-Event Simulation Using SimPyIntroduction Discrete-Event Simulation Using SimPy
Introduction Discrete-Event Simulation Using SimPyAlbert Huang
 
Rapid prototypingembeddedsystemsbypython
Rapid prototypingembeddedsystemsbypythonRapid prototypingembeddedsystemsbypython
Rapid prototypingembeddedsystemsbypythonAlbert Huang
 
Pycontw2013x
Pycontw2013xPycontw2013x
Pycontw2013xweijr
 
A Glimpse into Developing Software-Defined Radio by Python
A Glimpse into Developing Software-Defined Radio by PythonA Glimpse into Developing Software-Defined Radio by Python
A Glimpse into Developing Software-Defined Radio by PythonAlbert Huang
 
Introduction to Digital Signal Processing Using GNU Radio
Introduction to Digital Signal Processing Using GNU RadioIntroduction to Digital Signal Processing Using GNU Radio
Introduction to Digital Signal Processing Using GNU RadioAlbert Huang
 

Destacado (6)

Introduction Discrete-Event Simulation Using SimPy
Introduction Discrete-Event Simulation Using SimPyIntroduction Discrete-Event Simulation Using SimPy
Introduction Discrete-Event Simulation Using SimPy
 
Rapid prototypingembeddedsystemsbypython
Rapid prototypingembeddedsystemsbypythonRapid prototypingembeddedsystemsbypython
Rapid prototypingembeddedsystemsbypython
 
Pycontw2013x
Pycontw2013xPycontw2013x
Pycontw2013x
 
Gnu radio lecture
Gnu radio lectureGnu radio lecture
Gnu radio lecture
 
A Glimpse into Developing Software-Defined Radio by Python
A Glimpse into Developing Software-Defined Radio by PythonA Glimpse into Developing Software-Defined Radio by Python
A Glimpse into Developing Software-Defined Radio by Python
 
Introduction to Digital Signal Processing Using GNU Radio
Introduction to Digital Signal Processing Using GNU RadioIntroduction to Digital Signal Processing Using GNU Radio
Introduction to Digital Signal Processing Using GNU Radio
 

Similar a Pysx presentation at Pycontw

Python @ PiTech - March 2009
Python @ PiTech - March 2009Python @ PiTech - March 2009
Python @ PiTech - March 2009tudorprodan
 
Codebits Handivi
Codebits HandiviCodebits Handivi
Codebits Handivicfpinto
 
OSDC 2017 | Is that an Ansible? Stop holding it like a Puppet by Felix Frank
OSDC 2017 | Is that an Ansible? Stop holding it like a Puppet by Felix FrankOSDC 2017 | Is that an Ansible? Stop holding it like a Puppet by Felix Frank
OSDC 2017 | Is that an Ansible? Stop holding it like a Puppet by Felix FrankNETWAYS
 
OSDC 2017 - Felix Frank - Is that an Ansible_ Stop holding It Like a Puppet
OSDC 2017 - Felix Frank - Is that an Ansible_ Stop holding It Like a PuppetOSDC 2017 - Felix Frank - Is that an Ansible_ Stop holding It Like a Puppet
OSDC 2017 - Felix Frank - Is that an Ansible_ Stop holding It Like a PuppetNETWAYS
 
ooc - A hybrid language experiment
ooc - A hybrid language experimentooc - A hybrid language experiment
ooc - A hybrid language experimentAmos Wenger
 
ooc - A hybrid language experiment
ooc - A hybrid language experimentooc - A hybrid language experiment
ooc - A hybrid language experimentAmos Wenger
 
stackconf 2022: Is that an Ansible? Stop holding it like a Puppet
stackconf 2022: Is that an Ansible? Stop holding it like a Puppetstackconf 2022: Is that an Ansible? Stop holding it like a Puppet
stackconf 2022: Is that an Ansible? Stop holding it like a PuppetNETWAYS
 
Golang Performance : microbenchmarks, profilers, and a war story
Golang Performance : microbenchmarks, profilers, and a war storyGolang Performance : microbenchmarks, profilers, and a war story
Golang Performance : microbenchmarks, profilers, and a war storyAerospike
 
Artificial Intelligence Neural Processing Unit Hikey970
Artificial Intelligence Neural Processing Unit Hikey970Artificial Intelligence Neural Processing Unit Hikey970
Artificial Intelligence Neural Processing Unit Hikey970KnowledgeMavens
 
Why I Love Python
Why I Love PythonWhy I Love Python
Why I Love Pythondidip
 
Design and Evolution of cyber-dojo
Design and Evolution of cyber-dojoDesign and Evolution of cyber-dojo
Design and Evolution of cyber-dojoJon Jagger
 
Boxen: How to Manage an Army of Laptops
Boxen: How to Manage an Army of LaptopsBoxen: How to Manage an Army of Laptops
Boxen: How to Manage an Army of LaptopsPuppet
 
ElixirConf 2017 - Writing an Editor in Elixir - Ian Duggan
ElixirConf 2017 - Writing an Editor in Elixir - Ian DugganElixirConf 2017 - Writing an Editor in Elixir - Ian Duggan
ElixirConf 2017 - Writing an Editor in Elixir - Ian Dugganijcd
 
Unix Shell Tricks for Rails Developers
Unix Shell Tricks for Rails DevelopersUnix Shell Tricks for Rails Developers
Unix Shell Tricks for Rails DevelopersMatthew Swain
 
Cocoapods sane library management for xcode
Cocoapods   sane library management for xcodeCocoapods   sane library management for xcode
Cocoapods sane library management for xcodeleonardehrenfried
 
Pc architecture michael karbo
Pc architecture   michael karboPc architecture   michael karbo
Pc architecture michael karboSecretTed
 
What does OOP stand for?
What does OOP stand for?What does OOP stand for?
What does OOP stand for?Colin Riley
 
Euro python2011 High Performance Python
Euro python2011 High Performance PythonEuro python2011 High Performance Python
Euro python2011 High Performance PythonIan Ozsvald
 

Similar a Pysx presentation at Pycontw (20)

Python @ PiTech - March 2009
Python @ PiTech - March 2009Python @ PiTech - March 2009
Python @ PiTech - March 2009
 
Codebits Handivi
Codebits HandiviCodebits Handivi
Codebits Handivi
 
OSDC 2017 | Is that an Ansible? Stop holding it like a Puppet by Felix Frank
OSDC 2017 | Is that an Ansible? Stop holding it like a Puppet by Felix FrankOSDC 2017 | Is that an Ansible? Stop holding it like a Puppet by Felix Frank
OSDC 2017 | Is that an Ansible? Stop holding it like a Puppet by Felix Frank
 
OSDC 2017 - Felix Frank - Is that an Ansible_ Stop holding It Like a Puppet
OSDC 2017 - Felix Frank - Is that an Ansible_ Stop holding It Like a PuppetOSDC 2017 - Felix Frank - Is that an Ansible_ Stop holding It Like a Puppet
OSDC 2017 - Felix Frank - Is that an Ansible_ Stop holding It Like a Puppet
 
ooc - A hybrid language experiment
ooc - A hybrid language experimentooc - A hybrid language experiment
ooc - A hybrid language experiment
 
ooc - A hybrid language experiment
ooc - A hybrid language experimentooc - A hybrid language experiment
ooc - A hybrid language experiment
 
stackconf 2022: Is that an Ansible? Stop holding it like a Puppet
stackconf 2022: Is that an Ansible? Stop holding it like a Puppetstackconf 2022: Is that an Ansible? Stop holding it like a Puppet
stackconf 2022: Is that an Ansible? Stop holding it like a Puppet
 
Golang Performance : microbenchmarks, profilers, and a war story
Golang Performance : microbenchmarks, profilers, and a war storyGolang Performance : microbenchmarks, profilers, and a war story
Golang Performance : microbenchmarks, profilers, and a war story
 
At the end of the rainbow
At the end of the rainbowAt the end of the rainbow
At the end of the rainbow
 
Artificial Intelligence Neural Processing Unit Hikey970
Artificial Intelligence Neural Processing Unit Hikey970Artificial Intelligence Neural Processing Unit Hikey970
Artificial Intelligence Neural Processing Unit Hikey970
 
HackIM 2012 CTF Walkthrough
HackIM 2012 CTF WalkthroughHackIM 2012 CTF Walkthrough
HackIM 2012 CTF Walkthrough
 
Why I Love Python
Why I Love PythonWhy I Love Python
Why I Love Python
 
Design and Evolution of cyber-dojo
Design and Evolution of cyber-dojoDesign and Evolution of cyber-dojo
Design and Evolution of cyber-dojo
 
Boxen: How to Manage an Army of Laptops
Boxen: How to Manage an Army of LaptopsBoxen: How to Manage an Army of Laptops
Boxen: How to Manage an Army of Laptops
 
ElixirConf 2017 - Writing an Editor in Elixir - Ian Duggan
ElixirConf 2017 - Writing an Editor in Elixir - Ian DugganElixirConf 2017 - Writing an Editor in Elixir - Ian Duggan
ElixirConf 2017 - Writing an Editor in Elixir - Ian Duggan
 
Unix Shell Tricks for Rails Developers
Unix Shell Tricks for Rails DevelopersUnix Shell Tricks for Rails Developers
Unix Shell Tricks for Rails Developers
 
Cocoapods sane library management for xcode
Cocoapods   sane library management for xcodeCocoapods   sane library management for xcode
Cocoapods sane library management for xcode
 
Pc architecture michael karbo
Pc architecture   michael karboPc architecture   michael karbo
Pc architecture michael karbo
 
What does OOP stand for?
What does OOP stand for?What does OOP stand for?
What does OOP stand for?
 
Euro python2011 High Performance Python
Euro python2011 High Performance PythonEuro python2011 High Performance Python
Euro python2011 High Performance Python
 

Último

Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024The Digital Insurer
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 

Último (20)

Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 

Pysx presentation at Pycontw

  • 1. Pysx: A Psx emulator written in python Should be: “why you should not write a psx emulator in python” But you already know why. So let’s talk about why I wrote it.
  • 2. My plan is writing a javascript/webgl psx emulator. Sounds like a cool project. But I know nothing about Psx emulation. Python is my tool for understanding. So my first step is writing a psx emulator in python.
  • 3. OK, but there are lots of cool projects, why this one? You might ask. It’s a long story. It all began one year ago. actually, 1 year and 1 month ago, May 9, 2011. I had a several hobby projects back then.
  • 4. Chinese handwriting recognition algorithm in python Web browser and GTK+ for Kindle DX Chewing Chinese input for Kindle Cracking kindle’s DRM Hacking Acer Stream’s HDMI port ClockWorkMod Recovery for Acer stream Custom roms for Acer Stream Unpacking tools for Bin format for Acer firmwares
  • 5. On May 9, 2011 I was working on upgrading the kernel of Acer Stream, 90% done. I remember I got a phone call, and have go out and to pause the work. Then something happened and my life was never the same again. Something about a night with blood, screaming women, knifes, scissors.
  • 6. Something good. But not a very good for other Acer stream owners.
  • 7.
  • 8.
  • 9. The next thing I remember was Happy 10m old!
  • 10. Not much time for hobby projects. And free time are fragmented. I choose Psx emulator as my project because I don’t have much choice. Modifying a kernel for a smart device is not possible. need to concentrate for a fairly long time.
  • 11. Writing a Psx emulator is different. Each components like CPU, GPU, memory are fairly independent. Each instruction of CPU are fairly independent. Implement on demand Seeing how far can the emulation go is kind of fun
  • 12. bfc00000 : LUI 00000000 (t0), 0013 (19), bfc00004 : ORI 00130000 (t0), 00130000 (t0), 243f (9279), bfc00008 : LUI 00000000 (at), 1f80 (8064), bfc0000c : SW 0013243f (t0), 1010 (1f800000 (at)) [1f801010] bfc00010 : NOP bfc00014 : ADDIU 0013243f (t0), 00000000 (r0), 0b88 (2952), bfc00018 : LUI 1f800000 (at), 1f80 (8064), bfc0001c : SW 00000b88 (t0), 1060 (1f800000 (at)) [1f801060] bfc00020 : NOP bfc00024 : NOP bfc00028 : NOP bfc0002c : NOP bfc00030 : NOP bfc00034 : NOP bfc00038 : NOP bfc0003c : NOP bfc00040 : NOP bfc00044 : NOP bfc00048 : NOP bfc0004c : NOP
  • 13. Ctypes helps to load psemu plugins. Pypy is 10x faster than CPython Otherwise, the video can not fit in a lightening talk. I use some ad hoc meta programming
  • 14. What I wrote self.optbl=[ "SPECIAL", "BCOND", "J", "JAL", "BEQ", "BNE", "BLEZ" , "BGTZ", "ADDI", "ADDIU", "SLTI", "SLTIU","ANDI", "ORI", "XOR I", "LUI", "COP0", "COP1", "COP2", "COP3"]+ [""]*12+[ "LB", "LH", "LWL", "LW", "LBU", "LHU", "LWR", "", "SB", "SH", "SWL", "SW", "", "", "SWR", "", "LWC0", "LWC1", "LWC2", "LWC3"]+ [""]*4+[ "SWC0", "SWC1", "SWC2", "SWC3"]+ [""]*4 ... @expand_dispatch def run(self): ... getattr(self, self.optbl[op])()
  • 16. Pypy’s rpython can “JIT” interpreters. But it has only signed 32bit integers. Using unsigned 32bit need to rewrite the code The expanded “switch statement” works for shedskin. But no ctypes in shedskin Shedskin does not support nested functions. Using opengl, sdl on shedskin is tricky.