Jump to content
IGNORED

dasm question


SpiceWare
 Share

Recommended Posts

This bit of code:

​    ORG $7000
    RORG $F000
 
...
 
SoundFreq:  ; 0-31 0 = highest freq.
            ; upper 3 bits control duration, 0 = 1 frame, 1 = 2 frames... 7=8 frames
            
        .byte 0, D4+29, D4+29, D6+0, D2+26 ; _12_AA_Jingle
        .byte    D2+26, D6+0, D2+23, D2+23 ; _12_AA_Jingle
        .byte    D6+0, D2+21, D2+21, D6+0  ; _12_AA_Jingle
        .byte    D2+29, D2+29, D6+0, D2+29 ; _12_AA_Jingle
        .byte    D2+29, D6+0, D2+29, D2+29 ; _12_AA_Jingle
        .byte    D6+0, D2+29, D2+29        ; _12_AA_Jingle        

 

when compiled produces this output in the listing:

     40  730a    SoundFreq ; 0-31 0 = highest freq.
     41  730a ; upper 3 bits control duration, 0 = 1 frame, 1 = 2 frames... 7=8 frames
     42  730a
     43  730a        00 7d 7d a0*       .byte.b 0, D4+29, D4+29, D6+0, D2+26 ; _12_AA_Jingle
     44  730f        3a a0 37 37       .byte.b D2+26, D6+0, D2+23, D2+23 ; _12_AA_Jingle
     45  7313        a0 35 35 a0       .byte.b D6+0, D2+21, D2+21, D6+0 ; _12_AA_Jingle
     46  7317        3d 3d a0 3d       .byte.b D2+29, D2+29, D6+0, D2+29 ; _12_AA_Jingle
     47  731b        3d a0 3d 3d       .byte.b D2+29, D6+0, D2+29, D2+29 ; _12_AA_Jingle
     48  731f        a0 3d 3d        .byte.b D6+0, D2+29, D2+29 ; _12_AA_Jingle
     49  7322

Due to the ORG/RORG the value given label SoundFreq is F30A. I need the 730A value for the ARM routines, so I've been doing this to convert it:

 echo "#define SOUND_FREQ                 ((unsigned char *)(",[[SoundFreq & $fff] + $7000]d,"))"

While that works, it's a hassle to maintain when I'm rearranging data usage - forget to change one and things no longer work correctly. Is there a way to do something like this so that SoundFreq would get the 730A value?

SoundFreq = SPECIAL_SYMBOL

        .byte 0, D4+29, D4+29, D6+0, D2+26 ; _12_AA_Jingle
        .byte    D2+26, D6+0, D2+23, D2+23 ; _12_AA_Jingle
        .byte    D6+0, D2+21, D2+21, D6+0  ; _12_AA_Jingle
        .byte    D2+29, D2+29, D6+0, D2+29 ; _12_AA_Jingle
        .byte    D2+29, D6+0, D2+29, D2+29 ; _12_AA_Jingle
        .byte    D6+0, D2+29, D2+29        ; _12_AA_Jingle        

Dasm must know it, else it couldn't be in the listing.

Link to comment
Share on other sites

Unless I missing something, you could just:

​    ORG $7000
    RORG $7000

You don't need to use $Fxxx specifically for rom addresses. Lots of games use rom addresses other then $Fxxx:

 

$1xxx

$3xxx

$5xxx

$7xxx

$9xxx

$Bxxx

$Dxxx

$Fxxx

 

These are all valid. If you really need to go back to $Fxxx addresses later on in the code, then just do another ORG/RORG.

Link to comment
Share on other sites

I'm thinking he's talking about moving his tables around in what is a multi-bank rom anyway, and he needs the ORG instead of RORG address for the ARM code to find it.

 

Looking at the dasm docs (and briefly at the source) I don't see a way to spit out the ORG if you're using RORG. So long as you stick to the "usual" F6 style ORG/RORG values, I guess you could do something like "SoundFreq = ( . & $fff ) | ((. >> 1) & $ff000))"

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...