
データ構造 | |
| struct | NTSC_STATUS |
| struct | NTSC |
| struct | VIDEO |
| struct | GRAPH |
| struct | METER |
| struct | TRACK |
マクロ定義 | |
| #define | VIDEO_FAST |
| #define | NTSC_WIDTH 256 |
| #define | NTSC_HEIGHT 192 |
| #define | NTSC_VRAM_SIZE ((NTSC_WIDTH >> 3) * NTSC_HEIGHT) |
| #define | GRAPH_SIZE (100) |
| #define | TRACK_SIZE (5) |
| #define | VIDEO_circle(x, y, r) VIDEO_arc(x, y, r, 0, 360) |
| #define | VIDEO_circle_(x, y, r) VIDEO_arc(x, y, r, 0, 360) |
型定義 | |
| typedef struct NTSC_STATUS | NTSC_STATUS_T |
| typedef NTSC_STATUS_T * | pNTSC_STATUS_T |
| typedef struct NTSC | NTSC_T |
| typedef NTSC_T * | pNTSC_T |
| typedef struct VIDEO | VIDEO_T |
| typedef VIDEO_T * | pVIDEO_T |
| typedef struct GRAPH | GRAPH_T |
| typedef GRAPH_T * | pGRAPH_T |
| typedef struct METER | METER_T |
| typedef METER_T * | pMETER_T |
| typedef struct TRACK | TRACK_T |
| typedef TRACK_T * | pTRACK_T |
関数 | |
| void | VIDEO_init (void) |
| void | VIDEO_init_clock (void) |
| void | VIDEO_vram_clear (unsigned int pattern) |
| unsigned char | VIDEO_get_output (void) |
| unsigned int | VIDEO_get_point (unsigned int x, unsigned int y) |
| void | VIDEO_point (unsigned int x, unsigned int y) |
| void | VIDEO_point_ (unsigned int x, unsigned int y) |
| void | VIDEO_line (int x0, int y0, int x1, int y1) |
| void | VIDEO_line_ (int x0, int y0, int x1, int y1) |
| void | VIDEO_arc (unsigned int x, unsigned int y, unsigned int r, unsigned int start, unsigned int end) |
| void | VIDEO_arc_ (unsigned int x, unsigned int y, unsigned int r, unsigned int start, unsigned int end) |
| void | VIDEO_locate (unsigned int x, unsigned int y) |
| void | VIDEO_putch (unsigned char c) |
| void | VIDEO_putstr (const char *s) |
| void | VIDEO_puthex (unsigned char a) |
| void | VIDEO_putbin (unsigned char a) |
| void | VIDEO_putuint (unsigned int digit, unsigned char size) |
| void | VIDEO_putint (int digit, unsigned char size) |
| void | VIDEO_putdouble (double digit, unsigned char size, unsigned char size2) |
| void | GRAPH_init (pGRAPH_T graph, unsigned int x, unsigned int y, unsigned int width, unsigned int height) |
| void | GRAPH_putdata (pGRAPH_T graph, unsigned int data) |
| void | GRAPH_draw_point (pGRAPH_T graph) |
| void | GRAPH_draw_line (pGRAPH_T graph) |
| void | GRAPH_draw_bar (pGRAPH_T graph) |
| void | METER_init (pMETER_T meter, unsigned int x, unsigned int y, unsigned char r) |
| void | METER_draw (pMETER_T meter, unsigned int value) |
| void | TRACK_init (pTRACK_T track, unsigned int x, unsigned int y, unsigned int width, unsigned int height) |
| void | TRACK_putdata (pTRACK_T track, unsigned int x, unsigned int y) |
| void | TRACK_draw_point (pTRACK_T track) |
変数 | |
| NTSC_T | ntsc |
| VIDEO_T | video |
| #define GRAPH_SIZE (100) |
libvideo.h の 35 行で定義されています。
参照元 GRAPH_init().
| #define NTSC_HEIGHT 192 |
libvideo.h の 32 行で定義されています。
参照元 GRAPH_init(), VIDEO_get_point(), VIDEO_init(), VIDEO_line(), VIDEO_line_(), VIDEO_point(), VIDEO_point_(), と VIDEO_putch().
| #define NTSC_VRAM_SIZE ((NTSC_WIDTH >> 3) * NTSC_HEIGHT) |
libvideo.h の 33 行で定義されています。
| #define NTSC_WIDTH 256 |
libvideo.h の 31 行で定義されています。
参照元 __attribute__(), GRAPH_init(), VIDEO_get_point(), VIDEO_init(), VIDEO_line(), VIDEO_line_(), VIDEO_locate(), VIDEO_point(), VIDEO_point_(), と VIDEO_putch().
| #define TRACK_SIZE (5) |
libvideo.h の 36 行で定義されています。
参照元 TRACK_draw_point(), と TRACK_putdata().
| #define VIDEO_circle | ( | x, | ||
| y, | ||||
| r | ||||
| ) | VIDEO_arc(x, y, r, 0, 360) |
libvideo.h の 132 行で定義されています。
| #define VIDEO_circle_ | ( | x, | ||
| y, | ||||
| r | ||||
| ) | VIDEO_arc(x, y, r, 0, 360) |
libvideo.h の 133 行で定義されています。
| #define VIDEO_FAST |
libvideo.h の 25 行で定義されています。
| typedef struct NTSC_STATUS NTSC_STATUS_T |
libvideo.h の 87 行で定義されています。
libvideo.h の 95 行で定義されています。
| typedef NTSC_STATUS_T* pNTSC_STATUS_T |
libvideo.h の 61 行で定義されています。
libvideo.h の 71 行で定義されています。
libvideo.h の 105 行で定義されています。
libvideo.h の 77 行で定義されています。
| void GRAPH_draw_bar | ( | pGRAPH_T | graph | ) |
libvideo.c の 1050 行で定義されています。
参照先 GRAPH::data, GRAPH::height, GRAPH::ptr, VIDEO_line(), VIDEO_line_(), GRAPH::width, GRAPH::x, と GRAPH::y.
{
unsigned int i, x, y;
for(i = 0; i < graph->width; i++){
x = graph->x + i;
y = graph->y + (((unsigned int)graph->data[(graph->ptr + i) % graph->width] * graph->height) / 100);
VIDEO_line_(x, graph->y, x, y);
VIDEO_line (x, y , x, graph->y + graph->height);
}
return;
}

