A complete (I think) set of code generator macros to generate published op-codes
Rev. | b281f65ed7aeceaaf5feefa53f71dc6a4c0a99ac |
---|---|
Größe | 2,414 Bytes |
Zeit | 2020-10-08 20:37:04 |
Autor | Joel Matthew Rees |
Log Message | As it survived the trip across the Mac and ocean
|
/* Scatter test of exchange, swap, move peripheral/control */
/* 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)|_PSH(E_Dn|0),
E_InDEC|7, 0, 0);
err = genMOVE(CLONG, E_IMM, 0, (long) v2, E_An|2, 0, 0);
err = genMOVE(CLONG, E_IMM, 0, (long) v2, E_An|3, 0, 0);
err = genMOVE(CBYTE, E_IMM, 0, 0xc, E_Dn|7, 0, 0);
err = genMOVE(CBYTE, E_IMM, 0, 0x4356, E_Dn|6, 0, 0);
err = genMOVEP(CBYTE, E_Dn|7, 0, E_InOFF|2, 4); /* */
err = genEXG(E_An|2, E_An|3);
err = genEXG(E_Dn|7, E_An|3);
err = genEXG(E_An|2, E_Dn|6);
err = genEXG(E_Dn|7, E_Dn|6);
err = genEXT(CBYTE, E_Dn|1); /* */
err = genEXT(CWORD, E_Dn|6);
err = genEXT(CLONG, E_Dn|7);
err = genEXT(CLONG, E_Dn|0);
err = genSWAP(E_Dn|0);
err = genSWAP(E_Dn|7);
err = genMOVEP(CWORD, E_Dn|7, 0, E_InOFF|2, 4);
err = genMOVEP(CLONG, E_InOFF|3, 2, E_Dn|6, 0);
err = genMOVEP(CLONG, E_Dn|7, 0, E_InOFF|2, 4);
err = genMOVEP(CWORD, E_InOFF|3, 2, E_Dn|6, 0);
err = genMOVEC(E_DFC, E_Dn|7);
err = genMOVEC(E_Dn|7, E_SFC);
err = genMOVEC(E_SFC, E_Dn|0);
err = genMOVEC(E_Dn|0, E_DFC);
err = genMOVEC(E_VBR, E_An|2);
err = genMOVEC(E_An|3, E_VBR);
err = genMOVEC(E_An|7, E_USP);
err = genMOVEC(E_USP, E_An|2);
/* non intuitive, but legal: */
err = genMOVEC(E_DFC, E_An|7);
err = genMOVEC(E_An|7, E_SFC);
err = genMOVEC(E_SFC, E_An|0);
err = genMOVEC(E_An|0, E_DFC);
err = genMOVEC(E_VBR, E_Dn|2);
err = genMOVEC(E_Dn|3, E_VBR);
err = genMOVEC(E_Dn|7, E_USP);
err = genMOVEC(E_USP, E_Dn|2);
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)|_PUL(E_Dn|0));
err = genUNLK(6);
err = genRTS;
err = (*(PFI) f)();
printf("what? %lx\n", err);
return(0);
}