How to use py65 on a Mac

Topics pertaining to the emulation or simulation of the 65xx microprocessors and their peripheral chips.
Post Reply
powersoft_51
Posts: 51
Joined: 22 Jun 2024

How to use py65 on a Mac

Post by powersoft_51 »

I have installed py65 on my MacBook.

Requirement already satisfied: setuptools in /Library/Python/3.9/site-packages (78.1.0)
Requirement already satisfied: py65 in ./Library/Python/3.9/lib/python/site-packages (1.2.0)

How can I start py65 to emulate a 65c02 and run Taliforth have no clou ?

Tanks for any help
cheers
Jan
SamCoVT
Posts: 344
Joined: 13 May 2018

Re: How to use py65 on a Mac

Post by SamCoVT »

It's usually available from the command prompt, which you can get by opening the Terminal app. Are you familiar with how to use the command line?

To run Tali in py65mon, you should be able to:
1. Open the Terminal app
2. Use the "cd" command to change to the directory (folder) that Tali is installed in.
3. run the command:

Code: Select all

py65mon -m 65c02 -r taliforth-py65mon.bin
Note that when you type "bye" to exit Tali, you will still be in the py65mon simulator. It's just "q" to exit that program and get back to a OSX command prompt.

If you have make installed (I can't remember if make is installed with OSX by default or if you need Xcode installed to get it) then you should be able to just run the command:

Code: Select all

make sim
instead. You'll also want the assembler 64tass installed if you want to make changes to Tali and be able to reassemble it. The "make sim" command will reassemble Tali if any source files have changed and then run the simulator on the resulting .bin file.

If you do install Xcode, so that there is a C compiler installed on the system, you should also be able to run the command:

Code: Select all

make csim
which will compile a simulator that uses fake6502. This simulator is much faster than py65mon and also includes simulation of a block device using a file on the Mac (the block device support needs a different command to activate, so let us know if you want to go that route).

Note that all of these options using make assume you have cloned the git repository so you have all of the Tali files, rather than just downloading the .bin file.
powersoft_51
Posts: 51
Joined: 22 Jun 2024

Re: How to use py65 on a Mac

Post by powersoft_51 »

thanks, but my system is not recognize py65. Have take a look in "site-packages" and it is there.
But when I give py65 in the terminal got this : command not found: py65
Don't know how to proceed!
User avatar
BigEd
Posts: 11463
Joined: 11 Dec 2008
Location: England
Contact:

Re: How to use py65 on a Mac

Post by BigEd »

In my case when I installed py65 with pip I got the following output:

Code: Select all

ed$ pip install setuptools py65
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: setuptools in /opt/local/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages (75.6.0)
Collecting py65
  Downloading py65-1.2.0-py2.py3-none-any.whl.metadata (1.6 kB)
Downloading py65-1.2.0-py2.py3-none-any.whl (60 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 60.5/60.5 kB 3.8 MB/s eta 0:00:00
Installing collected packages: py65
  WARNING: The script py65mon is installed in '/Users/ed/Library/Python/3.12/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed py65-1.2.0
And so, for me, I have to start py65mon like this:

Code: Select all

ed$ /Users/ed/Library/Python/3.12/bin/py65mon 

Py65 Monitor

       PC  AC XR YR SP NV-BDIZC
6502: 0000 00 00 00 ff 00110000
More generally, perhaps, you could try

Code: Select all

ed$ ~/Library/Python/3.*/bin/py65mon -m 65c02 -r taliforth-py65mon.bin 
Wrote +32768 bytes from $8000 to $ffff
Tali Forth 2 default kernel for py65mon (27. Feb 2025)


Tali Forth 2 for the 65c02
Version 1.1 06. Apr 2024 
Copyright 2014-2024 Scot W. Stevenson, Sam Colwell, Patrick Surry
Tali Forth 2 comes with absolutely NO WARRANTY
Type 'bye' to exit
22000 7 / . 3142  ok
although the use of * there will blow up if you have several python 3 versions with py65 installed.
powersoft_51
Posts: 51
Joined: 22 Jun 2024

Re: How to use py65 on a Mac

Post by powersoft_51 »

Thanks, this was very helpful.
I'm now able to run Taliforth from my terminal on my macbook!

Cheers,
Jan
SamCoVT
Posts: 344
Joined: 13 May 2018

Re: How to use py65 on a Mac

Post by SamCoVT »

Thanks for the heads-up that py65mon isn't in the path by default, BigEd. I'm so used to updating my path for any tools that I use that I forget it's an extra step sometimes.

Jan,
the PATH is variable that the terminal uses to know which directories (folders) to look in when you say the name of an executable. It's basically just a list of directories and the computer will look through them, in the order they are listed, until it finds the program. If there are multiple executables with the same name, it will use the FIRST one that matches, so the order of the directories is important. It's generally recommended to add directories to the path list at the end (unless you have a reason not to) so that the system directories will be searched first and your extra software will be searched last. That way, programs that come with the operating system will always be found first if there is are two programs with the same name.

I don't have a newer mac, but a quick internet search shows that on newer macs you can edit the file /etc/paths and add a directory to the list there. It's one directory per line. Don't add the program name, but put in the full path up to folder the program is in (eg. up to the .../bin on the end). You will need to close and reopen the Terminal app for it to take effect. If you want to see the current list of PATH list being used by your terminal (to make sure your changes worked), you can type:

Code: Select all

echo $PATH
at the Terminal prompt and it will print the list to the screen (separated by colons, I believe). This list takes input from several sources (/etc/path is just one of them) so your changes may show up in the middle of the list and that's usually fine. Once you've done this, you should be able to just say py65mon for the program name to get it to start and your terminal will know where to look to find it.
User avatar
BigEd
Posts: 11463
Joined: 11 Dec 2008
Location: England
Contact:

Re: How to use py65 on a Mac

Post by BigEd »

BTW, it seems that making csim for the first time needs 64tass to make a new bin file for TaliForth - perhaps there's a way to avoid that dependency? (Like finding a way for a single bin file to suffice, or perhaps shipping a prebuilt c65 version?)
SamCoVT
Posts: 344
Joined: 13 May 2018

Re: How to use py65 on a Mac

Post by SamCoVT »

Thanks for pointing that out, BigEd. From the Tali project's point of view, c65 is there to simulate the test suite and test Tali. Looking at it from that direction, it makes sense that the Makefile would re-assemble Tali for it before running the simulator. Patrick has added enough useful functionality to the c65 simulator, however, that it might now make sense to allow c65 to be built without needing to reassemble Tali. The two simulators (c65 and py65mon) agree on I/O, so for general use the c65 simulator can run the py65mon targeted .bin file, but I don't have a makefile target that does that.
Post Reply