Linux console-based 6502 emulator anywhere?

Topics pertaining to the emulation or simulation of the 65xx microprocessors and their peripheral chips.
daivox
Posts: 30
Joined: 04 Sep 2004
Location: Last Ninja 2: Basement

Linux console-based 6502 emulator anywhere?

Post by daivox »

I'm wondering if there are any 6502 emulators that use the Linux console instead of Windows or X11, etc. GUIs. I want to turn an old Pentium 133 into a 6502 development system, but don't want to use X11 to do it. I doubt it exists, but if there is one, I'm all ears.
kc5tja
Posts: 1706
Joined: 04 Jan 2003

Post by kc5tja »

My lib65816 package is designed to be modular enough to write your own emulators. True, it's designed for the 65816, but if you keep it in emulation mode, it ought to mimick the 6502 very closely, provided you don't use 65C02-specific opcodes.

http://www.falvotech.com/content/lib65816
fachat
Posts: 1124
Joined: 05 Jul 2005
Location: near Heidelberg, Germany
Contact:

Re: Linux console-based 6502 emulator anywhere?

Post by fachat »

daivox wrote:
I'm wondering if there are any 6502 emulators that use the Linux console instead of Windows or X11, etc. GUIs. I want to turn an old Pentium 133 into a 6502 development system, but don't want to use X11 to do it. I doubt it exists, but if there is one, I'm all ears.
Before I joined the VICE emulator team, I started my own, console-based (ncurses that is) C64 emulator. It's in a desparate state, but works to the READY prompt and IIRC can even access files.

Look for "xcbm" on:
http://www.6502.org/users/andre/misc/index.html

André
User avatar
Twylo
Posts: 11
Joined: 11 Dec 2008
Location: Fremont, CA, USA
Contact:

Post by Twylo »

I'd just like to add a "me too" to this thread. I've started working on my first ever 6502 SBC (keeping it simple, since this is my first full microcomputer design), and I'd love a simulator for doing software debugging.

The existing simulators I've found seem to be Commodore 64 simulators, or Windows-only, or highly non-configurable. Ideally I'd want text-only (or curses based), something that would work on OS X or Linux -- or even Windows, with the right libraries -- where I can adjust the memory map to suit my design, and log memory accesses to certain locations.

I started working on a 6502 system simulator in Java (because it's my strongest compiled language at the moment, and I didn't want to have to dust off my C knowledge), but it just feels like re-inventing the wheel. I'd much rather just enhance someone else's work, rather than create Yet Another 6502 CPU Simulator :)
kc5tja
Posts: 1706
Joined: 04 Jan 2003

Post by kc5tja »

Once again, I maintain a 65816 emulator library, called "lib65816", for the Linux platform. It's 100% independent of any emulator. It stands without documentation because nobody heretofore has demonstrated any interest. However, I'd be happy to help anyone willing to write a simple console emulator using it. I'm unfortunately too busy to write such a virtual machine myself, as I'm working on my Kestrel project.

See http://www.bitbucket.org/kc5tja/lib65816/overview/ for the Mercurial repository. From there, you can also download a .zip or .gz file as well.

Again, this is just the CPU emulation library. You'll still need to write the surrounding emulator; but if all you're interested in is a virtual machine a la qemu or some such, you can use the WDM opcode handler as a kind of "system call" opcode, allowing you to interface to the host OS fairly easily. With that, there's really not even any need for creating virtual peripherals.

Let me know if you have any problems.
User avatar
Twylo
Posts: 11
Joined: 11 Dec 2008
Location: Fremont, CA, USA
Contact:

Post by Twylo »

kc5tja wrote:
I maintain a 65816 emulator library, called "lib65816", for the Linux platform.
Hello! Thanks for your reply. I'm sorry I misread your original post, for some odd reason I thought your 65816 library only ran in native mode, not 6502 mode. I have no idea why I believed that! I'll definitely dig into it, the library looks very thorough, and probably easy to wrap a simulator around.
kc5tja
Posts: 1706
Joined: 04 Jan 2003

