6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Mon Apr 29, 2024 9:47 am

All times are UTC




Post new topic Reply to topic  [ 16 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: Sun Mar 03, 2013 8:24 pm 
Offline
User avatar

Joined: Wed Feb 13, 2013 1:38 pm
Posts: 586
Location: Michigan, USA
I just came across a post that referred to a Py65 emulator where the author loaded the KIM-1 Monitor and KB9 BASIC into the emulator. Whoa, how cool is that?

So, I found a page for the Py65 emulator but it doesn't mention what platform(s) it runs on and doesn't seem to have installation instructions (that make sense to a Windows user, like me).

Is there a secret society (illuminati, perhaps) that knows how to use Py65?

Cheerful regards, Mike


Top
 Profile  
Reply with quote  
PostPosted: Sun Mar 03, 2013 8:42 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10793
Location: England
Hi Mike
I usually run py65 on linux but I have successfully run it on windows.
You should start by installating a python: either cygwin or activestate python. You want a version of python2, not python3.
I should be able to talk you through the steps.
Cheers
Ed


Top
 Profile  
Reply with quote  
PostPosted: Sun Mar 03, 2013 9:00 pm 
Offline
User avatar

Joined: Wed Feb 13, 2013 1:38 pm
Posts: 586
Location: Michigan, USA
Hi Ed,

Thank you for the kind offer. Installing Python and then PY65 sounds like it might be a lengthy process and I don't want to impose on you, Sir. Perhaps I can find an emulator similar in function and capability to PY65 that uses Java or another language that is already present on my Win 7 laptop?

Cheerful regards, Mike


Top
 Profile  
Reply with quote  
PostPosted: Sun Mar 03, 2013 9:17 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10793
Location: England
Hmm, no, should not be lengthy...
Activepython is here http://www.activestate.com/activepython/downloads and is in no way detrimental or dangerous!
According to https://github.com/mnaberez/py65 you then just need to do
> easy_install -U py65

Or, if you specifically choose to install the 32bit version of activestate, you can apparently
> pypm install py65

Of course, many other emulators exist but I'd recommend giving py65 a try first. It's set up for experimentation, rather than for emulating some specific machine.

Cheers
Ed


Top
 Profile  
Reply with quote  
PostPosted: Mon Mar 04, 2013 1:25 am 
Offline
User avatar

Joined: Wed Feb 13, 2013 1:38 pm
Posts: 586
Location: Michigan, USA
Hey Ed. I appreciate the personal help but the more I look at these programs (PY65 and SyMon) the more I realize I don't have the skill set to work with them, yet. For example, the directions provided for Py65 don't seem to be complete. That is, they don't tell me how to actually launch or get into the program.

I think I better pass on this for now. I appreciate your willingness to help and I apologize for taking so much of your time.

Cheerful regards, Mike


Top
 Profile  
Reply with quote  
PostPosted: Mon Mar 04, 2013 11:09 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10793
Location: England
Hi Mike
I appreciate it might not be the right solution for you - although I haven't given up on you - but for the record here's what I did.

On Windows, use Windows+R to get the Run dialog (or use the Start Menu) and run "cmd" to get a command window. You need a DOS prompt - so whichever way works for you. It might be that you run "command".

If you've successfully installed ActiveState python, you can do
Code:
C:\Programs and Settings\Username> python -V
(that's a capital V) and you'll see something like
Code:
Python 2.7.2


If you have the right privileges, you can do
Code:
C:\Programs and Settings\Username> easy_install py65

and it will fetch and install py65. If you don't have the privileges, you might need to login as a different account, or try
Code:
C:\Programs and Settings\Username> runas /user:administrator "easy_install py65"


If you get no errors, you should then be able to
Code:
C:\Programs and Settings\Username> py65mon

and you'll see the py65 monitor command line:
Code:
Py65 Monitor

       PC  AC XR YR SP NV-BDIZC
6502: 0000 00 00 00 ff 00110000
.

or indeed
Code:
C:\Programs and Settings\Username> py65mon -h

and see the help:
Code:
py65mon -- interact with a simulated 6502-based system

Usage: C:\Python27\Scripts\py65mon-script.py [options]

Options:
-h, --help           : Show this message
-m, --mpu <device>   : Choose which MPU device (default is 6502)
-l, --load <file>    : Load a file at address 0
-r, --rom <file>     : Load a rom at the top of address space and reset into it
-g, --goto <address> : Perform a goto command after loading any files


(For anyone on linux: same process, but install with "sudo easy_install py65")

From the py65 monitor prompt, there's a help command:
Code:
.help

Documented commands (type help <topic>):
========================================
add_label  cycles        fill  load  pwd    registers  save         tilde 
assemble   delete_label  goto  mem   quit   reset      show_labels  version
cd         disassemble   help  mpu   radix  return     step         width 


Hope this helps
Ed


Top
 Profile  
Reply with quote  
PostPosted: Tue Mar 05, 2013 11:41 am 
Offline

Joined: Mon Jan 07, 2013 2:42 pm
Posts: 576
Location: Just outside Berlin, Germany
Michael wrote:
Is there a secret society (illuminati, perhaps) that knows how to use Py65?


(Edit: I see instructions for installing have already been posted above.)

It's written in Python, which means it runs on just about anything. Mac OS X and most Linux variants have Python out of the box, for example, it's the default language of the Raspberry Pi (BTW, I'm still somewhat in shock how many of the tools mentioned here are Windows only, I'd expected this to be more of a Linux crowd). If you haven't tried it, Python is a fun language that is very easy to get started in once you get past the whitespace thing, and the py65 code is interesting to read for its own sake (lives under /Library/Python/2.7/site-packages/py65-0.15-py2.7.egg/py65/ on OS X).

Which is a good thing, because you are right, the documentation is basically non-existant. Digging around in the source, I found some hardwired routines:

Code:
$F001 putc ("put character", ie, print to terminal)
$F004 getc ("read" character)
$F005 blocking_getc


There doesn't seem to be a configuration file with an easy way to change this. Also, py65 has the annoying tendency to want to load programs at $0000, which of course is the zero page. To load a ROM image where it belongs, you'll have to do something like

Code:
py65mon --mpu 65C02


to start the program and then

Code:
load <RAM IMAGE FILE> e000
goto e000


The first line of 6502 code at e000 then has to be a hack to the jump vectors. The reason for all of this is that py65 is not an emulator in the sense that it pretends to be a SBC, but for experimenting with the 6502 commands. As such, I've found it very useful to just hack in short code snippets for testing through its interactive assembler.


Last edited by scotws on Tue Mar 05, 2013 11:47 am, edited 1 time in total.

Top
 Profile  
Reply with quote  
PostPosted: Tue Mar 05, 2013 11:46 am 
Offline

Joined: Mon Jan 07, 2013 2:42 pm
Posts: 576
Location: Just outside Berlin, Germany
(As an aside about Python, while I was learning the language, I read the "Python Cookbook" (http://www.amazon.com/Python-Cookbook-A ... 0596007973) on Berlin public transport on my way to work. You wouldn't believe the looks I got, though nobody every asked me why I would want to cook snakes. It probably didn't help there is a squirrel on the front cover.)


Top
 Profile  
Reply with quote  
PostPosted: Wed Mar 06, 2013 8:36 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10793
Location: England
BTW, you can do
py65mon -r romfile
which will load an image to the top of memory instead of the bottom (which -l does) - this is mainly because I'm lazy and didn't want to write the code to take an address as well as a filename.

You're quite right about the I/O mechanisms being hard-coded and underdocumented. Pull request needed!

Cheers
Ed


Top
 Profile  
Reply with quote  
PostPosted: Wed Mar 06, 2013 9:31 am 
Offline

Joined: Mon Jan 07, 2013 2:42 pm
Posts: 576
Location: Just outside Berlin, Germany
BigEd wrote:
BTW, you can do
py65mon -r romfile
which will load an image to the top of memory instead of the bottom (...).


Ah, I didn't see that, thanks!


Top
 Profile  
Reply with quote  
PostPosted: Mon Apr 01, 2013 10:04 am 
Offline

Joined: Mon Jan 07, 2013 2:42 pm
Posts: 576
Location: Just outside Berlin, Germany
BigEd wrote:
BTW, you can do
py65mon -r romfile
which will load an image to the top of memory instead of the bottom


Finally got around to trying this, and somehow, I can't seem to get it to work:

Code:
Error: <type 'exceptions.OverflowError'>, -1: file: /Library/Python/2.7/site-packages/py65-0.15-py2.7.egg/py65/utils/addressing.py line: 99


This was after a call with "py65mon -m 65c02 -r sqos.prg". I tested it the hard way (load to e000, use mem to get the address of the reset vector, goto the reset vector), and that works fine, so that's not the problem. Building a 16 kB instead of an 8 kB image doesn't change anything either.

As far as I could trace the Python code so far, the -1 is used as a marker to defer the address processing so that the image can be loaded to the top of memory (last byte in $FFFF). Then something goes wrong -- I'm still working on the "what" -- and the -1 is transfered as the actual address. Not going to be able to much more today (family, Easter, etc), so wanted to document what I found so far.


Top
 Profile  
Reply with quote  
PostPosted: Mon Apr 01, 2013 11:32 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10793
Location: England
Ah, you're right. It used to work!

I've pushed a fix to the github version: are you able to install that? There's probably more than one way. It's just a small change to one file: see
https://raw.github.com/mnaberez/py65/f7 ... monitor.py
for the file, and
https://github.com/mnaberez/py65/commit ... c04305958c
for the differences.

Cheers
Ed


Top
 Profile  
Reply with quote  
PostPosted: Mon Apr 01, 2013 2:30 pm 
Offline

Joined: Mon Jan 07, 2013 2:42 pm
Posts: 576
Location: Just outside Berlin, Germany
BigEd wrote:
I've pushed a fix to the github version: are you able to install that?


I just saved the new version off the webpage to monitor.py. Works perfectly now, thanks for the quick fix!


Top
 Profile  
Reply with quote  
PostPosted: Mon Apr 01, 2013 2:35 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10793
Location: England
Great! (and, more importantly, thanks for the bug report!)


Top
 Profile  
Reply with quote  
PostPosted: Fri Apr 05, 2013 6:19 pm 
Offline
Site Admin
User avatar

Joined: Fri Aug 30, 2002 1:08 am
Posts: 280
Location: Northern California
BigEd wrote:
I've pushed a fix to the github version

I've released a new version (0.16) that includes your fix.

_________________
- Mike Naberezny (mike@naberezny.com) http://6502.org


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 16 posts ]  Go to page 1, 2  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: