summaryrefslogtreecommitdiff
path: root/2_scroll_planes/startup.c
diff options
context:
space:
mode:
Diffstat (limited to '2_scroll_planes/startup.c')
-rw-r--r--2_scroll_planes/startup.c130
1 files changed, 130 insertions, 0 deletions
diff --git a/2_scroll_planes/startup.c b/2_scroll_planes/startup.c
new file mode 100644
index 0000000..f2574cd
--- /dev/null
+++ b/2_scroll_planes/startup.c
@@ -0,0 +1,130 @@
+typedef void (*ptr_func_t)();
+
+struct smd_header {
+ char console_name[16];
+ char copyright[16];
+ char domestic_name[48];
+ char international_name[48];
+ char version[14];
+ unsigned short checksum;
+ char io_support[16];
+ unsigned long rom_start;
+ unsigned long rom_end;
+ unsigned long ram_start;
+ unsigned long ram_end;
+ unsigned long sram_enabled;
+ unsigned long unused1;
+ unsigned long sram_start;
+ unsigned long sram_end;
+ unsigned long unused2;
+ unsigned long unused3;
+ char notes[40];
+ char country_codes[16];
+};
+
+void INT_Null(void) __attribute__((weak, interrupt));
+void CPU_EntryPoint(void) __attribute__((weak, alias ("INT_Null")));
+void INT_HInterrupt(void) __attribute__((weak, alias ("INT_Null")));
+void INT_VInterrupt(void) __attribute__((weak, alias ("INT_Null")));
+void CPU_Exception(void) __attribute__((weak, interrupt));
+
+extern unsigned __stacktop;
+extern unsigned __rom_start;
+extern unsigned __rom_end;
+
+__attribute__((section(".stack"), used)) unsigned *__stack_init = &__stacktop;
+
+__attribute__((section(".vectors"), used)) ptr_func_t __isr_vectors[] = {
+ CPU_EntryPoint,
+ CPU_Exception,
+ CPU_Exception,
+ CPU_Exception,
+ CPU_Exception,
+ CPU_Exception,
+ CPU_Exception,
+ CPU_Exception,
+ INT_Null,
+ INT_Null,
+ INT_Null,
+ INT_Null,
+ INT_Null,
+ INT_Null,
+ INT_Null,
+ INT_Null,
+ INT_Null,
+ INT_Null,
+ INT_Null,
+ INT_Null,
+ INT_Null,
+ INT_Null,
+ INT_Null,
+ INT_Null,
+ INT_Null,
+ INT_Null,
+ INT_Null,
+ INT_HInterrupt,
+ INT_Null,
+ INT_VInterrupt,
+ INT_Null,
+ INT_Null,
+ INT_Null,
+ INT_Null,
+ INT_Null,
+ INT_Null,
+ INT_Null,
+ INT_Null,
+ INT_Null,
+ INT_Null,
+ INT_Null,
+ INT_Null,
+ INT_Null,
+ INT_Null,
+ INT_Null,
+ INT_Null,
+ INT_Null,
+ INT_Null,
+ INT_Null,
+ INT_Null,
+ INT_Null,
+ INT_Null,
+ INT_Null,
+ INT_Null,
+ INT_Null,
+ INT_Null,
+ INT_Null,
+ INT_Null,
+ INT_Null,
+ INT_Null,
+ INT_Null,
+ INT_Null,
+ INT_Null,
+};
+
+__attribute__((section(".smd_header"), used)) struct smd_header __smd_header = {
+ .console_name = "SEGA MEGA DRIVE ",
+ .copyright = "BIGEVILCORP. ",
+ .domestic_name = "HELLO WORLD ",
+ .international_name = "HELLO WORLD ",
+ .version = "GM XXXXXXXX-XX",
+ .checksum = 0x0000,
+ .io_support = "J ",
+ .rom_start = (unsigned long)&__rom_start,
+ .rom_end = (unsigned long)&__rom_end-1,
+ .ram_start = 0xff0000,
+ .ram_end = 0xffffff,
+ .sram_enabled = 0x00000000,
+ .unused1 = 0x00000000,
+ .sram_start = 0x00000000,
+ .sram_end = 0x00000000,
+ .unused2 = 0x00000000,
+ .unused3 = 0x00000000,
+ .notes = " ",
+ .country_codes = " E ",
+};
+
+void INT_Null(void) {}
+
+void CPU_Exception(void)
+{
+ asm inline volatile (" stop #2700");
+}