Refine and reuse STM/LDM code
Refine and reuse STM/LDM code

zerofalcon/mgba,cassos/mgba,matthewbauer/mgba,sergiobenrocha2/mgba,libretro/mgba,jeremyherbert/mgba,MerryMage/mgba,askotx/mgba,fr500/mgba,Iniquitatis/mgba,Iniquitatis/mgba,fr500/mgba,sergiobenrocha2/mgba,askotx/mgba,sergiobenrocha2/mgba,jeremyherbert/mgba,askotx/mgba,sergiobenrocha2/mgba,libretro/mgba,Iniquitatis/mgba,mgba-emu/mgba,bentley/mgba,sergiobenrocha2/mgba,nattthebear/mgba,Anty-Lemon/mgba,jeremyherbert/mgba,jeremyherbert/mgba,libretro/mgba,zerofalcon/mgba,libretro/mgba,AdmiralCurtiss/mgba,Touched/mgba,mgba-emu/mgba,cassos/mgba,Anty-Lemon/mgba,zerofalcon/mgba,matthewbauer/mgba,Anty-Lemon/mgba,iracigt/mgba,Touched/mgba,fr500/mgba,mgba-emu/mgba,Touched/mgba,mgba-emu/mgba,Anty-Lemon/mgba,fr500/mgba,nattthebear/mgba,libretro/mgba,MerryMage/mgba,iracigt/mgba,iracigt/mgba,Iniquitatis/mgba,MerryMage/mgba,cassos/mgba,AdmiralCurtiss/mgba,AdmiralCurtiss/mgba,bentley/mgba,askotx/mgba,iracigt/mgba