diff options
Diffstat (limited to 'source/main.c')
-rw-r--r-- | source/main.c | 67 |
1 files changed, 30 insertions, 37 deletions
diff --git a/source/main.c b/source/main.c index 3407a88..010210c 100644 --- a/source/main.c +++ b/source/main.c @@ -81,6 +81,14 @@ typedef enum #endif } MenuOpt; + +/* Backgrounds +*/ +static int main_bitmap_bg; +static int main_text_overlay_bg; +static int sub_bitmap_bg; +static int sub_text_overlay_bg; + /* ---------------------------------------- IRQ FUNCS */ @@ -132,8 +140,7 @@ static void Splash(void) "20 print \"%the zx81 is ace%\"\n" "30 goto 20"); - SUB_BG2_XDX = 0x080; - SUB_BG2_YDY = 0x080; + bgSetScale(sub_text_overlay_bg, 0x80, 0x80); TM_printf(0,11,"%-18.18s",scroller); @@ -217,12 +224,13 @@ static void Splash(void) TM_printf(0,11,"%-18.18s",scroller); } - SUB_BG2_CX = scr_x << 8; + bgSetScroll(sub_text_overlay_bg, scr_x << 8, 0); + bgUpdate(); } - SUB_BG2_XDX = 0x100; - SUB_BG2_YDY = 0x100; - SUB_BG2_CX = 0; + bgSetScale(sub_text_overlay_bg, 0x100, 0x100); + bgSetScroll(sub_text_overlay_bg, 0, 0); + bgUpdate(); TM_Cls(); @@ -298,31 +306,24 @@ int main(int argc, char *argv[]) { Z80 *z80; - powerON(POWER_ALL_2D); + powerOn(POWER_ALL_2D); /* Set up main screen for ZX81 and load the ROM character data */ - videoSetMode(MODE_3_2D | DISPLAY_BG0_ACTIVE | DISPLAY_BG3_ACTIVE); + videoSetMode(MODE_3_2D); vramSetBankA(VRAM_A_MAIN_BG_0x06000000); vramSetBankB(VRAM_B_MAIN_BG_0x06020000); - BG0_CR = BG_COLOR_256 | BG_32x32 | BG_MAP_BASE(0) | - BG_TILE_BASE(1) | BG_PRIORITY(0); - BG0_X0 = 0; - BG0_Y0 = 0; + main_bitmap_bg = bgInit(0, BgType_Bmp16, BgSize_B16_256x256, 2, 0); + main_text_overlay_bg = bgInit(3, BgType_Text8bpp, BgSize_T_256x256, 0, 1); + + bgSetPriority(main_bitmap_bg, 1); + bgSetPriority(main_text_overlay_bg, 0); BG_PALETTE[0] = RGB15(31,31,31); BG_PALETTE[1] = RGB15(0,0,0); - BG3_CR = BG_BMP16_256x256 | BG_BMP_BASE(2) | BG_PRIORITY(1); - BG3_XDX = 0x100; - BG3_XDY = 0; - BG3_YDX = 0; - BG3_YDY = 0x100; - BG3_CX = 0; - BG3_CY = 0; - dmaCopy(rom_font_bin,(void *)BG_TILE_RAM(1),rom_font_bin_size); /* Set up the sub-screen for rotation (basically for use as a framebuffer). @@ -331,25 +332,17 @@ int main(int argc, char *argv[]) the ZX81 run). Having said the overlay is currently a rotation map for some pointless frippery! Still be quicker though. */ - videoSetModeSub(MODE_4_2D | DISPLAY_BG2_ACTIVE | DISPLAY_BG3_ACTIVE); + videoSetModeSub(MODE_4_2D); + videoBgEnableSub(2); + videoBgEnableSub(3); + vramSetBankC(VRAM_C_SUB_BG_0x06200000); - SUB_BG2_CR = BG_COLOR_256 | BG_RS_32x32 | BG_MAP_BASE(4) | - BG_TILE_BASE(0) | BG_PRIORITY(0); - SUB_BG2_XDX = 0x100; - SUB_BG2_XDY = 0; - SUB_BG2_YDX = 0; - SUB_BG2_YDY = 0x100; - SUB_BG2_CX = 0; - SUB_BG2_CY = 0; - - SUB_BG3_CR = BG_BMP8_256x256 | BG_BMP_BASE(1) | BG_PRIORITY(1); - SUB_BG3_XDX = 0x100; - SUB_BG3_XDY = 0; - SUB_BG3_YDX = 0; - SUB_BG3_YDY = 0x100; - SUB_BG3_CX = 0; - SUB_BG3_CY = 0; + sub_bitmap_bg = bgInit(3, BgType_Bmp8, BgSize_B8_256x256, 1, 0); + sub_text_overlay_bg = bgInit(2, BgType_Rotation, BgSize_R_256x256, 4, 0); + + bgSetPriority(sub_bitmap_bg, 1); + bgSetPriority(sub_text_overlay_bg, 0); /* Tell 'framebuffer' routines to use this */ |