Relocation of AKM binary files loaded into RAM

What is Arkos Tracker? Forums Arkos Tracker forum General discussion Relocation of AKM binary files loaded into RAM

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #30515
    amaurycarvalho
    Participant

    Hi!

    I’m working on a project thats needs to dynamically relocate AKM binary files loaded into RAM on the fly, changing the original loading address informed on AT2 file export dialog screen.

    Looking on ASM source version of some AKM files, its clear that it’s necessary to navigate on the file structure recalculating all the address fields. Something like this for the first 3 address fields on the file header:

    {!{code}!}czo2MTE6XCIKOyBITCA9IEFLTSBvcmlnaW5hbCBhZGRyZXNzIChleHBvcnRlZCBmcm9tIEFUMikKOyBERSA9IEFLTSBuZXcgYWRkcmV7WyYqJl19c3MgKGxvYWRlZCBpbnRvIFJBTSkKU29uZ1JlbG9jYXRpb246CiAgcHVzaCBkZQogICAgeG9yIGEKICAgIGV4IGRlLCBobAogICAgc3tbJiomXX1iYyBobCwgZGUKICAgIGxkIChGQUNUT1IpLCBobAogIHBvcCBobAogIGNhbGwgQWRkcmVzc0ZpZWxkUmVsb2NhdGlvbgogIGNhbGwge1smKiZdfUFkZHJlc3NGaWVsZFJlbG9jYXRpb24KICBjYWxsIEFkZHJlc3NGaWVsZFJlbG9jYXRpb24KICA7IGZpbGUgc3RydWN0dXJlIG5hdml7WyYqJl19Z2F0aW9uIGNvZGUgaGVyZS4uLi4KICByZXQgCgpBZGRyZXNzRmllbGRHZXQ6CiAgcHVzaCBobAogICAgbGQgZSwgKGhsKQogICAgaXtbJiomXX1uYyBobAogICAgbGQgZCwgKGhsKQogIHBvcCBobCAKICByZXQgCgpBZGRyZXNzRmllbGRQdXQ6CiAgbGQgKGhsKSwgZQogIGluYyBoe1smKiZdfWwKICBsZCAoaGwpLCBkCiAgaW5jIGhsCiAgcmV0IAoKQWRkcmVzc1JlbG9jYXRpb246CiAgY2FsbCBBZGRyZXNzRmllbGRHZXQKICB7WyYqJl19ZXggZGUsIGhsCiAgICBsZCBiYywgKEZBQ1RPUikKICAgIGFkZCBobCwgYmMKICBleCBkZSwgaGwKICBjYWxsIEFkZHJlc3NGaWVsZHtbJiomXX1QdXQKICByZXQKXCI7e1smKiZdfQ=={!{/code}!}

    I wondering if someone has the official AKM binary file structure documentation and already wrote a routine for this same purpose.

    Thanks for any help.

    #30516
    amaurycarvalho
    Participant

    For some reason the example code do not showed into the post, so here it’s again below:

    ; HL = AKM original address (exported from AT2)
    ; DE = AKM new address (loaded into RAM)
    SongRelocation:
    push de
    xor a
    ex de, hl
    sbc hl, de
    ld (FACTOR), hl
    pop hl
    call AddressFieldRelocation
    call AddressFieldRelocation
    call AddressFieldRelocation
    ; file structure navigation code here….
    ret

    AddressFieldGet:
    push hl
    ld e, (hl)
    inc hl
    ld d, (hl)
    pop hl
    ret

    AddressFieldPut:
    ld (hl), e
    inc hl
    ld (hl), d
    inc hl
    ret

    AddressRelocation:
    call AddressFieldGet
    ex de, hl
    ld bc, (FACTOR)
    add hl, bc
    ex de, hl
    call AddressFieldPut
    ret

    #30517
    Targhan
    Keymaster

    Hi!

    Yeah, sorry about the broken code tag that doesn’t work…

    Anyway! The AKM structure is perfectly documented in the package: players/playerAkm/doc/AKM.md

    It shouldn’t be hard to make a “relocator”. If you manage to do one, don’t hesitate to send it to me, I can put it in the package (with due credits!).

    See ya,
    Trg.

    #30520
    amaurycarvalho
    Participant

    Thanks very much, Thargan, for your advices!

    I found the documentation just in the folder you appointed, and it was sufficient to my project.

    The Arkos Tracker 2 is a great tool, so I’m working on an integration of my open source MSX Basic compiler (MSXBAS2ROM) with your incredible minimalist player.

    My goal is to create an easy way to a MSX Basic programmer (with no knowledge of assembly) to include and play an Arkos exported AKM/AKX file into a MSX Basic compiled ROM. The “relocator” (thats I wrote in C++) was necessary to build the final ROM in a more flexible way.

    You can see my first tests of a MSX Basic compiled program using the minimalist player on the video below (sorry, portuguese only…).

    I will soon publish on my project page this new MSXBAS2ROM version with AKM/AKX support, and another video demonstrating how to use it.

    So, more news is coming soon!

    #30522
    Targhan
    Keymaster

    Hey that’s pretty neat. Once you have a finished versione, maybe I can put it in the package of the application (with due credits!), besides the CPC-Basic AKG wrapper I already did.

    #30523
    amaurycarvalho
    Participant

    Of course, Targhan! thanks!!!

    I will inform you when its OK to release (its in beta test by now), and I will make for you a zip package with a little documentation explaining how to use it.

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.