scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

z80.c (870B)


      1 #include <stdlib.h>
      2 
      3 #include <scc/mach.h>
      4 #include <scc/scc.h>
      5 
      6 #include "../../as.h"
      7 #include "../x80/proc.h"
      8 
      9 TUINT maxaddr = 0xFFFFFFFF;
     10 int endian = LITTLE_ENDIAN;
     11 
     12 void
     13 iarch(void)
     14 {
     15 	static struct {
     16 		char *name;
     17 		char type;
     18 	} regs[] = {
     19 		"AF", AREG_AF,
     20 		"A", AREG_A,
     21 		"F", AREG_F,
     22 
     23 		"BC", AREG_BC,
     24 		"B", AREG_B,
     25 		"C", AREG_C,
     26 
     27 		"HL", AREG_HL,
     28 		"H", AREG_H,
     29 		"L", AREG_L,
     30 
     31 		"DE", AREG_DE,
     32 		"D", AREG_D,
     33 		"E", AREG_E,
     34 
     35 		"IX", AREG_IX,
     36 		"IXL", AREG_IXL,
     37 		"IXH", AREG_IXH,
     38 
     39 		"IY", AREG_IY,
     40 		"IYL", AREG_IYL,
     41 		"IYH", AREG_IYH,
     42 
     43 		"R", AREG_R,
     44 		"I", AREG_I,
     45 		"AF'", AREG_AF_,
     46 		"SP", AREG_SP,
     47 
     48 		"NZ", AREG_NZ,
     49 		"Z", AREG_Z,
     50 		"NC", AREG_NC,
     51 		"PO", AREG_PO,
     52 		"PE", AREG_PE,
     53 		"P", AREG_P,
     54 		"M", AREG_M,
     55 
     56 		NULL,
     57 	}, *bp;
     58 
     59 	for (bp = regs; bp->name; ++bp) {
     60 		Symbol *sym = lookup(bp->name);
     61 		sym->flags = FREG;
     62 		sym->value = bp->type;
     63 	}
     64 }