https://devblogs.microsoft.com/oldnewthing/20251104-00/?p=111758 Skip to main content [RE1Mu3b] Microsoft Dev Blogs Dev Blogs Dev Blogs * Home * Developer + Microsoft for Developers + Visual Studio + Visual Studio Code + Develop from the cloud + All things Azure + Xcode + DevOps + Windows Developer + ISE Developer + Azure SDK + Command Line + Aspire * Technology + DirectX + Semantic Kernel * Languages + C++ + C# + F# + TypeScript + PowerShell Team + Python + Java + Java Blog in Chinese + Go * .NET + All .NET posts + .NET Aspire + .NET MAUI + AI + ASP.NET Core + Blazor + Entity Framework + NuGet + Servicing + .NET Blog in Chinese * Platform Development + #ifdef Windows + Azure AI Foundry + Azure Government + Azure VM Runtime Team + Bing Dev Center + Microsoft Edge Dev + Microsoft Azure + Microsoft 365 Developer + Microsoft Entra Identity Developer + Old New Thing + Power Platform * Data Development + Azure Cosmos DB + Azure Data Studio + Azure SQL + OData + Revolutions R + Unified Data Model (IDEAs) * More [ ] Search Search * No results Cancel * Dev Blogs * The Old New Thing * The Microsoft SoftCard for the Apple II: Getting two processors to share the same memory November 4th, 2025 likecelebrate2 reactions The Microsoft SoftCard for the Apple II: Getting two processors to share the same memory Raymond Chen Raymond Chen Show more The Microsoft Z-80 SoftCard was a plug-in expansion card for the Apple II that added the ability to run CP/M software. According to Wikipedia, it was Microsoft's first hardware product and in 1980 was the single largest revenue source for the company. CP/M runs on an 8080 processor, but the Apple II has a 6502 processor. So how can you run CP/M on an Apple II? Answer: The card comes with its own 8080-compatible processor, the Zilog Z80, which was arguable better than the 8080 for a bunch of reasons given on its Wikipedia page.1 Great, you now have a processor. But what happens to the old 6502 processor? Ideally, you would just shut it off, but you can't go cold turkey because some things still had to be handled by the 6502.2 Nicole Branagan digs deeper into the story of how the two processors coexist. The idea is that the SoftCard tells the 6502 that it's doing DMA, so the 6502 pauses and waits for the DMA to complete. However, you can't leave the 6502 paused for too long or its internal registers degrade and lose their values. The solution is to take advantage of the Z80's REFRESH line, which the processor uses to signal that it's not accessing memory right now (because it's decoding an instruction). This tells external memory refresh circuitry that it can run and keep the RAM values refreshed so that they don't degrade and lose their values. On the Apple II, memory refreshing is done by the video circuitry, so there is need for a dedicated REFRESH signal. The SoftCard uses this signal to allow the 6502 to execute a tiny little bit. (Presumably it is sitting in a spin loop waiting to be woken.) This keeps the 6502's registers refreshed. When the SoftCard needs the 6502 to do actual work, it can update some memory to tell the 6502, "Break out of your spin loop and do something for me, then let me know the answer and go back to the spin loop." The Z80 then goes to sleep until it gets an answer from the 6502. Another wrinkle in the way that the 6502 and Z80 shared memory is in the memory map. Both the Z80 and 6502 consider the first 256 bytes of memory to be special and want to use it for different things. Furthermore, CP/M programs expect to be loaded at $0100, but the 6502 hard-codes its CPU stack to live in the range $0100-$01FF. There are other obstacles in the low part of the Apple II memory map: The Apple II system monitor uses $0200-$02FF as its keyboard input buffer, the bytes in the range $03F0-$03FF are used to hold interrupt vectors, and the text video frame buffer goes from $0400-$07FF. (There is a second text video frame buffer from $0800-$0BFF, but almost nobody uses it.) Other big obstacles are the memory range from $C000-$CFFF, which is used by peripheral devices, and the memory range from $D000-$FFFF, which holds the Apple II monitor ROM, but can be replaced by RAM if you have the Language Card (a 16KB memory expansion card), except that the last few bytes $FFFA-$FFFF are used by the CPU as interrupt vectors. The solution is to remap the memory by putting address translation circuitry on the SoftCard, so that when the Z80 asks for memory address $0000, say, it actually gets physical memory $1000. The remapping is carefully arranged so that all of the Apple II's special reserved addresses get shuffled to the end of the Z80 memory map, and all of the Apple II's normal RAM occupies contiguous address space in the Z80 memory map starting at $0000.3 6502 Physical Z80 Special use $0000-$0FFF \ $1000-$1FFF $0000-$0FFF $1000-$1FFF $2000-$2FFF $1000-$1FFF $2000-$2FFF $3000-$3FFF $2000-$2FFF $3000-$3FFF $4000-$4FFF $3000-$3FFF $4000-$4FFF $5000-$5FFF $4000-$4FFF normal RAM (contiguous, normal RAM $5000-$5FFF $6000-$6FFF $5000-$5FFF up to (contiguous, installed RAM) up to $6000-$6FFF / $7000-$7FFF $6000-$6FFF installed RAM) $7000-$7FFF $8000-$8FFF $7000-$7FFF $8000-$8FFF $9000-$9FFF $8000-$8FFF $9000-$9FFF $A000-$AFFF $9000-$9FFF $A000-$AFFF $B000-$BFFF $A000-$AFFF $B000-$BFFF $D000-$DFFF $B000-$BFFF expansion RAM I/O space $C000-$CFFF \ $E000-$EFFF $C000-$CFFF (except for last 6 bytes) $D000-$DFFF $F000-$FFFF $D000-$DFFF expansion RAM (except for $E000-$EFFF / $C000-$CFFF $E000-$EFFF I/O space last 6 bytes) $F000-$FFFF $0000-$0FFF $F000-$FFFF Special use The SoftCard manual contained lots of details on how to write code for it. For example, it included instructions on how to call into a 6502 subroutine from Z80 and had a chart showing how the memory was remapped for the Z80. It even included the Z80 processor reference manual, listing all the instructions. This will come in handy in a future story. 1 I don't know where the hyphen in Z-80 came from. 2 In many places, I/O was handled by timing loops, so if you wanted to access, say, the game paddles, you had to let the 6502 do the I/O with its precise software timing loops. 3 There were also two high resolution graphics frame buffers, one at $2000-$3FFF, and another at $4000-$5FFF. These were right in the middle of the Z80 memory map, but in practice it wasn't a problem because CP/M was a text-mode operating system, so the programs you were running didn't try to do graphics anyway. 2 * * * * * * 3 1 * Facebook Share on Facebook * Share on X * LinkedIn Share on Linkedin Category Old New Thing Topics History Share * * * Author Raymond Chen Raymond Chen Raymond has been involved in the evolution of Windows for more than 30 years. In 2003, he began a Web site known as The Old New Thing which has grown in popularity far beyond his wildest imagination, a development which still gives him the heebie-jeebies. The Web site spawned a book, coincidentally also titled The Old New Thing (Addison Wesley 2007). He occasionally appears on the Windows Dev Docs Twitter account to tell stories which convey no useful information. 3 comments Join the discussion. Leave a commentCancel reply Sign in [ ] [Reply] [Cancel] Code of Conduct Sort by : Newest Newest Popular Oldest * [png] Vincent Weaver 4 hours ago 0 Collapse this comment Copy link There is a second text video frame buffer from $0800-$0BFF, but almost nobody uses it.) To the extent that when they designed the Apple IIgs they forgot to handle it and had to add a last-minute hack to handle it in software (until a later BIOS revision). quite the problem if you want to play the Apple II version of Myst which uses page-flipping in lo-res mode and so has to enable the slow workaround on IIgs systems Log in to Vote or Reply * [png] word merchant 8 hours ago 0 Collapse this comment Copy link What a fantastic and fascinating piece of engineering, and a well written manual too. It's always impressive when people bend hardware to do way more than anyone originally envisaged; limited capability environments really pushed people to try crazy, yet brilliant things. Another example: I still remain both impressed and appalled how the Sinclair ZX81 interleaved screen updates with actually running programs. Log in to Vote or Reply * [png] Henry Skoglund November 4, 2025 0 Collapse this comment Copy link Have fond memories working on the Apple ][ with the Z-80 SoftCard and CP/M. I remember writing business software using WordStar and Pascal MT+ (a step up from the UCSD Pascal native to the Apple ][). I think because Visicalc helped sell so many Apple ][s , the SoftCard arrived nicely to a pretty big market. Log in to Vote or Reply Read next November 3, 2025 Why does SHFormatDateTime take an unaligned FILETIME? Raymond Chen Raymond Chen October 28, 2025 How did the Windows 95 user interface code get brought to the Windows NT code base? Raymond Chen Raymond Chen Stay informed Get notified when new posts are published. [ ] Subscribe By subscribing you agree to our Terms of Use and Privacy Follow this blog youtube Are you sure you wish to delete this comment? OK Cancel Sign in Theme Insert/edit link Close Enter the destination URL URL [ ] Link Text [ ] [ ] Open link in a new tab Or link to existing content Search [ ] No search term specified. Showing recent items. Search or use up and down arrow keys to select an item. Cancel [Add Link] Code Block x Paste your code snippet [ ] Ok Cancel What's new * Surface Pro * Surface Laptop * Surface Laptop Studio 2 * Copilot for organizations * Copilot for personal use * AI in Windows * Explore Microsoft products * Windows 11 apps Microsoft Store * Account profile * Download Center * Microsoft Store support * Returns * Order tracking * Certified Refurbished * Microsoft Store Promise * Flexible Payments Education * Microsoft in education * Devices for education * Microsoft Teams for Education * Microsoft 365 Education * How to buy for your school * Educator training and development * Deals for students and parents * AI for education Business * Microsoft Cloud * Microsoft Security * Dynamics 365 * Microsoft 365 * Microsoft Power Platform * Microsoft Teams * Microsoft 365 Copilot * Small Business Developer & IT * Azure * Microsoft Developer * Microsoft Learn * Support for AI marketplace apps * Microsoft Tech Community * Microsoft Marketplace * Marketplace Rewards * Visual Studio Company * Careers * About Microsoft * Company news * Privacy at Microsoft * Investors * Diversity and inclusion * Accessibility * Sustainability Your Privacy Choices Your Privacy Choices Consumer Health Privacy * Sitemap * Contact Microsoft * Privacy * Manage cookies * Terms of use * Trademarks * Safety & eco * Recycling * About our ads * (c) Microsoft 2025