SlideShare une entreprise Scribd logo
1  sur  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

Contenu connexe

Tendances

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
 

Tendances (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
 

En vedette

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
 

En vedette (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
 

Similaire à 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
 

Similaire à 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
 

Dernier

Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
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
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
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
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
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
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
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
 

Dernier (20)

Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
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
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
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
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
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
 

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.