diff --git a/cMIPS/bin/assemble.sh b/cMIPS/bin/assemble.sh
index d86876f26826f7928ffc6dbcf68e91a513beafd0..c657f6efd42d13d5bca9908585ceaa2d8e305b96 100755
--- a/cMIPS/bin/assemble.sh
+++ b/cMIPS/bin/assemble.sh
@@ -112,7 +112,7 @@ bin=prog.bin
 dat=data.bin
 
 (mips-as -O${level} -EL -mips32r2  -I "${include}" -o $obj $asm || exit 1) &&\
-  mips-ld -EL -e _start ${mem_map} -I "${include}" --script $c_ld -o $elf $obj &&\
+  mips-ld -EL ${mem_map} -I "${include}" --script $c_ld -o $elf $obj &&\
   mips-objcopy -S -j .text -O binary $elf $bin &&\
   mips-objcopy -S -j .data -j .rodata -O binary $elf $dat &&\
   chmod a-x $bin $dat &&\
diff --git a/cMIPS/bin/compile.sh b/cMIPS/bin/compile.sh
index 9032d6900ef6eb1ae0f7cf3c20ab4ed0e979a36c..89ef9cfd7c8de23553223d4cd25ef0971d88723a 100755
--- a/cMIPS/bin/compile.sh
+++ b/cMIPS/bin/compile.sh
@@ -108,7 +108,6 @@ c_s="${include}"/cMIPS.s
 c_io="${include}"/cMIPSio
 # c_start="${include}"/start ## see below for synthesis version
 c_hndlrs="${include}"/handlers
-c_stop="${include}"/stop
 
 pkg_vhd="${srcVHDL}"/packageMemory.vhd
 
@@ -141,10 +140,9 @@ mips-gcc -O1 -DcMIPS -mno-gpopt -I"${include}" -S ${c_io}.c -o ${c_io}.s $S &&\
 mips-as -O1 -EL -mips32 -I "${include}" -o ${obj} ${asm} && \
 mips-as -O1 -EL -mips32 -I "${include}" -o ${c_start}.o ${c_start}.s && \
 mips-as -O1 -EL -mips32 -I "${include}" -o ${c_hndlrs}.o ${c_hndlrs}.s && \
-mips-as -O1 -EL -mips32 -I "${include}" -o ${c_stop}.o ${c_stop}.s && \
 mips-as -O1 -EL -mips32 -I "${include}" -o ${c_io}.o ${c_io}.s && \
 mips-ld -EL -e _start ${memory_map} -I "${include}" --script $c_ld \
-    -o $elf ${c_start}.o ${c_hndlrs}.o ${c_io}.o $obj ${c_stop}.o || exit 1
+    -o $elf ${c_start}.o ${c_hndlrs}.o ${c_io}.o $obj || exit 1
 
 mips-objcopy -S -j .text -O binary $elf $bin && \
   mips-objcopy -S -j .data -j .rodata -j .rodata1 -j .data1 \