| void GRAPH_draw_line | ( | pGRAPH_T | graph | ) |
libvideo.c の 1028 行で定義されています。
参照先 GRAPH::data, GRAPH::height, GRAPH::ptr, VIDEO_line(), VIDEO_line_(), VIDEO_point_(), GRAPH::width, GRAPH::x, と GRAPH::y.
{
unsigned int i, w, x, y1, y2, y3;
w = graph->width * 2 - 2;
for(i = graph->width + 1; i < w; i++){
x = graph->x + i - graph->width;
y1 = graph->y + (((unsigned int)graph->data[(graph->ptr + i - 1) % graph->width] * graph->height) / 100);
y2 = graph->y + (((unsigned int)graph->data[(graph->ptr + i ) % graph->width] * graph->height) / 100);
y3 = graph->y + (((unsigned int)graph->data[(graph->ptr + i + 1) % graph->width] * graph->height) / 100);
VIDEO_line_(x, y1, x + 1, y2);
VIDEO_line (x, y2, x + 1, y3);
}
for(i = graph->y; i < graph->y + graph->height; i++){
VIDEO_point_(graph->x, i);
VIDEO_point_(graph->x + graph->width, i);
}
return;
}

| void GRAPH_draw_point | ( | pGRAPH_T | graph | ) |
libvideo.c の 1006 行で定義されています。
参照先 GRAPH::data, GRAPH::height, GRAPH::ptr, VIDEO_point(), VIDEO_point_(), GRAPH::width, GRAPH::x, と GRAPH::y.
{
unsigned int i, w, x, y;
for(i = graph->y; i < graph->y + graph->height; i++){
VIDEO_point_(graph->x, i);
}
w = graph->width * 2;
for(i = graph->width; i < w; i++){
x = graph->x + i - graph->width;
y = graph->y + (((unsigned int)graph->data[(graph->ptr + i - 1) % graph->width] * graph->height) / 100);
VIDEO_point_(x, y);
y = graph->y + (((unsigned int)graph->data[(graph->ptr + i ) % graph->width] * graph->height) / 100);
VIDEO_point(x, y);
}
return;
}

