In article <1rSdnYQ7edYPXkSgXTWQlg@News.GigaNews.Com>, Bryan Parkoff wrote: >NES on Apple II > > Is it possible to copy NES' ROM into Apple II memory location before I >can be able to program using assembly language to emulate NES' ROM. I >understand that NES uses 6502 microprocessor, but NES has more colors (256 >colorss?) than Apple II has. Hmm, let me try again with a better response for this question. I don't think I did a good job with that except for describing the video hardware. Basically, you can't really use an Apple II to emulate the NES, even though the CPU instruction set is almost identical. Why? Two major reasons: 1. Memory map is completely different. Here is the NES memory map: 2K of page-flipped RAM, 4 copies of a single page, between $0000 to $1FFF. That's 8K. 12K of I/O space, between $2000 and $4FFF. 4K of expansion module space, between $5000 and $5FFF. 8K of Cartridge RAM area, between $6000 and $7FFF. 16K of lower bank of cartridge ROM, between $8000 and $BFFF. 16K of upper bank of cartridge ROM, between $C000 and $FFFF. So... you have to decide which behavior you want to emulate -- the Apple II behavior or the NES behavior, but can't really piggyback both on the other easily, partly because of memory space limitations. If the Apple II had a 16 MHz processor and a larger address space, it *might* have been technically possible even if the idea of emulating the NES under Apple II hardware is a weird one. ;) 2. NES hardware is completely different. Apple II, you can draw to high res graphics screen by directly setting pixels in the $2000-3FFF area, then do some soft switch toggles in the $C0xx area. The entire RAM is directly addressable and accessible by the 6502 processor. There is no special custom graphics hardware involved. But with the NES and its video controller, the PPU, well... the PPU has its own VRAM area that is not directly accessible by the 6502 CPU, which is why you have to do some special toggles at certain locations. I think at $2000, which is a MAJOR PPU register mapped to normal RAM; you can do stuff like enable or disable VBL interrupts by setting or clearing a bit at $2000, for example. The NES's equivalent of the Apple II $C000 page is at $2000-2007 and $4000-4017 in the I/O area. Accessing peripherals is also very different because of the different internal bus design and peripheral interfaces. For example, you aren't going to find a 'slots' design in the NES like you do in the Apple II, and you aren't going to find the card's ROM in a 256 byte area in $C100-C800 space like you do for the Apple II. So to properly emulate the NES, you also have to emulate all of the NES hardware. I don't think Nintendo publically released the specs, so a lot of folks reverse engineered it, partly by using NDA'd docs. And some others probably used logic probes to figure out timing and sequencing for memory accesses to make various things happen. There must be about an half dozen to a dozen NES emulators released and some of them come with full source code that you can browse. Worth looking at them. Why? They will have information about the hardware specs that you must know to emulate them properly. A nice looking one is FakeNES, and their home page is at: http://fakenes.sourceforge.net/ Source code for FakeNES can be checked out with cvs. Info at: http://sourceforge.net/cvs/?group_id=39844 FakeNES is about 10,500 lines of C code and seems complete enough. The only thing that you might be able to reuse from an Apple II emulator for your own separate NES emulator might be the 6502 processing core code. Everything else, you'll have to write on your own, and the Apple II support will be completely useless, and will, in fact, get in your way if you don't do it as a true NES emulator from the ground up that doesn't sit under an Apple II layer. -Dan