--- nono/exp/fmovemc.php 2026/04/29 17:04:33 1.1.1.2 +++ nono/exp/fmovemc.php 2026/04/29 17:05:28 1.1.1.3 @@ -24,8 +24,8 @@ ; SUCH DAMAGE. ; How to compile: -; > has fmovem.has -; > hlk fmovem.o si_util.o +; > has fmovemc.has +; > hlk fmovemc.o si_util.o .xref hexstr_long .include doscall.mac @@ -50,6 +50,9 @@ RESTORE_FLINE_TRAP .macro .text .even +start: + bra start2 + , function subr_success_to($regs, $id) { + $cpureg = eanum2mnem($id); $regnum = reg2num($regs); $mnem = regnum2mnemonic($regnum); $label = eanum2label($id); $funcname = "fmovem_{$label}_to_{$regs}"; - addfunc($funcname); + addfunc($funcname, "to", $mnem, $cpureg); + out(" PRINT msg_{$funcname}"); $w1 = 0xf200 | eanum2word($id); $w2 = 0x8000 | ($regnum << 10); - $cpureg = eanum2mnem($id); // count は指定されたレジスタ数 (0..3) // txcount は転送するレジスタ数 (1..3) $count = regnum2count($regnum); @@ -446,16 +469,17 @@ function subr_success_to($regs, $id) // アクセス可能な場合のテスト。FMOVEM , function subr_success_from($regs, $id) { + $cpureg = eanum2mnem($id); $regnum = reg2num($regs); $mnem = regnum2mnemonic($regnum); $label = eanum2label($id); $funcname = "fmovem_{$regs}_to_{$label}"; - addfunc($funcname); + addfunc($funcname, "from", $mnem, $cpureg); + out(" PRINT msg_{$funcname}"); $w1 = 0xf200 | eanum2word($id); $w2 = 0xa000 | ($regnum << 10); - $cpureg = eanum2mnem($id); // count は指定されたレジスタ数 (0..3) // txcount は転送するレジスタ数 (1..3) $count = regnum2count($regnum); @@ -587,15 +611,39 @@ function subr_success_from($regs, $id) // lea.l $0000002c.l,a5 だと has.x に絶対アドレッシングだと // 怒られてしまうため仕方なく ?> -start: +start2: clr.l -(sp) DOS _SUPER movem.l d7/a3-a5,-(sp) + ; rough argument check + cmpi.b #4,(a2)+ ; strlen(arg)>=4 ? + bcs @f + cmpi.l #$68617264,(a2) ; "hard" + seq.b is_hard +@@: + tst.b is_hard(pc) + beq disp_easy +disp_hard: + PRINT msg_hard + bra @f +disp_easy: + PRINT msg_easy +@@: + moveq.l #$2c,d0 ; alternate of "lea.l $2c,a5" move.l d0,a5 ; $text) { + // FPcr が1つもないケースは hard の時だけ実行。 + $undef_case = preg_match("/____/", $name); + if ($undef_case) { + out(" tst.b is_hard(pc)"); + out(" beq @f"); + } out(" bsr test_{$name}"); + if ($undef_case) { + out("@@:"); + } } ?> movem.l (sp)+,d7/a3-a5 @@ -617,7 +665,7 @@ result: PRINT buf PRINT msg_but - move.l 8+0(a6),a0 + move.l 8+0(a6),d0 lea.l buf(pc),a0 bsr hexstr_long PRINT buf @@ -636,6 +684,8 @@ fline_handler: move.l a3,2(sp) rte +msg_hard: .dc.b "hard mode",$d,$a,0 +msg_easy: .dc.b "easy mode",$d,$a,0 msg_oktrap: .dc.b $9,"ok(trap)",$d,$a,0, 0,0 msg_fail_notrap: .dc.b $9,"FAIL: trap expected but not occured",$d,$a,0 msg_fail_trap: .dc.b $9,"FAIL: unexpected trap occured",$d,$a,0 @@ -651,14 +701,15 @@ msg_crlf: .dc.b $d,$a,0 $text) { + out("msg_{$name}: .dc.b \"{$text}\",0"); } ?> .data .even workarea: .ds.b 24 -buf: .dc.b 20 +buf: .ds.b 20 +is_hard: .ds.b 1 .end start