public void STR(uint address, uint data, CPU_RAM80.DATA_WIDTH width, out int DATA_S) { uint page; uint offset; HiLoAddress(address, width, out page, out offset); switch (width) { case CPU_RAM80.DATA_WIDTH.HALFWORD: uint lo, hi; int LO_S, HI_S; HiLo16(data, out hi, out lo); page_WR[page](offset, hi, out LO_S); page_WR[page](offset + 1, lo, out HI_S); DATA_S = LO_S + HI_S; break; case CPU_RAM80.DATA_WIDTH.BYTE: page_WR[page](offset, data, out DATA_S); break; default: throw new ArgumentException(); } }
static void HiLoAddress(uint address, CPU_RAM80.DATA_WIDTH width, out uint page, out uint offset) { HiLo16(address & ~((uint)width - 1), out page, out offset); }