Page 1 of 2

Linux console-based 6502 emulator anywhere?

Posted: Thu May 31, 2007 3:38 am
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.

Posted: Thu May 31, 2007 5:35 am
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

Re: Linux console-based 6502 emulator anywhere?

Posted: Thu May 31, 2007 6:49 am
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é

Posted: Thu Dec 11, 2008 7:17 pm
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 :)

Posted: Thu Dec 11, 2008 8:20 pm
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.

Posted: Mon Dec 22, 2008 5:53 pm
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.

Posted: Mon Dec 22, 2008 6:19 pm
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!

Posted: Tue Dec 23, 2008 1:22 am
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?

Posted: Tue Dec 23, 2008 1:26 am
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

the other lib6502

Posted: Fri Jan 09, 2009 9:10 am
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

Re: the other lib6502

Posted: Mon Jan 12, 2009 8:19 pm
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 ;)

Re: the other lib6502

Posted: Mon Jan 12, 2009 9:44 pm
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.

Re: the other lib6502

Posted: Tue Jan 13, 2009 8:02 pm
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!

Posted: Wed Jan 14, 2009 11:44 pm
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.

Posted: Thu Jan 15, 2009 4:30 pm
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.