| void GRAPH_init | ( | pGRAPH_T | graph, | |
| unsigned int | x, | |||
| unsigned int | y, | |||
| unsigned int | width, | |||
| unsigned int | height | |||
| ) |
libvideo.c の 959 行で定義されています。
参照先 GRAPH::data, GRAPH_SIZE, GRAPH::height, NTSC_HEIGHT, NTSC_WIDTH, GRAPH::ptr, GRAPH::width, GRAPH::x, と GRAPH::y.
{
unsigned int i;
#ifndef VIDEO_FAST /* このブロックは未検証 */
if(width >= GRAPH_SIZE){
width = GRAPH_SIZE;
}
if(x + width > NTSC_WIDTH){
width = NTSC_WIDTH - x;
}
if(y + height > NTSC_HEIGHT){
height = NTSC_HEIGHT - y;
}
#endif
graph->x = x;
graph->y = y;
graph->width = width;
graph->height = height;
graph->ptr = 0;
for(i = 0; i < GRAPH_SIZE; i++){
graph->data[i] = 0;
}
return;
}
| void GRAPH_putdata | ( | pGRAPH_T | graph, | |
| unsigned int | data | |||
| ) |
libvideo.c の 992 行で定義されています。
参照先 GRAPH::data, GRAPH::ptr, と GRAPH::width.
| void METER_draw | ( | pMETER_T | meter, | |
| unsigned int | value | |||
| ) |
libvideo.c の 1084 行で定義されています。
参照先 METER::old, METER::r, tcos, tsin, VIDEO_line(), VIDEO_line_(), METER::x, と METER::y.
{
double rc, rs;
if(value > 100) value = 100;
rc = (double)meter->r * tcos[0];
rs = (double)meter->r * tsin[0];
VIDEO_line(meter->x + rc, meter->y + rs, meter->x + 0.7 * rc, meter->y + 0.7 * rs);
rc = (double)meter->r * tcos[270];
rs = (double)meter->r * tsin[270];
VIDEO_line(meter->x + rc, meter->y + rs, meter->x + 0.7 * rc, meter->y + 0.7 * rs);
rc = (double)meter->r * tcos[meter->old];
rs = (double)meter->r * tsin[meter->old];
VIDEO_line_(meter->x + rc, meter->y + rs, meter->x + 0.7 * rc, meter->y + 0.7 * rs);
meter->old = ((100 - value) * 27) / 10;
rc = (double)meter->r * tcos[meter->old];
rs = (double)meter->r * tsin[meter->old];
VIDEO_line (meter->x + rc, meter->y + rs, meter->x + 0.7 * rc, meter->y + 0.7 * rs);
return;
}

| void METER_init | ( | pMETER_T | meter, | |
| unsigned int | x, | |||
| unsigned int | y, | |||
| unsigned char | r | |||
| ) |
libvideo.c の 1068 行で定義されています。
参照先 METER::old, METER::r, VIDEO_arc(), METER::x, と METER::y.

| void TRACK_draw_point | ( | pTRACK_T | track | ) |
libvideo.c の 1151 行で定義されています。
参照先 TRACK::data, TRACK::height, TRACK::ptr, TRACK_SIZE, VIDEO_line(), VIDEO_point(), VIDEO_point_(), TRACK::width, TRACK::x, と TRACK::y.
{
unsigned int tmp;
/* 消す */
tmp = (track->ptr + 1) % TRACK_SIZE;
VIDEO_point_(track->x + (track->width * track->data[ tmp ][0]) / 100,
track->y + (track->height * track->data[ tmp ][1]) / 100);
VIDEO_point_(track->x + (track->width * track->data[ tmp ][0]) / 100 + 1,
track->y + (track->height * track->data[ tmp ][1]) / 100);
VIDEO_point_(track->x + (track->width * track->data[ tmp ][0]) / 100,
track->y + (track->height * track->data[ tmp ][1]) / 100 + 1);
VIDEO_point_(track->x + (track->width * track->data[ tmp ][0]) / 100 + 1,
track->y + (track->height * track->data[ tmp ][1]) / 100 + 1);
VIDEO_point_(track->x + (track->width * track->data[ tmp ][0]) / 100 + 2,
track->y + (track->height * track->data[ tmp ][1]) / 100);
VIDEO_point_(track->x + (track->width * track->data[ tmp ][0]) / 100,
track->y + (track->height * track->data[ tmp ][1]) / 100 + 2);
VIDEO_point_(track->x + (track->width * track->data[ tmp ][0]) / 100 + 1,
track->y + (track->height * track->data[ tmp ][1]) / 100 + 2);
VIDEO_point_(track->x + (track->width * track->data[ tmp ][0]) / 100 + 2,
track->y + (track->height * track->data[ tmp ][1]) / 100 + 1);
VIDEO_point_(track->x + (track->width * track->data[ tmp ][0]) / 100 + 2,
track->y + (track->height * track->data[ tmp ][1]) / 100 + 2);
/* 描く */
VIDEO_point(track->x + (track->width * track->data[ track->ptr ][0]) / 100,
track->y + (track->height * track->data[ track->ptr ][1]) / 100);
VIDEO_point(track->x + (track->width * track->data[ track->ptr ][0]) / 100 + 1,
track->y + (track->height * track->data[ track->ptr ][1]) / 100);
VIDEO_point(track->x + (track->width * track->data[ track->ptr ][0]) / 100,
track->y + (track->height * track->data[ track->ptr ][1]) / 100 + 1);
VIDEO_point(track->x + (track->width * track->data[ track->ptr ][0]) / 100 + 1,
track->y + (track->height * track->data[ track->ptr ][1]) / 100 + 1);
VIDEO_point(track->x + (track->width * track->data[ track->ptr ][0]) / 100 + 2,
track->y + (track->height * track->data[ track->ptr ][1]) / 100);
VIDEO_point(track->x + (track->width * track->data[ track->ptr ][0]) / 100,
track->y + (track->height * track->data[ track->ptr ][1]) / 100 + 2);
VIDEO_point(track->x + (track->width * track->data[ track->ptr ][0]) / 100 + 1,
track->y + (track->height * track->data[ track->ptr ][1]) / 100 + 2);
VIDEO_point(track->x + (track->width * track->data[ track->ptr ][0]) / 100 + 2,
track->y + (track->height * track->data[ track->ptr ][1]) / 100 + 1);
VIDEO_point(track->x + (track->width * track->data[ track->ptr ][0]) / 100 + 2,
track->y + (track->height * track->data[ track->ptr ][1]) / 100 + 2);
/* 十字を描く */
tmp = track->y + (track->height >> 1);
VIDEO_line(track->x, tmp, track->x + track->width, tmp);
tmp = track->x + (track->width >> 1);
VIDEO_line(tmp, track->y, tmp, track->y + track->height);
return;
}

