From cd6982e5da1f5facdc1e0154b3a27c01e8b076c9 Mon Sep 17 00:00:00 2001 From: mrb0nk500 Date: Wed, 27 Jan 2021 13:42:57 -0500 Subject: - Fixed some bugs in the emulator. - Started work on implementing the Super VIA emulation. - Added support for disabling disassembly per instruction, when in debug mode. - Did some more work on rewriting the SuB Suite to work with the new calling convention. - Rewrote the symbol handling code in the emulator's assembler, to make it both simpler, and to add support for arbitrarily deep symbol scopes. - Added support for arbitrarily deep local symbol scopes. For example, to declare a symbol of depth 2, you add two '@' characters to the start of the symbol name. In other words, the number of '@' characters before the symbol name is what determines the scope of that symbol. And to use a symbol thats outside the current scope, you would use the same syntax as using a struct member, so you would do `global.local`. --- supervia.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 supervia.c (limited to 'supervia.c') diff --git a/supervia.c b/supervia.c new file mode 100644 index 0000000..23e44e9 --- /dev/null +++ b/supervia.c @@ -0,0 +1,18 @@ +void init_supervia(struct supervia *sv) { + memset(sv, 0, sizeof(struct supervia)); +} + +/* Shifts out one bit from each output byte of the shift register into + * the serial output lines of those output bytes. + */ +void shift_out8(struct supervia *sv, int id) { + uint8_t bitpos = 7-sv->sr[id].ocount; + for (int i = 0; i < 8; i++) { + if (sv->sr[id].dir & (1 << i)) { + uint8_t bit = (sv->sr[id].data.u8[i] >> bitpos) & 1; + sv->sr[id].bits |= (bit << i); + } + } + sv->sr[id].ocount++; + sv->sr[id].ocount %= 8; +} -- cgit v1.2.3-13-gbd6f