6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Fri Oct 04, 2024 3:26 pm

All times are UTC




Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: Fri May 15, 2009 5:22 pm 
Offline

Joined: Fri May 15, 2009 5:00 pm
Posts: 2
Location: Ohio
I'm an admin for Appalm ][, an Apple II emulator for Palm OS (http://sourceforge.net/projects/palmapple/). The current 6502 emulator in Appalm was custom written in 68000 assembler for speed (it's based on YAE), but naturally this doesn't run very fast on Palm OS 5 devices, where 68000 code is emulated by the ARM processor. I'd like to replace the current 6502 emulator with one written in C, so it could be compiled to native ARM code (in a PNOlet). The license for Appalm is GNU GPL.

What approach would you recommend? Is there an existing emulator core that could be adapted to the Palm's somewhat quirky environment? (For example, Palm binaries must be divided up into units of 32KiB or less. PNOlets can have only one argument (typically a pointer to a table of parameters).)


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri May 15, 2009 7:01 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10945
Location: England
There are several but I'd recommend you take a look at Ian Piumarta's lib6502 - the main function is a shade under 32k in an x86 binary. (It's written for speed rather than size - I would think most emulators will be.)

It's freely reusable, and in C. I would expect it to be very portable. Plumbing it in is probably the interesting bit, and that's going to be similar for any emulator core you pick.

See lib6502 at http://piumarta.com/software/lib6502/ - the run6502 emulator may be a useful reference, but it's the lib6502 core you'd want.

Thinking about it, there must be some efficient 6502 emulation written in ARM given the history with Acorn - but it won't be C and it won't be GPL.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat May 16, 2009 9:20 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10945
Location: England
On second thoughts, lib6502 would probably need extra work because it uses a lot of memory: 64k for the memory image and another 12 x 64k for the hooks to trap OS calls and hardware actions.

This site has a catalogue of emulators at http://6502.org/tools/emu/

The upstream source for some of them is Earle Philhower's Commodore 64 Emulator, which is GPL'd C and can be found at http://zimmers.net/anonftp/pub/cbm/cros ... index.html as mac64-04.hqx

I was able to unpack that on Linux using
Code:
  hexbin mac64-04.hqx
  macunpack -U MAC64-04.SEA.bin

(utils from the macutils package)

(But you might be better off asking Mike or Daryl on this forum for their upstream sources, for http://pypi.python.org/pypi/py65/ and http://sbc.rictor.org/simulator.html respectively)


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat May 16, 2009 9:38 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10945
Location: England
Another starting point to consider is VICE, which is currently maintained and is GPL'd C. See http://www.viceteam.org/#download

The core of the CPU emulation seems to be this file
http://svn.akop.org/psp/trunk/vice/6510core.c

It looks like it has some support for different models of 6502 cores, but I couldn't say whether it is right for your purpose.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat May 16, 2009 3:41 pm 
Offline

Joined: Fri May 15, 2009 5:00 pm
Posts: 2
Location: Ohio
Thanks! Several of these look promising.

One can allocate data structures larger than 64k under Palm OS, you just have to keep each resource (including code resources) under 32k.

While there are C++ compilers for the Palm, Appalm is C only.

I should have mentioned that 65C02 emulation would be a strong plus, but that shouldn't be hard to add to a working simulator, right?


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat May 16, 2009 9:04 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10945
Location: England
reeder.29 wrote:
65C02 emulation would be a strong plus, but that shouldn't be hard to add to a working simulator, right?


Probably not - there are many emulators out there you can use for reference, and it looks like you're not keeping track of clock cycles so that's a detail you don't need to worry about.

(Using other code for reference doesn't raise any licensing issue, nor do you care which language they are written in. That really does open up the field.)

Cheers
Ed


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu May 21, 2009 6:10 am 
Offline

Joined: Sat Jan 04, 2003 10:03 pm
Posts: 1706
I also lazily maintain a 65816 emulator library as well. Speaking of which, I have a patch outstanding, but I haven't gotten around to committing it yet. I'll try to get to that tomorrow.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC


Who is online

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