| void TRACK_init | ( | pTRACK_T | track, | |
| unsigned int | x, | |||
| unsigned int | y, | |||
| unsigned int | width, | |||
| unsigned int | height | |||
| ) |
libvideo.c の 1113 行で定義されています。
参照先 TRACK::data, TRACK::height, TRACK::ptr, TRACK::width, TRACK::x, と TRACK::y.
| void TRACK_putdata | ( | pTRACK_T | track, | |
| unsigned int | x, | |||
| unsigned int | y | |||
| ) |
libvideo.c の 1135 行で定義されています。
参照先 TRACK::data, TRACK::ptr, と TRACK_SIZE.
| void VIDEO_arc | ( | unsigned int | x, | |
| unsigned int | y, | |||
| unsigned int | r, | |||
| unsigned int | start, | |||
| unsigned int | end | |||
| ) |
libvideo.c の 685 行で定義されています。
参照先 tcos, tsin, と VIDEO_point().
参照元 METER_init().
{
unsigned int deg;
#ifndef VIDEO_FAST
if(start > end){
deg = end;
end = start;
start = deg;
}
#endif
for(deg = start; deg < end; deg++){
VIDEO_point (x + (double)r * tcos[deg], y + (double)r * tsin[deg]);
}
return;
}


| void VIDEO_arc_ | ( | unsigned int | x, | |
| unsigned int | y, | |||
| unsigned int | r, | |||
| unsigned int | start, | |||
| unsigned int | end | |||
| ) |
libvideo.c の 704 行で定義されています。
参照先 tcos, tsin, と VIDEO_point_().
{
unsigned int deg;
#ifndef VIDEO_FAST
if(start > end){
deg = end;
end = start;
start = deg;
}
#endif
for(deg = start; deg < end; deg++){
VIDEO_point_(x + (double)r * tcos[deg], y + (double)r * tsin[deg]);
}
return;
}

