diff options
Diffstat (limited to 'emu/7seg.h')
-rw-r--r-- | emu/7seg.h | 38 |
1 files changed, 34 insertions, 4 deletions
@@ -1,12 +1,42 @@ -#ifndef 7_SEG_H -#define 7_SEG_H +#ifndef SEG7_H +#define SEG7_H #ifdef WITH_GUI #include <SDL.h> #endif -typedef struct 7seg_t +#include <stdint.h> +#include <stdbool.h> + +// VIA connected on PORTA to 3 wires leading to the 3 coupled 74HC595 +// shift register which enable the ROM address lines to read the LED +// segment data (cells 0-15 contain the encoded 7 segments of 16 hexdigits) +// +// PORTA connected as follows: +// xxxxx111 +// +--- SER +// +---- RCLK +// +----- SRCLK +enum { + PORTA = 0x6001, + DDRA = 0x6003, + + SER = 0x01, + RCLK = 0x02, + SRCLK = 0x04 +}; + +typedef struct seg7_t { -} 7seg_t; + uint8_t ddr; + uint16_t shift; + uint16_t latch; + + bool debug; +} seg7_t; + +void seg7_init( seg7_t *seg ); +uint8_t seg7_read( seg7_t *seg, uint16_t addr ); +void seg7_write( seg7_t *seg, uint16_t addr, uint8_t data ); #endif |