StanHash / fe1

Disassembly of Fire Emblem: Ankoku Ryu to Hikari no Tsurugi ("Shadow Dragon and the Blade of Light")
12 stars 1 forks source link

WLA-DX #1

Open oziphantom opened 3 years ago

oziphantom commented 3 years ago

yeah don't use WLA-DX for 6502, Z80 top tier, 6502 not so much.

There is no need to make another 6502 assembler, there are hundreds. Personally I recommend 64tass; it is god tier. But banking can be a bit of a pain to set up for it, and as you are not developing it CA65 ( part of CC65) suite might be better suited to your needs even if its not as good an assembler as 64tass.

Docs are here : http://tass64.sourceforge.net/ Program is here : https://sourceforge.net/projects/tass64/

StanHash commented 3 years ago

I had tried 64tass already (it was actually my first choice) and indeed I ran into issues when it came to doing banks, which is why I went for another one. I have messed with CA65 a bit for another thing so maybe I'll end up using that when I come back to this.

Thanks for your input!

oziphantom commented 3 years ago

yes 64tass being C64 focused has the tools but doesn't spell it out

you need to assemble with -b -X for binary (no prg header) and for 16MiB address space. From there you will want to use sections and logical so

=$0000 .dsection nesHeader =$0010 .logical $8000 .include "bank1.asm" .here .align $4010 .logical $8000 .include "bank2.asm" .here .align $8010 .logical $8000 .include "bank3.asm" .here .align $C010 .... .logical $c000 .include "bank16.asm" .here

It would make more sense though to pull all the banks into a section and then add the header after woods in say another assembly step to avoid all the +$10.

If you use 64Tass you can use https://csdb.dk/release/?id=149429 while you will need to split it up into banks and do it bank by bank, its "info" format is plain text, so it would be easy to have a global "RAM" and "Fixed bank" set that you use a script to insert into all the others as you update. But it will auto update all the labels you add, you can mark tables as words, lo hi block hi lo blocks, with -1 for rts dispatch, bytes, words, text etc

StanHash commented 3 years ago

If I end up doing it in a hacky way like that, then I wouldn't be able to pull bank numbers from labels right? Like if I do this

    * = $4000*$3 ; bank 3
    .logical $8000

label
    ; do whatever
    rts

    .here

I wouldn't be able to do this right?

    * = $4000*$F ; bank 15
    .logical $C000

goto_label
    lda #`label ; how would it know? How can I not have to write a raw 3 here?
    jsr swap_bank
    jmp label

    .here

Doing .logical $038000 to force a bank byte doesn't work (it doesn't like the address not fitting the 16bits).

One thing that is nice with WLA-DX is that it does handle banks more sensibly.

This is typically the reason why I am so strongly considering writing my own assembler, because none of the existing assemblers I looked at seem to support what I want in a sensible manner, despite there being so many of them.

oziphantom commented 3 years ago

Yeah when in a 65XX mode the PC is locked to 64K, it will wrap but it is locked to 64K. If you add -x or .cpu "65816" to the main file that will put it into 65816 mode to which you get 24bit PC and you can do `label and *=$038000 etc Since you are not writing but reversing, accidentally making 65816 code probably not an issue ;)

As somebody who has made SNES demos in WLA-DX trust me the get bank feature is not nice, its a horrible buggy mess. And on the SNES case we usually resort to just hard coding the bank number because you just can't trust it to do the right thing. Also this happens https://github.com/vhelin/wla-dx/issues/290 its a bit fixed now but you need to write code as if you are writing 68K to be sure sure. It fails silently