| unsigned char VIDEO_get_output | ( | void | ) |
| unsigned int VIDEO_get_point | ( | unsigned int | x, | |
| unsigned int | y | |||
| ) |
libvideo.c の 482 行で定義されています。
参照先 ntsc, NTSC_HEIGHT, NTSC_WIDTH, と NTSC::vram.
{
const unsigned int table[] = {
/* FEDCBA9876543210 */
0b1000000000000000, /* 0 */
0b0100000000000000, /* 1 */
0b0010000000000000, /* 2 */
0b0001000000000000, /* 3 */
0b0000100000000000, /* 4 */
0b0000010000000000, /* 5 */
0b0000001000000000, /* 6 */
0b0000000100000000, /* 7 */
0b0000000010000000, /* 8 */
0b0000000001000000, /* 9 */
0b0000000000100000, /* a */
0b0000000000010000, /* b */
0b0000000000001000, /* c */
0b0000000000000100, /* d */
0b0000000000000010, /* e */
0b0000000000000001, /* f */
};
#ifndef VIDEO_FAST
if(x >= NTSC_WIDTH) x = NTSC_WIDTH - 1;
if(y >= NTSC_HEIGHT) y = NTSC_HEIGHT - 1;
#endif
#ifdef VIDEO_MIRROR
x = (NTSC_WIDTH - 1) - x;
#endif
return(ntsc.vram[ (y << 4) + (x >> 4) ] & table[ (x & 0x0f) ] ? 1 : 0);
}
| void VIDEO_init | ( | void | ) |
libvideo.c の 116 行で定義されています。
参照先 VIDEO::cx, VIDEO::cy, NTSC_STATUS::horizon_pulse, NTSC::monitor, ntsc, NTSC_HEIGHT, NTSC_WIDTH, NTSC::superimpose, VIDEO_init_clock(), VIDEO_line(), VIDEO_vram_clear(), と NTSC_STATUS::video_width.
参照元 main().
{
/* 変数初期化 */
video.cx = 0;
video.cy = 0;
VIDEO_vram_clear(0xaaaa);
/* 白枠 */
VIDEO_line( 1, 1, NTSC_WIDTH - 2, 1);
VIDEO_line( 1, 1, 1, NTSC_HEIGHT - 1);
VIDEO_line(NTSC_WIDTH - 2, 1, NTSC_WIDTH - 2, NTSC_HEIGHT - 1);
VIDEO_line( 1, NTSC_HEIGHT - 1, NTSC_WIDTH - 2, NTSC_HEIGHT - 1);
VIDEO_line( 2, 2, NTSC_WIDTH - 3, 2);
VIDEO_line( 2, 2, 2, NTSC_HEIGHT - 2);
VIDEO_line(NTSC_WIDTH - 3, 2, NTSC_WIDTH - 3, NTSC_HEIGHT - 2);
VIDEO_line( 2, NTSC_HEIGHT - 2, NTSC_WIDTH - 3, NTSC_HEIGHT - 2);
VIDEO_line( 3, 3, NTSC_WIDTH - 4, 3);
VIDEO_line( 3, 3, 3, NTSC_HEIGHT - 3);
VIDEO_line(NTSC_WIDTH - 4, 3, NTSC_WIDTH - 4, NTSC_HEIGHT - 3);
VIDEO_line( 3, NTSC_HEIGHT - 3, NTSC_WIDTH - 4, NTSC_HEIGHT - 3);
VIDEO_line( 4, 4, NTSC_WIDTH - 5, 4);
VIDEO_line( 4, 4, 4, NTSC_HEIGHT - 4);
VIDEO_line(NTSC_WIDTH - 5, 4, NTSC_WIDTH - 5, NTSC_HEIGHT - 4);
VIDEO_line( 4, NTSC_HEIGHT - 4, NTSC_WIDTH - 5, NTSC_HEIGHT - 4);
/* モニタ出力用の初期化 */
VIDEO_init_clock();
RPOR6bits.RP13R = 7;
if(ntsc.monitor.video_width > NTSC_WIDTH) ntsc.monitor.video_width = NTSC_WIDTH;
ntsc.monitor.video_width = ntsc.monitor.video_width >> 4;
ntsc.superimpose.video_width = ntsc.monitor.video_width;
/* FEDBCA9876543210 */
SPI1CON1 = 0b0000010000110111;
SPI1CON2 = 0b0000000000000000;
SPI1STAT = 0b1000000000000000;
IPC2bits.SPI1IP = 7;
IEC0bits.SPI1IE = 1;
IFS0bits.SPI1IF = 0;
IPC0bits.OC1IP = 7;
IEC0bits.OC1IE = 1;
IFS0bits.OC1IF = 0;
IPC1bits.OC2IP = 7;
IEC0bits.OC2IE = 1;
IFS0bits.OC2IF = 0;
PR2 = ntsc.monitor.horizon_pulse;
TMR2 = 0x0000;
IPC1bits.T2IP = 7;
IEC0bits.T2IE = 1;
IFS0bits.T2IF = 0;
/* FEDBCA9876543210 */
T2CON = 0b1000000000000000;
/* スーパーインポーズ用の初期化 */
VIDEO_init_superimpose();
return;
}


| void VIDEO_init_clock | ( | void | ) |
libvideo.c の 226 行で定義されています。
参照先 cpu_fcy, NTSC_STATUS::equalizing_pulse, NTSC_STATUS::horizon_pulse, NTSC_STATUS::left_space, NTSC::monitor, ntsc, NTSC_DEFAULT_FCY, NTSC_EQUALIZING_PULSE, NTSC_HORIZON_PULSE, NTSC_LEFT_SPACE, NTSC_SERRATION_PULSE, NTSC_VIDEO_WIDTH, NTSC_STATUS::serration_pulse, NTSC::superimpose, と NTSC_STATUS::video_width.
参照元 VIDEO_init().
{
ntsc.monitor.horizon_pulse = (double)NTSC_HORIZON_PULSE * ((double)cpu_fcy[ OSCTUN ] / (double)NTSC_DEFAULT_FCY);
ntsc.monitor.serration_pulse = (double)NTSC_SERRATION_PULSE * ((double)cpu_fcy[ OSCTUN ] / (double)NTSC_DEFAULT_FCY);
ntsc.monitor.equalizing_pulse = (double)NTSC_EQUALIZING_PULSE * ((double)cpu_fcy[ OSCTUN ] / (double)NTSC_DEFAULT_FCY);
ntsc.monitor.left_space = (double)NTSC_LEFT_SPACE * ((double)cpu_fcy[ OSCTUN ] / (double)NTSC_DEFAULT_FCY);
ntsc.monitor.video_width = (double)NTSC_VIDEO_WIDTH * ((double)cpu_fcy[ OSCTUN ] / (double)NTSC_DEFAULT_FCY);
ntsc.superimpose.left_space = (double)60 * ((double)cpu_fcy[ OSCTUN ] / (double)NTSC_DEFAULT_FCY);
return;
}

