1 /*
2  * Z80SIM  -  a Z80-CPU simulator
3  *
4  * Copyright (C) 2016-2019 by Udo Munk
5  *
6  * This module implements memory management for a Cromemco Z-1 system
7  *
8  * History:
9  * 22-NOV-16 stuff moved to here and implemented as inline functions
10  * 03-FEB-17 added ROM initialisation
11  * 18-MAY-18 optimization
12  * 18-JUL-18 use logging
13  * 01-OCT-19 optimization
14  */
15 
16 #include <stdlib.h>
17 #include <stdio.h>
18 #include "sim.h"
19 #include "simglb.h"
20 #include "../../frontpanel/frontpanel.h"
21 #include "memory.h"
22 #include "log.h"
23 
24 static const char *TAG = "memory";
25 
26 BYTE *memory[MAXSEG];		/* MMU with pointers to the banks */
27 int selbnk;			/* current selected bank */
28 int common;			/* flag for common writes to all banks */
29 int bankio;			/* data written to banking I/O port */
30 
init_memory(void)31 void init_memory(void)
32 {
33 	register int i;
34 
35 	for (i = 0; i < MAXSEG; i++) {
36 		if ((memory[i] = malloc(65536)) == NULL) {
37 			LOGE(TAG, "can't allocate memory for bank %d", i);
38 			exit(1);
39 		}
40 	}
41 }
42 
init_rom(void)43 void init_rom(void)
44 {
45 }
46