News:

11 March 2016 - Forum Rules

Main Menu

Bank as define in xkas or Asar

Started by Madsiur, June 11, 2016, 12:35:03 PM

Previous topic - Next topic

Madsiur

I'd like to have the bank defined at beginning of a SNES ASM file such as follow:


!BK = $F3  ;bank
!off = !BK$0100  ;expected value: $F30100
!off1 = !BK$0000  ; expected value: $F30000


However, doing LDA $off,X does a LDA $F3 (or LDA $F3,X I'm not sure about the B5 opcode).

According to xkas documentation, doing such a thing is valid:


!x = $12
!y = !x$34
LDA !y  ;LDA $1234


What am I missing?

Also if anyone have a better solution with another assembler, feel free to suggest it.

Lenophis

Setting defines that way is just silly, but whatever. If you know your starting addresses, why not just set them separately as the defines already?

As for what you're missing, who knows. It's xkas. It's probably too robust.


https://ff6randomizer.codeplex.com/ - Randomize your FF6 experience!

Madsiur

Quote from: Lenophis on June 11, 2016, 01:09:08 PM
Setting defines that way is just silly, but whatever. If you know your starting addresses, why not just set them separately as the defines already?

I think I'll resign to that. However I though it could be handy to have a single define at the beginning of code for the bank. Before declaring them one after the other at the beginning, I tried the following. Thing is, I have to do two extra sets of monster data and other data for multiple difficulties. In case I want to relocate those, a simple bank define (or two) would have seem logic, though personally I can achieve the same result in notepad++ with the replace function.


LDA !BK$0100,X
[...]

Tried this too:

LDA (!BK$0100),X  ;I think this has not the same meaning as an SNES instruction. I was using parenthesis for the concatenation of the define and value after, but whatever.


The best would be an assembler that support something like this:


!BK = $F30000
$off = !BK + $0100

Nightcrawler

Quote from: Madsiur on June 11, 2016, 01:32:43 PM
The best would be an assembler that support something like this:


!BK = $F30000
$off = !BK + $0100


xkas DOES support that... I've done things like that often. I do it via the following:


BK = $F30000
off = BK + $0100

lda BK,x   ;This will be lda $F30100,x


TransCorp - Over 20 years of community dedication.
Dual Orb 2, Wozz, Emerald Dragon, Tenshi No Uta, Glory of Heracles IV SFC/SNES Translations

Madsiur

Thanks for the tip. I'll try that.