analog/v2-analog-rev1/fs/businterface.c
David Kuder 0835003caa Build 0159
Progress on PCPI mode bug fixes. PCPI mode is now working again, but the config interface is still broken enough to prevent the use of the config utility while in this mode.. Sending the FORMAT command from the monitor rom returns the card to defaults.
Replace n with the slot number the card is installed in:

]CALL -151
*CnF0:46 4F 52 4D 41 54 00 00

Correction of mousetext / inverse / flashing handling on IIe
see https://github.com/V2RetroComputing/analog/issues/3

Monochrome mode & color palettes are now implemented.
$C0n1: Monochrome mode & palette
  $80: B&W
  $90: Inverse
  $A0: Amber
  $B0: Inverse Amber
  $C0: Green
  $D0: Inverse Green
  $E0: Commodore 64 Theme
  $F0: Use IIgs palette
$C0n2: Mirror of IIgs TBCOLOR register
$C0n3: Mirror of IIgs BORDER register
2023-03-02 11:09:48 -05:00

67 lines
2.2 KiB
C

#include <string.h>
#include <hardware/pio.h>
#include "common/config.h"
#include "common/buffers.h"
#include "abus.pio.h"
#include "fs/businterface.h"
#include "fs/fs.h"
volatile uint8_t fs_slot = 0;
void __time_critical_func(fs_businterface)(uint32_t address, uint32_t value) {
// Shadow parts of the Apple's memory by observing the bus write cycles
if((value & (1u << CONFIG_PIN_APPLEBUS_RW-CONFIG_PIN_APPLEBUS_DATA_BASE)) == 0) {
if(address < 0x200) {
if((soft_switches & (SOFTSW_80STORE | SOFTSW_AUXZP)) == (SOFTSW_80STORE | SOFTSW_AUXZP)) {
private_memory[address] = value & 0xff;
} else {
apple_memory[address] = value & 0xff;
}
} else if((address < 0xC000) || (address >= 0xD000)) {
if((soft_switches & (SOFTSW_80STORE | SOFTSW_AUX_WRITE)) == (SOFTSW_80STORE | SOFTSW_AUX_WRITE)) {
private_memory[address] = value & 0xff;
} else {
apple_memory[address] = value & 0xff;
}
}
}
if(CARD_SELECT) {
if(CARD_DEVSEL) {
if((value & (1u << CONFIG_PIN_APPLEBUS_RW-CONFIG_PIN_APPLEBUS_DATA_BASE)) == 0) {
apple_memory[address] = value;
}
}
if(CARD_IOSTROBE) {
apple_memory[address] = value;
}
}
// Shadow the soft-switches by observing all read & write bus cycles
if((internal_flags & IFLAGS_IIE_REGS) && ((value & (1u << CONFIG_PIN_APPLEBUS_RW-CONFIG_PIN_APPLEBUS_DATA_BASE)) == 0)) {
if((address & 0xff80) == 0xc000) {
switch(address & 0x7f) {
case 0x00:
soft_switches &= ~SOFTSW_80STORE;
break;
case 0x01:
soft_switches |= SOFTSW_80STORE;
break;
case 0x04:
soft_switches &= ~SOFTSW_AUX_WRITE;
break;
case 0x05:
soft_switches |= SOFTSW_AUX_WRITE;
break;
case 0x08:
soft_switches &= ~SOFTSW_AUXZP;
break;
case 0x09:
soft_switches |= SOFTSW_AUXZP;
break;
}
}
}
}