#include "pia.h" namespace pia { uint8_t ram[128]; uint8_t INTIM; uint8_t TIMINT; void reset() { } void tick() { } uint8_t read(uint16_t address) { if (address & 0x200) { if ( (address & 0x04) ) { // Timer functions if (address & 0x01) { uint8_t flags = TIMINT; TIMINT &= ~0x80; // resetejem el flag return flags; } else { return INTIM; } } else { // I/O Ports switch( address & 0x03) { case 0x00: // [TODO] SWCHA case 0x01: // [TODO] DDRA case 0x02: // [TODO] SWCHB case 0x03: // [TODO] DDRB } } } else { return ram[address & 0x7f]; } } void write(uint16_t address, uint8_t value) { if (address & 0x200) { if ( (address & 0x04) ) { if ( (address & 0x10) ) { // Timer functions switch( address & 0x03) { case 0x00: // [TODO] TIM1T case 0x01: // [TODO] TIM8T case 0x02: // [TODO] TIM64T case 0x03: // [TODO] TIM1024T } } else { // Funcionalitat relacionada amb les interrupcions. Ignorar per a la Atari 2600 } } else { // I/O Ports switch( address & 0x03) { case 0x00: // [TODO] SWCHA case 0x01: // [TODO] DDRA case 0x02: // [TODO] SWCHB case 0x03: // [TODO] DDRB } } } else { ram[address & 0x7f] = value; } } }