diff --git a/src/build/Common.gmake b/src/build/Common.gmake
index 79722f14aeb81232801f382ea12600bbde197cfd..7180d7dad715617ef4e2698aacad108eb2de7524 100644
--- a/src/build/Common.gmake
+++ b/src/build/Common.gmake
@@ -452,6 +452,11 @@ endif
 -include $(SRC_ROOT)/build/rules.mk
 -include objects.mk		# defines $(OBJS)
 
+# Implicit ASM Compile Rule
+$(OBJODIR)/%$(OFILE) : %.s $(BUILD_DEPENDS) | $(OBJODIR)
+	@echo $(COMPILE_MSG) $<
+	$(QUIET)$(AS) $(ASFLAGS) -o $@ $<
+
 # Implicit C Compile Rule
 $(OBJODIR)/%$(OFILE) : %.c $(BUILD_DEPENDS) | $(OBJODIR)
 	@echo $(COMPILE_MSG) $<
@@ -462,6 +467,11 @@ $(OBJODIR)/%$(OFILE) : %.cpp $(BUILD_DEPENDS) | $(OBJODIR)
 	@echo $(COMPILE_MSG) $<
 	$(QUIET)$(CXX) -std=c++11 $(CFLAGS) $(CXXFLAGS) -o $@ -c $<
 
+# Implicit MT ASM Compile Rule
+$(MTOBJODIR)/%$(OFILE) : %.s $(BUILD_DEPENDS) | $(OBJODIR)
+	@echo $(COMPILE_MSG) $<
+	$(QUIET)$(AS) $(ASFLAGS) -o $@ $<
+
 # Implicit MT C Compile Rule
 $(MTOBJODIR)/%$(OFILE) : %.c $(BUILD_DEPENDS) | $(MTOBJODIR)
 	@echo $(COMPILE_MSG) $<
diff --git a/src/conio/GNUmakefile b/src/conio/GNUmakefile
index 79af95ff8a26b87649147f99d1f0d3d6942f9df3..06555900f99121c4a9a4b131a79f943effa194c4 100644
--- a/src/conio/GNUmakefile
+++ b/src/conio/GNUmakefile
@@ -67,7 +67,16 @@ $(MTOBJODIR)$(DIRSEP)ciolib_res${OFILE}: ciolib.rc syncicon64.ico
 	$(QUIET)${WINDRES} $(WINDRESFLAGS) -O coff -i ciolib.rc -o $@
 endif
 
-genamp: $(EXEODIR) $(MTOBJODIR) $(EXEODIR)$(DIRSEP)genmap$(EXEFILE)
+$(EXEODIR)$(DIRSEP)genmap$(EXEFILE): $(EXEODIR)
+
+rgbmap.s: $(EXEODIR)$(DIRSEP)genmap$(EXEFILE)
+	@echo Creating $@...
+	$(QUIET)$(EXEODIR)$(DIRSEP)genmap$(EXEFILE)
+
+rgbmap.h: rgbmap.s
+
+$(MTOBJODIR)$(DIRSEP)rgbmap$(OFILE): rgbmap.s rgbmap.h
+
+$(EXEODIR)$(DIRSEP)genmap$(EXEFILE): $(OBJODIR)$(DIRSEP)genmap$(OFILE)
+	$(CC) $(LDFLAGS) $(OBJODIR)$(DIRSEP)genmap$(OFILE) -o $@
 
-$(EXEODIR)$(DIRSEP)genmap$(EXEFILE): $(MTOBJODIR)$(DIRSEP)genmap$(OFILE) $(MTOBJODIR)$(DIRSEP)scale$(OFILE) $(MTOBJODIR)$(DIRSEP)xbr$(OFILE)
-	$(CC) $(LDFLAGS) $(MT_LDFLAGS) $(MTOBJODIR)$(DIRSEP)genmap$(OFILE) $(MTOBJODIR)$(DIRSEP)scale$(OFILE) $(MTOBJODIR)$(DIRSEP)xbr$(OFILE) -o $@ -lm
diff --git a/src/conio/genmap.c b/src/conio/genmap.c
index c02a5458ee8f0d4899b1b9772866cf971c70b331..96916e8c11f000461f0e8933ff67087059b9f5bb 100644
--- a/src/conio/genmap.c
+++ b/src/conio/genmap.c
@@ -1,42 +1,92 @@
 #include <stdio.h>
