Just a question about assemblers

By gdx

Enlighted (5012)

Аватар пользователя gdx

30-08-2020, 10:41

Is there an assembler that can create a file containing only the labels and the address corresponding to each in the following format when we assemble a source code?

LabelName	equ	address
LabelName2	equ	address2
    .    	 . 	   .
    .    	 . 	   .
    .    	 . 	   .
Для того, чтобы оставить комментарий, необходимо регистрация или !login

By mcolom

Master (181)

Аватар пользователя mcolom

30-08-2020, 11:38

I use z80asm, and it has an -L option and gives that.
For example, z80asm nobu.asm -L gives this:

WRTVDP: equ $0047
WRTVRM: equ $004d
WSLREG: equ $013b
XSAVE:  equ $fafe
YSAVE:  equ $fb00
blink_loop:     equ $40a2
blink_loop_delay_hl:    equ $4025
end_level1:     equ $9590
iter:   equ $40a4
move_tiles:     equ $4082
print_str_loop: equ $402d
print_str_ret:  equ $4038
scroll_test:    equ $407d
start:  equ $404d
start_level1:   equ $8000

By pgimeno

Champion (310)

Аватар пользователя pgimeno

30-08-2020, 12:29

I expect most assemblers to be able to do that. Pasmo in particular accepts a third parameter for a symbol listing file (the first two are input and output file). The output format is:

L1		EQU 00100H
L2		EQU 00103H

By gdx

Enlighted (5012)

Аватар пользователя gdx

30-08-2020, 12:39

Me too I expected most assemblers to be able to do that but I tested 3 or 4, neither seems to be able to do it.

mcolom@ What z80asm?

By mcolom

Master (181)

Аватар пользователя mcolom

30-08-2020, 12:42

gdx wrote:

mcolom@ What z80asm?

It's the Z80 assembler I use on Linux. Not specific to MSX as pasmo and others, but I've got used to it.

By Manel46

Hero (630)

Аватар пользователя Manel46

30-08-2020, 13:33

use Sjasm. This, apart from the object code, creates an .lst file, with everything you want.

By thegeps

Paladin (949)

Аватар пользователя thegeps

30-08-2020, 16:59

glass does it for sure (I always create the labels' file):

java -jar glass.jar freedom.asm freedom.rom freedom.txt

freedom.txt is the file that contains ALL the labels and their addresses

By Ped7g

Resident (44)

Аватар пользователя Ped7g

30-08-2020, 17:43

sjasmplus has two options for this:

sjasmplus --sym=<filename>
- this will dump full symbol table in the EQU form

sjasmplus --exp=<filename>
- this will collect only symbols explicitly marked for export by `EXPORT` directive

If you are just interested in the values of labels, the full table can be appended to listing by --lstlab, and there are multiple other dump-labels options outputting them in different formats for debuggers/emulators (LABELSLIST, CSPECTMAP) or the full tracing data (--sld).

By Metalion

Paragon (1456)

Аватар пользователя Metalion

30-08-2020, 18:24

sjasm creates a symbol file, when you use the option "-s".
sjasm -s main.asm will create a symbol file main.sym, with all addresses and labels.

This is an example from a *.sym file created from one of my program:

START: equ 00004018h
wait_player: equ 00004025h
my_play: equ 00004041h
my_pause: equ 0000404Dh
my_resume: equ 00004056h
wait: equ 0000405Fh
wait.loop: equ 00004062h
search_rom: equ 00004069h
VBLANK.init: equ 00004088h

By santiontanon

Paragon (1568)

Аватар пользователя santiontanon

30-08-2020, 23:31

Yeah, as far as I know all the assemblers I can remember now can generate a symbol file. I am curious to know which ones actually cannot generate it Smile