For weapons.. is the hidden weapon power (???) hardcoded to the weapon, or is that some bit that noone knows about.
Hard coded to the weapon:
C3/879C: 7B TDC
C3/879D: A54B LDA $4B
C3/879F: A8 TAY
C3/87A0: B96918 LDA $1869,Y (Items currently in inventory)
C3/87A3: C91C CMP #$1C (Is it the Atma Weapon?)
C3/87A5: F019 BEQ $87C0
C3/87A7: C916 CMP #$16 (Is it the Soul Sabre?)
C3/87A9: F015 BEQ $87C0
C3/87AB: C951 CMP #$51 (Is it the Dice?)
C3/87AD: F011 BEQ $87C0
C3/87AF: C952 CMP #$52 (Is it the fixed Dice?)
C3/87B1: F00D BEQ $87C0
C3/87B3: BF1450D8 LDA $D85014,X (Load attack pwr, strength of item X)
C3/87B7: 20E004 JSR $04E0
C3/87BA: A24386 LDX #$8643
C3/87BD: 4CC004 JMP $04C0
C3/87C0: A0718D LDY #$8D71
C3/87C3: 20F902 JSR $02F9 (display "???")
C3/87C6: 60 RTS
Granted, there are enough bits in the item data to where it could be changed to be a bit, but for whatever reason they chose this method.
For armor, some weapon/armor don't auto equip (like the Imp set of equipment) via Optimal. It doesn't seem to be triggered by the Imp bit, so are these hardcoded or are related to the same bit weapons use (the hidden weapon power bit) so they aren't auto-equipped?
Optimum goes by ID number. The higher number has the priority (which is why Ragnarok is always equipped over the Illumina). The game actually makes no attempt at all to check for power (attack or defense) when equipping. There are some items though which will never be selected for Optimum, ever. These items are Cursed Shield, Thornlet, Imp Halberd, Tortoise Shield, Titanium, Imp's Armor, Atma Weapon, Drainer, Soul Saber, and Heal Rod.
That's a bigger list than I remember.