Py65 65816 - Add support for the 65C816 to py65

Overview

Add support for the 65C816 to py65

Py65 (https://github.com/mnaberez/py65) is a great simulator for the 6502. Recently I added support for interrupts (https://github.com/tmr4/py65_int) and a debug window (https://github.com/tmr4/py65_debug_window). After success with these modifications, I decided to try adding support for the 65C816. Luckily, py65 is open-source and enhancing it isn't very difficult.

This repository provides a framework for adding support for the 65C816 to py65. I've included the modules I've developed to simulate and test the 65C816. As noted below, a few modifications are needed to the core py65 modules as well.

Screenshot

Screenshot of py65 running Liara Forth on a simulated 65C816

Contents

I've included the main device module, mpu65c816.py, to add simulation support for the 65C816 to py65. I've also include several modules for testing the 65C816 simulation. These include the main unit test module, test_mpu65c816.py, and support modules, test_mpu65816_Common6502.py and test_mpu65816_Common65c02.py, derived largely from similarly named py65 test modules, to test the 65C816 emulation mode simulation. I've also included a binary file, liara.bin, that I modified from Scot W. Stevenson's Liara Forth (https://github.com/scotws/LiaraForth) to work with py65 simulating the 65C816. Note that I'm a Python newbie and appreciate any feedback to make these better.

  • mpu65c816.py

The 65C816 device.

  • test_mpu65c816.py

The main unit test module for the 65C816.

  • test_mpu65816_Common6502.py

Unit tests for 65C816 emulation mode.

  • test_mpu65816_Common65c02.py

Additional 65C02 based unit tests for 65C816 emulation mode.

  • liara.bin

A modified version of Scot W. Stevenson's Liara Forth (https://github.com/scotws/LiaraForth) for testing. Liara Forth is designed to run on the Western Design Center's W65C265SXB development board (https://www.westerndesigncenter.com/wdc/documentation/W65C265SXB.pdf). I've modified the Liara Forth binary to interface with alternate I/O addresses rather than those used by the development board.

Modifications to core py65 modules

The following modifications are needed for py65 to simulate the 65C816:

  1. monitor.py
  • Add a reference to new 65C816 MPU class from devices.mpu65c816 import MPU as CMOS65C816
  • Add the '65C816': CMOS65C816 pair to the Microprocessors dictionary.

License

The mpu65c816.py, test_mpu65816_Common6502.py and test_mpu65816_Common65c02.py modules contain large portions of code from or derived from py65 which is covered by a BSD 3-Clause License. I've included that license as required.

Running the 65C816 Unit Tests

You can run the unit tests with python -m unittest test_mpu65c816.py. The 65C816 simulation passes the py65 6502- and 65C02-based test (507 in total) in emulation mode. Some of tests were modified to run properly with the new device. I still have to create the tests for native mode operations (not a small task). I expect these to take some time and I expect these will turn up many errors in my code.

Testing the 65C816 Simulation with Liara Forth

It wasn't easy to find a sizable program to test with the new 65C816 simulation. You can run the slightly modified version of Liara Forth with python monitor.py -m 65c816 -l liara.bin -g 5000 -i fff0 -o fff1.

Limitations

  1. The new 65C816 device is largely untested. I plan to update it as I work on supporting hardware and code. Use at your own risk. Some know issues:
  • FIXED: ROL and ROR haven't been updated for a 16 bit accumulator.
  • Extra cycle counts haven't been considered for any new to 65816 opcodes.
  • ADC and SBC in decimal mode are likely invalid in 16 bit.
  • Native mode hasn't been tested outside of bank 0. Assume it will fail for this until it is tested. Currently only 3 banks of memory are modeled, by py65 default, but this can easily be changed.
  • The simulation is meant to emulate the actual W65C816. Modelling so far has been based on the 65816 Programming Manual only. I intend to test at least some code against the W65C265SXB development board.
  • Currently no way to break to the py65 monitor.
  • Register wrapping of Direct page addressing modes need tested.
  1. While Liara Forth runs in py65 with the new 65C816 device, it isn't hard to make it crash. I believe this is due to my code, rather than Liara Forth, even though it is marked as an ALPHA version. Liara Forth runs entirely in bank 0. There is no way to break to the monitor since Liara Forth was designed to run on hardware only. It can only be ended with a control-C.

  2. I've successfully run a non-interrupt version of my own 6502 Forth in the new 65C816 device in emulation mode. This isn't surprising since much of the code comes from py65 6502 and 65C02 devices. I expect an interrupt version of it will run as well, but I haven't tested this. I expect that many 6502 programs will run in emulation mode. Note however, that there are differences between the 65C816 operating in emulation mode and the 6502/65C02 that could cause problems with your program.

Status

  • Initial commit: January 11, 2022
  • Successfully tested my 65C02 Forth in emulation mode
  • Was able to run Liara Forth in native mode in block 0.
    • FIXED: (Many words cause it to crash (likely due to one of the limitations listed above).)
    • Currently all numbers print out as 0. Unclear why.

Next Steps

  • Resolve simulator issues with running Liara Forth. I view this as a robust test of the 65816 simulator, other than bank switching, which Liara Forth doesn't handle out of the box. Some hardware specific Liara Forth features will not work with the simulator (KEY? for example which is hardwired to a W65C265SXB development board specific address indicating whether a key has been pressed).
  • Add native mode unit tests.
Ray-based parallel data preprocessing for NLP and ML.

Wrangl Ray-based parallel data preprocessing for NLP and ML. pip install wrangl # for latest pip install git+https://github.com/vzhong/wrangl See exa

Victor Zhong 33 Dec 27, 2022
Search with BERT vectors in Solr and Elasticsearch

Search with BERT vectors in Solr and Elasticsearch

Dmitry Kan 123 Dec 29, 2022
Python functions for summarizing and improving voice dictation input.

Helpmespeak Help me speak uses Python functions for summarizing and improving voice dictation input. Get started with OpenAI gpt-3 OpenAI is a amazing

Margarita Humanitarian Foundation 6 Dec 17, 2022
Translation to python of Chris Sims' optimization function

pycsminwel This is a locol minimization algorithm. Uses a quasi-Newton method with BFGS update of the estimated inverse hessian. It is robust against

Gustavo Amarante 1 Mar 21, 2022
[KBS] Aspect-based sentiment analysis via affective knowledge enhanced graph convolutional networks

#Sentic GCN Introduction This repository was used in our paper: Aspect-Based Sentiment Analysis via Affective Knowledge Enhanced Graph Convolutional N

Akuchi 35 Nov 16, 2022
Open solution to the Toxic Comment Classification Challenge

Starter code: Kaggle Toxic Comment Classification Challenge More competitions ЁЯОЗ Check collection of public projects ЁЯОБ , where you can find multiple

minerva.ml 153 Jun 22, 2022
Data loaders and abstractions for text and NLP

torchtext This repository consists of: torchtext.data: Generic data loaders, abstractions, and iterators for text (including vocabulary and word vecto

3.2k Dec 30, 2022
A Facebook Messenger Chatbot using NLP

A Facebook Messenger Chatbot using NLP This project is about creating a messenger chatbot using basic NLP techniques and models like Logistic Regressi

6 Nov 20, 2022
Japanese Long-Unit-Word Tokenizer with RemBertTokenizerFast of Transformers

Japanese-LUW-Tokenizer Japanese Long-Unit-Word (хЫ╜шкЮчаФщХ╖хНШф╜Н) Tokenizer for Transformers based on щЭТчй║цЦЗх║л Basic Usage from transformers import RemBertToken

Koichi Yasuoka 3 Dec 22, 2021
A simple tool to update bib entries with their official information (e.g., DBLP or the ACL anthology).

Rebiber: A tool for normalizing bibtex with official info. We often cite papers using their arXiv versions without noting that they are already PUBLIS

(Bill) Yuchen Lin 2k Jan 01, 2023
NLP and Text Generation Experiments in TensorFlow 2.x / 1.x

Code has been run on Google Colab, thanks Google for providing computational resources Contents Natural Language Processingя╝ИшЗкчД╢шпншиАхдДчРЖя╝Й Text Classificati

1.5k Nov 14, 2022
Twitter bot that uses NLP models to summarize news articles referenced in a user's twitter timeline

Twitter-News-Summarizer Twitter bot that uses NLP models to summarize news articles referenced in a user's twitter timeline 1.) Extracts all tweets fr

Rohit Govindan 1 Jan 27, 2022
Turn clang-tidy warnings and fixes to comments in your pull request

clang-tidy pull request comments A GitHub Action to post clang-tidy warnings and suggestions as review comments on your pull request. What platisd/cla

Dimitris Platis 30 Dec 13, 2022
Correctly generate plurals, ordinals, indefinite articles; convert numbers to words

NAME inflect.py - Correctly generate plurals, singular nouns, ordinals, indefinite articles; convert numbers to words. SYNOPSIS import inflect p = in

Jason R. Coombs 762 Dec 29, 2022
PyTorch implementation and pretrained models for XCiT models. See XCiT: Cross-Covariance Image Transformer

Cross-Covariance Image Transformer (XCiT) PyTorch implementation and pretrained models for XCiT models. See XCiT: Cross-Covariance Image Transformer L

Facebook Research 605 Jan 02, 2023
DANeS is an open-source E-newspaper dataset by collaboration between DATASET JSC (dataset.vn) and AIV Group (aivgroup.vn)

DANeS - Open-source E-newspaper dataset Source: Technology vector created by macrovector - www.freepik.com. DANeS is an open-source E-newspaper datase

DATASET .JSC 64 Aug 17, 2022
translate using your voice

speech-to-text-translator Usage translate using your voice description this project makes translating a word easy, all you have to do is speak and...

1 Oct 18, 2021
рдорд░рд╛рдареА рднрд╛рд╖рд╛ рд╡рд╛рдЪрд╡рд┐рдгреНрдпрд╛рдЪрд╛ рдПрдХ рдкреНрд░рдпрд╛рд╕. рдЗрдВрдЧреНрд░рдЬреА рддреЗ рдорд░рд╛рдареАрдЪрд╛ рд╢рдмреНрджрдХреЛрд╢. An attempt to preserve the Marathi language. A lightweight and ad free English to Marathi thesaurus.

For English, scroll down рдорд░рд╛рдареА рд╢рдмреНрдж рдорд░рд╛рдареА рднрд╛рд╖рд╛ рд╡рд╛рдЪрд╡рдгреНрдпрд╛рд╕рд╛рдареА рдореА рд╣рд╛ рдУрдкрди рд╕реЛрд░реНрд╕ рдкреНрд░реЛрдЬреЗрдХреНрдЯ рд╕реБрд░реВ рдХреЗрд▓рд╛ рдЖрд╣реЗ. рдорд╛рдЭреНрдпрд╛ рдорддреЗ, рдЖрдкрд▓реА рднрд╛рд╖рд╛ рд╣рд│реВрд╣рд│реВ рдЖрдгрд┐ рдХреЛрдгрд╛рдЪрд╛рд╣реА рд▓рдХреНрд╖рд╛рдд

рдореБрдХреНрдд рд╕реНрддреНрд░реЛрдд 20 Oct 11, 2022
Python interface for converting Penn Treebank trees to Stanford Dependencies and Universal Depenencies

PyStanfordDependencies Python interface for converting Penn Treebank trees to Universal Dependencies and Stanford Dependencies. Example usage Start by

David McClosky 64 May 08, 2022