summaryrefslogtreecommitdiff
path: root/game/src/aux.c
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2020-12-30 19:07:31 +0000
committerJuan J. Martinez <jjm@usebox.net>2020-12-30 19:23:41 +0000
commit2682bc5d1d864341aaeb42a449db73c3ecd16d70 (patch)
tree9116764364b4ee0ce7f6037305077807b57776de /game/src/aux.c
downloadubox-msx-lib-1.0.tar.gz
ubox-msx-lib-1.0.zip
Initial import1.0
Diffstat (limited to 'game/src/aux.c')
-rw-r--r--game/src/aux.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/game/src/aux.c b/game/src/aux.c
new file mode 100644
index 0000000..15fc2a4
--- /dev/null
+++ b/game/src/aux.c
@@ -0,0 +1,27 @@
+#include <stdint.h>
+
+#include "ubox.h"
+
+#include "aux.h"
+
+/**
+ * Put a zero terminated string on the screen using tiles.
+ *
+ * The font starts on the tileset on tile 128 and the fist char in our has
+ * ASCII value 31, so it is adjusted so we can use ASCII *uppercase* directly
+ * in our C code.
+ */
+void put_text(uint8_t x, uint8_t y, const uint8_t *text)
+{
+ while (*text)
+ ubox_put_tile(x++, y, *text++ + 128 - 31);
+}
+
+/**
+ * Wait for `frames` frames.
+ */
+void wait_for(uint8_t frames)
+{
+ while (frames--)
+ ubox_wait();
+}