SYMBOLS {
  # the maximum size of a single line (also the size of the line buffer)
  __LINESIZE__:  type = export, value = 40;
}

MEMORY {

  INIT:
    start = $11ff
    size = $6e01
    fill = no;

  RAM:
    start = $2000
    size = $8000;

  APPRAM:
    start = $2000
    size  = $6000;

  HIRAM:
    start = $a000
    size  = $2000;

  MACRO:
    start = $a000
    size  = $2000;

  LINKER:
    start = $a000
    size  = $2000;

  LABELS:
    start = $a000
    size  = $2000;

  LABELNAMES:
    start = $2000
    size  = $6000;

  FTXT:
    start = $b000
    size  = $1000;

  UDGEDIT:
    start = $a000
    size  = $2000;

  CONSOLE:
    start = $a000
    size  = $2000;

  COPYBUFF:
    start = $a000
    size  = $2000;

  #VSCREEN:
    #start = $2000
    #size  = $2d00;

  #SAVESCR:
    #start = $4d00
    #size  = $257f;

  SOURCE:
    start = $2000
    size  = $6000;

  DEBUGINFO:
    start = $2000
    size  = $6000;

  DEBUGINFO_CODE:
    start = $a000
    size  = $2000;

  SAVESCR:
    start = $2000
    size  = $5f00;

  SHARERAM:
    start = $33c
    size  = $c4;

  LINEBUFFER:
    start = $400
    size = __LINESIZE__*3;	# 1 line + backup + assembly buffer

  SHARERAM2:
    start = $478
    size = $b88;
}

SEGMENTS {
	# setup
	SETUP:  load = INIT, define = yes;
	DATA:   load = INIT, run = HIRAM, type = rw, define = yes;
	IRQ:    load = INIT, run = SHARERAM, type = ro, define = yes;
	SHAREBSS: load = SHARERAM, type = bss;
	LINEBUFF: load = LINEBUFFER, type = bss;

	# shared bank code
	BANKCODE: load = INIT, run = SHARERAM, define = yes;
	BANKCODE2: load = INIT, run = SHARERAM2, define = yes;

	# bank $01
	DEBUGGER:  load = RAM, run = APPRAM, type=rw, define = yes;
	CODE:   load = RAM, run = APPRAM, type = ro, define = yes;
	RODATA: load = INIT, run = HIRAM, type = ro, define = yes;

	# BSS
	BSS:      load = HIRAM, type = bss, define = yes;

	SOURCE: load = SOURCE, type = bss;

	# Bank $02
	DEBUGINFO: load = DEBUGINFO, type = bss;
	DEBUGINFO_CODE: load = INIT, run = DEBUGINFO_CODE, type = rw, define = yes;

	# Bank $04
	UDGEDIT: load = INIT, run = UDGEDIT, type = ro, define = yes;

	# Bank $05
	COPYBUFF: load = INIT, run = COPYBUFF, type = ro, define = yes;
	COPYBUFF_BSS: load = COPYBUFF, type = bss, define = yes;

	# Bank $0C
	# SAVESCR resides above the screen column backups (at $a000)
	SAVESCR: load = INIT, run = SAVESCR, type = ro, define = yes;
	SAVESCR_BSS: load = SAVESCR, type = bss;

	# bank $0e
	FASTTEXT: load = INIT, run = FTXT, type = ro, define = yes;
	FASTTEXT_BSS: load = FTXT, type = bss;
	MACROCODE: load = INIT, run = MACRO, type = ro, define = yes;
	MACROBSS: load = MACRO, type = bss;

	# bank $06
	LINKER: load = INIT, run = LINKER, type = ro, define = yes;

	# bank $07
	CONSOLE: load = INIT, run = CONSOLE, type = ro, define = yes;
	CONSOLE_BSS: load = CONSOLE, type = bss;

	# bank $0d
	LABEL_BSS: load = LABELS, type = bss;
	LABELS: load = INIT, run = LABELS, type = ro, define = yes;
	LABELNAMES: load = LABELNAMES, type = bss;
}