| void VIDEO_line | ( | int | x0, | |
| int | y0, | |||
| int | x1, | |||
| int | y1 | |||
| ) |
libvideo.c の 553 行で定義されています。
参照先 abs, NTSC_HEIGHT, NTSC_WIDTH, と VIDEO_point().
参照元 GRAPH_draw_bar(), GRAPH_draw_line(), METER_draw(), TRACK_draw_point(), と VIDEO_init().
{
int steep, t;
int deltax, deltay, error;
int x, y;
int ystep;
#ifndef VIDEO_FAST
if(x0 < 0) x0 = 0;
if(x0 >= NTSC_WIDTH) x0 = NTSC_WIDTH - 1;
if(x1 < 0) x1 = 0;
if(x1 >= NTSC_WIDTH) x1 = NTSC_WIDTH - 1;
if(y0 < 0) y0 = 0;
if(y0 >= NTSC_HEIGHT) y0 = NTSC_HEIGHT - 1;
if(y1 < 0) y1 = 0;
if(y1 >= NTSC_HEIGHT) y1 = NTSC_HEIGHT - 1;
#endif
steep = (abs(y1 - y0) > abs(x1 - x0));
if(steep){
t = x0; x0 = y0; y0 = t;
t = x1; x1 = y1; y1 = t;
}
if(x0 > x1) {
t = x0; x0 = x1; x1 = t;
t = y0; y0 = y1; y1 = t;
}
deltax = x1 - x0;
deltay = abs(y1 - y0);
error = 0;
y = y0;
if(y0 < y1) ystep = 1;
else ystep = -1;
if(steep){
for(x = x0; x < x1; x++) {
VIDEO_point(y,x);
error += deltay;
if((error << 1) >= deltax){
y += ystep;
error -= deltax;
}
}
} else {
for(x = x0; x < x1; x++) {
VIDEO_point(x,y);
error += deltay;
if((error << 1) >= deltax){
y += ystep;
error -= deltax;
}
}
}
return;
}


| void VIDEO_line_ | ( | int | x0, | |
| int | y0, | |||
| int | x1, | |||
| int | y1 | |||
| ) |
libvideo.c の 617 行で定義されています。
参照先 abs, NTSC_HEIGHT, NTSC_WIDTH, と VIDEO_point_().
参照元 GRAPH_draw_bar(), GRAPH_draw_line(), と METER_draw().
{
int steep, t;
int deltax, deltay, error;
int x, y;
int ystep;
#ifndef VIDEO_FAST
if(x0 < 0) x0 = 0;
if(x0 >= NTSC_WIDTH) x0 = NTSC_WIDTH - 1;
if(x1 < 0) x1 = 0;
if(x1 >= NTSC_WIDTH) x1 = NTSC_WIDTH - 1;
if(y0 < 0) y0 = 0;
if(y0 >= NTSC_HEIGHT) y0 = NTSC_HEIGHT - 1;
if(y1 < 0) y1 = 0;
if(y1 >= NTSC_HEIGHT) y1 = NTSC_HEIGHT - 1;
#endif
steep = (abs(y1 - y0) > abs(x1 - x0));
if(steep){
t = x0; x0 = y0; y0 = t;
t = x1; x1 = y1; y1 = t;
}
if(x0 > x1) {
t = x0; x0 = x1; x1 = t;
t = y0; y0 = y1; y1 = t;
}
deltax = x1 - x0;
deltay = abs(y1 - y0);
error = 0;
y = y0;
if(y0 < y1) ystep = 1;
else ystep = -1;
if(steep){
for(x = x0; x < x1; x++) {
VIDEO_point_(y,x);
error += deltay;
if((error << 1) >= deltax){
y += ystep;
error -= deltax;
}
}
} else {
for(x = x0; x < x1; x++) {
VIDEO_point_(x,y);
error += deltay;
if((error << 1) >= deltax){
y += ystep;
error -= deltax;
}
}
}
return;
}


| void VIDEO_locate | ( | unsigned int | x, | |
| unsigned int | y | |||
| ) |
libvideo.c の 754 行で定義されています。
参照先 VIDEO::cx, VIDEO::cy, FONTX2_get_ascii_width(), と NTSC_WIDTH.
参照元 main(), と SCREEN_main().
{
#ifdef VIDEO_MIRROR
video.cx = NTSC_WIDTH / FONTX2_get_ascii_width() - x - 1;
#else
video.cx = x;
#endif
video.cy = y;
return;
}


| void VIDEO_point | ( | unsigned int | x, | |
| unsigned int | y | |||
| ) |
libvideo.c の 520 行で定義されています。
参照先 ntsc, NTSC_HEIGHT, NTSC_WIDTH, と NTSC::vram.
参照元 GRAPH_draw_point(), TRACK_draw_point(), VIDEO_arc(), と VIDEO_line().
{
#ifndef VIDEO_FAST
if(x >= NTSC_WIDTH) x = NTSC_WIDTH - 1;
if(y >= NTSC_HEIGHT) y = NTSC_HEIGHT - 1;
#endif
#ifdef VIDEO_MIRROR
x = (NTSC_WIDTH - 1) - x;
#endif
ntsc.vram[ ((NTSC_HEIGHT - 1 - y) << 4) + (x >> 4) ] |= (0x8000 >> (x & 0x0f));
return;
}

