[SOLVED]Z80 assembler with include path and macro support ?

Talk about development tools here

Moderator: BigEvilCorporation

Post Reply
Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

[SOLVED]Z80 assembler with include path and macro support ?

Post by Stef » Mon Apr 12, 2010 9:06 pm

Hey :)

I'm looking for a Z80 assembler which is available for win32 and does support both macro and the possiblity to give additional "include path" as compiler parameters.
For now i'm using AS80 and i was very happy with it, unfortunatly it doesn't support extra include path and that gimme serious problems to write my ultimate genesis developement makefile ;)
Does anyone has any ideas ? i made some searchs but i can't found any win32 assembler with both features...
thanks :D
Last edited by Stef on Mon Jan 10, 2011 10:22 pm, edited 1 time in total.

Shiru
Very interested
Posts: 786
Joined: Sat Apr 07, 2007 3:11 am
Location: Russia, Moscow
Contact:

Post by Shiru » Mon Apr 12, 2010 9:12 pm

SjAsmPlus is the best Z80 cross-assembler, in my opinion. It has includes, macros, and a lot of other features. I've used parent version, SjAsm, to make code for SMD's Z80, and you've seen the code.

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Tue Apr 13, 2010 1:03 am

That does look rather nice. I'll have to give it a try. I've just been using zasm.

Pascal
Very interested
Posts: 200
Joined: Wed Nov 29, 2006 11:29 am
Location: Belgium
Contact:

Post by Pascal » Tue Apr 13, 2010 11:27 am

wladx is a good option too

http://www.smspower.org/dev/tools/wladx/

asmx do 68000 and z80, it's included in basiegaxorz setup

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Tue Apr 13, 2010 3:48 pm

Pascal wrote: asmx do 68000 and z80, it's included in basiegaxorz setup
Last I checked, asmx didn't do the undocumented Z80 instructions. That's why I used zasm instead.

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Tue Apr 13, 2010 5:17 pm

Shiru wrote:SjAsmPlus is the best Z80 cross-assembler, in my opinion. It has includes, macros, and a lot of other features. I've used parent version, SjAsm, to make code for SMD's Z80, and you've seen the code.
Thanks a tons, i think i found my new Z80 assembler :)
Pascal wrote:wladx is a good option too

http://www.smspower.org/dev/tools/wladx/

asmx do 68000 and z80, it's included in basiegaxorz setup
Already tried both and they are both quite nice but they miss some features i really need (as include path option), thanks anyway :)
Last edited by Stef on Tue Apr 13, 2010 5:22 pm, edited 1 time in total.

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Sun Jan 09, 2011 12:27 am

I was lately experiencing some problems with my Z80 drivers and i just realized that SJAsm was doing very weird things compared to my previous assembler... anyway i can't use it anymore, it seems quite buggy :-/

So i'm just wondering if someone found a "new cool another Z80 assembler" which does support macro and include path option ? maybe the one you're using :)

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Sun Jan 09, 2011 9:26 pm

I used to use zasm: http://k1.dyndns.org/Develop/projects/z ... ributions/

It doesn't have macros. I switched to sjasmplus, but I haven't seen anything weird yet. I'm using 1.0.7 RC7. Maybe your problem is an issue with a new version that broke something... or maybe I just haven't used whatever causes you problems.

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Mon Jan 10, 2011 9:39 am

Chilly Willy wrote:I used to use zasm: http://k1.dyndns.org/Develop/projects/z ... ributions/

It doesn't have macros. I switched to sjasmplus, but I haven't seen anything weird yet. I'm using 1.0.7 RC7. Maybe your problem is an issue with a new version that broke something... or maybe I just haven't used whatever causes you problems.
I was using sjasm, not sjasmplus... afaik the problem arrives only when you intent to use ORG directive. With my previous assembler (asmZ80, don't remember exactly which one exactly) i was able to choose to fill empty space with 0 in binary file which was very common. So i was able to do the following stuff :

Code: Select all

  ORG $0

  <boot_code>
  ...
  jmp main

  ORG $38

  <interrrupt_code>
  RTI


  ORG $200

main

  <main_code>
  ...
My working variables were located at $100, between interrupt handler and main code. The problem with sjasm is that ORG directive doesn't work that way. Afaik i don't really know what it does. Maybe it permit to force the Program Counter value at specific location but at least it doesn't fill empty space so all code is concatenated. i.e, the last instruction of boot_code is followed with first instruction of interrupt_code and last instruction of interrupt_code is followed by first instruction of main_code.

Then i tried to use the BLOCK directive to empty space fill but then if code is now correctly located the resulting obj file is truncated before the end of the actual code. For instance my main code_code should end at $450 but the bin file end at $350... so a part of my code isn't there.

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Mon Jan 10, 2011 10:41 am

Um - you do use an END statement at the end of the code, right? Here's a snippet of my Z80 code where I use ORG and BLOCK:

Code: Select all

; ########################### Code starts here ##############################

    OUTPUT "z80_tadpcm.o80",t
    ORG $0000

; basic init code

    DI                      ; Disable ints
    LD  SP, $2000           ; Setup stack
    IM  $01                 ; Set int mode 1
    JP  start               ; Jump to start


; ########################## Interrupt handler ##############################

    BLOCK $0038-$

interrupt
    RETI


; ############################## Main code ##################################

    BLOCK $0080-$

start
    LD  B, $10
    XOR A
    LD  HL, $0040
clr_vars
ORG doesn't work for offsetting the current PC, but BLOCK does. I have END at the end of my Z80 code and I haven't had a problem with the code size being wrong.

I am using sjasmplus, not sjasm.

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Mon Jan 10, 2011 12:37 pm

Chilly Willy wrote:Um - you do use an END statement at the end of the code, right? Here's a snippet of my Z80 code where I use ORG and BLOCK:

...
END statement ? ok so that is the reason why my code is truncated...You're doing is exactly what i want to do so i guess that's the problem, thanks a tons !
Honestly i find that END statement a bit surprising, i really wonder why ajasm need that :-/ not a big problem anyway...

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Mon Jan 10, 2011 7:39 pm

It works now, thanks again :)
Very stupid problem afaik, the END directive was missing and it seems this is only needed when you use some others specials directives as BLOCK :-/
I can't understand why the assembler doesn't assume the end of file as being the end X'D

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Mon Jan 10, 2011 7:46 pm

It was pretty common for assemblers for 8-bit CPUs to require the end statement. It stopped being common on 16-bit systems. For example, all the 6502 assemblers I used to use all required END, but only one of the 68000 assemblers did, and it was optional on the rest.

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Mon Jan 10, 2011 10:21 pm

Chilly Willy wrote:It was pretty common for assemblers for 8-bit CPUs to require the end statement. It stopped being common on 16-bit systems. For example, all the 6502 assemblers I used to use all required END, but only one of the 68000 assemblers did, and it was optional on the rest.
I'm not very familiar with these 8 bits assemblers, i did a bit of 6809 but a long long time ago and the assembler was really far from what we have now. Anyway problem solved, this is the point :)

Post Reply