How do I set up PyNES

Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems.

Moderator: Moderators

Post Reply
psycopathicteen
Posts: 2938
Joined: Wed May 19, 2010 6:12 pm

How do I set up PyNES

Post by psycopathicteen » Wed Aug 26, 2015 2:50 pm

https://www.youtube.com/watch?v=Y-o3pJEhwD4

Like in this video. How do I get a black screen, with a window on the side for asm.

User avatar
Drew Sebastino
Formerly Espozo
Posts: 3503
Joined: Mon Sep 15, 2014 4:35 pm
Location: Richmond, Virginia

Re: How do I set up PyNES

Post by Drew Sebastino » Wed Aug 26, 2015 2:56 pm

What exactly is this? Is it like a compiler that shows you the code that you've been writing in whatever and what it did to turn it into assembly? Can you write in assembly and it would go the other way around?

User avatar
freem
Posts: 163
Joined: Mon Oct 01, 2012 3:47 pm
Location: freemland (NTSC-U)
Contact:

Re: How do I set up PyNES

Post by freem » Wed Aug 26, 2015 3:42 pm

Espozo wrote:What exactly is this?
A way to use the programming language Python to program NES games.
Espozo wrote:Is it like a compiler that shows you the code that you've been writing in whatever and what it did to turn it into assembly?
as far as I can tell, it converts Python code to 6502 assembler, but I haven't really used it, so I couldn't say for sure.
Espozo wrote:Can you write in assembly and it would go the other way around?
highly doubt it.

User avatar
Drew Sebastino
Formerly Espozo
Posts: 3503
Joined: Mon Sep 15, 2014 4:35 pm
Location: Richmond, Virginia

Re: How do I set up PyNES

Post by Drew Sebastino » Wed Aug 26, 2015 4:23 pm

freem wrote:highly doubt it.
What's the point then? You wouldn't be able to correct any inefficiencies made by the compiler. Actually, I'm stupid, you could probably keep editing the python code in a certain way to where it makes exactly what you want, but I'd wonder if it would just turn up being even harder than just writing in assembly.

User avatar
mikejmoffitt
Posts: 1351
Joined: Sun May 27, 2012 8:43 pm

Re: How do I set up PyNES

Post by mikejmoffitt » Wed Aug 26, 2015 5:58 pm

If it is generating 6502 assembly mnemonics, nothing prevents you from editing it by hand.

User avatar
tokumaru
Posts: 11771
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: How do I set up PyNES

Post by tokumaru » Wed Aug 26, 2015 6:35 pm

Yes, but it's obvious that the changes won't be reflected in the python code. It's not like every piece of optimized assembly has a corresponding piece of optimized python (or other high level language) code, otherwise it would just be a matter of figuring out that optimized high-level code from the start, and nobody would ever use assembly. Expecting a program to be able to convert any arbitrary piece of assembly code into optimized high-level code is completely unreasonable.

psycopathicteen
Posts: 2938
Joined: Wed May 19, 2010 6:12 pm

Re: How do I set up PyNES

Post by psycopathicteen » Thu Aug 27, 2015 7:29 am

From the video, it looks pretty efficient. So far it doesn't do any of the typical slow-code things, like using a subroutine for stuff that could be done in an instruction, and using word sizes that are too big for the CPU to handle.

psycopathicteen
Posts: 2938
Joined: Wed May 19, 2010 6:12 pm

Re: How do I set up PyNES

Post by psycopathicteen » Sat Aug 29, 2015 9:20 am

I'm still waiting for a response. I believe the actual program is in the .spec file, but my computer doesn't run .spec files, so how do I run the program?

User avatar
rainwarrior
Posts: 7824
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: How do I set up PyNES

Post by rainwarrior » Sat Aug 29, 2015 9:51 am

Espozo wrote:What's the point then?
The point is not having to write assembly.

nrezinorn
Posts: 3
Joined: Thu May 02, 2013 10:04 pm
Location: Gilbert, AZ

Re: How do I set up PyNES

Post by nrezinorn » Sun Aug 30, 2015 5:23 pm

psycopathicteen wrote:I'm still waiting for a response. I believe the actual program is in the .spec file, but my computer doesn't run .spec files, so how do I run the program?
I was able to install this on linux doing the following:

clone the github repo:
https://github.com/gutomaia/pyNES.git

# switch to folder and run make (creates a python virtual env)
cd pyNES; make

# activate the python virtual env
source venv/bin/activate

# install pyNES module into venv
python setup.py install

# build examples
cd pynes/examples
pynes py helloworld.py -o helloworld.nes

Test is an emulator of choice by loading helloworld.nes

I'm going to play with this more and fumble my way through as there is next to no documentation right now for this. The above steps *should* work on OSX too. If you run windows you will need python installed, then you can run similar commands using windows command line syntax, and it should work all the same.

Edit: the makefile for OS X explodes. makefile works fine on Centos 7 (and probably any other Linux distro)

Apologies is this is confusing, but it's how "python" works :beer:
psycopathicteen wrote:Like in this video. How do I get a black screen, with a window on the side for asm.
If you're on windows, what he is doing there won't work (or at least I don't know how to reproduce it). If you're on linux/mac , he has some save hook in his editor that updates the file in realtime, using his pynes command, and in his second window it's simply refreshing it with the "watch" command to display the raw ASM generated.

Post Reply