diff --git a/cMIPS/bin/elf2mif.sh b/cMIPS/bin/elf2mif.sh
index 28b7f2f5eb7b286d73cb86d84831167fd7be756f..8a86c330b258e11d35ce5188a372d406f18d6438 100755
--- a/cMIPS/bin/elf2mif.sh
+++ b/cMIPS/bin/elf2mif.sh
@@ -49,6 +49,9 @@ x_ROM_BASE=$(sed -n '/x_INST_BASE_ADDR/s/.*:= x"\(.*\)".*$/\1/p' $tree/vhdl/pack
 
 ROM_BASE=$((16#$x_ROM_BASE))
 
+x_ROM_SIZE=$(sed -n '/x_INST_MEM_SZ/s/.*:= x"\(.*\)".*$/\1/p' $tree/vhdl/packageMemory.vhd)
+
+ROM_SZ=$((16#$x_ROM_SIZE))
 
 mif=ROM.mif
 
@@ -56,7 +59,7 @@ mips-objdump -z -D -EL --section .text $elf |\
     sed -e '1,6d' -e '/^$/d' -e '/^ /!d' -e 's:\t: :g' -e 's#^ *\([a-f0-9]*\): *\(........\)  *\(.*\)$#\2;#' |\
     awk 'BEGIN{c='$ROM_BASE';} //{ printf "%d : %s\n",c,$1 ; c=c+1; }' > xxxx
 
-echo -e "\n-- cMIPS code\n\nDEPTH=4096;\nWIDTH=32;\n\n" > $mif
+echo -e "\n-- cMIPS code\n\nDEPTH=${ROM_SZ};\nWIDTH=32;\n" > $mif
 echo -e "ADDRESS_RADIX=DEC;\nDATA_RADIX=HEX;\nCONTENT BEGIN" >> $mif 
 cat xxxx >> $mif
 echo "END;" >> $mif
@@ -64,17 +67,24 @@ echo "END;" >> $mif
 rm -f xxxx
 
 
+
 x_RAM_BASE=$(sed -n '/x_DATA_BASE_ADDR/s/.*:= x"\(.*\)".*$/\1/p' $tree/vhdl/packageMemory.vhd)
 
 RAM_BASE=$((16#$x_RAM_BASE))
 
+x_RAM_SIZE=$(sed -n '/x_DATA_MEM_SZ/s/.*:= x"\(.*\)".*$/\1/p' $tree/vhdl/packageMemory.vhd)
+
+RAM_SZ=$((16#$x_RAM_SIZE))
+
+
+
 mif=RAM.mif
 
 mips-objdump -z -D -EL --section .data --section .rodata --section rodata1 --section .data1 --section .sdata --section .lit8 --section .lit4 --section .sbss --section .bss   $elf |\
     sed -e '1,6d' -e '/^$/d' -e '/^ /!d' -e 's:\t: :g' -e 's#^ *\([a-f0-9]*\): *\(........\)  *\(.*\)$#\2;#' |\
     awk 'BEGIN{c='$RAM_BASE';} //{ printf "%d : %s\n",c,$1 ; c=c+1; }' > xxxx
 
-echo -e "\n-- cMIPS data\n\nDEPTH=4096;\nWIDTH=32;\n\n" > $mif
+echo -e "\n-- cMIPS data\n\nDEPTH=${RAM_SZ};\nWIDTH=32;\n" > $mif
 echo -e "ADDRESS_RADIX=DEC;\nDATA_RADIX=HEX;\nCONTENT BEGIN" >> $mif 
 cat xxxx >> $mif
 echo "END;" >> $mif
diff --git a/cMIPS/docs/cMIPS.pdf b/cMIPS/docs/cMIPS.pdf
index a0244361f1de709481efc30d594ee69abe098df8..8092a007ecab134b226874eee489e3cdfc1d8bf9 100644
Binary files a/cMIPS/docs/cMIPS.pdf and b/cMIPS/docs/cMIPS.pdf differ
diff --git a/cMIPS/include/cMIPS.ld b/cMIPS/include/cMIPS.ld
index 2d76a0e8176f9182b78bfaf95a62597651d95fe2..a3ee7a098937d7967b55e71a20e2ebb9d6d9a665 100644
--- a/cMIPS/include/cMIPS.ld
+++ b/cMIPS/include/cMIPS.ld
@@ -1,16 +1,32 @@
+OUTPUT_ARCH(mips)
+ENTRY(_start)
 SECTIONS
 {
        . = 0x00000000; /* x_INST_BASE_ADDR */
-       .text : { *(.text .text.*) }
+       .text :
+       {
+          *(.text .text.*)
+          _etext = . ;         /* end of text constant (from Xinu) */
+
+       }
        . = 0x00040000; /* x_DATA_BASE_ADDR */
-       .data    : { *(.data .data.*) }
        .rodata  : { *(.rodata .rodata.*) }
        .rodata1 : { *(.rodata1) }
+       .data    : 
+       {
+          *(.data .data.*) 
+          _edata = . ;         /* end of data constant  (from Xinu) */
+
+       }
        .data1   : { *(.data1) }
        .sdata   : { *(.sdata .sdata.*) }
        .lit8    : { *(.lit8) }
        .lit4    : { *(.lit4) }
        .sbss    : { *(.sbss .sbss.*) *(.scommon .scommon.*) }
-       .bss     : { *(.bss .bss.*) *(COMMON) }
-}
+       .bss     :
+       {
+          *(.bss .bss.*) *(COMMON) 
+          _end = . ;           /* end of image constant  (from Xinu) */
 
+       }
+}
diff --git a/cMIPS/include/cMIPS.s b/cMIPS/include/cMIPS.s
index e83854d75ba4b919edaf6ae12173e913cc5f3f03..70eef736364af0fccaa51af61d9c3f9470ac47cd 100644
--- a/cMIPS/include/cMIPS.s
+++ b/cMIPS/include/cMIPS.s
@@ -1,10 +1,10 @@
 
 	# see vhdl/packageMemory.vhd for addresses
         .set x_INST_BASE_ADDR,0x00000000
-        .set x_INST_MEM_SZ,0x00008000
+        .set x_INST_MEM_SZ,0x00002000
 
         .set x_DATA_BASE_ADDR,0x00040000
-        .set x_DATA_MEM_SZ,0x00008000
+        .set x_DATA_MEM_SZ,0x00002000
 	
         .set x_IO_BASE_ADDR,0x0F000000
         .set x_IO_MEM_SZ,0x00002000
diff --git a/cMIPS/include/stop.s b/cMIPS/include/stop.s
deleted file mode 100644
index 5849ebc8b5287a77c4ca7c77fff767b3f701369c..0000000000000000000000000000000000000000
--- a/cMIPS/include/stop.s
+++ /dev/null
@@ -1,4 +0,0 @@
-	.section .bss,"aw",@nobits
-        .align   3
-	.global  _highmem
-        .comm    _highmem 4
diff --git a/cMIPS/tests/mac_intRam.s b/cMIPS/tests/mac_intRam.s
index f63197be9fd044fa6f21eec065ce1cac7c91ba0e..33b5a0f44467be90d651ac902c7a5bba07610fab 100644
--- a/cMIPS/tests/mac_intRam.s
+++ b/cMIPS/tests/mac_intRam.s
@@ -255,7 +255,7 @@ endT1:	la  $15, HW_dsp7seg_addr # 7 segment display
 
 loop2:	sb    $9, 0($8)		# store char
 	addiu $9, $9, 1	
-	lbu    $13, 0($8)	# read it back
+	lbu   $13, 0($8)	# read it back
 	addiu $8, $8, 1
 
 	jal   LCDput		# then print it
@@ -269,10 +269,14 @@ loop2:	sb    $9, 0($8)		# store char
 
 endT2:	la  $15, HW_dsp7seg_addr # 7 segment display
 	li  $16, 0x04
-	sw  $16, 0($15)          # write to 7 segment display
-	nop
+
+endAll:	sw  $16, 0($15)          # write to 7 segment display
+
+	la  $4, wait_1_sec       # wait ONE second
+	jal delay
+	addi $16, $16,1
 	
-endAll:	j   endAll               # wait forever 
+	j   endAll               # wait forever 
 	nop
 
 #----------------------------------------------------------------------
diff --git a/cMIPS/tests/mac_kbd_lcd.s b/cMIPS/tests/mac_kbd_lcd.s
deleted file mode 100644
index efb26e6f456bb5d1cac9616868d015e8ce817c59..0000000000000000000000000000000000000000
--- a/cMIPS/tests/mac_kbd_lcd.s
+++ /dev/null
@@ -1,105 +0,0 @@
-	.file	1 "mac_kbd_lcd.c"
-	.section .mdebug.abi32
-	.previous
-	.nan	legacy
-	.module	fp=32
-	.module	nooddspreg
-	.text
-	.align	2
-	.globl	main
-	.set	nomips16
-	.set	nomicromips
-	.ent	main
-	.type	main, @function
-main:
-	.frame	$sp,32,$31		# vars= 0, regs= 4/0, args= 16, gp= 0
-	.mask	0x80070000,-4
-	.fmask	0x00000000,0
-	.set	noreorder
-	.set	nomacro
-	addiu	$sp,$sp,-32
-	sw	$31,28($sp)
-	sw	$18,24($sp)
-	sw	$17,20($sp)
-	jal	LCDinit
-	sw	$16,16($sp)
-
-	jal	LCDtopLine
-	li	$17,-1			# 0xffffffffffffffff
-
-	jal	LCDput
-	li	$4,32			# 0x20
-
-	jal	LCDput
-	li	$4,72			# 0x48
-
-	jal	LCDput
-	li	$4,101			# 0x65
-
-	jal	LCDput
-	li	$4,108			# 0x6c
-
-	jal	LCDput
-	li	$4,108			# 0x6c
-
-	jal	LCDput
-	li	$4,111			# 0x6f
-
-	jal	LCDput
-	li	$4,32			# 0x20
-
-	jal	LCDput
-	li	$4,119			# 0x77
-
-	jal	LCDput
-	li	$4,111			# 0x6f
-
-	jal	LCDput
-	li	$4,114			# 0x72
-
-	jal	LCDput
-	li	$4,108			# 0x6c
-
-	jal	LCDput
-	li	$4,100			# 0x64
-
-	jal	LCDput
-	li	$4,33			# 0x21
-
-	jal	LCDbotLine
-	li	$18,12451840			# 0xbe0000
-
-	ori	$18,$18,0xbc20
-$L2:
-	jal	KBDget
-	nop
-
-	beq	$2,$17,$L2
-	move	$16,$2
-
-	move	$7,$0
-	move	$6,$0
-	li	$5,1			# 0x1
-	jal	DSP7SEGput
-	move	$4,$2
-
-	jal	LCDput
-	addiu	$4,$16,48
-
-	jal	cmips_delay
-	move	$4,$18
-
-	li	$7,1			# 0x1
-	move	$6,$16
-	move	$5,$0
-	jal	DSP7SEGput
-	move	$4,$0
-
-	b	$L2
-	nop
-
-	.set	macro
-	.set	reorder
-	.end	main
-	.size	main, .-main
-	.ident	"GCC: (GNU) 5.1.0"
diff --git a/cMIPS/vhdl/tb_cMIPS.vhd b/cMIPS/vhdl/tb_cMIPS.vhd
index 953bdb291713419a4a81ccba38b4dfa5c4dc06d0..bbb4f6ed973b37c78f3118fabfd2c2ad7177eda9 100644
--- a/cMIPS/vhdl/tb_cMIPS.vhd
+++ b/cMIPS/vhdl/tb_cMIPS.vhd
@@ -730,8 +730,8 @@ architecture behavioral of io_addr_decode is
   constant HI_ADDR  : integer := log2_ceil(IO_BASE_ADDR + IO_RANGE - 1);
   constant in_r : std_logic_vector(HI_ADDR downto LO_ADDR) := (others => '1');
   constant ng_r : std_logic_vector(HI_ADDR downto LO_ADDR) := (others => '0');
-  constant oth  : std_logic_vector(HI_SEL_BITS downto HI_ADDR+1):=(others => '1');
-  constant ng_o : std_logic_vector(HI_SEL_BITS downto HI_ADDR+1):=(others => '0');
+  constant oth  : std_logic_vector(HI_SEL_BITS downto HI_ADDR+1):=(others=>'1');
+  constant ng_o : std_logic_vector(HI_SEL_BITS downto HI_ADDR+1):=(others=>'0');
 
   signal aVal : std_logic;
   signal dev  : integer;                    -- DEBUGGING only