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 | ||
---|---|---|---|---|
Reduce settings | 1x | 1/2 times | 1/4 times | − |
Number of VRAM accesses required in one cycle | 1 | 2 | 4 | 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 settings (x) | 1 | 1/2 | 1/4 | 1 | 1/2 | 1 | 1 | 1 | − | − | − |
Number of VRAM accesses required in one cycle | 1 | 2 | 4 | 2 | 4 | 4 | 4 | 8 | 8 | 4 | 4 |
┏━━━━━━━━━━━━━┓ ┌──────────────────────┐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/4x ┃VRAM B0 ┃ │16-color bitmap data │ ┃ ┃ │ │ ┃ ┃ ├──────────────────────┤NBG1 1/4x ┃ ┃ │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 included */ 0xffff, 0xffff, /* VRAM A1 VRAM A is not divided */ /* unused */ 0xffff, 0xffff, /* VRAM B(B0) No data */ 0xffff, 0xffff}; /* VRAM B1 VRAM B is not divided */ /* unused */ extern Uint16 ColData[]; /* Pointer to palette data */ 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 settings */ SCL_AllocColRam(SCL_NBG0,256,ON); /* Reserve pallet area */ SCL_SetColRam(SCL_NBG0,0,265,ColData); /* Palette data settings */ ................... /* Store 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); /* Set cycle pattern */ 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 movement functions */ . . . SCL_Close(SCL_NBG0); /* End of scroll processing */ SCL_DisplayFrame(); /* Wait for V_BLANK and scroll display */ }