diff --git a/build/Makefile b/build/Makefile
index c43c640..ce28a66 100644
--- a/build/Makefile
+++ b/build/Makefile
@@ -135,8 +135,8 @@ version:
SUFFIX_OBJ := rel
FILES_PRJ := $(PATH_SRC)/app/app_hello.c \
+ $(PATH_SRC)/app/app_lcd_util.c \
$(PATH_SRC)/app/app_led.c \
- $(PATH_SRC)/app/app_led_util.c \
$(PATH_SRC)/mcal/mcal_gpt.c \
$(PATH_SRC)/os/os.c \
$(PATH_SRC)/startup/crt0.s
diff --git a/build/ti84-ref_app.vcxproj b/build/ti84-ref_app.vcxproj
index e407211..502f3f2 100644
--- a/build/ti84-ref_app.vcxproj
+++ b/build/ti84-ref_app.vcxproj
@@ -15,13 +15,13 @@
-
+
-
+
diff --git a/build/ti84-ref_app.vcxproj.filters b/build/ti84-ref_app.vcxproj.filters
index eeb49cc..27e0b74 100644
--- a/build/ti84-ref_app.vcxproj.filters
+++ b/build/ti84-ref_app.vcxproj.filters
@@ -47,7 +47,7 @@
src\app
-
+
src\app
@@ -64,7 +64,7 @@
-
+
src\app
diff --git a/src/app/app_hello.c b/src/app/app_hello.c
index ca564a2..b593f14 100644
--- a/src/app/app_hello.c
+++ b/src/app/app_hello.c
@@ -5,7 +5,7 @@
#include
-#include
+#include
static void app_hello_hello(void);
static void app_hello_world(void);
@@ -29,31 +29,19 @@ void app_hello_task(void)
static void app_hello_hello(void)
{
- app_led_util_home2();
- app_led_util_putc('h');
- app_led_util_putc('e');
- app_led_util_putc('l');
- app_led_util_putc('l');
- app_led_util_putc('o');
+ app_lcd_util_home2();
+ app_lcd_util_puts("hello");
}
static void app_hello_world(void)
{
- app_led_util_home2();
- app_led_util_putc('w');
- app_led_util_putc('o');
- app_led_util_putc('r');
- app_led_util_putc('l');
- app_led_util_putc('d');
+ app_lcd_util_home2();
+ app_lcd_util_puts("world");
}
static void app_hello_clear(void)
{
- app_led_util_home2();
- app_led_util_putc(' ');
- app_led_util_putc(' ');
- app_led_util_putc(' ');
- app_led_util_putc(' ');
- app_led_util_putc(' ');
+ app_lcd_util_home2();
+ app_lcd_util_puts(" ");
}
diff --git a/src/app/app_led_util.c b/src/app/app_lcd_util.c
similarity index 60%
rename from src/app/app_led_util.c
rename to src/app/app_lcd_util.c
index 8869333..56bf74d 100644
--- a/src/app/app_led_util.c
+++ b/src/app/app_lcd_util.c
@@ -3,17 +3,25 @@
// Distributed under The Unlicense
//
-#include
+#include
-void app_led_util_putc(char c) ATTRIBUTE_NAKED
+#define NULL_PTR (void*) 0
+
+static void app_lcd_util_putc(char c) ATTRIBUTE_NAKED;
+
+void app_lcd_util_puts(const char* p_str)
{
- (void) c;
+ char c;
- __asm__("rst 0x28\n" ".dw #0x4504\n");
- __asm__("ret\n");
+ while((p_str != NULL_PTR) && ((c = *p_str) != '\0'))
+ {
+ app_lcd_util_putc(c);
+
+ ++p_str;
+ }
}
-void app_led_util_home1(void) ATTRIBUTE_NAKED
+void app_lcd_util_home1(void) ATTRIBUTE_NAKED
{
__asm__("ld b,#0x02\n");
__asm__("ld a,b\n");
@@ -24,7 +32,7 @@ void app_led_util_home1(void) ATTRIBUTE_NAKED
__asm__("ret\n");
}
-void app_led_util_home2(void) ATTRIBUTE_NAKED
+void app_lcd_util_home2(void) ATTRIBUTE_NAKED
{
__asm__("ld b,#0x03\n");
__asm__("ld a,b\n");
@@ -35,9 +43,17 @@ void app_led_util_home2(void) ATTRIBUTE_NAKED
__asm__("ret\n");
}
-void app_led_util_init(void) ATTRIBUTE_NAKED
+void app_lcd_util_init(void) ATTRIBUTE_NAKED
{
__asm__("rst 0x28\n" ".dw #0x4540\n");
__asm__("rst 0x28\n" ".dw #0x4558\n");
__asm__("ret\n");
}
+
+static void app_lcd_util_putc(char c) ATTRIBUTE_NAKED
+{
+ (void) c;
+
+ __asm__("rst 0x28\n" ".dw #0x4504\n");
+ __asm__("ret\n");
+}
diff --git a/src/app/app_led_util.h b/src/app/app_lcd_util.h
similarity index 78%
rename from src/app/app_led_util.h
rename to src/app/app_lcd_util.h
index 8cf8a80..826c77c 100644
--- a/src/app/app_led_util.h
+++ b/src/app/app_lcd_util.h
@@ -24,9 +24,10 @@
// curCol #0x844C
// _PutC #0x4504
- void app_led_util_putc (char c) ATTRIBUTE_NAKED;
- void app_led_util_home1 (void) ATTRIBUTE_NAKED;
- void app_led_util_home2 (void) ATTRIBUTE_NAKED;
- void app_led_util_init (void) ATTRIBUTE_NAKED;
+ void app_lcd_util_puts(const char* p_str);
+
+ void app_lcd_util_home1(void) ATTRIBUTE_NAKED;
+ void app_lcd_util_home2(void) ATTRIBUTE_NAKED;
+ void app_lcd_util_init (void) ATTRIBUTE_NAKED;
#endif // APP_LED_UTIL_2024_01_07_H
diff --git a/src/app/app_led.c b/src/app/app_led.c
index 68b2242..5cb1490 100644
--- a/src/app/app_led.c
+++ b/src/app/app_led.c
@@ -3,7 +3,7 @@
// Distributed under The Unlicense
//
-#include
+#include
static void app_led_on (void);
static void app_led_off(void);
@@ -13,7 +13,7 @@ static bool app_led_is_on;
void app_led_init(void)
{
- app_led_util_init();
+ app_lcd_util_init();
}
void app_led_task(void)
@@ -27,24 +27,18 @@ void app_led_task(void)
static void app_led_on(void)
{
- app_led_util_home1();
- app_led_util_putc('O');
- app_led_util_putc('N');
- app_led_util_putc(' ');
+ app_lcd_util_home1();
+ app_lcd_util_puts("ON ");
}
static void app_led_off(void)
{
- app_led_util_home1();
- app_led_util_putc('O');
- app_led_util_putc('F');
- app_led_util_putc('F');
+ app_lcd_util_home1();
+ app_lcd_util_puts("OFF");
}
static void app_led_clr(void)
{
- app_led_util_home1();
- app_led_util_putc(' ');
- app_led_util_putc(' ');
- app_led_util_putc(' ');
+ app_lcd_util_home1();
+ app_lcd_util_puts(" ");
}