restructured

This commit is contained in:
JimmyZ 2017-09-28 16:03:46 +08:00
parent 03b625bff0
commit 66260fff6b
9 changed files with 14 additions and 12 deletions

View File

@ -16,7 +16,7 @@ include $(DEVKITARM)/ds_rules
#---------------------------------------------------------------------------------
TARGET := $(shell basename $(CURDIR))
BUILD := build
SOURCES := source
SOURCES := source term256
DATA :=
INCLUDES := include
GRAPHICS := data

View File

@ -3,7 +3,7 @@
- Supported font width: 6, yes, only 6, the test code uses the 6x10 font from Linux kernel.
- With font width 6, we can fit 42 characters on a single line on DS screen, compared to 32 for DKP console, that's the main reason this was written.
- 256 ANSI colors, each can be used on forground and/or background, like a real 256 color terminal, this is the second reason this was written.
- Support some ANSI escape codes.
- Support a little ANSI escape codes.
- LUT optimized font reading, resonably fast.
- Partial hardware scroll, that's really fast, I suppose this feature won't work on GBA.
@ -14,7 +14,7 @@ Cons:
Ideas and thoughts:
- It could be possible to use 2x bg to eliminate software scroll completely, and sounds like fun to code, but I don't think I could make the code compatible with GBA then.
- I guess DKP console used 1 tile for each character, then 16 color palattes gave us 16 forground color choices, but background color is stuck at black, I suppose we can use a custom palatte to have 16 forground/background combinations, not necessarily 4 forground colors * 4 background colors, like white on white won't make much sense, just choose what you'd use, 16 custom combinations is not that bad, especially comparing with 16 colors on black(including black on black).
- Or, take another way, use 15 tiles per character, each utilizing a different color slot in the palatte for background, and we can still switch color palattes for forground color, this way we could have 16*15 forground*background choices, it will cosumes 15 times VRAM for tiles, but retains the speed advantage. But still stuck with 8x8 font.
- Or, take another way, use 15 tiles per character, each utilizing a different color slot in the palatte for background, and we can still switch color palattes for forground color, this way we could have 16*15 forground*background choices, it will cosume 15 times VRAM for tiles, but retains the speed advantage. But still stuck with 8x8 font.
- Is it possible to use 3x overlapping tile bg to support 6x8 font? well if there is any good looking 6x8 font.
- Yeah I'm kinda obsessed.

View File

@ -2,8 +2,8 @@
#include <stdarg.h>
#include <stdio.h>
#include "term256.h"
#include "term256ext.h"
#include "../term256/term256.h"
#include "../term256/term256ext.h"
// show ANSI color palette, 8 rows
void show_ansi256_color_table(u16 *bg, unsigned width, unsigned height) {
@ -92,22 +92,24 @@ void dbg_iprtf(const char *fmt, ...) {
int main(void)
{
// init first console on lower screen
videoSetModeSub(MODE_3_2D);
videoSetMode(MODE_3_2D);
vramSetBankC(VRAM_C_SUB_BG);
vramSetBankA(VRAM_A_MAIN_BG);
int bg0id = bgInitSub(3, BgType_Bmp8, BgSize_B8_256x256, 0, 0);
int bg1id = bgInit(3, BgType_Bmp8, BgSize_B8_256x256, 0, 0);
u16 *bg0 = bgGetGfxPtr(bg0id);
u16 *bg1 = bgGetGfxPtr(bg1id);
generate_ansi256_palette(BG_PALETTE_SUB);
dmaCopy(BG_PALETTE_SUB, BG_PALETTE, 256 * 2);
term_init(&t0, bg0, set_scroll, &bg0id);
// init second console on upper screen
videoSetMode(MODE_3_2D);
vramSetBankA(VRAM_A_MAIN_BG);
int bg1id = bgInit(3, BgType_Bmp8, BgSize_B8_256x256, 0, 0);
u16 *bg1 = bgGetGfxPtr(bg1id);
dmaCopy(BG_PALETTE_SUB, BG_PALETTE, 256 * 2);
term_init(&t1, bg1, set_scroll, &bg1id);
// term_init(&t1, fb1, 0, 0);
select_term(&t0);
int is_DSi = isDSiMode();
if (is_DSi) {
prt("DSi Mode, previous CPU clock was ");