• Please review our updated Terms and Rules here

Programming with the ASxxxx cross assemblers

RichCini

Veteran Member
Joined
Aug 6, 2005
Messages
598
Location
Long Island, NY
I have a Z80 project that I'm working that is adapting code targeted for the ASZ80 assembler from Shop-PDP.net. While the assembler part works fine, the linker ASLINK, seems to continually barf on the command line used, complaining about a missing file which is the first parameter in the linker line -- it seems to think it's another file to be linked, even though the command line has the right file output flag. Does anyone regularly use this cross-assembler and linker? Is there a special incantation that I'm missing?

Thanks!
Rich
 
Sure Dave.

It's part of a Makefile, but I've also tried it manually:

Bash:
./aslink -n -m -u -i -b CODE=0xF000 rom startup.rel main.rel chario.rel string.rel spio13.rel ide8.rel zero.rel

The readme says that the first name after the options ("rom") is the output filename.
 
There seems to be multiple (different) descriptions of the aslink command line. I wonder which documentation is applicable to the tool you are using?

I don't see a -c or -f switch on your line (command line or command file respectively). I wonder what the default is?

What is the 'rom' word?

The other switches seem to make sense to me.

Dave
 
Dave --

The documentation source is https://shop-pdp.net/ashtml/asls01.htm#Processing. The c and f options handle command input, with f being used for a script file, sort of the way Microsoft has a link file for Windows driver development. The makefile is pretty simple. The word "rom" is supposed to be the output file (it's the first filename on the command line). The error is "?ASlink-Error-<cannot open> : "rom.rel"" which to me means it's misprocessing the command line or there's a difference between Link versions (I think this code was last used with a 2.x version of the linker, not the current 4.4). I was going to try recompiling the linker for Windows (I'm using OSX) and see if that makes a difference.

Makefile:
.SUFFIXES: .rel .s

TARGET=rom
OBJ=startup.rel main.rel chario.rel string.rel spio13.rel ide8.rel zero.rel
HDR=globals.s
AS=./asz80
ASFLAGS=-b -l -g
LINK=./aslink
LFLAGS=-n -m -i -u -b CODE=0xF000
GET=sccs get

.s.rel:
    $(AS) $(ASFLAGS) -o $<

all: $(TARGET)

$(OBJ): $(HDR) Makefile

$(TARGET): $(OBJ)
    $(LINK) $(LFLAGS) $(TARGET) $(OBJ)

clean:
    rm -f $(TARGET).map $(OBJ) *.lst *.rst

cleanall:
    rm -f $(TARGET).ihx $(TARGET).map $(OBJ) *.lst *.rst
 
Your command line appears to match the documentation, but the documentation is pretty inconclusive.

I would suggest trying -i rom followed by the .rel input files as a test.

Dave
 
It complains with "?ASlink-Error-Options come first" which I'm inferring to mean that -i is an option with no parameter. So, I tried the -s option with no output file parameter and it worked. So I went back to the -i parameter with no output file and it worked, as did the "-t" parameter. So, not only is the documentation incorrect (or at best, out-of-sync), but the makefile needs to be corrected to remove the target parameter which I now suspect was required under the previous version of the linker. Doing this results in a successful run.

Thanks again Dave!
Rich
 
@RichCini , do you have an exemplar of the source code this assembler reads?

I have an interest in how other z80 assemblers work/look as I'm current writing a macro z80 cross assembler that just goes straight to the binary - ie, ASM SOURCE produces SOURCE.BIN directly without any further configuration.

I currently have a z80 cross-assembler that runs on Windows 10/11 and Linux and a z80 native macro assembler that runs under CP/M, though can be adapted, as well as a planned macro z80 cross-assembler that I'm rewriting for Windows 10/11/Linux to do the same as the native assembler on a PC so I'm curious as to what a z80 source file looks like when you need to create MAKE files for it to assemble correctly?
 
@cj7hawk The makefile looks exactly like an MASM makefile (pasted in a prior response). For syntax, it's probably better to look at the documents on the web site for the assembler. The opcodes look like standard Z80. The preprocessor commands are prepended with "." and source labels use colons.

Rich
 

Attachments

Just for information, I found my as6809/aslink command file today.

I used the command:

aslink -n -m -i -u -b _CODE1000=0x1000 -b _VECTORS=0xfff0 V6809.rel

Dave
 
@cj7hawk The makefile looks exactly like an MASM makefile (pasted in a prior response). For syntax, it's probably better to look at the documents on the web site for the assembler. The opcodes look like standard Z80. The preprocessor commands are prepended with "." and source labels use colons.

Rich

Thank you for that - I wasn't expecting anything unusual until I noticed that it uses;

* hashes for numerical numbers. ( No assumption or autodetection )
* 0h or 0b for headers for hex and binary following the hash ( eg, #16, #0h10, #0b00010000 )
* Allows numerical and symbols for labels
* Has this weird, non-Zilog, form of indexing - eg: "cp ram_addr+1(iy)" - rather than using "CP (IX+ram_addr+1)" - which is very alien to me, though is still very readable - I've never seen that before.
* Reserves "." for assembler directives ( you mentioned that though, and I've seen it before. ).

Thank you very much for the code example - It was great to read through and get a feel for the assembler.

David.
 
Back
Top