Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option -u warns about unused labels from included ASM file #13

Open
mirao opened this issue Apr 1, 2023 · 4 comments
Open

Option -u warns about unused labels from included ASM file #13

mirao opened this issue Apr 1, 2023 · 4 comments

Comments

@mirao
Copy link
Collaborator

mirao commented Apr 1, 2023

I use the handy option -u so that I don't keep useless labels in my code
But it doesn't seem to be working as expected when including labels from external ASM file.

Let's have a shared library for a work with keyboard

keys.asm:

KEY_M = $25
KEY_U = $0b
KEY_D = $3a
KEY_SPACE = $21
KEY_F = $38
KEY_H = $39

CH = $2fc

.macro get_key
    lda CH
    ; Accept even upper case
    and #%1011 1111
.endm

.macro reset_key
    mva #$ff CH
.endm

and an application using only KEY_SPACE, KEY_F and KEY_H from it

gtia_gr0.asm:

    icl "../common/keys.asm"
    mva #KEY_F LAST_SHIFT_KEY

    ; ... and some other usage of KEY_SPACE, KEY_F and KEY_H

There is also another application using different keys: KEY_M, KEY_U, KEY_D.

Now if I assemble gtia_gr0.asm, I'm getting warnings ❌

$ mads -u gtia_gr0.asm
keys.asm (1) WARNING: Unused label KEY_M
keys.asm (2) WARNING: Unused label KEY_U
keys.asm (3) WARNING: Unused label KEY_D
Writing object file...
189 lines of source assembled in 3 pass
184 bytes written to the object file

Or is there a way how to "Import only some labels and don't notice others" so that I won't get those warnings?
Or another solution? I don't want to separate keys into extra libraries. I just want to share some keys from one library.

Used SW:
mads 2.1.5, Ubuntu 22.10

@dfbg
Copy link

dfbg commented May 9, 2023

It sounds like you want "OPT u" added so you can turn the warnings on and off where you want them.

@mirao
Copy link
Collaborator Author

mirao commented May 10, 2023

Not sure if "OPT u" could make the process easier.
I just need to skip check of unused labels from included asm files (external labels) when using -u.
Now I'm getting many warnings and some of them are useless (external labels, I can't do anything with such warnings) and only some useful (internal labels that are not used. Typically I forgot to remove them from my application and it's good that MADS reports it).

@dfbg
Copy link

dfbg commented May 10, 2023

I was thinking you would put OPT u- at the top of the include file and OPT u+ at the bottom. This is how I use OPT l-/+ to keep those same files out of the .lst file.

@mirao
Copy link
Collaborator Author

mirao commented May 10, 2023

I see. It could work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants