/* Program to generate TASM table for SC/MP. It's done this way because the SCMP is very orthogonal in design & its much easier and more reliable than typing one. */ #include #include char *Ops[] = { "LD ","ST ","AND","OR ","XOR","DAD","ADD","CAD" }; char *Jump[] = { "JMP","JP ","JZ ","JNZ" }; struct _Defs { int Opcode;char *Name; } ByteOps[] = { { 0x19,"sio" }, { 0x1C,"sr" }, { 0x1D,"srl" },{ 0x1E,"rr" }, { 0x1F,"rrl" }, { 0x00,"halt" }, { 0x01,"xae" }, { 0x02,"ccl" }, { 0x03,"scl" }, { 0x04,"dint" }, { 0x05,"ien" }, { 0x06,"csa" }, { 0x07,"cas" }, { 0x08,"nop" }, { -1,"" } }; void main() { int Op; int Reg; char *DType,Name[8]; printf("\"TASM 8060 Assembler. \"\n"); printf("/* Table Assembler file for SC/MP Microprocessor */\n"); printf("/* this is automatically generated by TGEN.C */\n"); printf("/* written by Paul Robson (C) 1998 */\n"); for (Op = 0;Op < 8;Op++) { for (Reg = 0;Reg < 4;Reg++) { DType = "NOTOUCH"; if (Reg != 0) printf("%s @*(%d) %02X 2 %s 1\n",Ops[Op],Reg,0xC4+Reg+Op*8,DType); printf("%s *(%d) %02X 2 %s 1\n",Ops[Op],Reg,0xC0+Reg+Op*8,DType); } strcpy(Name,Ops[Op]);strcpy(Name+2,"I"); if (Op == 4) Name[1] = 'R'; if (Op != 1) printf("%s * %02X 2 NOTOUCH 1\n",Name,0xC4+Op*8); Name[2] = 'E'; if (Op != 1) printf("%s \"\" %02X 1 NOP 1\n",Name,0x40+Op*8); printf("%s * %02X 2 R1 1\n",Ops[Op],Op*8+0xC0); printf("\n"); } for (Reg = 0;Reg < 4;Reg++) { DType = "NOTOUCH"; for (Op = 0;Op < 4;Op++) printf("%s *(%d) %02X 2 %s 1\n",Jump[Op],Reg,0x90+Reg+Op*4,DType); printf("ILD *(%d) %02X 2 %s 1\n",Reg,0xA8+Reg,DType); printf("DLD *(%d) %02X 2 %s 1\n",Reg,0xB8+Reg,DType); printf("XPAL %d %02X 1 NOP 1\n",Reg,0x30+Reg); printf("XPAH %d %02X 1 NOP 1\n",Reg,0x34+Reg); printf("XPPC %d %02X 1 NOP 1\n",Reg,0x3C+Reg); printf("\n"); } for (Op = 0;Op < 4;Op++) printf("%s * %02X 2 %s 1\n",Jump[Op],0x90+Op*4,"R1"); printf("ILD * A8 2 R1 1\n"); printf("DLD * B8 2 R1 1\n"); printf("DLY * 8F 2 NOTOUCH 1\n"); Op = 0; while (ByteOps[Op].Opcode >= 0) { strcpy(Name,ByteOps[Op].Name); strupr(Name); printf("%s \"\" %02X 1 NOP 1\n",Name,ByteOps[Op].Opcode); Op++; } }