Menu fixes. Various fixes.

This commit is contained in:
LemonBoy 2014-04-28 18:44:50 +02:00
parent 54d3f3ee3f
commit 3b5d7bc6b3
7 changed files with 133 additions and 117 deletions

View File

@ -25,10 +25,9 @@ NITRODATA := fs
#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------
ARCH := -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s
ARCH := -marm -mno-thumb-interwork -march=armv5te -mtune=arm946e-s
CFLAGS := -save-temps \
-funroll-loops -ftree-vectorize \
-Wall -Ofast\
-fomit-frame-pointer\
-ffast-math \

View File

@ -21,6 +21,7 @@ reg_y .req r7
reg_f .req r6
cycles .req r5
// XXX rebase the pc on page cross
.macro fetch
ldrb r0, [reg_pc], #1
.endm
@ -134,19 +135,11 @@ cycles .req r5
ldrsb r0, [reg_pc], #1
#ifdef CHECK_IDLE_JUMP
cmp r0, #-2
bne 2f
// unbase_pc reg_pc
// ldr r0, =idle_loop_msg
// mov r1, reg_pc
// bl iprintf
bne 1f
b _xx
#endif
2: // Sign extend
add r2, reg_pc, r0
eor r1, r2, reg_pc
tst r1, #0x100
subne cycles, #2
add reg_pc, r0
// XXX two cycle penality for page crossing
1: add reg_pc, r0
.endm
#define FLAG_CARRY 0x01<<24

View File

@ -46,7 +46,7 @@ void emu_init ()
keyboardShow();
// Set some sane defaults
emu_vsync = 0;
emu_vsync = 1;
// Setup the video hardware
video_init();

View File

@ -13,8 +13,10 @@
int emu_vsync;
int emu_input;
int emu_screen;
int emu_scale;
static char *basename;
static char *basename = NULL;
void emu_init ();
void emu_run ();

View File