| void VIDEO_point_ | ( | unsigned int | x, | |
| unsigned int | y | |||
| ) |
libvideo.c の 534 行で定義されています。
参照先 ntsc, NTSC_HEIGHT, NTSC_WIDTH, と NTSC::vram.
参照元 GRAPH_draw_line(), GRAPH_draw_point(), TRACK_draw_point(), VIDEO_arc_(), と VIDEO_line_().
{
#ifndef VIDEO_FAST
if(x >= NTSC_WIDTH) x = NTSC_WIDTH - 1;
if(y >= NTSC_HEIGHT) y = NTSC_HEIGHT - 1;
#endif
#ifdef VIDEO_MIRROR
x = (NTSC_WIDTH - 1) - x;
#endif
ntsc.vram[ ((NTSC_HEIGHT - 1 - y) << 4) + (x >> 4) ] &= ‾(0x8000 >> (x & 0x0f));
return;
}

| void VIDEO_putbin | ( | unsigned char | a | ) |
libvideo.c の 888 行で定義されています。
参照先 VIDEO_putch().
{
VIDEO_putch('0' + ((a >> 7) & 0x01));
VIDEO_putch('0' + ((a >> 6) & 0x01));
VIDEO_putch('0' + ((a >> 5) & 0x01));
VIDEO_putch('0' + ((a >> 4) & 0x01));
VIDEO_putch('0' + ((a >> 3) & 0x01));
VIDEO_putch('0' + ((a >> 2) & 0x01));
VIDEO_putch('0' + ((a >> 1) & 0x01));
VIDEO_putch('0' + ( a & 0x01));
return;
}

| void VIDEO_putch | ( | unsigned char | c | ) |
libvideo.c の 769 行で定義されています。
参照先 VIDEO::cx, VIDEO::cy, FONTX2_get_ascii_font(), FONTX2_get_ascii_font_data(), FONTX2_get_ascii_height(), FONTX2_get_ascii_width(), FONTX2_get_ascii_width_byte(), ntsc, NTSC_HEIGHT, NTSC_WIDTH, と NTSC::vram.
参照元 SCREEN_main(), VIDEO_putbin(), VIDEO_putdouble(), VIDEO_puthex(), VIDEO_putint(), VIDEO_putstr(), と VIDEO_putuint().
{
/* 文字列の連続出力のための、折り返し処理 */
#ifdef VIDEO_MIRROR
if(video.cx == 0){
video.cx = NTSC_WIDTH / FONTX2_get_ascii_width();
//video.cy++;
}
#else
if(video.cx >= (NTSC_WIDTH / FONTX2_get_ascii_width())){
video.cx = 0;
video.cy++;
}
#endif
if(video.cy >= (NTSC_HEIGHT / FONTX2_get_ascii_height())){
video.cy = 0;
}
#if defined FONT_FAST8
{
/* フォントをバイト単位で VRAMへ転送する */
unsigned char i;
unsigned int *vram;
unsigned char *font;
vram = &ntsc.vram[ video.cy * FONTX2_get_ascii_height() * (NTSC_WIDTH >> 4) + (video.cx >> 1)];
font = FONTX2_get_ascii_font(c);
if(video.cx & 0x01){
for(i = 0; i < FONTX2_get_ascii_height(); i++){
*vram &= 0xff00;
#ifdef VIDEO_MIRROR
*vram |= (int)reverse(*font++);
#else
*vram |= (int)(*font++);
#endif
vram += (NTSC_WIDTH >> 4);
}
} else {
for(i = 0; i < FONTX2_get_ascii_height(); i++){
*vram &= 0x00ff;
#ifdef VIDEO_MIRROR
*vram |= (int)reverse(*font++) << 8;
#else
*vram |= (int)(*font++) << 8;
#endif
vram += (NTSC_WIDTH >> 4);
}
}
}
#else
{
/* フォントを VRAMへ転送する。遅いけれど、byte単位以外の変態フォントサイズに対応するため */
unsigned int x, y, i, j, k;
unsigned char grif;
for(y = 0; y < FONTX2_get_ascii_height(); y++){
i = FONTX2_get_ascii_height() * video.cy + y;
for(j = 0; j < FONTX2_get_ascii_width_byte(); j++){
#ifdef VIDEO_MIRROR
grif = reverse(FONTX2_get_ascii_font_data(c, j, y));
#else
grif = FONTX2_get_ascii_font_data(c, j, y);
#endif
for(x = 0; x < 8 && (j * 8 + x) < FONTX2_get_ascii_width(); x++){
k = x + video.cx * FONTX2_get_ascii_width();
if(grif & 0x80) ntsc.vram[(i << 4) + (k >> 4)] |= (0x8000 >> (k & 0x0F));
else ntsc.vram[(i << 4) + (k >> 4)] &= ‾(0x8000 >> (k & 0x0F));
grif = grif << 1;
}
}
}
}
#endif
#ifdef VIDEO_MIRROR
video.cx--;
#else
video.cx++;
#endif
return;
}


