forked from EtchedPixels/FUZIX
-
Notifications
You must be signed in to change notification settings - Fork 1
/
discard.c
81 lines (74 loc) · 1.68 KB
/
discard.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#include <kernel.h>
#include <timer.h>
#include <kdata.h>
#include <printf.h>
#include <device.h>
#include <devtty.h>
#include <carts.h>
#include <blkdev.h>
static const char *sysname[] = {"Dragon", "COCO", "COCO3", "Unknown"};
#if 0
struct cart_rom_id {
uint16_t hash;
uint8_t id;
const char *name;
};
static const char empty[] = "(empty)";
struct cart_rom_id carts[] = {
{ 0x72B0, CART_DRAGONDOS, "DragonDOS" },
{ 0x9063, CART_DELTADOS, "DeltaDOS" },
{ 0xB400, 0, empty },
{ 0xC248, CART_RSDOS, "RS-DOS" },
{ 0xE1BA, CART_ORCH90, "Orchestra-90 CC" },
{ 0x0000, 0, "No ROM" }
};
static struct cart_rom_id *cart_lookup(uint16_t hash)
{
struct cart_rom_id *cart = carts;
do {
if (cart->hash == hash)
return cart;
} while(cart++->hash);
return NULL;
}
#endif
void map_init(void)
{
uint8_t i;
#if 0
uint8_t bslot = 0;
uint16_t hash;
struct cart_rom_id *rom;
#endif
kprintf("%s system.\n", sysname[system_id]);
#if 0
/* We would have to do the mpi management in asm and we really
don't have enough memory to care about this ! */
if (mpi_present()) {
kputs("MPI cartridge detected.\n");
cartslots = 4;
bootslot = mpi_set_slot(0);
bslot = bootslot & 3;
}
for (i = 0; i < cartslots; i++) {
mpi_set_slot((i << 4) | i);
hash = cart_hash();
rom = cart_lookup(hash);
if (rom) {
kprintf("%d: %s %c\n",
i, rom->name,
i == bootslot ? '*':' ');
carttype[i] = rom->id;
}
else
kprintf("%d: Unknown(%x) %c\n",
i, hash,
i == bslot ? '*':' ');
}
mpi_set_slot(bootslot);
#endif
/* We put swap on the start of slice 0, but with the first 64K free
so we can keep the OS image linearly there */
for (i = 0; i < MAX_SWAPS; i++)
swapmap_init(i + 128);
}