LOGIN   :::   RECOVER PASS   :::   GET ACCOUNT    
Browse
  • Projects
  • Code (CVS)
  • Forums
  • News
  • Articles
  • Polls
  •  
    OpenCores
  • FAQ
  • CVS HowTo
  • Mission
  • Media
  • Tools
  • Advertise
  • Mirrors
  • Logos
  • Contact us
  • Find Resources
  • Job Opportunity
  •  
    Tools
  • Search
      
  • Download Cores (CVSGet)
  •  
    More
  • Wishbone
  • Perlilog
  • EDA tools
  • OpenTech CD
  •  
    Navigation: All forums > Cvs-checkins > Message List > Message Post

    Message

    Reply | Reply all
    Date Prev | Date Next | Thread Prev | Thread Next Date Index | Thread Index

    From: cvs at opencores.org<cvs@o...>
    Date: Wed Mar 28 23:30:36 CEST 2007
    Subject: [cvs-checkins] MODIFIED: openfire2 ...
    Top
    Date: 00/07/03 28:23:30

    Added: openfire2/sw/vga Makefile vga.c vga.h vga_5x7_fuente.c
    vga_5x7_putchar.c vga_5x7_putline.c
    vga_5x7_setbgcolor.c vga_5x7_setfgcolor.c
    vga_clearscreen.c vga_drawpixel.c
    Log:



    Revision Changes Path
    1.1 openfire2/sw/vga/Makefile

    http://www.opencores.org/cvsweb.shtml/openfire2/sw/vga/Makefile?rev=1.1&content-type=text/x-cvsweb-markup

    Index: Makefile
    ===================================================================
    PRJ = vga
    CRT = ../crt/crt-sram
    LIB = vga_5x7_fuente.c vga_5x7_putchar.c vga_5x7_putline.c vga_5x7_setfgcolor.c vga_5x7_setbgcolor.c vga_clearscreen.c vga_drawpixel.c
    SRCS = $(PRJ).c $(LIB)
    OBJS = $(SRCS:.c=.o) ../lib/uart1io.o
    LINK = ../link/sp3sk-sram.ld

    $(PRJ).srec: $(PRJ).out
    mb-objcopy -O srec $(PRJ).out $(PRJ).srec
    mb-objcopy -O binary $(PRJ).out $(PRJ).bin
    ..\..\utils\bin2rom $(PRJ).bin $(PRJ).rom

    libvga:
    --rm $(PRJ).a
    mb-ar q lib$(PRJ).a $(OBJS)

    $(OBJS): $(SRCS)
    mb-gcc -B. -mno-xl-soft-mul -c -Wa,-ahlms=$(@:.o=.lst) -o $@ $(@:.o=.c)

    $(PRJ).out: $(CRT).o $(OBJS)
    mb-ld -T $(LINK) -Map=$(PRJ).map -o $(PRJ).out $(CRT).o $(OBJS) -lgcc -lc -lm -lgcc

    clean:
    -rm *.o
    -rm *.out
    -rm *.bin
    -rm *.v
    -rm *.map
    -rm *.lst
    -rm *.bak
    -rm *.srec
    -rm *.prom
    -rm *.rom



    1.1 openfire2/sw/vga/vga.c

    http://www.opencores.org/cvsweb.shtml/openfire2/sw/vga/vga.c?rev=1.1&content-type=text/x-cvsweb-markup

    Index: vga.c
    ===================================================================
    #include "vga.h"
    #include <stdio.h>
    #include <math.h>

    #define PI 3.14159265

    char buffer[256];

    void main(void)
    {
    unsigned n, m, c = 0;
    vga_clearscreen();

    for(m = 0; m < 8; m++)
    {
    for(n = 0; n < 8; n++)
    {
    vga_setfgcolor5x7( n );
    vga_setbgcolor5x7( m );
    vga_putline5x7("HOLA", 10 + m * 4, 10 + n);
    }
    }
    vga_setfgcolor5x7(7);
    vga_setbgcolor5x7(1);

    for(n = 100; n < 540; n++)
    {
    vga_drawpixel(n, 100, 7);
    vga_drawpixel(n, 380, 7);
    }

    for(n = 100; n < 380; n++)
    {
    vga_drawpixel(100, n, 7);
    vga_drawpixel(540, n, 7);
    }

    for(n = 0; n < 360; n++)
    {
    float x, y;
    x = 320 + 100 * cos(n * (2*PI) / 360.0);
    y = 240 + 100 * sin(n * (2*PI) / 360.0);

    //printf("n=%u, x=%f y=%f\r\n", n, x, y); //vga_putline5x7(buffer, 5, 5); vga_drawpixel(x, y, 7); } } 1.1 openfire2/sw/vga/vga.h http://www.opencores.org/cvsweb.shtml/openfire2/sw/vga/vga.h?rev=1.1&content-type=text/x-cvsweb-markup Index: vga.h =================================================================== /* datos para el vga 5x7 */ extern unsigned short bitmap_font_5x7[]; extern unsigned short background_5x7; extern unsigned short foreground_5x7; extern unsigned short colores_5x7[]; extern unsigned short xpos_5x7; extern unsigned short ypos_5x7; extern unsigned _VIDEO_RAM_ADDR; void vga_putchar5x7(char caracter, unsigned short pos_x, unsigned short pos_y); void vga_putline5x7(char *s, unsigned short x, unsigned short y); void vga_setfgcolor5x7(unsigned short color); void vga_setbgcolor5x7(unsigned short color); /* funciones vga generales */ void vga_clearscreen(void); void vga_drawpixel(unsigned short x, unsigned short y, unsigned short color); 1.1 openfire2/sw/vga/vga_5x7_fuente.c http://www.opencores.org/cvsweb.shtml/openfire2/sw/vga/vga_5x7_fuente.c?rev=1.1&content-type=text/x-cvsweb-markup Index: vga_5x7_fuente.c =================================================================== #include "vga.h" /* fuente de 5x7 en vga de 640x480 --> 128 x 68 */ /* ---------------------------------------------- */ unsigned short bitmap_font_5x7[96 * 7] = { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x20 -espacio- */ 0x01C0, 0x01C0, 0x01C0, 0x0000, 0x01C0, 0x0000, 0x0000, /* cada word es: 0 RGB RGB RGB RGB RGB */ 0x0E38, 0x0E38, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* siendo R=G=B, ocupa el doble de espacio */ 0x0E38, 0x7FFF, 0x0E38, 0x7FFF, 0x0E38, 0x0000, 0x0000, /* pero ahorra muchos ciclos de reloj */ 0x0FF8, 0x71C0, 0x0FF8, 0x01C7, 0x0FF8, 0x0000, 0x0000, 0x7E07, 0x7E38, 0x01C0, 0x0E3F, 0x703F, 0x0000, 0x0000, 0x0FC0, 0x0E38, 0x0FC0, 0x7038, 0x0FC7, 0x0000, 0x0000, 0x01C0, 0x0E00, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x01C0, 0x0E00, 0x0E00, 0x0E00, 0x01C0, 0x0000, 0x0000, 0x01C0, 0x0038, 0x0038, 0x0038, 0x01C0, 0x0000, 0x0000, 0x71C7, 0x0FF8, 0x01C0, 0x0FF8, 0x71C7, 0x0000, 0x0000, 0x01C0, 0x01C0, 0x7FFF, 0x01C0, 0x01C0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x01F8, 0x0038, 0x01C0, 0x0000, 0x0000, 0x0000, 0x7FFF, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x01F8, 0x01F8, 0x0000, 0x0000, 0x0007, 0x0038, 0x01C0, 0x0E00, 0x7000, 0x0000, 0x0000, 0x0FF8, 0x7007, 0x71C7, 0x7007, 0x0FF8, 0x0000, 0x0000, 0x01C0, 0x0FC0, 0x01C0, 0x01C0, 0x0FF8, 0x0000, 0x0000, 0x0FF8, 0x0007, 0x0FF8, 0x7000, 0x7FFF, 0x0000, 0x0000, 0x0FF8, 0x0007, 0x0FF8, 0x0007, 0x0FF8, 0x0000, 0x0000, 0x7038, 0x7038, 0x7FFF, 0x0038, 0x0038, 0x0000, 0x0000, 0x7FF8, 0x7000, 0x7FF8, 0x0007, 0x7FF8, 0x0000, 0x0000, 0x0FF8, 0x7000, 0x7FF8, 0x7007, 0x0FF8, 0x0000, 0x0000, 0x7FFF, 0x0038, 0x01C0, 0x01C0, 0x01C0, 0x0000, 0x0000, 0x0FF8, 0x7007, 0x0FF8, 0x7007, 0x0FF8, 0x0000, 0x0000, 0x0FF8, 0x7007, 0x0FFF, 0x0007, 0x0FF8, 0x0000, 0x0000, 0x0000, 0x01F8, 0x01F8, 0x0000, 0x01F8, 0x01F8, 0x0000, 0x0000, 0x01F8, 0x01F8, 0x0000, 0x01F8, 0x0FC0, 0x0000, 0x0038, 0x01C0, 0x0E00, 0x01C0, 0x0038, 0x0000, 0x0000, 0x0000, 0x7FFF, 0x0000, 0x7FFF, 0x0000, 0x0000, 0x0000, 0x0E00, 0x01C0, 0x0038, 0x01C0, 0x0E00, 0x0000, 0x0000, 0x0FF8, 0x0007, 0x01F8, 0x0000, 0x01C0, 0x0000, 0x0000, 0x0FF8, 0x71FF, 0x71FF, 0x7000, 0x0FF8, 0x0000, 0x0000, 0x0FF8, 0x7007, 0x7FFF, 0x7007, 0x7007, 0x0000, 0x0000, 0x7FF8, 0x7007, 0x7FF8, 0x7007, 0x7FF8, 0x0000, 0x0000, 0x0FF8, 0x7000, 0x7000, 0x7000, 0x0FF8, 0x0000, 0x0000, 0x7FF8, 0x7007, 0x7007, 0x7007, 0x7FF8, 0x0000, 0x0000, 0x7FFF, 0x7000, 0x7FC0, 0x7000, 0x7FFF, 0x0000, 0x0000, 0x7FFF, 0x7000, 0x7FF8, 0x7000, 0x7000, 0x0000, 0x0000, 0x0FF8, 0x7000, 0x703F, 0x7007, 0x0FF8, 0x0000, 0x0000, 0x7007, 0x7007, 0x7FFF, 0x7007, 0x7007, 0x0000, 0x0000, 0x0FF8, 0x01C0, 0x01C0, 0x01C0, 0x0FF8, 0x0000, 0x0000, 0x0007, 0x0007, 0x0007, 0x7007, 0x0FF8, 0x0000, 0x0000, 0x7007, 0x7038, 0x7FC0, 0x7038, 0x7007, 0x0000, 0x0000, 0x7000, 0x7000, 0x7000, 0x7000, 0x7FFF, 0x0000, 0x0000, 0x7007, 0x7E3F, 0x71C7, 0x7007, 0x7007, 0x0000, 0x0000, 0x7007, 0x7E07, 0x71C7, 0x703F, 0x7007, 0x0000, 0x0000, 0x0FF8, 0x7007, 0x7007, 0x7007, 0x0FF8, 0x0000, 0x0000, 0x7FF8, 0x7007, 0x7FF8, 0x7000, 0x7000, 0x0000, 0x0000, 0x0FF8, 0x7007, 0x7007, 0x703F, 0x0FFF, 0x0000, 0x0000, 0x7FF8, 0x7007, 0x7FF8, 0x7038, 0x7007, 0x0000, 0x0000, 0x0FF8, 0x7000, 0x0FF8, 0x0007, 0x0FF8, 0x0000, 0x0000, 0x7FFF, 0x01C0, 0x01C0, 0x01C0, 0x01C0, 0x0000, 0x0000, 0x7007, 0x7007, 0x7007, 0x7007, 0x0FF8, 0x0000, 0x0000, 0x7007, 0x7007, 0x0E38, 0x0E38, 0x01C0, 0x0000, 0x0000, 0x7007, 0x7007, 0x71C7, 0x71C7, 0x0E38, 0x0000, 0x0000, 0x7007, 0x0E38, 0x01C0, 0x0E38, 0x7007, 0x0000, 0x0000, 0x7007, 0x0E38, 0x01C0, 0x01C0, 0x01C0, 0x0000, 0x0000, 0x7FFF, 0x0038, 0x01C0, 0x0E00, 0x7FFF, 0x0000, 0x0000, 0x0FF8, 0x0E00, 0x0E00, 0x0E00, 0x0FF8, 0x0000, 0x0000, 0x7000, 0x0E00, 0x01C0, 0x0038, 0x0007, 0x0000, 0x0000, 0x0FF8, 0x0038, 0x0038, 0x0038, 0x0FF8, 0x0000, 0x0000, 0x01C0, 0x0E38, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x7FFF, 0x0000, 0x0000, 0x0E00, 0x0E00, 0x01C0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0FC0, 0x0038, 0x7FF8, 0x0FF8, 0x0000, 0x0000, 0x7000, 0x7FC0, 0x7038, 0x7038, 0x7FC0, 0x0000, 0x0000, 0x0000, 0x0FF8, 0x7000, 0x7000, 0x0FF8, 0x0000, 0x0000, 0x0038, 0x0FF8, 0x7038, 0x7038, 0x0FF8, 0x0000, 0x0000, 0x0000, 0x0FC0, 0x7FF8, 0x7000, 0x0FC0, 0x0000, 0x0000, 0x01C0, 0x0E00, 0x7FC0, 0x0E00, 0x0E00, 0x0000, 0x0000, 0x0000, 0x0FC0, 0x7038, 0x7038, 0x0FF8, 0x0038, 0x0FC0, 0x7000, 0x7FC0, 0x7038, 0x7038, 0x7038, 0x0000, 0x0000, 0x0000, 0x0FC0, 0x01C0, 0x01C0, 0x0FF8, 0x0000, 0x0000, 0x0000, 0x01F8, 0x0038, 0x0038, 0x0038, 0x7038, 0x0FC0, 0x7000, 0x7038, 0x7FC0, 0x7FC0, 0x7038, 0x0000, 0x0000, 0x0FC0, 0x01C0, 0x01C0, 0x01C0, 0x0FF8, 0x0000, 0x0000, 0x0000, 0x7E38, 0x71C7, 0x7007, 0x7007, 0x0000, 0x0000, 0x0000, 0x7FC0, 0x7038, 0x7038, 0x7038, 0x0000, 0x0000, 0x0000, 0x0FC0, 0x7038, 0x7038, 0x0FC0, 0x0000, 0x0000, 0x0000, 0x7FC0, 0x7038, 0x7038, 0x7FC0, 0x7000, 0x7000, 0x0000, 0x0FF8, 0x7038, 0x7038, 0x0FF8, 0x0038, 0x0038, 0x0000, 0x7FC0, 0x7038, 0x7000, 0x7000, 0x0000, 0x0000, 0x0000, 0x0FF8, 0x7E00, 0x01F8, 0x7FC0, 0x0000, 0x0000, 0x01C0, 0x0FF8, 0x01C0, 0x01C0, 0x01C0, 0x0000, 0x0000, 0x0000, 0x7038, 0x7038, 0x7038, 0x0FF8, 0x0000, 0x0000, 0x0000, 0x7038, 0x7038, 0x71C0, 0x0E00, 0x0000, 0x0000, 0x0000, 0x7007, 0x7007, 0x71C7, 0x0E38, 0x0000, 0x0000, 0x0000, 0x7038, 0x0FC0, 0x0FC0, 0x7038, 0x0000, 0x0000, 0x0000, 0x7038, 0x7038, 0x7038, 0x0FF8, 0x0038, 0x0FC0, 0x0000, 0x7FF8, 0x01C0, 0x0E00, 0x7FF8, 0x0000, 0x0000, 0x01C0, 0x0E00, 0x7FC0, 0x0E00, 0x01C0, 0x0000, 0x0000, 0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF, 0x01C0, 0x0038, 0x01FF, 0x0038, 0x01C0, 0x0000, 0x0000, 0x0E00, 0x71C7, 0x0038, 0x0000, 0x0000, 0x0000, 0x0000, 0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF, /* 0x7f --- */ }; /* ---------------------------------------------- */ unsigned short background_5x7 = 0x0000; /* background */ unsigned short foreground_5x7 = 0x7FFF; /* mascara para el color de los textos */ unsigned short colores_5x7[] = /* mascaras para los colores */ { 0x0000, 0x1249, 0x2492, 0x36DB, 0x4924, 0x5b6d, 0x6db6, 0x7fff }; unsigned short xpos_5x7 = 0; unsigned short ypos_5x7 = 0; 1.1 openfire2/sw/vga/vga_5x7_putchar.c http://www.opencores.org/cvsweb.shtml/openfire2/sw/vga/vga_5x7_putchar.c?rev=1.1&content-type=text/x-cvsweb-markup Index: vga_5x7_putchar.c =================================================================== #include "vga.h" /* ---------------------------------------------- */ void vga_putchar5x7(char caracter, unsigned short pos_x, unsigned short pos_y) { unsigned short y, scanline, row, scan; unsigned ptr = (unsigned)&_VIDEO_RAM_ADDR; scanline = (caracter - 0x20) * 7; /* bitmap del caracter a mostrar */ y = pos_y * 7; /* 7 bits de alto por caracter */ for(row = 0; row < 7; row++) /* procesamos el caracter */ { /* pintamos la linea */ scan = bitmap_font_5x7[scanline++]; *(unsigned short *) (ptr + (y++ * 256) + pos_x * 2) = (scan & foreground_5x7) | (background_5x7 & ~scan); } } 1.1 openfire2/sw/vga/vga_5x7_putline.c http://www.opencores.org/cvsweb.shtml/openfire2/sw/vga/vga_5x7_putline.c?rev=1.1&content-type=text/x-cvsweb-markup Index: vga_5x7_putline.c =================================================================== #include "vga.h" void vga_putline5x7(char *s, unsigned short x, unsigned short y) { unsigned c; while( (c = *(s++)) != 0 ) { if(c == '\r') x = 0; else if(c == '\n') { x = 0; y++; } else { if(c < 0x20 || c > 0x7f) c = '?'; vga_putchar5x7(c, x, y); x++; if(x == 128) { x = 0; y++; } if(y == 68) y = 0; } } } 1.1 openfire2/sw/vga/vga_5x7_setbgcolor.c http://www.opencores.org/cvsweb.shtml/openfire2/sw/vga/vga_5x7_setbgcolor.c?rev=1.1&content-type=text/x-cvsweb-markup Index: vga_5x7_setbgcolor.c =================================================================== #include "vga.h" void vga_setbgcolor5x7(unsigned short color) { background_5x7 = colores_5x7[color]; } 1.1 openfire2/sw/vga/vga_5x7_setfgcolor.c http://www.opencores.org/cvsweb.shtml/openfire2/sw/vga/vga_5x7_setfgcolor.c?rev=1.1&content-type=text/x-cvsweb-markup Index: vga_5x7_setfgcolor.c =================================================================== #include "vga.h" void vga_setfgcolor5x7(unsigned short color) { foreground_5x7 = colores_5x7[color]; } 1.1 openfire2/sw/vga/vga_clearscreen.c http://www.opencores.org/cvsweb.shtml/openfire2/sw/vga/vga_clearscreen.c?rev=1.1&content-type=text/x-cvsweb-markup Index: vga_clearscreen.c =================================================================== #include "vga.h" void vga_clearscreen(void) { unsigned *ptr = (unsigned *)&_VIDEO_RAM_ADDR, n; for(n = 0; n < 64 * 480; n++) *(ptr++) = background_5x7; } 1.1 openfire2/sw/vga/vga_drawpixel.c http://www.opencores.org/cvsweb.shtml/openfire2/sw/vga/vga_drawpixel.c?rev=1.1&content-type=text/x-cvsweb-markup Index: vga_drawpixel.c =================================================================== #include "vga.h" void vga_drawpixel(unsigned short x, unsigned short y, unsigned short color) { unsigned ptr = (unsigned) &_VIDEO_RAM_ADDR; unsigned short pixel, mascara = 0x7; unsigned short w = x / 5; /* word donde esta el pixel */ unsigned short p = 12 - (x % 5) * 3; /* obtenemos el # de pixel dentro del grupo */ ptr += y * 256 + w * 2; pixel = *(unsigned short *) ptr; /* obtenemos el valor del grupo de 5 pixels */ mascara = ~(0x7 << p); /* mascara para el pixel */ color <<= p; /* ponemos el pixel en su sitio */ pixel &= mascara; /* aplicamos la mascara en el pixel actual */ pixel |= color; /* dibujamos el pixel en el hueco de la mascara */ *(unsigned short *) ptr = pixel; }

     
    Copyright (c) 1999 OPENCORES.ORG. All rights reserved.