6502 Processor Emulator

I've created a C++ library that (hopefully) emulates the 6502 (maybe part of the 65C02) processor. I believe it was used in the Commodore, as well as the Nintendo Entertainment System. I've created it as a step toward creating my first emulator, for the NES. However, to put it lightly, the docs I've found suck, so I'm not sure I've implemented every instruction appropriately. To help debug it, I'm creating an application similar to windows' debug that will allow me to essentially program for the 6502 and trace the code. But seeing as how knowing how to program for the 6502 and knowing what each instruction does are essentially the same thing, I must say I don't really know how to program for the 6502.

So, to the point. If anyone has 6502 (and/or 65C02) source code they could donate to my cause, I'd appreciate it. And if you're interested in taking a more active role as an experienced 6502 programmer, I'd appreciate that as well.

If so, contact me by email (anthem.dsl@verizon.net) or ICQ (2063124).

Thanks,
James

Comments

  • Hi!

    Interesting project! How do you get this far if you don't know how to program in 6502?

    There are sites that focus on 6502, such as:
    http://www.npsnet.com/danf/cbm/cross-development.html

    They have links to simulators and debuggers there, as well as cross-compilers, which I would assume you need since you don't actually have a 6502 to compile with.

    There's also a bit of info at this site on instruction sets, history, and Commodore and Apple (both of which used 6502) as well as some Nintendo info:

    http://www.geocities.com/SiliconValley/Byte/6508/6502/english/index.htm


    Finally, http://www.6502.org/ is packed with info, links, and message boards geared toward the 6502 fanatic!

    Have fun!

    Melissa


  • : How do you get this far if you don't know how to program in 6502?

    Well, I didn't mean to say I don't know how to programin in 6502. It's just a matter of not knowing exactly what every instruction does.

    Thanks for the info, I'll check it out. I'll post an occasional update on my progress for any who are interested.

  • : : How do you get this far if you don't know how to program in 6502?
    :
    By the way, I hope this came across the way I meant it. It wasn't a criticism. In fact, I was amazed that you had done as much as you had to this point, without being experienced in 6502

    :
    : Thanks for the info, I'll check it out. I'll post an occasional update on my progress for any who are interested.
    :

    I'm interested! Let us know how you do!

    Melissa


  • I understood, not to worry.

    Anyhow, at this point I have created a debugging program (similar to Win/dos' debug.exe) for the 6502 emulator I've created. It's not fully featured, but it can assemble, disassemble, do memory dumps and data entry, and trace the code. I may still have a few bugs with the functioning of the individual instructions, but at least the ADC and SBC ops, as well and many others, appear to work correctly. Most importantly, the flow control instructions appear to be functioning.

    Thanks for your interest.

  • : I dont understood, but look very interssting
    it is all about eMulation for PS2 some sort of old stufff
    do you know a good strating point to become a good progammer
    some library tutorial info ect...
    anyway ill read your post often : P
    see you around and GL

    Yazmo




  • : I've created a C++ library that (hopefully) emulates the 6502 (maybe part of the 65C02) processor. ...

    Hi James!

    Just wondering how the 6502 emulator project is going...

    Melissa

  • I wish I had good news to report, but unless no news is good news, it's not good. With school and everthing else, I haven't gotten any more work done with it. The 6502 processor emulator is fully functional (as far as I can tell), except for decimal mode arithmetic. I created a debug program for it, sort of a clone of Windows debug, which also works.
  • : I wish I had good news to report, but unless no news is good news, it's not good. With school and everthing else, I haven't gotten any more work done with it. The 6502 processor emulator is fully functional (as far as I can tell), except for decimal mode arithmetic. I created a debug program for it, sort of a clone of Windows debug, which also works.
    :
    It sounds like you're doing OK, and keeping priorities straight. It's more important to finish school stuff, though not as much fun.

    I have work that gets in my way too!




    [purple]Melissa[/purple]

  • I wish prioritizing my projects was as cut and dry as prioritizing everything else. I get too much stuff going on at once and leave other things in the dust.
  • : I've created a C++ library that (hopefully) emulates the 6502 (maybe part of the 65C02) processor. I believe it was used in the Commodore, as well as the Nintendo Entertainment System. I've created it as a step toward creating my first emulator, for the NES. However, to put it lightly, the docs I've found suck, so I'm not sure I've implemented every instruction appropriately. To help debug it, I'm creating an application similar to windows' debug that will allow me to essentially program for the 6502 and trace the code. But seeing as how knowing how to program for the 6502 and knowing what each instruction does are essentially the same thing, I must say I don't really know how to program for the 6502.
    :
    : So, to the point. If anyone has 6502 (and/or 65C02) source code they could donate to my cause, I'd appreciate it. And if you're interested in taking a more active role as an experienced 6502 programmer, I'd appreciate that as well.
    :
    : If so, contact me by email (anthem.dsl@verizon.net) or ICQ (2063124).
    :
    : Thanks,
    : James
    :
    :

    James, wasn't this the same 6502 that was in Amiga and Apple II?

  • :
    : James, wasn't this the same 6502 that was in Amiga and Apple II?
    :

    Unfortunately I'm not quite old enough to have lived the glory days of those computers, nor do I know much about them. But certainly it may be the same 6502.

    If you (or anyone, for that matter) would like a copy of my emulator/debugger, email me and I'd be happy to oblige. My email address should be given above.

    James
  • Hi people, here's a good page, the C64 programming one. Find the chapter on machine language programming.

    http://www.c64.ch/programming/C64PRG10.txt

    Here's some other pages:
    http://www.c64.ch/programming/memorymap.asp
    http://www.obelisk.demon.co.uk/6502/

    I've got a C64 at home (with a 6510 processor), so I could test some code for you (but it's tedious because I must use POKEs in BASIC). E-mail me any code at bthompson67665@yahoo.com

    Here's a loader for a game called DEFENDER I hand-disassembled included with the hex dump in the comments, real comments are after pipes:
    [code]
    ;Load at address $02A8:
    sei ;78
    lda $01,zp ;A5 01 | Use zero-page addressing.
    and #$FE ;29 FE | Clear bit0.
    sta $01,zp ;85 01 | Use zero-page addressing.
    lda #08 ;A9 08 | This load the logical file number (file handle).
    ldx #08 ;A2 08 | Device #8, the first floppy drive.
    ldy #$FF ;A0 FF | Secondary addr on serial bus, $FF if none specified.
    jsr $FFBA ;20 BA FF | SETLFS: Set First and Second Logical Address.
    lda #03 ;A9 03 | Length of the filename, not zero-based.
    ldx #C9 ;A2 C9 | Point Y:X to the file name, at $02C9.
    ldy #02 ;A0 02
    jsr $FFBD ;20 BD FF | SETNAM: Set Filename
    lda #00 ;A9 00 | 0=Load, 1=Verify
    jsr $FFD5 ;20 D5 FF | LOAD: Load RAM from device.
    jmp $8009 ;Jump to code.
    .db "DD*" ;This loads the defender program, this is at address $02C9.
    [/code]
  • This post has been deleted.
  • This post has been deleted.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories