Larswad / uno2iec

A commodore (CBM) 1541 emulator on the Arduino Uno, using any desktop PC (or raspberry PI with raspbian) as a media host.
http://larswad.github.io/uno2iec/
135 stars 37 forks source link

fixing typing bug on saveFile #9

Closed biappi closed 8 years ago

biappi commented 9 years ago

i had troubles sending files greater than 255 bytes from the commodore64 to the arduino. the problem was caused by an always true comparison because sizeof(serCmdIOBuf) is MAX_BYTES_PER_REQUEST, aka 256, but bytesInBuffer can hold only 255, so the cycle guard will collapse into an always-true comparison.

artificially limiting the "packet" size to 0xf0 worked for my toy example. of course this is only a workaround, but it can be a starting point for a better patch.

Larswad commented 9 years ago

Many many thanks biappi for these contributions. They are all very valuable.

I will see if I get the time to fix this bug in the "right" way. So right now I won't merge but use your patch as a problem description. I think when I was adding the saving feature that I had trouble with files and I never had time to test more thoroughly, not really remembering but it may very well have been this size check that was wrong all along. Thanks!