11 ms·
Appler: Apple ][ emulator for IBM PC, written in 8088 assembly
- BlackFingolfin 4y agoThat is pretty amazing. Kudos to the authors, I never would have believed emulating an Apple II on an 8088 in a way that is actually usable would be remotely possible. The story in the README is also worth reading! E.g. > At the time we wrote Appler we of course knew that the colors are supposed to be purple, blue, green, and orange, but we had never seen them displayed by an actual physical computer, because the Apple ][ displays that were available in Bulgaria were all monochrome-green. Alex looked at the schematics, and he used the actual resistor values of the DAC to calculate what the 4 primary colors should be. WHAT??? Awesome
- anyfoo 4y agoThat's more or less equivalent to reading out the RGB values of the colors[1]. As far as I know (never had one), the Apple II's output was composite NTSC, so what colors the values actually correspond to is also standardized. Of course, different monitors will still have different color output, but that's basically a choice, and for emulators a reasonable one is to just go with what the NTSC standard says. [1] Might not actually be RGB, did not look at the schematic. But having RGB before modulating into NTSC's color difference signals is not uncommon.
- thought_alarm 4y ago> Might not actually be RGB, did not look at the schematic. But having RGB before modulating into NTSC's color difference signals is not uncommon The standard NTSC Apple II does not generate color this way, but the European PAL models do. The native Apple II video signal is 560x192 1-bit monochrome pixels. The PAL video circuit converts video signal into a digital stream of color pixels, 4 bits per pixel. It then converts the digital pixels into analog YPbPr signals by attaching various resistors to each of the 4 bits. The YPbPr signals are then fed into a PAL encoder chip. Presumably, the original authors used these YPbPr resistor values to determine the colors sent to their Bulgarian PAL/SECAM encoder. This is a schematic of the PAL color encoder for the Apple IIe: https://imgur.com/CQH7vNS https://imgur.com/CQH7vNS 1. The native monochrome video signal is SEROUT in the top-left of the schematic. It is fed into the LS164 shift register. 2. The LS175 buffer captures each 4-bit color pixel from the shift register. 3. The output of the LS175 is then fed through a various resistors to generate the YPbPr signal which are fed into the TCA650 PAL encoder.
- anyfoo 4y agoThanks, that's great context. Do I read it right that the NTSC Apple II generated "artifact colors" (heard that before, but did not know if it applies to the Apple II) through effectively monochrome pixels that just work out to the desired color in NTSC, but since that would not work for PAL (because of the phase flip each line, and because the colors would be different), PAL Apple IIs have some extra circuit to convert artifact color pixels into YPbPr and then modulate that using the TCA650?
- thought_alarm 4y agoYes, that's right. This page has more info: https://nerdlypleasures.blogspot.com/2021/10/apple-ii-composite-artifact-color-ntsc.html https://nerdlypleasures.blogspot.com/2021/10/apple-ii-compos... The PAL color circuit was initially an expansion card for the Apple II+ in 1979. The same circuit was built-in to the later Apple IIe and IIc models. A novel part of the design is that the TCA650 is actually a PAL decoder chip that is meant to split a composite video signal into YPbPr components. The Apple II drives the TCA650 in reverse to generate the composite signal.
- johannes1234321 4y agoSome what related: Ben Eater's video series on building a VGA graphics card. In there he calculates the resistors to show colors. https://youtu.be/l7rce6IQDWs https://youtu.be/l7rce6IQDWs
- rob74 4y ago> The Hollywood blockbuster The Terminator featured some 6502 code for Apple ][ in several scenes, seen on the Terminator's HUD I knew that Bender from Futurama had a 6502 as his brain (https://spectrum.ieee.org/the-truth-about-benders-brain https://spectrum.ieee.org/the-truth-about-benders-brain), but I expected the Terminator to be powered by something a bit more advanced...
- xxs 4y agoI mean the code on the screen just copies few bytes, then sets the carry flag... but it doesn't do anything with, instead jumps. Mesmerizing!
- abdulhaq 4y agothe 6502 was only used as a 'bad person' detector, so it's ok
- abudabi123 4y agohttps://en.wikipedia.org/wiki/Chuck_Peddle https://en.wikipedia.org/wiki/Chuck_Peddle The mind behind the 6502 was interviewed at CHM.
- detrites 4y agoSpecifically, Apple ][ code copied from Nibble Magazine: https://www.pagetable.com/?p=64 https://www.pagetable.com/?p=64 (More details in the recent comments at the bottom.)
- djmips 4y agoI was super familiar with Nibble Magazine when I saw The Terminator in the theatre and it totally broke me out of my suspension of disbelief. I was still a youngster and almost wanted to say something out loud! haha.
- rbanffy 4y agoI loved the last page one-liners. Always something cool to run with one single program line.
- low_tech_love 4y agoMake to look at the README, it’s quite nice!
- IncRnd 4y agoIt's been a while since I've used one of these! It's looking good! The only way to make it better is to change the spelling to App][er. It's an extra l that way, but I think that's forgivable.
- anthk 4y agoMmmmh IDK about the 8088, but the 8086 is 16 bit so it could be doable to emulate an Apple II at good speeds, right?
- beagle3 4y ago8088 and 8086 are internally equivalent, the difference is the size of the data bus - which would make little difference if any when emulating an 8 bit data bus processor.
- rbanffy 4y agoI remember my Apple II "felt" quicker than the first 4.77 MHz IBMs I used. A lot of that was due to BIOS character output on CGA needing to coordinate when to write to VRAM with the 6845 to avoid causing "snow" on the screen.
- forinti 4y agoThe 6502 was pretty fast little chip: https://imapenguin.com/2022/06/how-fast-can-a-6502-transfer-memory/ https://imapenguin.com/2022/06/how-fast-can-a-6502-transfer-... The ARM team decided to design their own CPU because they felt that the available options weren't that much better than the 6502 as they wished them to be.
- flohofwoe 4y agoI think the 16-bitness alone won't help all that much except for some 16-bit address computations, but the bigger register set of the 8088/8086 and the code being written in assembly may allow to map 6502 registers to fixed 8086 registers, which is a pretty big advantage compared to writing the emulator in a high level language (not sure if the emulator uses that approach though, if it would just run the CPU emulation it would be trivial, but when emulating the whole hardware the manual register allocation may become a bit trickier).
- deleted 4y ago[deleted]
- rbanffy 4y agoFinally a utility for all those old PCs!
- breakingcups 4y agoWhat an accomplishment, very cool.
- flohofwoe 4y agoOh my, the 6502 emulation [1] has fewer lines of assembly code than my (code-generated) implementation has lines of C code [2] :D Very nice use of a macro assembler though [3], makes the code feel very high level. To my defense, my generated code has a lot of redundancies (such as assert(false) which were meant to catch any 'stray cycles' but which are removed in release mode - and it could be more compact if it would use preprocessor macros (but since the code is generated anyway that seemed kinda wrong). [1] https://github.com/zajo/appler/blob/develop/src/65C02.ASM https://github.com/zajo/appler/blob/develop/src/65C02.ASM [2] https://github.com/floooh/chips/blob/master/chips/m6502.h https://github.com/floooh/chips/blob/master/chips/m6502.h [3] https://github.com/zajo/appler/blob/52aaa0f768cdf303438cd2c7b6236c0fadf5ba96/src/65C02.ASM#L227-L246 https://github.com/zajo/appler/blob/52aaa0f768cdf303438cd2c7...
- hvs 4y agoYour code has been super helpful while I've been trying to build a cycle-accurate 6502 emulator as well. I'm also planning on using your header files in another emulator project I'm working on. Thanks for a building an awesome set of emulators.
- wiz21c 4y agoDon't be sad, your code is pretty helpful! I use it with great success in my AccuraApple emulator :-) Thanks for giving it away, it helped me to boostrap my project much easier !
- JoeDaDude 4y agoCame to check out the Emulator, stayed to enjoy the history and design lessons of the Apple II computers. Thanks for posting!!
- robterrell 4y agoIt was developed in 1990, at a time when Apple IIe was still in production, which means that Appler is likely the first Apple ][ emulator ever made Not to be one of those guys, but "][ in a Mac" was from 1985: https://archive.org/details/2InaMac https://archive.org/details/2InaMac
- worldsavior 4y agoLooking at the src code gives me a headache. How can someone develop an actual emulator in Assembly? From where is the motivation and what is the principle?
- mzs 4y agoreadme.md links to this and wow! https://arachnoid.com/electric_duet/index.html https://arachnoid.com/electric_duet/index.html
- javier_e06 4y agoAh Karateka! We all know what happens at the end of the game if Karateka tries to kick Mariko when he enters her room. Apple's basic was my first language. I can hear Human League blasting away in my Sony Walkman.
- aYsY4dDQ2NrcNzA 4y agoIf he approaches her without bowing.
- aYsY4dDQ2NrcNzA 4y agoAnd we know what happens when you flip the disk to side 2.
- mietek 4y agoWhat happens?
- AnotherGoodName 4y agoThey had an entire copy of the game with graphics flipped vertically as a gag if you inserted the disc upside down.
- myhf 4y agoThis allowed the same disk to be usable in Australia.
- cylinder714 4y agoFor extra credit, try running this under 8086tiny, an IBM PC XT emulator: https://github.com/alblue/8086tiny https://github.com/alblue/8086tiny
- qorrect 4y agoWhat anachronistic keycaps are these https://github.com/zajo/appler/blob/develop/images/Apple1.jpg https://github.com/zajo/appler/blob/develop/images/Apple1.jp... ? They look gorgeous
- dirkt 4y agoThe Apple II keyboard had very similar keycaps (if not the same). I haven't seen them anywhere except for Apple keyboards.
- nikolay 4y agoIt's good to see fellow Bulgarians and Bulgarian projects here.