#782 extracted 16K VRAM

This commit is contained in:
Vadim Grigoruk 2018-12-02 04:28:50 +03:00
parent be801c93aa
commit df22784d65
3 changed files with 39 additions and 15 deletions

View File

@ -2326,13 +2326,6 @@ static void onConsoleRamCommand(Console* console, const char* param)
static const struct{s32 addr; const char* info;} Layout[] = static const struct{s32 addr; const char* info;} Layout[] =
{ {
{offsetof(tic_ram, vram.screen), "SCREEN"},
{offsetof(tic_ram, vram.palette), "PALETTE"},
{offsetof(tic_ram, vram.mapping), "PALETTE MAP"},
{offsetof(tic_ram, vram.vars.colors), "BORDER"},
{offsetof(tic_ram, vram.vars.offset), "SCREEN OFFSET"},
{offsetof(tic_ram, vram.vars.cursor), "MOUSE CURSOR"},
{offsetof(tic_ram, vram.reserved), "..."},
{offsetof(tic_ram, tiles), "TILES"}, {offsetof(tic_ram, tiles), "TILES"},
{offsetof(tic_ram, sprites), "SPRITES"}, {offsetof(tic_ram, sprites), "SPRITES"},
{offsetof(tic_ram, map), "MAP"}, {offsetof(tic_ram, map), "MAP"},
@ -2346,15 +2339,43 @@ static void onConsoleRamCommand(Console* console, const char* param)
{offsetof(tic_ram, music.patterns.data), "MUSIC PATTERNS"}, {offsetof(tic_ram, music.patterns.data), "MUSIC PATTERNS"},
{offsetof(tic_ram, music.tracks.data), "MUSIC TRACKS"}, {offsetof(tic_ram, music.tracks.data), "MUSIC TRACKS"},
{offsetof(tic_ram, sound_state), "SOUND STATE"}, {offsetof(tic_ram, sound_state), "SOUND STATE"},
{TIC_RAM_SIZE, "..."}, {offsetof(tic_ram, free), "..."},
{TIC_RAM_SIZE, ""},
}; };
enum{Last = COUNT_OF(Layout)-1}; for(s32 i = 0; i < COUNT_OF(Layout)-1; i++)
for(s32 i = 0; i < Last; i++)
printRamInfo(console, Layout[i].addr, Layout[i].info, Layout[i+1].addr-Layout[i].addr); printRamInfo(console, Layout[i].addr, Layout[i].info, Layout[i+1].addr-Layout[i].addr);
printRamInfo(console, Layout[Last].addr, Layout[Last].info, 0); printTable(console, "\n+-------+-------------------+-------+");
printLine(console);
commandDone(console);
}
static void onConsoleVRamCommand(Console* console, const char* param)
{
printLine(console);
printTable(console, "\n+-----------------------------------+" \
"\n| 16K VRAM LAYOUT |" \
"\n+-------+-------------------+-------+" \
"\n| ADDR | INFO | SIZE |" \
"\n+-------+-------------------+-------+");
static const struct{s32 addr; const char* info;} Layout[] =
{
{offsetof(tic_ram, vram.screen), "SCREEN"},
{offsetof(tic_ram, vram.palette), "PALETTE"},
{offsetof(tic_ram, vram.mapping), "PALETTE MAP"},
{offsetof(tic_ram, vram.vars.colors), "BORDER"},
{offsetof(tic_ram, vram.vars.offset), "SCREEN OFFSET"},
{offsetof(tic_ram, vram.vars.cursor), "MOUSE CURSOR"},
{offsetof(tic_ram, vram.reserved), "..."},
{TIC_VRAM_SIZE, ""},
};
for(s32 i = 0; i < COUNT_OF(Layout)-1; i++)
printRamInfo(console, Layout[i].addr, Layout[i].info, Layout[i+1].addr-Layout[i].addr);
printTable(console, "\n+-------+-------------------+-------+"); printTable(console, "\n+-------+-------------------+-------+");
@ -2375,7 +2396,8 @@ static const struct
#if defined(CAN_OPEN_URL) #if defined(CAN_OPEN_URL)
{"wiki", NULL, "open github wiki page", onConsoleWikiCommand}, {"wiki", NULL, "open github wiki page", onConsoleWikiCommand},
#endif #endif
{"ram", NULL, "show memory info", onConsoleRamCommand}, {"ram", NULL, "show 80K RAM layout", onConsoleRamCommand},
{"vram", NULL, "show 16K VRAM layout", onConsoleVRamCommand},
{"exit", "quit", "exit the application", onConsoleExitCommand}, {"exit", "quit", "exit the application", onConsoleExitCommand},
{"new", NULL, "create new cart", onConsoleNewCommand}, {"new", NULL, "create new cart", onConsoleNewCommand},
{"load", NULL, "load cart", onConsoleLoadCommand}, {"load", NULL, "load cart", onConsoleLoadCommand},

View File

@ -30,7 +30,7 @@
#define MAIN_OFFSET 4 #define MAIN_OFFSET 4
#define MENU_HEIGHT 10 #define MENU_HEIGHT 10
#define MAX_CARTS 256 #define MAX_CARTS 512
#define ANIM 10 #define ANIM 10
#define COVER_WIDTH 140 #define COVER_WIDTH 140
#define COVER_HEIGHT 116 #define COVER_HEIGHT 116

View File

@ -52,7 +52,7 @@
#define TIC_COPYRIGHT "http://" TIC_HOST " (C) 2017" #define TIC_COPYRIGHT "http://" TIC_HOST " (C) 2017"
#define TIC_VRAM_SIZE (16*1024) //16K #define TIC_VRAM_SIZE (16*1024) //16K
#define TIC_RAM_SIZE (80*1024) //80K #define TIC_RAM_SIZE (TIC_VRAM_SIZE+80*1024) //16K+80K
#define TIC_FONT_WIDTH 6 #define TIC_FONT_WIDTH 6
#define TIC_FONT_HEIGHT 6 #define TIC_FONT_HEIGHT 6
#define TIC_ALTFONT_WIDTH 4 #define TIC_ALTFONT_WIDTH 4
@ -457,9 +457,11 @@ typedef union
tic_sfx sfx; tic_sfx sfx;
tic_music music; tic_music music;
tic_sound_state sound_state; tic_sound_state sound_state;
u8 free[16*1024];
}; };
u8 data[TIC_RAM_SIZE]; u8 data[TIC_RAM_SIZE];
} tic_ram; } tic_ram;
typedef enum typedef enum