diff --git a/Debug/MyProject.axf b/Debug/MyProject.axf index 3725eea..993a0c2 100755 Binary files a/Debug/MyProject.axf and b/Debug/MyProject.axf differ diff --git a/Debug/MyProject.map b/Debug/MyProject.map index afc1ba2..a181ea8 100644 --- a/Debug/MyProject.map +++ b/Debug/MyProject.map @@ -22,8 +22,6 @@ Discarded input sections .bss 0x00000000 0x0 ./src/GPIO.o .text.LedSetState 0x00000000 0x48 ./src/GPIO.o - .text.JoystickGetState - 0x00000000 0x34 ./src/GPIO.o .text.JoystickTestState 0x00000000 0x26 ./src/GPIO.o .group 0x00000000 0xc ./src/SPI.o @@ -51,7 +49,7 @@ Discarded input sections .debug_macro 0x00000000 0x12e ./src/SPI.o .debug_macro 0x00000000 0x5b3 ./src/SPI.o .debug_macro 0x00000000 0x22 ./src/SPI.o - .debug_macro 0x00000000 0x178 ./src/SPI.o + .debug_macro 0x00000000 0x196 ./src/SPI.o .group 0x00000000 0xc ./src/cr_startup_lpc175x_6x.o .text 0x00000000 0x0 ./src/cr_startup_lpc175x_6x.o .data 0x00000000 0x0 ./src/cr_startup_lpc175x_6x.o @@ -92,7 +90,7 @@ Discarded input sections .debug_macro 0x00000000 0x12e ./src/init_clk.o .debug_macro 0x00000000 0x5b3 ./src/init_clk.o .debug_macro 0x00000000 0x22 ./src/init_clk.o - .debug_macro 0x00000000 0x178 ./src/init_clk.o + .debug_macro 0x00000000 0x196 ./src/init_clk.o .group 0x00000000 0xc ./src/main.o .group 0x00000000 0xc ./src/main.o .group 0x00000000 0xc ./src/main.o @@ -109,7 +107,7 @@ Discarded input sections .text.scroll_array 0x00000000 0x7e ./src/main.o .debug_macro 0x00000000 0xab4 ./src/main.o - .debug_macro 0x00000000 0x178 ./src/main.o + .debug_macro 0x00000000 0x196 ./src/main.o .debug_macro 0x00000000 0x10 ./src/main.o .debug_macro 0x00000000 0x12e ./src/main.o .debug_macro 0x00000000 0x5b3 ./src/main.o @@ -234,7 +232,7 @@ END GROUP 0x20084000 __top_RamAHB32 = 0x20084000 0x20084000 __top_RAM2 = 0x20084000 -.text 0x00000000 0x39968 +.text 0x00000000 0x39c80 FILL mask 0xff 0x00000000 __vectors_start__ = ABSOLUTE (.) *(.isr_vector) @@ -243,16 +241,16 @@ END GROUP 0x000000cc . = ALIGN (0x4) 0x000000cc __section_table_start = . 0x000000cc __data_section_table = . - 0x000000cc 0x4 LONG 0x39968 LOADADDR (.data) + 0x000000cc 0x4 LONG 0x39c80 LOADADDR (.data) 0x000000d0 0x4 LONG 0x10000000 ADDR (.data) - 0x000000d4 0x4 LONG 0x14 SIZEOF (.data) - 0x000000d8 0x4 LONG 0x39968 LOADADDR (.data_RAM2) + 0x000000d4 0x4 LONG 0x1c SIZEOF (.data) + 0x000000d8 0x4 LONG 0x39c80 LOADADDR (.data_RAM2) 0x000000dc 0x4 LONG 0x2007c000 ADDR (.data_RAM2) 0x000000e0 0x4 LONG 0x0 SIZEOF (.data_RAM2) 0x000000e4 __data_section_table_end = . 0x000000e4 __bss_section_table = . - 0x000000e4 0x4 LONG 0x10000014 ADDR (.bss) - 0x000000e8 0x4 LONG 0xc SIZEOF (.bss) + 0x000000e4 0x4 LONG 0x1000001c ADDR (.bss) + 0x000000e8 0x4 LONG 0x20 SIZEOF (.bss) 0x000000ec 0x4 LONG 0x2007c000 ADDR (.bss_RAM2) 0x000000f0 0x4 LONG 0x0 SIZEOF (.bss_RAM2) 0x000000f4 __bss_section_table_end = . @@ -290,7 +288,6 @@ END GROUP 0x00000230 I2S_IRQHandler 0x00000230 I2C2_IRQHandler 0x00000230 RTC_IRQHandler - 0x00000230 TIMER0_IRQHandler 0x00000230 SPI_IRQHandler 0x00000230 EINT1_IRQHandler 0x00000230 TIMER1_IRQHandler @@ -318,140 +315,164 @@ END GROUP .text.LedSetState8 0x00000300 0x34 ./src/GPIO.o 0x00000300 LedSetState8 - .text.DelaiMs 0x00000334 0x34 ./src/GPIO.o - 0x00000334 DelaiMs + .text.JoystickGetState + 0x00000334 0x34 ./src/GPIO.o + 0x00000334 JoystickGetState + .text.DelaiMs 0x00000368 0x34 ./src/GPIO.o + 0x00000368 DelaiMs .text.InitButtons - 0x00000368 0x30 ./src/GPIO.o - 0x00000368 InitButtons + 0x0000039c 0x30 ./src/GPIO.o + 0x0000039c InitButtons .text.Detect_AB_buttons - 0x00000398 0x34 ./src/GPIO.o - 0x00000398 Detect_AB_buttons + 0x000003cc 0x34 ./src/GPIO.o + 0x000003cc Detect_AB_buttons .text.InitTimer - 0x000003cc 0x24 ./src/GPIO.o - 0x000003cc InitTimer + 0x00000400 0x24 ./src/GPIO.o + 0x00000400 InitTimer + .text.InitAudio + 0x00000424 0x4c ./src/GPIO.o + 0x00000424 InitAudio + .text.ClearTimer0 + 0x00000470 0x14 ./src/GPIO.o + 0x00000470 ClearTimer0 + .text.SetAudio + 0x00000484 0x20 ./src/GPIO.o + 0x00000484 SetAudio .text.ClearButtons - 0x000003f0 0x24 ./src/GPIO.o - 0x000003f0 ClearButtons + 0x000004a4 0x24 ./src/GPIO.o + 0x000004a4 ClearButtons .text.Init_SPI - 0x00000414 0x80 ./src/SPI.o - 0x00000414 Init_SPI + 0x000004c8 0x80 ./src/SPI.o + 0x000004c8 Init_SPI .text.DC_MODE_DATA - 0x00000494 0x1c ./src/SPI.o - 0x00000494 DC_MODE_DATA + 0x00000548 0x1c ./src/SPI.o + 0x00000548 DC_MODE_DATA .text.DC_MODE_COMMAND - 0x000004b0 0x1c ./src/SPI.o - 0x000004b0 DC_MODE_COMMAND - .text.CS_UP 0x000004cc 0x18 ./src/SPI.o - 0x000004cc CS_UP - .text.CS_DOWN 0x000004e4 0x18 ./src/SPI.o - 0x000004e4 CS_DOWN + 0x00000564 0x1c ./src/SPI.o + 0x00000564 DC_MODE_COMMAND + .text.CS_UP 0x00000580 0x18 ./src/SPI.o + 0x00000580 CS_UP + .text.CS_DOWN 0x00000598 0x18 ./src/SPI.o + 0x00000598 CS_DOWN .text.Write_Cmd - 0x000004fc 0x38 ./src/SPI.o - 0x000004fc Write_Cmd + 0x000005b0 0x38 ./src/SPI.o + 0x000005b0 Write_Cmd .text.Write_Cmd_Data - 0x00000534 0x38 ./src/SPI.o - 0x00000534 Write_Cmd_Data + 0x000005e8 0x38 ./src/SPI.o + 0x000005e8 Write_Cmd_Data .text.ILI9341_Initial - 0x0000056c 0x234 ./src/SPI.o - 0x0000056c ILI9341_Initial + 0x00000620 0x234 ./src/SPI.o + 0x00000620 ILI9341_Initial .text.Split_Uint8 - 0x000007a0 0x2e ./src/SPI.o - 0x000007a0 Split_Uint8 + 0x00000854 0x2e ./src/SPI.o + 0x00000854 Split_Uint8 .text.SendPixel - 0x000007ce 0x78 ./src/SPI.o - 0x000007ce SendPixel - *fill* 0x00000846 0x2 ff + 0x00000882 0x78 ./src/SPI.o + 0x00000882 SendPixel + *fill* 0x000008fa 0x2 ff .text.Resize_Window - 0x00000848 0xc4 ./src/SPI.o - 0x00000848 Resize_Window - .text.scroll 0x0000090c 0x38 ./src/SPI.o - 0x0000090c scroll + 0x000008fc 0xc4 ./src/SPI.o + 0x000008fc Resize_Window + .text.scroll 0x000009c0 0x38 ./src/SPI.o + 0x000009c0 scroll .text.Get_Color_From_Background - 0x00000944 0x5c ./src/SPI.o - 0x00000944 Get_Color_From_Background + 0x000009f8 0x5c ./src/SPI.o + 0x000009f8 Get_Color_From_Background .text.auto_screen_roloff - 0x000009a0 0x66 ./src/SPI.o - 0x000009a0 auto_screen_roloff + 0x00000a54 0x66 ./src/SPI.o + 0x00000a54 auto_screen_roloff .text.Refresh_Area - 0x00000a06 0xa6 ./src/SPI.o - 0x00000a06 Refresh_Area + 0x00000aba 0xa6 ./src/SPI.o + 0x00000aba Refresh_Area + .text.DrawPlayer + 0x00000b60 0x74 ./src/SPI.o + 0x00000b60 DrawPlayer .text.Draw_stars - 0x00000aac 0x64 ./src/SPI.o - 0x00000aac Draw_stars - .text.strLen 0x00000b10 0x3a ./src/SPI.o - 0x00000b10 strLen - *fill* 0x00000b4a 0x2 ff + 0x00000bd4 0x64 ./src/SPI.o + 0x00000bd4 Draw_stars + .text.strLen 0x00000c38 0x3a ./src/SPI.o + 0x00000c38 strLen + *fill* 0x00000c72 0x2 ff .text.DrawChar - 0x00000b4c 0x108 ./src/SPI.o - 0x00000b4c DrawChar + 0x00000c74 0x108 ./src/SPI.o + 0x00000c74 DrawChar .text.DrawText - 0x00000c54 0x8c ./src/SPI.o - 0x00000c54 DrawText + 0x00000d7c 0x8c ./src/SPI.o + 0x00000d7c DrawText .text.SystemInit - 0x00000ce0 0x144 ./src/init_clk.o - 0x00000ce0 SystemInit - .text.init 0x00000e24 0xc ./src/main.o - 0x00000e24 init + 0x00000e08 0x144 ./src/init_clk.o + 0x00000e08 SystemInit + .text.init 0x00000f4c 0xc ./src/main.o + 0x00000f4c init + .text.TIMER0_IRQHandler + 0x00000f58 0x34 ./src/main.o + 0x00000f58 TIMER0_IRQHandler .text.EINT3_IRQHandler - 0x00000e30 0x18 ./src/main.o - 0x00000e30 EINT3_IRQHandler + 0x00000f8c 0x18 ./src/main.o + 0x00000f8c EINT3_IRQHandler .text.SysTick_Handler - 0x00000e48 0x40 ./src/main.o - 0x00000e48 SysTick_Handler + 0x00000fa4 0x48 ./src/main.o + 0x00000fa4 SysTick_Handler .text.increment_scroll - 0x00000e88 0x44 ./src/main.o - 0x00000e88 increment_scroll + 0x00000fec 0x44 ./src/main.o + 0x00000fec increment_scroll .text.number_of_digits - 0x00000ecc 0x40 ./src/main.o - 0x00000ecc number_of_digits + 0x00001030 0x40 ./src/main.o + 0x00001030 number_of_digits .text.convert_to_string - 0x00000f0c 0x7c ./src/main.o - 0x00000f0c convert_to_string - .text.main 0x00000f88 0x134 ./src/main.o - 0x00000f88 main + 0x00001070 0x7c ./src/main.o + 0x00001070 convert_to_string + .text.CreatePlayer + 0x000010ec 0x9c ./src/main.o + 0x000010ec CreatePlayer + .text.RefreshPlayer + 0x00001188 0x7c ./src/main.o + 0x00001188 RefreshPlayer + .text.main 0x00001204 0x1c8 ./src/main.o + 0x00001204 main .text.__weak_main - 0x000010bc 0x4 /usr/local/mcuxpressoide-11.9.0_2144/ide/plugins/com.nxp.mcuxpresso.tools.linux_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) - 0x000010bc __main - 0x000010bc __weak_main + 0x000013cc 0x4 /usr/local/mcuxpressoide-11.9.0_2144/ide/plugins/com.nxp.mcuxpresso.tools.linux_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) + 0x000013cc __main + 0x000013cc __weak_main *(.rodata .rodata.* .constdata .constdata.*) - .rodata.SMPTE 0x000010c0 0x38410 ./src/SPI.o + .rodata.SMPTE 0x000013d0 0x38410 ./src/SPI.o .rodata.SmallFont - 0x000394d0 0x478 ./src/fonts.o - 0x000394d0 SmallFont + 0x000397e0 0x478 ./src/fonts.o + 0x000397e0 SmallFont .rodata.SCREEN - 0x00039948 0x10 ./src/main.o - 0x00039948 SCREEN - .rodata 0x00039958 0x10 ./src/main.o - 0x00039968 . = ALIGN (0x4) + 0x00039c58 0x10 ./src/main.o + 0x00039c58 SCREEN + .rodata 0x00039c68 0x18 ./src/main.o + 0x00039c80 . = ALIGN (0x4) -.glue_7 0x00039968 0x0 - .glue_7 0x00039968 0x0 linker stubs +.glue_7 0x00039c80 0x0 + .glue_7 0x00039c80 0x0 linker stubs -.glue_7t 0x00039968 0x0 - .glue_7t 0x00039968 0x0 linker stubs +.glue_7t 0x00039c80 0x0 + .glue_7t 0x00039c80 0x0 linker stubs -.vfp11_veneer 0x00039968 0x0 - .vfp11_veneer 0x00039968 0x0 linker stubs +.vfp11_veneer 0x00039c80 0x0 + .vfp11_veneer 0x00039c80 0x0 linker stubs -.v4_bx 0x00039968 0x0 - .v4_bx 0x00039968 0x0 linker stubs +.v4_bx 0x00039c80 0x0 + .v4_bx 0x00039c80 0x0 linker stubs -.iplt 0x00039968 0x0 - .iplt 0x00039968 0x0 ./src/SPI.o +.iplt 0x00039c80 0x0 + .iplt 0x00039c80 0x0 ./src/SPI.o -.rel.dyn 0x00039968 0x0 - .rel.iplt 0x00039968 0x0 ./src/SPI.o +.rel.dyn 0x00039c80 0x0 + .rel.iplt 0x00039c80 0x0 ./src/SPI.o .ARM.extab *(.ARM.extab* .gnu.linkonce.armextab.*) -.ARM.exidx 0x00039968 0x0 - 0x00039968 __exidx_start = . +.ARM.exidx 0x00039c80 0x0 + 0x00039c80 __exidx_start = . *(.ARM.exidx* .gnu.linkonce.armexidx.*) - 0x00039968 __exidx_end = . - 0x00039968 _etext = . + 0x00039c80 __exidx_end = . + 0x00039c80 _etext = . -.data_RAM2 0x2007c000 0x0 load address 0x00039968 +.data_RAM2 0x2007c000 0x0 load address 0x00039c80 FILL mask 0xff [!provide] PROVIDE (__start_data_RAM2 = .) [!provide] PROVIDE (__start_data_RamAHB32 = .) @@ -472,7 +493,7 @@ END GROUP 0x10000000 . = ALIGN (0x4) 0x10000000 _end_uninit_RESERVED = . -.data 0x10000000 0x14 load address 0x00039968 +.data 0x10000000 0x1c load address 0x00039c80 FILL mask 0xff 0x10000000 _data = . [!provide] PROVIDE (__start_data_RAM = .) @@ -486,16 +507,22 @@ END GROUP .data.viewPort 0x10000000 0x10 ./src/SPI.o 0x10000000 viewPort + .data.on 0x10000010 0x1 ./src/main.o + 0x10000010 on + *fill* 0x10000011 0x3 ff .data.scroller_divider - 0x10000010 0x4 ./src/main.o - 0x10000010 scroller_divider - 0x10000014 . = ALIGN (0x4) - 0x10000014 _edata = . + 0x10000014 0x4 ./src/main.o + 0x10000014 scroller_divider + .data.scroll_increment + 0x10000018 0x4 ./src/main.o + 0x10000018 scroll_increment + 0x1000001c . = ALIGN (0x4) + 0x1000001c _edata = . [!provide] PROVIDE (__end_data_RAM = .) [!provide] PROVIDE (__end_data_RamLoc32 = .) -.igot.plt 0x10000014 0x0 load address 0x0003997c - .igot.plt 0x10000014 0x0 ./src/SPI.o +.igot.plt 0x1000001c 0x0 load address 0x00039c9c + .igot.plt 0x1000001c 0x0 ./src/SPI.o .bss_RAM2 0x2007c000 0x0 [!provide] PROVIDE (__start_bss_RAM2 = .) @@ -508,24 +535,26 @@ END GROUP [!provide] PROVIDE (__end_bss_RAM2 = .) [!provide] PROVIDE (__end_bss_RamAHB32 = .) -.bss 0x10000014 0xc - 0x10000014 _bss = . +.bss 0x1000001c 0x20 + 0x1000001c _bss = . [!provide] PROVIDE (__start_bss_RAM = .) [!provide] PROVIDE (__start_bss_RamLoc32 = .) *(.bss*) + .bss.player 0x1000001c 0x14 ./src/main.o + 0x1000001c player .bss.scrolling - 0x10000014 0x4 ./src/main.o - 0x10000014 scrolling + 0x10000030 0x4 ./src/main.o + 0x10000030 scrolling .bss.need_to_scroll - 0x10000018 0x1 ./src/main.o - 0x10000018 need_to_scroll - *fill* 0x10000019 0x3 + 0x10000034 0x1 ./src/main.o + 0x10000034 need_to_scroll + *fill* 0x10000035 0x3 .bss.timer_count - 0x1000001c 0x4 ./src/main.o - 0x1000001c timer_count + 0x10000038 0x4 ./src/main.o + 0x10000038 timer_count *(COMMON) - 0x10000020 . = ALIGN (0x4) - 0x10000020 _ebss = . + 0x1000003c . = ALIGN (0x4) + 0x1000003c _ebss = . [!provide] PROVIDE (__end_bss_RAM = .) [!provide] PROVIDE (__end_bss_RamLoc32 = .) [!provide] PROVIDE (end = .) @@ -541,113 +570,113 @@ END GROUP [!provide] PROVIDE (__end_noinit_RAM2 = .) [!provide] PROVIDE (__end_noinit_RamAHB32 = .) -.noinit 0x10000020 0x0 - 0x10000020 _noinit = . +.noinit 0x1000003c 0x0 + 0x1000003c _noinit = . [!provide] PROVIDE (__start_noinit_RAM = .) [!provide] PROVIDE (__start_noinit_RamLoc32 = .) *(.noinit*) - 0x10000020 . = ALIGN (0x4) - 0x10000020 _end_noinit = . + 0x1000003c . = ALIGN (0x4) + 0x1000003c _end_noinit = . [!provide] PROVIDE (__end_noinit_RAM = .) [!provide] PROVIDE (__end_noinit_RamLoc32 = .) [!provide] PROVIDE (_pvHeapStart = DEFINED (__user_heap_base)?__user_heap_base:.) 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) - 0x0003997c _image_end = (LOADADDR (.data) + SIZEOF (.data)) - 0x0003997c _image_size = (_image_end - _image_start) + 0x00039c9c _image_end = (LOADADDR (.data) + SIZEOF (.data)) + 0x00039c9c _image_size = (_image_end - _image_start) OUTPUT(MyProject.axf elf32-littlearm) LOAD linker stubs -.debug_info 0x00000000 0x141d - .debug_info 0x00000000 0x1be ./src/GPIO.o - .debug_info 0x000001be 0x8c5 ./src/SPI.o - .debug_info 0x00000a83 0x29d ./src/cr_startup_lpc175x_6x.o - .debug_info 0x00000d20 0x40 ./src/crp.o - .debug_info 0x00000d60 0xc9 ./src/fonts.o - .debug_info 0x00000e29 0xb5 ./src/init_clk.o - .debug_info 0x00000ede 0x4f5 ./src/main.o - .debug_info 0x000013d3 0x4a /usr/local/mcuxpressoide-11.9.0_2144/ide/plugins/com.nxp.mcuxpresso.tools.linux_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 0x00000000 0x16c3 + .debug_info 0x00000000 0x208 ./src/GPIO.o + .debug_info 0x00000208 0x91d ./src/SPI.o + .debug_info 0x00000b25 0x29d ./src/cr_startup_lpc175x_6x.o + .debug_info 0x00000dc2 0x40 ./src/crp.o + .debug_info 0x00000e02 0xc9 ./src/fonts.o + .debug_info 0x00000ecb 0xb5 ./src/init_clk.o + .debug_info 0x00000f80 0x6f9 ./src/main.o + .debug_info 0x00001679 0x4a /usr/local/mcuxpressoide-11.9.0_2144/ide/plugins/com.nxp.mcuxpresso.tools.linux_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 0x89c +.debug_abbrev 0x00000000 0x8d6 .debug_abbrev 0x00000000 0x12b ./src/GPIO.o .debug_abbrev 0x0000012b 0x28a ./src/SPI.o .debug_abbrev 0x000003b5 0x14d ./src/cr_startup_lpc175x_6x.o .debug_abbrev 0x00000502 0x38 ./src/crp.o .debug_abbrev 0x0000053a 0x73 ./src/fonts.o .debug_abbrev 0x000005ad 0x83 ./src/init_clk.o - .debug_abbrev 0x00000630 0x21d ./src/main.o - .debug_abbrev 0x0000084d 0x4f /usr/local/mcuxpressoide-11.9.0_2144/ide/plugins/com.nxp.mcuxpresso.tools.linux_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 0x00000630 0x257 ./src/main.o + .debug_abbrev 0x00000887 0x4f /usr/local/mcuxpressoide-11.9.0_2144/ide/plugins/com.nxp.mcuxpresso.tools.linux_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 0x270 +.debug_aranges 0x00000000 0x2a8 .debug_aranges - 0x00000000 0x60 ./src/GPIO.o + 0x00000000 0x78 ./src/GPIO.o .debug_aranges - 0x00000060 0xc0 ./src/SPI.o + 0x00000078 0xc8 ./src/SPI.o .debug_aranges - 0x00000120 0x80 ./src/cr_startup_lpc175x_6x.o + 0x00000140 0x80 ./src/cr_startup_lpc175x_6x.o .debug_aranges - 0x000001a0 0x18 ./src/crp.o + 0x000001c0 0x18 ./src/crp.o .debug_aranges - 0x000001b8 0x18 ./src/fonts.o + 0x000001d8 0x18 ./src/fonts.o .debug_aranges - 0x000001d0 0x28 ./src/init_clk.o + 0x000001f0 0x28 ./src/init_clk.o .debug_aranges - 0x000001f8 0x58 ./src/main.o + 0x00000218 0x70 ./src/main.o .debug_aranges - 0x00000250 0x20 /usr/local/mcuxpressoide-11.9.0_2144/ide/plugins/com.nxp.mcuxpresso.tools.linux_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) + 0x00000288 0x20 /usr/local/mcuxpressoide-11.9.0_2144/ide/plugins/com.nxp.mcuxpresso.tools.linux_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_ranges 0x00000000 0x1e0 - .debug_ranges 0x00000000 0x50 ./src/GPIO.o - .debug_ranges 0x00000050 0xb0 ./src/SPI.o - .debug_ranges 0x00000100 0x70 ./src/cr_startup_lpc175x_6x.o - .debug_ranges 0x00000170 0x18 ./src/init_clk.o - .debug_ranges 0x00000188 0x48 ./src/main.o - .debug_ranges 0x000001d0 0x10 /usr/local/mcuxpressoide-11.9.0_2144/ide/plugins/com.nxp.mcuxpresso.tools.linux_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_ranges 0x00000000 0x218 + .debug_ranges 0x00000000 0x68 ./src/GPIO.o + .debug_ranges 0x00000068 0xb8 ./src/SPI.o + .debug_ranges 0x00000120 0x70 ./src/cr_startup_lpc175x_6x.o + .debug_ranges 0x00000190 0x18 ./src/init_clk.o + .debug_ranges 0x000001a8 0x60 ./src/main.o + .debug_ranges 0x00000208 0x10 /usr/local/mcuxpressoide-11.9.0_2144/ide/plugins/com.nxp.mcuxpresso.tools.linux_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_macro 0x00000000 0x1623 +.debug_macro 0x00000000 0x1641 .debug_macro 0x00000000 0x58 ./src/GPIO.o .debug_macro 0x00000058 0xab4 ./src/GPIO.o .debug_macro 0x00000b0c 0x10 ./src/GPIO.o .debug_macro 0x00000b1c 0x12e ./src/GPIO.o .debug_macro 0x00000c4a 0x5b3 ./src/GPIO.o .debug_macro 0x000011fd 0x22 ./src/GPIO.o - .debug_macro 0x0000121f 0x178 ./src/GPIO.o - .debug_macro 0x00001397 0x83 ./src/SPI.o - .debug_macro 0x0000141a 0x10 ./src/SPI.o - .debug_macro 0x0000142a 0x1d ./src/cr_startup_lpc175x_6x.o - .debug_macro 0x00001447 0x1a ./src/crp.o - .debug_macro 0x00001461 0x34 ./src/crp.o - .debug_macro 0x00001495 0x1a ./src/fonts.o - .debug_macro 0x000014af 0x112 ./src/init_clk.o - .debug_macro 0x000015c1 0x62 ./src/main.o + .debug_macro 0x0000121f 0x196 ./src/GPIO.o + .debug_macro 0x000013b5 0x83 ./src/SPI.o + .debug_macro 0x00001438 0x10 ./src/SPI.o + .debug_macro 0x00001448 0x1d ./src/cr_startup_lpc175x_6x.o + .debug_macro 0x00001465 0x1a ./src/crp.o + .debug_macro 0x0000147f 0x34 ./src/crp.o + .debug_macro 0x000014b3 0x1a ./src/fonts.o + .debug_macro 0x000014cd 0x112 ./src/init_clk.o + .debug_macro 0x000015df 0x62 ./src/main.o -.debug_line 0x00000000 0x14fe - .debug_line 0x00000000 0x2e4 ./src/GPIO.o - .debug_line 0x000002e4 0x7ca ./src/SPI.o - .debug_line 0x00000aae 0x161 ./src/cr_startup_lpc175x_6x.o - .debug_line 0x00000c0f 0xb5 ./src/crp.o - .debug_line 0x00000cc4 0x3a ./src/fonts.o - .debug_line 0x00000cfe 0x3c0 ./src/init_clk.o - .debug_line 0x000010be 0x3f6 ./src/main.o - .debug_line 0x000014b4 0x4a /usr/local/mcuxpressoide-11.9.0_2144/ide/plugins/com.nxp.mcuxpresso.tools.linux_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 0x00000000 0x16ec + .debug_line 0x00000000 0x350 ./src/GPIO.o + .debug_line 0x00000350 0x824 ./src/SPI.o + .debug_line 0x00000b74 0x161 ./src/cr_startup_lpc175x_6x.o + .debug_line 0x00000cd5 0xb5 ./src/crp.o + .debug_line 0x00000d8a 0x3a ./src/fonts.o + .debug_line 0x00000dc4 0x3c0 ./src/init_clk.o + .debug_line 0x00001184 0x51e ./src/main.o + .debug_line 0x000016a2 0x4a /usr/local/mcuxpressoide-11.9.0_2144/ide/plugins/com.nxp.mcuxpresso.tools.linux_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 0x5ba2 - .debug_str 0x00000000 0x5049 ./src/GPIO.o - 0x50c8 (size before relaxing) - .debug_str 0x00005049 0x346 ./src/SPI.o - 0x53a5 (size before relaxing) - .debug_str 0x0000538f 0x1ef ./src/cr_startup_lpc175x_6x.o +.debug_str 0x00000000 0x5d2a + .debug_str 0x00000000 0x5142 ./src/GPIO.o + 0x51c1 (size before relaxing) + .debug_str 0x00005142 0x351 ./src/SPI.o + 0x548a (size before relaxing) + .debug_str 0x00005493 0x1ef ./src/cr_startup_lpc175x_6x.o 0x2fed (size before relaxing) - .debug_str 0x0000557e 0xe9 ./src/crp.o + .debug_str 0x00005682 0xe9 ./src/crp.o 0x2ee1 (size before relaxing) - .debug_str 0x00005667 0x27 ./src/fonts.o + .debug_str 0x0000576b 0x27 ./src/fonts.o 0x2e66 (size before relaxing) - .debug_str 0x0000568e 0x2e1 ./src/init_clk.o - 0x530c (size before relaxing) - .debug_str 0x0000596f 0x10e ./src/main.o - 0x524d (size before relaxing) - .debug_str 0x00005a7d 0x125 /usr/local/mcuxpressoide-11.9.0_2144/ide/plugins/com.nxp.mcuxpresso.tools.linux_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 0x00005792 0x2e1 ./src/init_clk.o + 0x53e6 (size before relaxing) + .debug_str 0x00005a73 0x192 ./src/main.o + 0x53fe (size before relaxing) + .debug_str 0x00005c05 0x125 /usr/local/mcuxpressoide-11.9.0_2144/ide/plugins/com.nxp.mcuxpresso.tools.linux_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) 0x12a (size before relaxing) .comment 0x00000000 0x45 @@ -680,13 +709,13 @@ LOAD linker stubs .ARM.attributes 0x0000013b 0x2d /usr/local/mcuxpressoide-11.9.0_2144/ide/plugins/com.nxp.mcuxpresso.tools.linux_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_frame 0x00000000 0x794 - .debug_frame 0x00000000 0x14c ./src/GPIO.o - .debug_frame 0x0000014c 0x320 ./src/SPI.o - .debug_frame 0x0000046c 0x170 ./src/cr_startup_lpc175x_6x.o - .debug_frame 0x000005dc 0x64 ./src/init_clk.o - .debug_frame 0x00000640 0x134 ./src/main.o - .debug_frame 0x00000774 0x20 /usr/local/mcuxpressoide-11.9.0_2144/ide/plugins/com.nxp.mcuxpresso.tools.linux_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_frame 0x00000000 0x894 + .debug_frame 0x00000000 0x1b4 ./src/GPIO.o + .debug_frame 0x000001b4 0x348 ./src/SPI.o + .debug_frame 0x000004fc 0x170 ./src/cr_startup_lpc175x_6x.o + .debug_frame 0x0000066c 0x64 ./src/init_clk.o + .debug_frame 0x000006d0 0x1a4 ./src/main.o + .debug_frame 0x00000874 0x20 /usr/local/mcuxpressoide-11.9.0_2144/ide/plugins/com.nxp.mcuxpresso.tools.linux_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) Cross Reference Table @@ -702,6 +731,9 @@ CS_DOWN ./src/SPI.o CS_UP ./src/SPI.o ClearButtons ./src/GPIO.o ./src/main.o +ClearTimer0 ./src/GPIO.o + ./src/main.o +CreatePlayer ./src/main.o DC_MODE_COMMAND ./src/SPI.o DC_MODE_DATA ./src/SPI.o DMA_IRQHandler ./src/cr_startup_lpc175x_6x.o @@ -711,6 +743,8 @@ DelaiMs ./src/GPIO.o Detect_AB_buttons ./src/GPIO.o ./src/main.o DrawChar ./src/SPI.o +DrawPlayer ./src/SPI.o + ./src/main.o DrawSolidBackground ./src/SPI.o DrawText ./src/SPI.o ./src/main.o @@ -731,6 +765,8 @@ I2C2_IRQHandler ./src/cr_startup_lpc175x_6x.o I2S_IRQHandler ./src/cr_startup_lpc175x_6x.o ILI9341_Initial ./src/SPI.o ./src/main.o +InitAudio ./src/GPIO.o + ./src/main.o InitButtons ./src/GPIO.o ./src/main.o InitTimer ./src/GPIO.o @@ -738,6 +774,7 @@ InitTimer ./src/GPIO.o Init_SPI ./src/SPI.o IntDefaultHandler ./src/cr_startup_lpc175x_6x.o JoystickGetState ./src/GPIO.o + ./src/main.o JoystickTestState ./src/GPIO.o LedSetState ./src/GPIO.o LedSetState8 ./src/GPIO.o @@ -752,6 +789,7 @@ PendSV_Handler ./src/cr_startup_lpc175x_6x.o QEI_IRQHandler ./src/cr_startup_lpc175x_6x.o RIT_IRQHandler ./src/cr_startup_lpc175x_6x.o RTC_IRQHandler ./src/cr_startup_lpc175x_6x.o +RefreshPlayer ./src/main.o Refresh_Area ./src/SPI.o ./src/main.o ResetISR ./src/cr_startup_lpc175x_6x.o @@ -768,6 +806,8 @@ SSP1_IRQHandler ./src/cr_startup_lpc175x_6x.o STARS_ODDS ./src/SPI.o SVC_Handler ./src/cr_startup_lpc175x_6x.o SendPixel ./src/SPI.o +SetAudio ./src/GPIO.o + ./src/main.o SevenSegNumFont ./src/fonts.o SmallFont ./src/fonts.o ./src/SPI.o @@ -778,7 +818,8 @@ SystemCoreClock ./src/init_clk.o SystemCoreClockUpdate ./src/init_clk.o SystemInit ./src/init_clk.o ./src/SPI.o -TIMER0_IRQHandler ./src/cr_startup_lpc175x_6x.o +TIMER0_IRQHandler ./src/main.o + ./src/cr_startup_lpc175x_6x.o TIMER1_IRQHandler ./src/cr_startup_lpc175x_6x.o TIMER2_IRQHandler ./src/cr_startup_lpc175x_6x.o TIMER3_IRQHandler ./src/cr_startup_lpc175x_6x.o @@ -847,9 +888,12 @@ main ./src/main.o /usr/local/mcuxpressoide-11.9.0_2144/ide/plugins/com.nxp.mcuxpresso.tools.linux_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) need_to_scroll ./src/main.o number_of_digits ./src/main.o +on ./src/main.o +player ./src/main.o scroll ./src/SPI.o ./src/main.o scroll_array ./src/main.o +scroll_increment ./src/main.o scroller_divider ./src/main.o scrolling ./src/main.o strLen ./src/SPI.o diff --git a/Debug/MyProject_Debug.ld b/Debug/MyProject_Debug.ld index aec2f0d..eb70177 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 7, 2024, 7:19:56 AM + * MCUXpresso IDE v11.9.0 [Build 2144] [2024-01-05] on Jun 7, 2024, 10:55:44 AM */ INCLUDE "MyProject_Debug_library.ld" diff --git a/Debug/MyProject_Debug_library.ld b/Debug/MyProject_Debug_library.ld index 46e06f2..d1ae234 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 7, 2024, 7:19:56 AM + * MCUXpresso IDE v11.9.0 [Build 2144] [2024-01-05] on Jun 7, 2024, 10:55:44 AM */ GROUP ( diff --git a/Debug/MyProject_Debug_memory.ld b/Debug/MyProject_Debug_memory.ld index ec9103f..ced3a38 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 7, 2024, 7:19:56 AM + * MCUXpresso IDE v11.9.0 [Build 2144] [2024-01-05] on Jun 7, 2024, 10:55:44 AM */ MEMORY diff --git a/Debug/src/GPIO.o b/Debug/src/GPIO.o index 1608e59..f383687 100644 Binary files a/Debug/src/GPIO.o and b/Debug/src/GPIO.o differ diff --git a/Debug/src/GPIO.su b/Debug/src/GPIO.su index e3d094e..b8031a1 100644 --- a/Debug/src/GPIO.su +++ b/Debug/src/GPIO.su @@ -6,4 +6,7 @@ ../src/GPIO.c:40:6:InitButtons 4 static ../src/GPIO.c:47:5:Detect_AB_buttons 4 static ../src/GPIO.c:54:6:InitTimer 4 static -../src/GPIO.c:60:6:ClearButtons 4 static +../src/GPIO.c:60:6:InitAudio 4 static +../src/GPIO.c:69:6:ClearTimer0 4 static +../src/GPIO.c:72:6:SetAudio 16 static +../src/GPIO.c:76:6:ClearButtons 4 static diff --git a/Debug/src/SPI.o b/Debug/src/SPI.o index 86b494e..e005696 100644 Binary files a/Debug/src/SPI.o and b/Debug/src/SPI.o differ diff --git a/Debug/src/SPI.su b/Debug/src/SPI.su index 14ef8ac..3c92b48 100644 --- a/Debug/src/SPI.su +++ b/Debug/src/SPI.su @@ -13,9 +13,10 @@ ../src/SPI.c:254:6:Get_Color_From_Background 32 static ../src/SPI.c:276:6:auto_screen_roloff 64 static ../src/SPI.c:286:6:Refresh_Area 72 static -../src/SPI.c:327:6:Draw_stars 32 static -../src/SPI.c:337:5:strLen 24 static -../src/SPI.c:347:6:DrawChar 72 static -../src/SPI.c:368:6:DrawText 72 static -../src/SPI.c:376:6:DrawSolidBackground 24 static -../src/SPI.c:384:6:Fill_Gradient 48 static +../src/SPI.c:298:6:DrawPlayer 56 static +../src/SPI.c:308:6:Draw_stars 32 static +../src/SPI.c:318:5:strLen 24 static +../src/SPI.c:328:6:DrawChar 72 static +../src/SPI.c:349:6:DrawText 72 static +../src/SPI.c:357:6:DrawSolidBackground 24 static +../src/SPI.c:365:6:Fill_Gradient 48 static diff --git a/Debug/src/init_clk.o b/Debug/src/init_clk.o index d81815b..7f7079b 100644 Binary files a/Debug/src/init_clk.o and b/Debug/src/init_clk.o differ diff --git a/Debug/src/main.o b/Debug/src/main.o index e025829..440d993 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 e11cbe0..0603dd9 100644 --- a/Debug/src/main.su +++ b/Debug/src/main.su @@ -1,8 +1,11 @@ -../src/main.c:22:6:init 8 static -../src/main.c:30:6:EINT3_IRQHandler 16 static -../src/main.c:42:6:SysTick_Handler 8 static -../src/main.c:54:6:increment_scroll 16 static -../src/main.c:62:5:number_of_digits 24 static -../src/main.c:72:6:convert_to_string 40 static -../src/main.c:83:6:scroll_array 32 static -../src/main.c:92:5:main 96 dynamic +../src/main.c:29:6:init 8 static +../src/main.c:38:6:TIMER0_IRQHandler 8 static +../src/main.c:52:6:EINT3_IRQHandler 16 static +../src/main.c:65:6:SysTick_Handler 8 static +../src/main.c:77:6:increment_scroll 16 static +../src/main.c:85:5:number_of_digits 24 static +../src/main.c:95:6:convert_to_string 40 static +../src/main.c:106:6:scroll_array 32 static +../src/main.c:115:8:CreatePlayer 80 static +../src/main.c:124:6:RefreshPlayer 16 static +../src/main.c:141:5:main 136 dynamic diff --git a/src/GPIO.c b/src/GPIO.c index 2054765..72be4da 100644 --- a/src/GPIO.c +++ b/src/GPIO.c @@ -57,6 +57,21 @@ void InitTimer(){ STRELOAD = 0x9C40; } +void InitAudio(){ + PINSEL1 |= 0b10 << 20; + //init timer + T0MR0 = 3124; + T0MCR = 0b11; + T0TCR = 1; + ISER0 |= 1 << 1; +} +void ClearTimer0(){ + T0IR = 1; +} +void SetAudio(int value){ + DACR = value << 6; +} + void ClearButtons(){ //A button IO2IntClr = 1 << 10; diff --git a/src/SPI.c b/src/SPI.c index 9c83e57..a0cb749 100644 --- a/src/SPI.c +++ b/src/SPI.c @@ -294,35 +294,16 @@ void Refresh_Area(Rectangle area){ SendPixel(color.Red,color.Green,color.Blue); } } - - /* - Rectangle first_half = {{0,0},{0,0}}; - Rectangle second_half = {{0,0},{0,0}}; - Split_sprite(area,&first_half,&second_half); - - Resize_Window(first_half); +} +void DrawPlayer(Rectangle area){ + Resize_Window(area); Write_Cmd(0x2C); - for(int y= 0; y < first_half.Size.Height;y++){ - for(int x = 0; x < first_half.Size.Width+1;x++){ - Color color; - Get_Color_From_Background((Point){x+first_half.Position.X,y+first_half.Position.Y},&color); - SendPixel(color.Red,color.Green,color.Blue); + for(int y = 0; y < area.Size.Height;y++){ + auto_screen_roloff(area,(Point){0,y}); + for(int x = 0; x < area.Size.Width+1;x++){ + SendPixel(0x58,0x2A,0x72); } } - - if(second_half.Size.Height != 0 && second_half.Size.Width != 0){ - Resize_Window(second_half); - Write_Cmd(0x2C); - for(int y= 0; y < second_half.Size.Height;y++){ - for(int x = 0; x < second_half.Size.Width+1;x++){ - Color color; - Get_Color_From_Background((Point){x+second_half.Position.X,y+second_half.Position.Y},&color); - SendPixel(color.Red,color.Green,color.Blue); - } - } - } - Resize_Window(viewPort); - */ } void Draw_stars(){ Write_Cmd(0x2C); diff --git a/src/config_LPC1769.h b/src/config_LPC1769.h index c50358c..d02ca28 100644 --- a/src/config_LPC1769.h +++ b/src/config_LPC1769.h @@ -101,5 +101,13 @@ // Flash Accelerator #define FLASHCFG (*((volatile uint32_t *) 0x400FC000)) +// DAC +#define DACR (*((volatile uint32_t *) 0x4008C000)) + +#define T0TCR (*((volatile uint32_t *) 0x40004004)) +#define T0MR0 (*((volatile uint32_t *) 0x40004018)) +#define T0MCR (*((volatile uint32_t *) 0x40004014)) +#define T0IR (*((volatile uint32_t *) 0x40004000)) + #endif /* CONFIG_LPC1769_H_ */ diff --git a/src/main.c b/src/main.c index d061273..9ce8585 100644 --- a/src/main.c +++ b/src/main.c @@ -19,6 +19,13 @@ const Point SCREEN_ORIGIN = {0,0}; const Size SCREEN_SIZE = {240,320}; const Rectangle SCREEN = {SCREEN_ORIGIN,SCREEN_SIZE}; +typedef struct Player_t{ + Rectangle Hitbox; + int HP; +}Player; + +Player player; + void init(void) { ILI9341_Initial(); @@ -27,6 +34,16 @@ void init(void) int scrolling = 0; bool need_to_scroll = false; +bool on = true; +void TIMER0_IRQHandler(void){ + //8000HZ smaple rate + ClearTimer0(); + + SetAudio(800); + on = true; + SetAudio(200); +} + void EINT3_IRQHandler(void){ int buttonPressed = Detect_AB_buttons(); if(buttonPressed == 2){ @@ -39,13 +56,12 @@ void EINT3_IRQHandler(void){ int timer_count = 0; int scroller_divider = 25; +int scroll_increment = 1; void SysTick_Handler(){ timer_count += 1; - //update the screen - if(timer_count >= scroller_divider){ - increment_scroll(-1); + increment_scroll(-scroll_increment); need_to_scroll = true; timer_count = 0; } @@ -89,22 +105,76 @@ void scroll_array(int **array,int **newArray,int width,int height){ } } +Player CreatePlayer(){ + int HP = 100; + Size playerSize = {15,30}; + Point position = {SCREEN_SIZE.Width / 2 - playerSize.Width /2,SCREEN_SIZE.Height / 2 - playerSize.Height/2}; + Rectangle playerHitbox = {position,playerSize}; + Player player = {playerHitbox,HP}; + return player; +} + +void RefreshPlayer(Point vector){ + Refresh_Area(player.Hitbox); + + 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 < 0) + player.Hitbox.Position.X = 0; + + DrawPlayer(player.Hitbox); +} + int main(void) { init(); InitButtons(); InitTimer(); + InitAudio(); LedSetState8(128+32+8+2); Point text_origin = {240 / 2 - 8/2,(320 / 6) * 5 - 4}; + player = CreatePlayer(); + Resize_Window(SCREEN); Draw_stars(); while (true) { + int JoystickState = JoystickGetState(); + + Point vec = {0,0}; + int increment = 1; + + if(JoystickState & (1 << 4)){ + vec.X -= increment; + } + if(JoystickState & (1 << 3)){ + vec.Y += increment; + } + if(JoystickState & (1 << 2)){ + vec.X += increment; + } + if(JoystickState & (1 << 1)){ + vec.Y -= increment; + } + if(JoystickState & 1){ + //empty + } + + + if(need_to_scroll){ scroll(scrolling); need_to_scroll = false; + vec.Y -= 1; + int digits = number_of_digits(scrolling); char newStr[digits+1]; convert_to_string(scrolling,digits,&newStr); @@ -115,6 +185,7 @@ int main(void) { Refresh_Area(areaToRefresh); DrawText(new_origin,newStr,charSize); } + RefreshPlayer(vec); } }