- Code: Select all
Load CaseWord with available characters
(gen. act. E3)
C0/B3B7: 7B TDC
C0/B3B8: 8DB41E STA $1EB4
C0/B3BB: 8DB51E STA $1EB5
C0/B3BE: A600 LDX $00
C0/B3C0: 9B TXY
C0/B3C1: B96708 LDA $0867,Y
C0/B3C4: 2907 AND #$07
C0/B3C6: F00A BEQ $B3D2
C0/B3C8: ADB41E LDA $1EB4
C0/B3CB: 1FFCBAC0 ORA $C0BAFC,X
C0/B3CF: 8DB41E STA $1EB4
C0/B3D2: C221 REP #$21
C0/B3D4: 98 TYA
C0/B3D5: 692900 ADC #$0029
C0/B3D8: A8 TAY
C0/B3D9: 7B TDC
C0/B3DA: E220 SEP #$20 (8 bit accum./memory)
C0/B3DC: E8 INX
C0/B3DD: E00800 CPX #$0008
C0/B3E0: D0DF BNE $B3C1
C0/B3E2: A600 LDX $00
C0/B3E4: 9B TXY
C0/B3E5: B9AF09 LDA $09AF,Y
C0/B3E8: 2907 AND #$07
C0/B3EA: F00A BEQ $B3F6
C0/B3EC: ADB51E LDA $1EB5
C0/B3EF: 1FFCBAC0 ORA $C0BAFC,X
C0/B3F3: 8DB51E STA $1EB5
C0/B3F6: C221 REP #$21
C0/B3F8: 98 TYA
C0/B3F9: 692900 ADC #$0029
C0/B3FC: A8 TAY
C0/B3FD: 7B TDC
C0/B3FE: E220 SEP #$20 (8 bit accum./memory)
C0/B400: E8 INX
C0/B401: E00800 CPX #$0008
C0/B404: D0DF BNE $B3E5
C0/B406: A901 LDA #$01
C0/B408: 4C5C9B JMP $9B5C
Load CaseWord with the characters in the active party
(gen. act. DE)
C0/B40B: 7B TDC
C0/B40C: 8DB41E STA $1EB4 (since A is still 8 bit, two STZ commands would work here)
C0/B40F: 8DB51E STA $1EB5
C0/B412: A600 LDX $00
C0/B414: 9B TXY
C0/B415: B96708 LDA $0867,Y
C0/B418: 2907 AND #$07
C0/B41A: CD6D1A CMP $1A6D (Is this the active party?)
C0/B41D: D00A BNE $B429
C0/B41F: ADB41E LDA $1EB4
C0/B422: 1FFCBAC0 ORA $C0BAFC,X
C0/B426: 8DB41E STA $1EB4
C0/B429: C221 REP #$21
C0/B42B: 98 TYA
C0/B42C: 692900 ADC #$0029
C0/B42F: A8 TAY
C0/B430: 7B TDC
C0/B431: E220 SEP #$20 (8 bit accum./memory)
C0/B433: E8 INX
C0/B434: E00800 CPX #$0008
C0/B437: D0DC BNE $B415
C0/B439: A600 LDX $00
C0/B43B: 9B TXY
C0/B43C: B9AF09 LDA $09AF,Y
C0/B43F: 2907 AND #$07
C0/B441: CD6D1A CMP $1A6D (Is this the active party?)
C0/B444: D00A BNE $B450
C0/B446: ADB51E LDA $1EB5
C0/B449: 1FFCBAC0 ORA $C0BAFC,X
C0/B44D: 8DB51E STA $1EB5
C0/B450: C221 REP #$21
C0/B452: 98 TYA
C0/B453: 692900 ADC #$0029
C0/B456: A8 TAY
C0/B457: 7B TDC
C0/B458: E220 SEP #$20 (8 bit accum./memory)
C0/B45A: E8 INX
C0/B45B: E00800 CPX #$0008
C0/B45E: D0DC BNE $B43C
C0/B460: A901 LDA #$01
C0/B462: 4C5C9B JMP $9B5C
(gen. act. DF)
C0/B465: 7B TDC
C0/B466: 8DB41E STA $1EB4 (LDX $00, STX $1EB4...)
C0/B469: 8DB51E STA $1EB5 (clear the caseword)
C0/B46C: A600 LDX $00
C0/B46E: 9B TXY
C0/B46F: B96708 LDA $0867,Y
C0/B472: 2940 AND #$40
C0/B474: F00A BEQ $B480
C0/B476: ADB41E LDA $1EB4 (load caseword)
C0/B479: 1FFCBAC0 ORA $C0BAFC,X (set a bit)
C0/B47D: 8DB41E STA $1EB4 (save caseword)
C0/B480: C221 REP #$21
C0/B482: 98 TYA
C0/B483: 692900 ADC #$0029
C0/B486: A8 TAY
C0/B487: 7B TDC
C0/B488: E220 SEP #$20 (8 bit accum./memory)
C0/B48A: E8 INX
C0/B48B: E00800 CPX #$0008 (have we done 8 characters yet?)
C0/B48E: D0DF BNE $B46F (branch if not)
C0/B490: A600 LDX $00
C0/B492: 9B TXY
C0/B493: B9AF09 LDA $09AF,Y
C0/B496: 2940 AND #$40
C0/B498: F00A BEQ $B4A4
C0/B49A: ADB51E LDA $1EB5 (load caseword)
C0/B49D: 1FFCBAC0 ORA $C0BAFC,X (set a bit)
C0/B4A1: 8DB51E STA $1EB5 (save caseword)
C0/B4A4: C221 REP #$21
C0/B4A6: 98 TYA
C0/B4A7: 692900 ADC #$0029
C0/B4AA: A8 TAY
C0/B4AB: 7B TDC
C0/B4AC: E220 SEP #$20 (8 bit accum./memory)
C0/B4AE: E8 INX
C0/B4AF: E00800 CPX #$0008 (have we done 8 characters yet?)
C0/B4B2: D0DF BNE $B493 (branch if not)
C0/B4B4: A901 LDA #$01
C0/B4B6: 4C5C9B JMP $9B5C (advance event queue 1 byte)
It's all as clear as mud. DF is so similar to DE and E3, it's really hard to establish any logical reasoning for this.
Doing some tests, all I can determine is that DF seems to be related to the current party. With an NPC Sabin sitting in a room, the caseword was not affected (my party was just Locke, and the caseword going into the room was already #$0002). Well, inaccurate, since the command did set a value, just happened to be the value it currently was. Yes, I did set a breakpoint on the caseword, and the only time it was ever written to was by command DF.
So, what does all of this mean? *shrug* All I know is, I'm just as confused as I was 20 minutes ago. To top it all off, I ran into an old routine. The infamous equipment check function of C0.
- Code: Select all
C0/6CF3: 9CDF11 STZ $11DF (from C0/A032, C0/B094, C0/BF97)
C0/6CF6: A400 LDY $00
C0/6CF8: 641B STZ $1B
C0/6CFA: B96708 LDA $0867,Y
C0/6CFD: 2940 AND #$40
C0/6CFF: F013 BEQ $6D14
C0/6D01: B96708 LDA $0867,Y
C0/6D04: 2907 AND #$07
C0/6D06: CD6D1A CMP $1A6D (Is this the active party?)
C0/6D09: D009 BNE $6D14
C0/6D0B: 5A PHY
C0/6D0C: A51B LDA $1B (load current character)
C0/6D0E: 220600C2 JSL $C20006 ("Equipment check function," enforces stat caps, etc)
C0/6D12: 7B TDC
C0/6D13: 7A PLY
C0/6D14: C221 REP #$21
C0/6D16: 98 TYA
C0/6D17: 692900 ADC #$0029 (increment for next character)
C0/6D1A: A8 TAY
C0/6D1B: 7B TDC
C0/6D1C: E220 SEP #$20 (8 bit accum./memory)
C0/6D1E: E61B INC $1B
C0/6D20: C09002 CPY #$0290 (have we checked 16 characters?)
C0/6D23: D0D5 BNE $6CFA (branch if not)
C0/6D25: 60 RTS
Ok, more like "why is that there at all?"
This will be figured out, I assure you. I only hope my sanity hasn't left me by the time that happens.
