These are the patched sources for the 1541 Ultimate firmware
used in the CREST-demo 'bluREU' released at Breakpoint 2010.
http://noname.c64.org/csdb/release/?id=90344


= Features =

The patch adds this feature to the firmware:
- Selection of REU files in the file browser, and loading REU files
  into the emulated REU by pressing RETURN or F3.
  Note: Loading of a 16 MB file into the REU takes about 47 seconds.
  During these 47 seconds there is no visual feedback on screen.



= Compiling =

In order to build the software, you need to do the following:

Install Cygwin, or run under Linux. Make sure you have:
* GNU make in order to run the makefiles.
* GCC compiler, in order to build the conversion tools.
* Install CC65 (http://www.cc65.org), and make sure you have the  
  required environment variables and path set.
  !==> You need CC65 version V2.11.0 <==!
* Go to the sub-directory 1541u/application/ultimate/make/
  and type 'make'.
* If everything works fine, you'll find the compiled firmware
  named 'appl.bin' in 1541u/application/ultimate/make/result/

Note: If you use a newer version of CC65, e.g. V2.13.1, you will get
compile errors like this:
  Memory area overflow in 'BANK1', segment 'FILESYS'
Use CC65 version V2.11.0 and everything should work fine.



= Baseline for this patch =

Baseline for this patched version is the source revision 15 from the
repository from http://svn.xp-dev.com/svn/gideonz_1541Ultimate/
i.e. firmware version 1.7 beta.



= Technical details of this patch =

There are 2 main sub-directories in this archive:

SVN-Export/:
 Original baseline sources, unaltered.
SVN-Export-Patched/:
 Patched sources.

I suggest you use some diff-tool (that is capable of comparing whole directory 
trees recursively) to compare the original baseline to the patched version
in order to get an overview of the patch.

There are 17 files patched. Some contain code for the actual new feature, while 
other files are simply patched to save some bytes we need to fit the new code 
into the tight memory limits.

1541u/application/ultimate/inc/version.h:
 Altered version string.

1541u/filesystem/fat/inc/dir.h:
 Added constant 'TYPE_REU'.
 Removed unused function 'dump_entryname' to save some bytes.

1541u/filesystem/fat/inc/ff.h:
 Removed unused function 'f_chmod' to save some bytes.
 
1541u/filesystem/fat/src/dir.c:
 Added file extension 'REU'.
 Bugfix needed for clean compile (C pointer syntax).
 Removed calls to 'printf' to save some bytes.
 Removed unused function 'dump_entryname' to save some bytes.

1541u/filesystem/fat/src/dir_bankgate.asm:
 Removed unused function 'dump_entryname' to save some bytes.

1541u/filesystem/fat/src/ff.c:
 Removed unused function 'f_chmod' to save some bytes.
 Removed calls to 'printf' to save some bytes.

1541u/filesystem/fat/src/ff_bankgate.asm:
 Removed unused function 'f_chmod' to save some bytes.

1541u/filetype/d64/src/d64.c:
 Removed calls to 'printf' to save some bytes - but kept
 seemingly important call to 'find_trackstart()'.

1541u/filetype/d64/src/t64.c:
 Removed calls to 'printf' to save some bytes.

1541u/io/inc/sd.h:
 Removed unused function 'sd_Resp8bError' to save some bytes.

1541u/io/src/diskio.c:
 Removed calls to 'printf' to save some bytes.

1541u/io/src/screen.asm:
 Optimized scroller code because I can and to save some bytes.

1541u/io/src/sd.c:
 Altered define 'DBG' to save some bytes.
 Removed calls to 'printf' to save some bytes.
 Removed unused function 'sd_Resp8bError' to save some bytes.

1541u/lib/libsrc/common/_scanf.c:
 Added some ';' after labels to get rid of compiler warnings.

1541u/storage/ram/inc/mapper.h:
 Added constants MAP_SDRAM_REU and MAP_TOP_END.

1541u/ui/inc/c64_menu.h:
 Added new function 'reu_loadfile'.

1541u/ui/src/c64_menu.c:
 Altered scrolltext.
 Added handling for REU files in function 'handle_select'.
 Added new function 'reu_loadfile'.



= General information on the 1541 ultimate =

Visit http://www.1541ultimate.net/



= Personal notes =

Hi, S.E.S./CREST writing here. This patch was done by me.

When DeeKay approached me and asked if I could patch the 1541u firmware to add 
support for REU files, I was sceptical if I could do that - since I haven't got 
a 1541u. In fact, I've never even seen one. Nevertheless, I decided to have a 
look at the source. The source is very well structured and commented, so the 
patch was a walk in the park. The hardest part was installing the build 
environment and finding out that the sources compile only when you don't use the 
latest CC65 version but a previous one.

So, I patched the source, compiled, but couldn't test it because I haven't got a 
1541u. So I sent the resulting firmware file 'appl.bin' to DeeKay so he could 
test it on his 1541u. To our surprise and delight, it worked right away.

This patched firmware was crucial to our demo 'bluREU'/CREST released at 
Breakpoint 2010. (It won the 1st prize in the Wild Compo!) Without this firmware 
patch, we would have had to load 16 MB of data into the REU from lots of D64 
images - literally 100 disks. That would have been very cumbersome and would 
have taken ages. So, I'm very proud of my contribution to 'bluREU'/CREST.
(I also coded the intro, by the way.)

If you have any questions, feel free to contact me: simon.stelling@gmx.de
Have fun!
S.E.S./CREST, 9th April 2010

