comparison blastcpm.c @ 1130:8f14767661fa

Remove memory map assumptions from Z80 core and move a little bit of logic to the generic backend.c so it can be shared between CPU cores
author Michael Pavone <pavone@retrodev.com>
date Wed, 28 Dec 2016 20:39:27 -0800
parents fe8c79f82c22
children 2455662378ed ca2336469397
comparison
equal deleted inserted replaced
1129:6b5c92b6205c 1130:8f14767661fa
60 exit(0); 60 exit(0);
61 return context; 61 return context;
62 } 62 }
63 63
64 const memmap_chunk z80_map[] = { 64 const memmap_chunk z80_map[] = {
65 { 0x0000, 0x10000, 0xFFFF, 0, MMAP_READ | MMAP_WRITE | MMAP_CODE, ram, NULL, NULL, NULL, NULL}, 65 { 0x0000, 0x10000, 0xFFFF, 0, 0, MMAP_READ | MMAP_WRITE | MMAP_CODE, ram, NULL, NULL, NULL, NULL},
66 }; 66 };
67 67
68 const memmap_chunk io_map[] = { 68 const memmap_chunk io_map[] = {
69 { 0x0, 0x1, 0xFFFF, 0, 0, NULL, NULL, NULL, console_read, console_write}, 69 { 0x0, 0x1, 0xFFFF, 0, 0, 0, NULL, NULL, NULL, console_read, console_write},
70 { 0x1, 0x2, 0xFFFF, 0, 0, NULL, NULL, NULL, console_status_read, console_flush_write}, 70 { 0x1, 0x2, 0xFFFF, 0, 0, 0, NULL, NULL, NULL, console_status_read, console_flush_write},
71 { 0x2, 0x3, 0xFFFF, 0, 0, NULL, NULL, NULL, NULL, exit_write}, 71 { 0x2, 0x3, 0xFFFF, 0, 0, 0, NULL, NULL, NULL, NULL, exit_write},
72 }; 72 };
73 73
74 int main(int argc, char **argv) 74 int main(int argc, char **argv)
75 { 75 {
76 FILE *f = fopen("fake_cpm.bin", "rb"); 76 FILE *f = fopen("fake_cpm.bin", "rb");
98 ram[5] = 0xC3; 98 ram[5] = 0xC3;
99 ram[6] = OS_START & 0xFF; 99 ram[6] = OS_START & 0xFF;
100 ram[7] = OS_START >> 8; 100 ram[7] = OS_START >> 8;
101 101
102 z80_options opts; 102 z80_options opts;
103 z80_context context; 103 z80_context *context;
104 init_z80_opts(&opts, z80_map, 1, io_map, 3, 1, 0xFF); 104 init_z80_opts(&opts, z80_map, 1, io_map, 3, 1, 0xFF);
105 init_z80_context(&context, &opts); 105 context = init_z80_context(&opts);
106 for(;;) 106 for(;;)
107 { 107 {
108 z80_run(&context, 1000000); 108 z80_run(context, 1000000);
109 context.current_cycle = 0; 109 context->current_cycle = 0;
110 } 110 }
111 return 0; 111 return 0;
112 } 112 }