6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Tue Nov 12, 2024 10:48 am

All times are UTC




Post new topic Reply to topic  [ 17 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: Fri Jan 04, 2013 1:48 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 6:43 am
Posts: 11
Location: Fremont, CA, USA
Hi Everyone,

I know, I know, the world needs another 6502 simulator like it needs a hole in the head. True! But even though the decision was ill-advised, I decided to write one anyway.

The homepage for my simulator, "Symon", is here: https://github.com/sethm/symon

Symon simulates an entire 6502 system with 32KB RAM, 16KB ROM, and a 6551 UART at $8800-$8803 (there's also a simulated 6522 VIA at $8000-$800F, but it doesn't actually do anything useful yet - everything is a no-op). There's a virtual 80x25 character serial terminal connected to the ACIA, a trace window, and a memory inspector/modifier. Very basic tools.

I wrote Symon in Java because when I first went looking for a good emulator that I could run on OS X or Linux, I had trouble finding what I wanted. I had used Michal Kowalski's excellent 6502 emulator on Windows, but since I do almost all of my work on OS X and Linux I wanted something I could cart around with me across platforms.

I actually started Symon in 2008, and then let it languish for a couple of years without working on it before I came back to it in 2012. It's at version 0.8.2 right now, and I still consider it beta, but it does have extensive testing for correct behavior and it passes all of Klaus Dormann's 6502 functional tests.

I'm already using it for testing my own 6502 code, and I hope it will turn into something more generally useful to others as I continue to work on it! Bug reports, enhancement requests, patches and critique are all welcome.

-Twylo


Top
 Profile  
Reply with quote  
PostPosted: Fri Jan 04, 2013 7:07 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10977
Location: England
Nicely done!

Nice feature: "The last 20,000 execution steps are disassembled and logged to the Trace Log Window."

Cheers
Ed


Top
 Profile  
Reply with quote  
PostPosted: Mon Jan 07, 2013 3:00 pm 
Offline

Joined: Mon Jan 07, 2013 2:42 pm
Posts: 576
Location: Just outside Berlin, Germany
Hi Twylo,

as luck would have it, I just installed it yesterday, and was up way too late with it. Great work, thank you! I'm using it on my MacBook Pro with Ophis. Installation worked without a hitch once I figured out how to get Maven.

Since you asked for enhancement requests -- you already have 65C02 support on your todo list, if I remember correctly -- some small interface details maybe: a) toggle button for the memory inspector that shows character strings (it will show garbage for code, of course), and b) hovering the mouse over the status bits gives their name and maybe even briefly their function?

The second one might seem silly, but as somebody who is just sticking his toe back in the 6502 waters after last programming it on an actual Vic-20, I'd like to stress how much easier these small things can make it for beginners and, uh, re-beginners. I'm having lots of "Oh yeah, that was it" moments, and a simulator such as Symon really lowers the barrier for experimenting. The more of these little hints there are, the quicker newbies can get up to speed (no pun intended).

Anyway, thanks again. Great work.


Top
 Profile  
Reply with quote  
PostPosted: Tue Jan 08, 2013 7:30 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 6:43 am
Posts: 11
Location: Fremont, CA, USA
Hi scotws!

I'm glad you got it to work. I really need to get a pre-compiled JAR available to download, so people don't need to worry about trying to build it.

scotws wrote:
a) toggle button for the memory inspector that shows character strings (it will show garbage for code, of course), and b) hovering the mouse over the status bits gives their name and maybe even briefly their function?


These are great ideas. I hadn't thought of the second one, but it would be very easy to add tool-tips to those status bits. I'll definitely do that ASAP.

I have already been planning to improve the memory window, the current implementation is basically "The simplest thing that could possibly work," and it could use some real improvement. Adding ASCII-equivalents is a good first step.

Thanks for trying it, and making suggestions!

-Twylo


Top
 Profile  
