Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ClusterM/famicom-dumper.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com>2020-12-01 19:43:26 +0300
committerAlexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com>2020-12-01 19:48:13 +0300
commit43d5d6c64243331a2fb5a36532c941716e50556c (patch)
tree8b43737e7cdd97b75f7abf026717bf2567950aba /dumper.h
parent4e4ca3f1f4d976f90084e128209000bd87d036a0 (diff)
FDS dumping/writing
Diffstat (limited to 'dumper.h')
-rw-r--r--dumper.h45
1 files changed, 43 insertions, 2 deletions
diff --git a/dumper.h b/dumper.h
index 994eb87..0beb761 100644
--- a/dumper.h
+++ b/dumper.h
@@ -11,7 +11,48 @@
#define IRQ_FIRED (!(PINF & (1<<6)))
-#define FDS_PAUSE_BEFORE_FIRST_BLOCK 300
-#define FDS_PAUSE_BETWEEN_BLOCKS 5
+#define FDS_IRQ_CONTROL 0x4022
+#define FDS_MASTER_IO 0x4023
+#define FDS_DATA_WRITE 0x4024
+#define FDS_CONTROL 0x4025
+#define FDS_EXT_WRITE 0x4026
+#define FDS_DISK_STATUS 0x4030
+#define FDS_DATA_READ 0x4031
+#define FDS_DRIVE_STATUS 0x4032
+#define FDS_EXT_READ 0x4033
+
+#define FDS_CONTROL_MOTOR_ON 0b00000001
+#define FDS_CONTROL_RESET 0b00000010
+#define FDS_CONTROL_READ 0b00100100
+#define FDS_CONTROL_WRITE 0b00100000
+#define FDS_CONTROL_CRC 0b00010000
+#define FDS_CONTROL_TRANSFER_ON 0b01000000
+#define FDS_CONTROL_IRQ_ON 0b10000000
+
+#define FDS_READ_GAP_BEFORE_FIRST_BLOCK 486974
+#define FDS_WRITE_GAP_BEFORE_FIRST_BLOCK 580000
+#define FDS_READ_GAP_BETWEEN_BLOCKS 9026
+#define FDS_WRITE_GAP_BETWEEN_BLOCKS 17917
+#define FDS_WRITE_CRC_DELAY 897
+
+#define LED_RED_ON PORTB |= (1<<7)
+#define LED_RED_OFF PORTB &= ~(1<<7)
+#define LED_GREEN_ON PORTB |= (1<<6)
+#define LED_GREEN_OFF PORTB &= ~(1<<6)
+
+#define ROMSEL_HI PORTF |= (1<<1)
+#define ROMSEL_LOW PORTF &= ~(1<<1)
+#define PHI2_HI PORTF |= (1<<0)
+#define PHI2_LOW PORTF &= ~(1<<0)
+#define MODE_READ { PORTD = 0xFF; DDRD = 0; }
+#define MODE_WRITE DDRD = 0xFF
+#define PRG_READ PORTF |= (1<<7)
+#define PRG_WRITE PORTF &= ~(1<<7)
+#define CHR_READ_HI PORTF |= (1<<5)
+#define CHR_READ_LOW PORTF &= ~(1<<5)
+#define CHR_WRITE_HI PORTF |= (1<<2)
+#define CHR_WRITE_LOW PORTF &= ~(1<<2)
+
+#define DELAY_CLOCK(t) {if (t < 30000) _delay_us(t * 1000000 / 1789773); else _delay_ms(t * 1000 / 1789773);}
#endif