views:

2065

answers:

12

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.

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).

+2  A: 

You may be interested in this for a Z80 simulator, and I've had good experiences with WinAsm.

tj9991
A: 

Take a look at Thomas Scherrer Z80 Emulators for a listing of potential emulators you could use.

Espo
A: 

@Espo: As far as I can see, none of those emulators come with simulators to let me see if my program is actually doing what I want it to do. Thanks for the link though.

It's a shame that http://www.emu8086.com/ isn't available for Z80s...maybe I'll have to learn 8086 assembler.

robintw
+1  A: 

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.

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

Will Dean
A: 

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.

sparkes
+1  A: 

If you happen to already know .NET, then this may be of use:

http://www.viksoe.dk/code/asmil.htm

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.

<%@ page language="Asm80386" %>
<%
Str:  DB "Testing...", 0

  mov eax, -2
  cmp eax, 2
  jle Label1
  xor eax, eax
Label1:
  lea esi, Str
  push esi
  call "Response.Write(string)"
  pop esi
%>
<br>EAX: <%= eax %>

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. :)

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 :)

Nic Wise
A: 

SimpSim is definitely worth a look. It's Windows only, but the feature set is pretty decent:

  • Main memory and register display
  • Built-in editor with syntax highlighting
  • Run, step, and break functions
Chris Zwiryk
+3  A: 

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?

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.

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.

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.

David Hicks
Writing an assembler is great fun. Teaches you lots of pitfalls too.
Callum Rogers
A: 

WinApe is a good emulator of an Amstrad CPC. 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.

mdm
+1  A: 

You might want to check out the open source 8085 simulator "GnuSim8085", 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.

none
A: 

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.

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.

Adrian Pronk
A: 

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.

rodey