32 static Uint16 segment_bases[64];
33 static Uint8 segment_limits[64];
34 static Uint8 segment_attributes[64];
35 static Uint8 mode,sar,dsc;
44 for (
int a = 0; a < 64; a++) {
46 segment_limits[a] = 0;
47 segment_attributes[a] = 0;
58 static void write_descriptor (
int dsc_now,
Uint8 data )
60 switch (dsc_now & 3) {
62 segment_bases[sar] = (
data << 8) | (segment_bases[sar] & 0xFF);
63 DEBUGPRINT(
"Z8010: segment #$%02X base high is set to $%02X, value is now = %04X" NL, sar,
data, segment_bases[sar]);
66 segment_bases[sar] = (segment_bases[sar] & 0xFF00) |
data;
67 DEBUGPRINT(
"Z8010: segment #$%02X base low is set to $%02X, value is now = %04X" NL, sar,
data, segment_bases[sar]);
70 segment_limits[sar] =
data;
74 segment_attributes[sar] =
data;
81 static Uint8 read_descriptor (
int dsc_now )
83 switch (dsc_now & 3) {
84 case 0:
return segment_bases [sar] >> 8;
85 case 1:
return segment_bases [sar] & 0xFF;
86 case 2:
return segment_limits [sar];
87 case 3:
return segment_attributes[sar];
113 write_descriptor(dsc & 1,
data);
117 write_descriptor(2,
data);
120 write_descriptor(3,
data);
123 write_descriptor(dsc,
data);
126 write_descriptor(dsc & 1,
data);
127 sar = (sar + 1) & 63;
130 write_descriptor(2,
data);
131 sar = (sar + 1) & 63;
134 write_descriptor(3,
data);
135 sar = (sar + 1) & 63;
138 write_descriptor(dsc,
data);
141 sar = (sar + 1) & 63;
159 return ((segment_bases[segment & 63] << 8) + offset) & 0xFFFFFF;