<p>I'd like to learn how to program in Assembler. I've done a bit of assembly before (during my A-Level Computing course) but that was very definitely a simplified 'pseudo-assembler'. I've borrowed my Dad's old Z80 Assembler reference manual, and that seems quite interesting so if possible I'd like to have a go with Z80 assembler.</p>

<p>However, I don't have a Z80 processor to hand, and would like to do it on my PC (I have windows or linux so either is good). I've found various assemblers around on the internet, but I'm not particularly interested in assembling down to a hex file, I want to just be able to assemble it to something that some kind of simulator on the PC can run. Preferably this simulator would show me the contents of all the registers, memory locations etc, and let me step through instructions. I've found a few bits of software that suggest they might do this - but they either refuse to compile, or don't seem to work properly. Has anyone got any suggestions? If there are good simulator/IDE things available for another type of assembler then I could try that instead (assuming there is a good online reference manual available).</p>

[{'answer_id': 27573, 'author': 'tslocum', 'author_id': 1662, 'author_profile': 'https://Stackoverflow.com/users/1662', 'pm_score': 2, 'selected': False, 'text': '<p>You may be interested in <a href="http://retrospec.sgn.net/game.php?link=z80asm" rel="nofollow noreferrer">this</a> for a Z80 simulator, and I\'ve had good experiences with <a href="http://www.winasm.net/" rel="nofollow noreferrer">WinAsm</a>.</p>\n'}, {'answer_id': 27576, 'author': 'Espo', 'author_id': 2257, 'author_profile': 'https://Stackoverflow.com/users/2257', 'pm_score': 1, 'selected': False, 'text': '<p>Take a look at <a href="http://www.z80.info/z80emu.htm" rel="nofollow noreferrer">Thomas Scherrer Z80 Emulators</a> for a listing of potential emulators you could use.</p>\n'}, {'answer_id': 27589, 'author': 'Will Dean', 'author_id': 987, 'author_profile': 'https://Stackoverflow.com/users/987', 'pm_score': 2, 'selected': False, 'text': "<p>You might also consider learning x86 assembly language, which you could do using in-line assembler in Visual Studio - although it's a larger instruction set than Z80, you would have the advantage of being able to use much better tools than would be available for the Z80.</p>\n\n<p>I've also just remembered that the Keil 8051 and Arm tools have a simulator in the IDE - there are size-restricted versions of these available for free download from www.keil.com</p>\n"}, {'answer_id': 27595, 'author': 'sparkes', 'author_id': 269, 'author_profile': 'https://Stackoverflow.com/users/269', 'pm_score': 1, 'selected': False, 'text': '<p>I write z80 asm for the ZX Spectrum (still, I know :) ) and use SJasmPlus to link to a spectrum emulator file.  Lots of of the better Spectrum emulators like Fuse and ZXSpin have built in editors as well for on the fly debugging and patching.</p>\n'}, {'answer_id': 27626, 'author': 'Nic Wise', 'author_id': 2947, 'author_profile': 'https://Stackoverflow.com/users/2947', 'pm_score': 2, 'selected': False, 'text': '<p>If you happen to already know .NET, then this may be of use:</p>\n\n<p><a href="http://www.viksoe.dk/code/asmil.htm" rel="nofollow noreferrer">http://www.viksoe.dk/code/asmil.htm</a></p>\n\n<p>It\'s a little bit limited, and may only work with .NET 1.1, but you could atleast use a "modern" IDE for it, and there are plenty of docs around for it.</p>\n\n<pre><code>&lt;%@ page language="Asm80386" %&gt;\n&lt;%\nStr:  DB "Testing...", 0\n\n  mov eax, -2\n  cmp eax, 2\n  jle Label1\n  xor eax, eax\nLabel1:\n  lea esi, Str\n  push esi\n  call "Response.Write(string)"\n  pop esi\n%&gt;\n&lt;br&gt;EAX: &lt;%= eax %&gt;\n</code></pre>\n\n<p>Another option, if you want to go "hard core" is get something like FreeDOS and VMWare, and use that. I\'m sure a garage sale (car boot sale? yard sale?) or second hand book shop would have a copy of Peter Norton\'s old DOS interrupts bible. :)</p>\n\n<p>Personally, I learned x86 asm by using Turbo Pascal (which I think is now free from Borland?), which had the ability to embed assembly instructions inside a function. Made it easier to setup the app, and I could focus on the stuff I wanted to do. I later used MacVAX at Auckland Uni, which was ok, but the VAX is very much dead - you may as well learn x86 :)</p>\n'}, {'answer_id': 28275, 'author': 'Chris Zwiryk', 'author_id': 734, 'author_profile': 'https://Stackoverflow.com/users/734', 'pm_score': 2, 'selected': False, 'text': '<p><a href="http://www.anne-gert.nl/projects/simpsim/" rel="nofollow noreferrer">SimpSim</a> is definitely worth a look. It\'s Windows only, but the feature set is pretty decent:</p>\n\n<ul>\n<li>Main memory and register display</li>\n<li>Built-in editor with syntax highlighting</li>\n<li>Run, step, and break functions</li>\n</ul>\n'}, {'answer_id': 36972, 'author': 'David Hicks', 'author_id': 3653, 'author_profile': 'https://Stackoverflow.com/users/3653', 'pm_score': 5, 'selected': True, 'text': '<blockquote>\n  <p>I\'ve found a few bits of software that suggest they might do this - but they either\n  refuse to compile, or don\'t seem to work properly. Has anyone got any suggestions?</p>\n</blockquote>\n\n<p>Write one. You\'re best off picking a nice, simple instruction set (Z80 should be perfect). I remember doing this as a first-year undergraduate exercise - I think we wrote the simulator in C++ and simulated 6800 assembly, but really any language/instruction set will do.</p>\n\n<p>The idea of "learning assembly language" these days is to get the idea of how computers work at the lowest level, only a select few (compiler writers, etc.) have any real reason to actually be writing assembly code these days. Modern processors are stuffed full of features designed to be used by compilers to help optimise code for speed/concurrent execution/power consumption/etc., and trying to write assembly by hand for a modern processor would be a nightmare. </p>\n\n<p>Don\'t fret about getting your application production-ready unless you want to - in all likelihood the bits of software you\'ve found so far were written by people exactly like you who wanted to figure out how assembly works and wrote their own simulator, then realised how much work would be involved in getting it "production ready" so the general public could use it.</p>\n'}, {'answer_id': 502676, 'author': 'mdm', 'author_id': 25318, 'author_profile': 'https://Stackoverflow.com/users/25318', 'pm_score': 3, 'selected': False, 'text': '<p><a href="http://www.winape.net/features.jsp" rel="noreferrer">WinApe</a> is a good emulator of an <a href="http://en.wikipedia.org/wiki/Amstrad_CPC" rel="noreferrer">Amstrad CPC</a>. The Amstrad CPC was a Home Computer produced in the 80\'s. It used a Z80 as its CPU. Using the emulator you can display a lot of the internals while programming. It includes a debugger and a disassembler for Z80 code.</p>\n'}, {'answer_id': 644702, 'author': 'none', 'author_id': 78244, 'author_profile': 'https://Stackoverflow.com/users/78244', 'pm_score': 3, 'selected': False, 'text': '<p>You might want to check out the open source 8085 simulator &quot;<a href="https://github.com/GNUSim8085" rel="nofollow noreferrer">GnuSim8085</a>&quot;, it\'s specifically meant to be used for educational purposes, and it was in fact written by student while preparing for his exams. It runs on both, Linux and Windows.</p>\n'}, {'answer_id': 644851, 'author': 'Adrian Pronk', 'author_id': 41861, 'author_profile': 'https://Stackoverflow.com/users/41861', 'pm_score': 2, 'selected': False, 'text': '<p>Aim higher! Try and get a simulator for a more powerful assembly language.  Remember, Z80 and 808x were low-end processors with low-end and awkward instruction sets.</p>\n\n<p>Something like VAX from DEC was regarded as the Rolls-Royce of instruction sets.  And then there are crazy Risc instruction sets that do some really strange things.  Maybe you can find definitions of those so that you can have a crack at implementing them.</p>\n'}, {'answer_id': 794579, 'author': 'Ryan Rodemoyer', 'author_id': 1444511, 'author_profile': 'https://Stackoverflow.com/users/1444511', 'pm_score': 1, 'selected': False, 'text': '<p>When I was in college we used PIC microprocessors. They are made by a company called Microchip. They also have a great IDE with a chip emulator/simulator that can allow you to do things without actually having the chips.</p>\n'}, {'answer_id': 6314992, 'author': 'Carlo V. Dango', 'author_id': 454017, 'author_profile': 'https://Stackoverflow.com/users/454017', 'pm_score': 3, 'selected': False, 'text': '<p><a href="http://www.mipsim.tk/" rel="nofollow noreferrer">MipSim</a> is FREE</p>\n<p>Main Features of MIPSim 2</p>\n<ul>\n<li>Built-in code editor with features like syntax highlighting and folding</li>\n<li>Display register and memory values in different representations (signed integer, unsigned integer, hexadecimal and ASCII)</li>\n<li>Set the block size (full-word, half-word, byte) of the memory cells for easier examination of the memory values</li>\n<li>Change values of registers and memory cells with a single click even during simulation and debugging</li>\n<li>Realtime user-interface updating allows you to see how values of registers and memory cells change during execution</li>\n<li>Built-in debugger with step-by-step instruction execution, instruction skipping and breakpoint features</li>\n<li>Tools for inserting ASCII, UNICODE strings and integer values to memory for testing of your code</li>\n<li>Tools for checking duplicate or missing labels and instruction parameters</li>\n<li>Save computer state (values of all registers and memory cells) so that next time you run the simulator you can continue from where you left!</li>\n<li>Set the simulation speed - low speeds are great to trace your code and to see how it behaves</li>\n<li>Encode instructions - produce machine code in either binary or hexadecimal representation</li>\n<li>Catch assembly time and runtime errors</li>\n<li>Easier debugging with descriptive error messages</li>\n<li>Multi-threaded design - MIPSim doesn\'t get stuck (hopefully ;) even if the assembly code executed is erroneous or contains infinite loops</li>\n<li>MIPSim API - make your own programs that can read from and write to the registers and memory of MIPSim, great flexibility for powerful testing!</li>\n</ul>\n'}, {'answer_id': 8170826, 'author': 'Abdul Munim', 'author_id': 228656, 'author_profile': 'https://Stackoverflow.com/users/228656', 'pm_score': 2, 'selected': False, 'text': '<p>This wouldn\'t make any meaning to you now but just for people stopping by. This is the best assembly code simulator I have come across with. Truly worth it!</p>\n\n<p><a href="http://www.emu8086.com/" rel="nofollow">http://www.emu8086.com/</a></p>\n'}, {'answer_id': 12196894, 'author': 'Wayne Michael', 'author_id': 1636015, 'author_profile': 'https://Stackoverflow.com/users/1636015', 'pm_score': 1, 'selected': False, 'text': '<p>Why use an emulator?</p>\n\n<p>Download <a href="http://www.masm32.com/" rel="nofollow">MASM</a> or <a href="http://www.nasm.us/" rel="nofollow">NASM</a> and write good old 80386 architecture. Plenty of online samples and learning tools. </p>\n\n<p>Plenty of real-world reason to use assembler!</p>\n'}, {'answer_id': 15717006, 'author': 'Jithin Jose', 'author_id': 1545385, 'author_profile': 'https://Stackoverflow.com/users/1545385', 'pm_score': 3, 'selected': False, 'text': '<p>If Your are on windows <a href="http://www.jtechsoftwares.in/8085-simulator.html" rel="nofollow noreferrer">8085 Simulator</a> is the best choice.\n<img src="https://i.stack.imgur.com/p5u3c.jpg" alt="8085 Simulator by J-tech Softwares"></p>\n\n<p>It user interface is excellent than any other simulator. Also this simulator provide live view of memory map very time(also while in the execution).</p>\n\n<p>But this one does not support Windows 98 or lower for that you need to check other simulators like <a href="https://gnusim8085.github.io/" rel="nofollow noreferrer">GNUSim8085</a>.</p>\n'}, {'answer_id': 16142651, 'author': 'Nuri Topkan', 'author_id': 2306613, 'author_profile': 'https://Stackoverflow.com/users/2306613', 'pm_score': 1, 'selected': False, 'text': '<p>there is a simulator which is Visual6502 for teaching fundemental of microprocessor architecture. It has a editor, assembler, I/O operation and animation of how to work a microprocessor. I is available at the following link.</p>\n\n<p><a href="http://www.pcsistem.net/visual/index.htm" rel="nofollow">http://www.pcsistem.net/visual/index.htm</a></p>\n'}]
['https://Stackoverflow.com/questions/27568', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1912/']