マクロ定義 | 関数 | 変数

C:/PIC/OpenSSM/libvideo.c

#include <p24FJ64GA002.h>
#include "types.h"
#include "table.h"
#include "librtc.h"
#include "libfontx2.h"
#include "libvideo.h"
libvideo.cのインクルード依存関係図

ソースコードを見る。

マクロ定義

#define abs(a)   (((a)>0) ? (a) : -(a))
#define NTSC_SYNC   LATBbits.LATB12
#define NTSC_VIDEO   LATBbits.LATB13
#define NTSC_LINE   263
#define NTSC_LINE_SYNC   13
#define NTSC_LINE_SPACE_TOP   29
#define NTSC_DEFAULT_FCY   cpu_fcy[0]
#define NTSC_HORIZON_PULSE   1015
#define NTSC_SERRATION_PULSE   936
#define NTSC_EQUALIZING_PULSE   70
#define NTSC_LEFT_SPACE   180
#define NTSC_VIDEO_WIDTH   256

関数

void VIDEO_init (void)
void VIDEO_init_clock (void)
void __attribute__ ((interrupt, no_auto_psv, shadow))
void __attribute__ ((interrupt, auto_psv))
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)

変数

VIDEO_T video

マクロ定義

#define abs (   a  )     (((a)>0) ? (a) : -(a))

libvideo.c33 行で定義されています。

参照元 VIDEO_line(), VIDEO_line_(), VIDEO_putdouble(), と VIDEO_putint().

#define NTSC_DEFAULT_FCY   cpu_fcy[0]

libvideo.c45 行で定義されています。

参照元 VIDEO_init_clock().

#define NTSC_EQUALIZING_PULSE   70

libvideo.c48 行で定義されています。

参照元 VIDEO_init_clock().

#define NTSC_HORIZON_PULSE   1015

libvideo.c46 行で定義されています。

参照元 VIDEO_init_clock().

#define NTSC_LEFT_SPACE   180

libvideo.c49 行で定義されています。

参照元 VIDEO_init_clock().

#define NTSC_LINE   263

libvideo.c40 行で定義されています。

#define NTSC_LINE_SPACE_TOP   29

libvideo.c42 行で定義されています。

#define NTSC_LINE_SYNC   13

libvideo.c41 行で定義されています。

#define NTSC_SERRATION_PULSE   936

libvideo.c47 行で定義されています。

参照元 VIDEO_init_clock().

#define NTSC_SYNC   LATBbits.LATB12

libvideo.c36 行で定義されています。

#define NTSC_VIDEO   LATBbits.LATB13

libvideo.c37 行で定義されています。

#define NTSC_VIDEO_WIDTH   256

libvideo.c50 行で定義されています。

参照元 VIDEO_init_clock().


関数

void __attribute__ ( (interrupt, no_auto_psv, shadow)   ) 

libvideo.c311 行で定義されています。

参照先 NTSC_STATUS::hsync, NTSC::monitor, ntsc, NTSC_WIDTH, NTSC_STATUS::video_width, と NTSC_STATUS::vram.

{
    unsigned int dummy;

    IFS0bits.SPI1IF = 0;

    if(ntsc.monitor.hsync == 0){
        SPI1BUF = (*ntsc.monitor.vram++) & 0x7fff;                  /* 左端を描画しない */
        ntsc.monitor.hsync++;

    } else if(ntsc.monitor.hsync < ntsc.monitor.video_width - 1){
        SPI1BUF = *ntsc.monitor.vram++;
        ntsc.monitor.hsync++;

    } else if(ntsc.monitor.hsync < ntsc.monitor.video_width){
        SPI1BUF = (*ntsc.monitor.vram++) & 0xfffe;                  /* 右端を描画しない */
        ntsc.monitor.hsync++;

    } else {
        for(;ntsc.monitor.hsync < (NTSC_WIDTH >> 4); ntsc.monitor.hsync++){
            ntsc.monitor.vram++;
        }
    }

    dummy = SPI1BUF;
    return;
}

void __attribute__ ( (interrupt, auto_psv)   ) 

libvideo.c436 行で定義されています。

参照先 ntsc, と NTSC::output.

