[HN Gopher] Appler: Apple ][ emulator for IBM PC, written in 808...
___________________________________________________________________
Appler: Apple ][ emulator for IBM PC, written in 8088 assembly
Author : ggerganov
Score : 157 points
Date : 2023-03-08 08:14 UTC (14 hours ago)
(HTM) web link (github.com)
(TXT) w3m dump (github.com)
| IncRnd wrote:
| It'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.
| rbanffy wrote:
| Finally a utility for all those old PCs!
| BlackFingolfin wrote:
| That 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 wrote:
| That'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.
| johannes1234321 wrote:
| Some 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
| anthk wrote:
| Mmmmh IDK about the 8088, but the 8086 is 16 bit so it could be
| doable to emulate an Apple II at good speeds, right?
| flohofwoe wrote:
| I 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).
| tssva wrote:
| "Most of the state of the emulated 6502 CPU is stored in 8086
| registers:
|
| A => dl
|
| X => cx
|
| Y => bp
|
| PC => si
|
| The Z and N flags are stored directly in the 8086 ZF and SF,
| while dh stores the C and the O flags. The stack pointer is
| stored in memory."
| jcadam wrote:
| Might help if you want to emulate a 65816 for a IIgs? But I
| imagine you'd want at least a 286 for that.
| anthk wrote:
| Wasn't that the SNES CPU? A 486 maybe, and for basic
| emulation.
| forinti wrote:
| The 6502 was pretty fast little chip:
| 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.
| rbanffy wrote:
| I 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.
| jcadam wrote:
| Went from Apple IIe to an Amiga 500, then later an Amiga
| 1200. Sometime later "upgraded" to a 486 running DOS/Win3.1
| (not an upgrade).
| rbanffy wrote:
| > Sometime later "upgraded" to a 486 running DOS/Win3.1
| (not an upgrade).
|
| I understand it wouldn't feel like much of an upgrade.
| RachelF wrote:
| No. The 8088/86 was similar in speed to the 6502, around 1.4x
| faster.
|
| The clock speed was higher (4.77 vs 1MHz) but it was generally
| less efficient.
|
| However, it was an easier machine to use. The Apple 2 was full
| of Woz shortcuts as the article mentioned. Made it cheap, but
| hard to program. Not just the floppy and the speaker, the high
| res graphics mode (HGR) had memory addresses that were not
| aligned to actual screen rows. The first row of pixels started
| at $8000. The next row in memory was 1/3 of the way down the
| screen, probably due to refresh timing.
|
| Amazing what was achieved on such hardware, in days when
| documentation was good, but very hard to find.
| beagle3 wrote:
| 8088 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.
| mzs wrote:
| readme.md links to this and wow!
|
| https://arachnoid.com/electric_duet/index.html
| rob74 wrote:
| > _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), but I
| expected the Terminator to be powered by something a bit more
| advanced...
| xxs wrote:
| I 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 wrote:
| the 6502 was only used as a 'bad person' detector, so it's ok
| abudabi123 wrote:
| https://en.wikipedia.org/wiki/Chuck_Peddle
|
| The mind behind the 6502 was interviewed at CHM.
| jgrahamc wrote:
| Yes. I looked into this here: https://behind-the-
| screens.tv/#terminator
| palad1n wrote:
| I had just taught myself 6502 assembler, I was 14. I remember
| seeing that and pointing, "I know what that is!"
| detrites wrote:
| Specifically, Apple ][ code copied from Nibble Magazine:
|
| https://www.pagetable.com/?p=64
|
| (More details in the recent comments at the bottom.)
| djmips wrote:
| I 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 wrote:
| I loved the last page one-liners. Always something cool to
| run with one single program line.
| worldsavior wrote:
| Looking 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?
| cylinder714 wrote:
| For extra credit, try running this under 8086tiny, an IBM PC XT
| emulator: https://github.com/alblue/8086tiny
| javier_e06 wrote:
| Ah 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 wrote:
| If he approaches her without bowing.
| aYsY4dDQ2NrcNzA wrote:
| And we know what happens when you flip the disk to side 2.
| mietek wrote:
| What happens?
| AnotherGoodName wrote:
| They had an entire copy of the game with graphics flipped
| vertically as a gag if you inserted the disc upside down.
| myhf wrote:
| This allowed the same disk to be usable in Australia.
| robterrell wrote:
| It 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
| breakingcups wrote:
| What an accomplishment, very cool.
| qorrect wrote:
| What anachronistic keycaps are these
| https://github.com/zajo/appler/blob/develop/images/Apple1.jp... ?
| They look gorgeous
| low_tech_love wrote:
| Make to look at the README, it's quite nice!
| JoeDaDude wrote:
| Came to check out the Emulator, stayed to enjoy the history and
| design lessons of the Apple II computers. Thanks for posting!!
| [deleted]
| flohofwoe wrote:
| Oh 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
|
| [2] https://github.com/floooh/chips/blob/master/chips/m6502.h
|
| [3]
| https://github.com/zajo/appler/blob/52aaa0f768cdf303438cd2c7...
| wiz21c wrote:
| Don'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 !
| hvs wrote:
| Your 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.
___________________________________________________________________
(page generated 2023-03-08 23:01 UTC)