diff --git a/osufs/osufs/osu_object_analyze/osu_object_includes.h b/osufs/osufs/osu_object_analyze/osu_object_includes.h
new file mode 100644
index 0000000000000000000000000000000000000000..62e97acd6204b55ce50077bce72629d85d03145a
--- /dev/null
+++ b/osufs/osufs/osu_object_analyze/osu_object_includes.h
@@ -0,0 +1,53 @@
+#ifndef OSU_OBJECT_INCLUDES_H_
+
+#define OSU_OBJECT_INCLUDES_H_
+
+#include<inttypes>
+
+typedef struct __attribute__((__packed__)) hit_circle_t{
+	//32 Byte
+	char type,
+	uint_16t x,y,
+	uint_32t start_timing,
+	uint_32t check_timing,
+	uint_32t disappear_timing,
+	//uint_32t end_timing,
+	uint_16t hit_radius,
+	uint_16t approach_radius,
+	uint_16t gradient_color1,
+	uint_16t gradient_color2,
+	uint_16t stroke_color,
+	uint_8t gradient_direction,
+	uint_32t reserved
+	
+}elem_hit_circle;
+
+typedef struct __attribute__((__packed__)) hit_circle_t{
+	//32 Byte
+	char type,
+	uint_16t x,y,
+	uint_32t start_timing,
+	uint_32t disappear_timing,
+	uint_16t radius,
+	uint_16t gradient_color1,
+	uint_16t gradient_color2,
+	uint_16t stroke_color,
+	uint_8t gradient_direction,
+	char padding[10]
+	
+}elem_spinner;
+
+/*typedef struct __attribute__((__packed__)) rect_slider_t{
+	char type;
+	uint_32t start_timing,
+	uint_32t check_timing,
+	uint_32t disappear_timing,
+	//uint_32t end_timing,
+	uint_16t hit_radius,
+	uint_16t approach_radius,
+	uint_16t x1,y1,x2,y2,x3,y3,x4,y4,
+	uint_8t gradient_direction,
+	uint_32t reserved
+}elem_rect_slider;*/
+
+#endif
\ No newline at end of file
diff --git a/software/interprocess/interprocess.h b/software/interprocess/interprocess.h
index 4a0bf32e9d4cdb411016ca8bf8d7e65053747382..c3b055bed8dc001cca63857e04e62f1adbc7c193 100644
--- a/software/interprocess/interprocess.h
+++ b/software/interprocess/interprocess.h
@@ -38,7 +38,7 @@ inline void mpeg_set_bg(uint32_t addr) {
 
 // For mpeg
 #define mpeg_bg IORD_32DIRECT(ISD_BASE, MPEG_BG_ADDR)
-#define mpeg_bg_reset(val) IOWR_32DIRECT(ISD_BASE, MPEG_BG_ADDR, addr);
+#define mpeg_bg_reset(val) IOWR_32DIRECT(ISD_BASE, MPEG_BG_ADDR, val);
 
 // Audio: W
 // Trig: ADDR
@@ -80,6 +80,7 @@ inline void mpeg_play_fx(uint32_t addr, uint32_t len) {
 #define mpeg_fx_addr IORD_32DIRECT(ISD_BASE, MPEG_MIX_ADDR)
 #define mpeg_fx_len IORD_32DIRECT(ISD_BASE, MPEG_MIX_LEN)
 #define mpeg_fx_reset(val) IOWR_32DIRECT(ISD_BASE, MPEG_MIX_ADDR, val)
+#define mpeg_fx_len_change(val) IOWR_32DIRECT(ISD_BASE, MPEG_MIX_LEN, val)
 
 // Generic Read: RW
 // Trig: ADDR
@@ -111,16 +112,14 @@ inline void mpeg_read(uint32_t addr, uint32_t len, void *buf) {
 #define MPEG_IMG_ADDR		52	// - 55
 #define MPEG_IMG_WIDTH		56	// - 57
 #define MPEG_IMG_HEIGHT		58	// - 59
-#define MPEG_IMG_DEST1		60	// - 63
-#define MPEG_IMG_DEST2		64	// - 67
+#define MPEG_IMG_DEST		60	// - 63
 
 // For main
-inline void mpeg_read(uint32_t addr, uint16_t w, uint16_t h, uint64_t dest) {
+inline void mpeg_read(uint32_t addr, uint16_t w, uint16_t h, uint32_t dest) {
 	while(IORD_32DIRECT(ISD_BASE, MPEG_IMG_ADDR));
 	IOWR_16DIRECT(ISD_BASE, MPEG_IMG_WIDTH, w);
 	IOWR_16DIRECT(ISD_BASE, MPEG_IMG_HEIGHT, h);
-	IOWR_32DIRECT(ISD_BASE, MPEG_IMG_DEST1, dest&0xffff);
-	IOWR_32DIRECT(ISD_BASE, MPEG_IMG_DEST2, (dest&0xffff0000)>>32);
+	IOWR_32DIRECT(ISD_BASE, MPEG_IMG_DEST, dest);
 	IOWR_32DIRECT(ISD_BASE, MPEG_IMG_ADDR, addr);
 }
 
diff --git a/software/osu_main_process/main.c b/software/osu_main/src/draw_main.h
similarity index 100%
rename from software/osu_main_process/main.c
rename to software/osu_main/src/draw_main.h
diff --git a/software/osu_main_process/osu_draw.c b/software/osu_main/src/osu_main_process/osu_draw.c
similarity index 100%
rename from software/osu_main_process/osu_draw.c
rename to software/osu_main/src/osu_main_process/osu_draw.c
diff --git a/software/osu_main_process/osu_draw.h b/software/osu_main/src/osu_main_process/osu_draw.h
similarity index 100%
rename from software/osu_main_process/osu_draw.h
rename to software/osu_main/src/osu_main_process/osu_draw.h
diff --git a/software/osu_main_process/osu_includes.h b/software/osu_main/src/osu_main_process/osu_includes.h
similarity index 100%
rename from software/osu_main_process/osu_includes.h
rename to software/osu_main/src/osu_main_process/osu_includes.h
diff --git a/software/osu_main_process/osu_process.c b/software/osu_main/src/osu_main_process/osu_process.c
similarity index 100%
rename from software/osu_main_process/osu_process.c
rename to software/osu_main/src/osu_main_process/osu_process.c
diff --git a/software/osu_main_process/osu_process.h b/software/osu_main/src/osu_main_process/osu_process.h
similarity index 100%
rename from software/osu_main_process/osu_process.h
rename to software/osu_main/src/osu_main_process/osu_process.h
diff --git a/software/osu_main/src/sdcard/osufs/osufs.h b/software/osu_main/src/sdcard/osufs/osufs.h
deleted file mode 100644
index f49cba34933960c1b361f6cca6dcf3251d0b2fd2..0000000000000000000000000000000000000000
--- a/software/osu_main/src/sdcard/osufs/osufs.h
+++ /dev/null
@@ -1,72 +0,0 @@
-//
-//  osufs.h
-//  osufs
-//
-//  Created by Fang Lu on 11/28/17.
-//  Copyright © 2017 Fang Lu. All rights reserved.
-//
-
-#ifndef osufs_h
-#define osufs_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdio.h>
-#include <inttypes.h>
-#include <stdbool.h>
-#include <unistd.h>
-
-	typedef struct __attribute__((__packed__)) osu_meta_t {
-		char magic[4];							// 0   - 3
-		uint16_t songs;							// 4   - 5
-		uint16_t available_block;				// 6   - 7
-
-		char _padding[504];						// 8   - 511
-	} osu_meta;
-
-	typedef struct __attribute__((__packed__)) osu_song_t {
-		char magic[4];							// 0   - 3
-		uint32_t cover_begin, cover_len;		// 4   - 7
-		uint32_t audio_begin, audio_len;		// 8   - 11
-		uint32_t beatmap_begin, beatmap_len;	// 12  - 15
-		int16_t difficulty;						// 16  - 17
-		int16_t hp_drain;						// 18  - 19
-		int16_t circle_size;					// 20  - 21
-		int16_t approach_rate;					// 22  - 23
-		int16_t slider_mult;					// 24  - 25
-		int16_t slider_tick;					// 26  - 27
-		uint8_t combo_colors[3][8];				// 28  - 51
-		uint32_t preview_blk_offset;			// 52  - 55
-		uint32_t beatmap_id;					// 56  - 59
-		uint32_t beatmap_setid;					// 60  - 63
-		uint16_t audio_leadin;					// 64  - 65
-		uint16_t stack_leniency;				// 66  - 67
-
-		uint32_t audio_offset;
-		//uint32_t cover_offset;
-		//uint32_t beatmap_offset;
-		char _padding[242];						// 68  - 319
-
-		char title[64];							// 320 - 383
-		char artist[64];						// 384 - 447
-		char creator[32];						// 448 - 479
-		char version[32];						// 480 - 511
-	} osu_song;
-
-	bool osu_read_meta(void *buf);
-	bool osu_read_song(uint32_t block,void *buf);
-	//void osu_write_meta(mdev *dev, osu_meta *meta);
-	//void osu_write_song(mdev *dev, int idx, osu_song *song);
-//	bool osu_read_audio512(osu_song* o_song,void *buf);
-	
-//	bool osu_read_cover(osu_song* o_song);
-
-	bool osu_init_device(void);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* osufs_h */
diff --git a/software/osu_sd_core/main.c b/software/osu_sd_core/main.c
new file mode 100644
index 0000000000000000000000000000000000000000..ef1335e0ac842938e9fcc0db93444b19492f1947
--- /dev/null
+++ b/software/osu_sd_core/main.c
@@ -0,0 +1,82 @@
+#ifndef SDCARD_H_
+#define SDCARD_H_
+
+#include "terasic_lib/terasic_includes.h"
+//#include "osufs/osufs.h"
+#include "util.h"
+#include "terasic_sdcard/sd_lib.h"
+#include "../interprocess/interprocess.h"
+#include "system.h"
+
+#define audioData ((uint32_t*)AUDIO_0_BASE)
+#define audioReady ((uint32_t*)(AUDIO_0_BASE+0x100))
+#define audioVol ((uint32_t*)(AUDIO_0_BASE+0x102))
+#define VolReset ((uint32_t*)(AUDIO_0_BASE+0x103))
+
+int main() {
+	printf("Hello world\n");
+	//from 00000 to 11111
+	*audioVol = 0x77;
+	*VolReset = 1;
+	uint32_t i;
+	uint8_t j;
+	uint32_t temp_start,temp_len;
+    SDLIB_Init();
+    char bg_buf[516];
+    uint32_t *buf = ALIGN_32(&bg_buf);
+    char o_meta_buf[516];
+	uint32_t *audio_buf1 = ALIGN_32(&o_meta_buf);
+	char o_song_buf[516];
+	uint32_t *audio_buf2 = ALIGN_32(&o_song_buf);
+
+	//giant probe sequence
+	SDLIB_ReadBlock512(o_song->cover_begin,buf);
+	PROBE:
+	while (1){
+    	if (mpeg_bg){
+    		SDLIB_ReadBlock512(mpeg_bg,buf);
+    		if (strncasecmp(buf, "PLT", 3)!=0) {
+				printf("Invalid palette magic: %c%c%c\n", buf[0], buf[1], buf[2]);
+			}
+			for (int i=0; i<128; i++) {
+				uint32_t c = (buf[i*3+3]<<16) | (buf[i*3+4]<<8) | buf[i*3+5];
+				GL_PLWR(i+128, c);
+				GL_PLWR(i, 0);
+			}            
+  			continue;
+  		}
+  		if (){}
+		if (mpeg_audio_addr){
+			goto AUDIO;
+		}	
+
+	}
+	AUDIO:
+	//SDLIB_ReadBlock512(temp_start,audioData);
+	usleep(mpeg_audio_start);
+	for (i=0;i<mpeg_audio_len;++i){
+		while (!(*audioReady));
+		if (mpeg_fx_addr){
+			if (mpeg_fx_len){
+				SDLIB_ReadBlock512(mpeg_audio_addr+i,audio_buf1);
+				SDLIB_ReadBlock512(mpeg_fx_addr,audio_buf2);
+				for (j=0;j<128;++j){
+					IOWR_32DIRECT(audioData+j,0,audio_buf1[j]+audio_buf2[j]);
+				}
+				mpeg_fx_reset(mpeg_fx_addr+1);
+				mpeg_fx_len_change(mpeg_fx_len-1);
+			}else{
+				SDLIB_ReadBlock512(mpeg_audio_addr+i,audioData);
+				mpeg_fx_reset(0);
+			}
+			
+		}else{
+			SDLIB_ReadBlock512(mpeg_audio_addr+i,audioData);
+		}
+	}
+	mpeg_audio_reset(0);
+	goto PROBE;
+}
+
+
+#endif
diff --git a/software/osu_main/src/sdcard/sdcard.h b/software/osu_sd_core/ori_main.txt
similarity index 81%
rename from software/osu_main/src/sdcard/sdcard.h
rename to software/osu_sd_core/ori_main.txt
index ed812d163d820d8ccf0cf42b32bdbc59f12080a0..83273c500bcef24886c7b7d88b5cf76c9fa62af2 100644
--- a/software/osu_main/src/sdcard/sdcard.h
+++ b/software/osu_sd_core/ori_main.txt
@@ -3,8 +3,9 @@
 
 #include "terasic_lib/terasic_includes.h"
 #include "osufs/osufs.h"
+#include "util.h"
+#include "../interprocess/interprocess.h"
 
-/*
 int main() {
 	printf("Hello world\n");
 	//from 00000 to 11111
@@ -12,26 +13,26 @@ int main() {
 	//notice: must reset to start the I2C config
 	*VolReset = 1;
 	//short int fileP;
-	char filename[256];
-
     unsigned int fileSize;
     int i,j;
-    osu_meta o_meta;
-    osu_song o_song;
+    //osu_meta o_meta;
+    //osu_song o_song;
     osu_init_device();
-   
+
+    char o_meta_buf[516];
+	osu_meta *o_meta = ALIGN_32(&o_meta_buf);
+	char o_song_buf[516];
+	osu_meta *o_song = ALIGN_32(&o_song_buf);
+
     while(1){
         if (osu_read_meta(&o_meta)){
             printf("Sdcard mount success!\n");
             printf("magic:%c%c%c%c\n",o_meta.magic[0],o_meta.magic[1],o_meta.magic[2],o_meta.magic[3]);
             printf("Song Count:%d\n", o_meta.songs);
-
             goto AUDIO;
-            
         }else{
             printf("Failed to mount the SDCARD!\r\nPlease retry!\r\n");
         }
-
     } // while            
   	
     
@@ -52,6 +53,6 @@ int main() {
 	printf("Playback completed\n");
 	goto AUDIO;
 }
-*/
+
 
 #endif
diff --git a/software/osu_main/src/sdcard/osufs/osufs.c b/software/osu_sd_core/osufs/osufs.c
similarity index 88%
rename from software/osu_main/src/sdcard/osufs/osufs.c
rename to software/osu_sd_core/osufs/osufs.c
index 75b9a87bc255afaf3ad014664d4c526f51bd5726..10c1f78384f2350900c1af8945adab743f487d56 100644
--- a/software/osu_main/src/sdcard/osufs/osufs.c
+++ b/software/osu_sd_core/osufs/osufs.c
@@ -13,16 +13,16 @@
 #include <assert.h>
 
 
-bool osu_read_meta(void *buf) {
+/*bool osu_read_meta(void *buf) {
 	return SDLIB_ReadBlock512(0,buf);
 }
-
-bool osu_read_song(uint32_t block,void *buf) {
+*/
+/*bool osu_read_512(uint32_t block,void *buf) {
 	return SDLIB_ReadBlock512(block,buf);
-}
+}*/
+
 
-/*
-bool osu_read_audio512(osu_song* o_song,void *buf) {
+/*bool osu_read_audio512(osu_song* o_song,void *buf) {
 	if (o_song->audio_offset > o_song->audio_len)
 		return 0;
 	if (SDLIB_ReadBlock512((o_song->audio_begin)+(o_song->audio_offset),buf)){
@@ -30,7 +30,7 @@ bool osu_read_audio512(osu_song* o_song,void *buf) {
 		return 1;
 	}else
 		return 0;
-}
+}*/
 
 bool osu_read_cover(osu_song* o_song) {
 	//read palette data
@@ -63,7 +63,7 @@ bool osu_read_cover(osu_song* o_song) {
 
 	}
 }
-*/
+
 
 /*void osu_write_meta(mdev *dev, osu_meta *meta) {
 	blkio_write(dev, 0, meta);
@@ -73,6 +73,6 @@ void osu_write_song(mdev *dev, int idx, osu_song *song) {
 	blkio_write(dev, idx+1, song);
 }*/
 
-bool osu_init_device(void) {
+/*bool osu_init_device(void) {
 	return SDLIB_Init();
-}
+}*/
diff --git a/software/osu_sd_core/osufs/osufs.h b/software/osu_sd_core/osufs/osufs.h
new file mode 100644
index 0000000000000000000000000000000000000000..fb660f9de4f30d4566a3b6306dd9c86a4fba99e0
--- /dev/null
+++ b/software/osu_sd_core/osufs/osufs.h
@@ -0,0 +1,173 @@
+//
+//  osufs.h
+//  osufs
+//
+//  Created by Fang Lu on 11/28/17.
+//  Copyright © 2017 Fang Lu. All rights reserved.
+//
+
+#ifndef osufs_h
+#define osufs_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdio.h>
+#include <inttypes.h>
+#include "blkio.h"
+
+
+	typedef struct __attribute__((__packed__)) osu_meta_t {
+		char magic[4];							// 0   - 3
+		uint16_t songs;							// 4   - 5
+		uint32_t available_block;				// 6   - 9
+		char meta_padding[6];					// 10  - 15
+		
+		// Resources
+		// Sounds
+		uint32_t applause_begin;				// 16  - 19
+		uint32_t failsnd_begin;					// 20  - 23
+		uint16_t applause_len;					// 24  - 25
+		uint16_t failsnd_len;					// 26  - 27
+
+		uint32_t spinnerspin_begin;				// 28  - 31
+		uint32_t spinnerbonus_begin;			// 32  - 35
+		uint16_t spinnerspin_len;				// 36  - 37
+		uint16_t spinnerbonus_len;				// 38  - 39
+
+		uint32_t menuclick_begin;				// 40  - 43
+		uint32_t menuback_begin;				// 44  - 47
+		uint16_t menuclick_len;					// 48  - 49
+		uint16_t menuback_len;					// 50  - 51
+
+		uint32_t menuhit_begin;					// 52  - 55
+		uint32_t combobreak_begin;				// 56  - 59
+		uint16_t menuhit_len;					// 60  - 61
+		uint16_t combobreak_len;				// 62  - 63
+
+		uint32_t drum_hitclap_begin;			// 64  - 67
+		uint32_t drum_hitfinish_begin;			// 68  - 71
+		uint16_t drum_hitclap_len;				// 72  - 73
+		uint16_t drum_hitfinish_len;			// 74  - 75
+
+		uint32_t drum_hitnormal_begin;			// 76  - 79
+		uint32_t drum_hitwhistle_begin;			// 80  - 83
+		uint16_t drum_hitnormal_len;			// 84  - 85
+		uint16_t drum_hitwhistle_len;			// 86  - 87
+
+		uint32_t drum_sliderslide_begin;		// 88  - 91
+		uint32_t drum_slidertick_begin;			// 92  - 95
+		uint16_t drum_sliderslide_len;			// 96  - 97
+		uint16_t drum_slidertick_len;			// 98  - 99
+
+		uint32_t drum_sliderwhistle_begin;		// 100 - 103
+		uint32_t drum_padding_begin;			// 104 - 107
+		uint16_t drum_sliderwhistle_len;		// 108 - 109
+		uint16_t drum_padding_len;				// 110 - 111
+
+		uint32_t normal_hitclap_begin;			// 112 - 115
+		uint32_t normal_hitfinish_begin;		// 116 - 119
+		uint16_t normal_hitclap_len;			// 120 - 121
+		uint16_t normal_hitfinish_len;			// 122 - 123
+
+		uint32_t normal_hitnormal_begin;		// 124 - 127
+		uint32_t normal_hitwhistle_begin;		// 128 - 131
+		uint16_t normal_hitnormal_len;			// 132 - 133
+		uint16_t normal_hitwhistle_len;			// 134 - 135
+
+		uint32_t normal_sliderslide_begin;		// 136 - 139
+		uint32_t normal_slidertick_begin;		// 140 - 143
+		uint16_t normal_sliderslide_len;		// 144 - 145
+		uint16_t normal_slidertick_len;			// 146 - 147
+
+		uint32_t normal_sliderwhistle_begin;	// 148 - 151
+		uint32_t normal_padding_begin;			// 152 - 155
+		uint16_t normal_sliderwhistle_len;		// 156 - 157
+		uint16_t normal_padding_len;			// 158 - 159
+
+		uint32_t soft_hitclap_begin;			// 160 - 163
+		uint32_t soft_hitfinish_begin;			// 164 - 167
+		uint16_t soft_hitclap_len;				// 168 - 169
+		uint16_t soft_hitfinish_len;			// 170 - 171
+
+		uint32_t soft_hitnormal_begin;			// 172 - 175
+		uint32_t soft_hitwhistle_begin;			// 176 - 179
+		uint16_t soft_hitnormal_len;			// 180 - 181
+		uint16_t soft_hitwhistle_len;			// 182 - 183
+
+		uint32_t soft_sliderslide_begin;		// 184 - 187
+		uint32_t soft_slidertick_begin;			// 188 - 191
+		uint16_t soft_sliderslide_len;			// 192 - 193
+		uint16_t soft_slidertick_len;			// 194 - 195
+
+		uint32_t soft_sliderwhistle_begin;		// 196 - 199
+		uint32_t soft_padding_begin;			// 200 - 203
+		uint16_t soft_sliderwhistle_len;		// 204 - 205
+		uint16_t soft_padding_len;				// 206 - 207
+
+		// Image resources
+		uint32_t cursor_begin;
+		uint16_t cursor_w;
+		uint16_t cursor_h;
+		
+		uint32_t menu_bg_begin;
+		uint32_t menu_bg_len;
+		
+		uint32_t menu_back_begin;
+		uint16_t menu_back_w;
+		uint16_t menu_back_h;
+		
+		
+		
+		
+
+
+		char _padding[502];						// 10   - 511
+	} osu_meta;
+
+	typedef struct __attribute__((__packed__)) osu_song_t {
+		char magic[4];							// 0   - 3
+		uint32_t cover_begin, cover_len;		// 4   - 11
+		uint32_t audio_begin, audio_len;		// 12  - 19
+		uint32_t beatmap_begin, beatmap_len;	// 20  - 27
+		int16_t difficulty;						// 28  - 29
+		int16_t hp_drain;						// 30  - 31
+		int16_t circle_size;					// 32  - 33
+		int16_t approach_rate;					// 34  - 35
+		int16_t slider_mult;					// 36  - 37
+		int16_t slider_tick;					// 38  - 39
+		uint8_t combo_colors[8][3];				// 40  - 63
+		uint32_t preview_blk_offset;			// 64  - 67
+		uint32_t beatmap_id;					// 68  - 71
+		uint32_t beatmap_setid;					// 72  - 75
+		uint16_t audio_leadin;					// 76  - 77
+		uint16_t stack_leniency;				// 78  - 79
+
+		//for analyze side only
+		uint8_t combo_colors_count;				//80 - 80
+		uint8_t combo_colors_start;				//81 - 81
+		void*	storyboard;						//82 - 89
+		char _padding[230];						// 94  - 319
+
+		char title[64];							// 320 - 383
+		char artist[64];						// 384 - 447
+		char creator[32];						// 448 - 479
+		char version[32];						// 480 - 511
+	} osu_song;
+
+	bool osu_read_meta(void *buf);
+	bool osu_read_song(uint32_t block,void *buf);
+	//void osu_write_meta(mdev *dev, osu_meta *meta);
+	//void osu_write_song(mdev *dev, int idx, osu_song *song);
+//	bool osu_read_audio512(osu_song* o_song,void *buf);
+	
+//	bool osu_read_cover(osu_song* o_song);
+
+	bool osu_init_device(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* osufs_h */
diff --git a/software/osu_main/src/sdcard/terasic_lib/debug.c b/software/osu_sd_core/terasic_lib/debug.c
similarity index 100%
rename from software/osu_main/src/sdcard/terasic_lib/debug.c
rename to software/osu_sd_core/terasic_lib/debug.c
diff --git a/software/osu_main/src/sdcard/terasic_lib/debug.h b/software/osu_sd_core/terasic_lib/debug.h
similarity index 100%
rename from software/osu_main/src/sdcard/terasic_lib/debug.h
rename to software/osu_sd_core/terasic_lib/debug.h
diff --git a/software/osu_main/src/sdcard/terasic_lib/terasic_includes.h b/software/osu_sd_core/terasic_lib/terasic_includes.h
similarity index 100%
rename from software/osu_main/src/sdcard/terasic_lib/terasic_includes.h
rename to software/osu_sd_core/terasic_lib/terasic_includes.h
diff --git a/software/osu_main/src/sdcard/terasic_sdcard/crc16.c b/software/osu_sd_core/terasic_sdcard/crc16.c
similarity index 100%
rename from software/osu_main/src/sdcard/terasic_sdcard/crc16.c
rename to software/osu_sd_core/terasic_sdcard/crc16.c
diff --git a/software/osu_main/src/sdcard/terasic_sdcard/crc16.h b/software/osu_sd_core/terasic_sdcard/crc16.h
similarity index 100%
rename from software/osu_main/src/sdcard/terasic_sdcard/crc16.h
rename to software/osu_sd_core/terasic_sdcard/crc16.h
diff --git a/software/osu_main/src/sdcard/terasic_sdcard/crc7.c b/software/osu_sd_core/terasic_sdcard/crc7.c
similarity index 100%
rename from software/osu_main/src/sdcard/terasic_sdcard/crc7.c
rename to software/osu_sd_core/terasic_sdcard/crc7.c
diff --git a/software/osu_main/src/sdcard/terasic_sdcard/crc7.h b/software/osu_sd_core/terasic_sdcard/crc7.h
similarity index 100%
rename from software/osu_main/src/sdcard/terasic_sdcard/crc7.h
rename to software/osu_sd_core/terasic_sdcard/crc7.h
diff --git a/software/osu_main/src/sdcard/terasic_sdcard/sd_hal.c b/software/osu_sd_core/terasic_sdcard/sd_hal.c
similarity index 100%
rename from software/osu_main/src/sdcard/terasic_sdcard/sd_hal.c
rename to software/osu_sd_core/terasic_sdcard/sd_hal.c
diff --git a/software/osu_main/src/sdcard/terasic_sdcard/sd_hal.h b/software/osu_sd_core/terasic_sdcard/sd_hal.h
similarity index 100%
rename from software/osu_main/src/sdcard/terasic_sdcard/sd_hal.h
rename to software/osu_sd_core/terasic_sdcard/sd_hal.h
diff --git a/software/osu_main/src/sdcard/terasic_sdcard/sd_lib.c b/software/osu_sd_core/terasic_sdcard/sd_lib.c
similarity index 100%
rename from software/osu_main/src/sdcard/terasic_sdcard/sd_lib.c
rename to software/osu_sd_core/terasic_sdcard/sd_lib.c
diff --git a/software/osu_main/src/sdcard/terasic_sdcard/sd_lib.h b/software/osu_sd_core/terasic_sdcard/sd_lib.h
similarity index 100%
rename from software/osu_main/src/sdcard/terasic_sdcard/sd_lib.h
rename to software/osu_sd_core/terasic_sdcard/sd_lib.h
diff --git a/software/osu_main/src/sdcard/terasic_sdcard/sd_protocol.c b/software/osu_sd_core/terasic_sdcard/sd_protocol.c
similarity index 100%
rename from software/osu_main/src/sdcard/terasic_sdcard/sd_protocol.c
rename to software/osu_sd_core/terasic_sdcard/sd_protocol.c
diff --git a/software/osu_main/src/sdcard/terasic_sdcard/sd_protocol.h b/software/osu_sd_core/terasic_sdcard/sd_protocol.h
similarity index 100%
rename from software/osu_main/src/sdcard/terasic_sdcard/sd_protocol.h
rename to software/osu_sd_core/terasic_sdcard/sd_protocol.h
diff --git a/software/osu_sd_core/util.h b/software/osu_sd_core/util.h
new file mode 100644
index 0000000000000000000000000000000000000000..d6706312bdc4748932ac6d38f70d8b786331233d
--- /dev/null
+++ b/software/osu_sd_core/util.h
@@ -0,0 +1,8 @@
+#ifndef UTIL_H_
+#define UTIL_H_
+
+#define ALIGN_16(ptr) (void *)(((uint64_t)(ptr))&(~0x3)+2)
+#define ALIGN_32(ptr) (void *)(((uint64_t)(ptr))&(~0xf)+4)
+#define ALIGN_64(ptr) (void *)(((uint64_t)(ptr))&(~0xff)+8)
+
+#endif
\ No newline at end of file