A complete (I think) set of code generator macros to generate published op-codes
Rev. | b281f65ed7aeceaaf5feefa53f71dc6a4c0a99ac |
---|---|
サイズ | 2,175 バイト |
日時 | 2020-10-08 20:37:04 |
作者 | Joel Matthew Rees |
ログメッセージ | As it survived the trip across the Mac and ocean
|
/* Scatter test of conditional operators */
/* Assigned by the author to the public domain, February 2000, Takino, Japan. */
/* joel_rees@sannet.ne.jp */
/* http://www.page.sannet.ne.jp/joel_rees */
#include "code.h"
#include <stdio.h>
int main()
{ int err;
CODE *v1 = dap;
CODE *v2 = dap += 4;
CODE *s1 = dap += 4;
CODE *s2 = dap += 16;
CODE *f = cap;
CODE *targ1, *targ2, *obj;
printf("here?\n");
v1[0] = 0x0000;
v1[1] = 0x4321;
v1[2] = 0x5678;
v1[3] = 0x9012;
v2[0] = 0x0876;
v2[1] = 0x2345;
v2[2] = 0x9012;
v2[3] = 0x5489;
strcpy((char *) s1, "hello there");
err = genLINK(6, -30);
err = genPUSH(CLONG, _PSH(E_An|1)|_PSH(E_An|2)|_PSH(E_An|3)
|_PSH(E_Dn|6)|_PSH(E_Dn|7),
E_InDEC|7, 0, 0);
err = genMOVE(CLONG, E_IMM, 0, (long) v1, E_An|2, 0, 0);
err = genBRA(0);
err = genB(cc_F, cap);
targ1 = cap;
err = genROXL(CBYTE, E_IMM, 1, E_InINC|2, 0, 0);
targ2 = cap;
err = genB(cc_CC, cap);
err = genBRA(targ1);
err = genTRAP(5);
err = fillB(CBYTE,targ2);
targ1 = cap;
err = genBSR(cap);
err = genPULL(CLONG, E_InINC|7, 0, 0,
_PUL(E_An|1)|_PUL(E_An|2)|_PUL(E_An|3)
|_PUL(E_Dn|6)|_PUL(E_Dn|7));
err = genUNLK(6);
err = genRTS;
err = fillB(CBYTE, targ1);
err = genMOVE(CBYTE, E_CCR, 0, 0, E_InDEC|7, 0, 0);
err = genS(cc_T, E_In|7, 0, 0);
err = genS(cc_HI, E_InOFF|6, 0, -8);
err = genS(cc_HS, E_InOFF|6, 0, -8);
err = genS(cc_CC, E_Dn|6, 0, 0);
err = genS(cc_NE, E_InDEC|2, 0, 0);
err = genS(cc_VC, E_InINC|2, 0, 0);
err = genS(cc_PL, E_AnXi|2, iDl(6), 0x43);
err = genS(cc_GT, E_Dn|6, 0, 0);
err = genS(cc_GE, E_Dn|6, 0, 0);
err = genS(cc_T, E_ABSl, 0, (long) (v1+2));
err = genS(cc_T, E_ABSw, 0, (long) (v1+2));
err = genDB(cc_F, E_Dn|6, cap);
err = genDB(cc_LS, E_Dn|6, cap);
err = genDB(cc_LO, E_Dn|6, cap);
err = genDB(cc_CS, E_Dn|6, cap);
err = genDB(cc_EQ, E_Dn|6, cap);
err = genDB(cc_VS, E_Dn|6, cap);
err = genDB(cc_MI, E_Dn|6, cap);
err = genDB(cc_LT, E_Dn|6, cap);
err = genDB(cc_GE, E_Dn|6, cap);
err = genRTR;
err = (*(PFI) f)();
printf("what? %lx\n", err);
return(0);
}