Michal Kowalski's 6502 simulator

Topics pertaining to the emulation or simulation of the 65xx microprocessors and their peripheral chips.
leeeeee
In Memoriam
Posts: 347
Joined: 30 Aug 2002
Location: UK
Contact:

Michal Kowalski's 6502 simulator

Post by leeeeee »

Michal has at last released the source code to his excelent 6502 simulator. You can find it at ..

http://exifpro.com/utils.html

Anyone here fancy actively developing it? I don't have the time (or C experience) ATM.

Cheers,

Lee.
Last edited by leeeeee on Sat Dec 03, 2011 9:48 am, edited 1 time in total.
User avatar
BitWise
In Memoriam
Posts: 996
Joined: 02 Mar 2004
Location: Berkshire, UK
Contact:

Post by BitWise »

I'll take a look at it.
Andrew Jacobs
6502 & PIC Stuff - http://www.obelisk.me.uk/
Cross-Platform 6502/65C02/65816 Macro Assembler - http://www.obelisk.me.uk/dev65/
Open Source Projects - https://github.com/andrew-jacobs
Nightmaretony
In Memoriam
Posts: 618
Joined: 27 Jun 2003
Location: Meadowbrook
Contact:

Post by Nightmaretony »

EXCELLENT. Now, if only hte help file would come into English, then I woiuld be a happy puppy.

serisouly, got it going along nicely out here. Only other thign that would be neat would be to build up a hardware emulation part so that you can specifiy rom, ram and 6522 location and have it view those registers and accesses (mainly the 6522 :)....
"My biggest dream in life? Building black plywood Habitrails"
leeeeee
In Memoriam
Posts: 347
Joined: 30 Aug 2002
Location: UK
Contact:

Post by leeeeee »

The file Macroassembly.txt is the important part of the help file in English, the rest of the help file is a Polish translation of a 6502 instruction guide.

You can make a ROM area by setting the detect write attempt flag and specifying a range.

Things that would make my life easier are -

If the code isn't already running then RESET starts the code as if power had just been applied in a real 6502 system.

That the fill byte for unused memory could be user defined. At the moment unused bytes are filled with $00 which is a PITA for making EPROM images. It also means some code works that would fail with the random mess you get in real RAM at power up.

Make the memory window a hex edit window. It would be soooo good to be able to type over bytes or move bytes. The current way to modify the memory is a bit cumbersome.

Need more 6502 core types. The 6502, 65C02, R6502, M38067, CCU3000 etc are all very similar and I use all of them but can't easily test code for anything but the 65(C)02.

</wish_list>

Cheers,

Lee.
MaN
Posts: 3
Joined: 13 Apr 2004
Location: Fin

Post by MaN »

It would be great to be able to add your on emulated/simulated devices (maybe as plugins?).

-MaN-
Nightmaretony
In Memoriam
Posts: 618
Joined: 27 Jun 2003
Location: Meadowbrook
Contact:

Post by Nightmaretony »

So far, the RAM/ROM simulators seem to work out well on it so far. I have a checksum calculator for the ROM side of it and it works correctly in the simulator. The trick is more the 6522, thats all. One part of my POST tests out the interrupt which the simulator doesnt emulate, I dont think. But so far, its been shotgunning all the way out here :)
"My biggest dream in life? Building black plywood Habitrails"
leeeeee
In Memoriam
Posts: 347
Joined: 30 Aug 2002
Location: UK
Contact:

Post by leeeeee »

You can generate timed interrupts by selecting Simulator - Generate Interrupt - Generator... (or Ctrl+Shift+G) and then set the generator to do the work. Not ideal but much better than nothing.

This works well enough to be able to run a clock written in BASIC.

Cheers

Lee.
scratchmonkey
Posts: 12
Joined: 28 Apr 2004

awakened

Post by scratchmonkey »

Just thought i'd stick my nose in and say i'm building a 65X02 emulator in C#/.net at the moment. You can (as requested) build up devices programmatically although i am working on doing this via XML and generating the system at runtime.

Sale to generate a system at the moment (minus anything to do with XML):
Quote:
Bus b = new Bus();

Cpu6502 c = new Cpu6502(b);

MemoryRAM ram = new MemoryRAM(b, 0x0000, 0x4000);
// params: b =bus, base address, size

MemoryROM rom = new MemoryROM(b, 0xE800, 0x1800, "monitor.obj");
// params: b =bus, base address, size, binary image
c.Reset();

while(true)
c.ExecInstruction();
This is in the early stages of development but assuming i get a few minutes here and there, i'll try and get a release out before the end of the year.

When i say 65x02, there is a base 6502 model on which you could build a 65C02, 65C102
daniel_bingamon
Posts: 5
Joined: 22 Jan 2003
Location: Kings Mills, OH
Contact:

