### WHDLoadCD32

WHDLoadCD32 is a special WHDLoad version to be used on the CD³². It has been optimized for this hardware and will therefore only run on a plain not expanded CD³². It will not run on SX-32 or any other machine.

These are the differences to the normal WHDLoad:

- it does not require nor use a WHDLoad keyfile, therefore CD's with WHDLoadCD32 on it can be distributed freely
- only the 68020 CPU is supported, this means also no MMU support
- fast memory is not supported
- there is absolut no writing support, neither savegames, highscores nor coredumps (a CD is usually read-only)
- many options have been removed which are not useful on a CD³² to make the executable smaller and save memory, check Usage and Options for which options are affected
- the following resload functions are not implemented and using them will terminate WHDLoad with a return value TDREASON_ILLEGALARGS:
  - resload_DiskLoadDev
  - resload_ProtectRead
  - resload_ProtectReadWrite
  - resload_ProtectWrite
  - resload_ProtectRemove
  - resload_ProtectSMC
- the following resload functions are dummies, they will do nothing but return always success:
  - resload_SaveFile
  - resload_SaveFileOffset
  - resload_DeleteFile
- there is no freezer/monitor support build in
- there is no internal check for sufficient stackspace as in the normal WHDLoad, to my tests the default of 4096 bytes should enough for WHDLoadCD32

### Hints for using WHDLoad on a CD³²

The main problem on the CD³² is the limited main memory. There are only 2 MB of chip memory. Therefore the aim must be to get as much free memory as possible for WHDLoad and especially for the PreLoad operation. Make sure that no other programs are running while starting an installed program using WHDLoadCD32.

- If install gives the choice between diskimages and files use files. Because many smaller files can be better cached than less big files.
- If a install provides the ability to compress files using ProPack/FImp use it and compress all files (RNC1 gives best compression ratio). Compressed files need less memory for PreLoad and cause nearly no delay in loading speed.
- Use AllocMemReverse before running WHDLoadCD32 (or an adequate replacement). AllocMemReverse is a small program included in the dev-package of WHDLoad. It patches the exec function AllocMem to always use the memory attribute MEM_REVERSE for the allocations. This will cause that memory is allocated from the top of the free memory to the bottom and not from bottom to top as normal. And this will hold the lower memory regions free. The background is, that WHDLoad needs memory starting at address 0, the start of chipmem. All memory which is used in this lower region needs to be swapped out. For this additional memory is needed to hold the saved ram. The more memory is used in the low memory regions the less is available for the installed program and for preloading data files.
- Always use the Data option. PreLoad does not know which files will be loaded by the installed program, therefore it loads all files it finds. To avoid that unnecessary files are loaded create a directory which only contains the required files. Delete all obsolete stuff like #?.info, #?.Slave, ReadMe, Manual, .... Then call WHDLoad with Slave and Data directory as argument, e.g. `WHDLoadCD32 :Slaves/XYZ.Slave Data=:Data/XYZ PreLoad`. There is no need to change the current directory to anywhere.
- Don't use XPK compressed data files. XPK decompression needs much memory because XPK libraries must be in memory, decompression itself needs memory and decompression will cause memory fragmentation.