From bf78d45b2f9ae645c7005a0d98b8293fe43762e9 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Fri, 14 Apr 2017 05:39:33 -0500 Subject: [PATCH] Add puts function and call it for Hello, World! --- build_rom.sh | 10 ++++ charset.png | Bin 0 -> 1250 bytes media_header.txt | 1 + src/core/gba/gfx.cpp | 111 +++++++++++++++++++++++++++++++++++++++++-- src/core/gfx.hpp | 4 ++ src/core/qt/gfx.cpp | 6 +++ src/player/main.cpp | 2 + 7 files changed, 129 insertions(+), 5 deletions(-) create mode 100755 build_rom.sh create mode 100644 charset.png create mode 100644 media_header.txt diff --git a/build_rom.sh b/build_rom.sh new file mode 100755 index 00000000..867ee362 --- /dev/null +++ b/build_rom.sh @@ -0,0 +1,10 @@ +#! /usr/bin/env bash + +set -e + +padbin 32 build/gba-release/src/player/nostalgia.bin +echo NOSTALGIA_MEDIA_HEADER_________ > media_header.txt +oxfs format 32 1m nostalgia_media.oxfs +./build/current/src/tools/nost-pack -fs nostalgia_media.oxfs -img charset.png -inode 1 -c +cat build/gba-release/src/player/nostalgia.bin media_header.txt nostalgia_media.oxfs > nostalgia.gba +gbafix nostalgia.gba diff --git a/charset.png b/charset.png new file mode 100644 index 0000000000000000000000000000000000000000..20bae7eb0351ee1e4636e7df76c122a3047a5b19 GIT binary patch literal 1250 zcmeHFdq`7Z6hHF;(~{-_lS+3XdJLI5Ds83SS-!Q+mSK$a`hY}DG#!!|-D^tX3m+*2 zKCaNrKO7BY)Ktb5VT9ybl9~kVX5xf$4$GU8*A9 z$NQ)^0Qe*(#Havx2=ajMj$EPcW*UGyq^6|BqAka9KmkP|h?ZS6Iyy>G)CM}(fQ{b{ zd4!N*05|{vKmyPJ3;>HNAm$zc3;5e>SDhYxpE-ofXvbnjLrfI!i&oGSDYGqm0>2#u(B4thl91a`- z90?o^90MG?d!^4DjB?P6n!!O92Xdsj%l_vC(VxrjsepR%-}dPMpU+2A_V@S4Fib2K zOQlkoOcos-os^WMQmNExbxuxBK|w)TSy^ReWp#CRLqkJ*dwW+`msYFQ>2wBz!DKR- z&1Q?mGCe(Qv)Sx+`||Sg+S(fW4$?RI1k&bdREp~$x6j^2xFs5{#w+n#a8Qy4AO9Qy=iel(>P#x>WFvP7b>(- z3g^g{-WcZ$f933USx0h*`fEN0N7|U$x%;JcBrGnI{!g@XW;G=Dy{S+uWu|bYpA9)y&_CTO$y&7Kak9YG3Qo( zBqXm)l+QOycC6lKf>s9I9&U9v9A3CTZV9Vzqv(3I-^Btl(x>ye{_K}t#u@RK(4R~CBUd`7!g$3Io;~3KJ#P6^{<)Hsf$_m;}read(1, 511, 8 * 64 * 36, &TILE8_ADDR[0][1], nullptr); + fs->read(1, 512, 8 * 64 * 36, &TILE8_ADDR[0][1], nullptr); fs->read(1, 0, 512, &MEM_PALLETE_BG[0], &readSize); } +} - MEM_BG_MAP[28][106] = 1; - MEM_BG_MAP[28][107] = 1; - - return 0; +void puts(int loc, const char *str) { + for (int i = 0; str[i]; i++) { + MEM_BG_MAP[28][loc + i] = charMap[(int) str[i]]; + } } } diff --git a/src/core/gfx.hpp b/src/core/gfx.hpp index d6d6af48..98037475 100644 --- a/src/core/gfx.hpp +++ b/src/core/gfx.hpp @@ -14,5 +14,9 @@ namespace core { ox::Error initGfx(); +void initConsole(); + +void puts(int loc, const char *str); + } } diff --git a/src/core/qt/gfx.cpp b/src/core/qt/gfx.cpp index 8b7c08d0..21b92fe7 100644 --- a/src/core/qt/gfx.cpp +++ b/src/core/qt/gfx.cpp @@ -15,5 +15,11 @@ ox::Error initGfx() { return 0; } +void initConsole() { +} + +void puts(int loc, const char *str) { +} + } } diff --git a/src/player/main.cpp b/src/player/main.cpp index a63a883e..90229b2c 100644 --- a/src/player/main.cpp +++ b/src/player/main.cpp @@ -12,6 +12,8 @@ using namespace nostalgia; int main() { core::init(); + core::initConsole(); + core::puts(296, "HELLO, WORLD!"); while (1); return 0; }