Preferred assembler?

151 views
Skip to first unread message

Robert Liesenfeld

unread,
Sep 28, 2016, 11:10:59 AM9/28/16
to rc201...@googlegroups.com
Hi fellow retro computing enthusiasts-

I have myself the excellent RC2014 kit, for which I am attempting to write a Forth implementation.  I plan to do this entirely in assembly (and, of course, in Forth itself).  Initially I selected the GNU binutils 'as' tool as my assembler, but I've run into a snag with the ORG directive.  Instead of merely changing the addresses used when resolving label references and the like, I end up with that many bytes of zeros prepended to the output.  Of course, the jumps and label references are then correct, but it seems wrong to me - and other assemblers I've tried don't do this.

I wonder what assemblers you all prefer?  I've also tried z80asm which is available in the Ubuntu repositories, which works but I'm not fond of its assembler directive formats.  I plan to do my development on Linux or Windows.

If anyone has ideas about how to coerce GNU as to output a binary without zero padding to the ORG address, I'm all ears about that as well!

-Rob

Scott Lawrence

unread,
Sep 28, 2016, 12:21:38 PM9/28/16
to rc201...@googlegroups.com
I've been using the assembler that came with small-c many years ago, and can be found in my git repo.  I used it for many years to patch pac-man roms.  (https://github.com/BleuLlama/bleu-romtools)

I've also created a tool, "genroms" in the same repo  to map IHX files out to binary rom files.  For example, you say that pacman.6f sits between 0000 and 1fff, pacman.6h sits at 2000-3fff, pacman.B sits at 8000-Afff and so on... then it can load in those rom files (for patching existing roms) or fill with zeroes for making new roms, then the IHX gets applied to that memory space, and the binary rom files saved out.

For this, you could create your own .ROMS definition file.  For example, here's the ROMS that I use for my emulators, for the RC2014: https://github.com/BleuLlama/z80-machine/blob/master/Z80asm/Common/rc2014.roms

Here's a ROMS file for generating 2k of program space for use with writing new code for BASIC's "USR()" function implementations... 
For this, you'd .org 0xF800, then write your code, and all jumps and labels will be correct. assemble it, and run it through genroms and you'll get a 2kbyte file called "basicusr.rom" that can be placed at 0xF8000.

So to answer your latter question, i think genroms might help. ;)

Sorry if i'm not explaining myself well... 

-s

--
You received this message because you are subscribed to the Google Groups "RC2014-Z80" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rc2014-z80+unsubscribe@googlegroups.com.
To post to this group, send email to rc201...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/rc2014-z80/CAHAQr5KD3tQeWfLMZVp9jUnddNYJnB9zGM2Yhuh%2B4b%2Br%2BFfBpQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.



--
Scott Lawrence
yor...@gmail.com

Filippo Bergamasco

unread,
Sep 28, 2016, 1:10:31 PM9/28/16
to rc201...@googlegroups.com
I've personally used the assembler included in the z88dk compiler:


It's mature and actively developed. You can also easily interface it with the z80 c compiler (zcc) if you want to upgrade to a higher-level language later on.

Unfortunately, one of the problems of the assembly language is that it comes with a lot of different dialects so it's very hard to create portable code. For this reason I really suggest to use an assembler that is available for multiple platforms and as modern as possible.


Once you are successful with your project, I'll be happy to include it in the official RC2014 repository (https://github.com/RC2014Z80/RC2014) either as a submodule or by directly serving the source code.

Filippo






A A

unread,
Sep 28, 2016, 1:13:13 PM9/28/16
to RC2014-Z80


On Wednesday, September 28, 2016 at 10:21:38 AM UTC-6, Scott Lawrence wrote:
I've been using the assembler that came with small-c many years ago, and can be found in my git repo.  I used it for many years to patch pac-man roms.  (https://github.com/BleuLlama/bleu-romtools)

It's quite interesting that you seem to have the first versions of some of the tools in current use in z88dk and sdcc :D

Your zcc seems to be one of the first versions written in 1996:
https://raw.githubusercontent.com/BleuLlama/bleu-romtools/master/zcc/zcc.c

The current version in z88dk:
http://z88dk.cvs.sourceforge.net/viewvc/z88dk/z88dk/src/zcc/zcc.c?revision=1.177&content-type=text%2Fplain
(actually the comments at the top say this is a direct development of 0.96 which you have.  Of course by now it's quite different but you can still see some of the same subroutines.)

The asz80 assembler:
https://raw.githubusercontent.com/BleuLlama/bleu-romtools/master/zcc/as/z80.h
was written in 1989/90 by Alan Baldwin

The version used in sdcc:
https://sourceforge.net/p/sdcc/code/HEAD/tree/trunk/sdcc/sdas/asz80/z80.h
is dated 2009 by Alan Baldwin
(there is a more current version available that is not used in sdcc)

That's what happens when you have a really long-lived project.  There is a lot of cross-pollination of z80 related tools dating back a couple of decades so it's always interesting to me anyway to see another piece of the web.


I wonder what assemblers you all prefer?  I've also tried z80asm which is available in the Ubuntu repositories, which works but I'm not fond of its assembler directive formats.  I plan to do my development on Linux or Windows.

There are quite a few z80 assemblers about but if you need a linker, the field narrows to a handful.  There's z80asm inside z88dk (this is not the same as the z80asm you've tried already -- that one re-used the name probably unintentionally), asz80 inside sdcc but also as a standalone project, zmac, gnu tools which you are looking at and I think wla-dx.

I personally dislike the non-standard asm syntax of asz80 but the as-tools have an advantage over the others -- they are part of a family of assemblers targetting many different processors.
wla-dx I find overcomplicated.  z80asm has the advantage that there is a large body of asm code available as libraries inside z88dk but you may find it is currently lacking some features you may want like macros.  zmac I am less familiar with.  With gnu you have to write a linker script to change your memory space so that it doesn't start at address 0 to avoid the zero-stuffing.

Popular non-linking assemblers include pasmo and sjasm.  They will have some niceties that the others above may lack but the omission of linking capability means they are difficult to use effectively in large projects.

JOHN SMITH

unread,
Sep 29, 2016, 2:33:46 AM9/29/16
to RC2014-Z80
Hello:
I did not know where else to post this info, so I'll post it here since it references Scott's "bleu-romtools".

Upon downloading from GIT, entering the "bleu-romtools" directory and compiling, I was met with some fatal errors", which were essentially:
./alloc.h:5:14: error: conflicting types for ‘malloc’
./alloc.h:6:14: error: conflicting types for ‘calloc’
./alloc.h:7:14: warning: conflicting types for built-in function ‘realloc’ [enabled by default]

Looks like the newer versions of GCC have an issue with this (mine is gcc 4.6.3).  I found the fix to be simply changing the "char" reference to "void" in the following files"
./zcc/as/alloc.h
./zcc/link/alloc.h

Hope that helps.

Peace and blessings,
Johnny Quest

Phillip Stevens

unread,
Sep 29, 2016, 2:36:08 AM9/29/16
to rc201...@googlegroups.com
Yes I found the same situation, and left it as an issue on the GitHub Repo. 
--
You received this message because you are subscribed to the Google Groups "RC2014-Z80" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rc2014-z80+unsubscribe@googlegroups.com.
To post to this group, send email to rc201...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/rc2014-z80/ac09902a-12fd-4404-a70e-571ef96dfae4%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.


--
Sent from a Mobile Device.
Replies may appear terse.
Reply all
Reply to author
Forward
0 new messages