kbr-net / sdrive-max

Arduino based Atari 8-bit Floppy Emulator with Touchscreen
http://www.kbrnet.de/projekte/sdrive-max/index.html
GNU General Public License v3.0
92 stars 23 forks source link

Change to remove need for diode on TxD #11

Closed darylrichards closed 5 years ago

darylrichards commented 5 years ago

diff --git a/SDrive.c b/SDrive.c index 0590906..7b28795 100644 --- a/SDrive.c +++ b/SDrive.c @@ -374,6 +374,9 @@ int main(void) CMD_PORTREG |= 1 << CMD_PIN; // with pullup CMD_DDR &= ~(1 << CMD_PIN); // to input

kbr-net commented 5 years ago

I'm not sure, if this makes sense. I want to be compatible to the original sdrive from Bob & Raster, and there was also the diode present. Otherways we are near the end of flash, so i won't waste any bytes not really needed.

darylrichards commented 5 years ago

This only adds 6 bytes to the code total. Having the diode in place does no harm with this change, and I feel that since anyone new has to add the diode and this removes that requirement, it's only a net benefit.

Also, I've already remove hundreds of bytes of unneeded code from the tree that I'm working on..

kbr-net commented 5 years ago

Interesting, i know there could be something optimized, it's mostly the original code from Bob & Raster, but hundred of bytes? Where have you found them?

kbr-net commented 5 years ago

The diode is only the half rate, the main issue is the 1K resistor in the line, which is between the USB2Serial converter. So i think it is not really wholesome to activate a second pull-up. The diode has the side effect to eliminate the pull-up.

darylrichards commented 5 years ago

The optimization comes from the fact that avr-gcc isn't always great at optimizing things. Restructuring code helps it a lot... As for the pull-up, it hasn't made a difference for me either way, but since I also moved the Command signal to INT0 (PORTD bit 2), it was easier for me to turn the pull ups all on. And the reason for moving Command is again, to save a couple bytes and a slight savings in interrupt latency..

kbr-net commented 5 years ago

But this Pin is also used for display data, you should always turn of interrupts on display activity at least. And when reading from display, this may conflict.

kbr-net commented 5 years ago

I close this issue now, because this is not the solution, and there are an other/better hardware solution based on 7407 now.