-#include "scale.h"
-#include "ciolib.h"
-cioapi_t cio_api;
+#include <inttypes.h>
+uint32_t r2y[16777216];
+uint32_t y2r[16777216];
 
-int main(int argc, char **argv)
+#define CLAMP(x) do { \
+	if (x < 0) \
+		x = 0; \
+	else if (x > 255) \
+		x = 255; \
+} while(0)
+
+void
+init_r2y(void)
 {
-	uint32_t i;
-	FILE *c = fopen("rgbmap.c", "wb");
-	FILE *h = fopen("rgbmap.h", "wb");
-	init_r2y();
+	int r, g, b;
+	int y, u, v;
+	const double luma = 255.0 / 219;
+	const double col  = 255.0 / 224;
+
+	for (r = 0; r < 256; r++) {
+		for (g = 0; g < 256; g++) {
+			for (b = 0; b < 256; b++) {
+				y =  16 + ( 65.738 * r + 129.057 * g +  25.064 * b + 128) / 256;
+				CLAMP(y);
+				u = 128 + (-37.945 * r -  74.494 * g + 112.439 * b + 128) / 256;
+				CLAMP(u);
+				v = 128 + (112.439 * r -  94.154 * g -  18.285 * b + 128) / 256;
+				CLAMP(v);
 
-	fprintf(c, "#include <inttypes.h>\n\n"
-	    "const uint32_t r2y[%u] = {\n", 1 << 24);
-	fprintf(h, "#ifndef RGBMAP_H\n"
-	    "#define RGBMAP_H\n\n"
-	    "#include <inttypes.h>\n\n"
-	    "extern const uint32_t r2y[%u];\n"
-	    "extern const uint32_t y2r[%u];\n\n"
-	    "#endif\n", 1 << 24, 1 << 24);
-	for (i = 0; i < (1<<24); i++) {
-		if (i % 8 == 0)
-			fputs("\t", c);
-		fprintf(c, "0x%08x,", r2y[i]);
-		if (i % 8 == 7)
-			fputs("\n", c);
-		else
-			fputs(" ", c);
+				r2y[(r<<16) | (g<<8) | b] = (y<<16)|(u<<8)|v;
+			}
+		}
 	}
-	fprintf(c, "};\n\n"
-	    "const uint32_t y2r[%u] = {\n", 1 << 24);
-	for (i = 0; i < (1<<24); i++) {
-		if (i % 8 == 0)
-			fputs("\t", c);
-		fprintf(c, "0x%08x,", y2r[i]);
-		if (i % 8 == 7)
-			fputs("\n", c);
-		else
-			fputs(" ", c);
+	for (y = 0; y < 256; y++) {
+		for (u = 0; u < 256; u++) {
+			for (v = 0; v < 256; v++) {
+				const int c = y - 16;
+				const int d = u - 128;
+				const int e = v - 128;
+				r = luma * c                                     + col * 1.402 * e;
+				CLAMP(r);
+				g = luma * c - col * 1.772 * (0.114 / 0.587) * d - col * 1.402 * (0.299 / 0.587) * e;
+				CLAMP(g);
+				b = luma * c + col * 1.772 * d;
+				CLAMP(b);
+
+				y2r[(y<<16) | (u<<8) | v] = (r<<16)|(g<<8)|b;
+			}
+		}
 	}
-	fputs("};\n", c);
+}
+
+int
+main(int argc, char **argv)
+{
+	FILE *s = fopen("rgbmap.s", "w");
+	FILE *h = fopen("rgbmap.h", "w");
+	FILE *r = fopen("r2y.bin", "wb");
+	FILE *y = fopen("y2r.bin", "wb");
+	init_r2y();
+
+	fprintf(s,
+	    ".section .rodata\n"
+	    ".global r2y\n"
+	    ".type   r2y, @object\n"
+	    ".align  4\n"
+	    "r2y:\n"
+	    "	.incbin \"r2y.bin\"\n"
+	    ".global y2r\n"
+	    ".type   y2r, @object\n"
+	    ".align  4\n"
+	    "y2r:\n"
+	    "	.incbin \"y2r.bin\"\n");
+	fprintf(h,
+	    "#ifndef RGBMAP_H\n"
+	    "#define RGBMAP_H\n"
+	    "\n"
+	    "#include <inttypes.h>\n"
+	    "\n"
+	    "extern const uint32_t r2y[16777216];\n"
+	    "extern const uint32_t y2r[16777216];\n"
+	    "\n"
+	    "#endif\n");
+	fwrite(r2y, 4, 1 << 24, r);
+	fwrite(y2r, 4, 1 << 24, y);
+	fclose(s);
+	fclose(h);
+	fclose(r);
+	fclose(y);
+	return 0;
 }
diff --git a/src/conio/rgbmap.c b/src/conio/rgbmap.c
deleted file mode 100644
index c97ca28a6009ab679e7567d6b0c86f89b840b4fa..0000000000000000000000000000000000000000
Binary files a/src/conio/rgbmap.c and /dev/null differ
diff --git a/src/conio/rgbmap.h b/src/conio/rgbmap.h
deleted file mode 100644
index d7523869da285a4c9013611a22a2fc3d295c2952..0000000000000000000000000000000000000000
--- a/src/conio/rgbmap.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef RGBMAP_H
-#define RGBMAP_H
-
-#include <inttypes.h>
-
-extern const uint32_t r2y[16777216];
-extern const uint32_t y2r[16777216];
-
-#endif
diff --git a/src/conio/scale.c b/src/conio/scale.c
index 3d62638711f30a9a230dd41d8a69758d741977d6..b96af98c6934874181695c44dab53161d9f36849 100644
--- a/src/conio/scale.c
+++ b/src/conio/scale.c
@@ -16,13 +16,6 @@ static void multiply_scale(uint32_t* src, uint32_t* dst, int width, int height,
 
 static struct graphics_buffer *free_list;
 
-#define CLAMP(x) do { \
-	if (x < 0) \
-		x = 0; \
-	else if (x > 255) \
-		x = 255; \
-} while(0)
-
 /*
  * Corrects width/height to have the specified aspect ratio
  * any fit inside the specified rectangle
@@ -182,52 +175,6 @@ aspect_reverse(int *x, int *y, int scrnwidth, int scrnheight, int aspect_width,
 	*y = height;
 }
 
-#if 0
-void
-init_r2y(void)
-{
-	int r, g, b;
-	int y, u, v;
-	const double luma = 255.0 / 219;
-	const double col  = 255.0 / 224;
-
-	if (r2y_inited)
-		return;
-	for (r = 0; r < 256; r++) {
-		for (g = 0; g < 256; g++) {
-			for (b = 0; b < 256; b++) {
-				y =  16 + ( 65.738 * r + 129.057 * g +  25.064 * b + 128) / 256;
-				CLAMP(y);
-				u = 128 + (-37.945 * r -  74.494 * g + 112.439 * b + 128) / 256;
-				CLAMP(u);
-				v = 128 + (112.439 * r -  94.154 * g -  18.285 * b + 128) / 256;
-				CLAMP(v);
-
-				ciolib_r2yptr[(r<<16) | (g<<8) | b] = (y<<16)|(u<<8)|v;
-			}
-		}
-	}
-	for (y = 0; y < 256; y++) {
-		for (u = 0; u < 256; u++) {
-			for (v = 0; v < 256; v++) {
-				const int c = y - 16;
-				const int d = u - 128;
-				const int e = v - 128;
-				r = luma * c                                     + col * 1.402 * e;
-				CLAMP(r);
-				g = luma * c - col * 1.772 * (0.114 / 0.587) * d - col * 1.402 * (0.299 / 0.587) * e;
-				CLAMP(g);
-				b = luma * c + col * 1.772 * d;
-				CLAMP(b);
-
-				ciolib_y2rptr[(y<<16) | (u<<8) | v] = (r<<16)|(g<<8)|b;
-			}
-		}
-	}
-	r2y_inited = true;
-}
-#endif
-
 struct graphics_buffer *
 get_buffer(void)
 {