aboutsummaryrefslogtreecommitdiff
path: root/source/sdd1emu.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/sdd1emu.c')
-rw-r--r--source/sdd1emu.c112
1 files changed, 0 insertions, 112 deletions
diff --git a/source/sdd1emu.c b/source/sdd1emu.c
index cccbf27..4fbfac5 100644
--- a/source/sdd1emu.c
+++ b/source/sdd1emu.c
@@ -343,115 +343,3 @@ void SDD1_decompress(uint8_t* out, uint8_t* in, int len)
break;
}
}
-
-static uint8_t cur_plane;
-static uint8_t num_bits;
-static uint8_t next_byte;
-
-void SDD1_init(uint8_t* in)
-{
- bitplane_type = in[0] >> 6;
-
- switch (in[0] & 0x30)
- {
- case 0x00:
- high_context_bits = 0x01c0;
- low_context_bits = 0x0001;
- break;
- case 0x10:
- high_context_bits = 0x0180;
- low_context_bits = 0x0001;
- break;
- case 0x20:
- high_context_bits = 0x00c0;
- low_context_bits = 0x0001;
- break;
- case 0x30:
- high_context_bits = 0x0180;
- low_context_bits = 0x0003;
- break;
- }
-
- in_stream = (in[0] << 11) | (in[1] << 3);
- valid_bits = 5;
- in_buf = in + 2;
- memset(bit_ctr, 0, sizeof(bit_ctr));
- memset(context_states, 0, sizeof(context_states));
- memset(context_MPS, 0, sizeof(context_MPS));
- memset(prev_bits, 0, sizeof(prev_bits));
-
- cur_plane = 0;
- num_bits = 0;
-}
-
-uint8_t SDD1_get_byte(void)
-{
- uint8_t bit;
- uint8_t byte = 0;
-
- switch (bitplane_type)
- {
- case 0:
- num_bits += 16;
- if (num_bits & 16)
- {
- next_byte = 0;
- for (bit = 0x80; bit; bit >>= 1)
- {
- if (GetBit(0)) byte |= bit;
- if (GetBit(1)) next_byte |= bit;
- }
- return byte;
- }
- else
- return next_byte;
-
- case 1:
- num_bits += 16;
- if (num_bits & 16)
- {
- next_byte = 0;
- for (bit = 0x80; bit; bit >>= 1)
- {
- if (GetBit(cur_plane)) byte |= bit;
- if (GetBit(cur_plane + 1)) next_byte |= bit;
- }
- return byte;
- }
- else
- {
- if (!num_bits) cur_plane = (cur_plane + 2) & 7;
- return next_byte;
- }
-
- case 2:
- num_bits += 16;
- if (num_bits & 16)
- {
- next_byte = 0;
- for (bit = 0x80; bit; bit >>= 1)
- {
- if (GetBit(cur_plane)) byte |= bit;
- if (GetBit(cur_plane + 1)) next_byte |= bit;
- }
- return byte;
- }
- else
- {
- if (!num_bits) cur_plane ^= 2;
- return next_byte;
- }
-
- case 3:
- for (cur_plane = 0, bit = 1; bit; bit <<= 1, cur_plane++)
- {
- if (GetBit(cur_plane)) byte |= bit;
- }
- return byte;
-
- default:
- /* should never happen */
- return 0;
- }
-}
-