@ -27,7 +27,7 @@ int main(int argc, char **argv)
/*load_disk("PACMAN.DSK");*/
/*load_disk("Karateka (1984)(Broderbund).dsk");*/
// Awesome!
/*load_disk("lode.dsk");*/
load_disk("lode.dsk");
// AppleII+
/*load_disk("Prince of Persia (1989)(Broderbund)(Disk 1 of 3)[cr].dsk");*/
// Gfx heavy
@ -44,7 +44,7 @@ int main(int argc, char **argv)
/*load_disk("Fracas (1980)(Quality Software).dsk");*/
/*load_disk("Colorix.dsk");*/
/*load_disk("LoRes Games.DSK");*/
load_disk("LoRes Hijinks.DSK");
/*load_disk("LoRes Hijinks.DSK");*/
// SP Crash
/*load_disk("Apple II Business Graphics 1.0 (1981).nib");*/
} else {

View File

@ -6,6 +6,7 @@ typedef struct entry_t {
const char *label;
const int opts_no;
const char *opts[10];
int *opt_ptr;
int (*cb)(int);
} entry_t;
@ -15,31 +16,53 @@ typedef struct page_t {
const entry_t *entries;
} page_t;
#define OPT(n) int opt_##n (int sel) { emu_##n = sel; return 1; }
OPT(vsync);
OPT(input);
int opt_screen (int sel)
static int opt_screen (const int sel)
{
emu_screen = sel;
(sel) ? lcdMainOnBottom() : lcdMainOnTop();
return 1;
}
static int opt_vsync (const int sel)
{
emu_vsync = sel;
return 1;
}
static int opt_scale (const int sel)
{
emu_scale = sel;
video_set_scale(emu_scale);
return 1;
}
static int opt_input (const int sel)
{
emu_input = sel;
return 1;
}
static int opt_exit (const int sel)
{
exit(0);
return 1;
}
static int sel_slot_l = 0, sel_slot_s = 0;
const static struct page_t paused_pg = {
"Paused", 7, (const entry_t []){
{ "Vsync", 2, { "No", "Yes" }, opt_vsync },
{ "Scale", 2, { "No", "Yes" }, video_set_scale },
{ "Screen", 2, { "Top", "Bottom" }, opt_screen },
{ "Map keys to", 2, { "joystick", "keyboard" }, opt_input },
{ "Save state", 9, { "1", "2", "3", "4", "5", "6", "7", "8", "9" }, state_save },
{ "Load state", 9, { "1", "2", "3", "4", "5", "6", "7", "8", "9" }, state_load },
{ "Exit", 0, { }, exit },
{ "Vsync", 2, { "No", "Yes" }, &emu_vsync, opt_vsync },
{ "Scale", 2, { "No", "Yes" }, &emu_scale, opt_scale },
{ "Screen", 2, { "Top", "Bottom" }, &emu_screen, opt_screen },
{ "Map keys to", 2, { "joystick", "keyboard" }, &emu_input, opt_input },
{ "Save state", 9, { "1", "2", "3", "4", "5", "6", "7", "8", "9" }, &sel_slot_s, state_save },
{ "Load state", 9, { "1", "2", "3", "4", "5", "6", "7", "8", "9" }, &sel_slot_l, state_load },
{ "Exit", 0, { }, NULL, opt_exit },
}
};
static int paused_pg_opt[6] = { 1, 0, 0, 0, 0, 0 };
void menu_print_page (const page_t *page, int *opts)
void menu_print_page (const page_t *page)
{
int i;
int cur;
@ -56,7 +79,7 @@ void menu_print_page (const page_t *page, int *opts)
for (i = 0; i < page->entries_no; i++) {
const entry_t *entry = &page->entries[i];
iprintf("%c %s %s\n", (i == cur) ? '>' : ' ', entry->label,
(entry->opts_no) ? entry->opts[opts[i]] : "");
(entry->opts_no) ? entry->opts[*entry->opt_ptr] : "");
}
scanKeys();
@ -73,26 +96,19 @@ void menu_print_page (const page_t *page, int *opts)
cur = 0;
}
if (sel_entry->opts_no) {
if (keys&KEY_LEFT && opts[cur] > 0) {
opts[cur]--;
/*if (sel_entry->cb) sel_entry->cb(opts[cur]);*/
}
if (keys&KEY_RIGHT && opts[cur] < sel_entry->opts_no - 1) {
opts[cur]++;
/*if (sel_entry->cb) sel_entry->cb(opts[cur]);*/
}
if (keys&KEY_LEFT && *sel_entry->opt_ptr > 0)
(*sel_entry->opt_ptr)--;
if (keys&KEY_RIGHT && *sel_entry->opt_ptr < sel_entry->opts_no - 1)
(*sel_entry->opt_ptr)++;
}
if (keys&KEY_A) {
if (sel_entry->cb)
if (sel_entry->cb(opts[cur]))
return;
if (keys&(KEY_TOUCH|KEY_START|KEY_A)) {
if (sel_entry->cb && sel_entry->cb(*sel_entry->opt_ptr))
return;
if (!(keys&KEY_A))
return;
}
// Use keysDown to avoid bouncing
if (keysDown()&KEY_START)
return;
swiWaitForVBlank();
}
}
@ -103,4 +119,4 @@ void print_msg (const char *msg)
swiDelay(10000000);
}
void pause_menu () { menu_print_page(&paused_pg, (int *)&paused_pg_opt); }
void pause_menu () { menu_print_page(&paused_pg); }

View File