Post by kc5tja »

Nope -- it emulates a complete 65816, so far as I am aware, right down to reset behavior and cycle-counting (although, you can safely ignore cycle counts if you want to just emulate the program without concern to real-time performance). It even groks interrupts!
kc5tja
Posts: 1706
Joined: 04 Jan 2003

Post by kc5tja »

That's funny -- my post above was marked as a "new message", even though I was the one who actually posted it. Anyone else seeing anomalous behavior like this?
User avatar
8BIT
Posts: 1787
Joined: 30 Aug 2002
Location: Sacramento, CA
Contact:

Post by 8BIT »

kc5tja wrote:
That's funny -- my post above was marked as a "new message", even though I was the one who actually posted it. Anyone else seeing anomalous behavior like this?
My posts are usually marked as new posts. Purhaps its how one exits the post. I usually pick return to forum vs. see my post (not exact wording).

Daryl
User avatar
BigEd
Posts: 11464
Joined: 11 Dec 2008
Location: England
Contact:

the other lib6502

Post by BigEd »

I highly recommend Ian Piumarta's lib6502: it's console based, has a BBC mode, is readily extensible. Beautiful code, in fact.

http://piumarta.net/software/lib6502/lib6502-1.0
User avatar
ptorric
Posts: 85
Joined: 13 Feb 2005
Contact:

Re: the other lib6502

Post by ptorric »

BigEd wrote:
I highly recommend Ian Piumarta's lib6502: it's console based, has a BBC mode, is readily extensible. Beautiful code, in fact.

http://piumarta.net/software/lib6502/lib6502-1.0
I found this library very nice, thank you.
I've got some problem compiling it with the microsoft c++ express edition: it compile quite fine (with a couple of cast added) but the bbc emulation wont run.

is there anyway here in the forum with experience with this, before starting debugging ;)
User avatar
BigEd
Posts: 11464
Joined: 11 Dec 2008
Location: England
Contact:

Re: the other lib6502

Post by BigEd »

Does it run the trivial examples from the readme? You don't need the BBC emulation for that.

Could you show us what you see?

I have a couple of patches somewhere but they're not essential.
User avatar
ptorric
Posts: 85
Joined: 13 Feb 2005
Contact:

Re: the other lib6502

Post by ptorric »

BigEd wrote:
Does it run the trivial examples from the readme? You don't need the BBC emulation for that.

Could you show us what you see?

I have a couple of patches somewhere but they're not essential.
I'm afraid to be a bit off topic here, anyway...
i can run fine the examples and not-so-big-problem during compile time, i instert only a couple of cast

Code: Select all

typedef unsigned int uint16_t;
typedef unsigned char uint8_t;
...that i hope are right.

but i cannot run the bbc emulator with os12.rom and the basic rom, no prompt.

i found nice the idea to have a bbc rom operating in the emulator, because it is a simple environment to use for testing 6502 software.
anyway i'm open to receive hints, at the present i'm working on 6502 figforth and i need a place for running it.
tnx!
kc5tja
Posts: 1706
Joined: 04 Jan 2003

Post by kc5tja »

Code: Select all

typedef unsigned short uint16_t;
Do not use int, because that refers to the processor's natural word width. Use short or long for 16- and 32-bit widths explicitly.
John West
Posts: 383
Joined: 03 Sep 2002

Post by John West »

kc5tja wrote:

Code: Select all

typedef unsigned short uint16_t;
Do not use int, because that refers to the processor's natural word width. Use short or long for 16- and 32-bit widths explicitly.
Just don't be surprised if they ever change size.

I've used one platform where char, short, and int were all 16 bit (long was probably 32 bit, but I don't remember, and doubt I used it). And another with 64 bit longs.

But on most platforms that most people will experience today, short=16 and long=32 is reasonably safe.
Post Reply