BartmanAbyss / vscode-amiga-debug

One-stop Visual Studio Code Extension to compile, debug and profile Amiga C/C++ programs compiled by the bundled gcc 12.2 with the bundled WinUAE/FS-UAE.
GNU General Public License v3.0
314 stars 39 forks source link

Vasm integration #65

Closed rjobling closed 3 years ago

rjobling commented 3 years ago

Hi Bartman

I've been working with separate .s files for a little while using the gnu assembler. It works and it's tolerable for small chunks of assembler, however I can't help feel it could be nicer.

From what I can tell the gnu assembler is really not a full featured assembler, it's just the tool that processes the output from the C/C++ compiler.

For that reason is seems to lack things like scoped labeling. So, you can't use a dot to reuse common label names, for example ".loop:" isn't scoped to the most recent non-dot label, it's just like every other global label.

I also don't think there's any macro support other than the C compiler if you rename the file .S.

Would it make sense to integrate the Vasm assembler into your package and provide an example of how that could be used. Would this work for debugging as well as the gnu assembler?

BartmanAbyss commented 3 years ago

Hi, the GNU assembler is more capable than you think, although the syntax may be unfamiliar. Have a look at the included depacker_doynax.s for tips on how to use local labels (.L prefix), macros, IntelliSense. Also have a look at gcc8_a_support.s for local temp labels 1, 2, etc. jmp 1f (forward), jmp 1b (backward), .cfi_* directives to tell the debugger about the current stack level for correct callstacks during debugging and profiling.

So, in short, I don't have plans to integrate Vasm into my extension at this moment.

rjobling commented 3 years ago

As far as I can tell the only feature close to what I'm looking for is to use the numbered local labels.

So I could write the following:

Func1:
       subq #1,d0
0:     add.w d1,(a0)+
       dbra.b 0b
       rts

Func2:
       subq #1,d0
0:     add.w d2,(a0)+
       dbra.b 0b
       rts

What I remember from Devpak was that I could write:

Func1:
       subq #1,d0
.loop: add.w d1,(a0)+
       dbra.b .loop
       rts

Func2:
       subq #1,d0
.loop: add.w d2,(a0)+
       dbra.b .loop
       rts

I don't seem to be able to do anything like that where I get to name the reusable label names.

I've looked at the L prefix and it seems like that is used to hide labels from the debugger. I think that would clean up my profiler output, which seems littered with a bunch of labels rather than just the function names I've tried to tell it about.

Anyway I understand why you would prefer not to integrate Vasm, but I'm struggling to figure out how to use what's there. Maybe I'm missing some stuff.

If I did decide to assemble .s files using Vasm what downside would there be? I imagine the profiler would not know about anything inside the .s file, that would be a shame. But are there other things that would be more serious?

Also I really need to know why you have a pack of Irnbru as your profile picture?

BartmanAbyss commented 3 years ago

If I did decide to assemble .s files using Vasm what downside would there be? I imagine the profiler would not know about anything inside the .s file, that would be a shame. But are there other things that would be more serious?

I don't think there would be anything wrong if you just use Vasm. I think it's perfectly capable of producing ELF object files.

Also I really need to know why you have a pack of Irnbru as your profile picture?

My favorite beverage! #IRNBRU4LIFE!

BartmanAbyss commented 2 years ago

VASM support is now included in the (soon-to-be-released) v1.5.5!

BartmanAbyss commented 2 years ago

v1.5.5 is now available.