@ -3,46 +3,46 @@
#include "mem.h"
const u8 apple_font[] = {
0x00, 0x70, 0x88, 0xa8, 0xe8, 0x68, 0x08, 0xf0, 0x00, 0x20, 0x50, 0x88, 0x88, 0xf8, 0x88, 0x88,
0x00, 0x78, 0x88, 0x88, 0x78, 0x88, 0x88, 0x78, 0x00, 0x70, 0x88, 0x08, 0x08, 0x08, 0x88, 0x70,
0x00, 0x78, 0x88, 0x88, 0x88, 0x88, 0x88, 0x78, 0x00, 0xf8, 0x08, 0x08, 0x78, 0x08, 0x08, 0xf8,
0x00, 0xf8, 0x08, 0x08, 0x78, 0x08, 0x08, 0x08, 0x00, 0xf0, 0x08, 0x08, 0x08, 0xc8, 0x88, 0xf0,
0x00, 0x88, 0x88, 0x88, 0xf8, 0x88, 0x88, 0x88, 0x00, 0x70, 0x20, 0x20, 0x20, 0x20, 0x20, 0x70,
0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x88, 0x70, 0x00, 0x88, 0x48, 0x28, 0x18, 0x28, 0x48, 0x88,
0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0xf8, 0x00, 0x88, 0xd8, 0xa8, 0xa8, 0x88, 0x88, 0x88,
0x00, 0x88, 0x88, 0x98, 0xa8, 0xc8, 0x88, 0x88, 0x00, 0x70, 0x88, 0x88, 0x88, 0x88, 0x88, 0x70,
0x00, 0x78, 0x88, 0x88, 0x78, 0x08, 0x08, 0x08, 0x00, 0x70, 0x88, 0x88, 0x88, 0xa8, 0x48, 0xb0,
0x00, 0x78, 0x88, 0x88, 0x78, 0x28, 0x48, 0x88, 0x00, 0x70, 0x88, 0x08, 0x70, 0x80, 0x88, 0x70,
0x00, 0xf8, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x70,
0x00, 0x88, 0x88, 0x88, 0x88, 0x88, 0x50, 0x20, 0x00, 0x88, 0x88, 0x88, 0xa8, 0xa8, 0xd8, 0x88,
0x00, 0x70, 0x88, 0xa8, 0xe8, 0x68, 0x08, 0xf0, 0x00, 0x20, 0x50, 0x88, 0x88, 0xf8, 0x88, 0x88,
0x00, 0x78, 0x88, 0x88, 0x78, 0x88, 0x88, 0x78, 0x00, 0x70, 0x88, 0x08, 0x08, 0x08, 0x88, 0x70,
0x00, 0x78, 0x88, 0x88, 0x88, 0x88, 0x88, 0x78, 0x00, 0xf8, 0x08, 0x08, 0x78, 0x08, 0x08, 0xf8,
0x00, 0xf8, 0x08, 0x08, 0x78, 0x08, 0x08, 0x08, 0x00, 0xf0, 0x08, 0x08, 0x08, 0xc8, 0x88, 0xf0,
0x00, 0x88, 0x88, 0x88, 0xf8, 0x88, 0x88, 0x88, 0x00, 0x70, 0x20, 0x20, 0x20, 0x20, 0x20, 0x70,
0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x88, 0x70, 0x00, 0x88, 0x48, 0x28, 0x18, 0x28, 0x48, 0x88,
0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0xf8, 0x00, 0x88, 0xd8, 0xa8, 0xa8, 0x88, 0x88, 0x88,
0x00, 0x88, 0x88, 0x98, 0xa8, 0xc8, 0x88, 0x88, 0x00, 0x70, 0x88, 0x88, 0x88, 0x88, 0x88, 0x70,
0x00, 0x78, 0x88, 0x88, 0x78, 0x08, 0x08, 0x08, 0x00, 0x70, 0x88, 0x88, 0x88, 0xa8, 0x48, 0xb0,
0x00, 0x78, 0x88, 0x88, 0x78, 0x28, 0x48, 0x88, 0x00, 0x70, 0x88, 0x08, 0x70, 0x80, 0x88, 0x70,
0x00, 0xf8, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x70,
0x00, 0x88, 0x88, 0x88, 0x88, 0x88, 0x50, 0x20, 0x00, 0x88, 0x88, 0x88, 0xa8, 0xa8, 0xd8, 0x88,
0x00, 0x88, 0x88, 0x50, 0x20, 0x50, 0x88, 0x88, 0x00, 0x88, 0x88, 0x50, 0x20, 0x20, 0x20, 0x20,
0x00, 0xf8, 0x80, 0x40, 0x20, 0x10, 0x08, 0xf8, 0x00, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8,
0x00, 0x00, 0x08, 0x10, 0x20, 0x40, 0x80, 0x00, 0x00, 0xf8, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xf8,
0x00, 0x00, 0x00, 0x20, 0x50, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x20,
0x00, 0x50, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x50, 0xf8, 0x50, 0xf8, 0x50, 0x50,
0x00, 0x20, 0xf0, 0x28, 0x70, 0xa0, 0x78, 0x20, 0x00, 0x18, 0x98, 0x40, 0x20, 0x10, 0xc8, 0xc0,
0x00, 0xf8, 0x80, 0x40, 0x20, 0x10, 0x08, 0xf8, 0x00, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8,
0x00, 0x00, 0x08, 0x10, 0x20, 0x40, 0x80, 0x00, 0x00, 0xf8, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xf8,
0x00, 0x00, 0x00, 0x20, 0x50, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x20,
0x00, 0x50, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x50, 0xf8, 0x50, 0xf8, 0x50, 0x50,
0x00, 0x20, 0xf0, 0x28, 0x70, 0xa0, 0x78, 0x20, 0x00, 0x18, 0x98, 0x40, 0x20, 0x10, 0xc8, 0xc0,
0x00, 0x10, 0x28, 0x28, 0x10, 0xa8, 0x48, 0xb0, 0x00, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x20, 0x10, 0x08, 0x08, 0x08, 0x10, 0x20, 0x00, 0x20, 0x40, 0x80, 0x80, 0x80, 0x40, 0x20,
0x00, 0x20, 0xa8, 0x70, 0x20, 0x70, 0xa8, 0x20, 0x00, 0x00, 0x20, 0x20, 0xf8, 0x20, 0x20, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x80, 0x40, 0x20, 0x10, 0x08, 0x00,
0x00, 0x70, 0x88, 0xc8, 0xa8, 0x98, 0x88, 0x70, 0x00, 0x20, 0x30, 0x20, 0x20, 0x20, 0x20, 0x70,
0x00, 0x70, 0x88, 0x80, 0x60, 0x10, 0x08, 0xf8, 0x00, 0xf8, 0x80, 0x40, 0x60, 0x80, 0x88, 0x70,
0x00, 0x40, 0x60, 0x50, 0x48, 0xf8, 0x40, 0x40, 0x00, 0xf8, 0x08, 0x78, 0x80, 0x80, 0x88, 0x70,
0x00, 0xe0, 0x10, 0x08, 0x78, 0x88, 0x88, 0x70, 0x00, 0xf8, 0x80, 0x40, 0x20, 0x10, 0x10, 0x10,
0x00, 0x70, 0x88, 0x88, 0x70, 0x88, 0x88, 0x70, 0x00, 0x70, 0x88, 0x88, 0xf0, 0x80, 0x40, 0x38,
0x00, 0x00, 0x00, 0x20, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x20, 0x20, 0x10,
0x00, 0x40, 0x20, 0x10, 0x08, 0x10, 0x20, 0x40, 0x00, 0x00, 0x00, 0xf8, 0x00, 0xf8, 0x00, 0x00,
0x00, 0x20, 0x10, 0x08, 0x08, 0x08, 0x10, 0x20, 0x00, 0x20, 0x40, 0x80, 0x80, 0x80, 0x40, 0x20,
0x00, 0x20, 0xa8, 0x70, 0x20, 0x70, 0xa8, 0x20, 0x00, 0x00, 0x20, 0x20, 0xf8, 0x20, 0x20, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x80, 0x40, 0x20, 0x10, 0x08, 0x00,
0x00, 0x70, 0x88, 0xc8, 0xa8, 0x98, 0x88, 0x70, 0x00, 0x20, 0x30, 0x20, 0x20, 0x20, 0x20, 0x70,
0x00, 0x70, 0x88, 0x80, 0x60, 0x10, 0x08, 0xf8, 0x00, 0xf8, 0x80, 0x40, 0x60, 0x80, 0x88, 0x70,
0x00, 0x40, 0x60, 0x50, 0x48, 0xf8, 0x40, 0x40, 0x00, 0xf8, 0x08, 0x78, 0x80, 0x80, 0x88, 0x70,
0x00, 0xe0, 0x10, 0x08, 0x78, 0x88, 0x88, 0x70, 0x00, 0xf8, 0x80, 0x40, 0x20, 0x10, 0x10, 0x10,
0x00, 0x70, 0x88, 0x88, 0x70, 0x88, 0x88, 0x70, 0x00, 0x70, 0x88, 0x88, 0xf0, 0x80, 0x40, 0x38,
0x00, 0x00, 0x00, 0x20, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x20, 0x20, 0x10,
0x00, 0x40, 0x20, 0x10, 0x08, 0x10, 0x20, 0x40, 0x00, 0x00, 0x00, 0xf8, 0x00, 0xf8, 0x00, 0x00,
0x00, 0x10, 0x20, 0x40, 0x80, 0x40, 0x20, 0x10, 0x00, 0x70, 0x88, 0x40, 0x20, 0x20, 0x00, 0x20
};
static const u16 video_addr[] DTCM_DATA = {
0x000, 0x080, 0x100, 0x180,
0x200, 0x280, 0x300, 0x380,
0x028, 0x0a8, 0x128, 0x1a8,
0x228, 0x2a8, 0x328, 0x3a8,
0x050, 0x0d0, 0x150, 0x1d0,
0x000, 0x080, 0x100, 0x180,
0x200, 0x280, 0x300, 0x380,
0x028, 0x0a8, 0x128, 0x1a8,
0x228, 0x2a8, 0x328, 0x3a8,
0x050, 0x0d0, 0x150, 0x1d0,
0x250, 0x2d0, 0x350, 0x3d0
};
@ -73,6 +73,9 @@ static int mixed_mode;
static int sel_page;
static int hires;
// The mixed mode can be enabled only if graphic mode is set
#define render_mixed_mode (mixed_mode&(!text_mode))
void video_set_mode ();
void video_save (FILE *f)
@ -83,7 +86,7 @@ void video_save (FILE *f)
fwrite(&hires, 1, 4, f);
}
void video_load (FILE *f)
void video_load (FILE *f)
{
fread(&text_mode, 1, 4, f);
fread(&mixed_mode, 1, 4, f);
@ -94,8 +97,8 @@ void video_load (FILE *f)
}
void video_set_mode ()
{
if (mixed_mode) {
{
if (render_mixed_mode) {
bgShow(gfx_bg);
bgShow(text_bg);
REG_DISPCNT |= DISPLAY_WIN0_ON;
@ -106,8 +109,8 @@ void video_set_mode ()
}
}
u8 video_io_read (u16 addr) ITCM_CODE;
u8 video_io_read (u16 addr)
u8 video_io_read (u16 addr) ITCM_CODE;
u8 video_io_read (u16 addr)
{
switch (addr&0xf) {
case 0x0:
@ -115,8 +118,6 @@ u8 video_io_read (u16 addr)
break;
case 0x1:
text_mode = 1;
// The mixed mode can be enabled only if graphic mode is set
mixed_mode = 0;
break;
case 0x2:
mixed_mode = 0;
@ -152,7 +153,7 @@ u8 video_io_read (u16 addr)
}
void draw_lores_scr (u16 *map) ITCM_CODE;
void draw_lores_scr (u16 *map)
void draw_lores_scr (u16 *__restrict map)
{
int last_line;
int i, j;
@ -161,7 +162,7 @@ void draw_lores_scr (u16 *map)
if (!page_dirty[sel_page])
return;
last_line = mixed_mode ? 168 : 192;
last_line = render_mixed_mode ? 168 : 192;
for (i = 0; i < last_line; i++) {
ptr = (u8 *)(mainram + (sel_page << 10) + video_addr[i/8]);
@ -184,17 +185,19 @@ void draw_lores_scr (u16 *map)
}
}
void draw_hires_scr (u16 *map) ITCM_CODE;
#if 0
/*odd_color = (b1&0x80) ? 6 : 3;*/
/*even_color = (b1&0x80) ? 9 : 12;*/
void draw_hires_scr_1 (u16 *map)
void draw_hires_scr (u16 *__restrict map)
{
int last_line;
int i, j, k;
u8 *ptr, tmp;
u8 *__restrict ptr, tmp;
static u8 tmp_line[0x200];
static const u8 color_lut[] DTCM_DATA = { 0, 12, 0, 15, 0, 9, 0, 15, 0, 3, 0, 15, 0, 6, 0, 15 };
last_line = mixed_mode ? 168 : 192;
last_line = render_mixed_mode ? 168 : 192;
for (i = 0; i < last_line; i++, map += 0x100) {
if (!page_dirty[8 + (i&7)])
@ -211,28 +214,29 @@ void draw_hires_scr_1 (u16 *map)
// e = even / odd
// m = msb
// b = data
for (k = 0; k <= 7; k++)
for (k = 0; k <= 7; k++)
tmp_line[j+k] = color_lut[(((j+k)&1) ? 0x8 : 0x0) + ((b1&0x80)>>5) + ((tmp>>k)&3)];
tmp >>= 7;
}
dmaCopyAsynch(tmp_line, map, 0x200);
DC_FlushRange(tmp_line, sizeof(tmp_line));
dmaCopyAsynch(tmp_line, map, sizeof(tmp_line));
DC_InvalidateRange(map, sizeof(tmp_line));
}
}
void draw_hires_scr (u16 *map) ITCM_CODE;
void draw_hires_scr (u16 *map)
{
int last_line;
int i, j, k, x;
u8 *xptr, *ptr, tmp;
u16 *omap;
#else
void draw_hires_scr (u16 *__restrict map)
{
int last_line;
int i, j, k, x;
u8 *__restrict xptr, *__restrict ptr, tmp;
u16 *__restrict omap;
static u8 tmp_line[0x200];
static const u8 color_lut[] DTCM_DATA = { 0, 12, 0, 15, 0, 9, 0, 15, 0, 3, 0, 15, 0, 6, 0, 15 };
last_line = mixed_mode ? 168/8 : 192/8;
last_line = render_mixed_mode ? 168/8 : 192/8;
for(x = 0; x < 8; x++, map += 0x100) {
if (!page_dirty[8+x])
@ -246,7 +250,7 @@ void draw_hires_scr (u16 *map)
const u8 b1 = *ptr++;
tmp = (b1&0x7f) << 1 | tmp;
const u8 *lut_b = color_lut + ((b1&0x80)>>5);
const u8 *__restrict lut_b = color_lut + ((b1&0x80)>>5);
for (k = 0; k < 7; k+=2)
{
@ -258,12 +262,14 @@ void draw_hires_scr (u16 *map)
tmp >>= 1;
}
}
dmaCopyAsynch(tmp_line, omap, 0x200);
/*memcpy(omap, tmp_line, 0x200);*/
DC_FlushRange(tmp_line, sizeof(tmp_line));
dmaCopyAsynch(tmp_line, omap, sizeof(tmp_line));
DC_InvalidateRange(omap, sizeof(tmp_line));
}
page_dirty[8+x] = 0;
}
}
#endif
void draw_text_scr (u16 *map) ITCM_CODE;
void draw_text_scr (u16 *map)
@ -275,7 +281,7 @@ void draw_text_scr (u16 *map)
if (!page_dirty[sel_page])
return;
if ((start_line = mixed_mode ? 21 : 0))
if ((start_line = render_mixed_mode ? 21 : 0))
map += 32 * start_line;
for (i = start_line; i < 24; i++) {
@ -298,7 +304,7 @@ void video_draw ()
u16 *text_ptr = (u16 *)0x6002000;
u16 *gfx_ptr = (u16 *)0x6020000;
if (mixed_mode) {
if (render_mixed_mode) {
draw_text_scr(text_ptr);
(hires) ? draw_hires_scr(gfx_ptr) : draw_lores_scr(gfx_ptr);
} else {
@ -307,13 +313,13 @@ void video_draw ()
else
(hires) ? draw_hires_scr(gfx_ptr) : draw_lores_scr(gfx_ptr);
}
// Clear this here otherwise we won't be able to render a lores
// Clear this here otherwise we won't be able to render a lores
// screen after the text one
page_dirty[sel_page] = 0;
}
int video_set_scale (int mode)
int video_set_scale (int mode)
{
int scaleg_x, scalet_x;
int scale_y;
@ -337,7 +343,7 @@ int video_set_scale (int mode)
return 1;
}
void video_init ()
{
videoSetMode(MODE_4_2D);
@ -348,7 +354,7 @@ void video_init ()
// http://mtheall.com/vram.html#T2=3&NT2=128&MB2=4&TB2=0&S2=2&T3=5&NT3=32&MB3=8&TB3=1&S3=3
text_bg = bgInit(2, BgType_Rotation, BgSize_R_512x512, 4, 0);
gfx_bg = bgInit(3, BgType_Bmp8, BgSize_B8_512x256, 8, 0);
REG_DISPCNT &= ~DISPLAY_WIN0_ON;
// Setup the window used for mixed mode
WIN0_X0 = 0;