diff --git a/Debug/MyProject.axf b/Debug/MyProject.axf index 3890a95..96077b2 100755 Binary files a/Debug/MyProject.axf and b/Debug/MyProject.axf differ diff --git a/Debug/MyProject.map b/Debug/MyProject.map index 600db2d..654b61f 100644 --- a/Debug/MyProject.map +++ b/Debug/MyProject.map @@ -250,7 +250,7 @@ END GROUP 0x20084000 __top_RamAHB32 = 0x20084000 0x20084000 __top_RAM2 = 0x20084000 -.text 0x00000000 0x3aafc +.text 0x00000000 0x3ab20 FILL mask 0xff 0x00000000 __vectors_start__ = ABSOLUTE (.) *(.isr_vector) @@ -259,10 +259,10 @@ END GROUP 0x000000cc . = ALIGN (0x4) 0x000000cc __section_table_start = . 0x000000cc __data_section_table = . - 0x000000cc 0x4 LONG 0x3aafc LOADADDR (.data) + 0x000000cc 0x4 LONG 0x3ab20 LOADADDR (.data) 0x000000d0 0x4 LONG 0x10000000 ADDR (.data) 0x000000d4 0x4 LONG 0x1c SIZEOF (.data) - 0x000000d8 0x4 LONG 0x3aafc LOADADDR (.data_RAM2) + 0x000000d8 0x4 LONG 0x3ab20 LOADADDR (.data_RAM2) 0x000000dc 0x4 LONG 0x2007c000 ADDR (.data_RAM2) 0x000000e0 0x4 LONG 0x0 SIZEOF (.data_RAM2) 0x000000e4 __data_section_table_end = . @@ -431,12 +431,12 @@ END GROUP .text.EINT3_IRQHandler 0x00001184 0x18 ./src/main.o 0x00001184 EINT3_IRQHandler - .text.SysTick_Handler - 0x0000119c 0x48 ./src/main.o - 0x0000119c SysTick_Handler .text.increment_scroll - 0x000011e4 0x44 ./src/main.o - 0x000011e4 increment_scroll + 0x0000119c 0x44 ./src/main.o + 0x0000119c increment_scroll + .text.SysTick_Handler + 0x000011e0 0x48 ./src/main.o + 0x000011e0 SysTick_Handler .text.number_of_digits 0x00001228 0x40 ./src/main.o 0x00001228 number_of_digits @@ -447,63 +447,63 @@ END GROUP 0x000012e4 0x9c ./src/main.o 0x000012e4 CreatePlayer .text.RefreshPlayer - 0x00001380 0xa4 ./src/main.o + 0x00001380 0xd0 ./src/main.o 0x00001380 RefreshPlayer - .text.main 0x00001424 0x1dc ./src/main.o - 0x00001424 main - .text.memcpy 0x00001600 0x4 /Applications/MCUXpressoIDE_11.9.0_2144/ide/plugins/com.nxp.mcuxpresso.tools.macosx_11.9.0.202307121226/tools/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/lib/thumb/v7-m/nofp/libcr_c.a(memcpy.o) - 0x00001600 memcpy + .text.main 0x00001450 0x1d4 ./src/main.o + 0x00001450 main + .text.memcpy 0x00001624 0x4 /Applications/MCUXpressoIDE_11.9.0_2144/ide/plugins/com.nxp.mcuxpresso.tools.macosx_11.9.0.202307121226/tools/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/lib/thumb/v7-m/nofp/libcr_c.a(memcpy.o) + 0x00001624 memcpy .text.__weak_main - 0x00001604 0x4 /Applications/MCUXpressoIDE_11.9.0_2144/ide/plugins/com.nxp.mcuxpresso.tools.macosx_11.9.0.202307121226/tools/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/lib/thumb/v7-m/nofp/libcr_c.a(__weak__main.o) - 0x00001604 __main - 0x00001604 __weak_main + 0x00001628 0x4 /Applications/MCUXpressoIDE_11.9.0_2144/ide/plugins/com.nxp.mcuxpresso.tools.macosx_11.9.0.202307121226/tools/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/lib/thumb/v7-m/nofp/libcr_c.a(__weak__main.o) + 0x00001628 __main + 0x00001628 __weak_main .text.__aeabi_memcpy - 0x00001608 0x34 /Applications/MCUXpressoIDE_11.9.0_2144/ide/plugins/com.nxp.mcuxpresso.tools.macosx_11.9.0.202307121226/tools/bin/../lib/gcc/arm-none-eabi/12.3.1/thumb/v7-m/nofp/libcr_eabihelpers.a(memcpy.o) - 0x00001608 __aeabi_memcpy - 0x00001612 __aeabi_memcpy4 - 0x00001612 __aeabi_memcpy8 + 0x0000162c 0x34 /Applications/MCUXpressoIDE_11.9.0_2144/ide/plugins/com.nxp.mcuxpresso.tools.macosx_11.9.0.202307121226/tools/bin/../lib/gcc/arm-none-eabi/12.3.1/thumb/v7-m/nofp/libcr_eabihelpers.a(memcpy.o) + 0x0000162c __aeabi_memcpy + 0x00001636 __aeabi_memcpy4 + 0x00001636 __aeabi_memcpy8 *(.rodata .rodata.* .constdata .constdata.*) - .rodata.SMPTE 0x0000163c 0x38410 ./src/SPI.o + .rodata.SMPTE 0x00001660 0x38410 ./src/SPI.o .rodata.ShipSprite1 - 0x00039a4c 0xc10 ./src/SPI.o - 0x00039a4c ShipSprite1 + 0x00039a70 0xc10 ./src/SPI.o + 0x00039a70 ShipSprite1 .rodata.SmallFont - 0x0003a65c 0x478 ./src/fonts.o - 0x0003a65c SmallFont + 0x0003a680 0x478 ./src/fonts.o + 0x0003a680 SmallFont .rodata.SCREEN - 0x0003aad4 0x10 ./src/main.o - 0x0003aad4 SCREEN - .rodata 0x0003aae4 0x18 ./src/main.o - 0x0003aafc . = ALIGN (0x4) + 0x0003aaf8 0x10 ./src/main.o + 0x0003aaf8 SCREEN + .rodata 0x0003ab08 0x18 ./src/main.o + 0x0003ab20 . = ALIGN (0x4) -.glue_7 0x0003aafc 0x0 - .glue_7 0x0003aafc 0x0 linker stubs +.glue_7 0x0003ab20 0x0 + .glue_7 0x0003ab20 0x0 linker stubs -.glue_7t 0x0003aafc 0x0 - .glue_7t 0x0003aafc 0x0 linker stubs +.glue_7t 0x0003ab20 0x0 + .glue_7t 0x0003ab20 0x0 linker stubs -.vfp11_veneer 0x0003aafc 0x0 - .vfp11_veneer 0x0003aafc 0x0 linker stubs +.vfp11_veneer 0x0003ab20 0x0 + .vfp11_veneer 0x0003ab20 0x0 linker stubs -.v4_bx 0x0003aafc 0x0 - .v4_bx 0x0003aafc 0x0 linker stubs +.v4_bx 0x0003ab20 0x0 + .v4_bx 0x0003ab20 0x0 linker stubs -.iplt 0x0003aafc 0x0 - .iplt 0x0003aafc 0x0 ./src/SPI.o +.iplt 0x0003ab20 0x0 + .iplt 0x0003ab20 0x0 ./src/SPI.o -.rel.dyn 0x0003aafc 0x0 - .rel.iplt 0x0003aafc 0x0 ./src/SPI.o +.rel.dyn 0x0003ab20 0x0 + .rel.iplt 0x0003ab20 0x0 ./src/SPI.o .ARM.extab *(.ARM.extab* .gnu.linkonce.armextab.*) -.ARM.exidx 0x0003aafc 0x0 - 0x0003aafc __exidx_start = . +.ARM.exidx 0x0003ab20 0x0 + 0x0003ab20 __exidx_start = . *(.ARM.exidx* .gnu.linkonce.armexidx.*) - 0x0003aafc __exidx_end = . - 0x0003aafc _etext = . + 0x0003ab20 __exidx_end = . + 0x0003ab20 _etext = . -.data_RAM2 0x2007c000 0x0 load address 0x0003aafc +.data_RAM2 0x2007c000 0x0 load address 0x0003ab20 FILL mask 0xff [!provide] PROVIDE (__start_data_RAM2 = .) [!provide] PROVIDE (__start_data_RamAHB32 = .) @@ -524,7 +524,7 @@ END GROUP 0x10000000 . = ALIGN (0x4) 0x10000000 _end_uninit_RESERVED = . -.data 0x10000000 0x1c load address 0x0003aafc +.data 0x10000000 0x1c load address 0x0003ab20 FILL mask 0xff 0x10000000 _data = . [!provide] PROVIDE (__start_data_RAM = .) @@ -552,7 +552,7 @@ END GROUP [!provide] PROVIDE (__end_data_RAM = .) [!provide] PROVIDE (__end_data_RamLoc32 = .) -.igot.plt 0x1000001c 0x0 load address 0x0003ab18 +.igot.plt 0x1000001c 0x0 load address 0x0003ab3c .igot.plt 0x1000001c 0x0 ./src/SPI.o .bss_RAM2 0x2007c000 0x0 @@ -614,32 +614,32 @@ END GROUP 0x10008000 PROVIDE (_vStackTop = DEFINED (__user_stack_top)?__user_stack_top:(__top_RamLoc32 - 0x0)) 0xefff74b2 PROVIDE (__valid_user_code_checksum = (0x0 - ((((((_vStackTop + (ResetISR + 0x1)) + (NMI_Handler + 0x1)) + (HardFault_Handler + 0x1)) + (DEFINED (MemManage_Handler)?MemManage_Handler:0x0 + 0x1)) + (DEFINED (BusFault_Handler)?BusFault_Handler:0x0 + 0x1)) + (DEFINED (UsageFault_Handler)?UsageFault_Handler:0x0 + 0x1)))) 0x00000000 _image_start = LOADADDR (.text) - 0x0003ab18 _image_end = (LOADADDR (.data) + SIZEOF (.data)) - 0x0003ab18 _image_size = (_image_end - _image_start) + 0x0003ab3c _image_end = (LOADADDR (.data) + SIZEOF (.data)) + 0x0003ab3c _image_size = (_image_end - _image_start) OUTPUT(MyProject.axf elf32-littlearm) LOAD linker stubs -.debug_info 0x00000000 0x18f7 +.debug_info 0x00000000 0x18c4 .debug_info 0x00000000 0x208 ./src/GPIO.o .debug_info 0x00000208 0xa58 ./src/SPI.o .debug_info 0x00000c60 0x29d ./src/cr_startup_lpc175x_6x.o .debug_info 0x00000efd 0x40 ./src/crp.o .debug_info 0x00000f3d 0xc9 ./src/fonts.o .debug_info 0x00001006 0xb5 ./src/init_clk.o - .debug_info 0x000010bb 0x6d9 ./src/main.o - .debug_info 0x00001794 0x119 /Applications/MCUXpressoIDE_11.9.0_2144/ide/plugins/com.nxp.mcuxpresso.tools.macosx_11.9.0.202307121226/tools/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/lib/thumb/v7-m/nofp/libcr_c.a(memcpy.o) - .debug_info 0x000018ad 0x4a /Applications/MCUXpressoIDE_11.9.0_2144/ide/plugins/com.nxp.mcuxpresso.tools.macosx_11.9.0.202307121226/tools/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/lib/thumb/v7-m/nofp/libcr_c.a(__weak__main.o) + .debug_info 0x000010bb 0x6a6 ./src/main.o + .debug_info 0x00001761 0x119 /Applications/MCUXpressoIDE_11.9.0_2144/ide/plugins/com.nxp.mcuxpresso.tools.macosx_11.9.0.202307121226/tools/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/lib/thumb/v7-m/nofp/libcr_c.a(memcpy.o) + .debug_info 0x0000187a 0x4a /Applications/MCUXpressoIDE_11.9.0_2144/ide/plugins/com.nxp.mcuxpresso.tools.macosx_11.9.0.202307121226/tools/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/lib/thumb/v7-m/nofp/libcr_c.a(__weak__main.o) -.debug_abbrev 0x00000000 0x9b9 +.debug_abbrev 0x00000000 0x9b7 .debug_abbrev 0x00000000 0x12b ./src/GPIO.o .debug_abbrev 0x0000012b 0x2c2 ./src/SPI.o .debug_abbrev 0x000003ed 0x14d ./src/cr_startup_lpc175x_6x.o .debug_abbrev 0x0000053a 0x38 ./src/crp.o .debug_abbrev 0x00000572 0x73 ./src/fonts.o .debug_abbrev 0x000005e5 0x83 ./src/init_clk.o - .debug_abbrev 0x00000668 0x24c ./src/main.o - .debug_abbrev 0x000008b4 0xb6 /Applications/MCUXpressoIDE_11.9.0_2144/ide/plugins/com.nxp.mcuxpresso.tools.macosx_11.9.0.202307121226/tools/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/lib/thumb/v7-m/nofp/libcr_c.a(memcpy.o) - .debug_abbrev 0x0000096a 0x4f /Applications/MCUXpressoIDE_11.9.0_2144/ide/plugins/com.nxp.mcuxpresso.tools.macosx_11.9.0.202307121226/tools/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/lib/thumb/v7-m/nofp/libcr_c.a(__weak__main.o) + .debug_abbrev 0x00000668 0x24a ./src/main.o + .debug_abbrev 0x000008b2 0xb6 /Applications/MCUXpressoIDE_11.9.0_2144/ide/plugins/com.nxp.mcuxpresso.tools.macosx_11.9.0.202307121226/tools/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/lib/thumb/v7-m/nofp/libcr_c.a(memcpy.o) + .debug_abbrev 0x00000968 0x4f /Applications/MCUXpressoIDE_11.9.0_2144/ide/plugins/com.nxp.mcuxpresso.tools.macosx_11.9.0.202307121226/tools/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/lib/thumb/v7-m/nofp/libcr_c.a(__weak__main.o) .debug_aranges 0x00000000 0x2d0 .debug_aranges @@ -687,16 +687,16 @@ LOAD linker stubs .debug_macro 0x000014d7 0x112 ./src/init_clk.o .debug_macro 0x000015e9 0x62 ./src/main.o -.debug_line 0x00000000 0x1879 +.debug_line 0x00000000 0x1895 .debug_line 0x00000000 0x358 ./src/GPIO.o .debug_line 0x00000358 0x8eb ./src/SPI.o .debug_line 0x00000c43 0x161 ./src/cr_startup_lpc175x_6x.o .debug_line 0x00000da4 0xb9 ./src/crp.o .debug_line 0x00000e5d 0x3a ./src/fonts.o .debug_line 0x00000e97 0x3c8 ./src/init_clk.o - .debug_line 0x0000125f 0x535 ./src/main.o - .debug_line 0x00001794 0x9b /Applications/MCUXpressoIDE_11.9.0_2144/ide/plugins/com.nxp.mcuxpresso.tools.macosx_11.9.0.202307121226/tools/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/lib/thumb/v7-m/nofp/libcr_c.a(memcpy.o) - .debug_line 0x0000182f 0x4a /Applications/MCUXpressoIDE_11.9.0_2144/ide/plugins/com.nxp.mcuxpresso.tools.macosx_11.9.0.202307121226/tools/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/lib/thumb/v7-m/nofp/libcr_c.a(__weak__main.o) + .debug_line 0x0000125f 0x551 ./src/main.o + .debug_line 0x000017b0 0x9b /Applications/MCUXpressoIDE_11.9.0_2144/ide/plugins/com.nxp.mcuxpresso.tools.macosx_11.9.0.202307121226/tools/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/lib/thumb/v7-m/nofp/libcr_c.a(memcpy.o) + .debug_line 0x0000184b 0x4a /Applications/MCUXpressoIDE_11.9.0_2144/ide/plugins/com.nxp.mcuxpresso.tools.macosx_11.9.0.202307121226/tools/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/lib/thumb/v7-m/nofp/libcr_c.a(__weak__main.o) .debug_str 0x00000000 0x5dd3 .debug_str 0x00000000 0x5145 ./src/GPIO.o diff --git a/Debug/MyProject_Debug.ld b/Debug/MyProject_Debug.ld index 931a5ea..b1003fb 100644 --- a/Debug/MyProject_Debug.ld +++ b/Debug/MyProject_Debug.ld @@ -5,7 +5,7 @@ * Generated linker script file for LPC1769 * Created from linkscript.ldt by FMCreateLinkLibraries * Using Freemarker v2.3.30 - * MCUXpresso IDE v11.9.0 [Build 2144] [2024-01-05] on Jun 13, 2024, 4:17:52 PM + * MCUXpresso IDE v11.9.0 [Build 2144] [2024-01-05] on Jun 13, 2024, 5:02:02 PM */ INCLUDE "MyProject_Debug_library.ld" diff --git a/Debug/MyProject_Debug_library.ld b/Debug/MyProject_Debug_library.ld index d60b883..00501b4 100644 --- a/Debug/MyProject_Debug_library.ld +++ b/Debug/MyProject_Debug_library.ld @@ -5,7 +5,7 @@ * Generated linker script file for LPC1769 * Created from library.ldt by FMCreateLinkLibraries * Using Freemarker v2.3.30 - * MCUXpresso IDE v11.9.0 [Build 2144] [2024-01-05] on Jun 13, 2024, 4:17:52 PM + * MCUXpresso IDE v11.9.0 [Build 2144] [2024-01-05] on Jun 13, 2024, 5:02:02 PM */ GROUP ( diff --git a/Debug/MyProject_Debug_memory.ld b/Debug/MyProject_Debug_memory.ld index eea9b1c..6ce0e9f 100644 --- a/Debug/MyProject_Debug_memory.ld +++ b/Debug/MyProject_Debug_memory.ld @@ -5,7 +5,7 @@ * Generated linker script file for LPC1769 * Created from memory.ldt by FMCreateLinkMemory * Using Freemarker v2.3.30 - * MCUXpresso IDE v11.9.0 [Build 2144] [2024-01-05] on Jun 13, 2024, 4:17:52 PM + * MCUXpresso IDE v11.9.0 [Build 2144] [2024-01-05] on Jun 13, 2024, 5:02:02 PM */ MEMORY diff --git a/Debug/src/main.o b/Debug/src/main.o index 3631527..72e0273 100644 Binary files a/Debug/src/main.o and b/Debug/src/main.o differ diff --git a/Debug/src/main.su b/Debug/src/main.su index ccfaa5e..cf5e6c4 100644 --- a/Debug/src/main.su +++ b/Debug/src/main.su @@ -1,11 +1,11 @@ ../src/main.c:24:6:init 8 static ../src/main.c:33:6:TIMER0_IRQHandler 8 static ../src/main.c:42:6:EINT3_IRQHandler 16 static -../src/main.c:55:6:SysTick_Handler 8 static -../src/main.c:65:6:increment_scroll 16 static -../src/main.c:73:5:number_of_digits 24 static -../src/main.c:83:6:convert_to_string 40 static -../src/main.c:94:6:scroll_array 32 static -../src/main.c:103:8:CreatePlayer 80 static -../src/main.c:112:6:RefreshPlayer 72 static -../src/main.c:133:5:main 136 dynamic +../src/main.c:55:6:increment_scroll 16 static +../src/main.c:62:6:SysTick_Handler 8 static +../src/main.c:72:5:number_of_digits 24 static +../src/main.c:82:6:convert_to_string 40 static +../src/main.c:93:6:scroll_array 32 static +../src/main.c:102:8:CreatePlayer 80 static +../src/main.c:111:6:RefreshPlayer 72 static +../src/main.c:136:5:main 136 dynamic diff --git a/src/GPIO.h b/src/GPIO.h index 1e6543c..aa4768d 100644 --- a/src/GPIO.h +++ b/src/GPIO.h @@ -19,6 +19,8 @@ void ClearButtons(); void InitTimer(); +void InitAudio(); + #endif diff --git a/src/main.c b/src/main.c index c00fee7..2331df5 100644 --- a/src/main.c +++ b/src/main.c @@ -52,6 +52,13 @@ void EINT3_IRQHandler(void){ int timer_count = 0; int scroller_divider = 25; int scroll_increment = 1; +void increment_scroll(int value){ + scrolling += value; + if(scrolling <= 0) + scrolling = 319; + if(scrolling >= 320) + scrolling = 1; +} void SysTick_Handler(){ timer_count += 1; //update the screen @@ -62,14 +69,6 @@ void SysTick_Handler(){ } } -void increment_scroll(int value){ - scrolling += value; - if(scrolling <= 0) - scrolling = 319; - if(scrolling >= 320) - scrolling = 1; -} - int number_of_digits (int value){ int interVal = value; int count = 0; @@ -110,16 +109,20 @@ Player CreatePlayer(){ } void RefreshPlayer(Point vector){ - + if(player.Hitbox.Position.Y + vector.Y < 0){ + player.Hitbox.Position.Y = SCREEN_SIZE.Height - (0-vector.Y); + }else{ + if(player.Hitbox.Position.Y + vector.Y >= SCREEN_SIZE.Height){ + player.Hitbox.Position.Y = vector.Y - (SCREEN_SIZE.Height - player.Hitbox.Position.Y); + }else{ + player.Hitbox.Position.Y += vector.Y; + } + } player.Hitbox.Position.X += vector.X; - player.Hitbox.Position.Y += vector.Y; - if(player.Hitbox.Position.Y < 0) - player.Hitbox.Position.Y = SCREEN_SIZE.Height - 1; - - if(player.Hitbox.Position.X + player.Hitbox.Size.Width > SCREEN_SIZE.Width) - player.Hitbox.Position.X = SCREEN_SIZE.Width - player.Hitbox.Size.Width; + if(player.Hitbox.Position.X + player.Hitbox.Size.Width >= SCREEN_SIZE.Width) + player.Hitbox.Position.X = SCREEN_SIZE.Width - player.Hitbox.Size.Width -1; if(player.Hitbox.Position.X < 0) player.Hitbox.Position.X = 0; @@ -143,10 +146,11 @@ int main(void) { Resize_Window(SCREEN); Draw_stars(); + Point vec = {0,0}; + int increment = 5; + while (true) { - Point vec = {0,0}; - int increment = 1; int JoystickState = JoystickGetState(); if(JoystickState & (1 << 4)){ @@ -164,9 +168,8 @@ int main(void) { if(need_to_scroll){ scroll(scrolling); - need_to_scroll = false; - vec.Y -= 1; + need_to_scroll = false; int digits = number_of_digits(scrolling); char newStr[digits+1]; @@ -179,8 +182,10 @@ int main(void) { DrawText(new_origin,newStr,charSize); } - if(need_to_scroll || vec.X != 0 || vec.Y != 0) + if(vec.X != 0 || vec.Y != 0){ RefreshPlayer(vec); + } + } }