The RAM Size code is stored at address FFD8h:
00h....No RAM 01h....16K bit 03h....64K Bit 05h....256K Bit 06h....512K Bit 07h....1M Bit