Update to bsnes v042r01? release.

New WIP.

Updated centering code, it now just has per-platform centering code.
So it should look great with no flickering / movement on Windows or
Linux.

Fixed the patching status thing so it won't say it patched when it
fails. But seems there's not enough safeties in nall::ups. A patch of
nothing but "UPS1" has a 50% chance of crashing the emulator.

Most importantly, I finally got around to writing my pre-processor,
which is intended to add macro support to both C++ and xkas. Calling
it bpp, for **b**yuu's **p**re-**p**rocessor.

I started rewriting the S-CPU opcodes to use the new pre-processor. 40
of 256 opcodes finished. I'm also separating the 8-bit and 16-bit
versions this time. Twice the code, but it's easier on the eyes.

Old:
    ldy_addrx(0xbc, ldy, regs.p.x),
    ora_addrx(0x1d, ora, regs.p.m),
    sbc_addrx(0xfd, sbc, regs.p.m) {
    1:aa.l = op_readpc();
    2:aa.h = op_readpc();
    3:op_io_cond4(aa.w, aa.w + regs.x.w);
    4:if($2) last_cycle();
      rd.l = op_readdbr(aa.w + regs.x.w);
      if($2) { op_$1_b(); end; }
    5:last_cycle();
      rd.h = op_readdbr(aa.w + regs.x.w + 1);
      op_$1_w();
    }


New:
    @macro op_read_addrx(name)
      void {class}::op_{name}_addrx_b() {
        aa.l = op_readpc();
        aa.h = op_readpc();
        op_io_cond4(aa.w, aa.w + regs.x.w);
        last_cycle();
        rd.l = op_readdbr(aa.w + regs.x.w);
        op_{name}_b();
      }

      void {class}::op_{name}_addrx_w() {
        aa.l = op_readpc();
        aa.h = op_readpc();
        op_io_cond4(aa.w, aa.w + regs.x.w);
        rd.l = op_readdbr(aa.w + regs.x.w + 0);
        last_cycle();
        rd.h = op_readdbr(aa.w + regs.x.w + 1);
        op_{name}_w();
      }
    @endmacro


    @global class sCPU
    @include "opcode_read.bpp"

    @op_read_addry(ldx)
    @op_read_addry(ora)
    @op_read_addry(sbc)


Yes, I know the above can be done with the C pre-processor. Two major
reasons I avoided it:
1) I refuse to put \ after every line.
2) parameters are limited, eg MACRO(&=~, x += 2) would not work.

The important thing was making a more generic / flexible format. Will
allow me to kill off src/tool, though I'll still include the new
parser's source under src/lib/bpp.

May extend bpp in the future, who knows. @if/@else/@endif would be
nice, as would nested macros and static programming functions.

[No archive available]
This commit is contained in:
byuu 2009-04-03 11:15:00 +00:00
parent b5b21a4ec2
commit 90aa780d57

Diff Content Not Available