Whoopsie. I thought I fixed it... was aware of it doing that, but then traced it to me not updating LongCalls with the proper bank bytes after re-ordering them. Soooo hm. I'm kind of in the middle of messing up everything so I can't fix it without undoing my work or breaking battles, so gimme a day or two to sort that out.
I'm trying to come up with a way to load enemy graphics outside of their tilesets. Formation data has the IDs of all enemies needed, the IDs just need to be sorted small to big, with the amount updated as well...? Then instead of checking the low bits of the first byte for the whole set... just goes through the IDs, but then fiends need their own special loading, but also the second byte in the formation data might be tricky...
Yep. It's a mess.
Love the idea of a second overworld. But... not gonna devote any brain power to how it would be done just now. xD
Edit: Considering how much I have to change for this, I'm shelving it for tonight. I pushed my current build with my new stuff commented out and old stuff in place, and it loads for me okay.
If it still crashes, see what happens with the debugger with a breakpoint set at $C05C... that should be "CMP #$4D" Then let me know if it goes on to "LDA #$4D" or skips past it.
Think I'm gonna drop this idea. Being able to mix and match enemies sounds fun, but the amount of effort is... staggering. And I'm not having fun trying to code it.
Here's a rough draft of what I was trying to do...
LoadEnemyGraphics:
; LDY #2
; @LoadNext:
; LDA (tmp+4), Y ; get enemy ID
; CMP #$FF ; if $FF, do... something to skip it
; BEQ :+
;
; ASL A ; double ID, put in X
; TAX
; STY enemyload_counter ; save Y as counter
; LDA lut_EnemyBankCHR, X ; get first byte of this table
; AND #$0F ; cut off high bits
; LDY enemyload_pointer ; load the pointer thing into Y
; STA enemyload, Y ; save the bank # as this byte in the new loading list
; INY
; LDA lut_enemyBankCHR, X ; get first byte again
; AND #$F0 ; cut off low bits
; BEQ @SmallEnemy ; if its 0, its a small enemy, else...
;
; CMP #02
; BEQ @Fiend
; CMP #03
; BEQ @Chaos
;
; @LargeEnemy:
; INX ; get second byte of above table
; LDA lut_enemyBankCHR, X ; large enemies are $240 bytes each - #576 bytes
; LDX #$24 ; so multiply by...
; JSR MultiplyXA ;
; STA enemyload, Y ; low byte of address
; INY ;
; TXA ; get high byte of multiplication
; ORA #$80 ; set highest bit so it loads from the bank's address properly
; STA enemyload, Y ; and save as high byte of address
; INY
; STY enemyload_pointer
; LDY enemyload_counter
; INY
; CPY #6
; BEQ @Finish
; JMP @LoadNext
;
;
; @SmallEnemy:
; INX ; get second byte of above table
; LDA lut_enemyBankCHR, X ; small enemies are $100 bytes each
; STA enemyload, Y ; low byte of address
; INY ;
; TXA ; get high byte of multiplication
; ORA #$80 ; set highest bit so it loads from the bank's address properly
; STA enemyload, Y ; and save as high byte of address
; INY
; STY enemyload_pointer
; LDY enemyload_counter
; INY
; CPY #6
; BEQ @Finish
; JMP @LoadNext
lut_enemyBankCHR:
;; JIGS - left nybble: enemy size (0 = small, 1 = large, 2 = fiend, 3 = chaos)
;; right nybble: enemy place in chr list
;; second byte: order in bank (small and large are seperated graphically)
So the thought was, 4 enemies, $10 bytes of pointers and such. 1st byte is the bank to load from, 2nd and 3rd bytes are the pointers to start drawing, 4th byte is how many tiles. Then pass that off to a routine in the fixed bank that would go through the list, swap banks, draw the enemy tiles, ending up with basically the same format as it is now.
But also gotta organize the enemy graphics in the banks, know how many small/large are in each bank, add that offset in when doing large enemies, oawoo... Just a ton more code and extra LUTs for something so... probably not that useful at the current stage...?