
Emulating the Intel 8080 on a MOS 6502 - dezgeg
http://www.pagetable.com/?p=824
======
DiabloD3
"Why would you do that?!", the readership of Hacker News exclaimed loudly.
Their significant other/family/cat looked over at them with a strong wtf look
on their face(s).

~~~
kazinator
I used to use a 6502 emulator on a 6502.

Why you would do that is that you could develop and debug code in a way that
gives you a lot of visibility into the processor and control: stop anywhere in
a non-intrusive way and look at the state of anything.

The only other way to get that would be a hardware debugger requiring a second
computer.

~~~
mveety
I always use an emulator when I'm doing OS development or low level shit. The
ability to see what's happening makes life so much easier.

------
kwhitefoot
Brilliant piece of work. The kind of coding that you do when space is
expensive, been there, done similar things. And as others say an emulator lets
you see exactly what your code is doing.

------
faragon
After a quick overview, in my opinion it makes sense to try to assemble it.
Comments make sense, also the code. I don't think is "garbage code", and if it
is, the author put _a lot_ of work of making it convincing.

------
mmastrac
Does this mean the listing doesn't work, or that the original author just
never ran it, or that the author hand-assembled it?

Quote:

"Honestly, I don’t remember for certain… BUT… MORE THAN LIKELY, it is a FAKE –
i.e., I probably just text-edited a listing in “assembler listing” format for
the purpose of publishing the code and “looking professional”… ;)"

~~~
dannyobrien
It means that the printed version was manually re-constructed from the
original working version. The author here probably just had a hex dump which
he'd hand assembled, and re-wrote it to be more comprehensible in a text
editor.

This happened more often than you'd think. Before the widespread use of modems
or other long-distance ways of sending digital data, it was often very
difficult to transfer a digital version from one model of computer to another,
let alone converting that format to something that a typesetting system could
read.

I remember listings in magazines that were clearly typeset manually from
people who were just reading and re-typing from an original printout. Bear in
mind that the reader was also expected to type the program by hand from the
magazine.

Generally the final proofreading was left to the person brave enough to type
it all in again. It could be very frustrating to be faced with a program that
was clearly exactly the same as the printed copy, but didn't run. On the other
hand, it did teach you to be sceptical of what you read in magazines.

~~~
kwhitefoot
It also made you learn quickly how to debug.

------
sitkack
My first assembly language programs written in 8086 running on DOS (pctask?) ,
using MASM on an Amiga 500. The irony doesn't escape me.