| void VIDEO_putdouble | ( | double | digit, | |
| unsigned char | size, | |||
| unsigned char | size2 | |||
| ) |
libvideo.c の 934 行で定義されています。
参照先 abs, と VIDEO_putch().
{
if(digit < 0) VIDEO_putch('-');
else VIDEO_putch(' ');
digit = abs(digit);
if(size > 4){ if((unsigned int)digit > 9999){ VIDEO_putch('0' + (unsigned char)((unsigned int)(digit / 10000) % 10)); } else { VIDEO_putch(' '); }; };
if(size > 3){ if((unsigned int)digit > 999){ VIDEO_putch('0' + (unsigned char)((unsigned int)(digit / 1000) % 10)); } else { VIDEO_putch(' '); }; };
if(size > 2){ if((unsigned int)digit > 99){ VIDEO_putch('0' + (unsigned char)((unsigned int)(digit / 100) % 10)); } else { VIDEO_putch(' '); }; };
if(size > 1){ if((unsigned int)digit > 9){ VIDEO_putch('0' + (unsigned char)((unsigned int)(digit / 10) % 10)); } else { VIDEO_putch(' '); }; };
VIDEO_putch('0' + (unsigned char)((unsigned int)digit % 10));
VIDEO_putch('.');
VIDEO_putch('0' + (unsigned int)((unsigned int)(digit * 10.0) % 10));
if(size2 > 1) VIDEO_putch('0' + (unsigned int)((unsigned int)(digit * 100.0) % 10));
if(size2 > 2) VIDEO_putch('0' + (unsigned int)((unsigned int)(digit * 1000.0) % 10));
if(size2 > 3) VIDEO_putch('0' + (unsigned int)((unsigned int)(digit * 10000.0) % 10));
return;
}

| void VIDEO_puthex | ( | unsigned char | a | ) |
libvideo.c の 877 行で定義されています。
参照先 hex, と VIDEO_putch().
{
VIDEO_putch(hex[(a >> 4) & 0x0f]);
VIDEO_putch(hex[ a & 0x0f]);
return;
}

| void VIDEO_putint | ( | int | digit, | |
| unsigned char | size | |||
| ) |
libvideo.c の 919 行で定義されています。
参照先 abs, と VIDEO_putch().
{
if(digit < 0) VIDEO_putch('-');
else VIDEO_putch(' ');
digit = abs(digit);
if(size > 4){ if(digit > 9999){ VIDEO_putch('0' + digit / 10000 % 10); } else { VIDEO_putch(' '); }; };
if(size > 3){ if(digit > 999){ VIDEO_putch('0' + digit / 1000 % 10); } else { VIDEO_putch(' '); }; };
if(size > 2){ if(digit > 99){ VIDEO_putch('0' + digit / 100 % 10); } else { VIDEO_putch(' '); }; };
if(size > 1){ if(digit > 9){ VIDEO_putch('0' + digit / 10 % 10); } else { VIDEO_putch(' '); }; };
VIDEO_putch('0' + digit % 10);
return;
}

| void VIDEO_putstr | ( | const char * | s | ) |
libvideo.c の 865 行で定義されています。
参照先 VIDEO_putch().
参照元 main(), と SCREEN_main().
{
while(*s){
VIDEO_putch(*s++);
}
return;
}


| void VIDEO_putuint | ( | unsigned int | digit, | |
| unsigned char | size | |||
| ) |
libvideo.c の 906 行で定義されています。
参照先 VIDEO_putch().
参照元 SCREEN_main().
{
if(size > 4){ if(digit > 9999){ VIDEO_putch('0' + digit / 10000 % 10); } else { VIDEO_putch(' '); }; };
if(size > 3){ if(digit > 999){ VIDEO_putch('0' + digit / 1000 % 10); } else { VIDEO_putch(' '); }; };
if(size > 2){ if(digit > 99){ VIDEO_putch('0' + digit / 100 % 10); } else { VIDEO_putch(' '); }; };
if(size > 1){ if(digit > 9){ VIDEO_putch('0' + digit / 10 % 10); } else { VIDEO_putch(' '); }; };
VIDEO_putch('0' + digit % 10);
return;
}


| void VIDEO_vram_clear | ( | unsigned int | pattern | ) |
libvideo.c の 455 行で定義されています。
参照先 ntsc, と NTSC::vram.
参照元 VIDEO_init().
{
unsigned int i, *vram;
vram = ntsc.vram;
for(i = 0; i < (NTSC_VRAM_SIZE >> 1); i++){
*vram = pattern;
vram++;
}
return;
}

libvideo.c の 101 行で定義されています。
1.7.1