Reply with quote  
PostPosted: Tue Jan 08, 2013 11:03 pm 
Offline
User avatar

Joined: Fri Dec 11, 2009 3:50 pm
Posts: 3367
Location: Ontario, Canada
Quote:
as somebody who is just sticking his toe back in the 6502 waters after last programming it on an actual Vic-20 [...]
Welcome to the forum, scotws :) If you feel so inclined, feel free to post in the Introduce Yourself topic (under General Discussions) and tell us about yourself... perhaps including more about your interests and programming activities. Naturally if you have a 6502 question or anything related that you want to discuss you're also welcome to start a topic in whatever section is appropriate. (For questions or starting discussions, choose someplace other than "Introduce Yourself".)

cheers
Jeff

_________________
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html


Top
 Profile  
Reply with quote  
PostPosted: Wed Feb 06, 2013 11:13 am 
Offline

Joined: Mon Jan 07, 2013 2:42 pm
Posts: 576
Location: Just outside Berlin, Germany
Hi Twylo -

after using the emulator for a while longer now -- and thanks again -- I came up with another suggestion. Well, you did ask ...

It would be nice to be able to set different sizes and locations for RAM, ROM and I/O. Since RAM usually starts at $0000, a selection of 8K, 16K, and 32K would be great, since those seem to be the most common sizes people use (or at least that's what I'm picking up). For ROM, the same set of choices -- 8K ($E000 to $FFFF), 16K ($C000 to $FFFF), 32K ($8000 to $FFFF) -- would make it easier to use the emulator for a wider range of planned machines.

(For some reason, the stores in German only seem to carry the 8K 28C64-150 EEPROM or the 32K version, but nothing in 16K. Or maybe I'm looking in the wrong places.)

For the ACIA and the VIA, it would be nice to mark either/or (my plans for a first SBC currently only contain an ACIA) and given them different locations in the memory map (say, $8000 for the ACIA).

Since I'm completely ignorant of how much trouble all of this would be to implement, let me go whole hog and suggest a new window where you can click on memory banks with color-codes which show what the memory map contains there. Of course, that would mean that you would also have to include certain checks -- RAM needs ZP, interrupt vectors require ROM at the other end. It, ah, sounds like a lot of work :-) .

Of the other stuff already suggested and listed by yourself, I think support for WDC 65c02 commands might be the most valuable, since this seems to be the CPU variant that is easiest to buy. Of course, this observation has nothing at all to do with the fact that I'm thinking about using that very chip (cough).

Seriously, thanks again for all the work. It is making my life so much easier and is very much appreciated.


Top
 Profile  
Reply with quote  
PostPosted: Wed Mar 27, 2013 8:59 am 
Offline

Joined: Mon Mar 25, 2013 9:26 pm
Posts: 183
Location: Germany
From me too a big "thanks" for this simulator. I Think it will speed up my own homebrew project a lot.
After testing the first programs with the simulator I thought that it might be a good idea to have not only a "single step" button.
So I added simply three additional buttons to make 5, 10 and 50 steps at once.
The change is very simple, but for me it works great. Maybe somebody else may find this usefull.
Here's a patch for this:
Code:
--- symon-master/src/main/java/com/loomcom/symon/Simulator.java 2013-03-05 05:38:50.000000000 +0100
+++ symon-master_/src/main/java/com/loomcom/symon/Simulator.java        2013-03-27 09:47:16.000000000 +0100
@@ -129,6 +129,9 @@

     private JButton runStopButton;
     private JButton stepButton;
+    private JButton stepButton5;
+    private JButton stepButton10;
+    private JButton stepButton50;
     private JButton resetButton;

     private JFileChooser      fileChooser;
@@ -187,10 +190,16 @@

         runStopButton = new JButton("Run");
         stepButton = new JButton("Step");
+        stepButton5 = new JButton("5 Steps");
+        stepButton10 = new JButton("10 Steps");
+        stepButton50 = new JButton("50 Steps");
         resetButton = new JButton("Reset");

         buttonContainer.add(runStopButton);
         buttonContainer.add(stepButton);
+        buttonContainer.add(stepButton5);
+        buttonContainer.add(stepButton10);
+        buttonContainer.add(stepButton50);
         buttonContainer.add(resetButton);

         // Left side - console
@@ -219,6 +228,27 @@
             }
         });

