★ PROGRAMMER'S GUIDE ★ VDP2 library Figure 1 Comparison of VRAM and data size
┏━━━━━━━━━━━━━┓ ┌────────────────┐ RBG0 ┃VRAM A0 ┃│256 color bitmap data │ ┃ ┃ │ (512 × 256) │ ┃ ┃ │ 1M bit │ ┃ ┃ │ │ │ ┃ ┃ │ │ │ ┣━━━━━━━━━━━━━┫ ┝━━━━━━━━━━━━━━━━┥ ┃VRAM A1 ┃│Rotation parameter coefficient table │ ┃ ┃ │ (1 word) │ ┃ ┃ │ │ │ ┃ ┃ ├────────────────┤ ┃ ┃ │ Rotation parameter table │ ┣━━━━━━━━━━━━━┫ ┝━━━━━━━━━━━━━━━━┥ NBG0 ┃ VRAM B0 ┃ │ 16-color bitmap data │ ┃ ┃ │ (512 × 256) 0.5Mbit │ ┃ ┃ ├────────────────┤ NBG2 ┃ ┃ │ Character pattern data │ ┃ ┃ │ Pattern name data │ ┣━━━━━━━━━━━━━┫ ┝━━━━━━━━━━━━━━━━┥ NBG1 ┃ VRAM B1 ┃ │ 16-color bitmap data │ ┃ ┃ │ (512 × 256) 0.5Mbit │ ┃ ┃ ├────────────────┤ NBG3 ┃ ┃ │ Character pattern data │ ┃ ┃ │ Pattern name data │ ┗━━━━━━━━━━━━━┛ └────────────────┘
┏━━━━━━━━━━━━━┓ ┌────────────────┐ RBG0 ┃VRAM A0 ┃│256 color bitmap data │ ┃ ┃ │ (512 × 256) │ ┃ ┃ │ 1M bit │ ┃ ┃ │ │ │ ┃ ┃ │ │ │ ┣━━━━━━━━━━━━━┫ ┝━━━━━━━━━━━━━━━━┥ ┃VRAM A1 ┃│Rotation parameter coefficient table │ ┃ ┃ │ (1 word) │ ┃ ┃ │ │ │ ┃ ┃ ├────────────────┤ ┃ ┃ │ Rotation parameter table │ ┣━━━━━━━━━━━━━┫ ┝━━━━━━━━━━━━━━━━┥ RBG1 ┃VRAM B0 ┃│Character pattern data │ ┃ ┃ │ 1Mbit │ ┃ ┃ │ │ │ ┃ ┃ │ │ │ ┃ ┃ │ │ │ ┣━━━━━━━━━━━━━┫ ┝━━━━━━━━━━━━━━━━┥ ┃VRAM B1 ┃│Pattern name data │ ┃ ┃ │ 1Mbit │ ┃ ┃ │ │ │ ┃ ┃ │ │ │ ┃ ┃ │ │ │ ┗━━━━━━━━━━━━━┛ └────────────────┘
Item | NBG0 ~ NBG3 | RBG0, RBG1 | ||
|---|---|---|---|---|
Reduction setting | 1x | 1/2 times | 1/4 times | − |
Number of VRAM accesses required for one cycle | 1 | 2 | Four | 8 |
Item | NBG0 ~ NBG3 | RBG0, RBG1 | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
TV screen mode | normal | High resolution | exclusive | ||||||||
Number of character colors | 16 | 256 | 2048 | 32768 | 16.77 million | − | − | − | |||
Reduction setting (double) | 1 | 1/2 | 1/4 | 1 | 1/2 | 1 | 1 | 1 | − | − | − |
Number of VRAM accesses required for one cycle | 1 | 2 | Four | 2 | Four | Four | Four | 8 | 8 | Four | Four |
┏━━━━━━━━━━━━━┓ ┌────────────────┐ NBG0 1x ┃ VRAM A ┃ │ 16-color bitmap data │ ┃ ┃ │ │ │ ┃ ┃ ├────────────────┤ NBG1 1x ┃ ┃ │ 16-color bitmap data │ ┃ ┃ │ │ │ ┃ ┃ ├────────────────┤ NBG2 1x ┃ ┃ │ Character pattern data │ ┃ ┃ │ Pattern name data │ ┃ ┃ ├────────────────┤ NBG3 1x ┃ ┃ │ Character pattern data │ ┃ ┃ │ Pattern name data │ ┣━━━━━━━━━━━━━┫ ┝━━━━━━━━━━━━━━━━┥ NBG0 1/4 times ┃VRAM B0 ┃│16 color bitmap data │ ┃ ┃ │ │ │ ┃ ┃ ├────────────────┤ NBG1 1/4 times ┃ ┃ │ 16-color bitmap data │ ┃ ┃ │ │ │ ┣━━━━━━━━━━━━━┫ ┝━━━━━━━━━━━━━━━━┥ NBG2 1x ┃ VRAM B1 ┃ │ Character pattern data │ ┃ ┃ │ Pattern name data │ ┃ ┃ ├────────────────┤ NBG3 1x ┃ ┃ │ Character pattern data │ ┃ ┃ │ Pattern name data │ ┗━━━━━━━━━━━━━┛ └────────────────┘
#include <machine.h>
#include "sega_scl.h"
/ * Cycle pattern table settings * /
Uint16 n0_cycle [] = {0x44ff, 0x0fff, / * VRAM A (A0) NBG0 character pattern and pattern name table available * /
0xffff, 0xffff, / * VRAM A1 VRAM A is not divided, so * /
/* unused */
0xffff, 0xffff, / * VRAM B (B0) No data * /
0xffff, 0xffff}; / * VRAM B1 VRAM B is not divided, so * /
/* unused */
extern Uint16 ColData []; / * Palette data pointer * /
SclConfig scfg;
main ()
{
SCL_Vdp2Init (); / * Initialize VDP2 library * /
SCL_SetDisplayMode (SCL_NON_INTER, SCL_224LINE, SCL_NOMAL_A);
/ * Screen mode settings * /
SCL_SetColRamMode (SCL_CRM_2048);
/ * Color RAM mode setting * /
SCL_AllocColRam (SCL_NBG0,256, ON);
/ * Secure pallet area * /
SCL_SetColRam (SCL_NBG0,0,265,ColData);
/ * Palette data settings * /
.................. / * Stores scroll data in VDP2 VRAM. * /
SCL_InitConfigTb (& scfg); / * Scroll NBG0 Configuration initialization * /
scfg.dispenbl = ON; / * Display NBG0 on screen * /
scfg.charsize = SCL_CHAR_SIZE_1X1;
scfg.pnamesize = SCL_PN1WORD;
scfg.platesize = SCL_PL_SIZE_1X1;
scfg.coltype = SCL_COL_TYPE_256;
scfg.flip = SCL_PN_12BIT;
scfg.datatype = SCL_CELL;
scfg.plate_addr [0] = SCL_VDP2_VRAM_A + 0x0000;
scfg.plate_addr [1] = SCL_VDP2_VRAM_A + 0x2000;
scfg.plate_addr [2] = SCL_VDP2_VRAM_A + 0x4000;
scfg.plate_addr [3] = SCL_VDP2_VRAM_A + 0x6000;
SCL_SetConfig (SCL_NBG0, & scfg);
SCL_SetPriority (SCL_NBG0,7); / * Set priority to maximum * /
SCL_SetCycleTable (n0_cycle); / * Cycle pattern setting * /
INT_SetScuFunc (.....); / * Register V-Blank routine * /
set_imask (0); / * Enable interrupts. * /
SCL_Open (SCL_NBG0); / * NBG0 open processing * /
SCL_Move (FIXED (1), FIXED (1), 0); / * Various scroll operation functions * /
..
..
..
SCL_Close (SCL_NBG0); / * Scroll processing finished * /
SCL_DisplayFrame (); / * Wait for V_BLANK and scroll display * /
}
★ PROGRAMMER'S GUIDE ★ VDP2 library