{
    /* スーパーインポーズ用の外部ビデオ信号がないときに実行される */
    IFS0bits.T3IF = 0;

    IEC0bits.T2IE = 1;
    IEC0bits.T3IE = 0;
    IEC1bits.INT2IE = 0;

    ntsc.output = 0;

    return;
}

void GRAPH_draw_bar ( pGRAPH_T  graph  ) 

libvideo.c1050 行で定義されています。

参照先 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.c1028 行で定義されています。

参照先 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.c1006 行で定義されています。

参照先 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.c959 行で定義されています。

参照先 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.c992 行で定義されています。

参照先 GRAPH::data, GRAPH::ptr, と GRAPH::width.

{
    if(data > 100) data = 100;

    graph->data[graph->ptr] = data;
    graph->ptr = (graph->ptr + 1) % graph->width;

    return;
}

void METER_draw ( pMETER_T  meter,
unsigned int  value 
)

libvideo.c1084 行で定義されています。

参照先 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.c1068 行で定義されています。

参照先 METER::old, METER::r, VIDEO_arc(), METER::x, と METER::y.

{
    meter->x = x;
    meter->y = y;
    meter->r = r;
    meter->old = 0;

    VIDEO_arc(x, y, r, 270, 360);

    return;
}

関数の呼び出しグラフ:

void TRACK_draw_point ( pTRACK_T  track  ) 

libvideo.c1151 行で定義されています。

参照先 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.c1113 行で定義されています。

参照先 TRACK::data, TRACK::height, TRACK::ptr, TRACK::width, TRACK::x, と TRACK::y.

{
    unsigned int i;

    track->x = x;
    track->y = y;
    track->width = width;
    track->height = height;
    track->ptr = 0;

    for(i = 0; i < TRACK_SIZE; i++){
        track->data[i][0] = 0;
        track->data[i][1] = 0;
    }

    return;
}

void TRACK_putdata ( pTRACK_T  track,
unsigned int  x,
unsigned int  y 
)

libvideo.c1135 行で定義されています。

参照先 TRACK::data, TRACK::ptr, と TRACK_SIZE.

{
    if(x > 100) x = 100;
    if(y > 100) y = 100;

    track->ptr = (track->ptr + 1) % TRACK_SIZE;
    track->data[ track->ptr ][0] = x;
    track->data[ track->ptr ][1] = y;

    return;
}

void VIDEO_arc ( unsigned int  x,
unsigned int  y,
unsigned int  r,
unsigned int  start,
unsigned int  end 
)

libvideo.c685 行で定義されています。

参照先 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.c704 行で定義されています。

参照先 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   ) 

libvideo.c473 行で定義されています。

参照先 ntsc, と NTSC::output.

{
    return(ntsc.output);
}

unsigned int VIDEO_get_point ( unsigned int  x,
unsigned int  y 
)

libvideo.c482 行で定義されています。

参照先 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.c116 行で定義されています。

参照先 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   ) 
void VIDEO_line ( int  x0,
int  y0,
int  x1,
int  y1 
)

libvideo.c553 行で定義されています。

参照先 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.c617 行で定義されています。

参照先 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.c754 行で定義されています。

参照先 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.c520 行で定義されています。

参照先 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.c534 行で定義されています。

参照先 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.c888 行で定義されています。

参照先 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.c769 行で定義されています。

参照先 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.c934 行で定義されています。

参照先 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.c877 行で定義されています。

参照先 hex, と VIDEO_putch().

{
    VIDEO_putch(hex[(a >> 4) & 0x0f]);
    VIDEO_putch(hex[ a       & 0x0f]);
    return;
}

関数の呼び出しグラフ:

void VIDEO_putint ( int  digit,
unsigned char  size 
)

libvideo.c919 行で定義されています。

参照先 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.c865 行で定義されています。

参照先 VIDEO_putch().

参照元 main(), と SCREEN_main().

{
    while(*s){
        VIDEO_putch(*s++);
    }

    return;
}

関数の呼び出しグラフ:

呼出しグラフ:

void VIDEO_putuint ( unsigned int  digit,
unsigned char  size 
)

libvideo.c906 行で定義されています。

参照先 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.c455 行で定義されています。

参照先 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.c101 行で定義されています。