scc

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

z80.c (848B)


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