Add puts function and call it for Hello, World!
This commit is contained in:
parent
63f7daa810
commit
bf78d45b2f
10
build_rom.sh
Executable file
10
build_rom.sh
Executable file
@ -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
|
BIN
charset.png
Normal file
BIN
charset.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
1
media_header.txt
Normal file
1
media_header.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
NOSTALGIA_MEDIA_HEADER_________
|
@ -11,6 +11,7 @@
|
|||||||
#include "addresses.hpp"
|
#include "addresses.hpp"
|
||||||
#include "media.hpp"
|
#include "media.hpp"
|
||||||
#include "gba.hpp"
|
#include "gba.hpp"
|
||||||
|
#include "../gfx.hpp"
|
||||||
|
|
||||||
namespace nostalgia {
|
namespace nostalgia {
|
||||||
namespace core {
|
namespace core {
|
||||||
@ -20,6 +21,101 @@ using namespace ox::fs;
|
|||||||
#define TILE_ADDR ((CharBlock*) 0x06000000)
|
#define TILE_ADDR ((CharBlock*) 0x06000000)
|
||||||
#define TILE8_ADDR ((CharBlock8*) 0x06000000)
|
#define TILE8_ADDR ((CharBlock8*) 0x06000000)
|
||||||
|
|
||||||
|
// map ASCII values to the nostalgia charset
|
||||||
|
static char charMap[128] = {
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
38, // !
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
37, // ,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
1, // A
|
||||||
|
2, // B
|
||||||
|
3, // C
|
||||||
|
4, // D
|
||||||
|
5, // E
|
||||||
|
6, // F
|
||||||
|
7, // G
|
||||||
|
8, // H
|
||||||
|
9, // I
|
||||||
|
10, // J
|
||||||
|
11, // K
|
||||||
|
12, // L
|
||||||
|
13, // M
|
||||||
|
14, // N
|
||||||
|
15, // O
|
||||||
|
16, // P
|
||||||
|
17, // Q
|
||||||
|
18, // R
|
||||||
|
19, // S
|
||||||
|
20, // T
|
||||||
|
21, // U
|
||||||
|
22, // V
|
||||||
|
23, // W
|
||||||
|
24, // X
|
||||||
|
25, // Y
|
||||||
|
26, // Z
|
||||||
|
};
|
||||||
|
|
||||||
ox::Error initGfx() {
|
ox::Error initGfx() {
|
||||||
/* Sprite Mode ----\ */
|
/* Sprite Mode ----\ */
|
||||||
/* ---\| */
|
/* ---\| */
|
||||||
@ -28,19 +124,24 @@ ox::Error initGfx() {
|
|||||||
/* |||| */
|
/* |||| */
|
||||||
REG_DISPCNT = 0x1100;
|
REG_DISPCNT = 0x1100;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void initConsole() {
|
||||||
auto fs = (FileStore32*) findMedia();
|
auto fs = (FileStore32*) findMedia();
|
||||||
REG_BG0CNT = (28 << 8) | 1;
|
REG_BG0CNT = (28 << 8) | 1;
|
||||||
REG_BG0CNT |= (1 << 7); // set to use 8 bits per pixel
|
REG_BG0CNT |= (1 << 7); // set to use 8 bits per pixel
|
||||||
if (fs) {
|
if (fs) {
|
||||||
FileStore32::FsSize_t readSize = 0;
|
FileStore32::FsSize_t readSize = 0;
|
||||||
fs->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);
|
fs->read(1, 0, 512, &MEM_PALLETE_BG[0], &readSize);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
MEM_BG_MAP[28][106] = 1;
|
void puts(int loc, const char *str) {
|
||||||
MEM_BG_MAP[28][107] = 1;
|
for (int i = 0; str[i]; i++) {
|
||||||
|
MEM_BG_MAP[28][loc + i] = charMap[(int) str[i]];
|
||||||
return 0;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -14,5 +14,9 @@ namespace core {
|
|||||||
|
|
||||||
ox::Error initGfx();
|
ox::Error initGfx();
|
||||||
|
|
||||||
|
void initConsole();
|
||||||
|
|
||||||
|
void puts(int loc, const char *str);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,5 +15,11 @@ ox::Error initGfx() {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void initConsole() {
|
||||||
|
}
|
||||||
|
|
||||||
|
void puts(int loc, const char *str) {
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,8 @@ using namespace nostalgia;
|
|||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
core::init();
|
core::init();
|
||||||
|
core::initConsole();
|
||||||
|
core::puts(296, "HELLO, WORLD!");
|
||||||
while (1);
|
while (1);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user