Post by daniel_bingamon »

I have written a Machine Language Monitor with assemble and dissasemble functions in plain C. It was part of an unfinished 6502 simulator project. If anyone is interested, send me a private message.
Raf
Posts: 19
Joined: 02 Aug 2005
Location: Poland
Contact:

Post by Raf »

if anyone would like some of polish texts translated - just ask me
owns 1xC128, 1x128D cr ,1xc64 (broken unfortunately) ,1xc64c ,2xc64g (one is broken) ,~4xc64e ,1x1541 ,1x1541-II ,1x1541C and some chips for those machines ;-)

www.vulture.c64.org
www.rafalszyja.republika.pl
User avatar
Ruud
Posts: 259
Joined: 12 Dec 2003
Location: Heerlen, NL
Contact:

Post by Ruud »

Raf wrote:
if anyone would like some of polish texts translated - just ask me
Niema problemu, moja kochana jest Polka :)

But regarding emulators, for those who don't know: at http://www.viceteam.org/ you'll find an emulator that can emulate various Commodores computers and drives. Written in C, freeware.
The emulation covers the 6545, a 6845 clone, 6520 (6821 clone), 6522, 6551 and various other IC's. IMHO a matter of rearranging the hardware, implementing your own Kernal and have it a go.

The above is just an idea, I myself am more a Pascal guy and my C knowledge isn't that good.

Code: Select all

    ___
   / __|__
  / /  |_/     Groetjes, Ruud 
  \ \__|_\
   \___|       URL: www.baltissen.org

Raf
Posts: 19
Joined: 02 Aug 2005
Location: Poland
Contact:

Post by Raf »

offtopic ;-)
Ruud wrote:

Niema problemu, moja kochana jest Polka :)
heheh... przeczytalem to kiedys na Twojej stronie internetowej ;-) gdzie znalazles Polke w holandii? :D
owns 1xC128, 1x128D cr ,1xc64 (broken unfortunately) ,1xc64c ,2xc64g (one is broken) ,~4xc64e ,1x1541 ,1x1541-II ,1x1541C and some chips for those machines ;-)

www.vulture.c64.org
www.rafalszyja.republika.pl
Mats
Posts: 111
Joined: 24 Aug 2003

Post by Mats »

After having read Leee..s entusiastic contribution I decided to try this Kowalski system. Certainly nicely integrated. But for W65c02 users it is annoying that the "new operations" like

Code: Select all

  LDA (L1)
  STZ
etc are unknown!

And according to my understanding a string is a label if and only if it starts at column 1. This syntax is used by the assembler I wrote myself. But the Kowalski assembler takes for example "STA" as the operation, not as a label, even if it starts at column 1. But this is the old story that the assembler syntax is not absolutely standardised.
Mats
Posts: 111
Joined: 24 Aug 2003

Post by Mats »

The Kowalski simulator is fine to test out pure 6502 code not using the new W65C02 operations that one anyway can live very well without.

"MaN" writes:
Quote:
It would be great to be able to add your on emulated/simulated devices (maybe as plugins?).
No, I think this would be too big a task and even if in theory possible it would in practise probably be a "never ending project". And in any case not be worth the effort!

Then it would be better to make a full "in-circuite emulator" with a PC reading/writing all the pins of the 6502. The interface between the 6502 socket and the PC port could for example go over shift registers read/written by the PC (like for a typical EPROM programmer)

The classical approach is to debug using a Monitor like for example the MOS Monitor and to put BRK commands in the code. I have developped a very user friendly version of this! I have written a "demon" program on the 6502 system that is controlled by commands from a PC. These commands go from the PC parallel port to one of the 2 ports of a 6522 chip. This "demon" do all the usual Monitor tasks and sends data to the PC over the interface for display on the PC screen. In principle you see the same data on the PC screen as you see when using the Kowalski simulator. It is just that the program was executed on the 6502 system, not the PC, with the whole actual system (peripherical chips) interfacing with 6502 chip.

If there is interest for this and if Michael puts space on the WEB site to my disposal I would be willing to write up a description of this system (including the software for down-load).
leeeeee
In Memoriam
Posts: 347
Joined: 30 Aug 2002
Location: UK
Contact:

Post by leeeeee »

Mats wrote:
But for W65c02 users it is annoying that the "new operations" like

Code: Select all

  LDA (L1)
  STZ
etc are unknown!
65C02 opcodes such as ..

Code: Select all

	LDA	(zp)
	STZ	addr
.. work only in 65C02 mode. to set this mode go to Simulator - Options... - General and select the 65C02, 6501 button.

Lee.
Post Reply