RAMSTART =? 0x0000;
RAMEND   =? 0x8000;
ROMSTART =? 0x8000;
ROMEND   =? 0xFFFE;
STACKLEN =? 0x100;

MEMORY
{
  ram : org = RAMSTART, len = RAMEND - RAMSTART
  rom : org = ROMSTART, len = ROMEND - ROMSTART
  res : org = 0xFFFE, len = 2
}

SECTIONS {
	.text: { *(.text) } > rom
	.dtors : { *(.dtors) } > rom
	.ctors : { *(.ctors) } > rom
	.rodata: { *(.rodata) } > rom
	.dpage: { *(.dpage) } > ram
	.data: { *(.data) } > ram AT> rom
	.bss (NOLOAD) : { *(.bss) } > ram
	.res: { BYTE(0x80);BYTE(0); } > res

	__BS = ADDR(.bss);
	__BL = SIZEOF(.bss);
	__DS = ADDR(.data);
	__DC = LOADADDR(.data);
	__DL = SIZEOF(.data);

        __heap = (ADDR(.bss) + SIZEOF(.bss) + 7) / 8 * 8;
        __heapend = __STACK-STACKLEN;


	__STACK = 0x8000;

}
