Page 1 of 1

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

Posted: Mon Apr 12, 2010 9:06 pm
by Stef
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

Posted: Mon Apr 12, 2010 9:12 pm
by Shiru
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.

Posted: Tue Apr 13, 2010 1:03 am
by Chilly Willy
That does look rather nice. I'll have to give it a try. I've just been using zasm.

Posted: Tue Apr 13, 2010 11:27 am
by Pascal
wladx is a good option too

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

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

Posted: Tue Apr 13, 2010 3:48 pm
by Chilly Willy
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.

Posted: Tue Apr 13, 2010 5:17 pm
by Stef
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 :)

Posted: Sun Jan 09, 2011 12:27 am
by Stef
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 :)

Posted: Sun Jan 09, 2011 9:26 pm
by Chilly Willy
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.

Posted: Mon Jan 10, 2011 9:39 am
by Stef
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.

Posted: Mon Jan 10, 2011 10:41 am
by Chilly Willy
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.

Posted: Mon Jan 10, 2011 12:37 pm
by Stef
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...

Posted: Mon Jan 10, 2011 7:39 pm
by Stef
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

Posted: Mon Jan 10, 2011 7:46 pm
by Chilly Willy
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.

Posted: Mon Jan 10, 2011 10:21 pm
by Stef
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 :)