+
+
+        stepButton5.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent actionEvent) {
+                for(int i=0;i<5;i++) handleStep();
+            }
+        });
+
+        stepButton10.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent actionEvent) {
+                for(int i=0;i<10;i++) handleStep();
+            }
+        });
+
+        stepButton50.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent actionEvent) {
+                for(int i=0;i<50;i++) handleStep();
+            }
+        });
+
+
         resetButton.addActionListener(new ActionListener() {
             public void actionPerformed(ActionEvent actionEvent) {
                 handleReset();

_________________
How should I know what I think, until I hear what I've said.


Top
 Profile  
Reply with quote  
PostPosted: Wed Mar 27, 2013 3:20 pm 
Offline

Joined: Mon Mar 25, 2013 9:26 pm
Posts: 183
Location: Germany
Just another short "update". I quickly added the ASCII-output of the memory window. So you can see the hex value as well as the ASCII-value of each byte.
All bytes with a value with less then 32 are shown as ".".
Here's the diff for that:
Code:
--- symon-master.orig/src/main/java/com/loomcom/symon/ui/MemoryWindow.java      2013-03-05 05:38:50.000000000 +0100
+++ symon-master//src/main/java/com/loomcom/symon/ui/MemoryWindow.java  2013-03-27 16:14:21.000000000 +0100
@@ -46,7 +46,7 @@
     private JTable memoryTable;
     private JTextField pageNumberTextField;

-    private static final Dimension MINIMUM_SIZE = new Dimension(380, 400);
+    private static final Dimension MINIMUM_SIZE = new Dimension(550, 500);

     /**
      * Initialize a new MemoryWindow frame with the specified Bus.
@@ -168,7 +168,7 @@
         private Bus bus;
         private int pageNumber;

-        private static final int COLUMN_COUNT = 9;
+        private static final int COLUMN_COUNT = 17;
         private static final int ROW_COUNT = 32;

         public MemoryTableModel(Bus bus) {
@@ -221,7 +221,12 @@
                 if (column == 0) {
                     return HexUtil.wordToHex(fullAddress(row, 1));
                 } else {
-                    return HexUtil.byteToHex(bus.read(fullAddress(row, column)));
+                   if(column < 9) {
+                       return HexUtil.byteToHex(bus.read(fullAddress(row, column)));
+                   } else {
+                       if(bus.read(fullAddress(row, (column-8))) < 32) return "." ;
+                       else return new String(new char[] { (char)bus.read(fullAddress(row, (column-8))) });
+                   }
                 }
             } catch (MemoryAccessException ex) {
                 return "??";


I will also try to give the original programmer a message about that. maybe my changes are good enough to find their way into the office software-branch.

_________________
How should I know what I think, until I hear what I've said.


Top
 Profile  
Reply with quote  
PostPosted: Sun Mar 31, 2013 5:36 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 6:43 am
Posts: 11
Location: Fremont, CA, USA
I've just released version 0.8.5 of Symon (available via GitHub or the main Symon homepage). It includes both of Mario's changes.

Actually, I modified the "Multiple Step" feature a little, and provided a drop-down selector for the number of steps to take. It defaults to 1, same as it used to be, but you can now select 1, 5, 10, 20, 50, or 100 steps per click.

The Memory window has been cleaned up a lot. The grey cell borders are gone, which I think looks a little cleaner. ASCII versions of printable characters are shown. You can also now click "Next" and "Previous" page buttons in the Memory Window.


Top
 Profile  
Reply with quote  
PostPosted: Fri Jan 31, 2014 11:06 pm 
Offline

Joined: Fri Jan 31, 2014 10:23 pm
Posts: 1
A noob here! I just downloaded your emulator and the ehbasic.rom files. Running on Windows 7 64-bit. The Emulator runs great!. :)
I've been thinking about building Chris Ward's 6502.
You asked for suggestions.....

How about a save feature? One could save a block of memory for later loading without having to start over with what you are working with.


Top
 Profile  
Reply with quote  
PostPosted: Tue Jan 05, 2016 11:59 am 
Offline

Joined: Tue Jan 05, 2016 8:27 am
Posts: 4
god bles you :)I seek c version,

You seem to know better than lib6502 , which I fail to dig at STEP /RUN?


Top
 Profile  
Reply with quote  
PostPosted: Wed Jan 06, 2016 4:16 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10977
Location: England
Just to note: Symon is now up to version 1.20, but the discussion about a C emulator proceeds over at
viewtopic.php?f=8&t=3578

Quote:
Symon is a general purpose simulator for systems based on the MOS Technologies 6502 microprocessor and compatibles. Symon is implemented in Java. Its core goals are accuracy, ease of development, clear documentation, and extensive test suites for validating correctness.

Symon simulates a complete system with a 1 MHz NMOS 6502, 32KB of RAM, 16KB of ROM, a MOS 6551 or Motorola 6850 ACIA, a MOS 6522 VIA, and an experimental 6545 CRTC.

Symon has extensive unit tests to verify correctness, and fully passes Klaus Dormann's 6502 Functional Test Suite


Top
 Profile  
Reply with quote  
PostPosted: Wed Jan 06, 2016 5:35 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 6:43 am
Posts: 11
Location: Fremont, CA, USA
Hello all,

Yes, Symon is up to version 1.2.0 now. It's slowly being expanded into a more useful debugging tool for 6502 SBC's. Maik Marten contributed mult-machine support for version 1.0, so it's easier to add new machine descriptions to the source.

As for a C version, back in 2014 (wow, that long ago already?) I started to port the entire Symon architecture over to C++, as "libsymon" (https://github.com/sethm/libsymon). The goal was to make the non-UI parts of the simulator available as a shared or static library for C and C++ projects to use.

I guess I haven't touched it much recently, and it's only actually implemented two instructions so far. But now that the infrastructure is in place, finishing the work shouldn't be too much trouble if people really want it.

-Twylo


Top
 Profile  
Reply with quote  
PostPosted: Mon Feb 22, 2016 5:53 am 
Offline
User avatar

Joined: Wed Jan 04, 2012 4:28 am
Posts: 31
Location: Florida
This is brilliant!

I built version 1.3.0-SNAPSHOT and fired up EhBASIC.
Nice GUI. It will be a valuable tool for any MOS 6502 enthusiast.
I did full MOS 6502 op-codes implementation in C++, including BCD mode: https://github.com/makarcz/vm6502
My emulator is nowhere as advanced as yours, just console based simple debug tool.
It is on early development stage, I am not sure where this will lead me yet.
It may end up the same way as many of my projects: unfinished and forgotten.
But hey - the journey is more important than destination - this is my philosophy.

Let me know if I can contribute in any way to your project.

Thank you.

_________________
Marek Karcz
---
"Don't worry. We've got our best people working on it."


Top
 Profile  
Reply with quote  
PostPosted: Thu Feb 25, 2016 5:06 pm 
Offline

Joined: Mon Mar 25, 2013 9:26 pm
Posts: 183
Location: Germany
Hey. Cool that this project is still alive. It's my favourite simulator on my Mac. Especially by defining on machine setups. Are there any plan adding the 65C02 opcodes to this puppy? It would be a big step forward.

Mario.

_________________
How should I know what I think, until I hear what I've said.


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 0 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: