From 8111ed7c07a31dd99a323a0a29f9e99dd54c6d80 Mon Sep 17 00:00:00 2001 From: Yuval Adam Date: Wed, 15 May 2013 22:34:48 +0300 Subject: Lots of project tests --- demontsc/lib/.holder | 0 demontsc/lib/TVout/TVout.cpp | 877 +++++++++++++++++++++ demontsc/lib/TVout/TVout.h | 177 +++++ demontsc/lib/TVout/TVoutPrint.cpp | 380 +++++++++ demontsc/lib/TVout/examples/DemoNTSC/DemoNTSC.pde | 217 +++++ demontsc/lib/TVout/examples/DemoNTSC/TVOlogo.cpp | 37 + demontsc/lib/TVout/examples/DemoNTSC/TVOlogo.h | 6 + demontsc/lib/TVout/examples/DemoNTSC/schematic.cpp | 101 +++ demontsc/lib/TVout/examples/DemoNTSC/schematic.h | 6 + demontsc/lib/TVout/examples/DemoPAL/DemoPAL.pde | 217 +++++ demontsc/lib/TVout/examples/DemoPAL/TVOlogo.cpp | 37 + demontsc/lib/TVout/examples/DemoPAL/TVOlogo.h | 6 + demontsc/lib/TVout/examples/DemoPAL/schematic.cpp | 101 +++ demontsc/lib/TVout/examples/DemoPAL/schematic.h | 6 + .../examples/NTSCserialTerm/NTSCserialTerm.pde | 20 + demontsc/lib/TVout/keywords.txt | 50 ++ demontsc/lib/TVout/spec/asm_macros.h | 144 ++++ demontsc/lib/TVout/spec/hardware_setup.h | 146 ++++ demontsc/lib/TVout/spec/video_properties.h | 67 ++ demontsc/lib/TVout/version history.txt | 94 +++ demontsc/lib/TVout/video_gen.cpp | 470 +++++++++++ demontsc/lib/TVout/video_gen.h | 64 ++ demontsc/lib/TVoutfonts/font4x6.cpp | 671 ++++++++++++++++ demontsc/lib/TVoutfonts/font4x6.h | 7 + demontsc/lib/TVoutfonts/font6x8.cpp | 870 ++++++++++++++++++++ demontsc/lib/TVoutfonts/font6x8.h | 8 + demontsc/lib/TVoutfonts/font8x8.cpp | 133 ++++ demontsc/lib/TVoutfonts/font8x8.h | 7 + demontsc/lib/TVoutfonts/font8x8ext.cpp | 261 ++++++ demontsc/lib/TVoutfonts/font8x8ext.h | 7 + demontsc/lib/TVoutfonts/fontALL.h | 9 + demontsc/lib/TVoutfonts/keywords.txt | 5 + demontsc/lib/pollserial/pollserial.cpp | 139 ++++ demontsc/lib/pollserial/pollserial.h | 51 ++ demontsc/src/DemoNTSC.pde | 217 +++++ demontsc/src/TVOlogo.cpp | 37 + demontsc/src/TVOlogo.h | 6 + demontsc/src/schematic.cpp | 101 +++ demontsc/src/schematic.h | 6 + demopal/lib/.holder | 0 demopal/lib/TVout/TVout.cpp | 877 +++++++++++++++++++++ demopal/lib/TVout/TVout.h | 177 +++++ demopal/lib/TVout/TVoutPrint.cpp | 380 +++++++++ demopal/lib/TVout/examples/DemoNTSC/DemoNTSC.pde | 217 +++++ demopal/lib/TVout/examples/DemoNTSC/TVOlogo.cpp | 37 + demopal/lib/TVout/examples/DemoNTSC/TVOlogo.h | 6 + demopal/lib/TVout/examples/DemoNTSC/schematic.cpp | 101 +++ demopal/lib/TVout/examples/DemoNTSC/schematic.h | 6 + demopal/lib/TVout/examples/DemoPAL/DemoPAL.pde | 217 +++++ demopal/lib/TVout/examples/DemoPAL/TVOlogo.cpp | 37 + demopal/lib/TVout/examples/DemoPAL/TVOlogo.h | 6 + demopal/lib/TVout/examples/DemoPAL/schematic.cpp | 101 +++ demopal/lib/TVout/examples/DemoPAL/schematic.h | 6 + .../examples/NTSCserialTerm/NTSCserialTerm.pde | 20 + demopal/lib/TVout/keywords.txt | 50 ++ demopal/lib/TVout/spec/asm_macros.h | 144 ++++ demopal/lib/TVout/spec/hardware_setup.h | 146 ++++ demopal/lib/TVout/spec/video_properties.h | 67 ++ demopal/lib/TVout/version history.txt | 94 +++ demopal/lib/TVout/video_gen.cpp | 470 +++++++++++ demopal/lib/TVout/video_gen.h | 64 ++ demopal/lib/TVoutfonts/font4x6.cpp | 671 ++++++++++++++++ demopal/lib/TVoutfonts/font4x6.h | 7 + demopal/lib/TVoutfonts/font6x8.cpp | 870 ++++++++++++++++++++ demopal/lib/TVoutfonts/font6x8.h | 8 + demopal/lib/TVoutfonts/font8x8.cpp | 133 ++++ demopal/lib/TVoutfonts/font8x8.h | 7 + demopal/lib/TVoutfonts/font8x8ext.cpp | 261 ++++++ demopal/lib/TVoutfonts/font8x8ext.h | 7 + demopal/lib/TVoutfonts/fontALL.h | 9 + demopal/lib/TVoutfonts/keywords.txt | 5 + demopal/lib/pollserial/pollserial.cpp | 139 ++++ demopal/lib/pollserial/pollserial.h | 51 ++ demopal/src/DemoPAL.pde | 217 +++++ demopal/src/TVOlogo.cpp | 37 + demopal/src/TVOlogo.h | 6 + demopal/src/schematic.cpp | 101 +++ demopal/src/schematic.h | 6 + mozzi-hello/lib/.holder | 0 mozzi-hello/src/mozzi | 1 + mozzi-hello/src/sketch.ino | 23 + vga-more/lib/.holder | 0 vga-more/src/TimerHelpers.h | 209 +++++ vga-more/src/screenFont.h | 160 ++++ vga-more/src/sketch.ino | 190 +++++ vga-random/lib/.holder | 0 vga-random/src/sketch.ino | 7 + 87 files changed, 12106 insertions(+) create mode 100644 demontsc/lib/.holder create mode 100755 demontsc/lib/TVout/TVout.cpp create mode 100755 demontsc/lib/TVout/TVout.h create mode 100755 demontsc/lib/TVout/TVoutPrint.cpp create mode 100755 demontsc/lib/TVout/examples/DemoNTSC/DemoNTSC.pde create mode 100755 demontsc/lib/TVout/examples/DemoNTSC/TVOlogo.cpp create mode 100755 demontsc/lib/TVout/examples/DemoNTSC/TVOlogo.h create mode 100755 demontsc/lib/TVout/examples/DemoNTSC/schematic.cpp create mode 100755 demontsc/lib/TVout/examples/DemoNTSC/schematic.h create mode 100755 demontsc/lib/TVout/examples/DemoPAL/DemoPAL.pde create mode 100755 demontsc/lib/TVout/examples/DemoPAL/TVOlogo.cpp create mode 100755 demontsc/lib/TVout/examples/DemoPAL/TVOlogo.h create mode 100755 demontsc/lib/TVout/examples/DemoPAL/schematic.cpp create mode 100755 demontsc/lib/TVout/examples/DemoPAL/schematic.h create mode 100755 demontsc/lib/TVout/examples/NTSCserialTerm/NTSCserialTerm.pde create mode 100755 demontsc/lib/TVout/keywords.txt create mode 100755 demontsc/lib/TVout/spec/asm_macros.h create mode 100755 demontsc/lib/TVout/spec/hardware_setup.h create mode 100755 demontsc/lib/TVout/spec/video_properties.h create mode 100755 demontsc/lib/TVout/version history.txt create mode 100755 demontsc/lib/TVout/video_gen.cpp create mode 100755 demontsc/lib/TVout/video_gen.h create mode 100755 demontsc/lib/TVoutfonts/font4x6.cpp create mode 100755 demontsc/lib/TVoutfonts/font4x6.h create mode 100755 demontsc/lib/TVoutfonts/font6x8.cpp create mode 100755 demontsc/lib/TVoutfonts/font6x8.h create mode 100755 demontsc/lib/TVoutfonts/font8x8.cpp create mode 100755 demontsc/lib/TVoutfonts/font8x8.h create mode 100755 demontsc/lib/TVoutfonts/font8x8ext.cpp create mode 100755 demontsc/lib/TVoutfonts/font8x8ext.h create mode 100755 demontsc/lib/TVoutfonts/fontALL.h create mode 100755 demontsc/lib/TVoutfonts/keywords.txt create mode 100755 demontsc/lib/pollserial/pollserial.cpp create mode 100755 demontsc/lib/pollserial/pollserial.h create mode 100755 demontsc/src/DemoNTSC.pde create mode 100755 demontsc/src/TVOlogo.cpp create mode 100755 demontsc/src/TVOlogo.h create mode 100755 demontsc/src/schematic.cpp create mode 100755 demontsc/src/schematic.h create mode 100644 demopal/lib/.holder create mode 100755 demopal/lib/TVout/TVout.cpp create mode 100755 demopal/lib/TVout/TVout.h create mode 100755 demopal/lib/TVout/TVoutPrint.cpp create mode 100755 demopal/lib/TVout/examples/DemoNTSC/DemoNTSC.pde create mode 100755 demopal/lib/TVout/examples/DemoNTSC/TVOlogo.cpp create mode 100755 demopal/lib/TVout/examples/DemoNTSC/TVOlogo.h create mode 100755 demopal/lib/TVout/examples/DemoNTSC/schematic.cpp create mode 100755 demopal/lib/TVout/examples/DemoNTSC/schematic.h create mode 100755 demopal/lib/TVout/examples/DemoPAL/DemoPAL.pde create mode 100755 demopal/lib/TVout/examples/DemoPAL/TVOlogo.cpp create mode 100755 demopal/lib/TVout/examples/DemoPAL/TVOlogo.h create mode 100755 demopal/lib/TVout/examples/DemoPAL/schematic.cpp create mode 100755 demopal/lib/TVout/examples/DemoPAL/schematic.h create mode 100755 demopal/lib/TVout/examples/NTSCserialTerm/NTSCserialTerm.pde create mode 100755 demopal/lib/TVout/keywords.txt create mode 100755 demopal/lib/TVout/spec/asm_macros.h create mode 100755 demopal/lib/TVout/spec/hardware_setup.h create mode 100755 demopal/lib/TVout/spec/video_properties.h create mode 100755 demopal/lib/TVout/version history.txt create mode 100755 demopal/lib/TVout/video_gen.cpp create mode 100755 demopal/lib/TVout/video_gen.h create mode 100755 demopal/lib/TVoutfonts/font4x6.cpp create mode 100755 demopal/lib/TVoutfonts/font4x6.h create mode 100755 demopal/lib/TVoutfonts/font6x8.cpp create mode 100755 demopal/lib/TVoutfonts/font6x8.h create mode 100755 demopal/lib/TVoutfonts/font8x8.cpp create mode 100755 demopal/lib/TVoutfonts/font8x8.h create mode 100755 demopal/lib/TVoutfonts/font8x8ext.cpp create mode 100755 demopal/lib/TVoutfonts/font8x8ext.h create mode 100755 demopal/lib/TVoutfonts/fontALL.h create mode 100755 demopal/lib/TVoutfonts/keywords.txt create mode 100755 demopal/lib/pollserial/pollserial.cpp create mode 100755 demopal/lib/pollserial/pollserial.h create mode 100755 demopal/src/DemoPAL.pde create mode 100755 demopal/src/TVOlogo.cpp create mode 100755 demopal/src/TVOlogo.h create mode 100755 demopal/src/schematic.cpp create mode 100755 demopal/src/schematic.h create mode 100644 mozzi-hello/lib/.holder create mode 120000 mozzi-hello/src/mozzi create mode 100644 mozzi-hello/src/sketch.ino create mode 100644 vga-more/lib/.holder create mode 100644 vga-more/src/TimerHelpers.h create mode 100644 vga-more/src/screenFont.h create mode 100644 vga-more/src/sketch.ino create mode 100644 vga-random/lib/.holder create mode 100644 vga-random/src/sketch.ino diff --git a/demontsc/lib/.holder b/demontsc/lib/.holder new file mode 100644 index 0000000..e69de29 diff --git a/demontsc/lib/TVout/TVout.cpp b/demontsc/lib/TVout/TVout.cpp new file mode 100755 index 0000000..751eb54 --- /dev/null +++ b/demontsc/lib/TVout/TVout.cpp @@ -0,0 +1,877 @@ +/* + Copyright (c) 2010 Myles Metzer + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. +*/ + +/* A note about how Color is defined for this version of TVout + * + * Where ever choosing a color is mentioned the following are true: + * BLACK =0 + * WHITE =1 + * INVERT =2 + * All others will be ignored. +*/ + +#include "TVout.h" + + +/* Call this to start video output with the default resolution. + * + * Arguments: + * mode: + * The video standard to follow: + * PAL =1 =_PAL + * NTSC =0 =_NTSC + * + * Returns: + * 0 if no error. + * 4 if there is not enough memory. + */ +char TVout::begin(uint8_t mode) { + + return begin(mode,128,96); +} // end of begin + + +/* call this to start video output with a specified resolution. + * + * Arguments: + * mode: + * The video standard to follow: + * PAL =1 =_PAL + * NTSC =0 =_NTSC + * x: + * Horizonal resolution must be divisable by 8. + * y: + * Vertical resolution. + * + * Returns: + * 0 if no error. + * 1 if x is not divisable by 8. + * 2 if y is to large (NTSC only cannot fill PAL vertical resolution by 8bit limit) + * 4 if there is not enough memory for the frame buffer. + */ +char TVout::begin(uint8_t mode, uint8_t x, uint8_t y) { + + // check if x is divisable by 8 + if ( !(x & 0xF8)) + return 1; + x = x/8; + + screen = (unsigned char*)malloc(x * y * sizeof(unsigned char)); + if (screen == NULL) + return 4; + + cursor_x = 0; + cursor_y = 0; + + render_setup(mode,x,y,screen); + clear_screen(); + return 0; +} // end of begin + + +/* Stop video render and free the used memory. + */ + void TVout::end() { + TIMSK1 = 0; + free(screen); +} + + +/* Fill the screen with some color. + * + * Arguments: + * color: + * The color to fill the screen with. + * (see color note at the top of this file) +*/ +void TVout::fill(uint8_t color) { + switch(color) { + case BLACK: + cursor_x = 0; + cursor_y = 0; + for (int i = 0; i < (display.hres)*display.vres; i++) + display.screen[i] = 0; + break; + case WHITE: + cursor_x = 0; + cursor_y = 0; + for (int i = 0; i < (display.hres)*display.vres; i++) + display.screen[i] = 0xFF; + break; + case INVERT: + for (int i = 0; i < display.hres*display.vres; i++) + display.screen[i] = ~display.screen[i]; + break; + } +} // end of fill + + +/* Gets the Horizontal resolution of the screen + * + * Returns: + * The horizonal resolution. +*/ +unsigned char TVout::hres() { + return display.hres*8; +} // end of hres + + +/* Gets the Vertical resolution of the screen + * + * Returns: + * The vertical resolution +*/ +unsigned char TVout::vres() { + return display.vres; +} // end of vres + + +/* Return the number of characters that will fit on a line + * + * Returns: + * The number of characters that will fit on a text line starting from x=0. + * Will return -1 for dynamic width fonts as this cannot be determined. +*/ +char TVout::char_line() { + return ((display.hres*8)/pgm_read_byte(font)); +} // end of char_line + + +/* delay for x ms + * The resolution is 16ms for NTSC and 20ms for PAL + * + * Arguments: + * x: + * The number of ms this function should consume. +*/ +void TVout::delay(unsigned int x) { + unsigned long time = millis() + x; + while(millis() < time); +} // end of delay + + +/* Delay for x frames, exits at the end of the last display line. + * delay_frame(1) is useful prior to drawing so there is little/no flicker. + * + * Arguments: + * x: + * The number of frames to delay for. + */ +void TVout::delay_frame(unsigned int x) { + int stop_line = (int)(display.start_render + (display.vres*(display.vscale_const+1)))+1; + while (x) { + while (display.scanLine != stop_line); + while (display.scanLine == stop_line); + x--; + } +} // end of delay_frame + + +/* Get the time in ms since begin was called. + * The resolution is 16ms for NTSC and 20ms for PAL + * + * Returns: + * The time in ms since video generation has started. +*/ +unsigned long TVout::millis() { + if (display.lines_frame == _NTSC_LINE_FRAME) { + return display.frames * _NTSC_TIME_SCANLINE * _NTSC_LINE_FRAME / 1000; + } + else { + return display.frames * _PAL_TIME_SCANLINE * _PAL_LINE_FRAME / 1000; + } +} // end of millis + + +/* force the number of times to display each line. + * + * Arguments: + * sfactor: + * The scale number of times to repeate each line. + */ +void TVout::force_vscale(char sfactor) { + delay_frame(1); + display.vscale_const = sfactor - 1; + display.vscale = sfactor - 1; +} + + +/* force the output start time of a scanline in micro seconds. + * + * Arguments: + * time: + * The new output start time in micro seconds. + */ +void TVout::force_outstart(uint8_t time) { + delay_frame(1); + display.output_delay = ((time * _CYCLES_PER_US) - 1); +} + + +/* force the start line for active video + * + * Arguments: + * line: + * The new active video output start line + */ +void TVout::force_linestart(uint8_t line) { + delay_frame(1); + display.start_render = line; +} + + +/* Set the color of a pixel + * + * Arguments: + * x: + * The x coordinate of the pixel. + * y: + * The y coordinate of the pixel. + * c: + * The color of the pixel + * (see color note at the top of this file) + */ +void TVout::set_pixel(uint8_t x, uint8_t y, char c) { + if (x >= display.hres*8 || y >= display.vres) + return; + sp(x,y,c); +} // end of set_pixel + + +/* get the color of the pixel at x,y + * + * Arguments: + * x: + * The x coordinate of the pixel. + * y: + * The y coordinate of the pixel. + * + * Returns: + * The color of the pixel. + * (see color note at the top of this file) + * + * Thank you gijs on the arduino.cc forum for the non obviouse fix. +*/ +unsigned char TVout::get_pixel(uint8_t x, uint8_t y) { + if (x >= display.hres*8 || y >= display.vres) + return 0; + if (display.screen[x/8+y*display.hres] & (0x80 >>(x&7))) + return 1; + return 0; +} // end of get_pixel + + +/* Draw a line from one point to another + * + * Arguments: + * x0: + * The x coordinate of point 0. + * y0: + * The y coordinate of point 0. + * x1: + * The x coordinate of point 1. + * y1: + * The y coordinate of point 1. + * c: + * The color of the line. + * (see color note at the top of this file) + */ +void TVout::draw_line(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1, char c) { + + if (x0 > display.hres*8 || y0 > display.vres || x1 > display.hres*8 || y1 > display.vres) + return; + if (x0 == x1) + draw_column(x0,y0,y1,c); + else if (y0 == y1) + draw_row(y0,x0,x1,c); + else { + int e; + signed int dx,dy,j, temp; + signed char s1,s2, xchange; + signed int x,y; + + x = x0; + y = y0; + + //take absolute value + if (x1 < x0) { + dx = x0 - x1; + s1 = -1; + } + else if (x1 == x0) { + dx = 0; + s1 = 0; + } + else { + dx = x1 - x0; + s1 = 1; + } + + if (y1 < y0) { + dy = y0 - y1; + s2 = -1; + } + else if (y1 == y0) { + dy = 0; + s2 = 0; + } + else { + dy = y1 - y0; + s2 = 1; + } + + xchange = 0; + + if (dy>dx) { + temp = dx; + dx = dy; + dy = temp; + xchange = 1; + } + + e = ((int)dy<<1) - dx; + + for (j=0; j<=dx; j++) { + sp(x,y,c); + + if (e>=0) { + if (xchange==1) x = x + s1; + else y = y + s2; + e = e - ((int)dx<<1); + } + if (xchange==1) + y = y + s2; + else + x = x + s1; + e = e + ((int)dy<<1); + } + } +} // end of draw_line + + +/* Fill a row from one point to another + * + * Argument: + * line: + * The row that fill will be performed on. + * x0: + * edge 0 of the fill. + * x1: + * edge 1 of the fill. + * c: + * the color of the fill. + * (see color note at the top of this file) +*/ +void TVout::draw_row(uint8_t line, uint16_t x0, uint16_t x1, uint8_t c) { + uint8_t lbit, rbit; + + if (x0 == x1) + set_pixel(x0,line,c); + else { + if (x0 > x1) { + lbit = x0; + x0 = x1; + x1 = lbit; + } + lbit = 0xff >> (x0&7); + x0 = x0/8 + display.hres*line; + rbit = ~(0xff >> (x1&7)); + x1 = x1/8 + display.hres*line; + if (x0 == x1) { + lbit = lbit & rbit; + rbit = 0; + } + if (c == WHITE) { + screen[x0++] |= lbit; + while (x0 < x1) + screen[x0++] = 0xff; + screen[x0] |= rbit; + } + else if (c == BLACK) { + screen[x0++] &= ~lbit; + while (x0 < x1) + screen[x0++] = 0; + screen[x0] &= ~rbit; + } + else if (c == INVERT) { + screen[x0++] ^= lbit; + while (x0 < x1) + screen[x0++] ^= 0xff; + screen[x0] ^= rbit; + } + } +} // end of draw_row + + +/* Fill a column from one point to another + * + * Argument: + * row: + * The row that fill will be performed on. + * y0: + * edge 0 of the fill. + * y1: + * edge 1 of the fill. + * c: + * the color of the fill. + * (see color note at the top of this file) +*/ +void TVout::draw_column(uint8_t row, uint16_t y0, uint16_t y1, uint8_t c) { + + unsigned char bit; + int byte; + + if (y0 == y1) + set_pixel(row,y0,c); + else { + if (y1 < y0) { + bit = y0; + y0 = y1; + y1 = bit; + } + bit = 0x80 >> (row&7); + byte = row/8 + y0*display.hres; + if (c == WHITE) { + while ( y0 <= y1) { + screen[byte] |= bit; + byte += display.hres; + y0++; + } + } + else if (c == BLACK) { + while ( y0 <= y1) { + screen[byte] &= ~bit; + byte += display.hres; + y0++; + } + } + else if (c == INVERT) { + while ( y0 <= y1) { + screen[byte] ^= bit; + byte += display.hres; + y0++; + } + } + } +} + + +/* draw a rectangle at x,y with a specified width and height + * + * Arguments: + * x0: + * The x coordinate of upper left corner of the rectangle. + * y0: + * The y coordinate of upper left corner of the rectangle. + * w: + * The widht of the rectangle. + * h: + * The height of the rectangle. + * c: + * The color of the rectangle. + * (see color note at the top of this file) + * fc: + * The fill color of the rectangle. + * (see color note at the top of this file) + * default =-1 (no fill) +*/ +void TVout::draw_rect(uint8_t x0, uint8_t y0, uint8_t w, uint8_t h, char c, char fc) { + + if (fc != -1) { + for (unsigned char i = y0; i < y0+h; i++) + draw_row(i,x0,x0+w,fc); + } + draw_line(x0,y0,x0+w,y0,c); + draw_line(x0,y0,x0,y0+h,c); + draw_line(x0+w,y0,x0+w,y0+h,c); + draw_line(x0,y0+h,x0+w,y0+h,c); +} // end of draw_rect + + +/* draw a circle given a coordinate x,y and radius both filled and non filled. + * + * Arguments: + * x0: + * The x coordinate of the center of the circle. + * y0: + * The y coordinate of the center of the circle. + * radius: + * The radius of the circle. + * c: + * The color of the circle. + * (see color note at the top of this file) + * fc: + * The color to fill the circle. + * (see color note at the top of this file) + * defualt =-1 (do not fill) + */ +void TVout::draw_circle(uint8_t x0, uint8_t y0, uint8_t radius, char c, char fc) { + + int f = 1 - radius; + int ddF_x = 1; + int ddF_y = -2 * radius; + int x = 0; + int y = radius; + uint8_t pyy = y,pyx = x; + + + //there is a fill color + if (fc != -1) + draw_row(y0,x0-radius,x0+radius,fc); + + sp(x0, y0 + radius,c); + sp(x0, y0 - radius,c); + sp(x0 + radius, y0,c); + sp(x0 - radius, y0,c); + + while(x < y) { + if(f >= 0) { + y--; + ddF_y += 2; + f += ddF_y; + } + x++; + ddF_x += 2; + f += ddF_x; + + //there is a fill color + if (fc != -1) { + //prevent double draws on the same rows + if (pyy != y) { + draw_row(y0+y,x0-x,x0+x,fc); + draw_row(y0-y,x0-x,x0+x,fc); + } + if (pyx != x && x != y) { + draw_row(y0+x,x0-y,x0+y,fc); + draw_row(y0-x,x0-y,x0+y,fc); + } + pyy = y; + pyx = x; + } + sp(x0 + x, y0 + y,c); + sp(x0 - x, y0 + y,c); + sp(x0 + x, y0 - y,c); + sp(x0 - x, y0 - y,c); + sp(x0 + y, y0 + x,c); + sp(x0 - y, y0 + x,c); + sp(x0 + y, y0 - x,c); + sp(x0 - y, y0 - x,c); + } +} // end of draw_circle + + +/* place a bitmap at x,y where the bitmap is defined as {width,height,imagedata....} + * + * Arguments: + * x: + * The x coordinate of the upper left corner. + * y: + * The y coordinate of the upper left corner. + * bmp: + * The bitmap data to print. + * i: + * The offset into the image data to start at. This is mainly used for fonts. + * default =0 + * width: + * Override the bitmap width. This is mainly used for fonts. + * default =0 (do not override) + * height: + * Override the bitmap height. This is mainly used for fonts. + * default =0 (do not override) +*/ +void TVout::bitmap(uint8_t x, uint8_t y, const unsigned char * bmp, + uint16_t i, uint8_t width, uint8_t lines) { + + uint8_t temp, lshift, rshift, save, xtra; + uint16_t si = 0; + + rshift = x&7; + lshift = 8-rshift; + if (width == 0) { + width = pgm_read_byte((uint32_t)(bmp) + i); + i++; + } + if (lines == 0) { + lines = pgm_read_byte((uint32_t)(bmp) + i); + i++; + } + + if (width&7) { + xtra = width&7; + width = width/8; + width++; + } + else { + xtra = 8; + width = width/8; + } + + for (uint8_t l = 0; l < lines; l++) { + si = (y + l)*display.hres + x/8; + if (width == 1) + temp = 0xff >> rshift + xtra; + else + temp = 0; + save = screen[si]; + screen[si] &= ((0xff << lshift) | temp); + temp = pgm_read_byte((uint32_t)(bmp) + i++); + screen[si++] |= temp >> rshift; + for ( uint16_t b = i + width-1; i < b; i++) { + save = screen[si]; + screen[si] = temp << lshift; + temp = pgm_read_byte((uint32_t)(bmp) + i); + screen[si++] |= temp >> rshift; + } + if (rshift + xtra < 8) + screen[si-1] |= (save & (0xff >> rshift + xtra)); //test me!!! + if (rshift + xtra - 8 > 0) + screen[si] &= (0xff >> rshift + xtra - 8); + screen[si] |= temp << lshift; + } +} // end of bitmap + + +/* shift the pixel buffer in any direction + * This function will shift the screen in a direction by any distance. + * + * Arguments: + * distance: + * The distance to shift the screen + * direction: + * The direction to shift the screen the direction and the integer values: + * UP =0 + * DOWN =1 + * LEFT =2 + * RIGHT =3 +*/ +void TVout::shift(uint8_t distance, uint8_t direction) { + uint8_t * src; + uint8_t * dst; + uint8_t * end; + uint8_t shift; + uint8_t tmp; + switch(direction) { + case UP: + dst = display.screen; + src = display.screen + distance*display.hres; + end = display.screen + display.vres*display.hres; + + while (src <= end) { + *dst = *src; + *src = 0; + dst++; + src++; + } + break; + case DOWN: + dst = display.screen + display.vres*display.hres; + src = dst - distance*display.hres; + end = display.screen; + + while (src >= end) { + *dst = *src; + *src = 0; + dst--; + src--; + } + break; + case LEFT: + shift = distance & 7; + + for (uint8_t line = 0; line < display.vres; line++) { + dst = display.screen + display.hres*line; + src = dst + distance/8; + end = dst + display.hres-2; + while (src <= end) { + tmp = 0; + tmp = *src << shift; + *src = 0; + src++; + tmp |= *src >> (8 - shift); + *dst = tmp; + dst++; + } + tmp = 0; + tmp = *src << shift; + *src = 0; + *dst = tmp; + } + break; + case RIGHT: + shift = distance & 7; + + for (uint8_t line = 0; line < display.vres; line++) { + dst = display.screen + display.hres-1 + display.hres*line; + src = dst - distance/8; + end = dst - display.hres+2; + while (src >= end) { + tmp = 0; + tmp = *src >> shift; + *src = 0; + src--; + tmp |= *src << (8 - shift); + *dst = tmp; + dst--; + } + tmp = 0; + tmp = *src >> shift; + *src = 0; + *dst = tmp; + } + break; + } +} // end of shift + + +/* Inline version of set_pixel that does not perform a bounds check + * This function will be replaced by a macro. +*/ +static void inline sp(uint8_t x, uint8_t y, char c) { + if (c==1) + display.screen[(x/8) + (y*display.hres)] |= 0x80 >> (x&7); + else if (c==0) + display.screen[(x/8) + (y*display.hres)] &= ~0x80 >> (x&7); + else + display.screen[(x/8) + (y*display.hres)] ^= 0x80 >> (x&7); +} // end of sp + + +/* set the vertical blank function call + * The function passed to this function will be called one per frame. The function should be quickish. + * + * Arguments: + * func: + * The function to call. + */ +void TVout::set_vbi_hook(void (*func)()) { + vbi_hook = func; +} // end of set_vbi_hook + + +/* set the horizonal blank function call + * This function passed to this function will be called one per scan line. + * The function MUST be VERY FAST(~2us max). + * + * Arguments: + * funct: + * The function to call. + */ +void TVout::set_hbi_hook(void (*func)()) { + hbi_hook = func; +} // end of set_bhi_hook + + +/* Simple tone generation + * + * Arguments: + * frequency: + * the frequency of the tone + * courtesy of adamwwolf + */ +void TVout::tone(unsigned int frequency) { + tone(frequency, 0); +} // end of tone + + +/* Simple tone generation + * + * Arguments: + * frequency: + * the frequency of the tone + * duration_ms: + * The duration to play the tone in ms + * courtesy of adamwwolf + */ +void TVout::tone(unsigned int frequency, unsigned long duration_ms) { + + if (frequency == 0) + return; + +#define TIMER 2 + //this is init code + TCCR2A = 0; + TCCR2B = 0; + TCCR2A |= _BV(WGM21); + TCCR2B |= _BV(CS20); + //end init code + + //most of this is taken from Tone.cpp from Arduino + uint8_t prescalarbits = 0b001; + uint32_t ocr = 0; + + + DDR_SND |= _BV(SND_PIN); //set pb3 (digital pin 11) to output + + //we are using an 8 bit timer, scan through prescalars to find the best fit + ocr = F_CPU / frequency / 2 - 1; + prescalarbits = 0b001; // ck/1: same for both timers + if (ocr > 255) { + ocr = F_CPU / frequency / 2 / 8 - 1; + prescalarbits = 0b010; // ck/8: same for both timers + + if (ocr > 255) { + ocr = F_CPU / frequency / 2 / 32 - 1; + prescalarbits = 0b011; + } + + if (ocr > 255) { + ocr = F_CPU / frequency / 2 / 64 - 1; + prescalarbits = TIMER == 0 ? 0b011 : 0b100; + if (ocr > 255) { + ocr = F_CPU / frequency / 2 / 128 - 1; + prescalarbits = 0b101; + } + + if (ocr > 255) { + ocr = F_CPU / frequency / 2 / 256 - 1; + prescalarbits = TIMER == 0 ? 0b100 : 0b110; + if (ocr > 255) { + // can't do any better than /1024 + ocr = F_CPU / frequency / 2 / 1024 - 1; + prescalarbits = TIMER == 0 ? 0b101 : 0b111; + } + } + } + } + TCCR2B = prescalarbits; + + if (duration_ms > 0) + remainingToneVsyncs = duration_ms*60/1000; //60 here represents the framerate + else + remainingToneVsyncs = -1; + + // Set the OCR for the given timer, + OCR2A = ocr; + //set it to toggle the pin by itself + TCCR2A &= ~(_BV(COM2A1)); //set COM2A1 to 0 + TCCR2A |= _BV(COM2A0); +} // end of tone + +/* Stops tone generation + */ +void TVout::noTone() { + TCCR2B = 0; + PORT_SND &= ~(_BV(SND_PIN)); //set pin 11 to 0 +} // end of noTone \ No newline at end of file diff --git a/demontsc/lib/TVout/TVout.h b/demontsc/lib/TVout/TVout.h new file mode 100755 index 0000000..c4e184a --- /dev/null +++ b/demontsc/lib/TVout/TVout.h @@ -0,0 +1,177 @@ +/* +Copyright (c) 2010 Myles Metzer + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. +*/ +/* +This library provides a simple method for outputting data to a tv +from a frame buffer stored in sram. This implementation is done +completly by interupt and will return give as much cpu time to the +application as possible. +*/ +#ifndef TVOUT_H +#define TVOUT_H + +#include +#include +#include +#include +#include + +#include "video_gen.h" +#include "spec/hardware_setup.h" +#include "spec/video_properties.h" + +// macros for readability when selecting mode. +#define PAL 1 +#define NTSC 0 +#define _PAL 1 +#define _NTSC 0 + +#define WHITE 1 +#define BLACK 0 +#define INVERT 2 + +#define UP 0 +#define DOWN 1 +#define LEFT 2 +#define RIGHT 3 + +#define DEC 10 +#define HEX 16 +#define OCT 8 +#define BIN 2 +#define BYTE 0 + +// Macros for clearer usage +#define clear_screen() fill(0) +#define invert(color) fill(2) + +/* +TVout.cpp contains a brief expenation of each function. +*/ +class TVout { +public: + uint8_t * screen; + + char begin(uint8_t mode); + char begin(uint8_t mode, uint8_t x, uint8_t y); + void end(); + + //accessor functions + unsigned char hres(); + unsigned char vres(); + char char_line(); + + //flow control functions + void delay(unsigned int x); + void delay_frame(unsigned int x); + unsigned long millis(); + + //override setup functions + void force_vscale(char sfactor); + void force_outstart(uint8_t time); + void force_linestart(uint8_t line); + + //basic rendering functions + void set_pixel(uint8_t x, uint8_t y, char c); + unsigned char get_pixel(uint8_t x, uint8_t y); + void fill(uint8_t color); + void shift(uint8_t distance, uint8_t direction); + void draw_line(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1, char c); + void draw_row(uint8_t line, uint16_t x0, uint16_t x1, uint8_t c); + void draw_column(uint8_t row, uint16_t y0, uint16_t y1, uint8_t c); + void draw_rect(uint8_t x0, uint8_t y0, uint8_t w, uint8_t h, char c, char fc = -1); + void draw_circle(uint8_t x0, uint8_t y0, uint8_t radius, char c, char fc = -1); + void bitmap(uint8_t x, uint8_t y, const unsigned char * bmp, uint16_t i = 0, uint8_t width = 0, uint8_t lines = 0); + + //hook setup functions + void set_vbi_hook(void (*func)()); + void set_hbi_hook(void (*func)()); + + //tone functions + void tone(unsigned int frequency, unsigned long duration_ms); + void tone(unsigned int frequency); + void noTone(); + +//The following function definitions can be found in TVoutPrint.cpp +//printing functions + void print_char(uint8_t x, uint8_t y, unsigned char c); + void set_cursor(uint8_t, uint8_t); + void select_font(const unsigned char * f); + + void write(uint8_t); + void write(const char *str); + void write(const uint8_t *buffer, uint8_t size); + + void print(const char[]); + void print(char, int = BYTE); + void print(unsigned char, int = BYTE); + void print(int, int = DEC); + void print(unsigned int, int = DEC); + void print(long, int = DEC); + void print(unsigned long, int = DEC); + void print(double, int = 2); + + void print(uint8_t, uint8_t, const char[]); + void print(uint8_t, uint8_t, char, int = BYTE); + void print(uint8_t, uint8_t, unsigned char, int = BYTE); + void print(uint8_t, uint8_t, int, int = DEC); + void print(uint8_t, uint8_t, unsigned int, int = DEC); + void print(uint8_t, uint8_t, long, int = DEC); + void print(uint8_t, uint8_t, unsigned long, int = DEC); + void print(uint8_t, uint8_t, double, int = 2); + + void println(uint8_t, uint8_t, const char[]); + void println(uint8_t, uint8_t, char, int = BYTE); + void println(uint8_t, uint8_t, unsigned char, int = BYTE); + void println(uint8_t, uint8_t, int, int = DEC); + void println(uint8_t, uint8_t, unsigned int, int = DEC); + void println(uint8_t, uint8_t, long, int = DEC); + void println(uint8_t, uint8_t, unsigned long, int = DEC); + void println(uint8_t, uint8_t, double, int = 2); + void println(uint8_t, uint8_t); + + void println(const char[]); + void println(char, int = BYTE); + void println(unsigned char, int = BYTE); + void println(int, int = DEC); + void println(unsigned int, int = DEC); + void println(long, int = DEC); + void println(unsigned long, int = DEC); + void println(double, int = 2); + void println(void); + + void printPGM(const char[]); + void printPGM(uint8_t, uint8_t, const char[]); + +private: + uint8_t cursor_x,cursor_y; + const unsigned char * font; + + void inc_txtline(); + void printNumber(unsigned long, uint8_t); + void printFloat(double, uint8_t); +}; + +static void inline sp(unsigned char x, unsigned char y, char c); +#endif diff --git a/demontsc/lib/TVout/TVoutPrint.cpp b/demontsc/lib/TVout/TVoutPrint.cpp new file mode 100755 index 0000000..497e5a7 --- /dev/null +++ b/demontsc/lib/TVout/TVoutPrint.cpp @@ -0,0 +1,380 @@ +/* +TVPrint.cpp - Base class that provides print() and println() +Copyright (c) 2008 David A. Mellis. All right reserved. + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2.1 of the License, or (at your option) any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Modified 23 November 2006 by David A. Mellis +*/ + +#include +#include + +#include "TVout.h" + +void TVout::select_font(const unsigned char * f) { + font = f; +} + +/* + * print an 8x8 char c at x,y + * x must be a multiple of 8 + */ +void TVout::print_char(uint8_t x, uint8_t y, unsigned char c) { + + c -= pgm_read_byte(font+2); + bitmap(x,y,font,(c*pgm_read_byte(font+1))+3,pgm_read_byte(font),pgm_read_byte(font+1)); +} + +void TVout::inc_txtline() { + if (cursor_y >= (display.vres - pgm_read_byte(font+1))) + shift(pgm_read_byte(font+1),UP); + else + cursor_y += pgm_read_byte(font+1); +} + +/* default implementation: may be overridden */ +void TVout::write(const char *str) +{ + while (*str) + write(*str++); +} + +/* default implementation: may be overridden */ +void TVout::write(const uint8_t *buffer, uint8_t size) +{ + while (size--) + write(*buffer++); +} + +void TVout::write(uint8_t c) { + switch(c) { + case '\0': //null + break; + case '\n': //line feed + cursor_x = 0; + inc_txtline(); + break; + case 8: //backspace + cursor_x -= pgm_read_byte(font); + print_char(cursor_x,cursor_y,' '); + break; + case 13: //carriage return !?!?!?!VT!?!??!?! + cursor_x = 0; + break; + case 14: //form feed new page(clear screen) + //clear_screen(); + break; + default: + if (cursor_x >= (display.hres*8 - pgm_read_byte(font))) { + cursor_x = 0; + inc_txtline(); + print_char(cursor_x,cursor_y,c); + } + else + print_char(cursor_x,cursor_y,c); + cursor_x += pgm_read_byte(font); + } +} + +void TVout::print(const char str[]) +{ + write(str); +} + +void TVout::print(char c, int base) +{ + print((long) c, base); +} + +void TVout::print(unsigned char b, int base) +{ + print((unsigned long) b, base); +} + +void TVout::print(int n, int base) +{ + print((long) n, base); +} + +void TVout::print(unsigned int n, int base) +{ + print((unsigned long) n, base); +} + +void TVout::print(long n, int base) +{ + if (base == 0) { + write(n); + } else if (base == 10) { + if (n < 0) { + print('-'); + n = -n; + } + printNumber(n, 10); + } else { + printNumber(n, base); + } +} + +void TVout::print(unsigned long n, int base) +{ + if (base == 0) write(n); + else printNumber(n, base); +} + +void TVout::print(double n, int digits) +{ + printFloat(n, digits); +} + +void TVout::println(void) +{ + print('\r'); + print('\n'); +} + +void TVout::println(const char c[]) +{ + print(c); + println(); +} + +void TVout::println(char c, int base) +{ + print(c, base); + println(); +} + +void TVout::println(unsigned char b, int base) +{ + print(b, base); + println(); +} + +void TVout::println(int n, int base) +{ + print(n, base); + println(); +} + +void TVout::println(unsigned int n, int base) +{ + print(n, base); + println(); +} + +void TVout::println(long n, int base) +{ + print(n, base); + println(); +} + +void TVout::println(unsigned long n, int base) +{ + print(n, base); + println(); +} + +void TVout::println(double n, int digits) +{ + print(n, digits); + println(); +} + +void TVout::printPGM(const char str[]) { + char c; + while ((c = pgm_read_byte(str))) { + str++; + write(c); + } +} + +void TVout::printPGM(uint8_t x, uint8_t y, const char str[]) { + char c; + cursor_x = x; + cursor_y = y; + while ((c = pgm_read_byte(str))) { + str++; + write(c); + } +} + +void TVout::set_cursor(uint8_t x, uint8_t y) { + cursor_x = x; + cursor_y = y; +} + +void TVout::print(uint8_t x, uint8_t y, const char str[]) { + cursor_x = x; + cursor_y = y; + write(str); + +} +void TVout::print(uint8_t x, uint8_t y, char c, int base) { + cursor_x = x; + cursor_y = y; + print((long) c, base); +} +void TVout::print(uint8_t x, uint8_t y, unsigned char b, int base) { + cursor_x = x; + cursor_y = y; + print((unsigned long) b, base); +} +void TVout::print(uint8_t x, uint8_t y, int n, int base) { + cursor_x = x; + cursor_y = y; + print((long) n, base); +} +void TVout::print(uint8_t x, uint8_t y, unsigned int n, int base) { + cursor_x = x; + cursor_y = y; + print((unsigned long) n, base); +} +void TVout::print(uint8_t x, uint8_t y, long n, int base) { + cursor_x = x; + cursor_y = y; + print(n,base); +} +void TVout::print(uint8_t x, uint8_t y, unsigned long n, int base) { + cursor_x = x; + cursor_y = y; + print(n,base); +} +void TVout::print(uint8_t x, uint8_t y, double n, int digits) { + cursor_x = x; + cursor_y = y; + print(n,digits); +} + +void TVout::println(uint8_t x, uint8_t y, const char c[]) +{ + cursor_x = x; + cursor_y = y; + print(c); + println(); +} + +void TVout::println(uint8_t x, uint8_t y, char c, int base) +{ + cursor_x = x; + cursor_y = y; + print(c, base); + println(); +} + +void TVout::println(uint8_t x, uint8_t y, unsigned char b, int base) +{ + cursor_x = x; + cursor_y = y; + print(b, base); + println(); +} + +void TVout::println(uint8_t x, uint8_t y, int n, int base) +{ + cursor_x = x; + cursor_y = y; + print(n, base); + println(); +} + +void TVout::println(uint8_t x, uint8_t y, unsigned int n, int base) +{ + cursor_x = x; + cursor_y = y; + print(n, base); + println(); +} + +void TVout::println(uint8_t x, uint8_t y, long n, int base) +{ + cursor_x = x; + cursor_y = y; + print(n, base); + println(); +} + +void TVout::println(uint8_t x, uint8_t y, unsigned long n, int base) +{ + cursor_x = x; + cursor_y = y; + print(n, base); + println(); +} + +void TVout::println(uint8_t x, uint8_t y, double n, int digits) +{ + cursor_x = x; + cursor_y = y; + print(n, digits); + println(); +} + +void TVout::printNumber(unsigned long n, uint8_t base) +{ + unsigned char buf[8 * sizeof(long)]; // Assumes 8-bit chars. + unsigned long i = 0; + + if (n == 0) { + print('0'); + return; + } + + while (n > 0) { + buf[i++] = n % base; + n /= base; + } + + for (; i > 0; i--) + print((char) (buf[i - 1] < 10 ? + '0' + buf[i - 1] : + 'A' + buf[i - 1] - 10)); +} + +void TVout::printFloat(double number, uint8_t digits) +{ + // Handle negative numbers + if (number < 0.0) + { + print('-'); + number = -number; + } + + // Round correctly so that print(1.999, 2) prints as "2.00" + double rounding = 0.5; + for (uint8_t i=0; i 0) + print("."); + + // Extract digits from the remainder one at a time + while (digits-- > 0) + { + remainder *= 10.0; + int toPrint = int(remainder); + print(toPrint); + remainder -= toPrint; + } +} \ No newline at end of file diff --git a/demontsc/lib/TVout/examples/DemoNTSC/DemoNTSC.pde b/demontsc/lib/TVout/examples/DemoNTSC/DemoNTSC.pde new file mode 100755 index 0000000..7ad6232 --- /dev/null +++ b/demontsc/lib/TVout/examples/DemoNTSC/DemoNTSC.pde @@ -0,0 +1,217 @@ +#include +#include +#include "schematic.h" +#include "TVOlogo.h" + +TVout TV; + +int zOff = 150; +int xOff = 0; +int yOff = 0; +int cSize = 50; +int view_plane = 64; +float angle = PI/60; + +float cube3d[8][3] = { + {xOff - cSize,yOff + cSize,zOff - cSize}, + {xOff + cSize,yOff + cSize,zOff - cSize}, + {xOff - cSize,yOff - cSize,zOff - cSize}, + {xOff + cSize,yOff - cSize,zOff - cSize}, + {xOff - cSize,yOff + cSize,zOff + cSize}, + {xOff + cSize,yOff + cSize,zOff + cSize}, + {xOff - cSize,yOff - cSize,zOff + cSize}, + {xOff + cSize,yOff - cSize,zOff + cSize} +}; +unsigned char cube2d[8][2]; + + +void setup() { + TV.begin(NTSC,120,96); + TV.select_font(font6x8); + intro(); + TV.println("I am the TVout\nlibrary running on a freeduino\n"); + TV.delay(2500); + TV.println("I generate a PAL\nor NTSC composite video using\ninterrupts\n"); + TV.delay(2500); + TV.println("My schematic:"); + TV.delay(1500); + TV.bitmap(0,0,schematic); + TV.delay(10000); + TV.clear_screen(); + TV.println("Lets see what\nwhat I can do"); + TV.delay(2000); + + //fonts + TV.clear_screen(); + TV.println(0,0,"Multiple fonts:"); + TV.select_font(font4x6); + TV.println("4x6 font FONT"); + TV.select_font(font6x8); + TV.println("6x8 font FONT"); + TV.select_font(font8x8); + TV.println("8x8 font FONT"); + TV.select_font(font6x8); + TV.delay(2000); + + TV.clear_screen(); + TV.print(9,44,"Draw Basic Shapes"); + TV.delay(2000); + + //circles + TV.clear_screen(); + TV.draw_circle(TV.hres()/2,TV.vres()/2,TV.vres()/3,WHITE); + TV.delay(500); + TV.draw_circle(TV.hres()/2,TV.vres()/2,TV.vres()/2,WHITE,INVERT); + TV.delay(2000); + + //rectangles and lines + TV.clear_screen(); + TV.draw_rect(20,20,80,56,WHITE); + TV.delay(500); + TV.draw_rect(10,10,100,76,WHITE,INVERT); + TV.delay(500); + TV.draw_line(60,20,60,76,INVERT); + TV.draw_line(20,48,100,48,INVERT); + TV.delay(500); + TV.draw_line(10,10,110,86,INVERT); + TV.draw_line(10,86,110,10,INVERT); + TV.delay(2000); + + //random cube forever. + TV.clear_screen(); + TV.print(16,40,"Random Cube"); + TV.print(28,48,"Rotation"); + TV.delay(2000); + + randomSeed(analogRead(0)); +} + +void loop() { + int rsteps = random(10,60); + switch(random(6)) { + case 0: + for (int i = 0; i < rsteps; i++) { + zrotate(angle); + printcube(); + } + break; + case 1: + for (int i = 0; i < rsteps; i++) { + zrotate(2*PI - angle); + printcube(); + } + break; + case 2: + for (int i = 0; i < rsteps; i++) { + xrotate(angle); + printcube(); + } + break; + case 3: + for (int i = 0; i < rsteps; i++) { + xrotate(2*PI - angle); + printcube(); + } + break; + case 4: + for (int i = 0; i < rsteps; i++) { + yrotate(angle); + printcube(); + } + break; + case 5: + for (int i = 0; i < rsteps; i++) { + yrotate(2*PI - angle); + printcube(); + } + break; + } +} + +void intro() { +unsigned char w,l,wb; + int index; + w = pgm_read_byte(TVOlogo); + l = pgm_read_byte(TVOlogo+1); + if (w&7) + wb = w/8 + 1; + else + wb = w/8; + index = wb*(l-1) + 2; + for ( unsigned char i = 1; i < l; i++ ) { + TV.bitmap((TV.hres() - w)/2,0,TVOlogo,index,w,i); + index-= wb; + TV.delay(50); + } + for (unsigned char i = 0; i < (TV.vres() - l)/2; i++) { + TV.bitmap((TV.hres() - w)/2,i,TVOlogo); + TV.delay(50); + } + TV.delay(3000); + TV.clear_screen(); +} + +void printcube() { + //calculate 2d points + for(byte i = 0; i < 8; i++) { + cube2d[i][0] = (unsigned char)((cube3d[i][0] * view_plane / cube3d[i][2]) + (TV.hres()/2)); + cube2d[i][1] = (unsigned char)((cube3d[i][1] * view_plane / cube3d[i][2]) + (TV.vres()/2)); + } + TV.delay_frame(1); + TV.clear_screen(); + draw_cube(); +} + +void zrotate(float q) { + float tx,ty,temp; + for(byte i = 0; i < 8; i++) { + tx = cube3d[i][0] - xOff; + ty = cube3d[i][1] - yOff; + temp = tx * cos(q) - ty * sin(q); + ty = tx * sin(q) + ty * cos(q); + tx = temp; + cube3d[i][0] = tx + xOff; + cube3d[i][1] = ty + yOff; + } +} + +void yrotate(float q) { + float tx,tz,temp; + for(byte i = 0; i < 8; i++) { + tx = cube3d[i][0] - xOff; + tz = cube3d[i][2] - zOff; + temp = tz * cos(q) - tx * sin(q); + tx = tz * sin(q) + tx * cos(q); + tz = temp; + cube3d[i][0] = tx + xOff; + cube3d[i][2] = tz + zOff; + } +} + +void xrotate(float q) { + float ty,tz,temp; + for(byte i = 0; i < 8; i++) { + ty = cube3d[i][1] - yOff; + tz = cube3d[i][2] - zOff; + temp = ty * cos(q) - tz * sin(q); + tz = ty * sin(q) + tz * cos(q); + ty = temp; + cube3d[i][1] = ty + yOff; + cube3d[i][2] = tz + zOff; + } +} + +void draw_cube() { + TV.draw_line(cube2d[0][0],cube2d[0][1],cube2d[1][0],cube2d[1][1],WHITE); + TV.draw_line(cube2d[0][0],cube2d[0][1],cube2d[2][0],cube2d[2][1],WHITE); + TV.draw_line(cube2d[0][0],cube2d[0][1],cube2d[4][0],cube2d[4][1],WHITE); + TV.draw_line(cube2d[1][0],cube2d[1][1],cube2d[5][0],cube2d[5][1],WHITE); + TV.draw_line(cube2d[1][0],cube2d[1][1],cube2d[3][0],cube2d[3][1],WHITE); + TV.draw_line(cube2d[2][0],cube2d[2][1],cube2d[6][0],cube2d[6][1],WHITE); + TV.draw_line(cube2d[2][0],cube2d[2][1],cube2d[3][0],cube2d[3][1],WHITE); + TV.draw_line(cube2d[4][0],cube2d[4][1],cube2d[6][0],cube2d[6][1],WHITE); + TV.draw_line(cube2d[4][0],cube2d[4][1],cube2d[5][0],cube2d[5][1],WHITE); + TV.draw_line(cube2d[7][0],cube2d[7][1],cube2d[6][0],cube2d[6][1],WHITE); + TV.draw_line(cube2d[7][0],cube2d[7][1],cube2d[3][0],cube2d[3][1],WHITE); + TV.draw_line(cube2d[7][0],cube2d[7][1],cube2d[5][0],cube2d[5][1],WHITE); +} diff --git a/demontsc/lib/TVout/examples/DemoNTSC/TVOlogo.cpp b/demontsc/lib/TVout/examples/DemoNTSC/TVOlogo.cpp new file mode 100755 index 0000000..6435656 --- /dev/null +++ b/demontsc/lib/TVout/examples/DemoNTSC/TVOlogo.cpp @@ -0,0 +1,37 @@ +#include "TVOlogo.h" +PROGMEM const unsigned char TVOlogo[] = { +96,32, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x3F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFC,0x00, +0x03,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xC0, +0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x10,0x38, +0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x04, +0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x40,0x02, +0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0A,0x80,0x02, +0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x02, +0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xFF,0xFF,0xC2, +0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x42, +0x4F,0xFF,0x60,0x18,0x00,0x00,0x00,0x00,0x17,0xFF,0xFF,0x42, +0x4F,0xFF,0x60,0x18,0x00,0x00,0x00,0x30,0x14,0x00,0x01,0x42, +0x40,0x60,0x60,0x18,0x00,0x00,0x00,0x30,0x14,0x70,0x71,0x42, +0x40,0x60,0x30,0x30,0x00,0x00,0x00,0x30,0x14,0x88,0x89,0x42, +0x40,0x60,0x30,0x30,0x3E,0x06,0x0C,0xFE,0x15,0x05,0x25,0x42, +0x40,0x60,0x30,0x60,0xFF,0x86,0x0C,0xFE,0x15,0x72,0x75,0x42, +0x40,0x60,0x18,0x60,0xC1,0x86,0x0C,0x30,0x15,0x05,0x25,0x42, +0x40,0x60,0x18,0x61,0x80,0xC6,0x0C,0x30,0x14,0x88,0x89,0x42, +0x40,0x60,0x18,0xC1,0x80,0xC6,0x0C,0x30,0x14,0x70,0x71,0x42, +0x40,0x60,0x0C,0xC1,0x80,0xC6,0x0C,0x30,0x14,0x00,0x01,0x42, +0x40,0x60,0x0C,0xC1,0x80,0xC6,0x0C,0x30,0x17,0xFF,0xFF,0x42, +0x40,0x60,0x0F,0x81,0x80,0xC6,0x0C,0x30,0x10,0x00,0x00,0x42, +0x40,0x60,0x07,0x80,0xC1,0x87,0x1C,0x30,0x15,0x40,0x15,0x42, +0x40,0x60,0x07,0x80,0xFF,0x83,0xFC,0x3E,0x12,0x8A,0x8A,0x42, +0x40,0x60,0x03,0x00,0x3E,0x01,0xEC,0x1E,0x15,0x40,0x15,0x42, +0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x42, +0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xFF,0xFF,0xC2, +0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04, +0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38, +0x03,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xC0, +0x00,0x3F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFC,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + +}; diff --git a/demontsc/lib/TVout/examples/DemoNTSC/TVOlogo.h b/demontsc/lib/TVout/examples/DemoNTSC/TVOlogo.h new file mode 100755 index 0000000..3c1d56a --- /dev/null +++ b/demontsc/lib/TVout/examples/DemoNTSC/TVOlogo.h @@ -0,0 +1,6 @@ +#include +#ifndef TVOLOGO_H +#define TVOLOGO_H + +extern const unsigned char TVOlogo[]; +#endif \ No newline at end of file diff --git a/demontsc/lib/TVout/examples/DemoNTSC/schematic.cpp b/demontsc/lib/TVout/examples/DemoNTSC/schematic.cpp new file mode 100755 index 0000000..dcf0d1d --- /dev/null +++ b/demontsc/lib/TVout/examples/DemoNTSC/schematic.cpp @@ -0,0 +1,101 @@ +#include "schematic.h" + +PROGMEM const unsigned char schematic[] = { +120,96, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x0F,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFE, +0x08,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x02, +0x08,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x02, +0x0B,0x0C,0xE4,0x41,0x00,0x00,0x03,0x12,0x0E,0x22,0x61,0x80,0xB8,0x71,0x82, +0x0B,0x0D,0x94,0x41,0x00,0x00,0x05,0x14,0x11,0x22,0x61,0x80,0xA4,0xC9,0x82, +0x0A,0x95,0x04,0x41,0x00,0x00,0x01,0x14,0x11,0x22,0x52,0x80,0xA4,0x81,0x42, +0x0A,0x95,0x04,0x41,0x00,0x00,0x01,0x18,0x11,0x3E,0x52,0x80,0xB8,0x82,0x42, +0x0A,0x65,0x04,0x41,0x00,0x00,0x01,0x14,0x11,0x22,0x4C,0x80,0xA4,0x83,0xC2, +0x0A,0x65,0x94,0x41,0x00,0x00,0x01,0x12,0x11,0x22,0x4C,0x80,0xA4,0xCA,0x22, +0x0A,0x64,0xE3,0x81,0x00,0x00,0x07,0x92,0x0E,0x22,0x4C,0x80,0xA4,0x74,0x22, +0x08,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x02, +0x0F,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFE, +0x08,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x02, +0x08,0x70,0x00,0x01,0x00,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x80,0x00,0x02, +0x08,0x90,0x00,0x01,0x00,0x00,0x02,0x80,0x02,0x80,0x02,0x80,0x80,0x00,0x02, +0x08,0x84,0x5E,0x39,0x00,0x00,0x04,0x40,0x04,0x40,0x04,0x40,0x80,0x00,0x02, +0x08,0x64,0x92,0x41,0x00,0x00,0x08,0x20,0x08,0x20,0x08,0x20,0x80,0x00,0x02, +0x08,0x12,0x92,0x41,0xFF,0xFF,0xF0,0x10,0x10,0x10,0x10,0x1C,0x80,0x00,0x02, +0x08,0x92,0x92,0x41,0x00,0x00,0x00,0x08,0x20,0x08,0x20,0x04,0x80,0x00,0x02, +0x08,0xE1,0x12,0x39,0x00,0x00,0x00,0x04,0x40,0x04,0x40,0x04,0xA1,0x4F,0x02, +0x08,0x01,0x00,0x01,0x00,0x00,0x00,0x02,0x80,0x02,0x80,0x04,0xB3,0x49,0x82, +0x08,0x02,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x04,0x92,0x48,0x82, +0x08,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x92,0x48,0x82, +0x08,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x9C,0x48,0x82, +0x08,0x00,0x00,0x01,0x00,0x00,0x01,0x00,0x01,0x00,0x01,0x04,0x8C,0x49,0x82, +0x08,0x02,0x14,0xF1,0x00,0x00,0x02,0x80,0x02,0x80,0x02,0x84,0x8C,0x4F,0x02, +0x08,0x03,0x34,0x99,0x00,0x00,0x04,0x40,0x04,0x40,0x04,0x44,0x80,0x00,0x02, +0x08,0x01,0x24,0x89,0x00,0x00,0x08,0x20,0x08,0x20,0x08,0x24,0x80,0x00,0x02, +0x08,0x01,0x24,0x89,0xFF,0xFF,0xF0,0x10,0x10,0x10,0x10,0x1C,0x80,0x00,0x02, +0x08,0x01,0xC4,0x89,0x00,0x00,0x00,0x08,0x20,0x08,0x20,0x00,0x80,0x00,0x02, +0x08,0x00,0xC4,0x99,0x00,0x00,0x00,0x04,0x40,0x04,0x40,0x00,0x80,0x00,0x02, +0x08,0x00,0xC4,0xF1,0x00,0x00,0x00,0x02,0x80,0x02,0x80,0x00,0x80,0x00,0x02, +0x08,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x00,0x80,0x00,0x02, +0x08,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x02, +0x08,0x00,0x00,0x01,0x00,0x00,0x0C,0xF9,0xC1,0xC4,0x4C,0x30,0x80,0x00,0x02, +0x08,0x00,0x00,0x01,0x00,0x00,0x14,0x1A,0x42,0x24,0x4C,0x30,0x80,0x00,0x02, +0x08,0x00,0x00,0x01,0x00,0x00,0x34,0x12,0x42,0x24,0x4A,0x50,0x80,0x00,0x02, +0x08,0x00,0x00,0x01,0x00,0x00,0x24,0x32,0x42,0x27,0xCA,0x50,0x80,0x00,0x02, +0x08,0x00,0x00,0x01,0x00,0x00,0x3E,0x22,0x42,0x24,0x49,0x90,0x80,0x00,0x02, +0x08,0x00,0x00,0x01,0x00,0x00,0x04,0x62,0x42,0x24,0x49,0x90,0x80,0x00,0x02, +0x08,0x1E,0x64,0xF1,0x00,0x00,0x04,0x43,0x81,0xC4,0x49,0x90,0x9E,0x64,0xF2, +0x08,0x32,0x64,0x99,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xB2,0x64,0x9A, +0x08,0x20,0x54,0x89,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xA0,0x54,0x8A, +0x08,0x26,0x54,0x89,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xA6,0x54,0x8A, +0x08,0x22,0x4C,0x89,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xA2,0x4C,0x8A, +0x08,0x32,0x4C,0x99,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xB2,0x4C,0x9A, +0x08,0x1E,0x4C,0xF1,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x9E,0x4C,0xF2, +0x08,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x02, +0x0F,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFE, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x30,0x00,0x00,0x04,0x00,0x00,0x40,0x00,0x00,0x00,0x03,0x81,0xC6,0x04,0x00, +0x48,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x04,0x42,0x2A,0x04,0x00, +0x42,0x25,0x87,0x04,0x38,0x3C,0x48,0x8B,0xC8,0x8E,0x08,0x24,0x02,0x0A,0x00, +0x22,0x26,0x48,0x04,0x40,0x02,0x48,0x88,0x28,0x90,0x08,0x24,0x02,0x0A,0x00, +0x11,0x44,0x48,0x04,0x60,0x1E,0x45,0x51,0xE5,0x18,0x08,0x24,0x02,0x11,0x00, +0x09,0x44,0x48,0x04,0x18,0x22,0x45,0x52,0x25,0x06,0x08,0x24,0x02,0x1F,0x00, +0x48,0x84,0x48,0x04,0x08,0x22,0x42,0x22,0x22,0x02,0x04,0x42,0x22,0x20,0x80, +0x30,0x84,0x47,0x04,0x70,0x1E,0x42,0x21,0xE2,0x1C,0x03,0x81,0xCF,0xA0,0x80, +0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00, +0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x82,0x8F,0x01,0x00,0x00,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80, +0x82,0x88,0x80,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80, +0x44,0x88,0x41,0x0E,0x0F,0x02,0x03,0x8B,0x03,0xC5,0x91,0x07,0x87,0x17,0xE0, +0x44,0x88,0x41,0x10,0x08,0x82,0x04,0x4C,0x80,0x26,0x51,0x04,0x48,0x98,0x80, +0x28,0x88,0x41,0x18,0x08,0x84,0x04,0x48,0x81,0xE4,0x4A,0x04,0x48,0x90,0x80, +0x28,0x88,0x41,0x06,0x08,0x84,0x04,0x48,0x82,0x24,0x4A,0x04,0x48,0x90,0x80, +0x10,0x88,0x81,0x02,0x08,0x88,0x04,0x48,0x82,0x24,0x44,0x04,0x48,0x90,0x80, +0x10,0x8F,0x01,0x1C,0x0F,0x08,0x03,0x88,0x81,0xE4,0x44,0x07,0x87,0x10,0x60, +0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x08,0x04,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x08,0x04,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 +}; diff --git a/demontsc/lib/TVout/examples/DemoNTSC/schematic.h b/demontsc/lib/TVout/examples/DemoNTSC/schematic.h new file mode 100755 index 0000000..4d0b270 --- /dev/null +++ b/demontsc/lib/TVout/examples/DemoNTSC/schematic.h @@ -0,0 +1,6 @@ +#include +#ifndef SHEMATIC_H +#define SHEMATIC_H + +extern const unsigned char schematic[]; +#endif diff --git a/demontsc/lib/TVout/examples/DemoPAL/DemoPAL.pde b/demontsc/lib/TVout/examples/DemoPAL/DemoPAL.pde new file mode 100755 index 0000000..80cc885 --- /dev/null +++ b/demontsc/lib/TVout/examples/DemoPAL/DemoPAL.pde @@ -0,0 +1,217 @@ +#include +#include +#include "schematic.h" +#include "TVOlogo.h" + +TVout TV; + +int zOff = 150; +int xOff = 0; +int yOff = 0; +int cSize = 50; +int view_plane = 64; +float angle = PI/60; + +float cube3d[8][3] = { + {xOff - cSize,yOff + cSize,zOff - cSize}, + {xOff + cSize,yOff + cSize,zOff - cSize}, + {xOff - cSize,yOff - cSize,zOff - cSize}, + {xOff + cSize,yOff - cSize,zOff - cSize}, + {xOff - cSize,yOff + cSize,zOff + cSize}, + {xOff + cSize,yOff + cSize,zOff + cSize}, + {xOff - cSize,yOff - cSize,zOff + cSize}, + {xOff + cSize,yOff - cSize,zOff + cSize} +}; +unsigned char cube2d[8][2]; + + +void setup() { + TV.begin(PAL,120,96); + TV.select_font(font6x8); + intro(); + TV.println("I am the TVout\nlibrary running on a freeduino\n"); + TV.delay(2500); + TV.println("I generate a PAL\nor NTSC composite video using\ninterrupts\n"); + TV.delay(2500); + TV.println("My schematic:"); + TV.delay(1500); + TV.bitmap(0,0,schematic); + TV.delay(10000); + TV.clear_screen(); + TV.println("Lets see what\nwhat I can do"); + TV.delay(2000); + + //fonts + TV.clear_screen(); + TV.println(0,0,"Multiple fonts:"); + TV.select_font(font4x6); + TV.println("4x6 font FONT"); + TV.select_font(font6x8); + TV.println("6x8 font FONT"); + TV.select_font(font8x8); + TV.println("8x8 font FONT"); + TV.select_font(font6x8); + TV.delay(2000); + + TV.clear_screen(); + TV.print(9,44,"Draw Basic Shapes"); + TV.delay(2000); + + //circles + TV.clear_screen(); + TV.draw_circle(TV.hres()/2,TV.vres()/2,TV.vres()/3,WHITE); + TV.delay(500); + TV.draw_circle(TV.hres()/2,TV.vres()/2,TV.vres()/2,WHITE,INVERT); + TV.delay(2000); + + //rectangles and lines + TV.clear_screen(); + TV.draw_rect(20,20,80,56,WHITE); + TV.delay(500); + TV.draw_rect(10,10,100,76,WHITE,INVERT); + TV.delay(500); + TV.draw_line(60,20,60,76,INVERT); + TV.draw_line(20,48,100,48,INVERT); + TV.delay(500); + TV.draw_line(10,10,110,86,INVERT); + TV.draw_line(10,86,110,10,INVERT); + TV.delay(2000); + + //random cube forever. + TV.clear_screen(); + TV.print(16,40,"Random Cube"); + TV.print(28,48,"Rotation"); + TV.delay(2000); + + randomSeed(analogRead(0)); +} + +void loop() { + int rsteps = random(10,60); + switch(random(6)) { + case 0: + for (int i = 0; i < rsteps; i++) { + zrotate(angle); + printcube(); + } + break; + case 1: + for (int i = 0; i < rsteps; i++) { + zrotate(2*PI - angle); + printcube(); + } + break; + case 2: + for (int i = 0; i < rsteps; i++) { + xrotate(angle); + printcube(); + } + break; + case 3: + for (int i = 0; i < rsteps; i++) { + xrotate(2*PI - angle); + printcube(); + } + break; + case 4: + for (int i = 0; i < rsteps; i++) { + yrotate(angle); + printcube(); + } + break; + case 5: + for (int i = 0; i < rsteps; i++) { + yrotate(2*PI - angle); + printcube(); + } + break; + } +} + +void intro() { +unsigned char w,l,wb; + int index; + w = pgm_read_byte(TVOlogo); + l = pgm_read_byte(TVOlogo+1); + if (w&7) + wb = w/8 + 1; + else + wb = w/8; + index = wb*(l-1) + 2; + for ( unsigned char i = 1; i < l; i++ ) { + TV.bitmap((TV.hres() - w)/2,0,TVOlogo,index,w,i); + index-= wb; + TV.delay(50); + } + for (unsigned char i = 0; i < (TV.vres() - l)/2; i++) { + TV.bitmap((TV.hres() - w)/2,i,TVOlogo); + TV.delay(50); + } + TV.delay(3000); + TV.clear_screen(); +} + +void printcube() { + //calculate 2d points + for(byte i = 0; i < 8; i++) { + cube2d[i][0] = (unsigned char)((cube3d[i][0] * view_plane / cube3d[i][2]) + (TV.hres()/2)); + cube2d[i][1] = (unsigned char)((cube3d[i][1] * view_plane / cube3d[i][2]) + (TV.vres()/2)); + } + TV.delay_frame(1); + TV.clear_screen(); + draw_cube(); +} + +void zrotate(float q) { + float tx,ty,temp; + for(byte i = 0; i < 8; i++) { + tx = cube3d[i][0] - xOff; + ty = cube3d[i][1] - yOff; + temp = tx * cos(q) - ty * sin(q); + ty = tx * sin(q) + ty * cos(q); + tx = temp; + cube3d[i][0] = tx + xOff; + cube3d[i][1] = ty + yOff; + } +} + +void yrotate(float q) { + float tx,tz,temp; + for(byte i = 0; i < 8; i++) { + tx = cube3d[i][0] - xOff; + tz = cube3d[i][2] - zOff; + temp = tz * cos(q) - tx * sin(q); + tx = tz * sin(q) + tx * cos(q); + tz = temp; + cube3d[i][0] = tx + xOff; + cube3d[i][2] = tz + zOff; + } +} + +void xrotate(float q) { + float ty,tz,temp; + for(byte i = 0; i < 8; i++) { + ty = cube3d[i][1] - yOff; + tz = cube3d[i][2] - zOff; + temp = ty * cos(q) - tz * sin(q); + tz = ty * sin(q) + tz * cos(q); + ty = temp; + cube3d[i][1] = ty + yOff; + cube3d[i][2] = tz + zOff; + } +} + +void draw_cube() { + TV.draw_line(cube2d[0][0],cube2d[0][1],cube2d[1][0],cube2d[1][1],WHITE); + TV.draw_line(cube2d[0][0],cube2d[0][1],cube2d[2][0],cube2d[2][1],WHITE); + TV.draw_line(cube2d[0][0],cube2d[0][1],cube2d[4][0],cube2d[4][1],WHITE); + TV.draw_line(cube2d[1][0],cube2d[1][1],cube2d[5][0],cube2d[5][1],WHITE); + TV.draw_line(cube2d[1][0],cube2d[1][1],cube2d[3][0],cube2d[3][1],WHITE); + TV.draw_line(cube2d[2][0],cube2d[2][1],cube2d[6][0],cube2d[6][1],WHITE); + TV.draw_line(cube2d[2][0],cube2d[2][1],cube2d[3][0],cube2d[3][1],WHITE); + TV.draw_line(cube2d[4][0],cube2d[4][1],cube2d[6][0],cube2d[6][1],WHITE); + TV.draw_line(cube2d[4][0],cube2d[4][1],cube2d[5][0],cube2d[5][1],WHITE); + TV.draw_line(cube2d[7][0],cube2d[7][1],cube2d[6][0],cube2d[6][1],WHITE); + TV.draw_line(cube2d[7][0],cube2d[7][1],cube2d[3][0],cube2d[3][1],WHITE); + TV.draw_line(cube2d[7][0],cube2d[7][1],cube2d[5][0],cube2d[5][1],WHITE); +} diff --git a/demontsc/lib/TVout/examples/DemoPAL/TVOlogo.cpp b/demontsc/lib/TVout/examples/DemoPAL/TVOlogo.cpp new file mode 100755 index 0000000..6435656 --- /dev/null +++ b/demontsc/lib/TVout/examples/DemoPAL/TVOlogo.cpp @@ -0,0 +1,37 @@ +#include "TVOlogo.h" +PROGMEM const unsigned char TVOlogo[] = { +96,32, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x3F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFC,0x00, +0x03,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xC0, +0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x10,0x38, +0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x04, +0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x40,0x02, +0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0A,0x80,0x02, +0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x02, +0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xFF,0xFF,0xC2, +0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x42, +0x4F,0xFF,0x60,0x18,0x00,0x00,0x00,0x00,0x17,0xFF,0xFF,0x42, +0x4F,0xFF,0x60,0x18,0x00,0x00,0x00,0x30,0x14,0x00,0x01,0x42, +0x40,0x60,0x60,0x18,0x00,0x00,0x00,0x30,0x14,0x70,0x71,0x42, +0x40,0x60,0x30,0x30,0x00,0x00,0x00,0x30,0x14,0x88,0x89,0x42, +0x40,0x60,0x30,0x30,0x3E,0x06,0x0C,0xFE,0x15,0x05,0x25,0x42, +0x40,0x60,0x30,0x60,0xFF,0x86,0x0C,0xFE,0x15,0x72,0x75,0x42, +0x40,0x60,0x18,0x60,0xC1,0x86,0x0C,0x30,0x15,0x05,0x25,0x42, +0x40,0x60,0x18,0x61,0x80,0xC6,0x0C,0x30,0x14,0x88,0x89,0x42, +0x40,0x60,0x18,0xC1,0x80,0xC6,0x0C,0x30,0x14,0x70,0x71,0x42, +0x40,0x60,0x0C,0xC1,0x80,0xC6,0x0C,0x30,0x14,0x00,0x01,0x42, +0x40,0x60,0x0C,0xC1,0x80,0xC6,0x0C,0x30,0x17,0xFF,0xFF,0x42, +0x40,0x60,0x0F,0x81,0x80,0xC6,0x0C,0x30,0x10,0x00,0x00,0x42, +0x40,0x60,0x07,0x80,0xC1,0x87,0x1C,0x30,0x15,0x40,0x15,0x42, +0x40,0x60,0x07,0x80,0xFF,0x83,0xFC,0x3E,0x12,0x8A,0x8A,0x42, +0x40,0x60,0x03,0x00,0x3E,0x01,0xEC,0x1E,0x15,0x40,0x15,0x42, +0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x42, +0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xFF,0xFF,0xC2, +0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04, +0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38, +0x03,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xC0, +0x00,0x3F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFC,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + +}; diff --git a/demontsc/lib/TVout/examples/DemoPAL/TVOlogo.h b/demontsc/lib/TVout/examples/DemoPAL/TVOlogo.h new file mode 100755 index 0000000..3c1d56a --- /dev/null +++ b/demontsc/lib/TVout/examples/DemoPAL/TVOlogo.h @@ -0,0 +1,6 @@ +#include +#ifndef TVOLOGO_H +#define TVOLOGO_H + +extern const unsigned char TVOlogo[]; +#endif \ No newline at end of file diff --git a/demontsc/lib/TVout/examples/DemoPAL/schematic.cpp b/demontsc/lib/TVout/examples/DemoPAL/schematic.cpp new file mode 100755 index 0000000..dcf0d1d --- /dev/null +++ b/demontsc/lib/TVout/examples/DemoPAL/schematic.cpp @@ -0,0 +1,101 @@ +#include "schematic.h" + +PROGMEM const unsigned char schematic[] = { +120,96, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x0F,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFE, +0x08,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x02, +0x08,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x02, +0x0B,0x0C,0xE4,0x41,0x00,0x00,0x03,0x12,0x0E,0x22,0x61,0x80,0xB8,0x71,0x82, +0x0B,0x0D,0x94,0x41,0x00,0x00,0x05,0x14,0x11,0x22,0x61,0x80,0xA4,0xC9,0x82, +0x0A,0x95,0x04,0x41,0x00,0x00,0x01,0x14,0x11,0x22,0x52,0x80,0xA4,0x81,0x42, +0x0A,0x95,0x04,0x41,0x00,0x00,0x01,0x18,0x11,0x3E,0x52,0x80,0xB8,0x82,0x42, +0x0A,0x65,0x04,0x41,0x00,0x00,0x01,0x14,0x11,0x22,0x4C,0x80,0xA4,0x83,0xC2, +0x0A,0x65,0x94,0x41,0x00,0x00,0x01,0x12,0x11,0x22,0x4C,0x80,0xA4,0xCA,0x22, +0x0A,0x64,0xE3,0x81,0x00,0x00,0x07,0x92,0x0E,0x22,0x4C,0x80,0xA4,0x74,0x22, +0x08,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x02, +0x0F,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFE, +0x08,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x02, +0x08,0x70,0x00,0x01,0x00,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x80,0x00,0x02, +0x08,0x90,0x00,0x01,0x00,0x00,0x02,0x80,0x02,0x80,0x02,0x80,0x80,0x00,0x02, +0x08,0x84,0x5E,0x39,0x00,0x00,0x04,0x40,0x04,0x40,0x04,0x40,0x80,0x00,0x02, +0x08,0x64,0x92,0x41,0x00,0x00,0x08,0x20,0x08,0x20,0x08,0x20,0x80,0x00,0x02, +0x08,0x12,0x92,0x41,0xFF,0xFF,0xF0,0x10,0x10,0x10,0x10,0x1C,0x80,0x00,0x02, +0x08,0x92,0x92,0x41,0x00,0x00,0x00,0x08,0x20,0x08,0x20,0x04,0x80,0x00,0x02, +0x08,0xE1,0x12,0x39,0x00,0x00,0x00,0x04,0x40,0x04,0x40,0x04,0xA1,0x4F,0x02, +0x08,0x01,0x00,0x01,0x00,0x00,0x00,0x02,0x80,0x02,0x80,0x04,0xB3,0x49,0x82, +0x08,0x02,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x04,0x92,0x48,0x82, +0x08,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x92,0x48,0x82, +0x08,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x9C,0x48,0x82, +0x08,0x00,0x00,0x01,0x00,0x00,0x01,0x00,0x01,0x00,0x01,0x04,0x8C,0x49,0x82, +0x08,0x02,0x14,0xF1,0x00,0x00,0x02,0x80,0x02,0x80,0x02,0x84,0x8C,0x4F,0x02, +0x08,0x03,0x34,0x99,0x00,0x00,0x04,0x40,0x04,0x40,0x04,0x44,0x80,0x00,0x02, +0x08,0x01,0x24,0x89,0x00,0x00,0x08,0x20,0x08,0x20,0x08,0x24,0x80,0x00,0x02, +0x08,0x01,0x24,0x89,0xFF,0xFF,0xF0,0x10,0x10,0x10,0x10,0x1C,0x80,0x00,0x02, +0x08,0x01,0xC4,0x89,0x00,0x00,0x00,0x08,0x20,0x08,0x20,0x00,0x80,0x00,0x02, +0x08,0x00,0xC4,0x99,0x00,0x00,0x00,0x04,0x40,0x04,0x40,0x00,0x80,0x00,0x02, +0x08,0x00,0xC4,0xF1,0x00,0x00,0x00,0x02,0x80,0x02,0x80,0x00,0x80,0x00,0x02, +0x08,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x00,0x80,0x00,0x02, +0x08,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x02, +0x08,0x00,0x00,0x01,0x00,0x00,0x0C,0xF9,0xC1,0xC4,0x4C,0x30,0x80,0x00,0x02, +0x08,0x00,0x00,0x01,0x00,0x00,0x14,0x1A,0x42,0x24,0x4C,0x30,0x80,0x00,0x02, +0x08,0x00,0x00,0x01,0x00,0x00,0x34,0x12,0x42,0x24,0x4A,0x50,0x80,0x00,0x02, +0x08,0x00,0x00,0x01,0x00,0x00,0x24,0x32,0x42,0x27,0xCA,0x50,0x80,0x00,0x02, +0x08,0x00,0x00,0x01,0x00,0x00,0x3E,0x22,0x42,0x24,0x49,0x90,0x80,0x00,0x02, +0x08,0x00,0x00,0x01,0x00,0x00,0x04,0x62,0x42,0x24,0x49,0x90,0x80,0x00,0x02, +0x08,0x1E,0x64,0xF1,0x00,0x00,0x04,0x43,0x81,0xC4,0x49,0x90,0x9E,0x64,0xF2, +0x08,0x32,0x64,0x99,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xB2,0x64,0x9A, +0x08,0x20,0x54,0x89,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xA0,0x54,0x8A, +0x08,0x26,0x54,0x89,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xA6,0x54,0x8A, +0x08,0x22,0x4C,0x89,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xA2,0x4C,0x8A, +0x08,0x32,0x4C,0x99,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xB2,0x4C,0x9A, +0x08,0x1E,0x4C,0xF1,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x9E,0x4C,0xF2, +0x08,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x02, +0x0F,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFE, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x30,0x00,0x00,0x04,0x00,0x00,0x40,0x00,0x00,0x00,0x03,0x81,0xC6,0x04,0x00, +0x48,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x04,0x42,0x2A,0x04,0x00, +0x42,0x25,0x87,0x04,0x38,0x3C,0x48,0x8B,0xC8,0x8E,0x08,0x24,0x02,0x0A,0x00, +0x22,0x26,0x48,0x04,0x40,0x02,0x48,0x88,0x28,0x90,0x08,0x24,0x02,0x0A,0x00, +0x11,0x44,0x48,0x04,0x60,0x1E,0x45,0x51,0xE5,0x18,0x08,0x24,0x02,0x11,0x00, +0x09,0x44,0x48,0x04,0x18,0x22,0x45,0x52,0x25,0x06,0x08,0x24,0x02,0x1F,0x00, +0x48,0x84,0x48,0x04,0x08,0x22,0x42,0x22,0x22,0x02,0x04,0x42,0x22,0x20,0x80, +0x30,0x84,0x47,0x04,0x70,0x1E,0x42,0x21,0xE2,0x1C,0x03,0x81,0xCF,0xA0,0x80, +0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00, +0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x82,0x8F,0x01,0x00,0x00,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80, +0x82,0x88,0x80,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80, +0x44,0x88,0x41,0x0E,0x0F,0x02,0x03,0x8B,0x03,0xC5,0x91,0x07,0x87,0x17,0xE0, +0x44,0x88,0x41,0x10,0x08,0x82,0x04,0x4C,0x80,0x26,0x51,0x04,0x48,0x98,0x80, +0x28,0x88,0x41,0x18,0x08,0x84,0x04,0x48,0x81,0xE4,0x4A,0x04,0x48,0x90,0x80, +0x28,0x88,0x41,0x06,0x08,0x84,0x04,0x48,0x82,0x24,0x4A,0x04,0x48,0x90,0x80, +0x10,0x88,0x81,0x02,0x08,0x88,0x04,0x48,0x82,0x24,0x44,0x04,0x48,0x90,0x80, +0x10,0x8F,0x01,0x1C,0x0F,0x08,0x03,0x88,0x81,0xE4,0x44,0x07,0x87,0x10,0x60, +0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x08,0x04,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x08,0x04,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 +}; diff --git a/demontsc/lib/TVout/examples/DemoPAL/schematic.h b/demontsc/lib/TVout/examples/DemoPAL/schematic.h new file mode 100755 index 0000000..4d0b270 --- /dev/null +++ b/demontsc/lib/TVout/examples/DemoPAL/schematic.h @@ -0,0 +1,6 @@ +#include +#ifndef SHEMATIC_H +#define SHEMATIC_H + +extern const unsigned char schematic[]; +#endif diff --git a/demontsc/lib/TVout/examples/NTSCserialTerm/NTSCserialTerm.pde b/demontsc/lib/TVout/examples/NTSCserialTerm/NTSCserialTerm.pde new file mode 100755 index 0000000..7b509a4 --- /dev/null +++ b/demontsc/lib/TVout/examples/NTSCserialTerm/NTSCserialTerm.pde @@ -0,0 +1,20 @@ +#include +#include +#include + +TVout TV; +pollserial pserial; + +void setup() { + TV.begin(_NTSC,184,72); + TV.select_font(font6x8); + TV.println("Serial Terminal"); + TV.println("-- Version 0.1 --"); + TV.set_hbi_hook(pserial.begin(57600)); +} + +void loop() { + if (pserial.available()) { + TV.print((char)pserial.read()); + } +} \ No newline at end of file diff --git a/demontsc/lib/TVout/keywords.txt b/demontsc/lib/TVout/keywords.txt new file mode 100755 index 0000000..bdcec2b --- /dev/null +++ b/demontsc/lib/TVout/keywords.txt @@ -0,0 +1,50 @@ +NTSC LITERAL1 +PAL LITERAL1 +_NTSC LITERAL1 +_PAL LITERAL1 +WHITE LITERAL1 +BLACK LITERAL1 +INVERT LITERAL1 +UP LITERAL1 +DOWN LITERAL1 +LEFT LITERAL1 +RIGHT LITERAL1 + +TVout KEYWORD1 + +clear_screen KEYWORD2 +invert KEYWORD2 + +begin KEYWORD2 +end KEYWORD2 +force_vscale KEYWORD2 +force_outstart KEYWORD2 +force_linestart KEYWORD2 +hres KEYWORD2 +vres KEYWORD2 +char_line KEYWORD2 +fill KEYWORD2 +delay KEYWORD2 +delay_frame KEYWORD2 +millis KEYWORD2 +set_pixel KEYWORD2 +get_pixel KEYWORD2 +fill KEYWORD2 +shift KEYWORD2 +draw_line KEYWORD2 +draw_row KEYWORD2 +draw_column KEYWORD2 +draw_rect KEYWORD2 +draw_circle KEYWORD2 +bitmap KEYWORD2 +set_vbi_hook KEYWORD2 +set_hbi_hook KEYWORD2 +tone KEYWORD2 +noTone KEYWORD2 +print_char KEYWORD2 +set_cursor KEYWORD2 +select_font KEYWORD2 +print KEYWORD2 +println KEYWORD2 +printPGM KEYWORD2 + diff --git a/demontsc/lib/TVout/spec/asm_macros.h b/demontsc/lib/TVout/spec/asm_macros.h new file mode 100755 index 0000000..1f91c11 --- /dev/null +++ b/demontsc/lib/TVout/spec/asm_macros.h @@ -0,0 +1,144 @@ +/* + Copyright (c) 2010 Myles Metzer + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include "hardware_setup.h" + +#ifndef ASM_MACROS_H +#define ASM_MACROS_H + +// delay macros +__asm__ __volatile__ ( + // delay 1 clock cycle. + ".macro delay1\n\t" + "nop\n" + ".endm\n" + + // delay 2 clock cycles + ".macro delay2\n\t" + "nop\n\t" + "nop\n" + ".endm\n" + + // delay 3 clock cyles + ".macro delay3\n\t" + "nop\n\t" + "nop\n\t" + "nop\n" + ".endm\n" + + // delay 4 clock cylces + ".macro delay4\n\t" + "nop\n\t" + "nop\n\t" + "nop\n\t" + "nop\n" + ".endm\n" + + // delay 5 clock cylces + ".macro delay5\n\t" + "nop\n\t" + "nop\n\t" + "nop\n\t" + "nop\n\t" + "nop\n" + ".endm\n" + + // delay 6 clock cylces + ".macro delay6\n\t" + "nop\n\t" + "nop\n\t" + "nop\n\t" + "nop\n\t" + "nop\n\t" + "nop\n" + ".endm\n" + + // delay 7 clock cylces + ".macro delay7\n\t" + "nop\n\t" + "nop\n\t" + "nop\n\t" + "nop\n\t" + "nop\n\t" + "nop\n\t" + "nop\n" + ".endm\n" + + // delay 8 clock cylces + ".macro delay8\n\t" + "nop\n\t" + "nop\n\t" + "nop\n\t" + "nop\n\t" + "nop\n\t" + "nop\n\t" + "nop\n\t" + "nop\n" + ".endm\n" + + // delay 9 clock cylces + ".macro delay9\n\t" + "nop\n\t" + "nop\n\t" + "nop\n\t" + "nop\n\t" + "nop\n\t" + "nop\n\t" + "nop\n\t" + "nop\n\t" + "nop\n" + ".endm\n" + + // delay 10 clock cylces + ".macro delay10\n\t" + "nop\n\t" + "nop\n\t" + "nop\n\t" + "nop\n\t" + "nop\n\t" + "nop\n\t" + "nop\n\t" + "nop\n\t" + "nop\n\t" + "nop\n" + ".endm\n" +); // end of delay macros + +// common output macros, specific output macros at top of file +__asm__ __volatile__ ( + + // save port 16 and clear the video bit + ".macro svprt p\n\t" + "in r16,\\p\n\t" + ANDI_HWS + ".endm\n" + + // ouput 1 bit port safe + ".macro o1bs p\n\t" + BLD_HWS + "out \\p,r16\n" + ".endm\n" +); // end of output macros +#endif \ No newline at end of file diff --git a/demontsc/lib/TVout/spec/hardware_setup.h b/demontsc/lib/TVout/spec/hardware_setup.h new file mode 100755 index 0000000..c11e18c --- /dev/null +++ b/demontsc/lib/TVout/spec/hardware_setup.h @@ -0,0 +1,146 @@ +/* + Copyright (c) 2010 Myles Metzer + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. +*/ + +// sound is output on OC2A +// sync output is on OC1A + +//ENABLE_FAST_OUTPUT chooses the highest bit of a port over the original output method +//comment out this line to switch back to the original output pins. +#define ENABLE_FAST_OUTPUT + +#ifndef HARDWARE_SETUP_H +#define HARDWARE_SETUP_H + +// device specific settings. +#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega1281__) || defined(__AVR_ATmega2560__) || defined(__AVR_ATmega2561__) +#if defined(ENABLE_FAST_OUTPUT) +#define PORT_VID PORTA +#define DDR_VID DDRA +#define VID_PIN 7 +#else +//video +#define PORT_VID PORTB +#define DDR_VID DDRB +#define VID_PIN 6 +#endif +//sync +#define PORT_SYNC PORTB +#define DDR_SYNC DDRB +#define SYNC_PIN 5 +//sound +#define PORT_SND PORTB +#define DDR_SND DDRB +#define SND_PIN 4 + +#elif defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__) || defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__) +//video +#if defined(ENABLE_FAST_OUTPUT) +#define PORT_VID PORTA +#define DDR_VID DDRA +#define VID_PIN 7 +#else +#define PORT_VID PORTD +#define DDR_VID DDRD +#define VID_PIN 4 +#endif +//sync +#define PORT_SYNC PORTD +#define DDR_SYNC DDRD +#define SYNC_PIN 5 +//sound +#define PORT_SND PORTD +#define DDR_SND DDRD +#define SND_PIN 7 + +#elif defined(__AVR_ATmega8__) || defined(__AVR_ATmega88__) || defined(__AVR_ATmega168P__) || defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__) || defined(__AVR_ATmega328__) +//video +#if defined(ENABLE_FAST_OUTPUT) +#define PORT_VID PORTD +#define DDR_VID DDRD +#define VID_PIN 7 +#else +#define PORT_VID PORTB +#define DDR_VID DDRB +#define VID_PIN 0 +#endif +//sync +#define PORT_SYNC PORTB +#define DDR_SYNC DDRB +#define SYNC_PIN 1 +//sound +#define PORT_SND PORTB +#define DDR_SND DDRB +#define SND_PIN 3 + +#elif defined (__AVR_AT90USB1286__) +//video +#define PORT_VID PORTF +#define DDR_VID DDRF +#define VID_PIN 7 +//sync +#define PORT_SYNC PORTB +#define DDR_SYNC DDRB +#define SYNC_PIN 5 +//sound +#define PORT_SND PORTB +#define DDR_SND DDRB +#define SND_PIN 4 +#endif + +//automatic BST/BLD/ANDI macro definition +#if VID_PIN == 0 +#define BLD_HWS "bld r16,0\n\t" +#define BST_HWS "bst r16,0\n\t" +#define ANDI_HWS "andi r16,0xFE\n" +#elif VID_PIN == 1 +#define BLD_HWS "bld r16,1\n\t" +#define BST_HWS "bst r16,1\n\t" +#define ANDI_HWS "andi r16,0xFD\n" +#elif VID_PIN == 2 +#define BLD_HWS "bld r16,2\n\t" +#define BST_HWS "bst r16,2\n\t" +#define ANDI_HWS "andi r16,0xFB\n" +#elif VID_PIN == 3 +#define BLD_HWS "bld r16,3\n\t" +#define BST_HWS "bst r16,3\n\t" +#define ANDI_HWS "andi r16,0xF7\n" +#elif VID_PIN == 4 +#define BLD_HWS "bld r16,4\n\t" +#define BST_HWS "bst r16,4\n\t" +#define ANDI_HWS "andi r16,0xEF\n" +#elif VID_PIN == 5 +#define BLD_HWS "bld r16,5\n\t" +#define BST_HWS "bst r16,5\n\t" +#define ANDI_HWS "andi r16,0xDF\n" +#elif VID_PIN == 6 +#define BLD_HWS "bld r16,6\n\t" +#define BST_HWS "bst r16,6\n\t" +#define ANDI_HWS "andi r16,0xBF\n" +#elif VID_PIN == 7 +#define BLD_HWS "bld r16,7\n\t" +#define BST_HWS "bst r16,7\n\t" +#define ANDI_HWS "andi r16,0x7F\n" +#endif +#endif \ No newline at end of file diff --git a/demontsc/lib/TVout/spec/video_properties.h b/demontsc/lib/TVout/spec/video_properties.h new file mode 100755 index 0000000..006cf37 --- /dev/null +++ b/demontsc/lib/TVout/spec/video_properties.h @@ -0,0 +1,67 @@ +/* + Copyright (c) 2010 Myles Metzer + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. +*/ + +/* + This File contains the timing definitions for the TVout AVR composite video + generation Library +*/ +#ifndef VIDEO_TIMING_H +#define VIDEO_TIMING_H + +#define _CYCLES_PER_US (F_CPU / 1000000) + +#define _TIME_HORZ_SYNC 4.7 +#define _TIME_VIRT_SYNC 58.85 +#define _TIME_ACTIVE 46 +#define _CYCLES_VIRT_SYNC ((_TIME_VIRT_SYNC * _CYCLES_PER_US) - 1) +#define _CYCLES_HORZ_SYNC ((_TIME_HORZ_SYNC * _CYCLES_PER_US) - 1) + +//Timing settings for NTSC +#define _NTSC_TIME_SCANLINE 63.55 +#define _NTSC_TIME_OUTPUT_START 12 + +#define _NTSC_LINE_FRAME 262 +#define _NTSC_LINE_START_VSYNC 0 +#define _NTSC_LINE_STOP_VSYNC 3 +#define _NTSC_LINE_DISPLAY 216 +#define _NTSC_LINE_MID ((_NTSC_LINE_FRAME - _NTSC_LINE_DISPLAY)/2 + _NTSC_LINE_DISPLAY/2) + +#define _NTSC_CYCLES_SCANLINE ((_NTSC_TIME_SCANLINE * _CYCLES_PER_US) - 1) +#define _NTSC_CYCLES_OUTPUT_START ((_NTSC_TIME_OUTPUT_START * _CYCLES_PER_US) - 1) + +//Timing settings for PAL +#define _PAL_TIME_SCANLINE 64 +#define _PAL_TIME_OUTPUT_START 12.5 + +#define _PAL_LINE_FRAME 312 +#define _PAL_LINE_START_VSYNC 0 +#define _PAL_LINE_STOP_VSYNC 7 +#define _PAL_LINE_DISPLAY 260 +#define _PAL_LINE_MID ((_PAL_LINE_FRAME - _PAL_LINE_DISPLAY)/2 + _PAL_LINE_DISPLAY/2) + +#define _PAL_CYCLES_SCANLINE ((_PAL_TIME_SCANLINE * _CYCLES_PER_US) - 1) +#define _PAL_CYCLES_OUTPUT_START ((_PAL_TIME_OUTPUT_START * _CYCLES_PER_US) - 1) + +#endif \ No newline at end of file diff --git a/demontsc/lib/TVout/version history.txt b/demontsc/lib/TVout/version history.txt new file mode 100755 index 0000000..c45fb53 --- /dev/null +++ b/demontsc/lib/TVout/version history.txt @@ -0,0 +1,94 @@ +Beta1.0 (Dec 2nd 2010) + -Revamped font engine to use less flash memory. select_font() must be called see wiki for details. + -Full print system for all data types, no more print_str instead use print(). + -rewrote draw_circle faster uses different arguments. + -removed draw_box replaced with draw_rect faster easier. + -added draw_row very fast horizontal line drawing. + -added draw_column very fast column drawing. + -added force functions for startline outputdelay and vertical scale. + -remove fs_bitmap and replaced with general bitmap function. + -added shift function to move screen in any direction. + -delay now takes ms delays, delay_frames still takes frames. + -millis replacement returns ms since begin was called. + -added 4 and 3 cycle render routines for horizontal resolutions of up to 256. + -added vertical and horizontal blanking hook functions for automatic polling. + -added end function to clean up system. + -started lowering memory footprint + +R6 (June 2010) (Currently Beta at 5.9): + -transitioned API to a more be more "arduino like", macros were included + maintain compatibility, with the exception of the start_render(mode,x,y) which + has no such compatibility layer. + -created a fill method that will either fill the screen with white or black or + invert the screen. clear_screen() and invert() are now macro calls of fill() + -switched to an 8x8 font because of the simplicity and speed of rendering by the + byte, all character printing is now restricted x's that are multiples of 8 + to reflect this x is now taken as a multiple of 8pixels. + -encapsolated all global variables into structs. one for the video portion and + one for the audio portion. + -the interrupt now uses the timer1 overflow vector. Leaving compare match b for + intitiating the rendering(does not do this yet) + -the line handler portion of line interrupt is now handled by a function pointer + and functions that corrispond to each of the 3 possible line types. + -Switched the actual rendering to an assembly loop that will work for resolutions + all the way up to 192pixels(at 16mhz). This cuts off down the required flash + by 1.5kbytes. + -Moved Hardware specific deffinitions to there on hardware_setup.h file. + -fixed the number of lines in the PAL mode, Thanks Lover on arduino.cc forums. + -Added circle function thank you Andy Crook + -Added box function thank you Andy Crook + +R5 (May 27th 2010): + -Fixed a render bug preventing a full white screen + -Fixed the get_pixel function actually works now + -reverted to original version of the draw_line function works correctly now + -added gijs(arduino.cc forums) invert function inverts the whole screen + -added nootropic(arduino.cc forums) tone generation system + -added a full screen bitmap function, very limited will be expanded upon. + +R4.x (May 19th 2010): + -fixed sanguino support, works properly in R4.6 + +R4 (May 18th 2010): + -Added support for runtime resolution setup. + -start_render(mode,hres,vres) + -cleaned up the rendering code. + -If speed/low memory usage is required it is recommended that R3 is used and the + resolution is changed in the video_properties.h file. + -Added sanguino support, untested. + +R3 (May 9th 2010): + -Added horz_res(), vert_res(), char_line(), get_pixel(x,y) + -horz_res/vert_res gets resolution of screen + -char_line gets the number of characters that will fit on a line + -get_pixel gets the status of x,y returns 1 for white 0 for black. + -rewrote the line render functions + -fixed bugs preventing changes in resolution and pixel scaling + -automatically centers the screen vertically + -added arduino mega support, untested + -Sync pin: pin11 + -Video pin: pin12 + -changing the redering resolution is now supported. + to do so change the virtical and horizontal resolution in video_properties.h + -Note: + (_RESOLUTION_HORIZONTAL/8)*_RESOLUTION_VERTICAL + must be less than the amount of memory the arduino has. + +R2 (May 2nd 2010): + -Added PAL support: + -to render in pal call start_render(_PAL); + -to render in NTSC call start_render(_NTSC); + -centered video better. + -reduced system to useing one interupt, this will allow for adding sound, and or + support for polling the UART/SPI/ect. once per scanline. + -now renders full half frames(262 lines) instead of 255 lines for NTSC + -modified fonts to be less horrid looking. + -slightly faster line rendering. + -Fixed issue with line rendering not working on last horizonal pixel + -added support for pausing video; output still issues h sync + -pause: pause_render(); + -resume: resume_render(); + -This does cause a Vsync glitch for the first frame, recovers after + soon. +R1 (April 30th 2010): + Initial release. diff --git a/demontsc/lib/TVout/video_gen.cpp b/demontsc/lib/TVout/video_gen.cpp new file mode 100755 index 0000000..8e21b09 --- /dev/null +++ b/demontsc/lib/TVout/video_gen.cpp @@ -0,0 +1,470 @@ +/* + Copyright (c) 2010 Myles Metzer + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include +#include + +#include "video_gen.h" +#include "spec/video_properties.h" +#include "spec/asm_macros.h" +#include "spec/hardware_setup.h" + +//#define REMOVE6C +//#define REMOVE5C +//#define REMOVE4C +//#define REMOVE3C + +int renderLine; +TVout_vid display; +void (*render_line)(); //remove me +void (*line_handler)(); //remove me +void (*hbi_hook)() = ∅ +void (*vbi_hook)() = ∅ + +// sound properties +volatile long remainingToneVsyncs; + +void empty() {} + +void render_setup(uint8_t mode, uint8_t x, uint8_t y, uint8_t *scrnptr) { + + display.screen = scrnptr; + display.hres = x; + display.vres = y; + display.frames = 0; + + if (mode) + display.vscale_const = _PAL_LINE_DISPLAY/display.vres - 1; + else + display.vscale_const = _NTSC_LINE_DISPLAY/display.vres - 1; + display.vscale = display.vscale_const; + + //selects the widest render method that fits in 46us + //as of 9/16/10 rendermode 3 will not work for resolutions lower than + //192(display.hres lower than 24) + unsigned char rmethod = (_TIME_ACTIVE*_CYCLES_PER_US)/(display.hres*8); + switch(rmethod) { + case 6: + render_line = &render_line6c; + break; + case 5: + render_line = &render_line5c; + break; + case 4: + render_line = &render_line4c; + break; + case 3: + render_line = &render_line3c; + break; + default: + if (rmethod > 6) + render_line = &render_line6c; + else + render_line = &render_line3c; + } + + + DDR_VID |= _BV(VID_PIN); + DDR_SYNC |= _BV(SYNC_PIN); + PORT_VID &= ~_BV(VID_PIN); + PORT_SYNC |= _BV(SYNC_PIN); + DDR_SND |= _BV(SND_PIN); // for tone generation. + + // inverted fast pwm mode on timer 1 + TCCR1A = _BV(COM1A1) | _BV(COM1A0) | _BV(WGM11); + TCCR1B = _BV(WGM13) | _BV(WGM12) | _BV(CS10); + + if (mode) { + display.start_render = _PAL_LINE_MID - ((display.vres * (display.vscale_const+1))/2); + display.output_delay = _PAL_CYCLES_OUTPUT_START; + display.vsync_end = _PAL_LINE_STOP_VSYNC; + display.lines_frame = _PAL_LINE_FRAME; + ICR1 = _PAL_CYCLES_SCANLINE; + OCR1A = _CYCLES_HORZ_SYNC; + } + else { + display.start_render = _NTSC_LINE_MID - ((display.vres * (display.vscale_const+1))/2) + 8; + display.output_delay = _NTSC_CYCLES_OUTPUT_START; + display.vsync_end = _NTSC_LINE_STOP_VSYNC; + display.lines_frame = _NTSC_LINE_FRAME; + ICR1 = _NTSC_CYCLES_SCANLINE; + OCR1A = _CYCLES_HORZ_SYNC; + } + display.scanLine = display.lines_frame+1; + line_handler = &vsync_line; + TIMSK1 = _BV(TOIE1); + sei(); +} + +// render a line +ISR(TIMER1_OVF_vect) { + hbi_hook(); + line_handler(); +} + +void blank_line() { + + if ( display.scanLine == display.start_render) { + renderLine = 0; + display.vscale = display.vscale_const; + line_handler = &active_line; + } + else if (display.scanLine == display.lines_frame) { + line_handler = &vsync_line; + vbi_hook(); + } + + display.scanLine++; +} + +void active_line() { + wait_until(display.output_delay); + render_line(); + if (!display.vscale) { + display.vscale = display.vscale_const; + renderLine += display.hres; + } + else + display.vscale--; + + if ((display.scanLine + 1) == (int)(display.start_render + (display.vres*(display.vscale_const+1)))) + line_handler = &blank_line; + + display.scanLine++; +} + +void vsync_line() { + if (display.scanLine >= display.lines_frame) { + OCR1A = _CYCLES_VIRT_SYNC; + display.scanLine = 0; + display.frames++; + + if (remainingToneVsyncs != 0) + { + if (remainingToneVsyncs > 0) + { + remainingToneVsyncs--; + } + + } else + { + TCCR2B = 0; //stop the tone + PORTB &= ~(_BV(SND_PIN)); + } + + } + else if (display.scanLine == display.vsync_end) { + OCR1A = _CYCLES_HORZ_SYNC; + line_handler = &blank_line; + } + display.scanLine++; +} + + +static void inline wait_until(uint8_t time) { + __asm__ __volatile__ ( + "subi %[time], 10\n" + "sub %[time], %[tcnt1l]\n\t" + "100:\n\t" + "subi %[time], 3\n\t" + "brcc 100b\n\t" + "subi %[time], 0-3\n\t" + "breq 101f\n\t" + "dec %[time]\n\t" + "breq 102f\n\t" + "rjmp 102f\n" + "101:\n\t" + "nop\n" + "102:\n" + : + : [time] "a" (time), + [tcnt1l] "a" (TCNT1L) + ); +} + +void render_line6c() { + #ifndef REMOVE6C + __asm__ __volatile__ ( + "ADD r26,r28\n\t" + "ADC r27,r29\n\t" + //save PORTB + "svprt %[port]\n\t" + + "rjmp enter6\n" + "loop6:\n\t" + "bst __tmp_reg__,0\n\t" //8 + "o1bs %[port]\n" + "enter6:\n\t" + "LD __tmp_reg__,X+\n\t" //1 + "delay1\n\t" + "bst __tmp_reg__,7\n\t" + "o1bs %[port]\n\t" + "delay3\n\t" //2 + "bst __tmp_reg__,6\n\t" + "o1bs %[port]\n\t" + "delay3\n\t" //3 + "bst __tmp_reg__,5\n\t" + "o1bs %[port]\n\t" + "delay3\n\t" //4 + "bst __tmp_reg__,4\n\t" + "o1bs %[port]\n\t" + "delay3\n\t" //5 + "bst __tmp_reg__,3\n\t" + "o1bs %[port]\n\t" + "delay3\n\t" //6 + "bst __tmp_reg__,2\n\t" + "o1bs %[port]\n\t" + "delay3\n\t" //7 + "bst __tmp_reg__,1\n\t" + "o1bs %[port]\n\t" + "dec %[hres]\n\t" + "brne loop6\n\t" //go too loopsix + "delay2\n\t" + "bst __tmp_reg__,0\n\t" //8 + "o1bs %[port]\n" + + "svprt %[port]\n\t" + BST_HWS + "o1bs %[port]\n\t" + : + : [port] "i" (_SFR_IO_ADDR(PORT_VID)), + "x" (display.screen), + "y" (renderLine), + [hres] "d" (display.hres) + : "r16" // try to remove this clobber later... + ); + #endif +} + +void render_line5c() { + #ifndef REMOVE5C + __asm__ __volatile__ ( + "ADD r26,r28\n\t" + "ADC r27,r29\n\t" + //save PORTB + "svprt %[port]\n\t" + + "rjmp enter5\n" + "loop5:\n\t" + "bst __tmp_reg__,0\n\t" //8 + "o1bs %[port]\n" + "enter5:\n\t" + "LD __tmp_reg__,X+\n\t" //1 + "bst __tmp_reg__,7\n\t" + "o1bs %[port]\n\t" + "delay2\n\t" //2 + "bst __tmp_reg__,6\n\t" + "o1bs %[port]\n\t" + "delay2\n\t" //3 + "bst __tmp_reg__,5\n\t" + "o1bs %[port]\n\t" + "delay2\n\t" //4 + "bst __tmp_reg__,4\n\t" + "o1bs %[port]\n\t" + "delay2\n\t" //5 + "bst __tmp_reg__,3\n\t" + "o1bs %[port]\n\t" + "delay2\n\t" //6 + "bst __tmp_reg__,2\n\t" + "o1bs %[port]\n\t" + "delay1\n\t" //7 + "dec %[hres]\n\t" + "bst __tmp_reg__,1\n\t" + "o1bs %[port]\n\t" + "brne loop5\n\t" //go too loop5 + "delay1\n\t" + "bst __tmp_reg__,0\n\t" //8 + "o1bs %[port]\n" + + "svprt %[port]\n\t" + BST_HWS + "o1bs %[port]\n\t" + : + : [port] "i" (_SFR_IO_ADDR(PORT_VID)), + "x" (display.screen), + "y" (renderLine), + [hres] "d" (display.hres) + : "r16" // try to remove this clobber later... + ); + #endif +} + +void render_line4c() { + #ifndef REMOVE4C + __asm__ __volatile__ ( + "ADD r26,r28\n\t" + "ADC r27,r29\n\t" + + "rjmp enter4\n" + "loop4:\n\t" + "lsl __tmp_reg__\n\t" //8 + "out %[port],__tmp_reg__\n\t" + "enter4:\n\t" + "LD __tmp_reg__,X+\n\t" //1 + "delay1\n\t" + "out %[port],__tmp_reg__\n\t" + "delay2\n\t" //2 + "lsl __tmp_reg__\n\t" + "out %[port],__tmp_reg__\n\t" + "delay2\n\t" //3 + "lsl __tmp_reg__\n\t" + "out %[port],__tmp_reg__\n\t" + "delay2\n\t" //4 + "lsl __tmp_reg__\n\t" + "out %[port],__tmp_reg__\n\t" + "delay2\n\t" //5 + "lsl __tmp_reg__\n\t" + "out %[port],__tmp_reg__\n\t" + "delay2\n\t" //6 + "lsl __tmp_reg__\n\t" + "out %[port],__tmp_reg__\n\t" + "delay1\n\t" //7 + "lsl __tmp_reg__\n\t" + "dec %[hres]\n\t" + "out %[port],__tmp_reg__\n\t" + "brne loop4\n\t" //go too loop4 + "delay1\n\t" //8 + "lsl __tmp_reg__\n\t" + "out %[port],__tmp_reg__\n\t" + "delay3\n\t" + "cbi %[port],7\n\t" + : + : [port] "i" (_SFR_IO_ADDR(PORT_VID)), + "x" (display.screen), + "y" (renderLine), + [hres] "d" (display.hres) + : "r16" // try to remove this clobber later... + ); + #endif +} + +// only 16mhz right now!!! +void render_line3c() { + #ifndef REMOVE3C + __asm__ __volatile__ ( + ".macro byteshift\n\t" + "LD __tmp_reg__,X+\n\t" + "out %[port],__tmp_reg__\n\t" //0 + "nop\n\t" + "lsl __tmp_reg__\n\t" + "out %[port],__tmp_reg__\n\t" //1 + "nop\n\t" + "lsl __tmp_reg__\n\t" + "out %[port],__tmp_reg__\n\t" //2 + "nop\n\t" + "lsl __tmp_reg__\n\t" + "out %[port],__tmp_reg__\n\t" //3 + "nop\n\t" + "lsl __tmp_reg__\n\t" + "out %[port],__tmp_reg__\n\t" //4 + "nop\n\t" + "lsl __tmp_reg__\n\t" + "out %[port],__tmp_reg__\n\t" //5 + "nop\n\t" + "lsl __tmp_reg__\n\t" + "out %[port],__tmp_reg__\n\t" //6 + "nop\n\t" + "lsl __tmp_reg__\n\t" + "out %[port],__tmp_reg__\n\t" //7 + ".endm\n\t" + + "ADD r26,r28\n\t" + "ADC r27,r29\n\t" + + "cpi %[hres],30\n\t" //615 + "breq skip0\n\t" + "cpi %[hres],29\n\t" + "breq jumpto1\n\t" + "cpi %[hres],28\n\t" + "breq jumpto2\n\t" + "cpi %[hres],27\n\t" + "breq jumpto3\n\t" + "cpi %[hres],26\n\t" + "breq jumpto4\n\t" + "cpi %[hres],25\n\t" + "breq jumpto5\n\t" + "cpi %[hres],24\n\t" + "breq jumpto6\n\t" + "jumpto1:\n\t" + "rjmp skip1\n\t" + "jumpto2:\n\t" + "rjmp skip2\n\t" + "jumpto3:\n\t" + "rjmp skip3\n\t" + "jumpto4:\n\t" + "rjmp skip4\n\t" + "jumpto5:\n\t" + "rjmp skip5\n\t" + "jumpto6:\n\t" + "rjmp skip6\n\t" + "skip0:\n\t" + "byteshift\n\t" //1 \\643 + "skip1:\n\t" + "byteshift\n\t" //2 + "skip2:\n\t" + "byteshift\n\t" //3 + "skip3:\n\t" + "byteshift\n\t" //4 + "skip4:\n\t" + "byteshift\n\t" //5 + "skip5:\n\t" + "byteshift\n\t" //6 + "skip6:\n\t" + "byteshift\n\t" //7 + "byteshift\n\t" //8 + "byteshift\n\t" //9 + "byteshift\n\t" //10 + "byteshift\n\t" //11 + "byteshift\n\t" //12 + "byteshift\n\t" //13 + "byteshift\n\t" //14 + "byteshift\n\t" //15 + "byteshift\n\t" //16 + "byteshift\n\t" //17 + "byteshift\n\t" //18 + "byteshift\n\t" //19 + "byteshift\n\t" //20 + "byteshift\n\t" //21 + "byteshift\n\t" //22 + "byteshift\n\t" //23 + "byteshift\n\t" //24 + "byteshift\n\t" //25 + "byteshift\n\t" //26 + "byteshift\n\t" //27 + "byteshift\n\t" //28 + "byteshift\n\t" //29 + "byteshift\n\t" //30 + + "delay2\n\t" + "cbi %[port],7\n\t" + : + : [port] "i" (_SFR_IO_ADDR(PORT_VID)), + "x" (display.screen), + "y" (renderLine), + [hres] "d" (display.hres) + : "r16" // try to remove this clobber later... + ); + #endif +} diff --git a/demontsc/lib/TVout/video_gen.h b/demontsc/lib/TVout/video_gen.h new file mode 100755 index 0000000..f66d564 --- /dev/null +++ b/demontsc/lib/TVout/video_gen.h @@ -0,0 +1,64 @@ +/* + Copyright (c) 2010 Myles Metzer + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef VIDEO_GEN_H +#define VIDEO_GEN_H + +typedef struct { + volatile int scanLine; + volatile unsigned long frames; + unsigned char start_render; + int lines_frame; //remove me + uint8_t vres; + uint8_t hres; + uint8_t output_delay; //remove me + char vscale_const; //combine me with status switch + char vscale; //combine me too. + char vsync_end; //remove me + uint8_t * screen; +} TVout_vid; + +extern TVout_vid display; + +extern void (*hbi_hook)(); +extern void (*vbi_hook)(); + +void render_setup(uint8_t mode, uint8_t x, uint8_t y, uint8_t *scrnptr); + +void blank_line(); +void active_line(); +void vsync_line(); +void empty(); + +//tone generation properties +extern volatile long remainingToneVsyncs; + +// 6cycles functions +void render_line6c(); +void render_line5c(); +void render_line4c(); +void render_line3c(); +static void inline wait_until(uint8_t time); +#endif diff --git a/demontsc/lib/TVoutfonts/font4x6.cpp b/demontsc/lib/TVoutfonts/font4x6.cpp new file mode 100755 index 0000000..6a3fa4f --- /dev/null +++ b/demontsc/lib/TVoutfonts/font4x6.cpp @@ -0,0 +1,671 @@ +#include "font4x6.h" + +PROGMEM const unsigned char font4x6[] = { +4,6,32, +//space +0b00000000, +0b00000000, +0b00000000, +0b00000000, +0b00000000, +0b00000000, +//! +0b01000000, +0b01000000, +0b01000000, +0b00000000, +0b01000000, +0b00000000, +//" +0b10100000, +0b10100000, +0b00000000, +0b00000000, +0b00000000, +0b00000000, +//# +0b10100000, +0b11100000, +0b10100000, +0b11100000, +0b10100000, +0b00000000, +//$ +0b01000000, +0b01100000, +0b11000000, +0b01100000, +0b11000000, +0b00000000, +//% +0b10100000, +0b00100000, +0b01000000, +0b10000000, +0b10100000, +0b00000000, +//& +0b00100000, +0b01000000, +0b11000000, +0b10100000, +0b11100000, +0b00000000, +//' +0b10000000, +0b10000000, +0b00000000, +0b00000000, +0b00000000, +0b00000000, +//( +0b01000000, +0b10000000, +0b10000000, +0b10000000, +0b01000000, +0b00000000, +//) +0b10000000, +0b01000000, +0b01000000, +0b01000000, +0b10000000, +0b00000000, +//* +0b01000000, +0b10100000, +0b01000000, +0b00000000, +0b00000000, +0b00000000, +//+ +0b00000000, +0b01000000, +0b11100000, +0b01000000, +0b00000000, +0b00000000, +//, +0b00000000, +0b00000000, +0b00000000, +0b10000000, +0b10000000, +0b00000000, +//- +0b00000000, +0b00000000, +0b11100000, +0b00000000, +0b00000000, +0b00000000, +//. +0b00000000, +0b00000000, +0b00000000, +0b00000000, +0b10000000, +0b00000000, +// / +0b00100000, +0b00100000, +0b01000000, +0b10000000, +0b10000000, +0b00000000, +//0 +0b11100000, +0b10100000, +0b10100000, +0b10100000, +0b11100000, +0b00000000, +//1 +0b01000000, +0b11000000, +0b01000000, +0b01000000, +0b11100000, +0b00000000, +//2 +0b11100000, +0b00100000, +0b11100000, +0b10000000, +0b11100000, +0b00000000, +//3 +0b11100000, +0b00100000, +0b11100000, +0b00100000, +0b11100000, +0b00000000, +//4 +0b10100000, +0b10100000, +0b11100000, +0b00100000, +0b00100000, +0b00000000, +//5 +0b11100000, +0b10000000, +0b11100000, +0b00100000, +0b11000000, +0b00000000, +//6 +0b11000000, +0b10000000, +0b11100000, +0b10100000, +0b11100000, +0b00000000, +//7 +0b11100000, +0b00100000, +0b01000000, +0b10000000, +0b10000000, +0b00000000, +//8 +0b11100000, +0b10100000, +0b11100000, +0b10100000, +0b11100000, +0b00000000, +//9 +0b11100000, +0b10100000, +0b11100000, +0b00100000, +0b01100000, +0b00000000, +//: +0b00000000, +0b01000000, +0b00000000, +0b01000000, +0b00000000, +0b00000000, +//; +0b00000000, +0b01000000, +0b00000000, +0b01000000, +0b10000000, +0b00000000, +//< +0b00100000, +0b01000000, +0b10000000, +0b01000000, +0b00100000, +0b00000000, +//= +0b00000000, +0b11100000, +0b00000000, +0b11100000, +0b00000000, +0b00000000, +//> +0b10000000, +0b01000000, +0b00100000, +0b01000000, +0b10000000, +0b00000000, +//? +0b11000000, +0b00100000, +0b01000000, +0b00000000, +0b01000000, +0b00000000, +//@ +0b11100000, +0b10100000, +0b10100000, +0b11100000, +0b11100000, +0b00000000, +//A +0b11100000, +0b10100000, +0b11100000, +0b10100000, +0b10100000, +0b00000000, +//B +0b11000000, +0b10100000, +0b11100000, +0b10100000, +0b11000000, +0b00000000, +//C +0b11100000, +0b10000000, +0b10000000, +0b10000000, +0b11100000, +0b00000000, +//D +0b11000000, +0b10100000, +0b10100000, +0b10100000, +0b11000000, +0b00000000, +//E +0b11100000, +0b10000000, +0b11100000, +0b10000000, +0b11100000, +0b00000000, +//F +0b11100000, +0b10000000, +0b11100000, +0b10000000, +0b10000000, +0b00000000, +//G +0b11100000, +0b10000000, +0b10000000, +0b10100000, +0b11100000, +0b00000000, +//H +0b10100000, +0b10100000, +0b11100000, +0b10100000, +0b10100000, +0b00000000, +//I +0b11100000, +0b01000000, +0b01000000, +0b01000000, +0b11100000, +0b00000000, +//J +0b00100000, +0b00100000, +0b00100000, +0b10100000, +0b11100000, +0b00000000, +//K +0b10000000, +0b10100000, +0b11000000, +0b11000000, +0b10100000, +0b00000000, +//L +0b10000000, +0b10000000, +0b10000000, +0b10000000, +0b11100000, +0b00000000, +//M +0b10100000, +0b11100000, +0b11100000, +0b10100000, +0b10100000, +0b00000000, +//N +0b11000000, +0b10100000, +0b10100000, +0b10100000, +0b10100000, +0b00000000, +//O +0b01000000, +0b10100000, +0b10100000, +0b10100000, +0b01000000, +0b00000000, +//P +0b11100000, +0b10100000, +0b11100000, +0b10000000, +0b10000000, +0b00000000, +//Q +0b01000000, +0b10100000, +0b10100000, +0b11100000, +0b01100110, +0b00000000, +//R +0b11100000, +0b10100000, +0b11000000, +0b11100000, +0b10101010, +0b00000000, +//S +0b11100000, +0b10000000, +0b11100000, +0b00100000, +0b11100000, +0b00000000, +//T +0b11100000, +0b01000000, +0b01000000, +0b01000000, +0b01000000, +0b00000000, +//U +0b10100000, +0b10100000, +0b10100000, +0b10100000, +0b11100000, +0b00000000, +//V +0b10100000, +0b10100000, +0b10100000, +0b10100000, +0b01000000, +0b00000000, +//W +0b10100000, +0b10100000, +0b11100000, +0b11100000, +0b10100010, +0b00000000, +//X +0b10100000, +0b10100000, +0b01000000, +0b10100000, +0b10100000, +0b00000000, +//Y +0b10100000, +0b10100000, +0b01000000, +0b01000000, +0b01000000, +0b00000000, +//Z +0b11100000, +0b00100000, +0b01000000, +0b10000000, +0b11100000, +0b00000000, +//[ +0b11000000, +0b10000000, +0b10000000, +0b10000000, +0b11000000, +0b00000000, +0, //for the life of me I have no idea why this is needed.... +//\ +0b10000000, +0b10000000, +0b01000000, +0b00100000, +0b00100000, +0b00000000, +//] +0b11000000, +0b01000000, +0b01000000, +0b01000000, +0b11000000, +0b00000000, +//^ +0b01000000, +0b10100000, +0b00000000, +0b00000000, +0b00000000, +0b00000000, +//_ +0b00000000, +0b00000000, +0b00000000, +0b00000000, +0b11100000, +0b00000000, +//` +0b10000000, +0b01000000, +0b00000000, +0b00000000, +0b00000000, +0b00000000, +//a +0b00000000, +0b01100000, +0b10100000, +0b10100000, +0b01100000, +0b00000000, +//b +0b10000000, +0b10000000, +0b11000000, +0b10100000, +0b11000000, +0b00000000, +//c +0b00000000, +0b01100000, +0b10000000, +0b10000000, +0b01100000, +0b00000000, +//d +0b00100000, +0b00100000, +0b01100000, +0b10100000, +0b01100000, +0b00000000, +//e +0b01000000, +0b10100000, +0b11100000, +0b10000000, +0b01100000, +0b00000000, +//f +0b01100000, +0b01000000, +0b11100000, +0b01000000, +0b01000000, +0b00000000, +//g +0b01100000, +0b10100000, +0b01100000, +0b00100000, +0b11000000, +0b00000000, +//h +0b10000000, +0b10000000, +0b11000000, +0b10100000, +0b10100000, +0b00000000, +//i +0b01000000, +0b00000000, +0b01000000, +0b01000000, +0b01000000, +0b00000000, +//j +0b01000000, +0b00000000, +0b01000000, +0b01000000, +0b11000000, +0b00000000, +//k +0b10000000, +0b10000000, +0b10100000, +0b11000000, +0b10100000, +0b00000000, +//l +0b11000000, +0b01000000, +0b01000000, +0b01000000, +0b11100000, +0b00000000, +//m +0b00000000, +0b10100000, +0b11100000, +0b10100000, +0b10100000, +0b00000000, +//n +0b00000000, +0b11000000, +0b10100000, +0b10100000, +0b10100000, +0b00000000, +//o +0b00000000, +0b01000000, +0b10100000, +0b10100000, +0b01000000, +0b00000000, +//p +0b00000000, +0b11000000, +0b10100000, +0b11000000, +0b10000000, +0b00000000, +//q +0b00000000, +0b01100000, +0b10100000, +0b01100000, +0b00100000, +0b00000000, +//r +0b00000000, +0b11000000, +0b10100000, +0b10000000, +0b10000000, +0b00000000, +//s +0b00000000, +0b01100000, +0b01000000, +0b00100000, +0b01100000, +0b00000000, +//t +0b01000000, +0b11100000, +0b01000000, +0b01000000, +0b01000000, +0b00000000, +//u +0b00000000, +0b10100000, +0b10100000, +0b10100000, +0b01100000, +0b00000000, +//v +0b00000000, +0b10100000, +0b10100000, +0b10100000, +0b01000000, +0b00000000, +//w +0b00000000, +0b10100000, +0b10100000, +0b11100000, +0b10100000, +0b00000000, +//x +0b00000000, +0b10100000, +0b01000000, +0b01000000, +0b10100000, +0b00000000, +//y +0b00000000, +0b10100000, +0b11100000, +0b00100000, +0b01000000, +0b00000000, +//x +0b00000000, +0b11100000, +0b01000000, +0b10000000, +0b11100000, +0b00000000, +//{ +0b00100000, +0b01000000, +0b11000000, +0b01000000, +0b00100010, +0b00000000, +//| +0b01000000, +0b01000000, +0b00000000, +0b01000000, +0b01000000, +0b00000000, +//} +0b10000000, +0b01000000, +0b01100000, +0b01000000, +0b10000000, +0b00000000, +//~ +0b00000000, +0b10100000, +0b01000000, +0b00000000, +0b00000000, +0b00000000 +}; \ No newline at end of file diff --git a/demontsc/lib/TVoutfonts/font4x6.h b/demontsc/lib/TVoutfonts/font4x6.h new file mode 100755 index 0000000..be45e53 --- /dev/null +++ b/demontsc/lib/TVoutfonts/font4x6.h @@ -0,0 +1,7 @@ +#ifndef FONT4X6_h +#define FONT4X6_h +#include + +extern const unsigned char font4x6[]; + +#endif \ No newline at end of file diff --git a/demontsc/lib/TVoutfonts/font6x8.cpp b/demontsc/lib/TVoutfonts/font6x8.cpp new file mode 100755 index 0000000..f8736af --- /dev/null +++ b/demontsc/lib/TVoutfonts/font6x8.cpp @@ -0,0 +1,870 @@ +#include "font6x8.h" + +PROGMEM const unsigned char font6x8[] = { + + 6,8,32, + //32 Space + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + //33 Exclamation ! + 0b01000000, + 0b01000000, + 0b01000000, + 0b01000000, + 0b01000000, + 0b00000000, + 0b01000000, + 0b00000000, + //34 Quotes " + 0b01010000, + 0b01010000, + 0b01010000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + //35 Number # + 0b00000000, + 0b00000000, + 0b01010000, + 0b11111000, + 0b01010000, + 0b11111000, + 0b01010000, + 0b00000000, + //36 Dollars $ + 0b00100000, + 0b01110000, + 0b10100000, + 0b01110000, + 0b00101000, + 0b01110000, + 0b00100000, + 0b00000000, + //37 Percent % + 0b00000000, + 0b11001000, + 0b11010000, + 0b00100000, + 0b01011000, + 0b10011000, + 0b00000000, + 0b00000000, + //38 Ampersand & + 0b00100000, + 0b01010000, + 0b10000000, + 0b01000000, + 0b10101000, + 0b10010000, + 0b01101000, + 0b00000000, + //39 Single Quote ' + 0b01000000, + 0b01000000, + 0b01000000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + //40 Left Parenthesis ( + 0b00010000, + 0b00100000, + 0b01000000, + 0b01000000, + 0b01000000, + 0b00100000, + 0b00010000, + 0b00000000, + //41 Right Parenthesis ) + 0b01000000, + 0b00100000, + 0b00010000, + 0b00010000, + 0b00010000, + 0b00100000, + 0b01000000, + 0b00000000, + //42 Star * + 0b00010000, + 0b00111000, + 0b00010000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + //43 Plus + + 0b00000000, + 0b00100000, + 0b00100000, + 0b11111000, + 0b00100000, + 0b00100000, + 0b00000000, + 0b00000000, + //44 Comma , + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00010000, + 0b00010000, + 0b00000000, + //45 Minus - + 0b00000000, + 0b00000000, + 0b00000000, + 0b11111000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + //46 Period . + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00010000, + 0b00000000, + 0b00000000, + // 47 Backslash / + 0b00000000, + 0b00001000, + 0b00010000, + 0b00100000, + 0b01000000, + 0b10000000, + 0b00000000, + 0b00000000, + // 48 Zero + 0b01110000, + 0b10001000, + 0b10101000, + 0b10101000, + 0b10001000, + 0b01110000, + 0b00000000, + 0b00000000, + //49 One + 0b00100000, + 0b01100000, + 0b00100000, + 0b00100000, + 0b00100000, + 0b01110000, + 0b00000000, + 0b00000000, + //50 two + 0b01110000, + 0b10001000, + 0b00010000, + 0b00100000, + 0b01000000, + 0b11111000, + 0b00000000, + 0b00000000, + //51 Three + 0b11111000, + 0b00010000, + 0b00100000, + 0b00010000, + 0b10001000, + 0b01110000, + 0b00000000, + 0b00000000, + //52 Four + 0b10010000, + 0b10010000, + 0b10010000, + 0b11111000, + 0b00010000, + 0b00010000, + 0b00000000, + 0b00000000, + //53 Five + 0b11111000, + 0b10000000, + 0b11110000, + 0b00001000, + 0b10001000, + 0b01110000, + 0b00000000, + 0b00000000, + //54 Six + 0b01110000, + 0b10000000, + 0b11110000, + 0b10001000, + 0b10001000, + 0b01110000, + 0b00000000, + 0b00000000, + //55 Seven + 0b11111000, + 0b00001000, + 0b00010000, + 0b00100000, + 0b01000000, + 0b10000000, + 0b00000000, + 0b00000000, + //56 Eight + 0b01110000, + 0b10001000, + 0b01110000, + 0b10001000, + 0b10001000, + 0b01110000, + 0b00000000, + 0b00000000, + //57 Nine + 0b01110000, + 0b10001000, + 0b10001000, + 0b01111000, + 0b00001000, + 0b01110000, + 0b00000000, + 0b00000000, + //58 : + 0b00000000, + 0b00000000, + 0b00100000, + 0b00000000, + 0b00000000, + 0b00100000, + 0b00000000, + 0b00000000, + //59 ; + 0b00000000, + 0b00000000, + 0b00100000, + 0b00000000, + 0b00100000, + 0b00100000, + 0b01000000, + 0b00000000, + //60 < + 0b00000000, + 0b00011000, + 0b01100000, + 0b10000000, + 0b01100000, + 0b00011000, + 0b00000000, + 0b00000000, + //61 = + 0b00000000, + 0b00000000, + 0b01111000, + 0b00000000, + 0b01111000, + 0b00000000, + 0b00000000, + 0b00000000, + //62 > + 0b00000000, + 0b11000000, + 0b00110000, + 0b00001000, + 0b00110000, + 0b11000000, + 0b00000000, + 0b00000000, + //63 ? + 0b01100000, + 0b10010000, + 0b00100000, + 0b00100000, + 0b00000000, + 0b00100000, + 0b00000000, + 0b00000000, + //64 @ + 0b01110000, + 0b10001000, + 0b10011000, + 0b10101000, + 0b10010000, + 0b10001000, + 0b01110000, + 0b00000000, + //65 A + 0b00100000, + 0b01010000, + 0b10001000, + 0b11111000, + 0b10001000, + 0b10001000, + 0b00000000, + 0b00000000, + //B + 0b11110000, + 0b10001000, + 0b11110000, + 0b10001000, + 0b10001000, + 0b11110000, + 0b00000000, + 0b00000000, + //C + 0b01110000, + 0b10001000, + 0b10000000, + 0b10000000, + 0b10001000, + 0b01110000, + 0b00000000, + 0b00000000, + //D + 0b11110000, + 0b10001000, + 0b10001000, + 0b10001000, + 0b10001000, + 0b11110000, + 0b00000000, + 0b00000000, + //E + 0b11111000, + 0b10000000, + 0b11111000, + 0b10000000, + 0b10000000, + 0b11111000, + 0b00000000, + 0b00000000, + //F + 0b11111000, + 0b10000000, + 0b11110000, + 0b10000000, + 0b10000000, + 0b10000000, + 0b00000000, + 0b00000000, + //G + 0b01110000, + 0b10001000, + 0b10000000, + 0b10011000, + 0b10001000, + 0b01110000, + 0b00000000, + 0b00000000, + //H + 0b10001000, + 0b10001000, + 0b11111000, + 0b10001000, + 0b10001000, + 0b10001000, + 0b00000000, + 0b00000000, + //I + 0b01110000, + 0b00100000, + 0b00100000, + 0b00100000, + 0b00100000, + 0b01110000, + 0b00000000, + 0b00000000, + //J + 0b00111000, + 0b00010000, + 0b00010000, + 0b00010000, + 0b10010000, + 0b01100000, + 0b00000000, + 0b00000000, + //K + 0b10001000, + 0b10010000, + 0b11100000, + 0b10100000, + 0b10010000, + 0b10001000, + 0b00000000, + 0b00000000, + //L + 0b10000000, + 0b10000000, + 0b10000000, + 0b10000000, + 0b10000000, + 0b11111000, + 0b00000000, + 0b00000000, + //M + 0b10001000, + 0b11011000, + 0b10101000, + 0b10101000, + 0b10001000, + 0b10001000, + 0b00000000, + 0b00000000, + //N + 0b10001000, + 0b10001000, + 0b11001000, + 0b10101000, + 0b10011000, + 0b10001000, + 0b00000000, + 0b00000000, + //O + 0b01110000, + 0b10001000, + 0b10001000, + 0b10001000, + 0b10001000, + 0b01110000, + 0b00000000, + 0b00000000, + //P + 0b11110000, + 0b10001000, + 0b11110000, + 0b10000000, + 0b10000000, + 0b10000000, + 0b00000000, + 0b00000000, + //Q + 0b01110000, + 0b10001000, + 0b10001000, + 0b10101000, + 0b10010000, + 0b01101000, + 0b00000000, + 0b00000000, + //R + 0b11110000, + 0b10001000, + 0b11110000, + 0b10100000, + 0b10010000, + 0b10001000, + 0b00000000, + 0b00000000, + //S + 0b01111000, + 0b10000000, + 0b01110000, + 0b00001000, + 0b00001000, + 0b11110000, + 0b00000000, + 0b00000000, + //T + 0b11111000, + 0b00100000, + 0b00100000, + 0b00100000, + 0b00100000, + 0b00100000, + 0b00000000, + 0b00000000, + //U + 0b10001000, + 0b10001000, + 0b10001000, + 0b10001000, + 0b10001000, + 0b01110000, + 0b00000000, + 0b00000000, + //V + 0b10001000, + 0b10001000, + 0b10001000, + 0b10001000, + 0b01010000, + 0b00100000, + 0b00000000, + 0b00000000, + //W + 0b10001000, + 0b10001000, + 0b10101000, + 0b10101000, + 0b10101000, + 0b01010000, + 0b00000000, + 0b00000000, + //X + 0b10001000, + 0b01010000, + 0b00100000, + 0b01010000, + 0b10001000, + 0b10001000, + 0b00000000, + 0b00000000, + //Y + 0b10001000, + 0b10001000, + 0b01010000, + 0b00100000, + 0b00100000, + 0b00100000, + 0b00000000, + 0b00000000, + //Z + 0b11111000, + 0b00001000, + 0b00010000, + 0b00100000, + 0b01000000, + 0b11111000, + 0b00000000, + 0b00000000, + //91 [ + 0b11100000, + 0b10000000, + 0b10000000, + 0b10000000, + 0b10000000, + 0b11100000, + 0b00000000, + 0b00000000, + //92 (backslash) + 0b00000000, + 0b10000000, + 0b01000000, + 0b00100000, + 0b00010000, + 0b00001000, + 0b00000000, + 0b00000000, + //93 ] + 0b00111000, + 0b00001000, + 0b00001000, + 0b00001000, + 0b00001000, + 0b00111000, + 0b00000000, + 0b00000000, + //94 ^ + 0b00100000, + 0b01010000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + //95 _ + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b11111000, + 0b00000000, + //96 ` + 0b10000000, + 0b01000000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + //97 a + 0b00000000, + 0b01100000, + 0b00010000, + 0b01110000, + 0b10010000, + 0b01100000, + 0b00000000, + 0b00000000, + //98 b + 0b10000000, + 0b10000000, + 0b11100000, + 0b10010000, + 0b10010000, + 0b11100000, + 0b00000000, + 0b00000000, + //99 c + 0b00000000, + 0b00000000, + 0b01110000, + 0b10000000, + 0b10000000, + 0b01110000, + 0b00000000, + 0b00000000, + // 100 d + 0b00010000, + 0b00010000, + 0b01110000, + 0b10010000, + 0b10010000, + 0b01110000, + 0b00000000, + 0b00000000, + //101 e + 0b00000000, + 0b01100000, + 0b10010000, + 0b11110000, + 0b10000000, + 0b01110000, + 0b00000000, + 0b00000000, + //102 f + 0b00110000, + 0b01000000, + 0b11100000, + 0b01000000, + 0b01000000, + 0b01000000, + 0b00000000, + 0b00000000, + //103 g + 0b00000000, + 0b01100000, + 0b10010000, + 0b01110000, + 0b00010000, + 0b00010000, + 0b01100000, + 0b00000000, + //104 h + 0b10000000, + 0b10000000, + 0b11100000, + 0b10010000, + 0b10010000, + 0b10010000, + 0b00000000, + 0b00000000, + //105 i + 0b00100000, + 0b00000000, + 0b00100000, + 0b00100000, + 0b00100000, + 0b01110000, + 0b00000000, + 0b00000000, + //106 j + 0b00010000, + 0b00000000, + 0b00110000, + 0b00010000, + 0b00010000, + 0b00010000, + 0b01100000, + 0b00000000, + //107 k + 0b10000000, + 0b10010000, + 0b10100000, + 0b11000000, + 0b10100000, + 0b10010000, + 0b00000000, + 0b00000000, + //108 l + 0b01100000, + 0b00100000, + 0b00100000, + 0b00100000, + 0b00100000, + 0b01110000, + 0b00000000, + 0b00000000, + //109 m + 0b00000000, + 0b00000000, + 0b01010000, + 0b10101000, + 0b10101000, + 0b10101000, + 0b00000000, + 0b00000000, + //110 n + 0b00000000, + 0b00000000, + 0b11110000, + 0b10001000, + 0b10001000, + 0b10001000, + 0b00000000, + 0b00000000, + //111 o + 0b00000000, + 0b00000000, + 0b01100000, + 0b10010000, + 0b10010000, + 0b01100000, + 0b00000000, + 0b00000000, + //112 p + 0b00000000, + 0b00000000, + 0b01100000, + 0b10010000, + 0b11110000, + 0b10000000, + 0b10000000, + 0b00000000, + //113 q + 0b00000000, + 0b00000000, + 0b01100000, + 0b10010000, + 0b11110000, + 0b00010000, + 0b00010000, + 0b00000000, + //114 r + 0b00000000, + 0b00000000, + 0b10110000, + 0b01001000, + 0b01000000, + 0b01000000, + 0b00000000, + 0b00000000, + //115 s + 0b00000000, + 0b00110000, + 0b01000000, + 0b00100000, + 0b00010000, + 0b01100000, + 0b00000000, + 0b00000000, + //116 t + 0b01000000, + 0b01000000, + 0b11100000, + 0b01000000, + 0b01000000, + 0b01000000, + 0b00000000, + 0b00000000, + // 117u + 0b00000000, + 0b00000000, + 0b10010000, + 0b10010000, + 0b10010000, + 0b01100000, + 0b00000000, + 0b00000000, + //118 v + 0b00000000, + 0b00000000, + 0b10001000, + 0b10001000, + 0b01010000, + 0b00100000, + 0b00000000, + 0b00000000, + //119 w + 0b00000000, + 0b00000000, + 0b10001000, + 0b10101000, + 0b10101000, + 0b01010000, + 0b00000000, + 0b00000000, + //120 x + 0b00000000, + 0b10001000, + 0b01010000, + 0b00100000, + 0b01010000, + 0b10001000, + 0b00000000, + 0b00000000, + //121 y + 0b00000000, + 0b00000000, + 0b10010000, + 0b10010000, + 0b01100000, + 0b01000000, + 0b10000000, + 0b00000000, + //122 z + 0b00000000, + 0b00000000, + 0b11110000, + 0b00100000, + 0b01000000, + 0b11110000, + 0b00000000, + 0b00000000, + //123 { + 0b00100000, + 0b01000000, + 0b01000000, + 0b10000000, + 0b01000000, + 0b01000000, + 0b00100000, + 0b00000000, + //124 | + 0b00100000, + 0b00100000, + 0b00100000, + 0b00100000, + 0b00100000, + 0b00100000, + 0b00100000, + 0b00000000, + //125 } + 0b00100000, + 0b00010000, + 0b00010000, + 0b00001000, + 0b00010000, + 0b00010000, + 0b00100000, + 0b00000000, + //126 ~ + 0b01000000, + 0b10101000, + 0b00010000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + //127 DEL + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000 +}; \ No newline at end of file diff --git a/demontsc/lib/TVoutfonts/font6x8.h b/demontsc/lib/TVoutfonts/font6x8.h new file mode 100755 index 0000000..e5390e8 --- /dev/null +++ b/demontsc/lib/TVoutfonts/font6x8.h @@ -0,0 +1,8 @@ +#ifndef FONT6X8_H +#define FONT6X8_H + +#include + +extern const unsigned char font6x8[]; + +#endif \ No newline at end of file diff --git a/demontsc/lib/TVoutfonts/font8x8.cpp b/demontsc/lib/TVoutfonts/font8x8.cpp new file mode 100755 index 0000000..337da90 --- /dev/null +++ b/demontsc/lib/TVoutfonts/font8x8.cpp @@ -0,0 +1,133 @@ +#include "font8x8.h" + +PROGMEM const unsigned char font8x8[] = { +8,8,0, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x3E, 0x41, 0x55, 0x41, 0x55, 0x49, 0x3E, +0x00, 0x3E, 0x7F, 0x6B, 0x7F, 0x6B, 0x77, 0x3E, +0x00, 0x22, 0x77, 0x7F, 0x7F, 0x3E, 0x1C, 0x08, +0x00, 0x08, 0x1C, 0x3E, 0x7F, 0x3E, 0x1C, 0x08, +0x00, 0x08, 0x1C, 0x2A, 0x7F, 0x2A, 0x08, 0x1C, +0x00, 0x08, 0x1C, 0x3E, 0x7F, 0x3E, 0x08, 0x1C, +0x00, 0x00, 0x1C, 0x3E, 0x3E, 0x3E, 0x1C, 0x00, +0xFF, 0xFF, 0xE3, 0xC1, 0xC1, 0xC1, 0xE3, 0xFF, +0x00, 0x00, 0x1C, 0x22, 0x22, 0x22, 0x1C, 0x00, +0xFF, 0xFF, 0xE3, 0xDD, 0xDD, 0xDD, 0xE3, 0xFF, +0x00, 0x0F, 0x03, 0x05, 0x39, 0x48, 0x48, 0x30, +0x00, 0x08, 0x3E, 0x08, 0x1C, 0x22, 0x22, 0x1C, +0x00, 0x18, 0x14, 0x10, 0x10, 0x30, 0x70, 0x60, +0x00, 0x0F, 0x19, 0x11, 0x13, 0x37, 0x76, 0x60, +0x00, 0x08, 0x2A, 0x1C, 0x77, 0x1C, 0x2A, 0x08, +0x00, 0x60, 0x78, 0x7E, 0x7F, 0x7E, 0x78, 0x60, +0x00, 0x03, 0x0F, 0x3F, 0x7F, 0x3F, 0x0F, 0x03, +0x00, 0x08, 0x1C, 0x2A, 0x08, 0x2A, 0x1C, 0x08, +0x00, 0x66, 0x66, 0x66, 0x66, 0x00, 0x66, 0x66, +0x00, 0x3F, 0x65, 0x65, 0x3D, 0x05, 0x05, 0x05, +0x00, 0x0C, 0x32, 0x48, 0x24, 0x12, 0x4C, 0x30, +0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x7F, 0x7F, +0x00, 0x08, 0x1C, 0x2A, 0x08, 0x2A, 0x1C, 0x3E, +0x00, 0x08, 0x1C, 0x3E, 0x7F, 0x1C, 0x1C, 0x1C, +0x00, 0x1C, 0x1C, 0x1C, 0x7F, 0x3E, 0x1C, 0x08, +0x00, 0x08, 0x0C, 0x7E, 0x7F, 0x7E, 0x0C, 0x08, +0x00, 0x08, 0x18, 0x3F, 0x7F, 0x3F, 0x18, 0x08, +0x00, 0x00, 0x00, 0x70, 0x70, 0x70, 0x7F, 0x7F, +0x00, 0x00, 0x14, 0x22, 0x7F, 0x22, 0x14, 0x00, +0x00, 0x08, 0x1C, 0x1C, 0x3E, 0x3E, 0x7F, 0x7F, +0x00, 0x7F, 0x7F, 0x3E, 0x3E, 0x1C, 0x1C, 0x08, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x18, 0x3C, 0x3C, 0x18, 0x18, 0x00, 0x18, +0x00, 0x36, 0x36, 0x14, 0x00, 0x00, 0x00, 0x00, +0x00, 0x36, 0x36, 0x7F, 0x36, 0x7F, 0x36, 0x36, +0x00, 0x08, 0x1E, 0x20, 0x1C, 0x02, 0x3C, 0x08, +0x00, 0x60, 0x66, 0x0C, 0x18, 0x30, 0x66, 0x06, +0x00, 0x3C, 0x66, 0x3C, 0x28, 0x65, 0x66, 0x3F, +0x00, 0x18, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, +0x00, 0x60, 0x30, 0x18, 0x18, 0x18, 0x30, 0x60, +0x00, 0x06, 0x0C, 0x18, 0x18, 0x18, 0x0C, 0x06, +0x00, 0x00, 0x36, 0x1C, 0x7F, 0x1C, 0x36, 0x00, +0x00, 0x00, 0x08, 0x08, 0x3E, 0x08, 0x08, 0x00, +0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x30, 0x60, +0x00, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, +0x00, 0x00, 0x06, 0x0C, 0x18, 0x30, 0x60, 0x00, +0x00, 0x3C, 0x66, 0x6E, 0x76, 0x66, 0x66, 0x3C, +0x00, 0x18, 0x18, 0x38, 0x18, 0x18, 0x18, 0x7E, +0x00, 0x3C, 0x66, 0x06, 0x0C, 0x30, 0x60, 0x7E, +0x00, 0x3C, 0x66, 0x06, 0x1C, 0x06, 0x66, 0x3C, +0x00, 0x0C, 0x1C, 0x2C, 0x4C, 0x7E, 0x0C, 0x0C, +0x00, 0x7E, 0x60, 0x7C, 0x06, 0x06, 0x66, 0x3C, +0x00, 0x3C, 0x66, 0x60, 0x7C, 0x66, 0x66, 0x3C, +0x00, 0x7E, 0x66, 0x0C, 0x0C, 0x18, 0x18, 0x18, +0x00, 0x3C, 0x66, 0x66, 0x3C, 0x66, 0x66, 0x3C, +0x00, 0x3C, 0x66, 0x66, 0x3E, 0x06, 0x66, 0x3C, +0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00, +0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x30, +0x00, 0x06, 0x0C, 0x18, 0x30, 0x18, 0x0C, 0x06, +0x00, 0x00, 0x00, 0x3C, 0x00, 0x3C, 0x00, 0x00, +0x00, 0x60, 0x30, 0x18, 0x0C, 0x18, 0x30, 0x60, +0x00, 0x3C, 0x66, 0x06, 0x1C, 0x18, 0x00, 0x18, +0x00, 0x38, 0x44, 0x5C, 0x58, 0x42, 0x3C, 0x00, +0x00, 0x3C, 0x66, 0x66, 0x7E, 0x66, 0x66, 0x66, +0x00, 0x7C, 0x66, 0x66, 0x7C, 0x66, 0x66, 0x7C, +0x00, 0x3C, 0x66, 0x60, 0x60, 0x60, 0x66, 0x3C, +0x00, 0x7C, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7C, +0x00, 0x7E, 0x60, 0x60, 0x7C, 0x60, 0x60, 0x7E, +0x00, 0x7E, 0x60, 0x60, 0x7C, 0x60, 0x60, 0x60, +0x00, 0x3C, 0x66, 0x60, 0x60, 0x6E, 0x66, 0x3C, +0x00, 0x66, 0x66, 0x66, 0x7E, 0x66, 0x66, 0x66, +0x00, 0x3C, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3C, +0x00, 0x1E, 0x0C, 0x0C, 0x0C, 0x6C, 0x6C, 0x38, +0x00, 0x66, 0x6C, 0x78, 0x70, 0x78, 0x6C, 0x66, +0x00, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x7E, +0x00, 0x63, 0x77, 0x7F, 0x6B, 0x63, 0x63, 0x63, +0x00, 0x63, 0x73, 0x7B, 0x6F, 0x67, 0x63, 0x63, +0x00, 0x3C, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3C, +0x00, 0x7C, 0x66, 0x66, 0x66, 0x7C, 0x60, 0x60, +0x00, 0x3C, 0x66, 0x66, 0x66, 0x6E, 0x3C, 0x06, +0x00, 0x7C, 0x66, 0x66, 0x7C, 0x78, 0x6C, 0x66, +0x00, 0x3C, 0x66, 0x60, 0x3C, 0x06, 0x66, 0x3C, +0x00, 0x7E, 0x5A, 0x18, 0x18, 0x18, 0x18, 0x18, +0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3E, +0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3C, 0x18, +0x00, 0x63, 0x63, 0x63, 0x6B, 0x7F, 0x77, 0x63, +0x00, 0x63, 0x63, 0x36, 0x1C, 0x36, 0x63, 0x63, +0x00, 0x66, 0x66, 0x66, 0x3C, 0x18, 0x18, 0x18, +0x00, 0x7E, 0x06, 0x0C, 0x18, 0x30, 0x60, 0x7E, +0x00, 0x1E, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1E, +0x00, 0x00, 0x60, 0x30, 0x18, 0x0C, 0x06, 0x00, +0x00, 0x78, 0x18, 0x18, 0x18, 0x18, 0x18, 0x78, +0x00, 0x08, 0x14, 0x22, 0x41, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, +0x00, 0x0C, 0x0C, 0x06, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x3C, 0x06, 0x3E, 0x66, 0x3E, +0x00, 0x60, 0x60, 0x60, 0x7C, 0x66, 0x66, 0x7C, +0x00, 0x00, 0x00, 0x3C, 0x66, 0x60, 0x66, 0x3C, +0x00, 0x06, 0x06, 0x06, 0x3E, 0x66, 0x66, 0x3E, +0x00, 0x00, 0x00, 0x3C, 0x66, 0x7E, 0x60, 0x3C, +0x00, 0x1C, 0x36, 0x30, 0x30, 0x7C, 0x30, 0x30, +0x00, 0x00, 0x3E, 0x66, 0x66, 0x3E, 0x06, 0x3C, +0x00, 0x60, 0x60, 0x60, 0x7C, 0x66, 0x66, 0x66, +0x00, 0x00, 0x18, 0x00, 0x18, 0x18, 0x18, 0x3C, +0x00, 0x0C, 0x00, 0x0C, 0x0C, 0x6C, 0x6C, 0x38, +0x00, 0x60, 0x60, 0x66, 0x6C, 0x78, 0x6C, 0x66, +0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, +0x00, 0x00, 0x00, 0x63, 0x77, 0x7F, 0x6B, 0x6B, +0x00, 0x00, 0x00, 0x7C, 0x7E, 0x66, 0x66, 0x66, +0x00, 0x00, 0x00, 0x3C, 0x66, 0x66, 0x66, 0x3C, +0x00, 0x00, 0x7C, 0x66, 0x66, 0x7C, 0x60, 0x60, +0x00, 0x00, 0x3C, 0x6C, 0x6C, 0x3C, 0x0D, 0x0F, +0x00, 0x00, 0x00, 0x7C, 0x66, 0x66, 0x60, 0x60, +0x00, 0x00, 0x00, 0x3E, 0x40, 0x3C, 0x02, 0x7C, +0x00, 0x00, 0x18, 0x18, 0x7E, 0x18, 0x18, 0x18, +0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3E, +0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x3C, 0x18, +0x00, 0x00, 0x00, 0x63, 0x6B, 0x6B, 0x6B, 0x3E, +0x00, 0x00, 0x00, 0x66, 0x3C, 0x18, 0x3C, 0x66, +0x00, 0x00, 0x00, 0x66, 0x66, 0x3E, 0x06, 0x3C, +0x00, 0x00, 0x00, 0x3C, 0x0C, 0x18, 0x30, 0x3C, +0x00, 0x0E, 0x18, 0x18, 0x30, 0x18, 0x18, 0x0E, +0x00, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, +0x00, 0x70, 0x18, 0x18, 0x0C, 0x18, 0x18, 0x70, +0x00, 0x00, 0x00, 0x3A, 0x6C, 0x00, 0x00, 0x00, +0x00, 0x08, 0x1C, 0x36, 0x63, 0x41, 0x41, 0x7F +}; \ No newline at end of file diff --git a/demontsc/lib/TVoutfonts/font8x8.h b/demontsc/lib/TVoutfonts/font8x8.h new file mode 100755 index 0000000..1d1c88d --- /dev/null +++ b/demontsc/lib/TVoutfonts/font8x8.h @@ -0,0 +1,7 @@ +#ifndef FONT8X8_H +#define FONT8X8_H + +#include +extern const unsigned char font8x8[]; + +#endif \ No newline at end of file diff --git a/demontsc/lib/TVoutfonts/font8x8ext.cpp b/demontsc/lib/TVoutfonts/font8x8ext.cpp new file mode 100755 index 0000000..f3815eb --- /dev/null +++ b/demontsc/lib/TVoutfonts/font8x8ext.cpp @@ -0,0 +1,261 @@ +#include "font8x8ext.h" + +PROGMEM const unsigned char font8x8ext[] = { +8,8,0, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x7E, 0x81, 0xA5, 0x81, 0xBD, 0x99, 0x81, 0x7E, +0x7E, 0xFF, 0xDB, 0xFF, 0xC3, 0xE7, 0xFF, 0x7E, +0x6C, 0xFE, 0xFE, 0xFE, 0x7C, 0x38, 0x10, 0x00, +0x10, 0x38, 0x7C, 0xFE, 0x7C, 0x38, 0x10, 0x00, +0x38, 0x7C, 0x38, 0xFE, 0xFE, 0xD6, 0x10, 0x38, +0x10, 0x38, 0x7C, 0xFE, 0xFE, 0x7C, 0x10, 0x38, +0x00, 0x00, 0x18, 0x3C, 0x3C, 0x18, 0x00, 0x00, +0xFF, 0xFF, 0xE7, 0xC3, 0xC3, 0xE7, 0xFF, 0xFF, +0x00, 0x3C, 0x66, 0x42, 0x42, 0x66, 0x3C, 0x00, +0xFF, 0xC3, 0x99, 0xBD, 0xBD, 0x99, 0xC3, 0xFF, +0x0F, 0x07, 0x0F, 0x7D, 0xCC, 0xCC, 0xCC, 0x78, +0x3C, 0x66, 0x66, 0x66, 0x3C, 0x18, 0x7E, 0x18, +0x3F, 0x33, 0x3F, 0x30, 0x30, 0x70, 0xF0, 0xE0, +0x7F, 0x63, 0x7F, 0x63, 0x63, 0x67, 0xE6, 0xC0, +0x18, 0xDB, 0x3C, 0xE7, 0xE7, 0x3C, 0xDB, 0x18, +0x80, 0xE0, 0xF8, 0xFE, 0xF8, 0xE0, 0x80, 0x00, +0x02, 0x0E, 0x3E, 0xFE, 0x3E, 0x0E, 0x02, 0x00, +0x18, 0x3C, 0x7E, 0x18, 0x18, 0x7E, 0x3C, 0x18, +0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x66, 0x00, +0x7F, 0xDB, 0xDB, 0x7B, 0x1B, 0x1B, 0x1B, 0x00, +0x3E, 0x61, 0x3C, 0x66, 0x66, 0x3C, 0x86, 0x7C, +0x00, 0x00, 0x00, 0x00, 0x7E, 0x7E, 0x7E, 0x00, +0x18, 0x3C, 0x7E, 0x18, 0x7E, 0x3C, 0x18, 0xFF, +0x18, 0x3C, 0x7E, 0x18, 0x18, 0x18, 0x18, 0x00, +0x18, 0x18, 0x18, 0x18, 0x7E, 0x3C, 0x18, 0x00, +0x00, 0x18, 0x0C, 0xFE, 0x0C, 0x18, 0x00, 0x00, +0x00, 0x30, 0x60, 0xFE, 0x60, 0x30, 0x00, 0x00, +0x00, 0x00, 0xC0, 0xC0, 0xC0, 0xFE, 0x00, 0x00, +0x00, 0x24, 0x66, 0xFF, 0x66, 0x24, 0x00, 0x00, +0x00, 0x18, 0x3C, 0x7E, 0xFF, 0xFF, 0x00, 0x00, +0x00, 0xFF, 0xFF, 0x7E, 0x3C, 0x18, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x18, 0x3C, 0x3C, 0x18, 0x18, 0x00, 0x18, 0x00, +0x66, 0x66, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, +0x6C, 0x6C, 0xFE, 0x6C, 0xFE, 0x6C, 0x6C, 0x00, +0x18, 0x3E, 0x60, 0x3C, 0x06, 0x7C, 0x18, 0x00, +0x00, 0xC6, 0xCC, 0x18, 0x30, 0x66, 0xC6, 0x00, +0x38, 0x6C, 0x38, 0x76, 0xDC, 0xCC, 0x76, 0x00, +0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, +0x0C, 0x18, 0x30, 0x30, 0x30, 0x18, 0x0C, 0x00, +0x30, 0x18, 0x0C, 0x0C, 0x0C, 0x18, 0x30, 0x00, +0x00, 0x66, 0x3C, 0xFF, 0x3C, 0x66, 0x00, 0x00, +0x00, 0x18, 0x18, 0x7E, 0x18, 0x18, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x30, +0x00, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, +0x06, 0x0C, 0x18, 0x30, 0x60, 0xC0, 0x80, 0x00, +0x7C, 0xC6, 0xCE, 0xD6, 0xE6, 0xC6, 0x7C, 0x00, +0x18, 0x38, 0x18, 0x18, 0x18, 0x18, 0x7E, 0x00, +0x7C, 0xC6, 0x06, 0x1C, 0x30, 0x66, 0xFE, 0x00, +0x7C, 0xC6, 0x06, 0x3C, 0x06, 0xC6, 0x7C, 0x00, +0x1C, 0x3C, 0x6C, 0xCC, 0xFE, 0x0C, 0x1E, 0x00, +0xFE, 0xC0, 0xC0, 0xFC, 0x06, 0xC6, 0x7C, 0x00, +0x38, 0x60, 0xC0, 0xFC, 0xC6, 0xC6, 0x7C, 0x00, +0xFE, 0xC6, 0x0C, 0x18, 0x30, 0x30, 0x30, 0x00, +0x7C, 0xC6, 0xC6, 0x7C, 0xC6, 0xC6, 0x7C, 0x00, +0x7C, 0xC6, 0xC6, 0x7E, 0x06, 0x0C, 0x78, 0x00, +0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x00, +0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x30, +0x06, 0x0C, 0x18, 0x30, 0x18, 0x0C, 0x06, 0x00, +0x00, 0x00, 0x7E, 0x00, 0x00, 0x7E, 0x00, 0x00, +0x60, 0x30, 0x18, 0x0C, 0x18, 0x30, 0x60, 0x00, +0x7C, 0xC6, 0x0C, 0x18, 0x18, 0x00, 0x18, 0x00, +0x7C, 0xC6, 0xDE, 0xDE, 0xDE, 0xC0, 0x78, 0x00, +0x38, 0x6C, 0xC6, 0xFE, 0xC6, 0xC6, 0xC6, 0x00, +0xFC, 0x66, 0x66, 0x7C, 0x66, 0x66, 0xFC, 0x00, +0x3C, 0x66, 0xC0, 0xC0, 0xC0, 0x66, 0x3C, 0x00, +0xF8, 0x6C, 0x66, 0x66, 0x66, 0x6C, 0xF8, 0x00, +0xFE, 0x62, 0x68, 0x78, 0x68, 0x62, 0xFE, 0x00, +0xFE, 0x62, 0x68, 0x78, 0x68, 0x60, 0xF0, 0x00, +0x3C, 0x66, 0xC0, 0xC0, 0xCE, 0x66, 0x3A, 0x00, +0xC6, 0xC6, 0xC6, 0xFE, 0xC6, 0xC6, 0xC6, 0x00, +0x3C, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00, +0x1E, 0x0C, 0x0C, 0x0C, 0xCC, 0xCC, 0x78, 0x00, +0xE6, 0x66, 0x6C, 0x78, 0x6C, 0x66, 0xE6, 0x00, +0xF0, 0x60, 0x60, 0x60, 0x62, 0x66, 0xFE, 0x00, +0xC6, 0xEE, 0xFE, 0xFE, 0xD6, 0xC6, 0xC6, 0x00, +0xC6, 0xE6, 0xF6, 0xDE, 0xCE, 0xC6, 0xC6, 0x00, +0x7C, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, +0xFC, 0x66, 0x66, 0x7C, 0x60, 0x60, 0xF0, 0x00, +0x7C, 0xC6, 0xC6, 0xC6, 0xC6, 0xCE, 0x7C, 0x0E, +0xFC, 0x66, 0x66, 0x7C, 0x6C, 0x66, 0xE6, 0x00, +0x7C, 0xC6, 0x60, 0x38, 0x0C, 0xC6, 0x7C, 0x00, +0x7E, 0x7E, 0x5A, 0x18, 0x18, 0x18, 0x3C, 0x00, +0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, +0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x6C, 0x38, 0x00, +0xC6, 0xC6, 0xC6, 0xD6, 0xD6, 0xFE, 0x6C, 0x00, +0xC6, 0xC6, 0x6C, 0x38, 0x6C, 0xC6, 0xC6, 0x00, +0x66, 0x66, 0x66, 0x3C, 0x18, 0x18, 0x3C, 0x00, +0xFE, 0xC6, 0x8C, 0x18, 0x32, 0x66, 0xFE, 0x00, +0x3C, 0x30, 0x30, 0x30, 0x30, 0x30, 0x3C, 0x00, +0xC0, 0x60, 0x30, 0x18, 0x0C, 0x06, 0x02, 0x00, +0x3C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x3C, 0x00, +0x10, 0x38, 0x6C, 0xC6, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, +0x30, 0x18, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x78, 0x0C, 0x7C, 0xCC, 0x76, 0x00, +0xE0, 0x60, 0x7C, 0x66, 0x66, 0x66, 0xDC, 0x00, +0x00, 0x00, 0x7C, 0xC6, 0xC0, 0xC6, 0x7C, 0x00, +0x1C, 0x0C, 0x7C, 0xCC, 0xCC, 0xCC, 0x76, 0x00, +0x00, 0x00, 0x7C, 0xC6, 0xFE, 0xC0, 0x7C, 0x00, +0x3C, 0x66, 0x60, 0xF8, 0x60, 0x60, 0xF0, 0x00, +0x00, 0x00, 0x76, 0xCC, 0xCC, 0x7C, 0x0C, 0xF8, +0xE0, 0x60, 0x6C, 0x76, 0x66, 0x66, 0xE6, 0x00, +0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x3C, 0x00, +0x06, 0x00, 0x06, 0x06, 0x06, 0x66, 0x66, 0x3C, +0xE0, 0x60, 0x66, 0x6C, 0x78, 0x6C, 0xE6, 0x00, +0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00, +0x00, 0x00, 0xEC, 0xFE, 0xD6, 0xD6, 0xD6, 0x00, +0x00, 0x00, 0xDC, 0x66, 0x66, 0x66, 0x66, 0x00, +0x00, 0x00, 0x7C, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, +0x00, 0x00, 0xDC, 0x66, 0x66, 0x7C, 0x60, 0xF0, +0x00, 0x00, 0x76, 0xCC, 0xCC, 0x7C, 0x0C, 0x1E, +0x00, 0x00, 0xDC, 0x76, 0x60, 0x60, 0xF0, 0x00, +0x00, 0x00, 0x7E, 0xC0, 0x7C, 0x06, 0xFC, 0x00, +0x30, 0x30, 0xFC, 0x30, 0x30, 0x36, 0x1C, 0x00, +0x00, 0x00, 0xCC, 0xCC, 0xCC, 0xCC, 0x76, 0x00, +0x00, 0x00, 0xC6, 0xC6, 0xC6, 0x6C, 0x38, 0x00, +0x00, 0x00, 0xC6, 0xD6, 0xD6, 0xFE, 0x6C, 0x00, +0x00, 0x00, 0xC6, 0x6C, 0x38, 0x6C, 0xC6, 0x00, +0x00, 0x00, 0xC6, 0xC6, 0xC6, 0x7E, 0x06, 0xFC, +0x00, 0x00, 0x7E, 0x4C, 0x18, 0x32, 0x7E, 0x00, +0x0E, 0x18, 0x18, 0x70, 0x18, 0x18, 0x0E, 0x00, +0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, +0x70, 0x18, 0x18, 0x0E, 0x18, 0x18, 0x70, 0x00, +0x76, 0xDC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x10, 0x38, 0x6C, 0xC6, 0xC6, 0xFE, 0x00, +0x60, 0xF0, 0x60, 0x7C, 0x66, 0x66, 0x66, 0x0C, +0xFC, 0x60, 0x7C, 0x66, 0x66, 0x66, 0x6C, 0x00, +0x1C, 0x10, 0x00, 0x7E, 0x60, 0x60, 0x60, 0x00, +0x38, 0x20, 0xFE, 0xC0, 0xC0, 0xC0, 0xC0, 0x00, +0x6C, 0x00, 0x7C, 0xC6, 0xFE, 0xC0, 0x7C, 0x00, +0x6C, 0xFE, 0x62, 0x78, 0x60, 0x62, 0xFE, 0x00, +0x00, 0x00, 0x7C, 0xC6, 0xF0, 0xC6, 0x7C, 0x00, +0x3C, 0x66, 0xC0, 0xF8, 0xC0, 0x66, 0x3C, 0x00, +0x00, 0x00, 0x7E, 0xC0, 0x7C, 0x06, 0xFC, 0x00, +0x7C, 0xC6, 0x60, 0x38, 0x0C, 0xC6, 0x7C, 0x00, +0x30, 0x00, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00, +0x78, 0x30, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00, +0xCC, 0x00, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00, +0x66, 0x3C, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00, +0x18, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x70, +0x1E, 0x0C, 0x0C, 0x0C, 0x0C, 0xCC, 0x78, 0x00, +0x00, 0x00, 0x70, 0x50, 0x5C, 0x52, 0xDC, 0x00, +0x70, 0x50, 0x5C, 0x52, 0x52, 0x52, 0xDC, 0x00, +0x00, 0x00, 0xA0, 0xA0, 0xFC, 0xA2, 0xBC, 0x00, +0xA0, 0xA0, 0xA0, 0xFC, 0xA2, 0xA2, 0xBC, 0x00, +0x60, 0xF0, 0x60, 0x7C, 0x66, 0x66, 0x66, 0x00, +0xF8, 0x60, 0x7C, 0x66, 0x66, 0x66, 0x66, 0x00, +0x1C, 0x10, 0xC6, 0xD8, 0xF8, 0xCC, 0xC6, 0x00, +0x18, 0xD6, 0xCC, 0xF8, 0xF8, 0xCC, 0xC6, 0x00, +0x6C, 0x38, 0xC6, 0xC6, 0xC6, 0x7E, 0x06, 0x7C, +0x38, 0xC6, 0xC6, 0x7E, 0x06, 0xC6, 0x7C, 0x00, +0x00, 0x00, 0xC6, 0xC6, 0xC6, 0xC6, 0xFE, 0x10, +0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xFE, 0x10, +0x00, 0x00, 0xDC, 0xD6, 0xF6, 0xD6, 0xDC, 0x00, +0xDC, 0xD6, 0xD6, 0xF6, 0xD6, 0xD6, 0xDC, 0x00, +0x00, 0x00, 0xF0, 0xB0, 0x3C, 0x36, 0x3C, 0x00, +0xF0, 0xF0, 0xB0, 0x3C, 0x36, 0x36, 0x3C, 0x00, +0x00, 0x00, 0x78, 0x0C, 0x7C, 0xCC, 0x76, 0x00, +0x3E, 0x66, 0xC6, 0xC6, 0xFE, 0xC6, 0xC6, 0x00, +0x06, 0x7C, 0xC0, 0x7C, 0xC6, 0xC6, 0x7C, 0x00, +0xFE, 0x66, 0x60, 0x7C, 0x66, 0x66, 0xFC, 0x00, +0x00, 0x00, 0xCC, 0xCC, 0xCC, 0xCC, 0xFE, 0x06, +0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xFE, 0x06, +0x00, 0x00, 0x3C, 0x6C, 0x6C, 0x6C, 0xFE, 0xC6, +0x1E, 0x36, 0x66, 0x66, 0x66, 0x66, 0xFF, 0xC3, +0x00, 0x00, 0x7C, 0xC6, 0xFE, 0xC0, 0x7C, 0x00, +0xFE, 0x62, 0x68, 0x78, 0x68, 0x62, 0xFE, 0x00, +0x00, 0x00, 0x7C, 0xD6, 0xD6, 0x7C, 0x10, 0x38, +0x7C, 0xD6, 0xD6, 0xD6, 0x7C, 0x10, 0x38, 0x00, +0x00, 0x00, 0xFE, 0x66, 0x60, 0x60, 0xF0, 0x00, +0xFE, 0x66, 0x60, 0x60, 0x60, 0x60, 0xF0, 0x00, +0x00, 0x33, 0x66, 0xCC, 0x66, 0x33, 0x00, 0x00, +0x00, 0xCC, 0x66, 0x33, 0x66, 0xCC, 0x00, 0x00, +0x22, 0x88, 0x22, 0x88, 0x22, 0x88, 0x22, 0x88, +0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, +0xDB, 0x77, 0xDB, 0xEE, 0xDB, 0x77, 0xDB, 0xEE, +0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, +0x18, 0x18, 0x18, 0x18, 0xF8, 0x18, 0x18, 0x18, +0x00, 0x00, 0xC6, 0x6C, 0x38, 0x6C, 0xC6, 0x00, +0xC6, 0xC6, 0x6C, 0x38, 0x6C, 0xC6, 0xC6, 0x00, +0x00, 0x00, 0xC6, 0xCE, 0xDE, 0xF6, 0xE6, 0x00, +0xC6, 0xC6, 0xCE, 0xDE, 0xF6, 0xE6, 0xC6, 0x00, +0x36, 0x36, 0xF6, 0x06, 0xF6, 0x36, 0x36, 0x36, +0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, +0x00, 0x00, 0xFE, 0x06, 0xF6, 0x36, 0x36, 0x36, +0x36, 0x36, 0xF6, 0x06, 0xFE, 0x00, 0x00, 0x00, +0x00, 0x38, 0xC6, 0xCE, 0xDE, 0xF6, 0xE6, 0x00, +0x38, 0xC6, 0xCE, 0xDE, 0xF6, 0xE6, 0xC6, 0x00, +0x00, 0x00, 0x00, 0x00, 0xF8, 0x18, 0x18, 0x18, +0x18, 0x18, 0x18, 0x18, 0x1F, 0x00, 0x00, 0x00, +0x18, 0x18, 0x18, 0x18, 0xFF, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0xFF, 0x18, 0x18, 0x18, +0x18, 0x18, 0x18, 0x18, 0x1F, 0x18, 0x18, 0x18, +0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, +0x18, 0x18, 0x18, 0x18, 0xFF, 0x18, 0x18, 0x18, +0x00, 0x00, 0xE6, 0x6C, 0x78, 0x6C, 0xE6, 0x00, +0xE6, 0x6C, 0x78, 0x78, 0x6C, 0x66, 0xE6, 0x00, +0x36, 0x36, 0x37, 0x30, 0x3F, 0x00, 0x00, 0x00, +0x00, 0x00, 0x3F, 0x30, 0x37, 0x36, 0x36, 0x36, +0x36, 0x36, 0xF7, 0x00, 0xFF, 0x00, 0x00, 0x00, +0x00, 0x00, 0xFF, 0x00, 0xF7, 0x36, 0x36, 0x36, +0x36, 0x36, 0x37, 0x30, 0x37, 0x36, 0x36, 0x36, +0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, +0x36, 0x36, 0xF7, 0x00, 0xF7, 0x36, 0x36, 0x36, +0x00, 0xC6, 0x7C, 0xC6, 0xC6, 0x7C, 0xC6, 0x00, +0x00, 0x00, 0x3E, 0x66, 0x66, 0x66, 0xE6, 0x00, +0x1E, 0x36, 0x66, 0x66, 0x66, 0x66, 0xC6, 0x00, +0x00, 0x00, 0xC6, 0xFE, 0xFE, 0xD6, 0xC6, 0x00, +0xC6, 0xEE, 0xFE, 0xFE, 0xD6, 0xC6, 0xC6, 0x00, +0x00, 0x00, 0xC6, 0xC6, 0xFE, 0xC6, 0xC6, 0x00, +0xC6, 0xC6, 0xC6, 0xFE, 0xC6, 0xC6, 0xC6, 0x00, +0x00, 0x00, 0x7C, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, +0x7C, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, +0x00, 0x00, 0xFE, 0xC6, 0xC6, 0xC6, 0xC6, 0x00, +0x18, 0x18, 0x18, 0x18, 0xF8, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x1F, 0x18, 0x18, 0x18, +0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, +0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, +0xFE, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x00, +0x00, 0x00, 0x7E, 0xC6, 0x7E, 0x66, 0xC6, 0x00, +0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, +0x7E, 0xC6, 0xC6, 0xC6, 0x7E, 0x66, 0xC6, 0x00, +0x00, 0x00, 0xFC, 0x66, 0x66, 0x7C, 0x60, 0xF0, +0xFC, 0x66, 0x66, 0x66, 0x7C, 0x60, 0xF0, 0x00, +0x00, 0x00, 0x7C, 0xC6, 0xC0, 0xC6, 0x7C, 0x00, +0x7C, 0xC6, 0xC0, 0xC0, 0xC0, 0xC6, 0x7C, 0x00, +0x00, 0x00, 0x7E, 0x5A, 0x18, 0x18, 0x3C, 0x00, +0x7E, 0x5A, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00, +0x00, 0x00, 0xC6, 0xC6, 0xC6, 0x7E, 0x06, 0x7C, +0xC6, 0xC6, 0xC6, 0x7E, 0x06, 0xC6, 0x7C, 0x00, +0x00, 0x00, 0xD6, 0x7C, 0x38, 0x7C, 0xD6, 0x00, +0xD6, 0xD6, 0x7C, 0x38, 0x7C, 0xD6, 0xD6, 0x00, +0x00, 0x00, 0xFC, 0x66, 0x7C, 0x66, 0xFC, 0x00, +0xFC, 0x66, 0x66, 0x7C, 0x66, 0x66, 0xFC, 0x00, +0x00, 0x00, 0xF0, 0x60, 0x7C, 0x66, 0xFC, 0x00, +0xF0, 0x60, 0x60, 0x7C, 0x66, 0x66, 0x7C, 0x00, +0x8F, 0xCD, 0xEF, 0xFC, 0xDC, 0xCC, 0xCC, 0x00, +0x00, 0x00, 0x00, 0x7C, 0x7C, 0x00, 0x00, 0x00, +0x00, 0x00, 0xC6, 0xC6, 0xF6, 0xDE, 0xF6, 0x00, +0xC6, 0xC6, 0xC6, 0xF6, 0xDE, 0xDE, 0xF6, 0x00, +0x00, 0x00, 0x7C, 0xC6, 0x1C, 0xC6, 0x7C, 0x00, +0x7C, 0xC6, 0x06, 0x3C, 0x06, 0xC6, 0x7C, 0x00, +0x00, 0x00, 0xD6, 0xD6, 0xD6, 0xD6, 0xFE, 0x00, +0xD6, 0xD6, 0xD6, 0xD6, 0xD6, 0xD6, 0xFE, 0x00, +0x00, 0x00, 0x7C, 0xC6, 0x1E, 0xC6, 0x7C, 0x00, +0x78, 0x8C, 0x06, 0x3E, 0x06, 0x8C, 0x78, 0x00, +0x00, 0x00, 0xD6, 0xD6, 0xD6, 0xD6, 0xFF, 0x03, +0xD6, 0xD6, 0xD6, 0xD6, 0xD6, 0xD6, 0xFF, 0x03, +0x00, 0x00, 0xC6, 0xC6, 0x7E, 0x06, 0x06, 0x00, +0xC6, 0xC6, 0xC6, 0x7E, 0x06, 0x06, 0x06, 0x00, +0x3E, 0x61, 0x3C, 0x66, 0x66, 0x3C, 0x86, 0x7C, +0x00, 0x00, 0x3C, 0x3C, 0x3C, 0x3C, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +}; \ No newline at end of file diff --git a/demontsc/lib/TVoutfonts/font8x8ext.h b/demontsc/lib/TVoutfonts/font8x8ext.h new file mode 100755 index 0000000..8f888ca --- /dev/null +++ b/demontsc/lib/TVoutfonts/font8x8ext.h @@ -0,0 +1,7 @@ +#ifndef FONT8X8EXT_H +#define FONT8X8EXT_H + +#include +extern const unsigned char font8x8ext[]; + +#endif \ No newline at end of file diff --git a/demontsc/lib/TVoutfonts/fontALL.h b/demontsc/lib/TVoutfonts/fontALL.h new file mode 100755 index 0000000..4362761 --- /dev/null +++ b/demontsc/lib/TVoutfonts/fontALL.h @@ -0,0 +1,9 @@ +#ifndef FONTALL_H +#define FONTALL_H + +#include "font4x6.h" +#include "font6x8.h" +#include "font8x8.h" +#include "font8x8ext.h" + +#endif \ No newline at end of file diff --git a/demontsc/lib/TVoutfonts/keywords.txt b/demontsc/lib/TVoutfonts/keywords.txt new file mode 100755 index 0000000..9296ca1 --- /dev/null +++ b/demontsc/lib/TVoutfonts/keywords.txt @@ -0,0 +1,5 @@ +font4x6 LITERAL1 +font6x8 LITERAL1 +font8x8 LITERAL1 +font8x8ext LITERAL1 + diff --git a/demontsc/lib/pollserial/pollserial.cpp b/demontsc/lib/pollserial/pollserial.cpp new file mode 100755 index 0000000..a417098 --- /dev/null +++ b/demontsc/lib/pollserial/pollserial.cpp @@ -0,0 +1,139 @@ +/* + pollserial.cpp Heavily modified version of: + + HardwareSerial.cpp - Hardware serial library for Wiring + Copyright (c) 2006 Nicholas Zambetti. All right reserved. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Modified 23 November 2006 by David A. Mellis + + Modified July 2010 by Myles D. Metzler +*/ + +#include +#include +#include "pollserial.h" + +#define BUFFER_SIZE 64 + +rbuffer rxbuffer = {0,0,0}; + +void USART_recieve() { +#if defined ( UDR0 ) + if( UCSR0A & _BV(RXC0)) { + uint8_t i = (rxbuffer.head + 1) & (BUFFER_SIZE - 1); + if ( i != rxbuffer.tail) { + rxbuffer.buffer[rxbuffer.head] = UDR0; + rxbuffer.head = i; + } + } +#else + if( UCSRA & _BV(RXC)) { + uint8_t i = (rxbuffer.head + 1) & (BUFFER_SIZE - 1); + if ( i != rxbuffer.tail) { + rxbuffer.buffer[rxbuffer.head] = UDR; + rxbuffer.head = i; + } + } +#endif +} + +pt2Funct pollserial::begin(long baud) { + uint16_t baud_setting; + bool use_u2x; + + rxbuffer.buffer = (unsigned char*)malloc(BUFFER_SIZE*sizeof(unsigned char)); + + // U2X mode is needed for baud rates higher than (CPU Hz / 16) + if (baud > F_CPU / 16) { + use_u2x = true; + } + else { + // figure out if U2X mode would allow for a better connection + + // calculate the percent difference between the baud-rate specified and + // the real baud rate for both U2X and non-U2X mode (0-255 error percent) + uint8_t nonu2x_baud_error = abs((int)(255-((F_CPU/(16*(((F_CPU/8/baud-1)/2)+1))*255)/baud))); + uint8_t u2x_baud_error = abs((int)(255-((F_CPU/(8*(((F_CPU/4/baud-1)/2)+1))*255)/baud))); + + // prefer non-U2X mode because it handles clock skew better + use_u2x = (nonu2x_baud_error > u2x_baud_error); + } + if (use_u2x) { +#if defined ( UDR0 ) + UCSR0A = _BV(U2X0); +#else + UCSRA = _BV(U2X); +#endif + baud_setting = (F_CPU / 4 / baud - 1) / 2; + } + else { +#if defined ( UDR0 ) + UCSR0A = 0; +#else + UCSRA = 0; +#endif + baud_setting = (F_CPU / 8 / baud - 1) / 2; + } + + // assign the baud_setting, a.k.a. (USART Baud Rate Register) +#if defined ( UDR0 ) + UBRR0 = baud_setting; + UCSR0B = _BV(RXEN0) | _BV(TXEN0); +#else + UBRR = baud_setting; + UCSRB = _BV(RXEN) | _BV(TXEN); +#endif + + return &USART_recieve; +} + +void pollserial::end() { + UCSR0B &= ~(_BV(RXEN0) | _BV(TXEN0)); + free(rxbuffer.buffer); +} + +uint8_t pollserial::available() { + return (BUFFER_SIZE + rxbuffer.head - rxbuffer.tail) & (BUFFER_SIZE-1); +} + +int pollserial::read() { + if (rxbuffer.head == rxbuffer.tail) + return -1; + else { + uint8_t c = rxbuffer.buffer[rxbuffer.tail]; + //tail = (tail + 1) & 63; + if (rxbuffer.tail == BUFFER_SIZE) + rxbuffer.tail = 0; + else + rxbuffer.tail++; + return c; + } +} + +void pollserial::flush() { + rxbuffer.head = rxbuffer.tail; +} + +size_t pollserial::write(uint8_t c) { +#if defined ( UDR0 ) + while (!((UCSR0A) & _BV(UDRE0))); + UDR0 = c; +#else + while (!((UCSRA) & _BV(UDRE))); + UDR = c; +#endif +} \ No newline at end of file diff --git a/demontsc/lib/pollserial/pollserial.h b/demontsc/lib/pollserial/pollserial.h new file mode 100755 index 0000000..0e97fbb --- /dev/null +++ b/demontsc/lib/pollserial/pollserial.h @@ -0,0 +1,51 @@ +/* + pollserial.h Heavily modified version of: + + HardwareSerial.h - Hardware serial library for Wiring + Copyright (c) 2006 Nicholas Zambetti. All right reserved. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Modified July 2010 by Myles D. Metzler +*/ + +#ifndef PSERIAL_H +#define PSERIAL_H + +#include +#include "Print.h" + +typedef struct { + uint8_t head; + uint8_t tail; + unsigned char * buffer; +} rbuffer; + +//define a void function() return type. +typedef void (*pt2Funct)(); + +class pollserial : public Print { + public: + pt2Funct begin(long); + void end(); + uint8_t available(void); + int read(void); + void flush(void); + virtual size_t write(uint8_t); + using Print::write; // pull in write(str) and write(buf, size) from Print +}; + +void USART_recieve(); +#endif \ No newline at end of file diff --git a/demontsc/src/DemoNTSC.pde b/demontsc/src/DemoNTSC.pde new file mode 100755 index 0000000..7ad6232 --- /dev/null +++ b/demontsc/src/DemoNTSC.pde @@ -0,0 +1,217 @@ +#include +#include +#include "schematic.h" +#include "TVOlogo.h" + +TVout TV; + +int zOff = 150; +int xOff = 0; +int yOff = 0; +int cSize = 50; +int view_plane = 64; +float angle = PI/60; + +float cube3d[8][3] = { + {xOff - cSize,yOff + cSize,zOff - cSize}, + {xOff + cSize,yOff + cSize,zOff - cSize}, + {xOff - cSize,yOff - cSize,zOff - cSize}, + {xOff + cSize,yOff - cSize,zOff - cSize}, + {xOff - cSize,yOff + cSize,zOff + cSize}, + {xOff + cSize,yOff + cSize,zOff + cSize}, + {xOff - cSize,yOff - cSize,zOff + cSize}, + {xOff + cSize,yOff - cSize,zOff + cSize} +}; +unsigned char cube2d[8][2]; + + +void setup() { + TV.begin(NTSC,120,96); + TV.select_font(font6x8); + intro(); + TV.println("I am the TVout\nlibrary running on a freeduino\n"); + TV.delay(2500); + TV.println("I generate a PAL\nor NTSC composite video using\ninterrupts\n"); + TV.delay(2500); + TV.println("My schematic:"); + TV.delay(1500); + TV.bitmap(0,0,schematic); + TV.delay(10000); + TV.clear_screen(); + TV.println("Lets see what\nwhat I can do"); + TV.delay(2000); + + //fonts + TV.clear_screen(); + TV.println(0,0,"Multiple fonts:"); + TV.select_font(font4x6); + TV.println("4x6 font FONT"); + TV.select_font(font6x8); + TV.println("6x8 font FONT"); + TV.select_font(font8x8); + TV.println("8x8 font FONT"); + TV.select_font(font6x8); + TV.delay(2000); + + TV.clear_screen(); + TV.print(9,44,"Draw Basic Shapes"); + TV.delay(2000); + + //circles + TV.clear_screen(); + TV.draw_circle(TV.hres()/2,TV.vres()/2,TV.vres()/3,WHITE); + TV.delay(500); + TV.draw_circle(TV.hres()/2,TV.vres()/2,TV.vres()/2,WHITE,INVERT); + TV.delay(2000); + + //rectangles and lines + TV.clear_screen(); + TV.draw_rect(20,20,80,56,WHITE); + TV.delay(500); + TV.draw_rect(10,10,100,76,WHITE,INVERT); + TV.delay(500); + TV.draw_line(60,20,60,76,INVERT); + TV.draw_line(20,48,100,48,INVERT); + TV.delay(500); + TV.draw_line(10,10,110,86,INVERT); + TV.draw_line(10,86,110,10,INVERT); + TV.delay(2000); + + //random cube forever. + TV.clear_screen(); + TV.print(16,40,"Random Cube"); + TV.print(28,48,"Rotation"); + TV.delay(2000); + + randomSeed(analogRead(0)); +} + +void loop() { + int rsteps = random(10,60); + switch(random(6)) { + case 0: + for (int i = 0; i < rsteps; i++) { + zrotate(angle); + printcube(); + } + break; + case 1: + for (int i = 0; i < rsteps; i++) { + zrotate(2*PI - angle); + printcube(); + } + break; + case 2: + for (int i = 0; i < rsteps; i++) { + xrotate(angle); + printcube(); + } + break; + case 3: + for (int i = 0; i < rsteps; i++) { + xrotate(2*PI - angle); + printcube(); + } + break; + case 4: + for (int i = 0; i < rsteps; i++) { + yrotate(angle); + printcube(); + } + break; + case 5: + for (int i = 0; i < rsteps; i++) { + yrotate(2*PI - angle); + printcube(); + } + break; + } +} + +void intro() { +unsigned char w,l,wb; + int index; + w = pgm_read_byte(TVOlogo); + l = pgm_read_byte(TVOlogo+1); + if (w&7) + wb = w/8 + 1; + else + wb = w/8; + index = wb*(l-1) + 2; + for ( unsigned char i = 1; i < l; i++ ) { + TV.bitmap((TV.hres() - w)/2,0,TVOlogo,index,w,i); + index-= wb; + TV.delay(50); + } + for (unsigned char i = 0; i < (TV.vres() - l)/2; i++) { + TV.bitmap((TV.hres() - w)/2,i,TVOlogo); + TV.delay(50); + } + TV.delay(3000); + TV.clear_screen(); +} + +void printcube() { + //calculate 2d points + for(byte i = 0; i < 8; i++) { + cube2d[i][0] = (unsigned char)((cube3d[i][0] * view_plane / cube3d[i][2]) + (TV.hres()/2)); + cube2d[i][1] = (unsigned char)((cube3d[i][1] * view_plane / cube3d[i][2]) + (TV.vres()/2)); + } + TV.delay_frame(1); + TV.clear_screen(); + draw_cube(); +} + +void zrotate(float q) { + float tx,ty,temp; + for(byte i = 0; i < 8; i++) { + tx = cube3d[i][0] - xOff; + ty = cube3d[i][1] - yOff; + temp = tx * cos(q) - ty * sin(q); + ty = tx * sin(q) + ty * cos(q); + tx = temp; + cube3d[i][0] = tx + xOff; + cube3d[i][1] = ty + yOff; + } +} + +void yrotate(float q) { + float tx,tz,temp; + for(byte i = 0; i < 8; i++) { + tx = cube3d[i][0] - xOff; + tz = cube3d[i][2] - zOff; + temp = tz * cos(q) - tx * sin(q); + tx = tz * sin(q) + tx * cos(q); + tz = temp; + cube3d[i][0] = tx + xOff; + cube3d[i][2] = tz + zOff; + } +} + +void xrotate(float q) { + float ty,tz,temp; + for(byte i = 0; i < 8; i++) { + ty = cube3d[i][1] - yOff; + tz = cube3d[i][2] - zOff; + temp = ty * cos(q) - tz * sin(q); + tz = ty * sin(q) + tz * cos(q); + ty = temp; + cube3d[i][1] = ty + yOff; + cube3d[i][2] = tz + zOff; + } +} + +void draw_cube() { + TV.draw_line(cube2d[0][0],cube2d[0][1],cube2d[1][0],cube2d[1][1],WHITE); + TV.draw_line(cube2d[0][0],cube2d[0][1],cube2d[2][0],cube2d[2][1],WHITE); + TV.draw_line(cube2d[0][0],cube2d[0][1],cube2d[4][0],cube2d[4][1],WHITE); + TV.draw_line(cube2d[1][0],cube2d[1][1],cube2d[5][0],cube2d[5][1],WHITE); + TV.draw_line(cube2d[1][0],cube2d[1][1],cube2d[3][0],cube2d[3][1],WHITE); + TV.draw_line(cube2d[2][0],cube2d[2][1],cube2d[6][0],cube2d[6][1],WHITE); + TV.draw_line(cube2d[2][0],cube2d[2][1],cube2d[3][0],cube2d[3][1],WHITE); + TV.draw_line(cube2d[4][0],cube2d[4][1],cube2d[6][0],cube2d[6][1],WHITE); + TV.draw_line(cube2d[4][0],cube2d[4][1],cube2d[5][0],cube2d[5][1],WHITE); + TV.draw_line(cube2d[7][0],cube2d[7][1],cube2d[6][0],cube2d[6][1],WHITE); + TV.draw_line(cube2d[7][0],cube2d[7][1],cube2d[3][0],cube2d[3][1],WHITE); + TV.draw_line(cube2d[7][0],cube2d[7][1],cube2d[5][0],cube2d[5][1],WHITE); +} diff --git a/demontsc/src/TVOlogo.cpp b/demontsc/src/TVOlogo.cpp new file mode 100755 index 0000000..6435656 --- /dev/null +++ b/demontsc/src/TVOlogo.cpp @@ -0,0 +1,37 @@ +#include "TVOlogo.h" +PROGMEM const unsigned char TVOlogo[] = { +96,32, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x3F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFC,0x00, +0x03,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xC0, +0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x10,0x38, +0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x04, +0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x40,0x02, +0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0A,0x80,0x02, +0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x02, +0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xFF,0xFF,0xC2, +0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x42, +0x4F,0xFF,0x60,0x18,0x00,0x00,0x00,0x00,0x17,0xFF,0xFF,0x42, +0x4F,0xFF,0x60,0x18,0x00,0x00,0x00,0x30,0x14,0x00,0x01,0x42, +0x40,0x60,0x60,0x18,0x00,0x00,0x00,0x30,0x14,0x70,0x71,0x42, +0x40,0x60,0x30,0x30,0x00,0x00,0x00,0x30,0x14,0x88,0x89,0x42, +0x40,0x60,0x30,0x30,0x3E,0x06,0x0C,0xFE,0x15,0x05,0x25,0x42, +0x40,0x60,0x30,0x60,0xFF,0x86,0x0C,0xFE,0x15,0x72,0x75,0x42, +0x40,0x60,0x18,0x60,0xC1,0x86,0x0C,0x30,0x15,0x05,0x25,0x42, +0x40,0x60,0x18,0x61,0x80,0xC6,0x0C,0x30,0x14,0x88,0x89,0x42, +0x40,0x60,0x18,0xC1,0x80,0xC6,0x0C,0x30,0x14,0x70,0x71,0x42, +0x40,0x60,0x0C,0xC1,0x80,0xC6,0x0C,0x30,0x14,0x00,0x01,0x42, +0x40,0x60,0x0C,0xC1,0x80,0xC6,0x0C,0x30,0x17,0xFF,0xFF,0x42, +0x40,0x60,0x0F,0x81,0x80,0xC6,0x0C,0x30,0x10,0x00,0x00,0x42, +0x40,0x60,0x07,0x80,0xC1,0x87,0x1C,0x30,0x15,0x40,0x15,0x42, +0x40,0x60,0x07,0x80,0xFF,0x83,0xFC,0x3E,0x12,0x8A,0x8A,0x42, +0x40,0x60,0x03,0x00,0x3E,0x01,0xEC,0x1E,0x15,0x40,0x15,0x42, +0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x42, +0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xFF,0xFF,0xC2, +0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04, +0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38, +0x03,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xC0, +0x00,0x3F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFC,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + +}; diff --git a/demontsc/src/TVOlogo.h b/demontsc/src/TVOlogo.h new file mode 100755 index 0000000..3c1d56a --- /dev/null +++ b/demontsc/src/TVOlogo.h @@ -0,0 +1,6 @@ +#include +#ifndef TVOLOGO_H +#define TVOLOGO_H + +extern const unsigned char TVOlogo[]; +#endif \ No newline at end of file diff --git a/demontsc/src/schematic.cpp b/demontsc/src/schematic.cpp new file mode 100755 index 0000000..dcf0d1d --- /dev/null +++ b/demontsc/src/schematic.cpp @@ -0,0 +1,101 @@ +#include "schematic.h" + +PROGMEM const unsigned char schematic[] = { +120,96, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x0F,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFE, +0x08,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x02, +0x08,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x02, +0x0B,0x0C,0xE4,0x41,0x00,0x00,0x03,0x12,0x0E,0x22,0x61,0x80,0xB8,0x71,0x82, +0x0B,0x0D,0x94,0x41,0x00,0x00,0x05,0x14,0x11,0x22,0x61,0x80,0xA4,0xC9,0x82, +0x0A,0x95,0x04,0x41,0x00,0x00,0x01,0x14,0x11,0x22,0x52,0x80,0xA4,0x81,0x42, +0x0A,0x95,0x04,0x41,0x00,0x00,0x01,0x18,0x11,0x3E,0x52,0x80,0xB8,0x82,0x42, +0x0A,0x65,0x04,0x41,0x00,0x00,0x01,0x14,0x11,0x22,0x4C,0x80,0xA4,0x83,0xC2, +0x0A,0x65,0x94,0x41,0x00,0x00,0x01,0x12,0x11,0x22,0x4C,0x80,0xA4,0xCA,0x22, +0x0A,0x64,0xE3,0x81,0x00,0x00,0x07,0x92,0x0E,0x22,0x4C,0x80,0xA4,0x74,0x22, +0x08,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x02, +0x0F,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFE, +0x08,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x02, +0x08,0x70,0x00,0x01,0x00,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x80,0x00,0x02, +0x08,0x90,0x00,0x01,0x00,0x00,0x02,0x80,0x02,0x80,0x02,0x80,0x80,0x00,0x02, +0x08,0x84,0x5E,0x39,0x00,0x00,0x04,0x40,0x04,0x40,0x04,0x40,0x80,0x00,0x02, +0x08,0x64,0x92,0x41,0x00,0x00,0x08,0x20,0x08,0x20,0x08,0x20,0x80,0x00,0x02, +0x08,0x12,0x92,0x41,0xFF,0xFF,0xF0,0x10,0x10,0x10,0x10,0x1C,0x80,0x00,0x02, +0x08,0x92,0x92,0x41,0x00,0x00,0x00,0x08,0x20,0x08,0x20,0x04,0x80,0x00,0x02, +0x08,0xE1,0x12,0x39,0x00,0x00,0x00,0x04,0x40,0x04,0x40,0x04,0xA1,0x4F,0x02, +0x08,0x01,0x00,0x01,0x00,0x00,0x00,0x02,0x80,0x02,0x80,0x04,0xB3,0x49,0x82, +0x08,0x02,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x04,0x92,0x48,0x82, +0x08,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x92,0x48,0x82, +0x08,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x9C,0x48,0x82, +0x08,0x00,0x00,0x01,0x00,0x00,0x01,0x00,0x01,0x00,0x01,0x04,0x8C,0x49,0x82, +0x08,0x02,0x14,0xF1,0x00,0x00,0x02,0x80,0x02,0x80,0x02,0x84,0x8C,0x4F,0x02, +0x08,0x03,0x34,0x99,0x00,0x00,0x04,0x40,0x04,0x40,0x04,0x44,0x80,0x00,0x02, +0x08,0x01,0x24,0x89,0x00,0x00,0x08,0x20,0x08,0x20,0x08,0x24,0x80,0x00,0x02, +0x08,0x01,0x24,0x89,0xFF,0xFF,0xF0,0x10,0x10,0x10,0x10,0x1C,0x80,0x00,0x02, +0x08,0x01,0xC4,0x89,0x00,0x00,0x00,0x08,0x20,0x08,0x20,0x00,0x80,0x00,0x02, +0x08,0x00,0xC4,0x99,0x00,0x00,0x00,0x04,0x40,0x04,0x40,0x00,0x80,0x00,0x02, +0x08,0x00,0xC4,0xF1,0x00,0x00,0x00,0x02,0x80,0x02,0x80,0x00,0x80,0x00,0x02, +0x08,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x00,0x80,0x00,0x02, +0x08,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x02, +0x08,0x00,0x00,0x01,0x00,0x00,0x0C,0xF9,0xC1,0xC4,0x4C,0x30,0x80,0x00,0x02, +0x08,0x00,0x00,0x01,0x00,0x00,0x14,0x1A,0x42,0x24,0x4C,0x30,0x80,0x00,0x02, +0x08,0x00,0x00,0x01,0x00,0x00,0x34,0x12,0x42,0x24,0x4A,0x50,0x80,0x00,0x02, +0x08,0x00,0x00,0x01,0x00,0x00,0x24,0x32,0x42,0x27,0xCA,0x50,0x80,0x00,0x02, +0x08,0x00,0x00,0x01,0x00,0x00,0x3E,0x22,0x42,0x24,0x49,0x90,0x80,0x00,0x02, +0x08,0x00,0x00,0x01,0x00,0x00,0x04,0x62,0x42,0x24,0x49,0x90,0x80,0x00,0x02, +0x08,0x1E,0x64,0xF1,0x00,0x00,0x04,0x43,0x81,0xC4,0x49,0x90,0x9E,0x64,0xF2, +0x08,0x32,0x64,0x99,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xB2,0x64,0x9A, +0x08,0x20,0x54,0x89,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xA0,0x54,0x8A, +0x08,0x26,0x54,0x89,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xA6,0x54,0x8A, +0x08,0x22,0x4C,0x89,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xA2,0x4C,0x8A, +0x08,0x32,0x4C,0x99,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xB2,0x4C,0x9A, +0x08,0x1E,0x4C,0xF1,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x9E,0x4C,0xF2, +0x08,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x02, +0x0F,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFE, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x30,0x00,0x00,0x04,0x00,0x00,0x40,0x00,0x00,0x00,0x03,0x81,0xC6,0x04,0x00, +0x48,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x04,0x42,0x2A,0x04,0x00, +0x42,0x25,0x87,0x04,0x38,0x3C,0x48,0x8B,0xC8,0x8E,0x08,0x24,0x02,0x0A,0x00, +0x22,0x26,0x48,0x04,0x40,0x02,0x48,0x88,0x28,0x90,0x08,0x24,0x02,0x0A,0x00, +0x11,0x44,0x48,0x04,0x60,0x1E,0x45,0x51,0xE5,0x18,0x08,0x24,0x02,0x11,0x00, +0x09,0x44,0x48,0x04,0x18,0x22,0x45,0x52,0x25,0x06,0x08,0x24,0x02,0x1F,0x00, +0x48,0x84,0x48,0x04,0x08,0x22,0x42,0x22,0x22,0x02,0x04,0x42,0x22,0x20,0x80, +0x30,0x84,0x47,0x04,0x70,0x1E,0x42,0x21,0xE2,0x1C,0x03,0x81,0xCF,0xA0,0x80, +0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00, +0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x82,0x8F,0x01,0x00,0x00,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80, +0x82,0x88,0x80,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80, +0x44,0x88,0x41,0x0E,0x0F,0x02,0x03,0x8B,0x03,0xC5,0x91,0x07,0x87,0x17,0xE0, +0x44,0x88,0x41,0x10,0x08,0x82,0x04,0x4C,0x80,0x26,0x51,0x04,0x48,0x98,0x80, +0x28,0x88,0x41,0x18,0x08,0x84,0x04,0x48,0x81,0xE4,0x4A,0x04,0x48,0x90,0x80, +0x28,0x88,0x41,0x06,0x08,0x84,0x04,0x48,0x82,0x24,0x4A,0x04,0x48,0x90,0x80, +0x10,0x88,0x81,0x02,0x08,0x88,0x04,0x48,0x82,0x24,0x44,0x04,0x48,0x90,0x80, +0x10,0x8F,0x01,0x1C,0x0F,0x08,0x03,0x88,0x81,0xE4,0x44,0x07,0x87,0x10,0x60, +0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x08,0x04,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x08,0x04,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 +}; diff --git a/demontsc/src/schematic.h b/demontsc/src/schematic.h new file mode 100755 index 0000000..4d0b270 --- /dev/null +++ b/demontsc/src/schematic.h @@ -0,0 +1,6 @@ +#include +#ifndef SHEMATIC_H +#define SHEMATIC_H + +extern const unsigned char schematic[]; +#endif diff --git a/demopal/lib/.holder b/demopal/lib/.holder new file mode 100644 index 0000000..e69de29 diff --git a/demopal/lib/TVout/TVout.cpp b/demopal/lib/TVout/TVout.cpp new file mode 100755 index 0000000..751eb54 --- /dev/null +++ b/demopal/lib/TVout/TVout.cpp @@ -0,0 +1,877 @@ +/* + Copyright (c) 2010 Myles Metzer + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. +*/ + +/* A note about how Color is defined for this version of TVout + * + * Where ever choosing a color is mentioned the following are true: + * BLACK =0 + * WHITE =1 + * INVERT =2 + * All others will be ignored. +*/ + +#include "TVout.h" + + +/* Call this to start video output with the default resolution. + * + * Arguments: + * mode: + * The video standard to follow: + * PAL =1 =_PAL + * NTSC =0 =_NTSC + * + * Returns: + * 0 if no error. + * 4 if there is not enough memory. + */ +char TVout::begin(uint8_t mode) { + + return begin(mode,128,96); +} // end of begin + + +/* call this to start video output with a specified resolution. + * + * Arguments: + * mode: + * The video standard to follow: + * PAL =1 =_PAL + * NTSC =0 =_NTSC + * x: + * Horizonal resolution must be divisable by 8. + * y: + * Vertical resolution. + * + * Returns: + * 0 if no error. + * 1 if x is not divisable by 8. + * 2 if y is to large (NTSC only cannot fill PAL vertical resolution by 8bit limit) + * 4 if there is not enough memory for the frame buffer. + */ +char TVout::begin(uint8_t mode, uint8_t x, uint8_t y) { + + // check if x is divisable by 8 + if ( !(x & 0xF8)) + return 1; + x = x/8; + + screen = (unsigned char*)malloc(x * y * sizeof(unsigned char)); + if (screen == NULL) + return 4; + + cursor_x = 0; + cursor_y = 0; + + render_setup(mode,x,y,screen); + clear_screen(); + return 0; +} // end of begin + + +/* Stop video render and free the used memory. + */ + void TVout::end() { + TIMSK1 = 0; + free(screen); +} + + +/* Fill the screen with some color. + * + * Arguments: + * color: + * The color to fill the screen with. + * (see color note at the top of this file) +*/ +void TVout::fill(uint8_t color) { + switch(color) { + case BLACK: + cursor_x = 0; + cursor_y = 0; + for (int i = 0; i < (display.hres)*display.vres; i++) + display.screen[i] = 0; + break; + case WHITE: + cursor_x = 0; + cursor_y = 0; + for (int i = 0; i < (display.hres)*display.vres; i++) + display.screen[i] = 0xFF; + break; + case INVERT: + for (int i = 0; i < display.hres*display.vres; i++) + display.screen[i] = ~display.screen[i]; + break; + } +} // end of fill + + +/* Gets the Horizontal resolution of the screen + * + * Returns: + * The horizonal resolution. +*/ +unsigned char TVout::hres() { + return display.hres*8; +} // end of hres + + +/* Gets the Vertical resolution of the screen + * + * Returns: + * The vertical resolution +*/ +unsigned char TVout::vres() { + return display.vres; +} // end of vres + + +/* Return the number of characters that will fit on a line + * + * Returns: + * The number of characters that will fit on a text line starting from x=0. + * Will return -1 for dynamic width fonts as this cannot be determined. +*/ +char TVout::char_line() { + return ((display.hres*8)/pgm_read_byte(font)); +} // end of char_line + + +/* delay for x ms + * The resolution is 16ms for NTSC and 20ms for PAL + * + * Arguments: + * x: + * The number of ms this function should consume. +*/ +void TVout::delay(unsigned int x) { + unsigned long time = millis() + x; + while(millis() < time); +} // end of delay + + +/* Delay for x frames, exits at the end of the last display line. + * delay_frame(1) is useful prior to drawing so there is little/no flicker. + * + * Arguments: + * x: + * The number of frames to delay for. + */ +void TVout::delay_frame(unsigned int x) { + int stop_line = (int)(display.start_render + (display.vres*(display.vscale_const+1)))+1; + while (x) { + while (display.scanLine != stop_line); + while (display.scanLine == stop_line); + x--; + } +} // end of delay_frame + + +/* Get the time in ms since begin was called. + * The resolution is 16ms for NTSC and 20ms for PAL + * + * Returns: + * The time in ms since video generation has started. +*/ +unsigned long TVout::millis() { + if (display.lines_frame == _NTSC_LINE_FRAME) { + return display.frames * _NTSC_TIME_SCANLINE * _NTSC_LINE_FRAME / 1000; + } + else { + return display.frames * _PAL_TIME_SCANLINE * _PAL_LINE_FRAME / 1000; + } +} // end of millis + + +/* force the number of times to display each line. + * + * Arguments: + * sfactor: + * The scale number of times to repeate each line. + */ +void TVout::force_vscale(char sfactor) { + delay_frame(1); + display.vscale_const = sfactor - 1; + display.vscale = sfactor - 1; +} + + +/* force the output start time of a scanline in micro seconds. + * + * Arguments: + * time: + * The new output start time in micro seconds. + */ +void TVout::force_outstart(uint8_t time) { + delay_frame(1); + display.output_delay = ((time * _CYCLES_PER_US) - 1); +} + + +/* force the start line for active video + * + * Arguments: + * line: + * The new active video output start line + */ +void TVout::force_linestart(uint8_t line) { + delay_frame(1); + display.start_render = line; +} + + +/* Set the color of a pixel + * + * Arguments: + * x: + * The x coordinate of the pixel. + * y: + * The y coordinate of the pixel. + * c: + * The color of the pixel + * (see color note at the top of this file) + */ +void TVout::set_pixel(uint8_t x, uint8_t y, char c) { + if (x >= display.hres*8 || y >= display.vres) + return; + sp(x,y,c); +} // end of set_pixel + + +/* get the color of the pixel at x,y + * + * Arguments: + * x: + * The x coordinate of the pixel. + * y: + * The y coordinate of the pixel. + * + * Returns: + * The color of the pixel. + * (see color note at the top of this file) + * + * Thank you gijs on the arduino.cc forum for the non obviouse fix. +*/ +unsigned char TVout::get_pixel(uint8_t x, uint8_t y) { + if (x >= display.hres*8 || y >= display.vres) + return 0; + if (display.screen[x/8+y*display.hres] & (0x80 >>(x&7))) + return 1; + return 0; +} // end of get_pixel + + +/* Draw a line from one point to another + * + * Arguments: + * x0: + * The x coordinate of point 0. + * y0: + * The y coordinate of point 0. + * x1: + * The x coordinate of point 1. + * y1: + * The y coordinate of point 1. + * c: + * The color of the line. + * (see color note at the top of this file) + */ +void TVout::draw_line(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1, char c) { + + if (x0 > display.hres*8 || y0 > display.vres || x1 > display.hres*8 || y1 > display.vres) + return; + if (x0 == x1) + draw_column(x0,y0,y1,c); + else if (y0 == y1) + draw_row(y0,x0,x1,c); + else { + int e; + signed int dx,dy,j, temp; + signed char s1,s2, xchange; + signed int x,y; + + x = x0; + y = y0; + + //take absolute value + if (x1 < x0) { + dx = x0 - x1; + s1 = -1; + } + else if (x1 == x0) { + dx = 0; + s1 = 0; + } + else { + dx = x1 - x0; + s1 = 1; + } + + if (y1 < y0) { + dy = y0 - y1; + s2 = -1; + } + else if (y1 == y0) { + dy = 0; + s2 = 0; + } + else { + dy = y1 - y0; + s2 = 1; + } + + xchange = 0; + + if (dy>dx) { + temp = dx; + dx = dy; + dy = temp; + xchange = 1; + } + + e = ((int)dy<<1) - dx; + + for (j=0; j<=dx; j++) { + sp(x,y,c); + + if (e>=0) { + if (xchange==1) x = x + s1; + else y = y + s2; + e = e - ((int)dx<<1); + } + if (xchange==1) + y = y + s2; + else + x = x + s1; + e = e + ((int)dy<<1); + } + } +} // end of draw_line + + +/* Fill a row from one point to another + * + * Argument: + * line: + * The row that fill will be performed on. + * x0: + * edge 0 of the fill. + * x1: + * edge 1 of the fill. + * c: + * the color of the fill. + * (see color note at the top of this file) +*/ +void TVout::draw_row(uint8_t line, uint16_t x0, uint16_t x1, uint8_t c) { + uint8_t lbit, rbit; + + if (x0 == x1) + set_pixel(x0,line,c); + else { + if (x0 > x1) { + lbit = x0; + x0 = x1; + x1 = lbit; + } + lbit = 0xff >> (x0&7); + x0 = x0/8 + display.hres*line; + rbit = ~(0xff >> (x1&7)); + x1 = x1/8 + display.hres*line; + if (x0 == x1) { + lbit = lbit & rbit; + rbit = 0; + } + if (c == WHITE) { + screen[x0++] |= lbit; + while (x0 < x1) + screen[x0++] = 0xff; + screen[x0] |= rbit; + } + else if (c == BLACK) { + screen[x0++] &= ~lbit; + while (x0 < x1) + screen[x0++] = 0; + screen[x0] &= ~rbit; + } + else if (c == INVERT) { + screen[x0++] ^= lbit; + while (x0 < x1) + screen[x0++] ^= 0xff; + screen[x0] ^= rbit; + } + } +} // end of draw_row + + +/* Fill a column from one point to another + * + * Argument: + * row: + * The row that fill will be performed on. + * y0: + * edge 0 of the fill. + * y1: + * edge 1 of the fill. + * c: + * the color of the fill. + * (see color note at the top of this file) +*/ +void TVout::draw_column(uint8_t row, uint16_t y0, uint16_t y1, uint8_t c) { + + unsigned char bit; + int byte; + + if (y0 == y1) + set_pixel(row,y0,c); + else { + if (y1 < y0) { + bit = y0; + y0 = y1; + y1 = bit; + } + bit = 0x80 >> (row&7); + byte = row/8 + y0*display.hres; + if (c == WHITE) { + while ( y0 <= y1) { + screen[byte] |= bit; + byte += display.hres; + y0++; + } + } + else if (c == BLACK) { + while ( y0 <= y1) { + screen[byte] &= ~bit; + byte += display.hres; + y0++; + } + } + else if (c == INVERT) { + while ( y0 <= y1) { + screen[byte] ^= bit; + byte += display.hres; + y0++; + } + } + } +} + + +/* draw a rectangle at x,y with a specified width and height + * + * Arguments: + * x0: + * The x coordinate of upper left corner of the rectangle. + * y0: + * The y coordinate of upper left corner of the rectangle. + * w: + * The widht of the rectangle. + * h: + * The height of the rectangle. + * c: + * The color of the rectangle. + * (see color note at the top of this file) + * fc: + * The fill color of the rectangle. + * (see color note at the top of this file) + * default =-1 (no fill) +*/ +void TVout::draw_rect(uint8_t x0, uint8_t y0, uint8_t w, uint8_t h, char c, char fc) { + + if (fc != -1) { + for (unsigned char i = y0; i < y0+h; i++) + draw_row(i,x0,x0+w,fc); + } + draw_line(x0,y0,x0+w,y0,c); + draw_line(x0,y0,x0,y0+h,c); + draw_line(x0+w,y0,x0+w,y0+h,c); + draw_line(x0,y0+h,x0+w,y0+h,c); +} // end of draw_rect + + +/* draw a circle given a coordinate x,y and radius both filled and non filled. + * + * Arguments: + * x0: + * The x coordinate of the center of the circle. + * y0: + * The y coordinate of the center of the circle. + * radius: + * The radius of the circle. + * c: + * The color of the circle. + * (see color note at the top of this file) + * fc: + * The color to fill the circle. + * (see color note at the top of this file) + * defualt =-1 (do not fill) + */ +void TVout::draw_circle(uint8_t x0, uint8_t y0, uint8_t radius, char c, char fc) { + + int f = 1 - radius; + int ddF_x = 1; + int ddF_y = -2 * radius; + int x = 0; + int y = radius; + uint8_t pyy = y,pyx = x; + + + //there is a fill color + if (fc != -1) + draw_row(y0,x0-radius,x0+radius,fc); + + sp(x0, y0 + radius,c); + sp(x0, y0 - radius,c); + sp(x0 + radius, y0,c); + sp(x0 - radius, y0,c); + + while(x < y) { + if(f >= 0) { + y--; + ddF_y += 2; + f += ddF_y; + } + x++; + ddF_x += 2; + f += ddF_x; + + //there is a fill color + if (fc != -1) { + //prevent double draws on the same rows + if (pyy != y) { + draw_row(y0+y,x0-x,x0+x,fc); + draw_row(y0-y,x0-x,x0+x,fc); + } + if (pyx != x && x != y) { + draw_row(y0+x,x0-y,x0+y,fc); + draw_row(y0-x,x0-y,x0+y,fc); + } + pyy = y; + pyx = x; + } + sp(x0 + x, y0 + y,c); + sp(x0 - x, y0 + y,c); + sp(x0 + x, y0 - y,c); + sp(x0 - x, y0 - y,c); + sp(x0 + y, y0 + x,c); + sp(x0 - y, y0 + x,c); + sp(x0 + y, y0 - x,c); + sp(x0 - y, y0 - x,c); + } +} // end of draw_circle + + +/* place a bitmap at x,y where the bitmap is defined as {width,height,imagedata....} + * + * Arguments: + * x: + * The x coordinate of the upper left corner. + * y: + * The y coordinate of the upper left corner. + * bmp: + * The bitmap data to print. + * i: + * The offset into the image data to start at. This is mainly used for fonts. + * default =0 + * width: + * Override the bitmap width. This is mainly used for fonts. + * default =0 (do not override) + * height: + * Override the bitmap height. This is mainly used for fonts. + * default =0 (do not override) +*/ +void TVout::bitmap(uint8_t x, uint8_t y, const unsigned char * bmp, + uint16_t i, uint8_t width, uint8_t lines) { + + uint8_t temp, lshift, rshift, save, xtra; + uint16_t si = 0; + + rshift = x&7; + lshift = 8-rshift; + if (width == 0) { + width = pgm_read_byte((uint32_t)(bmp) + i); + i++; + } + if (lines == 0) { + lines = pgm_read_byte((uint32_t)(bmp) + i); + i++; + } + + if (width&7) { + xtra = width&7; + width = width/8; + width++; + } + else { + xtra = 8; + width = width/8; + } + + for (uint8_t l = 0; l < lines; l++) { + si = (y + l)*display.hres + x/8; + if (width == 1) + temp = 0xff >> rshift + xtra; + else + temp = 0; + save = screen[si]; + screen[si] &= ((0xff << lshift) | temp); + temp = pgm_read_byte((uint32_t)(bmp) + i++); + screen[si++] |= temp >> rshift; + for ( uint16_t b = i + width-1; i < b; i++) { + save = screen[si]; + screen[si] = temp << lshift; + temp = pgm_read_byte((uint32_t)(bmp) + i); + screen[si++] |= temp >> rshift; + } + if (rshift + xtra < 8) + screen[si-1] |= (save & (0xff >> rshift + xtra)); //test me!!! + if (rshift + xtra - 8 > 0) + screen[si] &= (0xff >> rshift + xtra - 8); + screen[si] |= temp << lshift; + } +} // end of bitmap + + +/* shift the pixel buffer in any direction + * This function will shift the screen in a direction by any distance. + * + * Arguments: + * distance: + * The distance to shift the screen + * direction: + * The direction to shift the screen the direction and the integer values: + * UP =0 + * DOWN =1 + * LEFT =2 + * RIGHT =3 +*/ +void TVout::shift(uint8_t distance, uint8_t direction) { + uint8_t * src; + uint8_t * dst; + uint8_t * end; + uint8_t shift; + uint8_t tmp; + switch(direction) { + case UP: + dst = display.screen; + src = display.screen + distance*display.hres; + end = display.screen + display.vres*display.hres; + + while (src <= end) { + *dst = *src; + *src = 0; + dst++; + src++; + } + break; + case DOWN: + dst = display.screen + display.vres*display.hres; + src = dst - distance*display.hres; + end = display.screen; + + while (src >= end) { + *dst = *src; + *src = 0; + dst--; + src--; + } + break; + case LEFT: + shift = distance & 7; + + for (uint8_t line = 0; line < display.vres; line++) { + dst = display.screen + display.hres*line; + src = dst + distance/8; + end = dst + display.hres-2; + while (src <= end) { + tmp = 0; + tmp = *src << shift; + *src = 0; + src++; + tmp |= *src >> (8 - shift); + *dst = tmp; + dst++; + } + tmp = 0; + tmp = *src << shift; + *src = 0; + *dst = tmp; + } + break; + case RIGHT: + shift = distance & 7; + + for (uint8_t line = 0; line < display.vres; line++) { + dst = display.screen + display.hres-1 + display.hres*line; + src = dst - distance/8; + end = dst - display.hres+2; + while (src >= end) { + tmp = 0; + tmp = *src >> shift; + *src = 0; + src--; + tmp |= *src << (8 - shift); + *dst = tmp; + dst--; + } + tmp = 0; + tmp = *src >> shift; + *src = 0; + *dst = tmp; + } + break; + } +} // end of shift + + +/* Inline version of set_pixel that does not perform a bounds check + * This function will be replaced by a macro. +*/ +static void inline sp(uint8_t x, uint8_t y, char c) { + if (c==1) + display.screen[(x/8) + (y*display.hres)] |= 0x80 >> (x&7); + else if (c==0) + display.screen[(x/8) + (y*display.hres)] &= ~0x80 >> (x&7); + else + display.screen[(x/8) + (y*display.hres)] ^= 0x80 >> (x&7); +} // end of sp + + +/* set the vertical blank function call + * The function passed to this function will be called one per frame. The function should be quickish. + * + * Arguments: + * func: + * The function to call. + */ +void TVout::set_vbi_hook(void (*func)()) { + vbi_hook = func; +} // end of set_vbi_hook + + +/* set the horizonal blank function call + * This function passed to this function will be called one per scan line. + * The function MUST be VERY FAST(~2us max). + * + * Arguments: + * funct: + * The function to call. + */ +void TVout::set_hbi_hook(void (*func)()) { + hbi_hook = func; +} // end of set_bhi_hook + + +/* Simple tone generation + * + * Arguments: + * frequency: + * the frequency of the tone + * courtesy of adamwwolf + */ +void TVout::tone(unsigned int frequency) { + tone(frequency, 0); +} // end of tone + + +/* Simple tone generation + * + * Arguments: + * frequency: + * the frequency of the tone + * duration_ms: + * The duration to play the tone in ms + * courtesy of adamwwolf + */ +void TVout::tone(unsigned int frequency, unsigned long duration_ms) { + + if (frequency == 0) + return; + +#define TIMER 2 + //this is init code + TCCR2A = 0; + TCCR2B = 0; + TCCR2A |= _BV(WGM21); + TCCR2B |= _BV(CS20); + //end init code + + //most of this is taken from Tone.cpp from Arduino + uint8_t prescalarbits = 0b001; + uint32_t ocr = 0; + + + DDR_SND |= _BV(SND_PIN); //set pb3 (digital pin 11) to output + + //we are using an 8 bit timer, scan through prescalars to find the best fit + ocr = F_CPU / frequency / 2 - 1; + prescalarbits = 0b001; // ck/1: same for both timers + if (ocr > 255) { + ocr = F_CPU / frequency / 2 / 8 - 1; + prescalarbits = 0b010; // ck/8: same for both timers + + if (ocr > 255) { + ocr = F_CPU / frequency / 2 / 32 - 1; + prescalarbits = 0b011; + } + + if (ocr > 255) { + ocr = F_CPU / frequency / 2 / 64 - 1; + prescalarbits = TIMER == 0 ? 0b011 : 0b100; + if (ocr > 255) { + ocr = F_CPU / frequency / 2 / 128 - 1; + prescalarbits = 0b101; + } + + if (ocr > 255) { + ocr = F_CPU / frequency / 2 / 256 - 1; + prescalarbits = TIMER == 0 ? 0b100 : 0b110; + if (ocr > 255) { + // can't do any better than /1024 + ocr = F_CPU / frequency / 2 / 1024 - 1; + prescalarbits = TIMER == 0 ? 0b101 : 0b111; + } + } + } + } + TCCR2B = prescalarbits; + + if (duration_ms > 0) + remainingToneVsyncs = duration_ms*60/1000; //60 here represents the framerate + else + remainingToneVsyncs = -1; + + // Set the OCR for the given timer, + OCR2A = ocr; + //set it to toggle the pin by itself + TCCR2A &= ~(_BV(COM2A1)); //set COM2A1 to 0 + TCCR2A |= _BV(COM2A0); +} // end of tone + +/* Stops tone generation + */ +void TVout::noTone() { + TCCR2B = 0; + PORT_SND &= ~(_BV(SND_PIN)); //set pin 11 to 0 +} // end of noTone \ No newline at end of file diff --git a/demopal/lib/TVout/TVout.h b/demopal/lib/TVout/TVout.h new file mode 100755 index 0000000..c4e184a --- /dev/null +++ b/demopal/lib/TVout/TVout.h @@ -0,0 +1,177 @@ +/* +Copyright (c) 2010 Myles Metzer + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. +*/ +/* +This library provides a simple method for outputting data to a tv +from a frame buffer stored in sram. This implementation is done +completly by interupt and will return give as much cpu time to the +application as possible. +*/ +#ifndef TVOUT_H +#define TVOUT_H + +#include +#include +#include +#include +#include + +#include "video_gen.h" +#include "spec/hardware_setup.h" +#include "spec/video_properties.h" + +// macros for readability when selecting mode. +#define PAL 1 +#define NTSC 0 +#define _PAL 1 +#define _NTSC 0 + +#define WHITE 1 +#define BLACK 0 +#define INVERT 2 + +#define UP 0 +#define DOWN 1 +#define LEFT 2 +#define RIGHT 3 + +#define DEC 10 +#define HEX 16 +#define OCT 8 +#define BIN 2 +#define BYTE 0 + +// Macros for clearer usage +#define clear_screen() fill(0) +#define invert(color) fill(2) + +/* +TVout.cpp contains a brief expenation of each function. +*/ +class TVout { +public: + uint8_t * screen; + + char begin(uint8_t mode); + char begin(uint8_t mode, uint8_t x, uint8_t y); + void end(); + + //accessor functions + unsigned char hres(); + unsigned char vres(); + char char_line(); + + //flow control functions + void delay(unsigned int x); + void delay_frame(unsigned int x); + unsigned long millis(); + + //override setup functions + void force_vscale(char sfactor); + void force_outstart(uint8_t time); + void force_linestart(uint8_t line); + + //basic rendering functions + void set_pixel(uint8_t x, uint8_t y, char c); + unsigned char get_pixel(uint8_t x, uint8_t y); + void fill(uint8_t color); + void shift(uint8_t distance, uint8_t direction); + void draw_line(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1, char c); + void draw_row(uint8_t line, uint16_t x0, uint16_t x1, uint8_t c); + void draw_column(uint8_t row, uint16_t y0, uint16_t y1, uint8_t c); + void draw_rect(uint8_t x0, uint8_t y0, uint8_t w, uint8_t h, char c, char fc = -1); + void draw_circle(uint8_t x0, uint8_t y0, uint8_t radius, char c, char fc = -1); + void bitmap(uint8_t x, uint8_t y, const unsigned char * bmp, uint16_t i = 0, uint8_t width = 0, uint8_t lines = 0); + + //hook setup functions + void set_vbi_hook(void (*func)()); + void set_hbi_hook(void (*func)()); + + //tone functions + void tone(unsigned int frequency, unsigned long duration_ms); + void tone(unsigned int frequency); + void noTone(); + +//The following function definitions can be found in TVoutPrint.cpp +//printing functions + void print_char(uint8_t x, uint8_t y, unsigned char c); + void set_cursor(uint8_t, uint8_t); + void select_font(const unsigned char * f); + + void write(uint8_t); + void write(const char *str); + void write(const uint8_t *buffer, uint8_t size); + + void print(const char[]); + void print(char, int = BYTE); + void print(unsigned char, int = BYTE); + void print(int, int = DEC); + void print(unsigned int, int = DEC); + void print(long, int = DEC); + void print(unsigned long, int = DEC); + void print(double, int = 2); + + void print(uint8_t, uint8_t, const char[]); + void print(uint8_t, uint8_t, char, int = BYTE); + void print(uint8_t, uint8_t, unsigned char, int = BYTE); + void print(uint8_t, uint8_t, int, int = DEC); + void print(uint8_t, uint8_t, unsigned int, int = DEC); + void print(uint8_t, uint8_t, long, int = DEC); + void print(uint8_t, uint8_t, unsigned long, int = DEC); + void print(uint8_t, uint8_t, double, int = 2); + + void println(uint8_t, uint8_t, const char[]); + void println(uint8_t, uint8_t, char, int = BYTE); + void println(uint8_t, uint8_t, unsigned char, int = BYTE); + void println(uint8_t, uint8_t, int, int = DEC); + void println(uint8_t, uint8_t, unsigned int, int = DEC); + void println(uint8_t, uint8_t, long, int = DEC); + void println(uint8_t, uint8_t, unsigned long, int = DEC); + void println(uint8_t, uint8_t, double, int = 2); + void println(uint8_t, uint8_t); + + void println(const char[]); + void println(char, int = BYTE); + void println(unsigned char, int = BYTE); + void println(int, int = DEC); + void println(unsigned int, int = DEC); + void println(long, int = DEC); + void println(unsigned long, int = DEC); + void println(double, int = 2); + void println(void); + + void printPGM(const char[]); + void printPGM(uint8_t, uint8_t, const char[]); + +private: + uint8_t cursor_x,cursor_y; + const unsigned char * font; + + void inc_txtline(); + void printNumber(unsigned long, uint8_t); + void printFloat(double, uint8_t); +}; + +static void inline sp(unsigned char x, unsigned char y, char c); +#endif diff --git a/demopal/lib/TVout/TVoutPrint.cpp b/demopal/lib/TVout/TVoutPrint.cpp new file mode 100755 index 0000000..497e5a7 --- /dev/null +++ b/demopal/lib/TVout/TVoutPrint.cpp @@ -0,0 +1,380 @@ +/* +TVPrint.cpp - Base class that provides print() and println() +Copyright (c) 2008 David A. Mellis. All right reserved. + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2.1 of the License, or (at your option) any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Modified 23 November 2006 by David A. Mellis +*/ + +#include +#include + +#include "TVout.h" + +void TVout::select_font(const unsigned char * f) { + font = f; +} + +/* + * print an 8x8 char c at x,y + * x must be a multiple of 8 + */ +void TVout::print_char(uint8_t x, uint8_t y, unsigned char c) { + + c -= pgm_read_byte(font+2); + bitmap(x,y,font,(c*pgm_read_byte(font+1))+3,pgm_read_byte(font),pgm_read_byte(font+1)); +} + +void TVout::inc_txtline() { + if (cursor_y >= (display.vres - pgm_read_byte(font+1))) + shift(pgm_read_byte(font+1),UP); + else + cursor_y += pgm_read_byte(font+1); +} + +/* default implementation: may be overridden */ +void TVout::write(const char *str) +{ + while (*str) + write(*str++); +} + +/* default implementation: may be overridden */ +void TVout::write(const uint8_t *buffer, uint8_t size) +{ + while (size--) + write(*buffer++); +} + +void TVout::write(uint8_t c) { + switch(c) { + case '\0': //null + break; + case '\n': //line feed + cursor_x = 0; + inc_txtline(); + break; + case 8: //backspace + cursor_x -= pgm_read_byte(font); + print_char(cursor_x,cursor_y,' '); + break; + case 13: //carriage return !?!?!?!VT!?!??!?! + cursor_x = 0; + break; + case 14: //form feed new page(clear screen) + //clear_screen(); + break; + default: + if (cursor_x >= (display.hres*8 - pgm_read_byte(font))) { + cursor_x = 0; + inc_txtline(); + print_char(cursor_x,cursor_y,c); + } + else + print_char(cursor_x,cursor_y,c); + cursor_x += pgm_read_byte(font); + } +} + +void TVout::print(const char str[]) +{ + write(str); +} + +void TVout::print(char c, int base) +{ + print((long) c, base); +} + +void TVout::print(unsigned char b, int base) +{ + print((unsigned long) b, base); +} + +void TVout::print(int n, int base) +{ + print((long) n, base); +} + +void TVout::print(unsigned int n, int base) +{ + print((unsigned long) n, base); +} + +void TVout::print(long n, int base) +{ + if (base == 0) { + write(n); + } else if (base == 10) { + if (n < 0) { + print('-'); + n = -n; + } + printNumber(n, 10); + } else { + printNumber(n, base); + } +} + +void TVout::print(unsigned long n, int base) +{ + if (base == 0) write(n); + else printNumber(n, base); +} + +void TVout::print(double n, int digits) +{ + printFloat(n, digits); +} + +void TVout::println(void) +{ + print('\r'); + print('\n'); +} + +void TVout::println(const char c[]) +{ + print(c); + println(); +} + +void TVout::println(char c, int base) +{ + print(c, base); + println(); +} + +void TVout::println(unsigned char b, int base) +{ + print(b, base); + println(); +} + +void TVout::println(int n, int base) +{ + print(n, base); + println(); +} + +void TVout::println(unsigned int n, int base) +{ + print(n, base); + println(); +} + +void TVout::println(long n, int base) +{ + print(n, base); + println(); +} + +void TVout::println(unsigned long n, int base) +{ + print(n, base); + println(); +} + +void TVout::println(double n, int digits) +{ + print(n, digits); + println(); +} + +void TVout::printPGM(const char str[]) { + char c; + while ((c = pgm_read_byte(str))) { + str++; + write(c); + } +} + +void TVout::printPGM(uint8_t x, uint8_t y, const char str[]) { + char c; + cursor_x = x; + cursor_y = y; + while ((c = pgm_read_byte(str))) { + str++; + write(c); + } +} + +void TVout::set_cursor(uint8_t x, uint8_t y) { + cursor_x = x; + cursor_y = y; +} + +void TVout::print(uint8_t x, uint8_t y, const char str[]) { + cursor_x = x; + cursor_y = y; + write(str); + +} +void TVout::print(uint8_t x, uint8_t y, char c, int base) { + cursor_x = x; + cursor_y = y; + print((long) c, base); +} +void TVout::print(uint8_t x, uint8_t y, unsigned char b, int base) { + cursor_x = x; + cursor_y = y; + print((unsigned long) b, base); +} +void TVout::print(uint8_t x, uint8_t y, int n, int base) { + cursor_x = x; + cursor_y = y; + print((long) n, base); +} +void TVout::print(uint8_t x, uint8_t y, unsigned int n, int base) { + cursor_x = x; + cursor_y = y; + print((unsigned long) n, base); +} +void TVout::print(uint8_t x, uint8_t y, long n, int base) { + cursor_x = x; + cursor_y = y; + print(n,base); +} +void TVout::print(uint8_t x, uint8_t y, unsigned long n, int base) { + cursor_x = x; + cursor_y = y; + print(n,base); +} +void TVout::print(uint8_t x, uint8_t y, double n, int digits) { + cursor_x = x; + cursor_y = y; + print(n,digits); +} + +void TVout::println(uint8_t x, uint8_t y, const char c[]) +{ + cursor_x = x; + cursor_y = y; + print(c); + println(); +} + +void TVout::println(uint8_t x, uint8_t y, char c, int base) +{ + cursor_x = x; + cursor_y = y; + print(c, base); + println(); +} + +void TVout::println(uint8_t x, uint8_t y, unsigned char b, int base) +{ + cursor_x = x; + cursor_y = y; + print(b, base); + println(); +} + +void TVout::println(uint8_t x, uint8_t y, int n, int base) +{ + cursor_x = x; + cursor_y = y; + print(n, base); + println(); +} + +void TVout::println(uint8_t x, uint8_t y, unsigned int n, int base) +{ + cursor_x = x; + cursor_y = y; + print(n, base); + println(); +} + +void TVout::println(uint8_t x, uint8_t y, long n, int base) +{ + cursor_x = x; + cursor_y = y; + print(n, base); + println(); +} + +void TVout::println(uint8_t x, uint8_t y, unsigned long n, int base) +{ + cursor_x = x; + cursor_y = y; + print(n, base); + println(); +} + +void TVout::println(uint8_t x, uint8_t y, double n, int digits) +{ + cursor_x = x; + cursor_y = y; + print(n, digits); + println(); +} + +void TVout::printNumber(unsigned long n, uint8_t base) +{ + unsigned char buf[8 * sizeof(long)]; // Assumes 8-bit chars. + unsigned long i = 0; + + if (n == 0) { + print('0'); + return; + } + + while (n > 0) { + buf[i++] = n % base; + n /= base; + } + + for (; i > 0; i--) + print((char) (buf[i - 1] < 10 ? + '0' + buf[i - 1] : + 'A' + buf[i - 1] - 10)); +} + +void TVout::printFloat(double number, uint8_t digits) +{ + // Handle negative numbers + if (number < 0.0) + { + print('-'); + number = -number; + } + + // Round correctly so that print(1.999, 2) prints as "2.00" + double rounding = 0.5; + for (uint8_t i=0; i 0) + print("."); + + // Extract digits from the remainder one at a time + while (digits-- > 0) + { + remainder *= 10.0; + int toPrint = int(remainder); + print(toPrint); + remainder -= toPrint; + } +} \ No newline at end of file diff --git a/demopal/lib/TVout/examples/DemoNTSC/DemoNTSC.pde b/demopal/lib/TVout/examples/DemoNTSC/DemoNTSC.pde new file mode 100755 index 0000000..7ad6232 --- /dev/null +++ b/demopal/lib/TVout/examples/DemoNTSC/DemoNTSC.pde @@ -0,0 +1,217 @@ +#include +#include +#include "schematic.h" +#include "TVOlogo.h" + +TVout TV; + +int zOff = 150; +int xOff = 0; +int yOff = 0; +int cSize = 50; +int view_plane = 64; +float angle = PI/60; + +float cube3d[8][3] = { + {xOff - cSize,yOff + cSize,zOff - cSize}, + {xOff + cSize,yOff + cSize,zOff - cSize}, + {xOff - cSize,yOff - cSize,zOff - cSize}, + {xOff + cSize,yOff - cSize,zOff - cSize}, + {xOff - cSize,yOff + cSize,zOff + cSize}, + {xOff + cSize,yOff + cSize,zOff + cSize}, + {xOff - cSize,yOff - cSize,zOff + cSize}, + {xOff + cSize,yOff - cSize,zOff + cSize} +}; +unsigned char cube2d[8][2]; + + +void setup() { + TV.begin(NTSC,120,96); + TV.select_font(font6x8); + intro(); + TV.println("I am the TVout\nlibrary running on a freeduino\n"); + TV.delay(2500); + TV.println("I generate a PAL\nor NTSC composite video using\ninterrupts\n"); + TV.delay(2500); + TV.println("My schematic:"); + TV.delay(1500); + TV.bitmap(0,0,schematic); + TV.delay(10000); + TV.clear_screen(); + TV.println("Lets see what\nwhat I can do"); + TV.delay(2000); + + //fonts + TV.clear_screen(); + TV.println(0,0,"Multiple fonts:"); + TV.select_font(font4x6); + TV.println("4x6 font FONT"); + TV.select_font(font6x8); + TV.println("6x8 font FONT"); + TV.select_font(font8x8); + TV.println("8x8 font FONT"); + TV.select_font(font6x8); + TV.delay(2000); + + TV.clear_screen(); + TV.print(9,44,"Draw Basic Shapes"); + TV.delay(2000); + + //circles + TV.clear_screen(); + TV.draw_circle(TV.hres()/2,TV.vres()/2,TV.vres()/3,WHITE); + TV.delay(500); + TV.draw_circle(TV.hres()/2,TV.vres()/2,TV.vres()/2,WHITE,INVERT); + TV.delay(2000); + + //rectangles and lines + TV.clear_screen(); + TV.draw_rect(20,20,80,56,WHITE); + TV.delay(500); + TV.draw_rect(10,10,100,76,WHITE,INVERT); + TV.delay(500); + TV.draw_line(60,20,60,76,INVERT); + TV.draw_line(20,48,100,48,INVERT); + TV.delay(500); + TV.draw_line(10,10,110,86,INVERT); + TV.draw_line(10,86,110,10,INVERT); + TV.delay(2000); + + //random cube forever. + TV.clear_screen(); + TV.print(16,40,"Random Cube"); + TV.print(28,48,"Rotation"); + TV.delay(2000); + + randomSeed(analogRead(0)); +} + +void loop() { + int rsteps = random(10,60); + switch(random(6)) { + case 0: + for (int i = 0; i < rsteps; i++) { + zrotate(angle); + printcube(); + } + break; + case 1: + for (int i = 0; i < rsteps; i++) { + zrotate(2*PI - angle); + printcube(); + } + break; + case 2: + for (int i = 0; i < rsteps; i++) { + xrotate(angle); + printcube(); + } + break; + case 3: + for (int i = 0; i < rsteps; i++) { + xrotate(2*PI - angle); + printcube(); + } + break; + case 4: + for (int i = 0; i < rsteps; i++) { + yrotate(angle); + printcube(); + } + break; + case 5: + for (int i = 0; i < rsteps; i++) { + yrotate(2*PI - angle); + printcube(); + } + break; + } +} + +void intro() { +unsigned char w,l,wb; + int index; + w = pgm_read_byte(TVOlogo); + l = pgm_read_byte(TVOlogo+1); + if (w&7) + wb = w/8 + 1; + else + wb = w/8; + index = wb*(l-1) + 2; + for ( unsigned char i = 1; i < l; i++ ) { + TV.bitmap((TV.hres() - w)/2,0,TVOlogo,index,w,i); + index-= wb; + TV.delay(50); + } + for (unsigned char i = 0; i < (TV.vres() - l)/2; i++) { + TV.bitmap((TV.hres() - w)/2,i,TVOlogo); + TV.delay(50); + } + TV.delay(3000); + TV.clear_screen(); +} + +void printcube() { + //calculate 2d points + for(byte i = 0; i < 8; i++) { + cube2d[i][0] = (unsigned char)((cube3d[i][0] * view_plane / cube3d[i][2]) + (TV.hres()/2)); + cube2d[i][1] = (unsigned char)((cube3d[i][1] * view_plane / cube3d[i][2]) + (TV.vres()/2)); + } + TV.delay_frame(1); + TV.clear_screen(); + draw_cube(); +} + +void zrotate(float q) { + float tx,ty,temp; + for(byte i = 0; i < 8; i++) { + tx = cube3d[i][0] - xOff; + ty = cube3d[i][1] - yOff; + temp = tx * cos(q) - ty * sin(q); + ty = tx * sin(q) + ty * cos(q); + tx = temp; + cube3d[i][0] = tx + xOff; + cube3d[i][1] = ty + yOff; + } +} + +void yrotate(float q) { + float tx,tz,temp; + for(byte i = 0; i < 8; i++) { + tx = cube3d[i][0] - xOff; + tz = cube3d[i][2] - zOff; + temp = tz * cos(q) - tx * sin(q); + tx = tz * sin(q) + tx * cos(q); + tz = temp; + cube3d[i][0] = tx + xOff; + cube3d[i][2] = tz + zOff; + } +} + +void xrotate(float q) { + float ty,tz,temp; + for(byte i = 0; i < 8; i++) { + ty = cube3d[i][1] - yOff; + tz = cube3d[i][2] - zOff; + temp = ty * cos(q) - tz * sin(q); + tz = ty * sin(q) + tz * cos(q); + ty = temp; + cube3d[i][1] = ty + yOff; + cube3d[i][2] = tz + zOff; + } +} + +void draw_cube() { + TV.draw_line(cube2d[0][0],cube2d[0][1],cube2d[1][0],cube2d[1][1],WHITE); + TV.draw_line(cube2d[0][0],cube2d[0][1],cube2d[2][0],cube2d[2][1],WHITE); + TV.draw_line(cube2d[0][0],cube2d[0][1],cube2d[4][0],cube2d[4][1],WHITE); + TV.draw_line(cube2d[1][0],cube2d[1][1],cube2d[5][0],cube2d[5][1],WHITE); + TV.draw_line(cube2d[1][0],cube2d[1][1],cube2d[3][0],cube2d[3][1],WHITE); + TV.draw_line(cube2d[2][0],cube2d[2][1],cube2d[6][0],cube2d[6][1],WHITE); + TV.draw_line(cube2d[2][0],cube2d[2][1],cube2d[3][0],cube2d[3][1],WHITE); + TV.draw_line(cube2d[4][0],cube2d[4][1],cube2d[6][0],cube2d[6][1],WHITE); + TV.draw_line(cube2d[4][0],cube2d[4][1],cube2d[5][0],cube2d[5][1],WHITE); + TV.draw_line(cube2d[7][0],cube2d[7][1],cube2d[6][0],cube2d[6][1],WHITE); + TV.draw_line(cube2d[7][0],cube2d[7][1],cube2d[3][0],cube2d[3][1],WHITE); + TV.draw_line(cube2d[7][0],cube2d[7][1],cube2d[5][0],cube2d[5][1],WHITE); +} diff --git a/demopal/lib/TVout/examples/DemoNTSC/TVOlogo.cpp b/demopal/lib/TVout/examples/DemoNTSC/TVOlogo.cpp new file mode 100755 index 0000000..6435656 --- /dev/null +++ b/demopal/lib/TVout/examples/DemoNTSC/TVOlogo.cpp @@ -0,0 +1,37 @@ +#include "TVOlogo.h" +PROGMEM const unsigned char TVOlogo[] = { +96,32, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x3F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFC,0x00, +0x03,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xC0, +0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x10,0x38, +0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x04, +0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x40,0x02, +0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0A,0x80,0x02, +0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x02, +0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xFF,0xFF,0xC2, +0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x42, +0x4F,0xFF,0x60,0x18,0x00,0x00,0x00,0x00,0x17,0xFF,0xFF,0x42, +0x4F,0xFF,0x60,0x18,0x00,0x00,0x00,0x30,0x14,0x00,0x01,0x42, +0x40,0x60,0x60,0x18,0x00,0x00,0x00,0x30,0x14,0x70,0x71,0x42, +0x40,0x60,0x30,0x30,0x00,0x00,0x00,0x30,0x14,0x88,0x89,0x42, +0x40,0x60,0x30,0x30,0x3E,0x06,0x0C,0xFE,0x15,0x05,0x25,0x42, +0x40,0x60,0x30,0x60,0xFF,0x86,0x0C,0xFE,0x15,0x72,0x75,0x42, +0x40,0x60,0x18,0x60,0xC1,0x86,0x0C,0x30,0x15,0x05,0x25,0x42, +0x40,0x60,0x18,0x61,0x80,0xC6,0x0C,0x30,0x14,0x88,0x89,0x42, +0x40,0x60,0x18,0xC1,0x80,0xC6,0x0C,0x30,0x14,0x70,0x71,0x42, +0x40,0x60,0x0C,0xC1,0x80,0xC6,0x0C,0x30,0x14,0x00,0x01,0x42, +0x40,0x60,0x0C,0xC1,0x80,0xC6,0x0C,0x30,0x17,0xFF,0xFF,0x42, +0x40,0x60,0x0F,0x81,0x80,0xC6,0x0C,0x30,0x10,0x00,0x00,0x42, +0x40,0x60,0x07,0x80,0xC1,0x87,0x1C,0x30,0x15,0x40,0x15,0x42, +0x40,0x60,0x07,0x80,0xFF,0x83,0xFC,0x3E,0x12,0x8A,0x8A,0x42, +0x40,0x60,0x03,0x00,0x3E,0x01,0xEC,0x1E,0x15,0x40,0x15,0x42, +0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x42, +0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xFF,0xFF,0xC2, +0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04, +0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38, +0x03,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xC0, +0x00,0x3F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFC,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + +}; diff --git a/demopal/lib/TVout/examples/DemoNTSC/TVOlogo.h b/demopal/lib/TVout/examples/DemoNTSC/TVOlogo.h new file mode 100755 index 0000000..3c1d56a --- /dev/null +++ b/demopal/lib/TVout/examples/DemoNTSC/TVOlogo.h @@ -0,0 +1,6 @@ +#include +#ifndef TVOLOGO_H +#define TVOLOGO_H + +extern const unsigned char TVOlogo[]; +#endif \ No newline at end of file diff --git a/demopal/lib/TVout/examples/DemoNTSC/schematic.cpp b/demopal/lib/TVout/examples/DemoNTSC/schematic.cpp new file mode 100755 index 0000000..dcf0d1d --- /dev/null +++ b/demopal/lib/TVout/examples/DemoNTSC/schematic.cpp @@ -0,0 +1,101 @@ +#include "schematic.h" + +PROGMEM const unsigned char schematic[] = { +120,96, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x0F,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFE, +0x08,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x02, +0x08,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x02, +0x0B,0x0C,0xE4,0x41,0x00,0x00,0x03,0x12,0x0E,0x22,0x61,0x80,0xB8,0x71,0x82, +0x0B,0x0D,0x94,0x41,0x00,0x00,0x05,0x14,0x11,0x22,0x61,0x80,0xA4,0xC9,0x82, +0x0A,0x95,0x04,0x41,0x00,0x00,0x01,0x14,0x11,0x22,0x52,0x80,0xA4,0x81,0x42, +0x0A,0x95,0x04,0x41,0x00,0x00,0x01,0x18,0x11,0x3E,0x52,0x80,0xB8,0x82,0x42, +0x0A,0x65,0x04,0x41,0x00,0x00,0x01,0x14,0x11,0x22,0x4C,0x80,0xA4,0x83,0xC2, +0x0A,0x65,0x94,0x41,0x00,0x00,0x01,0x12,0x11,0x22,0x4C,0x80,0xA4,0xCA,0x22, +0x0A,0x64,0xE3,0x81,0x00,0x00,0x07,0x92,0x0E,0x22,0x4C,0x80,0xA4,0x74,0x22, +0x08,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x02, +0x0F,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFE, +0x08,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x02, +0x08,0x70,0x00,0x01,0x00,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x80,0x00,0x02, +0x08,0x90,0x00,0x01,0x00,0x00,0x02,0x80,0x02,0x80,0x02,0x80,0x80,0x00,0x02, +0x08,0x84,0x5E,0x39,0x00,0x00,0x04,0x40,0x04,0x40,0x04,0x40,0x80,0x00,0x02, +0x08,0x64,0x92,0x41,0x00,0x00,0x08,0x20,0x08,0x20,0x08,0x20,0x80,0x00,0x02, +0x08,0x12,0x92,0x41,0xFF,0xFF,0xF0,0x10,0x10,0x10,0x10,0x1C,0x80,0x00,0x02, +0x08,0x92,0x92,0x41,0x00,0x00,0x00,0x08,0x20,0x08,0x20,0x04,0x80,0x00,0x02, +0x08,0xE1,0x12,0x39,0x00,0x00,0x00,0x04,0x40,0x04,0x40,0x04,0xA1,0x4F,0x02, +0x08,0x01,0x00,0x01,0x00,0x00,0x00,0x02,0x80,0x02,0x80,0x04,0xB3,0x49,0x82, +0x08,0x02,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x04,0x92,0x48,0x82, +0x08,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x92,0x48,0x82, +0x08,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x9C,0x48,0x82, +0x08,0x00,0x00,0x01,0x00,0x00,0x01,0x00,0x01,0x00,0x01,0x04,0x8C,0x49,0x82, +0x08,0x02,0x14,0xF1,0x00,0x00,0x02,0x80,0x02,0x80,0x02,0x84,0x8C,0x4F,0x02, +0x08,0x03,0x34,0x99,0x00,0x00,0x04,0x40,0x04,0x40,0x04,0x44,0x80,0x00,0x02, +0x08,0x01,0x24,0x89,0x00,0x00,0x08,0x20,0x08,0x20,0x08,0x24,0x80,0x00,0x02, +0x08,0x01,0x24,0x89,0xFF,0xFF,0xF0,0x10,0x10,0x10,0x10,0x1C,0x80,0x00,0x02, +0x08,0x01,0xC4,0x89,0x00,0x00,0x00,0x08,0x20,0x08,0x20,0x00,0x80,0x00,0x02, +0x08,0x00,0xC4,0x99,0x00,0x00,0x00,0x04,0x40,0x04,0x40,0x00,0x80,0x00,0x02, +0x08,0x00,0xC4,0xF1,0x00,0x00,0x00,0x02,0x80,0x02,0x80,0x00,0x80,0x00,0x02, +0x08,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x00,0x80,0x00,0x02, +0x08,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x02, +0x08,0x00,0x00,0x01,0x00,0x00,0x0C,0xF9,0xC1,0xC4,0x4C,0x30,0x80,0x00,0x02, +0x08,0x00,0x00,0x01,0x00,0x00,0x14,0x1A,0x42,0x24,0x4C,0x30,0x80,0x00,0x02, +0x08,0x00,0x00,0x01,0x00,0x00,0x34,0x12,0x42,0x24,0x4A,0x50,0x80,0x00,0x02, +0x08,0x00,0x00,0x01,0x00,0x00,0x24,0x32,0x42,0x27,0xCA,0x50,0x80,0x00,0x02, +0x08,0x00,0x00,0x01,0x00,0x00,0x3E,0x22,0x42,0x24,0x49,0x90,0x80,0x00,0x02, +0x08,0x00,0x00,0x01,0x00,0x00,0x04,0x62,0x42,0x24,0x49,0x90,0x80,0x00,0x02, +0x08,0x1E,0x64,0xF1,0x00,0x00,0x04,0x43,0x81,0xC4,0x49,0x90,0x9E,0x64,0xF2, +0x08,0x32,0x64,0x99,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xB2,0x64,0x9A, +0x08,0x20,0x54,0x89,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xA0,0x54,0x8A, +0x08,0x26,0x54,0x89,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xA6,0x54,0x8A, +0x08,0x22,0x4C,0x89,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xA2,0x4C,0x8A, +0x08,0x32,0x4C,0x99,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xB2,0x4C,0x9A, +0x08,0x1E,0x4C,0xF1,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x9E,0x4C,0xF2, +0x08,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x02, +0x0F,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFE, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x30,0x00,0x00,0x04,0x00,0x00,0x40,0x00,0x00,0x00,0x03,0x81,0xC6,0x04,0x00, +0x48,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x04,0x42,0x2A,0x04,0x00, +0x42,0x25,0x87,0x04,0x38,0x3C,0x48,0x8B,0xC8,0x8E,0x08,0x24,0x02,0x0A,0x00, +0x22,0x26,0x48,0x04,0x40,0x02,0x48,0x88,0x28,0x90,0x08,0x24,0x02,0x0A,0x00, +0x11,0x44,0x48,0x04,0x60,0x1E,0x45,0x51,0xE5,0x18,0x08,0x24,0x02,0x11,0x00, +0x09,0x44,0x48,0x04,0x18,0x22,0x45,0x52,0x25,0x06,0x08,0x24,0x02,0x1F,0x00, +0x48,0x84,0x48,0x04,0x08,0x22,0x42,0x22,0x22,0x02,0x04,0x42,0x22,0x20,0x80, +0x30,0x84,0x47,0x04,0x70,0x1E,0x42,0x21,0xE2,0x1C,0x03,0x81,0xCF,0xA0,0x80, +0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00, +0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x82,0x8F,0x01,0x00,0x00,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80, +0x82,0x88,0x80,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80, +0x44,0x88,0x41,0x0E,0x0F,0x02,0x03,0x8B,0x03,0xC5,0x91,0x07,0x87,0x17,0xE0, +0x44,0x88,0x41,0x10,0x08,0x82,0x04,0x4C,0x80,0x26,0x51,0x04,0x48,0x98,0x80, +0x28,0x88,0x41,0x18,0x08,0x84,0x04,0x48,0x81,0xE4,0x4A,0x04,0x48,0x90,0x80, +0x28,0x88,0x41,0x06,0x08,0x84,0x04,0x48,0x82,0x24,0x4A,0x04,0x48,0x90,0x80, +0x10,0x88,0x81,0x02,0x08,0x88,0x04,0x48,0x82,0x24,0x44,0x04,0x48,0x90,0x80, +0x10,0x8F,0x01,0x1C,0x0F,0x08,0x03,0x88,0x81,0xE4,0x44,0x07,0x87,0x10,0x60, +0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x08,0x04,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x08,0x04,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 +}; diff --git a/demopal/lib/TVout/examples/DemoNTSC/schematic.h b/demopal/lib/TVout/examples/DemoNTSC/schematic.h new file mode 100755 index 0000000..4d0b270 --- /dev/null +++ b/demopal/lib/TVout/examples/DemoNTSC/schematic.h @@ -0,0 +1,6 @@ +#include +#ifndef SHEMATIC_H +#define SHEMATIC_H + +extern const unsigned char schematic[]; +#endif diff --git a/demopal/lib/TVout/examples/DemoPAL/DemoPAL.pde b/demopal/lib/TVout/examples/DemoPAL/DemoPAL.pde new file mode 100755 index 0000000..80cc885 --- /dev/null +++ b/demopal/lib/TVout/examples/DemoPAL/DemoPAL.pde @@ -0,0 +1,217 @@ +#include +#include +#include "schematic.h" +#include "TVOlogo.h" + +TVout TV; + +int zOff = 150; +int xOff = 0; +int yOff = 0; +int cSize = 50; +int view_plane = 64; +float angle = PI/60; + +float cube3d[8][3] = { + {xOff - cSize,yOff + cSize,zOff - cSize}, + {xOff + cSize,yOff + cSize,zOff - cSize}, + {xOff - cSize,yOff - cSize,zOff - cSize}, + {xOff + cSize,yOff - cSize,zOff - cSize}, + {xOff - cSize,yOff + cSize,zOff + cSize}, + {xOff + cSize,yOff + cSize,zOff + cSize}, + {xOff - cSize,yOff - cSize,zOff + cSize}, + {xOff + cSize,yOff - cSize,zOff + cSize} +}; +unsigned char cube2d[8][2]; + + +void setup() { + TV.begin(PAL,120,96); + TV.select_font(font6x8); + intro(); + TV.println("I am the TVout\nlibrary running on a freeduino\n"); + TV.delay(2500); + TV.println("I generate a PAL\nor NTSC composite video using\ninterrupts\n"); + TV.delay(2500); + TV.println("My schematic:"); + TV.delay(1500); + TV.bitmap(0,0,schematic); + TV.delay(10000); + TV.clear_screen(); + TV.println("Lets see what\nwhat I can do"); + TV.delay(2000); + + //fonts + TV.clear_screen(); + TV.println(0,0,"Multiple fonts:"); + TV.select_font(font4x6); + TV.println("4x6 font FONT"); + TV.select_font(font6x8); + TV.println("6x8 font FONT"); + TV.select_font(font8x8); + TV.println("8x8 font FONT"); + TV.select_font(font6x8); + TV.delay(2000); + + TV.clear_screen(); + TV.print(9,44,"Draw Basic Shapes"); + TV.delay(2000); + + //circles + TV.clear_screen(); + TV.draw_circle(TV.hres()/2,TV.vres()/2,TV.vres()/3,WHITE); + TV.delay(500); + TV.draw_circle(TV.hres()/2,TV.vres()/2,TV.vres()/2,WHITE,INVERT); + TV.delay(2000); + + //rectangles and lines + TV.clear_screen(); + TV.draw_rect(20,20,80,56,WHITE); + TV.delay(500); + TV.draw_rect(10,10,100,76,WHITE,INVERT); + TV.delay(500); + TV.draw_line(60,20,60,76,INVERT); + TV.draw_line(20,48,100,48,INVERT); + TV.delay(500); + TV.draw_line(10,10,110,86,INVERT); + TV.draw_line(10,86,110,10,INVERT); + TV.delay(2000); + + //random cube forever. + TV.clear_screen(); + TV.print(16,40,"Random Cube"); + TV.print(28,48,"Rotation"); + TV.delay(2000); + + randomSeed(analogRead(0)); +} + +void loop() { + int rsteps = random(10,60); + switch(random(6)) { + case 0: + for (int i = 0; i < rsteps; i++) { + zrotate(angle); + printcube(); + } + break; + case 1: + for (int i = 0; i < rsteps; i++) { + zrotate(2*PI - angle); + printcube(); + } + break; + case 2: + for (int i = 0; i < rsteps; i++) { + xrotate(angle); + printcube(); + } + break; + case 3: + for (int i = 0; i < rsteps; i++) { + xrotate(2*PI - angle); + printcube(); + } + break; + case 4: + for (int i = 0; i < rsteps; i++) { + yrotate(angle); + printcube(); + } + break; + case 5: + for (int i = 0; i < rsteps; i++) { + yrotate(2*PI - angle); + printcube(); + } + break; + } +} + +void intro() { +unsigned char w,l,wb; + int index; + w = pgm_read_byte(TVOlogo); + l = pgm_read_byte(TVOlogo+1); + if (w&7) + wb = w/8 + 1; + else + wb = w/8; + index = wb*(l-1) + 2; + for ( unsigned char i = 1; i < l; i++ ) { + TV.bitmap((TV.hres() - w)/2,0,TVOlogo,index,w,i); + index-= wb; + TV.delay(50); + } + for (unsigned char i = 0; i < (TV.vres() - l)/2; i++) { + TV.bitmap((TV.hres() - w)/2,i,TVOlogo); + TV.delay(50); + } + TV.delay(3000); + TV.clear_screen(); +} + +void printcube() { + //calculate 2d points + for(byte i = 0; i < 8; i++) { + cube2d[i][0] = (unsigned char)((cube3d[i][0] * view_plane / cube3d[i][2]) + (TV.hres()/2)); + cube2d[i][1] = (unsigned char)((cube3d[i][1] * view_plane / cube3d[i][2]) + (TV.vres()/2)); + } + TV.delay_frame(1); + TV.clear_screen(); + draw_cube(); +} + +void zrotate(float q) { + float tx,ty,temp; + for(byte i = 0; i < 8; i++) { + tx = cube3d[i][0] - xOff; + ty = cube3d[i][1] - yOff; + temp = tx * cos(q) - ty * sin(q); + ty = tx * sin(q) + ty * cos(q); + tx = temp; + cube3d[i][0] = tx + xOff; + cube3d[i][1] = ty + yOff; + } +} + +void yrotate(float q) { + float tx,tz,temp; + for(byte i = 0; i < 8; i++) { + tx = cube3d[i][0] - xOff; + tz = cube3d[i][2] - zOff; + temp = tz * cos(q) - tx * sin(q); + tx = tz * sin(q) + tx * cos(q); + tz = temp; + cube3d[i][0] = tx + xOff; + cube3d[i][2] = tz + zOff; + } +} + +void xrotate(float q) { + float ty,tz,temp; + for(byte i = 0; i < 8; i++) { + ty = cube3d[i][1] - yOff; + tz = cube3d[i][2] - zOff; + temp = ty * cos(q) - tz * sin(q); + tz = ty * sin(q) + tz * cos(q); + ty = temp; + cube3d[i][1] = ty + yOff; + cube3d[i][2] = tz + zOff; + } +} + +void draw_cube() { + TV.draw_line(cube2d[0][0],cube2d[0][1],cube2d[1][0],cube2d[1][1],WHITE); + TV.draw_line(cube2d[0][0],cube2d[0][1],cube2d[2][0],cube2d[2][1],WHITE); + TV.draw_line(cube2d[0][0],cube2d[0][1],cube2d[4][0],cube2d[4][1],WHITE); + TV.draw_line(cube2d[1][0],cube2d[1][1],cube2d[5][0],cube2d[5][1],WHITE); + TV.draw_line(cube2d[1][0],cube2d[1][1],cube2d[3][0],cube2d[3][1],WHITE); + TV.draw_line(cube2d[2][0],cube2d[2][1],cube2d[6][0],cube2d[6][1],WHITE); + TV.draw_line(cube2d[2][0],cube2d[2][1],cube2d[3][0],cube2d[3][1],WHITE); + TV.draw_line(cube2d[4][0],cube2d[4][1],cube2d[6][0],cube2d[6][1],WHITE); + TV.draw_line(cube2d[4][0],cube2d[4][1],cube2d[5][0],cube2d[5][1],WHITE); + TV.draw_line(cube2d[7][0],cube2d[7][1],cube2d[6][0],cube2d[6][1],WHITE); + TV.draw_line(cube2d[7][0],cube2d[7][1],cube2d[3][0],cube2d[3][1],WHITE); + TV.draw_line(cube2d[7][0],cube2d[7][1],cube2d[5][0],cube2d[5][1],WHITE); +} diff --git a/demopal/lib/TVout/examples/DemoPAL/TVOlogo.cpp b/demopal/lib/TVout/examples/DemoPAL/TVOlogo.cpp new file mode 100755 index 0000000..6435656 --- /dev/null +++ b/demopal/lib/TVout/examples/DemoPAL/TVOlogo.cpp @@ -0,0 +1,37 @@ +#include "TVOlogo.h" +PROGMEM const unsigned char TVOlogo[] = { +96,32, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x3F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFC,0x00, +0x03,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xC0, +0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x10,0x38, +0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x04, +0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x40,0x02, +0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0A,0x80,0x02, +0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x02, +0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xFF,0xFF,0xC2, +0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x42, +0x4F,0xFF,0x60,0x18,0x00,0x00,0x00,0x00,0x17,0xFF,0xFF,0x42, +0x4F,0xFF,0x60,0x18,0x00,0x00,0x00,0x30,0x14,0x00,0x01,0x42, +0x40,0x60,0x60,0x18,0x00,0x00,0x00,0x30,0x14,0x70,0x71,0x42, +0x40,0x60,0x30,0x30,0x00,0x00,0x00,0x30,0x14,0x88,0x89,0x42, +0x40,0x60,0x30,0x30,0x3E,0x06,0x0C,0xFE,0x15,0x05,0x25,0x42, +0x40,0x60,0x30,0x60,0xFF,0x86,0x0C,0xFE,0x15,0x72,0x75,0x42, +0x40,0x60,0x18,0x60,0xC1,0x86,0x0C,0x30,0x15,0x05,0x25,0x42, +0x40,0x60,0x18,0x61,0x80,0xC6,0x0C,0x30,0x14,0x88,0x89,0x42, +0x40,0x60,0x18,0xC1,0x80,0xC6,0x0C,0x30,0x14,0x70,0x71,0x42, +0x40,0x60,0x0C,0xC1,0x80,0xC6,0x0C,0x30,0x14,0x00,0x01,0x42, +0x40,0x60,0x0C,0xC1,0x80,0xC6,0x0C,0x30,0x17,0xFF,0xFF,0x42, +0x40,0x60,0x0F,0x81,0x80,0xC6,0x0C,0x30,0x10,0x00,0x00,0x42, +0x40,0x60,0x07,0x80,0xC1,0x87,0x1C,0x30,0x15,0x40,0x15,0x42, +0x40,0x60,0x07,0x80,0xFF,0x83,0xFC,0x3E,0x12,0x8A,0x8A,0x42, +0x40,0x60,0x03,0x00,0x3E,0x01,0xEC,0x1E,0x15,0x40,0x15,0x42, +0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x42, +0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xFF,0xFF,0xC2, +0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04, +0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38, +0x03,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xC0, +0x00,0x3F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFC,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + +}; diff --git a/demopal/lib/TVout/examples/DemoPAL/TVOlogo.h b/demopal/lib/TVout/examples/DemoPAL/TVOlogo.h new file mode 100755 index 0000000..3c1d56a --- /dev/null +++ b/demopal/lib/TVout/examples/DemoPAL/TVOlogo.h @@ -0,0 +1,6 @@ +#include +#ifndef TVOLOGO_H +#define TVOLOGO_H + +extern const unsigned char TVOlogo[]; +#endif \ No newline at end of file diff --git a/demopal/lib/TVout/examples/DemoPAL/schematic.cpp b/demopal/lib/TVout/examples/DemoPAL/schematic.cpp new file mode 100755 index 0000000..dcf0d1d --- /dev/null +++ b/demopal/lib/TVout/examples/DemoPAL/schematic.cpp @@ -0,0 +1,101 @@ +#include "schematic.h" + +PROGMEM const unsigned char schematic[] = { +120,96, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x0F,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFE, +0x08,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x02, +0x08,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x02, +0x0B,0x0C,0xE4,0x41,0x00,0x00,0x03,0x12,0x0E,0x22,0x61,0x80,0xB8,0x71,0x82, +0x0B,0x0D,0x94,0x41,0x00,0x00,0x05,0x14,0x11,0x22,0x61,0x80,0xA4,0xC9,0x82, +0x0A,0x95,0x04,0x41,0x00,0x00,0x01,0x14,0x11,0x22,0x52,0x80,0xA4,0x81,0x42, +0x0A,0x95,0x04,0x41,0x00,0x00,0x01,0x18,0x11,0x3E,0x52,0x80,0xB8,0x82,0x42, +0x0A,0x65,0x04,0x41,0x00,0x00,0x01,0x14,0x11,0x22,0x4C,0x80,0xA4,0x83,0xC2, +0x0A,0x65,0x94,0x41,0x00,0x00,0x01,0x12,0x11,0x22,0x4C,0x80,0xA4,0xCA,0x22, +0x0A,0x64,0xE3,0x81,0x00,0x00,0x07,0x92,0x0E,0x22,0x4C,0x80,0xA4,0x74,0x22, +0x08,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x02, +0x0F,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFE, +0x08,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x02, +0x08,0x70,0x00,0x01,0x00,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x80,0x00,0x02, +0x08,0x90,0x00,0x01,0x00,0x00,0x02,0x80,0x02,0x80,0x02,0x80,0x80,0x00,0x02, +0x08,0x84,0x5E,0x39,0x00,0x00,0x04,0x40,0x04,0x40,0x04,0x40,0x80,0x00,0x02, +0x08,0x64,0x92,0x41,0x00,0x00,0x08,0x20,0x08,0x20,0x08,0x20,0x80,0x00,0x02, +0x08,0x12,0x92,0x41,0xFF,0xFF,0xF0,0x10,0x10,0x10,0x10,0x1C,0x80,0x00,0x02, +0x08,0x92,0x92,0x41,0x00,0x00,0x00,0x08,0x20,0x08,0x20,0x04,0x80,0x00,0x02, +0x08,0xE1,0x12,0x39,0x00,0x00,0x00,0x04,0x40,0x04,0x40,0x04,0xA1,0x4F,0x02, +0x08,0x01,0x00,0x01,0x00,0x00,0x00,0x02,0x80,0x02,0x80,0x04,0xB3,0x49,0x82, +0x08,0x02,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x04,0x92,0x48,0x82, +0x08,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x92,0x48,0x82, +0x08,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x9C,0x48,0x82, +0x08,0x00,0x00,0x01,0x00,0x00,0x01,0x00,0x01,0x00,0x01,0x04,0x8C,0x49,0x82, +0x08,0x02,0x14,0xF1,0x00,0x00,0x02,0x80,0x02,0x80,0x02,0x84,0x8C,0x4F,0x02, +0x08,0x03,0x34,0x99,0x00,0x00,0x04,0x40,0x04,0x40,0x04,0x44,0x80,0x00,0x02, +0x08,0x01,0x24,0x89,0x00,0x00,0x08,0x20,0x08,0x20,0x08,0x24,0x80,0x00,0x02, +0x08,0x01,0x24,0x89,0xFF,0xFF,0xF0,0x10,0x10,0x10,0x10,0x1C,0x80,0x00,0x02, +0x08,0x01,0xC4,0x89,0x00,0x00,0x00,0x08,0x20,0x08,0x20,0x00,0x80,0x00,0x02, +0x08,0x00,0xC4,0x99,0x00,0x00,0x00,0x04,0x40,0x04,0x40,0x00,0x80,0x00,0x02, +0x08,0x00,0xC4,0xF1,0x00,0x00,0x00,0x02,0x80,0x02,0x80,0x00,0x80,0x00,0x02, +0x08,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x00,0x80,0x00,0x02, +0x08,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x02, +0x08,0x00,0x00,0x01,0x00,0x00,0x0C,0xF9,0xC1,0xC4,0x4C,0x30,0x80,0x00,0x02, +0x08,0x00,0x00,0x01,0x00,0x00,0x14,0x1A,0x42,0x24,0x4C,0x30,0x80,0x00,0x02, +0x08,0x00,0x00,0x01,0x00,0x00,0x34,0x12,0x42,0x24,0x4A,0x50,0x80,0x00,0x02, +0x08,0x00,0x00,0x01,0x00,0x00,0x24,0x32,0x42,0x27,0xCA,0x50,0x80,0x00,0x02, +0x08,0x00,0x00,0x01,0x00,0x00,0x3E,0x22,0x42,0x24,0x49,0x90,0x80,0x00,0x02, +0x08,0x00,0x00,0x01,0x00,0x00,0x04,0x62,0x42,0x24,0x49,0x90,0x80,0x00,0x02, +0x08,0x1E,0x64,0xF1,0x00,0x00,0x04,0x43,0x81,0xC4,0x49,0x90,0x9E,0x64,0xF2, +0x08,0x32,0x64,0x99,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xB2,0x64,0x9A, +0x08,0x20,0x54,0x89,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xA0,0x54,0x8A, +0x08,0x26,0x54,0x89,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xA6,0x54,0x8A, +0x08,0x22,0x4C,0x89,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xA2,0x4C,0x8A, +0x08,0x32,0x4C,0x99,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xB2,0x4C,0x9A, +0x08,0x1E,0x4C,0xF1,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x9E,0x4C,0xF2, +0x08,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x02, +0x0F,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFE, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x30,0x00,0x00,0x04,0x00,0x00,0x40,0x00,0x00,0x00,0x03,0x81,0xC6,0x04,0x00, +0x48,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x04,0x42,0x2A,0x04,0x00, +0x42,0x25,0x87,0x04,0x38,0x3C,0x48,0x8B,0xC8,0x8E,0x08,0x24,0x02,0x0A,0x00, +0x22,0x26,0x48,0x04,0x40,0x02,0x48,0x88,0x28,0x90,0x08,0x24,0x02,0x0A,0x00, +0x11,0x44,0x48,0x04,0x60,0x1E,0x45,0x51,0xE5,0x18,0x08,0x24,0x02,0x11,0x00, +0x09,0x44,0x48,0x04,0x18,0x22,0x45,0x52,0x25,0x06,0x08,0x24,0x02,0x1F,0x00, +0x48,0x84,0x48,0x04,0x08,0x22,0x42,0x22,0x22,0x02,0x04,0x42,0x22,0x20,0x80, +0x30,0x84,0x47,0x04,0x70,0x1E,0x42,0x21,0xE2,0x1C,0x03,0x81,0xCF,0xA0,0x80, +0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00, +0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x82,0x8F,0x01,0x00,0x00,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80, +0x82,0x88,0x80,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80, +0x44,0x88,0x41,0x0E,0x0F,0x02,0x03,0x8B,0x03,0xC5,0x91,0x07,0x87,0x17,0xE0, +0x44,0x88,0x41,0x10,0x08,0x82,0x04,0x4C,0x80,0x26,0x51,0x04,0x48,0x98,0x80, +0x28,0x88,0x41,0x18,0x08,0x84,0x04,0x48,0x81,0xE4,0x4A,0x04,0x48,0x90,0x80, +0x28,0x88,0x41,0x06,0x08,0x84,0x04,0x48,0x82,0x24,0x4A,0x04,0x48,0x90,0x80, +0x10,0x88,0x81,0x02,0x08,0x88,0x04,0x48,0x82,0x24,0x44,0x04,0x48,0x90,0x80, +0x10,0x8F,0x01,0x1C,0x0F,0x08,0x03,0x88,0x81,0xE4,0x44,0x07,0x87,0x10,0x60, +0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x08,0x04,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x08,0x04,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 +}; diff --git a/demopal/lib/TVout/examples/DemoPAL/schematic.h b/demopal/lib/TVout/examples/DemoPAL/schematic.h new file mode 100755 index 0000000..4d0b270 --- /dev/null +++ b/demopal/lib/TVout/examples/DemoPAL/schematic.h @@ -0,0 +1,6 @@ +#include +#ifndef SHEMATIC_H +#define SHEMATIC_H + +extern const unsigned char schematic[]; +#endif diff --git a/demopal/lib/TVout/examples/NTSCserialTerm/NTSCserialTerm.pde b/demopal/lib/TVout/examples/NTSCserialTerm/NTSCserialTerm.pde new file mode 100755 index 0000000..7b509a4 --- /dev/null +++ b/demopal/lib/TVout/examples/NTSCserialTerm/NTSCserialTerm.pde @@ -0,0 +1,20 @@ +#include +#include +#include + +TVout TV; +pollserial pserial; + +void setup() { + TV.begin(_NTSC,184,72); + TV.select_font(font6x8); + TV.println("Serial Terminal"); + TV.println("-- Version 0.1 --"); + TV.set_hbi_hook(pserial.begin(57600)); +} + +void loop() { + if (pserial.available()) { + TV.print((char)pserial.read()); + } +} \ No newline at end of file diff --git a/demopal/lib/TVout/keywords.txt b/demopal/lib/TVout/keywords.txt new file mode 100755 index 0000000..bdcec2b --- /dev/null +++ b/demopal/lib/TVout/keywords.txt @@ -0,0 +1,50 @@ +NTSC LITERAL1 +PAL LITERAL1 +_NTSC LITERAL1 +_PAL LITERAL1 +WHITE LITERAL1 +BLACK LITERAL1 +INVERT LITERAL1 +UP LITERAL1 +DOWN LITERAL1 +LEFT LITERAL1 +RIGHT LITERAL1 + +TVout KEYWORD1 + +clear_screen KEYWORD2 +invert KEYWORD2 + +begin KEYWORD2 +end KEYWORD2 +force_vscale KEYWORD2 +force_outstart KEYWORD2 +force_linestart KEYWORD2 +hres KEYWORD2 +vres KEYWORD2 +char_line KEYWORD2 +fill KEYWORD2 +delay KEYWORD2 +delay_frame KEYWORD2 +millis KEYWORD2 +set_pixel KEYWORD2 +get_pixel KEYWORD2 +fill KEYWORD2 +shift KEYWORD2 +draw_line KEYWORD2 +draw_row KEYWORD2 +draw_column KEYWORD2 +draw_rect KEYWORD2 +draw_circle KEYWORD2 +bitmap KEYWORD2 +set_vbi_hook KEYWORD2 +set_hbi_hook KEYWORD2 +tone KEYWORD2 +noTone KEYWORD2 +print_char KEYWORD2 +set_cursor KEYWORD2 +select_font KEYWORD2 +print KEYWORD2 +println KEYWORD2 +printPGM KEYWORD2 + diff --git a/demopal/lib/TVout/spec/asm_macros.h b/demopal/lib/TVout/spec/asm_macros.h new file mode 100755 index 0000000..1f91c11 --- /dev/null +++ b/demopal/lib/TVout/spec/asm_macros.h @@ -0,0 +1,144 @@ +/* + Copyright (c) 2010 Myles Metzer + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include "hardware_setup.h" + +#ifndef ASM_MACROS_H +#define ASM_MACROS_H + +// delay macros +__asm__ __volatile__ ( + // delay 1 clock cycle. + ".macro delay1\n\t" + "nop\n" + ".endm\n" + + // delay 2 clock cycles + ".macro delay2\n\t" + "nop\n\t" + "nop\n" + ".endm\n" + + // delay 3 clock cyles + ".macro delay3\n\t" + "nop\n\t" + "nop\n\t" + "nop\n" + ".endm\n" + + // delay 4 clock cylces + ".macro delay4\n\t" + "nop\n\t" + "nop\n\t" + "nop\n\t" + "nop\n" + ".endm\n" + + // delay 5 clock cylces + ".macro delay5\n\t" + "nop\n\t" + "nop\n\t" + "nop\n\t" + "nop\n\t" + "nop\n" + ".endm\n" + + // delay 6 clock cylces + ".macro delay6\n\t" + "nop\n\t" + "nop\n\t" + "nop\n\t" + "nop\n\t" + "nop\n\t" + "nop\n" + ".endm\n" + + // delay 7 clock cylces + ".macro delay7\n\t" + "nop\n\t" + "nop\n\t" + "nop\n\t" + "nop\n\t" + "nop\n\t" + "nop\n\t" + "nop\n" + ".endm\n" + + // delay 8 clock cylces + ".macro delay8\n\t" + "nop\n\t" + "nop\n\t" + "nop\n\t" + "nop\n\t" + "nop\n\t" + "nop\n\t" + "nop\n\t" + "nop\n" + ".endm\n" + + // delay 9 clock cylces + ".macro delay9\n\t" + "nop\n\t" + "nop\n\t" + "nop\n\t" + "nop\n\t" + "nop\n\t" + "nop\n\t" + "nop\n\t" + "nop\n\t" + "nop\n" + ".endm\n" + + // delay 10 clock cylces + ".macro delay10\n\t" + "nop\n\t" + "nop\n\t" + "nop\n\t" + "nop\n\t" + "nop\n\t" + "nop\n\t" + "nop\n\t" + "nop\n\t" + "nop\n\t" + "nop\n" + ".endm\n" +); // end of delay macros + +// common output macros, specific output macros at top of file +__asm__ __volatile__ ( + + // save port 16 and clear the video bit + ".macro svprt p\n\t" + "in r16,\\p\n\t" + ANDI_HWS + ".endm\n" + + // ouput 1 bit port safe + ".macro o1bs p\n\t" + BLD_HWS + "out \\p,r16\n" + ".endm\n" +); // end of output macros +#endif \ No newline at end of file diff --git a/demopal/lib/TVout/spec/hardware_setup.h b/demopal/lib/TVout/spec/hardware_setup.h new file mode 100755 index 0000000..c11e18c --- /dev/null +++ b/demopal/lib/TVout/spec/hardware_setup.h @@ -0,0 +1,146 @@ +/* + Copyright (c) 2010 Myles Metzer + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. +*/ + +// sound is output on OC2A +// sync output is on OC1A + +//ENABLE_FAST_OUTPUT chooses the highest bit of a port over the original output method +//comment out this line to switch back to the original output pins. +#define ENABLE_FAST_OUTPUT + +#ifndef HARDWARE_SETUP_H +#define HARDWARE_SETUP_H + +// device specific settings. +#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega1281__) || defined(__AVR_ATmega2560__) || defined(__AVR_ATmega2561__) +#if defined(ENABLE_FAST_OUTPUT) +#define PORT_VID PORTA +#define DDR_VID DDRA +#define VID_PIN 7 +#else +//video +#define PORT_VID PORTB +#define DDR_VID DDRB +#define VID_PIN 6 +#endif +//sync +#define PORT_SYNC PORTB +#define DDR_SYNC DDRB +#define SYNC_PIN 5 +//sound +#define PORT_SND PORTB +#define DDR_SND DDRB +#define SND_PIN 4 + +#elif defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__) || defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__) +//video +#if defined(ENABLE_FAST_OUTPUT) +#define PORT_VID PORTA +#define DDR_VID DDRA +#define VID_PIN 7 +#else +#define PORT_VID PORTD +#define DDR_VID DDRD +#define VID_PIN 4 +#endif +//sync +#define PORT_SYNC PORTD +#define DDR_SYNC DDRD +#define SYNC_PIN 5 +//sound +#define PORT_SND PORTD +#define DDR_SND DDRD +#define SND_PIN 7 + +#elif defined(__AVR_ATmega8__) || defined(__AVR_ATmega88__) || defined(__AVR_ATmega168P__) || defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__) || defined(__AVR_ATmega328__) +//video +#if defined(ENABLE_FAST_OUTPUT) +#define PORT_VID PORTD +#define DDR_VID DDRD +#define VID_PIN 7 +#else +#define PORT_VID PORTB +#define DDR_VID DDRB +#define VID_PIN 0 +#endif +//sync +#define PORT_SYNC PORTB +#define DDR_SYNC DDRB +#define SYNC_PIN 1 +//sound +#define PORT_SND PORTB +#define DDR_SND DDRB +#define SND_PIN 3 + +#elif defined (__AVR_AT90USB1286__) +//video +#define PORT_VID PORTF +#define DDR_VID DDRF +#define VID_PIN 7 +//sync +#define PORT_SYNC PORTB +#define DDR_SYNC DDRB +#define SYNC_PIN 5 +//sound +#define PORT_SND PORTB +#define DDR_SND DDRB +#define SND_PIN 4 +#endif + +//automatic BST/BLD/ANDI macro definition +#if VID_PIN == 0 +#define BLD_HWS "bld r16,0\n\t" +#define BST_HWS "bst r16,0\n\t" +#define ANDI_HWS "andi r16,0xFE\n" +#elif VID_PIN == 1 +#define BLD_HWS "bld r16,1\n\t" +#define BST_HWS "bst r16,1\n\t" +#define ANDI_HWS "andi r16,0xFD\n" +#elif VID_PIN == 2 +#define BLD_HWS "bld r16,2\n\t" +#define BST_HWS "bst r16,2\n\t" +#define ANDI_HWS "andi r16,0xFB\n" +#elif VID_PIN == 3 +#define BLD_HWS "bld r16,3\n\t" +#define BST_HWS "bst r16,3\n\t" +#define ANDI_HWS "andi r16,0xF7\n" +#elif VID_PIN == 4 +#define BLD_HWS "bld r16,4\n\t" +#define BST_HWS "bst r16,4\n\t" +#define ANDI_HWS "andi r16,0xEF\n" +#elif VID_PIN == 5 +#define BLD_HWS "bld r16,5\n\t" +#define BST_HWS "bst r16,5\n\t" +#define ANDI_HWS "andi r16,0xDF\n" +#elif VID_PIN == 6 +#define BLD_HWS "bld r16,6\n\t" +#define BST_HWS "bst r16,6\n\t" +#define ANDI_HWS "andi r16,0xBF\n" +#elif VID_PIN == 7 +#define BLD_HWS "bld r16,7\n\t" +#define BST_HWS "bst r16,7\n\t" +#define ANDI_HWS "andi r16,0x7F\n" +#endif +#endif \ No newline at end of file diff --git a/demopal/lib/TVout/spec/video_properties.h b/demopal/lib/TVout/spec/video_properties.h new file mode 100755 index 0000000..006cf37 --- /dev/null +++ b/demopal/lib/TVout/spec/video_properties.h @@ -0,0 +1,67 @@ +/* + Copyright (c) 2010 Myles Metzer + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. +*/ + +/* + This File contains the timing definitions for the TVout AVR composite video + generation Library +*/ +#ifndef VIDEO_TIMING_H +#define VIDEO_TIMING_H + +#define _CYCLES_PER_US (F_CPU / 1000000) + +#define _TIME_HORZ_SYNC 4.7 +#define _TIME_VIRT_SYNC 58.85 +#define _TIME_ACTIVE 46 +#define _CYCLES_VIRT_SYNC ((_TIME_VIRT_SYNC * _CYCLES_PER_US) - 1) +#define _CYCLES_HORZ_SYNC ((_TIME_HORZ_SYNC * _CYCLES_PER_US) - 1) + +//Timing settings for NTSC +#define _NTSC_TIME_SCANLINE 63.55 +#define _NTSC_TIME_OUTPUT_START 12 + +#define _NTSC_LINE_FRAME 262 +#define _NTSC_LINE_START_VSYNC 0 +#define _NTSC_LINE_STOP_VSYNC 3 +#define _NTSC_LINE_DISPLAY 216 +#define _NTSC_LINE_MID ((_NTSC_LINE_FRAME - _NTSC_LINE_DISPLAY)/2 + _NTSC_LINE_DISPLAY/2) + +#define _NTSC_CYCLES_SCANLINE ((_NTSC_TIME_SCANLINE * _CYCLES_PER_US) - 1) +#define _NTSC_CYCLES_OUTPUT_START ((_NTSC_TIME_OUTPUT_START * _CYCLES_PER_US) - 1) + +//Timing settings for PAL +#define _PAL_TIME_SCANLINE 64 +#define _PAL_TIME_OUTPUT_START 12.5 + +#define _PAL_LINE_FRAME 312 +#define _PAL_LINE_START_VSYNC 0 +#define _PAL_LINE_STOP_VSYNC 7 +#define _PAL_LINE_DISPLAY 260 +#define _PAL_LINE_MID ((_PAL_LINE_FRAME - _PAL_LINE_DISPLAY)/2 + _PAL_LINE_DISPLAY/2) + +#define _PAL_CYCLES_SCANLINE ((_PAL_TIME_SCANLINE * _CYCLES_PER_US) - 1) +#define _PAL_CYCLES_OUTPUT_START ((_PAL_TIME_OUTPUT_START * _CYCLES_PER_US) - 1) + +#endif \ No newline at end of file diff --git a/demopal/lib/TVout/version history.txt b/demopal/lib/TVout/version history.txt new file mode 100755 index 0000000..c45fb53 --- /dev/null +++ b/demopal/lib/TVout/version history.txt @@ -0,0 +1,94 @@ +Beta1.0 (Dec 2nd 2010) + -Revamped font engine to use less flash memory. select_font() must be called see wiki for details. + -Full print system for all data types, no more print_str instead use print(). + -rewrote draw_circle faster uses different arguments. + -removed draw_box replaced with draw_rect faster easier. + -added draw_row very fast horizontal line drawing. + -added draw_column very fast column drawing. + -added force functions for startline outputdelay and vertical scale. + -remove fs_bitmap and replaced with general bitmap function. + -added shift function to move screen in any direction. + -delay now takes ms delays, delay_frames still takes frames. + -millis replacement returns ms since begin was called. + -added 4 and 3 cycle render routines for horizontal resolutions of up to 256. + -added vertical and horizontal blanking hook functions for automatic polling. + -added end function to clean up system. + -started lowering memory footprint + +R6 (June 2010) (Currently Beta at 5.9): + -transitioned API to a more be more "arduino like", macros were included + maintain compatibility, with the exception of the start_render(mode,x,y) which + has no such compatibility layer. + -created a fill method that will either fill the screen with white or black or + invert the screen. clear_screen() and invert() are now macro calls of fill() + -switched to an 8x8 font because of the simplicity and speed of rendering by the + byte, all character printing is now restricted x's that are multiples of 8 + to reflect this x is now taken as a multiple of 8pixels. + -encapsolated all global variables into structs. one for the video portion and + one for the audio portion. + -the interrupt now uses the timer1 overflow vector. Leaving compare match b for + intitiating the rendering(does not do this yet) + -the line handler portion of line interrupt is now handled by a function pointer + and functions that corrispond to each of the 3 possible line types. + -Switched the actual rendering to an assembly loop that will work for resolutions + all the way up to 192pixels(at 16mhz). This cuts off down the required flash + by 1.5kbytes. + -Moved Hardware specific deffinitions to there on hardware_setup.h file. + -fixed the number of lines in the PAL mode, Thanks Lover on arduino.cc forums. + -Added circle function thank you Andy Crook + -Added box function thank you Andy Crook + +R5 (May 27th 2010): + -Fixed a render bug preventing a full white screen + -Fixed the get_pixel function actually works now + -reverted to original version of the draw_line function works correctly now + -added gijs(arduino.cc forums) invert function inverts the whole screen + -added nootropic(arduino.cc forums) tone generation system + -added a full screen bitmap function, very limited will be expanded upon. + +R4.x (May 19th 2010): + -fixed sanguino support, works properly in R4.6 + +R4 (May 18th 2010): + -Added support for runtime resolution setup. + -start_render(mode,hres,vres) + -cleaned up the rendering code. + -If speed/low memory usage is required it is recommended that R3 is used and the + resolution is changed in the video_properties.h file. + -Added sanguino support, untested. + +R3 (May 9th 2010): + -Added horz_res(), vert_res(), char_line(), get_pixel(x,y) + -horz_res/vert_res gets resolution of screen + -char_line gets the number of characters that will fit on a line + -get_pixel gets the status of x,y returns 1 for white 0 for black. + -rewrote the line render functions + -fixed bugs preventing changes in resolution and pixel scaling + -automatically centers the screen vertically + -added arduino mega support, untested + -Sync pin: pin11 + -Video pin: pin12 + -changing the redering resolution is now supported. + to do so change the virtical and horizontal resolution in video_properties.h + -Note: + (_RESOLUTION_HORIZONTAL/8)*_RESOLUTION_VERTICAL + must be less than the amount of memory the arduino has. + +R2 (May 2nd 2010): + -Added PAL support: + -to render in pal call start_render(_PAL); + -to render in NTSC call start_render(_NTSC); + -centered video better. + -reduced system to useing one interupt, this will allow for adding sound, and or + support for polling the UART/SPI/ect. once per scanline. + -now renders full half frames(262 lines) instead of 255 lines for NTSC + -modified fonts to be less horrid looking. + -slightly faster line rendering. + -Fixed issue with line rendering not working on last horizonal pixel + -added support for pausing video; output still issues h sync + -pause: pause_render(); + -resume: resume_render(); + -This does cause a Vsync glitch for the first frame, recovers after + soon. +R1 (April 30th 2010): + Initial release. diff --git a/demopal/lib/TVout/video_gen.cpp b/demopal/lib/TVout/video_gen.cpp new file mode 100755 index 0000000..8e21b09 --- /dev/null +++ b/demopal/lib/TVout/video_gen.cpp @@ -0,0 +1,470 @@ +/* + Copyright (c) 2010 Myles Metzer + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include +#include + +#include "video_gen.h" +#include "spec/video_properties.h" +#include "spec/asm_macros.h" +#include "spec/hardware_setup.h" + +//#define REMOVE6C +//#define REMOVE5C +//#define REMOVE4C +//#define REMOVE3C + +int renderLine; +TVout_vid display; +void (*render_line)(); //remove me +void (*line_handler)(); //remove me +void (*hbi_hook)() = ∅ +void (*vbi_hook)() = ∅ + +// sound properties +volatile long remainingToneVsyncs; + +void empty() {} + +void render_setup(uint8_t mode, uint8_t x, uint8_t y, uint8_t *scrnptr) { + + display.screen = scrnptr; + display.hres = x; + display.vres = y; + display.frames = 0; + + if (mode) + display.vscale_const = _PAL_LINE_DISPLAY/display.vres - 1; + else + display.vscale_const = _NTSC_LINE_DISPLAY/display.vres - 1; + display.vscale = display.vscale_const; + + //selects the widest render method that fits in 46us + //as of 9/16/10 rendermode 3 will not work for resolutions lower than + //192(display.hres lower than 24) + unsigned char rmethod = (_TIME_ACTIVE*_CYCLES_PER_US)/(display.hres*8); + switch(rmethod) { + case 6: + render_line = &render_line6c; + break; + case 5: + render_line = &render_line5c; + break; + case 4: + render_line = &render_line4c; + break; + case 3: + render_line = &render_line3c; + break; + default: + if (rmethod > 6) + render_line = &render_line6c; + else + render_line = &render_line3c; + } + + + DDR_VID |= _BV(VID_PIN); + DDR_SYNC |= _BV(SYNC_PIN); + PORT_VID &= ~_BV(VID_PIN); + PORT_SYNC |= _BV(SYNC_PIN); + DDR_SND |= _BV(SND_PIN); // for tone generation. + + // inverted fast pwm mode on timer 1 + TCCR1A = _BV(COM1A1) | _BV(COM1A0) | _BV(WGM11); + TCCR1B = _BV(WGM13) | _BV(WGM12) | _BV(CS10); + + if (mode) { + display.start_render = _PAL_LINE_MID - ((display.vres * (display.vscale_const+1))/2); + display.output_delay = _PAL_CYCLES_OUTPUT_START; + display.vsync_end = _PAL_LINE_STOP_VSYNC; + display.lines_frame = _PAL_LINE_FRAME; + ICR1 = _PAL_CYCLES_SCANLINE; + OCR1A = _CYCLES_HORZ_SYNC; + } + else { + display.start_render = _NTSC_LINE_MID - ((display.vres * (display.vscale_const+1))/2) + 8; + display.output_delay = _NTSC_CYCLES_OUTPUT_START; + display.vsync_end = _NTSC_LINE_STOP_VSYNC; + display.lines_frame = _NTSC_LINE_FRAME; + ICR1 = _NTSC_CYCLES_SCANLINE; + OCR1A = _CYCLES_HORZ_SYNC; + } + display.scanLine = display.lines_frame+1; + line_handler = &vsync_line; + TIMSK1 = _BV(TOIE1); + sei(); +} + +// render a line +ISR(TIMER1_OVF_vect) { + hbi_hook(); + line_handler(); +} + +void blank_line() { + + if ( display.scanLine == display.start_render) { + renderLine = 0; + display.vscale = display.vscale_const; + line_handler = &active_line; + } + else if (display.scanLine == display.lines_frame) { + line_handler = &vsync_line; + vbi_hook(); + } + + display.scanLine++; +} + +void active_line() { + wait_until(display.output_delay); + render_line(); + if (!display.vscale) { + display.vscale = display.vscale_const; + renderLine += display.hres; + } + else + display.vscale--; + + if ((display.scanLine + 1) == (int)(display.start_render + (display.vres*(display.vscale_const+1)))) + line_handler = &blank_line; + + display.scanLine++; +} + +void vsync_line() { + if (display.scanLine >= display.lines_frame) { + OCR1A = _CYCLES_VIRT_SYNC; + display.scanLine = 0; + display.frames++; + + if (remainingToneVsyncs != 0) + { + if (remainingToneVsyncs > 0) + { + remainingToneVsyncs--; + } + + } else + { + TCCR2B = 0; //stop the tone + PORTB &= ~(_BV(SND_PIN)); + } + + } + else if (display.scanLine == display.vsync_end) { + OCR1A = _CYCLES_HORZ_SYNC; + line_handler = &blank_line; + } + display.scanLine++; +} + + +static void inline wait_until(uint8_t time) { + __asm__ __volatile__ ( + "subi %[time], 10\n" + "sub %[time], %[tcnt1l]\n\t" + "100:\n\t" + "subi %[time], 3\n\t" + "brcc 100b\n\t" + "subi %[time], 0-3\n\t" + "breq 101f\n\t" + "dec %[time]\n\t" + "breq 102f\n\t" + "rjmp 102f\n" + "101:\n\t" + "nop\n" + "102:\n" + : + : [time] "a" (time), + [tcnt1l] "a" (TCNT1L) + ); +} + +void render_line6c() { + #ifndef REMOVE6C + __asm__ __volatile__ ( + "ADD r26,r28\n\t" + "ADC r27,r29\n\t" + //save PORTB + "svprt %[port]\n\t" + + "rjmp enter6\n" + "loop6:\n\t" + "bst __tmp_reg__,0\n\t" //8 + "o1bs %[port]\n" + "enter6:\n\t" + "LD __tmp_reg__,X+\n\t" //1 + "delay1\n\t" + "bst __tmp_reg__,7\n\t" + "o1bs %[port]\n\t" + "delay3\n\t" //2 + "bst __tmp_reg__,6\n\t" + "o1bs %[port]\n\t" + "delay3\n\t" //3 + "bst __tmp_reg__,5\n\t" + "o1bs %[port]\n\t" + "delay3\n\t" //4 + "bst __tmp_reg__,4\n\t" + "o1bs %[port]\n\t" + "delay3\n\t" //5 + "bst __tmp_reg__,3\n\t" + "o1bs %[port]\n\t" + "delay3\n\t" //6 + "bst __tmp_reg__,2\n\t" + "o1bs %[port]\n\t" + "delay3\n\t" //7 + "bst __tmp_reg__,1\n\t" + "o1bs %[port]\n\t" + "dec %[hres]\n\t" + "brne loop6\n\t" //go too loopsix + "delay2\n\t" + "bst __tmp_reg__,0\n\t" //8 + "o1bs %[port]\n" + + "svprt %[port]\n\t" + BST_HWS + "o1bs %[port]\n\t" + : + : [port] "i" (_SFR_IO_ADDR(PORT_VID)), + "x" (display.screen), + "y" (renderLine), + [hres] "d" (display.hres) + : "r16" // try to remove this clobber later... + ); + #endif +} + +void render_line5c() { + #ifndef REMOVE5C + __asm__ __volatile__ ( + "ADD r26,r28\n\t" + "ADC r27,r29\n\t" + //save PORTB + "svprt %[port]\n\t" + + "rjmp enter5\n" + "loop5:\n\t" + "bst __tmp_reg__,0\n\t" //8 + "o1bs %[port]\n" + "enter5:\n\t" + "LD __tmp_reg__,X+\n\t" //1 + "bst __tmp_reg__,7\n\t" + "o1bs %[port]\n\t" + "delay2\n\t" //2 + "bst __tmp_reg__,6\n\t" + "o1bs %[port]\n\t" + "delay2\n\t" //3 + "bst __tmp_reg__,5\n\t" + "o1bs %[port]\n\t" + "delay2\n\t" //4 + "bst __tmp_reg__,4\n\t" + "o1bs %[port]\n\t" + "delay2\n\t" //5 + "bst __tmp_reg__,3\n\t" + "o1bs %[port]\n\t" + "delay2\n\t" //6 + "bst __tmp_reg__,2\n\t" + "o1bs %[port]\n\t" + "delay1\n\t" //7 + "dec %[hres]\n\t" + "bst __tmp_reg__,1\n\t" + "o1bs %[port]\n\t" + "brne loop5\n\t" //go too loop5 + "delay1\n\t" + "bst __tmp_reg__,0\n\t" //8 + "o1bs %[port]\n" + + "svprt %[port]\n\t" + BST_HWS + "o1bs %[port]\n\t" + : + : [port] "i" (_SFR_IO_ADDR(PORT_VID)), + "x" (display.screen), + "y" (renderLine), + [hres] "d" (display.hres) + : "r16" // try to remove this clobber later... + ); + #endif +} + +void render_line4c() { + #ifndef REMOVE4C + __asm__ __volatile__ ( + "ADD r26,r28\n\t" + "ADC r27,r29\n\t" + + "rjmp enter4\n" + "loop4:\n\t" + "lsl __tmp_reg__\n\t" //8 + "out %[port],__tmp_reg__\n\t" + "enter4:\n\t" + "LD __tmp_reg__,X+\n\t" //1 + "delay1\n\t" + "out %[port],__tmp_reg__\n\t" + "delay2\n\t" //2 + "lsl __tmp_reg__\n\t" + "out %[port],__tmp_reg__\n\t" + "delay2\n\t" //3 + "lsl __tmp_reg__\n\t" + "out %[port],__tmp_reg__\n\t" + "delay2\n\t" //4 + "lsl __tmp_reg__\n\t" + "out %[port],__tmp_reg__\n\t" + "delay2\n\t" //5 + "lsl __tmp_reg__\n\t" + "out %[port],__tmp_reg__\n\t" + "delay2\n\t" //6 + "lsl __tmp_reg__\n\t" + "out %[port],__tmp_reg__\n\t" + "delay1\n\t" //7 + "lsl __tmp_reg__\n\t" + "dec %[hres]\n\t" + "out %[port],__tmp_reg__\n\t" + "brne loop4\n\t" //go too loop4 + "delay1\n\t" //8 + "lsl __tmp_reg__\n\t" + "out %[port],__tmp_reg__\n\t" + "delay3\n\t" + "cbi %[port],7\n\t" + : + : [port] "i" (_SFR_IO_ADDR(PORT_VID)), + "x" (display.screen), + "y" (renderLine), + [hres] "d" (display.hres) + : "r16" // try to remove this clobber later... + ); + #endif +} + +// only 16mhz right now!!! +void render_line3c() { + #ifndef REMOVE3C + __asm__ __volatile__ ( + ".macro byteshift\n\t" + "LD __tmp_reg__,X+\n\t" + "out %[port],__tmp_reg__\n\t" //0 + "nop\n\t" + "lsl __tmp_reg__\n\t" + "out %[port],__tmp_reg__\n\t" //1 + "nop\n\t" + "lsl __tmp_reg__\n\t" + "out %[port],__tmp_reg__\n\t" //2 + "nop\n\t" + "lsl __tmp_reg__\n\t" + "out %[port],__tmp_reg__\n\t" //3 + "nop\n\t" + "lsl __tmp_reg__\n\t" + "out %[port],__tmp_reg__\n\t" //4 + "nop\n\t" + "lsl __tmp_reg__\n\t" + "out %[port],__tmp_reg__\n\t" //5 + "nop\n\t" + "lsl __tmp_reg__\n\t" + "out %[port],__tmp_reg__\n\t" //6 + "nop\n\t" + "lsl __tmp_reg__\n\t" + "out %[port],__tmp_reg__\n\t" //7 + ".endm\n\t" + + "ADD r26,r28\n\t" + "ADC r27,r29\n\t" + + "cpi %[hres],30\n\t" //615 + "breq skip0\n\t" + "cpi %[hres],29\n\t" + "breq jumpto1\n\t" + "cpi %[hres],28\n\t" + "breq jumpto2\n\t" + "cpi %[hres],27\n\t" + "breq jumpto3\n\t" + "cpi %[hres],26\n\t" + "breq jumpto4\n\t" + "cpi %[hres],25\n\t" + "breq jumpto5\n\t" + "cpi %[hres],24\n\t" + "breq jumpto6\n\t" + "jumpto1:\n\t" + "rjmp skip1\n\t" + "jumpto2:\n\t" + "rjmp skip2\n\t" + "jumpto3:\n\t" + "rjmp skip3\n\t" + "jumpto4:\n\t" + "rjmp skip4\n\t" + "jumpto5:\n\t" + "rjmp skip5\n\t" + "jumpto6:\n\t" + "rjmp skip6\n\t" + "skip0:\n\t" + "byteshift\n\t" //1 \\643 + "skip1:\n\t" + "byteshift\n\t" //2 + "skip2:\n\t" + "byteshift\n\t" //3 + "skip3:\n\t" + "byteshift\n\t" //4 + "skip4:\n\t" + "byteshift\n\t" //5 + "skip5:\n\t" + "byteshift\n\t" //6 + "skip6:\n\t" + "byteshift\n\t" //7 + "byteshift\n\t" //8 + "byteshift\n\t" //9 + "byteshift\n\t" //10 + "byteshift\n\t" //11 + "byteshift\n\t" //12 + "byteshift\n\t" //13 + "byteshift\n\t" //14 + "byteshift\n\t" //15 + "byteshift\n\t" //16 + "byteshift\n\t" //17 + "byteshift\n\t" //18 + "byteshift\n\t" //19 + "byteshift\n\t" //20 + "byteshift\n\t" //21 + "byteshift\n\t" //22 + "byteshift\n\t" //23 + "byteshift\n\t" //24 + "byteshift\n\t" //25 + "byteshift\n\t" //26 + "byteshift\n\t" //27 + "byteshift\n\t" //28 + "byteshift\n\t" //29 + "byteshift\n\t" //30 + + "delay2\n\t" + "cbi %[port],7\n\t" + : + : [port] "i" (_SFR_IO_ADDR(PORT_VID)), + "x" (display.screen), + "y" (renderLine), + [hres] "d" (display.hres) + : "r16" // try to remove this clobber later... + ); + #endif +} diff --git a/demopal/lib/TVout/video_gen.h b/demopal/lib/TVout/video_gen.h new file mode 100755 index 0000000..f66d564 --- /dev/null +++ b/demopal/lib/TVout/video_gen.h @@ -0,0 +1,64 @@ +/* + Copyright (c) 2010 Myles Metzer + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef VIDEO_GEN_H +#define VIDEO_GEN_H + +typedef struct { + volatile int scanLine; + volatile unsigned long frames; + unsigned char start_render; + int lines_frame; //remove me + uint8_t vres; + uint8_t hres; + uint8_t output_delay; //remove me + char vscale_const; //combine me with status switch + char vscale; //combine me too. + char vsync_end; //remove me + uint8_t * screen; +} TVout_vid; + +extern TVout_vid display; + +extern void (*hbi_hook)(); +extern void (*vbi_hook)(); + +void render_setup(uint8_t mode, uint8_t x, uint8_t y, uint8_t *scrnptr); + +void blank_line(); +void active_line(); +void vsync_line(); +void empty(); + +//tone generation properties +extern volatile long remainingToneVsyncs; + +// 6cycles functions +void render_line6c(); +void render_line5c(); +void render_line4c(); +void render_line3c(); +static void inline wait_until(uint8_t time); +#endif diff --git a/demopal/lib/TVoutfonts/font4x6.cpp b/demopal/lib/TVoutfonts/font4x6.cpp new file mode 100755 index 0000000..6a3fa4f --- /dev/null +++ b/demopal/lib/TVoutfonts/font4x6.cpp @@ -0,0 +1,671 @@ +#include "font4x6.h" + +PROGMEM const unsigned char font4x6[] = { +4,6,32, +//space +0b00000000, +0b00000000, +0b00000000, +0b00000000, +0b00000000, +0b00000000, +//! +0b01000000, +0b01000000, +0b01000000, +0b00000000, +0b01000000, +0b00000000, +//" +0b10100000, +0b10100000, +0b00000000, +0b00000000, +0b00000000, +0b00000000, +//# +0b10100000, +0b11100000, +0b10100000, +0b11100000, +0b10100000, +0b00000000, +//$ +0b01000000, +0b01100000, +0b11000000, +0b01100000, +0b11000000, +0b00000000, +//% +0b10100000, +0b00100000, +0b01000000, +0b10000000, +0b10100000, +0b00000000, +//& +0b00100000, +0b01000000, +0b11000000, +0b10100000, +0b11100000, +0b00000000, +//' +0b10000000, +0b10000000, +0b00000000, +0b00000000, +0b00000000, +0b00000000, +//( +0b01000000, +0b10000000, +0b10000000, +0b10000000, +0b01000000, +0b00000000, +//) +0b10000000, +0b01000000, +0b01000000, +0b01000000, +0b10000000, +0b00000000, +//* +0b01000000, +0b10100000, +0b01000000, +0b00000000, +0b00000000, +0b00000000, +//+ +0b00000000, +0b01000000, +0b11100000, +0b01000000, +0b00000000, +0b00000000, +//, +0b00000000, +0b00000000, +0b00000000, +0b10000000, +0b10000000, +0b00000000, +//- +0b00000000, +0b00000000, +0b11100000, +0b00000000, +0b00000000, +0b00000000, +//. +0b00000000, +0b00000000, +0b00000000, +0b00000000, +0b10000000, +0b00000000, +// / +0b00100000, +0b00100000, +0b01000000, +0b10000000, +0b10000000, +0b00000000, +//0 +0b11100000, +0b10100000, +0b10100000, +0b10100000, +0b11100000, +0b00000000, +//1 +0b01000000, +0b11000000, +0b01000000, +0b01000000, +0b11100000, +0b00000000, +//2 +0b11100000, +0b00100000, +0b11100000, +0b10000000, +0b11100000, +0b00000000, +//3 +0b11100000, +0b00100000, +0b11100000, +0b00100000, +0b11100000, +0b00000000, +//4 +0b10100000, +0b10100000, +0b11100000, +0b00100000, +0b00100000, +0b00000000, +//5 +0b11100000, +0b10000000, +0b11100000, +0b00100000, +0b11000000, +0b00000000, +//6 +0b11000000, +0b10000000, +0b11100000, +0b10100000, +0b11100000, +0b00000000, +//7 +0b11100000, +0b00100000, +0b01000000, +0b10000000, +0b10000000, +0b00000000, +//8 +0b11100000, +0b10100000, +0b11100000, +0b10100000, +0b11100000, +0b00000000, +//9 +0b11100000, +0b10100000, +0b11100000, +0b00100000, +0b01100000, +0b00000000, +//: +0b00000000, +0b01000000, +0b00000000, +0b01000000, +0b00000000, +0b00000000, +//; +0b00000000, +0b01000000, +0b00000000, +0b01000000, +0b10000000, +0b00000000, +//< +0b00100000, +0b01000000, +0b10000000, +0b01000000, +0b00100000, +0b00000000, +//= +0b00000000, +0b11100000, +0b00000000, +0b11100000, +0b00000000, +0b00000000, +//> +0b10000000, +0b01000000, +0b00100000, +0b01000000, +0b10000000, +0b00000000, +//? +0b11000000, +0b00100000, +0b01000000, +0b00000000, +0b01000000, +0b00000000, +//@ +0b11100000, +0b10100000, +0b10100000, +0b11100000, +0b11100000, +0b00000000, +//A +0b11100000, +0b10100000, +0b11100000, +0b10100000, +0b10100000, +0b00000000, +//B +0b11000000, +0b10100000, +0b11100000, +0b10100000, +0b11000000, +0b00000000, +//C +0b11100000, +0b10000000, +0b10000000, +0b10000000, +0b11100000, +0b00000000, +//D +0b11000000, +0b10100000, +0b10100000, +0b10100000, +0b11000000, +0b00000000, +//E +0b11100000, +0b10000000, +0b11100000, +0b10000000, +0b11100000, +0b00000000, +//F +0b11100000, +0b10000000, +0b11100000, +0b10000000, +0b10000000, +0b00000000, +//G +0b11100000, +0b10000000, +0b10000000, +0b10100000, +0b11100000, +0b00000000, +//H +0b10100000, +0b10100000, +0b11100000, +0b10100000, +0b10100000, +0b00000000, +//I +0b11100000, +0b01000000, +0b01000000, +0b01000000, +0b11100000, +0b00000000, +//J +0b00100000, +0b00100000, +0b00100000, +0b10100000, +0b11100000, +0b00000000, +//K +0b10000000, +0b10100000, +0b11000000, +0b11000000, +0b10100000, +0b00000000, +//L +0b10000000, +0b10000000, +0b10000000, +0b10000000, +0b11100000, +0b00000000, +//M +0b10100000, +0b11100000, +0b11100000, +0b10100000, +0b10100000, +0b00000000, +//N +0b11000000, +0b10100000, +0b10100000, +0b10100000, +0b10100000, +0b00000000, +//O +0b01000000, +0b10100000, +0b10100000, +0b10100000, +0b01000000, +0b00000000, +//P +0b11100000, +0b10100000, +0b11100000, +0b10000000, +0b10000000, +0b00000000, +//Q +0b01000000, +0b10100000, +0b10100000, +0b11100000, +0b01100110, +0b00000000, +//R +0b11100000, +0b10100000, +0b11000000, +0b11100000, +0b10101010, +0b00000000, +//S +0b11100000, +0b10000000, +0b11100000, +0b00100000, +0b11100000, +0b00000000, +//T +0b11100000, +0b01000000, +0b01000000, +0b01000000, +0b01000000, +0b00000000, +//U +0b10100000, +0b10100000, +0b10100000, +0b10100000, +0b11100000, +0b00000000, +//V +0b10100000, +0b10100000, +0b10100000, +0b10100000, +0b01000000, +0b00000000, +//W +0b10100000, +0b10100000, +0b11100000, +0b11100000, +0b10100010, +0b00000000, +//X +0b10100000, +0b10100000, +0b01000000, +0b10100000, +0b10100000, +0b00000000, +//Y +0b10100000, +0b10100000, +0b01000000, +0b01000000, +0b01000000, +0b00000000, +//Z +0b11100000, +0b00100000, +0b01000000, +0b10000000, +0b11100000, +0b00000000, +//[ +0b11000000, +0b10000000, +0b10000000, +0b10000000, +0b11000000, +0b00000000, +0, //for the life of me I have no idea why this is needed.... +//\ +0b10000000, +0b10000000, +0b01000000, +0b00100000, +0b00100000, +0b00000000, +//] +0b11000000, +0b01000000, +0b01000000, +0b01000000, +0b11000000, +0b00000000, +//^ +0b01000000, +0b10100000, +0b00000000, +0b00000000, +0b00000000, +0b00000000, +//_ +0b00000000, +0b00000000, +0b00000000, +0b00000000, +0b11100000, +0b00000000, +//` +0b10000000, +0b01000000, +0b00000000, +0b00000000, +0b00000000, +0b00000000, +//a +0b00000000, +0b01100000, +0b10100000, +0b10100000, +0b01100000, +0b00000000, +//b +0b10000000, +0b10000000, +0b11000000, +0b10100000, +0b11000000, +0b00000000, +//c +0b00000000, +0b01100000, +0b10000000, +0b10000000, +0b01100000, +0b00000000, +//d +0b00100000, +0b00100000, +0b01100000, +0b10100000, +0b01100000, +0b00000000, +//e +0b01000000, +0b10100000, +0b11100000, +0b10000000, +0b01100000, +0b00000000, +//f +0b01100000, +0b01000000, +0b11100000, +0b01000000, +0b01000000, +0b00000000, +//g +0b01100000, +0b10100000, +0b01100000, +0b00100000, +0b11000000, +0b00000000, +//h +0b10000000, +0b10000000, +0b11000000, +0b10100000, +0b10100000, +0b00000000, +//i +0b01000000, +0b00000000, +0b01000000, +0b01000000, +0b01000000, +0b00000000, +//j +0b01000000, +0b00000000, +0b01000000, +0b01000000, +0b11000000, +0b00000000, +//k +0b10000000, +0b10000000, +0b10100000, +0b11000000, +0b10100000, +0b00000000, +//l +0b11000000, +0b01000000, +0b01000000, +0b01000000, +0b11100000, +0b00000000, +//m +0b00000000, +0b10100000, +0b11100000, +0b10100000, +0b10100000, +0b00000000, +//n +0b00000000, +0b11000000, +0b10100000, +0b10100000, +0b10100000, +0b00000000, +//o +0b00000000, +0b01000000, +0b10100000, +0b10100000, +0b01000000, +0b00000000, +//p +0b00000000, +0b11000000, +0b10100000, +0b11000000, +0b10000000, +0b00000000, +//q +0b00000000, +0b01100000, +0b10100000, +0b01100000, +0b00100000, +0b00000000, +//r +0b00000000, +0b11000000, +0b10100000, +0b10000000, +0b10000000, +0b00000000, +//s +0b00000000, +0b01100000, +0b01000000, +0b00100000, +0b01100000, +0b00000000, +//t +0b01000000, +0b11100000, +0b01000000, +0b01000000, +0b01000000, +0b00000000, +//u +0b00000000, +0b10100000, +0b10100000, +0b10100000, +0b01100000, +0b00000000, +//v +0b00000000, +0b10100000, +0b10100000, +0b10100000, +0b01000000, +0b00000000, +//w +0b00000000, +0b10100000, +0b10100000, +0b11100000, +0b10100000, +0b00000000, +//x +0b00000000, +0b10100000, +0b01000000, +0b01000000, +0b10100000, +0b00000000, +//y +0b00000000, +0b10100000, +0b11100000, +0b00100000, +0b01000000, +0b00000000, +//x +0b00000000, +0b11100000, +0b01000000, +0b10000000, +0b11100000, +0b00000000, +//{ +0b00100000, +0b01000000, +0b11000000, +0b01000000, +0b00100010, +0b00000000, +//| +0b01000000, +0b01000000, +0b00000000, +0b01000000, +0b01000000, +0b00000000, +//} +0b10000000, +0b01000000, +0b01100000, +0b01000000, +0b10000000, +0b00000000, +//~ +0b00000000, +0b10100000, +0b01000000, +0b00000000, +0b00000000, +0b00000000 +}; \ No newline at end of file diff --git a/demopal/lib/TVoutfonts/font4x6.h b/demopal/lib/TVoutfonts/font4x6.h new file mode 100755 index 0000000..be45e53 --- /dev/null +++ b/demopal/lib/TVoutfonts/font4x6.h @@ -0,0 +1,7 @@ +#ifndef FONT4X6_h +#define FONT4X6_h +#include + +extern const unsigned char font4x6[]; + +#endif \ No newline at end of file diff --git a/demopal/lib/TVoutfonts/font6x8.cpp b/demopal/lib/TVoutfonts/font6x8.cpp new file mode 100755 index 0000000..f8736af --- /dev/null +++ b/demopal/lib/TVoutfonts/font6x8.cpp @@ -0,0 +1,870 @@ +#include "font6x8.h" + +PROGMEM const unsigned char font6x8[] = { + + 6,8,32, + //32 Space + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + //33 Exclamation ! + 0b01000000, + 0b01000000, + 0b01000000, + 0b01000000, + 0b01000000, + 0b00000000, + 0b01000000, + 0b00000000, + //34 Quotes " + 0b01010000, + 0b01010000, + 0b01010000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + //35 Number # + 0b00000000, + 0b00000000, + 0b01010000, + 0b11111000, + 0b01010000, + 0b11111000, + 0b01010000, + 0b00000000, + //36 Dollars $ + 0b00100000, + 0b01110000, + 0b10100000, + 0b01110000, + 0b00101000, + 0b01110000, + 0b00100000, + 0b00000000, + //37 Percent % + 0b00000000, + 0b11001000, + 0b11010000, + 0b00100000, + 0b01011000, + 0b10011000, + 0b00000000, + 0b00000000, + //38 Ampersand & + 0b00100000, + 0b01010000, + 0b10000000, + 0b01000000, + 0b10101000, + 0b10010000, + 0b01101000, + 0b00000000, + //39 Single Quote ' + 0b01000000, + 0b01000000, + 0b01000000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + //40 Left Parenthesis ( + 0b00010000, + 0b00100000, + 0b01000000, + 0b01000000, + 0b01000000, + 0b00100000, + 0b00010000, + 0b00000000, + //41 Right Parenthesis ) + 0b01000000, + 0b00100000, + 0b00010000, + 0b00010000, + 0b00010000, + 0b00100000, + 0b01000000, + 0b00000000, + //42 Star * + 0b00010000, + 0b00111000, + 0b00010000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + //43 Plus + + 0b00000000, + 0b00100000, + 0b00100000, + 0b11111000, + 0b00100000, + 0b00100000, + 0b00000000, + 0b00000000, + //44 Comma , + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00010000, + 0b00010000, + 0b00000000, + //45 Minus - + 0b00000000, + 0b00000000, + 0b00000000, + 0b11111000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + //46 Period . + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00010000, + 0b00000000, + 0b00000000, + // 47 Backslash / + 0b00000000, + 0b00001000, + 0b00010000, + 0b00100000, + 0b01000000, + 0b10000000, + 0b00000000, + 0b00000000, + // 48 Zero + 0b01110000, + 0b10001000, + 0b10101000, + 0b10101000, + 0b10001000, + 0b01110000, + 0b00000000, + 0b00000000, + //49 One + 0b00100000, + 0b01100000, + 0b00100000, + 0b00100000, + 0b00100000, + 0b01110000, + 0b00000000, + 0b00000000, + //50 two + 0b01110000, + 0b10001000, + 0b00010000, + 0b00100000, + 0b01000000, + 0b11111000, + 0b00000000, + 0b00000000, + //51 Three + 0b11111000, + 0b00010000, + 0b00100000, + 0b00010000, + 0b10001000, + 0b01110000, + 0b00000000, + 0b00000000, + //52 Four + 0b10010000, + 0b10010000, + 0b10010000, + 0b11111000, + 0b00010000, + 0b00010000, + 0b00000000, + 0b00000000, + //53 Five + 0b11111000, + 0b10000000, + 0b11110000, + 0b00001000, + 0b10001000, + 0b01110000, + 0b00000000, + 0b00000000, + //54 Six + 0b01110000, + 0b10000000, + 0b11110000, + 0b10001000, + 0b10001000, + 0b01110000, + 0b00000000, + 0b00000000, + //55 Seven + 0b11111000, + 0b00001000, + 0b00010000, + 0b00100000, + 0b01000000, + 0b10000000, + 0b00000000, + 0b00000000, + //56 Eight + 0b01110000, + 0b10001000, + 0b01110000, + 0b10001000, + 0b10001000, + 0b01110000, + 0b00000000, + 0b00000000, + //57 Nine + 0b01110000, + 0b10001000, + 0b10001000, + 0b01111000, + 0b00001000, + 0b01110000, + 0b00000000, + 0b00000000, + //58 : + 0b00000000, + 0b00000000, + 0b00100000, + 0b00000000, + 0b00000000, + 0b00100000, + 0b00000000, + 0b00000000, + //59 ; + 0b00000000, + 0b00000000, + 0b00100000, + 0b00000000, + 0b00100000, + 0b00100000, + 0b01000000, + 0b00000000, + //60 < + 0b00000000, + 0b00011000, + 0b01100000, + 0b10000000, + 0b01100000, + 0b00011000, + 0b00000000, + 0b00000000, + //61 = + 0b00000000, + 0b00000000, + 0b01111000, + 0b00000000, + 0b01111000, + 0b00000000, + 0b00000000, + 0b00000000, + //62 > + 0b00000000, + 0b11000000, + 0b00110000, + 0b00001000, + 0b00110000, + 0b11000000, + 0b00000000, + 0b00000000, + //63 ? + 0b01100000, + 0b10010000, + 0b00100000, + 0b00100000, + 0b00000000, + 0b00100000, + 0b00000000, + 0b00000000, + //64 @ + 0b01110000, + 0b10001000, + 0b10011000, + 0b10101000, + 0b10010000, + 0b10001000, + 0b01110000, + 0b00000000, + //65 A + 0b00100000, + 0b01010000, + 0b10001000, + 0b11111000, + 0b10001000, + 0b10001000, + 0b00000000, + 0b00000000, + //B + 0b11110000, + 0b10001000, + 0b11110000, + 0b10001000, + 0b10001000, + 0b11110000, + 0b00000000, + 0b00000000, + //C + 0b01110000, + 0b10001000, + 0b10000000, + 0b10000000, + 0b10001000, + 0b01110000, + 0b00000000, + 0b00000000, + //D + 0b11110000, + 0b10001000, + 0b10001000, + 0b10001000, + 0b10001000, + 0b11110000, + 0b00000000, + 0b00000000, + //E + 0b11111000, + 0b10000000, + 0b11111000, + 0b10000000, + 0b10000000, + 0b11111000, + 0b00000000, + 0b00000000, + //F + 0b11111000, + 0b10000000, + 0b11110000, + 0b10000000, + 0b10000000, + 0b10000000, + 0b00000000, + 0b00000000, + //G + 0b01110000, + 0b10001000, + 0b10000000, + 0b10011000, + 0b10001000, + 0b01110000, + 0b00000000, + 0b00000000, + //H + 0b10001000, + 0b10001000, + 0b11111000, + 0b10001000, + 0b10001000, + 0b10001000, + 0b00000000, + 0b00000000, + //I + 0b01110000, + 0b00100000, + 0b00100000, + 0b00100000, + 0b00100000, + 0b01110000, + 0b00000000, + 0b00000000, + //J + 0b00111000, + 0b00010000, + 0b00010000, + 0b00010000, + 0b10010000, + 0b01100000, + 0b00000000, + 0b00000000, + //K + 0b10001000, + 0b10010000, + 0b11100000, + 0b10100000, + 0b10010000, + 0b10001000, + 0b00000000, + 0b00000000, + //L + 0b10000000, + 0b10000000, + 0b10000000, + 0b10000000, + 0b10000000, + 0b11111000, + 0b00000000, + 0b00000000, + //M + 0b10001000, + 0b11011000, + 0b10101000, + 0b10101000, + 0b10001000, + 0b10001000, + 0b00000000, + 0b00000000, + //N + 0b10001000, + 0b10001000, + 0b11001000, + 0b10101000, + 0b10011000, + 0b10001000, + 0b00000000, + 0b00000000, + //O + 0b01110000, + 0b10001000, + 0b10001000, + 0b10001000, + 0b10001000, + 0b01110000, + 0b00000000, + 0b00000000, + //P + 0b11110000, + 0b10001000, + 0b11110000, + 0b10000000, + 0b10000000, + 0b10000000, + 0b00000000, + 0b00000000, + //Q + 0b01110000, + 0b10001000, + 0b10001000, + 0b10101000, + 0b10010000, + 0b01101000, + 0b00000000, + 0b00000000, + //R + 0b11110000, + 0b10001000, + 0b11110000, + 0b10100000, + 0b10010000, + 0b10001000, + 0b00000000, + 0b00000000, + //S + 0b01111000, + 0b10000000, + 0b01110000, + 0b00001000, + 0b00001000, + 0b11110000, + 0b00000000, + 0b00000000, + //T + 0b11111000, + 0b00100000, + 0b00100000, + 0b00100000, + 0b00100000, + 0b00100000, + 0b00000000, + 0b00000000, + //U + 0b10001000, + 0b10001000, + 0b10001000, + 0b10001000, + 0b10001000, + 0b01110000, + 0b00000000, + 0b00000000, + //V + 0b10001000, + 0b10001000, + 0b10001000, + 0b10001000, + 0b01010000, + 0b00100000, + 0b00000000, + 0b00000000, + //W + 0b10001000, + 0b10001000, + 0b10101000, + 0b10101000, + 0b10101000, + 0b01010000, + 0b00000000, + 0b00000000, + //X + 0b10001000, + 0b01010000, + 0b00100000, + 0b01010000, + 0b10001000, + 0b10001000, + 0b00000000, + 0b00000000, + //Y + 0b10001000, + 0b10001000, + 0b01010000, + 0b00100000, + 0b00100000, + 0b00100000, + 0b00000000, + 0b00000000, + //Z + 0b11111000, + 0b00001000, + 0b00010000, + 0b00100000, + 0b01000000, + 0b11111000, + 0b00000000, + 0b00000000, + //91 [ + 0b11100000, + 0b10000000, + 0b10000000, + 0b10000000, + 0b10000000, + 0b11100000, + 0b00000000, + 0b00000000, + //92 (backslash) + 0b00000000, + 0b10000000, + 0b01000000, + 0b00100000, + 0b00010000, + 0b00001000, + 0b00000000, + 0b00000000, + //93 ] + 0b00111000, + 0b00001000, + 0b00001000, + 0b00001000, + 0b00001000, + 0b00111000, + 0b00000000, + 0b00000000, + //94 ^ + 0b00100000, + 0b01010000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + //95 _ + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b11111000, + 0b00000000, + //96 ` + 0b10000000, + 0b01000000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + //97 a + 0b00000000, + 0b01100000, + 0b00010000, + 0b01110000, + 0b10010000, + 0b01100000, + 0b00000000, + 0b00000000, + //98 b + 0b10000000, + 0b10000000, + 0b11100000, + 0b10010000, + 0b10010000, + 0b11100000, + 0b00000000, + 0b00000000, + //99 c + 0b00000000, + 0b00000000, + 0b01110000, + 0b10000000, + 0b10000000, + 0b01110000, + 0b00000000, + 0b00000000, + // 100 d + 0b00010000, + 0b00010000, + 0b01110000, + 0b10010000, + 0b10010000, + 0b01110000, + 0b00000000, + 0b00000000, + //101 e + 0b00000000, + 0b01100000, + 0b10010000, + 0b11110000, + 0b10000000, + 0b01110000, + 0b00000000, + 0b00000000, + //102 f + 0b00110000, + 0b01000000, + 0b11100000, + 0b01000000, + 0b01000000, + 0b01000000, + 0b00000000, + 0b00000000, + //103 g + 0b00000000, + 0b01100000, + 0b10010000, + 0b01110000, + 0b00010000, + 0b00010000, + 0b01100000, + 0b00000000, + //104 h + 0b10000000, + 0b10000000, + 0b11100000, + 0b10010000, + 0b10010000, + 0b10010000, + 0b00000000, + 0b00000000, + //105 i + 0b00100000, + 0b00000000, + 0b00100000, + 0b00100000, + 0b00100000, + 0b01110000, + 0b00000000, + 0b00000000, + //106 j + 0b00010000, + 0b00000000, + 0b00110000, + 0b00010000, + 0b00010000, + 0b00010000, + 0b01100000, + 0b00000000, + //107 k + 0b10000000, + 0b10010000, + 0b10100000, + 0b11000000, + 0b10100000, + 0b10010000, + 0b00000000, + 0b00000000, + //108 l + 0b01100000, + 0b00100000, + 0b00100000, + 0b00100000, + 0b00100000, + 0b01110000, + 0b00000000, + 0b00000000, + //109 m + 0b00000000, + 0b00000000, + 0b01010000, + 0b10101000, + 0b10101000, + 0b10101000, + 0b00000000, + 0b00000000, + //110 n + 0b00000000, + 0b00000000, + 0b11110000, + 0b10001000, + 0b10001000, + 0b10001000, + 0b00000000, + 0b00000000, + //111 o + 0b00000000, + 0b00000000, + 0b01100000, + 0b10010000, + 0b10010000, + 0b01100000, + 0b00000000, + 0b00000000, + //112 p + 0b00000000, + 0b00000000, + 0b01100000, + 0b10010000, + 0b11110000, + 0b10000000, + 0b10000000, + 0b00000000, + //113 q + 0b00000000, + 0b00000000, + 0b01100000, + 0b10010000, + 0b11110000, + 0b00010000, + 0b00010000, + 0b00000000, + //114 r + 0b00000000, + 0b00000000, + 0b10110000, + 0b01001000, + 0b01000000, + 0b01000000, + 0b00000000, + 0b00000000, + //115 s + 0b00000000, + 0b00110000, + 0b01000000, + 0b00100000, + 0b00010000, + 0b01100000, + 0b00000000, + 0b00000000, + //116 t + 0b01000000, + 0b01000000, + 0b11100000, + 0b01000000, + 0b01000000, + 0b01000000, + 0b00000000, + 0b00000000, + // 117u + 0b00000000, + 0b00000000, + 0b10010000, + 0b10010000, + 0b10010000, + 0b01100000, + 0b00000000, + 0b00000000, + //118 v + 0b00000000, + 0b00000000, + 0b10001000, + 0b10001000, + 0b01010000, + 0b00100000, + 0b00000000, + 0b00000000, + //119 w + 0b00000000, + 0b00000000, + 0b10001000, + 0b10101000, + 0b10101000, + 0b01010000, + 0b00000000, + 0b00000000, + //120 x + 0b00000000, + 0b10001000, + 0b01010000, + 0b00100000, + 0b01010000, + 0b10001000, + 0b00000000, + 0b00000000, + //121 y + 0b00000000, + 0b00000000, + 0b10010000, + 0b10010000, + 0b01100000, + 0b01000000, + 0b10000000, + 0b00000000, + //122 z + 0b00000000, + 0b00000000, + 0b11110000, + 0b00100000, + 0b01000000, + 0b11110000, + 0b00000000, + 0b00000000, + //123 { + 0b00100000, + 0b01000000, + 0b01000000, + 0b10000000, + 0b01000000, + 0b01000000, + 0b00100000, + 0b00000000, + //124 | + 0b00100000, + 0b00100000, + 0b00100000, + 0b00100000, + 0b00100000, + 0b00100000, + 0b00100000, + 0b00000000, + //125 } + 0b00100000, + 0b00010000, + 0b00010000, + 0b00001000, + 0b00010000, + 0b00010000, + 0b00100000, + 0b00000000, + //126 ~ + 0b01000000, + 0b10101000, + 0b00010000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + //127 DEL + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000, + 0b00000000 +}; \ No newline at end of file diff --git a/demopal/lib/TVoutfonts/font6x8.h b/demopal/lib/TVoutfonts/font6x8.h new file mode 100755 index 0000000..e5390e8 --- /dev/null +++ b/demopal/lib/TVoutfonts/font6x8.h @@ -0,0 +1,8 @@ +#ifndef FONT6X8_H +#define FONT6X8_H + +#include + +extern const unsigned char font6x8[]; + +#endif \ No newline at end of file diff --git a/demopal/lib/TVoutfonts/font8x8.cpp b/demopal/lib/TVoutfonts/font8x8.cpp new file mode 100755 index 0000000..337da90 --- /dev/null +++ b/demopal/lib/TVoutfonts/font8x8.cpp @@ -0,0 +1,133 @@ +#include "font8x8.h" + +PROGMEM const unsigned char font8x8[] = { +8,8,0, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x3E, 0x41, 0x55, 0x41, 0x55, 0x49, 0x3E, +0x00, 0x3E, 0x7F, 0x6B, 0x7F, 0x6B, 0x77, 0x3E, +0x00, 0x22, 0x77, 0x7F, 0x7F, 0x3E, 0x1C, 0x08, +0x00, 0x08, 0x1C, 0x3E, 0x7F, 0x3E, 0x1C, 0x08, +0x00, 0x08, 0x1C, 0x2A, 0x7F, 0x2A, 0x08, 0x1C, +0x00, 0x08, 0x1C, 0x3E, 0x7F, 0x3E, 0x08, 0x1C, +0x00, 0x00, 0x1C, 0x3E, 0x3E, 0x3E, 0x1C, 0x00, +0xFF, 0xFF, 0xE3, 0xC1, 0xC1, 0xC1, 0xE3, 0xFF, +0x00, 0x00, 0x1C, 0x22, 0x22, 0x22, 0x1C, 0x00, +0xFF, 0xFF, 0xE3, 0xDD, 0xDD, 0xDD, 0xE3, 0xFF, +0x00, 0x0F, 0x03, 0x05, 0x39, 0x48, 0x48, 0x30, +0x00, 0x08, 0x3E, 0x08, 0x1C, 0x22, 0x22, 0x1C, +0x00, 0x18, 0x14, 0x10, 0x10, 0x30, 0x70, 0x60, +0x00, 0x0F, 0x19, 0x11, 0x13, 0x37, 0x76, 0x60, +0x00, 0x08, 0x2A, 0x1C, 0x77, 0x1C, 0x2A, 0x08, +0x00, 0x60, 0x78, 0x7E, 0x7F, 0x7E, 0x78, 0x60, +0x00, 0x03, 0x0F, 0x3F, 0x7F, 0x3F, 0x0F, 0x03, +0x00, 0x08, 0x1C, 0x2A, 0x08, 0x2A, 0x1C, 0x08, +0x00, 0x66, 0x66, 0x66, 0x66, 0x00, 0x66, 0x66, +0x00, 0x3F, 0x65, 0x65, 0x3D, 0x05, 0x05, 0x05, +0x00, 0x0C, 0x32, 0x48, 0x24, 0x12, 0x4C, 0x30, +0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x7F, 0x7F, +0x00, 0x08, 0x1C, 0x2A, 0x08, 0x2A, 0x1C, 0x3E, +0x00, 0x08, 0x1C, 0x3E, 0x7F, 0x1C, 0x1C, 0x1C, +0x00, 0x1C, 0x1C, 0x1C, 0x7F, 0x3E, 0x1C, 0x08, +0x00, 0x08, 0x0C, 0x7E, 0x7F, 0x7E, 0x0C, 0x08, +0x00, 0x08, 0x18, 0x3F, 0x7F, 0x3F, 0x18, 0x08, +0x00, 0x00, 0x00, 0x70, 0x70, 0x70, 0x7F, 0x7F, +0x00, 0x00, 0x14, 0x22, 0x7F, 0x22, 0x14, 0x00, +0x00, 0x08, 0x1C, 0x1C, 0x3E, 0x3E, 0x7F, 0x7F, +0x00, 0x7F, 0x7F, 0x3E, 0x3E, 0x1C, 0x1C, 0x08, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x18, 0x3C, 0x3C, 0x18, 0x18, 0x00, 0x18, +0x00, 0x36, 0x36, 0x14, 0x00, 0x00, 0x00, 0x00, +0x00, 0x36, 0x36, 0x7F, 0x36, 0x7F, 0x36, 0x36, +0x00, 0x08, 0x1E, 0x20, 0x1C, 0x02, 0x3C, 0x08, +0x00, 0x60, 0x66, 0x0C, 0x18, 0x30, 0x66, 0x06, +0x00, 0x3C, 0x66, 0x3C, 0x28, 0x65, 0x66, 0x3F, +0x00, 0x18, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, +0x00, 0x60, 0x30, 0x18, 0x18, 0x18, 0x30, 0x60, +0x00, 0x06, 0x0C, 0x18, 0x18, 0x18, 0x0C, 0x06, +0x00, 0x00, 0x36, 0x1C, 0x7F, 0x1C, 0x36, 0x00, +0x00, 0x00, 0x08, 0x08, 0x3E, 0x08, 0x08, 0x00, +0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x30, 0x60, +0x00, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, +0x00, 0x00, 0x06, 0x0C, 0x18, 0x30, 0x60, 0x00, +0x00, 0x3C, 0x66, 0x6E, 0x76, 0x66, 0x66, 0x3C, +0x00, 0x18, 0x18, 0x38, 0x18, 0x18, 0x18, 0x7E, +0x00, 0x3C, 0x66, 0x06, 0x0C, 0x30, 0x60, 0x7E, +0x00, 0x3C, 0x66, 0x06, 0x1C, 0x06, 0x66, 0x3C, +0x00, 0x0C, 0x1C, 0x2C, 0x4C, 0x7E, 0x0C, 0x0C, +0x00, 0x7E, 0x60, 0x7C, 0x06, 0x06, 0x66, 0x3C, +0x00, 0x3C, 0x66, 0x60, 0x7C, 0x66, 0x66, 0x3C, +0x00, 0x7E, 0x66, 0x0C, 0x0C, 0x18, 0x18, 0x18, +0x00, 0x3C, 0x66, 0x66, 0x3C, 0x66, 0x66, 0x3C, +0x00, 0x3C, 0x66, 0x66, 0x3E, 0x06, 0x66, 0x3C, +0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00, +0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x30, +0x00, 0x06, 0x0C, 0x18, 0x30, 0x18, 0x0C, 0x06, +0x00, 0x00, 0x00, 0x3C, 0x00, 0x3C, 0x00, 0x00, +0x00, 0x60, 0x30, 0x18, 0x0C, 0x18, 0x30, 0x60, +0x00, 0x3C, 0x66, 0x06, 0x1C, 0x18, 0x00, 0x18, +0x00, 0x38, 0x44, 0x5C, 0x58, 0x42, 0x3C, 0x00, +0x00, 0x3C, 0x66, 0x66, 0x7E, 0x66, 0x66, 0x66, +0x00, 0x7C, 0x66, 0x66, 0x7C, 0x66, 0x66, 0x7C, +0x00, 0x3C, 0x66, 0x60, 0x60, 0x60, 0x66, 0x3C, +0x00, 0x7C, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7C, +0x00, 0x7E, 0x60, 0x60, 0x7C, 0x60, 0x60, 0x7E, +0x00, 0x7E, 0x60, 0x60, 0x7C, 0x60, 0x60, 0x60, +0x00, 0x3C, 0x66, 0x60, 0x60, 0x6E, 0x66, 0x3C, +0x00, 0x66, 0x66, 0x66, 0x7E, 0x66, 0x66, 0x66, +0x00, 0x3C, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3C, +0x00, 0x1E, 0x0C, 0x0C, 0x0C, 0x6C, 0x6C, 0x38, +0x00, 0x66, 0x6C, 0x78, 0x70, 0x78, 0x6C, 0x66, +0x00, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x7E, +0x00, 0x63, 0x77, 0x7F, 0x6B, 0x63, 0x63, 0x63, +0x00, 0x63, 0x73, 0x7B, 0x6F, 0x67, 0x63, 0x63, +0x00, 0x3C, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3C, +0x00, 0x7C, 0x66, 0x66, 0x66, 0x7C, 0x60, 0x60, +0x00, 0x3C, 0x66, 0x66, 0x66, 0x6E, 0x3C, 0x06, +0x00, 0x7C, 0x66, 0x66, 0x7C, 0x78, 0x6C, 0x66, +0x00, 0x3C, 0x66, 0x60, 0x3C, 0x06, 0x66, 0x3C, +0x00, 0x7E, 0x5A, 0x18, 0x18, 0x18, 0x18, 0x18, +0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3E, +0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3C, 0x18, +0x00, 0x63, 0x63, 0x63, 0x6B, 0x7F, 0x77, 0x63, +0x00, 0x63, 0x63, 0x36, 0x1C, 0x36, 0x63, 0x63, +0x00, 0x66, 0x66, 0x66, 0x3C, 0x18, 0x18, 0x18, +0x00, 0x7E, 0x06, 0x0C, 0x18, 0x30, 0x60, 0x7E, +0x00, 0x1E, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1E, +0x00, 0x00, 0x60, 0x30, 0x18, 0x0C, 0x06, 0x00, +0x00, 0x78, 0x18, 0x18, 0x18, 0x18, 0x18, 0x78, +0x00, 0x08, 0x14, 0x22, 0x41, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, +0x00, 0x0C, 0x0C, 0x06, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x3C, 0x06, 0x3E, 0x66, 0x3E, +0x00, 0x60, 0x60, 0x60, 0x7C, 0x66, 0x66, 0x7C, +0x00, 0x00, 0x00, 0x3C, 0x66, 0x60, 0x66, 0x3C, +0x00, 0x06, 0x06, 0x06, 0x3E, 0x66, 0x66, 0x3E, +0x00, 0x00, 0x00, 0x3C, 0x66, 0x7E, 0x60, 0x3C, +0x00, 0x1C, 0x36, 0x30, 0x30, 0x7C, 0x30, 0x30, +0x00, 0x00, 0x3E, 0x66, 0x66, 0x3E, 0x06, 0x3C, +0x00, 0x60, 0x60, 0x60, 0x7C, 0x66, 0x66, 0x66, +0x00, 0x00, 0x18, 0x00, 0x18, 0x18, 0x18, 0x3C, +0x00, 0x0C, 0x00, 0x0C, 0x0C, 0x6C, 0x6C, 0x38, +0x00, 0x60, 0x60, 0x66, 0x6C, 0x78, 0x6C, 0x66, +0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, +0x00, 0x00, 0x00, 0x63, 0x77, 0x7F, 0x6B, 0x6B, +0x00, 0x00, 0x00, 0x7C, 0x7E, 0x66, 0x66, 0x66, +0x00, 0x00, 0x00, 0x3C, 0x66, 0x66, 0x66, 0x3C, +0x00, 0x00, 0x7C, 0x66, 0x66, 0x7C, 0x60, 0x60, +0x00, 0x00, 0x3C, 0x6C, 0x6C, 0x3C, 0x0D, 0x0F, +0x00, 0x00, 0x00, 0x7C, 0x66, 0x66, 0x60, 0x60, +0x00, 0x00, 0x00, 0x3E, 0x40, 0x3C, 0x02, 0x7C, +0x00, 0x00, 0x18, 0x18, 0x7E, 0x18, 0x18, 0x18, +0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3E, +0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x3C, 0x18, +0x00, 0x00, 0x00, 0x63, 0x6B, 0x6B, 0x6B, 0x3E, +0x00, 0x00, 0x00, 0x66, 0x3C, 0x18, 0x3C, 0x66, +0x00, 0x00, 0x00, 0x66, 0x66, 0x3E, 0x06, 0x3C, +0x00, 0x00, 0x00, 0x3C, 0x0C, 0x18, 0x30, 0x3C, +0x00, 0x0E, 0x18, 0x18, 0x30, 0x18, 0x18, 0x0E, +0x00, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, +0x00, 0x70, 0x18, 0x18, 0x0C, 0x18, 0x18, 0x70, +0x00, 0x00, 0x00, 0x3A, 0x6C, 0x00, 0x00, 0x00, +0x00, 0x08, 0x1C, 0x36, 0x63, 0x41, 0x41, 0x7F +}; \ No newline at end of file diff --git a/demopal/lib/TVoutfonts/font8x8.h b/demopal/lib/TVoutfonts/font8x8.h new file mode 100755 index 0000000..1d1c88d --- /dev/null +++ b/demopal/lib/TVoutfonts/font8x8.h @@ -0,0 +1,7 @@ +#ifndef FONT8X8_H +#define FONT8X8_H + +#include +extern const unsigned char font8x8[]; + +#endif \ No newline at end of file diff --git a/demopal/lib/TVoutfonts/font8x8ext.cpp b/demopal/lib/TVoutfonts/font8x8ext.cpp new file mode 100755 index 0000000..f3815eb --- /dev/null +++ b/demopal/lib/TVoutfonts/font8x8ext.cpp @@ -0,0 +1,261 @@ +#include "font8x8ext.h" + +PROGMEM const unsigned char font8x8ext[] = { +8,8,0, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x7E, 0x81, 0xA5, 0x81, 0xBD, 0x99, 0x81, 0x7E, +0x7E, 0xFF, 0xDB, 0xFF, 0xC3, 0xE7, 0xFF, 0x7E, +0x6C, 0xFE, 0xFE, 0xFE, 0x7C, 0x38, 0x10, 0x00, +0x10, 0x38, 0x7C, 0xFE, 0x7C, 0x38, 0x10, 0x00, +0x38, 0x7C, 0x38, 0xFE, 0xFE, 0xD6, 0x10, 0x38, +0x10, 0x38, 0x7C, 0xFE, 0xFE, 0x7C, 0x10, 0x38, +0x00, 0x00, 0x18, 0x3C, 0x3C, 0x18, 0x00, 0x00, +0xFF, 0xFF, 0xE7, 0xC3, 0xC3, 0xE7, 0xFF, 0xFF, +0x00, 0x3C, 0x66, 0x42, 0x42, 0x66, 0x3C, 0x00, +0xFF, 0xC3, 0x99, 0xBD, 0xBD, 0x99, 0xC3, 0xFF, +0x0F, 0x07, 0x0F, 0x7D, 0xCC, 0xCC, 0xCC, 0x78, +0x3C, 0x66, 0x66, 0x66, 0x3C, 0x18, 0x7E, 0x18, +0x3F, 0x33, 0x3F, 0x30, 0x30, 0x70, 0xF0, 0xE0, +0x7F, 0x63, 0x7F, 0x63, 0x63, 0x67, 0xE6, 0xC0, +0x18, 0xDB, 0x3C, 0xE7, 0xE7, 0x3C, 0xDB, 0x18, +0x80, 0xE0, 0xF8, 0xFE, 0xF8, 0xE0, 0x80, 0x00, +0x02, 0x0E, 0x3E, 0xFE, 0x3E, 0x0E, 0x02, 0x00, +0x18, 0x3C, 0x7E, 0x18, 0x18, 0x7E, 0x3C, 0x18, +0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x66, 0x00, +0x7F, 0xDB, 0xDB, 0x7B, 0x1B, 0x1B, 0x1B, 0x00, +0x3E, 0x61, 0x3C, 0x66, 0x66, 0x3C, 0x86, 0x7C, +0x00, 0x00, 0x00, 0x00, 0x7E, 0x7E, 0x7E, 0x00, +0x18, 0x3C, 0x7E, 0x18, 0x7E, 0x3C, 0x18, 0xFF, +0x18, 0x3C, 0x7E, 0x18, 0x18, 0x18, 0x18, 0x00, +0x18, 0x18, 0x18, 0x18, 0x7E, 0x3C, 0x18, 0x00, +0x00, 0x18, 0x0C, 0xFE, 0x0C, 0x18, 0x00, 0x00, +0x00, 0x30, 0x60, 0xFE, 0x60, 0x30, 0x00, 0x00, +0x00, 0x00, 0xC0, 0xC0, 0xC0, 0xFE, 0x00, 0x00, +0x00, 0x24, 0x66, 0xFF, 0x66, 0x24, 0x00, 0x00, +0x00, 0x18, 0x3C, 0x7E, 0xFF, 0xFF, 0x00, 0x00, +0x00, 0xFF, 0xFF, 0x7E, 0x3C, 0x18, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x18, 0x3C, 0x3C, 0x18, 0x18, 0x00, 0x18, 0x00, +0x66, 0x66, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, +0x6C, 0x6C, 0xFE, 0x6C, 0xFE, 0x6C, 0x6C, 0x00, +0x18, 0x3E, 0x60, 0x3C, 0x06, 0x7C, 0x18, 0x00, +0x00, 0xC6, 0xCC, 0x18, 0x30, 0x66, 0xC6, 0x00, +0x38, 0x6C, 0x38, 0x76, 0xDC, 0xCC, 0x76, 0x00, +0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, +0x0C, 0x18, 0x30, 0x30, 0x30, 0x18, 0x0C, 0x00, +0x30, 0x18, 0x0C, 0x0C, 0x0C, 0x18, 0x30, 0x00, +0x00, 0x66, 0x3C, 0xFF, 0x3C, 0x66, 0x00, 0x00, +0x00, 0x18, 0x18, 0x7E, 0x18, 0x18, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x30, +0x00, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, +0x06, 0x0C, 0x18, 0x30, 0x60, 0xC0, 0x80, 0x00, +0x7C, 0xC6, 0xCE, 0xD6, 0xE6, 0xC6, 0x7C, 0x00, +0x18, 0x38, 0x18, 0x18, 0x18, 0x18, 0x7E, 0x00, +0x7C, 0xC6, 0x06, 0x1C, 0x30, 0x66, 0xFE, 0x00, +0x7C, 0xC6, 0x06, 0x3C, 0x06, 0xC6, 0x7C, 0x00, +0x1C, 0x3C, 0x6C, 0xCC, 0xFE, 0x0C, 0x1E, 0x00, +0xFE, 0xC0, 0xC0, 0xFC, 0x06, 0xC6, 0x7C, 0x00, +0x38, 0x60, 0xC0, 0xFC, 0xC6, 0xC6, 0x7C, 0x00, +0xFE, 0xC6, 0x0C, 0x18, 0x30, 0x30, 0x30, 0x00, +0x7C, 0xC6, 0xC6, 0x7C, 0xC6, 0xC6, 0x7C, 0x00, +0x7C, 0xC6, 0xC6, 0x7E, 0x06, 0x0C, 0x78, 0x00, +0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x00, +0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x30, +0x06, 0x0C, 0x18, 0x30, 0x18, 0x0C, 0x06, 0x00, +0x00, 0x00, 0x7E, 0x00, 0x00, 0x7E, 0x00, 0x00, +0x60, 0x30, 0x18, 0x0C, 0x18, 0x30, 0x60, 0x00, +0x7C, 0xC6, 0x0C, 0x18, 0x18, 0x00, 0x18, 0x00, +0x7C, 0xC6, 0xDE, 0xDE, 0xDE, 0xC0, 0x78, 0x00, +0x38, 0x6C, 0xC6, 0xFE, 0xC6, 0xC6, 0xC6, 0x00, +0xFC, 0x66, 0x66, 0x7C, 0x66, 0x66, 0xFC, 0x00, +0x3C, 0x66, 0xC0, 0xC0, 0xC0, 0x66, 0x3C, 0x00, +0xF8, 0x6C, 0x66, 0x66, 0x66, 0x6C, 0xF8, 0x00, +0xFE, 0x62, 0x68, 0x78, 0x68, 0x62, 0xFE, 0x00, +0xFE, 0x62, 0x68, 0x78, 0x68, 0x60, 0xF0, 0x00, +0x3C, 0x66, 0xC0, 0xC0, 0xCE, 0x66, 0x3A, 0x00, +0xC6, 0xC6, 0xC6, 0xFE, 0xC6, 0xC6, 0xC6, 0x00, +0x3C, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00, +0x1E, 0x0C, 0x0C, 0x0C, 0xCC, 0xCC, 0x78, 0x00, +0xE6, 0x66, 0x6C, 0x78, 0x6C, 0x66, 0xE6, 0x00, +0xF0, 0x60, 0x60, 0x60, 0x62, 0x66, 0xFE, 0x00, +0xC6, 0xEE, 0xFE, 0xFE, 0xD6, 0xC6, 0xC6, 0x00, +0xC6, 0xE6, 0xF6, 0xDE, 0xCE, 0xC6, 0xC6, 0x00, +0x7C, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, +0xFC, 0x66, 0x66, 0x7C, 0x60, 0x60, 0xF0, 0x00, +0x7C, 0xC6, 0xC6, 0xC6, 0xC6, 0xCE, 0x7C, 0x0E, +0xFC, 0x66, 0x66, 0x7C, 0x6C, 0x66, 0xE6, 0x00, +0x7C, 0xC6, 0x60, 0x38, 0x0C, 0xC6, 0x7C, 0x00, +0x7E, 0x7E, 0x5A, 0x18, 0x18, 0x18, 0x3C, 0x00, +0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, +0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x6C, 0x38, 0x00, +0xC6, 0xC6, 0xC6, 0xD6, 0xD6, 0xFE, 0x6C, 0x00, +0xC6, 0xC6, 0x6C, 0x38, 0x6C, 0xC6, 0xC6, 0x00, +0x66, 0x66, 0x66, 0x3C, 0x18, 0x18, 0x3C, 0x00, +0xFE, 0xC6, 0x8C, 0x18, 0x32, 0x66, 0xFE, 0x00, +0x3C, 0x30, 0x30, 0x30, 0x30, 0x30, 0x3C, 0x00, +0xC0, 0x60, 0x30, 0x18, 0x0C, 0x06, 0x02, 0x00, +0x3C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x3C, 0x00, +0x10, 0x38, 0x6C, 0xC6, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, +0x30, 0x18, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x78, 0x0C, 0x7C, 0xCC, 0x76, 0x00, +0xE0, 0x60, 0x7C, 0x66, 0x66, 0x66, 0xDC, 0x00, +0x00, 0x00, 0x7C, 0xC6, 0xC0, 0xC6, 0x7C, 0x00, +0x1C, 0x0C, 0x7C, 0xCC, 0xCC, 0xCC, 0x76, 0x00, +0x00, 0x00, 0x7C, 0xC6, 0xFE, 0xC0, 0x7C, 0x00, +0x3C, 0x66, 0x60, 0xF8, 0x60, 0x60, 0xF0, 0x00, +0x00, 0x00, 0x76, 0xCC, 0xCC, 0x7C, 0x0C, 0xF8, +0xE0, 0x60, 0x6C, 0x76, 0x66, 0x66, 0xE6, 0x00, +0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x3C, 0x00, +0x06, 0x00, 0x06, 0x06, 0x06, 0x66, 0x66, 0x3C, +0xE0, 0x60, 0x66, 0x6C, 0x78, 0x6C, 0xE6, 0x00, +0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00, +0x00, 0x00, 0xEC, 0xFE, 0xD6, 0xD6, 0xD6, 0x00, +0x00, 0x00, 0xDC, 0x66, 0x66, 0x66, 0x66, 0x00, +0x00, 0x00, 0x7C, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, +0x00, 0x00, 0xDC, 0x66, 0x66, 0x7C, 0x60, 0xF0, +0x00, 0x00, 0x76, 0xCC, 0xCC, 0x7C, 0x0C, 0x1E, +0x00, 0x00, 0xDC, 0x76, 0x60, 0x60, 0xF0, 0x00, +0x00, 0x00, 0x7E, 0xC0, 0x7C, 0x06, 0xFC, 0x00, +0x30, 0x30, 0xFC, 0x30, 0x30, 0x36, 0x1C, 0x00, +0x00, 0x00, 0xCC, 0xCC, 0xCC, 0xCC, 0x76, 0x00, +0x00, 0x00, 0xC6, 0xC6, 0xC6, 0x6C, 0x38, 0x00, +0x00, 0x00, 0xC6, 0xD6, 0xD6, 0xFE, 0x6C, 0x00, +0x00, 0x00, 0xC6, 0x6C, 0x38, 0x6C, 0xC6, 0x00, +0x00, 0x00, 0xC6, 0xC6, 0xC6, 0x7E, 0x06, 0xFC, +0x00, 0x00, 0x7E, 0x4C, 0x18, 0x32, 0x7E, 0x00, +0x0E, 0x18, 0x18, 0x70, 0x18, 0x18, 0x0E, 0x00, +0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, +0x70, 0x18, 0x18, 0x0E, 0x18, 0x18, 0x70, 0x00, +0x76, 0xDC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x10, 0x38, 0x6C, 0xC6, 0xC6, 0xFE, 0x00, +0x60, 0xF0, 0x60, 0x7C, 0x66, 0x66, 0x66, 0x0C, +0xFC, 0x60, 0x7C, 0x66, 0x66, 0x66, 0x6C, 0x00, +0x1C, 0x10, 0x00, 0x7E, 0x60, 0x60, 0x60, 0x00, +0x38, 0x20, 0xFE, 0xC0, 0xC0, 0xC0, 0xC0, 0x00, +0x6C, 0x00, 0x7C, 0xC6, 0xFE, 0xC0, 0x7C, 0x00, +0x6C, 0xFE, 0x62, 0x78, 0x60, 0x62, 0xFE, 0x00, +0x00, 0x00, 0x7C, 0xC6, 0xF0, 0xC6, 0x7C, 0x00, +0x3C, 0x66, 0xC0, 0xF8, 0xC0, 0x66, 0x3C, 0x00, +0x00, 0x00, 0x7E, 0xC0, 0x7C, 0x06, 0xFC, 0x00, +0x7C, 0xC6, 0x60, 0x38, 0x0C, 0xC6, 0x7C, 0x00, +0x30, 0x00, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00, +0x78, 0x30, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00, +0xCC, 0x00, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00, +0x66, 0x3C, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00, +0x18, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x70, +0x1E, 0x0C, 0x0C, 0x0C, 0x0C, 0xCC, 0x78, 0x00, +0x00, 0x00, 0x70, 0x50, 0x5C, 0x52, 0xDC, 0x00, +0x70, 0x50, 0x5C, 0x52, 0x52, 0x52, 0xDC, 0x00, +0x00, 0x00, 0xA0, 0xA0, 0xFC, 0xA2, 0xBC, 0x00, +0xA0, 0xA0, 0xA0, 0xFC, 0xA2, 0xA2, 0xBC, 0x00, +0x60, 0xF0, 0x60, 0x7C, 0x66, 0x66, 0x66, 0x00, +0xF8, 0x60, 0x7C, 0x66, 0x66, 0x66, 0x66, 0x00, +0x1C, 0x10, 0xC6, 0xD8, 0xF8, 0xCC, 0xC6, 0x00, +0x18, 0xD6, 0xCC, 0xF8, 0xF8, 0xCC, 0xC6, 0x00, +0x6C, 0x38, 0xC6, 0xC6, 0xC6, 0x7E, 0x06, 0x7C, +0x38, 0xC6, 0xC6, 0x7E, 0x06, 0xC6, 0x7C, 0x00, +0x00, 0x00, 0xC6, 0xC6, 0xC6, 0xC6, 0xFE, 0x10, +0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xFE, 0x10, +0x00, 0x00, 0xDC, 0xD6, 0xF6, 0xD6, 0xDC, 0x00, +0xDC, 0xD6, 0xD6, 0xF6, 0xD6, 0xD6, 0xDC, 0x00, +0x00, 0x00, 0xF0, 0xB0, 0x3C, 0x36, 0x3C, 0x00, +0xF0, 0xF0, 0xB0, 0x3C, 0x36, 0x36, 0x3C, 0x00, +0x00, 0x00, 0x78, 0x0C, 0x7C, 0xCC, 0x76, 0x00, +0x3E, 0x66, 0xC6, 0xC6, 0xFE, 0xC6, 0xC6, 0x00, +0x06, 0x7C, 0xC0, 0x7C, 0xC6, 0xC6, 0x7C, 0x00, +0xFE, 0x66, 0x60, 0x7C, 0x66, 0x66, 0xFC, 0x00, +0x00, 0x00, 0xCC, 0xCC, 0xCC, 0xCC, 0xFE, 0x06, +0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xFE, 0x06, +0x00, 0x00, 0x3C, 0x6C, 0x6C, 0x6C, 0xFE, 0xC6, +0x1E, 0x36, 0x66, 0x66, 0x66, 0x66, 0xFF, 0xC3, +0x00, 0x00, 0x7C, 0xC6, 0xFE, 0xC0, 0x7C, 0x00, +0xFE, 0x62, 0x68, 0x78, 0x68, 0x62, 0xFE, 0x00, +0x00, 0x00, 0x7C, 0xD6, 0xD6, 0x7C, 0x10, 0x38, +0x7C, 0xD6, 0xD6, 0xD6, 0x7C, 0x10, 0x38, 0x00, +0x00, 0x00, 0xFE, 0x66, 0x60, 0x60, 0xF0, 0x00, +0xFE, 0x66, 0x60, 0x60, 0x60, 0x60, 0xF0, 0x00, +0x00, 0x33, 0x66, 0xCC, 0x66, 0x33, 0x00, 0x00, +0x00, 0xCC, 0x66, 0x33, 0x66, 0xCC, 0x00, 0x00, +0x22, 0x88, 0x22, 0x88, 0x22, 0x88, 0x22, 0x88, +0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, +0xDB, 0x77, 0xDB, 0xEE, 0xDB, 0x77, 0xDB, 0xEE, +0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, +0x18, 0x18, 0x18, 0x18, 0xF8, 0x18, 0x18, 0x18, +0x00, 0x00, 0xC6, 0x6C, 0x38, 0x6C, 0xC6, 0x00, +0xC6, 0xC6, 0x6C, 0x38, 0x6C, 0xC6, 0xC6, 0x00, +0x00, 0x00, 0xC6, 0xCE, 0xDE, 0xF6, 0xE6, 0x00, +0xC6, 0xC6, 0xCE, 0xDE, 0xF6, 0xE6, 0xC6, 0x00, +0x36, 0x36, 0xF6, 0x06, 0xF6, 0x36, 0x36, 0x36, +0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, +0x00, 0x00, 0xFE, 0x06, 0xF6, 0x36, 0x36, 0x36, +0x36, 0x36, 0xF6, 0x06, 0xFE, 0x00, 0x00, 0x00, +0x00, 0x38, 0xC6, 0xCE, 0xDE, 0xF6, 0xE6, 0x00, +0x38, 0xC6, 0xCE, 0xDE, 0xF6, 0xE6, 0xC6, 0x00, +0x00, 0x00, 0x00, 0x00, 0xF8, 0x18, 0x18, 0x18, +0x18, 0x18, 0x18, 0x18, 0x1F, 0x00, 0x00, 0x00, +0x18, 0x18, 0x18, 0x18, 0xFF, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0xFF, 0x18, 0x18, 0x18, +0x18, 0x18, 0x18, 0x18, 0x1F, 0x18, 0x18, 0x18, +0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, +0x18, 0x18, 0x18, 0x18, 0xFF, 0x18, 0x18, 0x18, +0x00, 0x00, 0xE6, 0x6C, 0x78, 0x6C, 0xE6, 0x00, +0xE6, 0x6C, 0x78, 0x78, 0x6C, 0x66, 0xE6, 0x00, +0x36, 0x36, 0x37, 0x30, 0x3F, 0x00, 0x00, 0x00, +0x00, 0x00, 0x3F, 0x30, 0x37, 0x36, 0x36, 0x36, +0x36, 0x36, 0xF7, 0x00, 0xFF, 0x00, 0x00, 0x00, +0x00, 0x00, 0xFF, 0x00, 0xF7, 0x36, 0x36, 0x36, +0x36, 0x36, 0x37, 0x30, 0x37, 0x36, 0x36, 0x36, +0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, +0x36, 0x36, 0xF7, 0x00, 0xF7, 0x36, 0x36, 0x36, +0x00, 0xC6, 0x7C, 0xC6, 0xC6, 0x7C, 0xC6, 0x00, +0x00, 0x00, 0x3E, 0x66, 0x66, 0x66, 0xE6, 0x00, +0x1E, 0x36, 0x66, 0x66, 0x66, 0x66, 0xC6, 0x00, +0x00, 0x00, 0xC6, 0xFE, 0xFE, 0xD6, 0xC6, 0x00, +0xC6, 0xEE, 0xFE, 0xFE, 0xD6, 0xC6, 0xC6, 0x00, +0x00, 0x00, 0xC6, 0xC6, 0xFE, 0xC6, 0xC6, 0x00, +0xC6, 0xC6, 0xC6, 0xFE, 0xC6, 0xC6, 0xC6, 0x00, +0x00, 0x00, 0x7C, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, +0x7C, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, +0x00, 0x00, 0xFE, 0xC6, 0xC6, 0xC6, 0xC6, 0x00, +0x18, 0x18, 0x18, 0x18, 0xF8, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x1F, 0x18, 0x18, 0x18, +0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, +0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, +0xFE, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x00, +0x00, 0x00, 0x7E, 0xC6, 0x7E, 0x66, 0xC6, 0x00, +0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, +0x7E, 0xC6, 0xC6, 0xC6, 0x7E, 0x66, 0xC6, 0x00, +0x00, 0x00, 0xFC, 0x66, 0x66, 0x7C, 0x60, 0xF0, +0xFC, 0x66, 0x66, 0x66, 0x7C, 0x60, 0xF0, 0x00, +0x00, 0x00, 0x7C, 0xC6, 0xC0, 0xC6, 0x7C, 0x00, +0x7C, 0xC6, 0xC0, 0xC0, 0xC0, 0xC6, 0x7C, 0x00, +0x00, 0x00, 0x7E, 0x5A, 0x18, 0x18, 0x3C, 0x00, +0x7E, 0x5A, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00, +0x00, 0x00, 0xC6, 0xC6, 0xC6, 0x7E, 0x06, 0x7C, +0xC6, 0xC6, 0xC6, 0x7E, 0x06, 0xC6, 0x7C, 0x00, +0x00, 0x00, 0xD6, 0x7C, 0x38, 0x7C, 0xD6, 0x00, +0xD6, 0xD6, 0x7C, 0x38, 0x7C, 0xD6, 0xD6, 0x00, +0x00, 0x00, 0xFC, 0x66, 0x7C, 0x66, 0xFC, 0x00, +0xFC, 0x66, 0x66, 0x7C, 0x66, 0x66, 0xFC, 0x00, +0x00, 0x00, 0xF0, 0x60, 0x7C, 0x66, 0xFC, 0x00, +0xF0, 0x60, 0x60, 0x7C, 0x66, 0x66, 0x7C, 0x00, +0x8F, 0xCD, 0xEF, 0xFC, 0xDC, 0xCC, 0xCC, 0x00, +0x00, 0x00, 0x00, 0x7C, 0x7C, 0x00, 0x00, 0x00, +0x00, 0x00, 0xC6, 0xC6, 0xF6, 0xDE, 0xF6, 0x00, +0xC6, 0xC6, 0xC6, 0xF6, 0xDE, 0xDE, 0xF6, 0x00, +0x00, 0x00, 0x7C, 0xC6, 0x1C, 0xC6, 0x7C, 0x00, +0x7C, 0xC6, 0x06, 0x3C, 0x06, 0xC6, 0x7C, 0x00, +0x00, 0x00, 0xD6, 0xD6, 0xD6, 0xD6, 0xFE, 0x00, +0xD6, 0xD6, 0xD6, 0xD6, 0xD6, 0xD6, 0xFE, 0x00, +0x00, 0x00, 0x7C, 0xC6, 0x1E, 0xC6, 0x7C, 0x00, +0x78, 0x8C, 0x06, 0x3E, 0x06, 0x8C, 0x78, 0x00, +0x00, 0x00, 0xD6, 0xD6, 0xD6, 0xD6, 0xFF, 0x03, +0xD6, 0xD6, 0xD6, 0xD6, 0xD6, 0xD6, 0xFF, 0x03, +0x00, 0x00, 0xC6, 0xC6, 0x7E, 0x06, 0x06, 0x00, +0xC6, 0xC6, 0xC6, 0x7E, 0x06, 0x06, 0x06, 0x00, +0x3E, 0x61, 0x3C, 0x66, 0x66, 0x3C, 0x86, 0x7C, +0x00, 0x00, 0x3C, 0x3C, 0x3C, 0x3C, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +}; \ No newline at end of file diff --git a/demopal/lib/TVoutfonts/font8x8ext.h b/demopal/lib/TVoutfonts/font8x8ext.h new file mode 100755 index 0000000..8f888ca --- /dev/null +++ b/demopal/lib/TVoutfonts/font8x8ext.h @@ -0,0 +1,7 @@ +#ifndef FONT8X8EXT_H +#define FONT8X8EXT_H + +#include +extern const unsigned char font8x8ext[]; + +#endif \ No newline at end of file diff --git a/demopal/lib/TVoutfonts/fontALL.h b/demopal/lib/TVoutfonts/fontALL.h new file mode 100755 index 0000000..4362761 --- /dev/null +++ b/demopal/lib/TVoutfonts/fontALL.h @@ -0,0 +1,9 @@ +#ifndef FONTALL_H +#define FONTALL_H + +#include "font4x6.h" +#include "font6x8.h" +#include "font8x8.h" +#include "font8x8ext.h" + +#endif \ No newline at end of file diff --git a/demopal/lib/TVoutfonts/keywords.txt b/demopal/lib/TVoutfonts/keywords.txt new file mode 100755 index 0000000..9296ca1 --- /dev/null +++ b/demopal/lib/TVoutfonts/keywords.txt @@ -0,0 +1,5 @@ +font4x6 LITERAL1 +font6x8 LITERAL1 +font8x8 LITERAL1 +font8x8ext LITERAL1 + diff --git a/demopal/lib/pollserial/pollserial.cpp b/demopal/lib/pollserial/pollserial.cpp new file mode 100755 index 0000000..a417098 --- /dev/null +++ b/demopal/lib/pollserial/pollserial.cpp @@ -0,0 +1,139 @@ +/* + pollserial.cpp Heavily modified version of: + + HardwareSerial.cpp - Hardware serial library for Wiring + Copyright (c) 2006 Nicholas Zambetti. All right reserved. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Modified 23 November 2006 by David A. Mellis + + Modified July 2010 by Myles D. Metzler +*/ + +#include +#include +#include "pollserial.h" + +#define BUFFER_SIZE 64 + +rbuffer rxbuffer = {0,0,0}; + +void USART_recieve() { +#if defined ( UDR0 ) + if( UCSR0A & _BV(RXC0)) { + uint8_t i = (rxbuffer.head + 1) & (BUFFER_SIZE - 1); + if ( i != rxbuffer.tail) { + rxbuffer.buffer[rxbuffer.head] = UDR0; + rxbuffer.head = i; + } + } +#else + if( UCSRA & _BV(RXC)) { + uint8_t i = (rxbuffer.head + 1) & (BUFFER_SIZE - 1); + if ( i != rxbuffer.tail) { + rxbuffer.buffer[rxbuffer.head] = UDR; + rxbuffer.head = i; + } + } +#endif +} + +pt2Funct pollserial::begin(long baud) { + uint16_t baud_setting; + bool use_u2x; + + rxbuffer.buffer = (unsigned char*)malloc(BUFFER_SIZE*sizeof(unsigned char)); + + // U2X mode is needed for baud rates higher than (CPU Hz / 16) + if (baud > F_CPU / 16) { + use_u2x = true; + } + else { + // figure out if U2X mode would allow for a better connection + + // calculate the percent difference between the baud-rate specified and + // the real baud rate for both U2X and non-U2X mode (0-255 error percent) + uint8_t nonu2x_baud_error = abs((int)(255-((F_CPU/(16*(((F_CPU/8/baud-1)/2)+1))*255)/baud))); + uint8_t u2x_baud_error = abs((int)(255-((F_CPU/(8*(((F_CPU/4/baud-1)/2)+1))*255)/baud))); + + // prefer non-U2X mode because it handles clock skew better + use_u2x = (nonu2x_baud_error > u2x_baud_error); + } + if (use_u2x) { +#if defined ( UDR0 ) + UCSR0A = _BV(U2X0); +#else + UCSRA = _BV(U2X); +#endif + baud_setting = (F_CPU / 4 / baud - 1) / 2; + } + else { +#if defined ( UDR0 ) + UCSR0A = 0; +#else + UCSRA = 0; +#endif + baud_setting = (F_CPU / 8 / baud - 1) / 2; + } + + // assign the baud_setting, a.k.a. (USART Baud Rate Register) +#if defined ( UDR0 ) + UBRR0 = baud_setting; + UCSR0B = _BV(RXEN0) | _BV(TXEN0); +#else + UBRR = baud_setting; + UCSRB = _BV(RXEN) | _BV(TXEN); +#endif + + return &USART_recieve; +} + +void pollserial::end() { + UCSR0B &= ~(_BV(RXEN0) | _BV(TXEN0)); + free(rxbuffer.buffer); +} + +uint8_t pollserial::available() { + return (BUFFER_SIZE + rxbuffer.head - rxbuffer.tail) & (BUFFER_SIZE-1); +} + +int pollserial::read() { + if (rxbuffer.head == rxbuffer.tail) + return -1; + else { + uint8_t c = rxbuffer.buffer[rxbuffer.tail]; + //tail = (tail + 1) & 63; + if (rxbuffer.tail == BUFFER_SIZE) + rxbuffer.tail = 0; + else + rxbuffer.tail++; + return c; + } +} + +void pollserial::flush() { + rxbuffer.head = rxbuffer.tail; +} + +size_t pollserial::write(uint8_t c) { +#if defined ( UDR0 ) + while (!((UCSR0A) & _BV(UDRE0))); + UDR0 = c; +#else + while (!((UCSRA) & _BV(UDRE))); + UDR = c; +#endif +} \ No newline at end of file diff --git a/demopal/lib/pollserial/pollserial.h b/demopal/lib/pollserial/pollserial.h new file mode 100755 index 0000000..0e97fbb --- /dev/null +++ b/demopal/lib/pollserial/pollserial.h @@ -0,0 +1,51 @@ +/* + pollserial.h Heavily modified version of: + + HardwareSerial.h - Hardware serial library for Wiring + Copyright (c) 2006 Nicholas Zambetti. All right reserved. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Modified July 2010 by Myles D. Metzler +*/ + +#ifndef PSERIAL_H +#define PSERIAL_H + +#include +#include "Print.h" + +typedef struct { + uint8_t head; + uint8_t tail; + unsigned char * buffer; +} rbuffer; + +//define a void function() return type. +typedef void (*pt2Funct)(); + +class pollserial : public Print { + public: + pt2Funct begin(long); + void end(); + uint8_t available(void); + int read(void); + void flush(void); + virtual size_t write(uint8_t); + using Print::write; // pull in write(str) and write(buf, size) from Print +}; + +void USART_recieve(); +#endif \ No newline at end of file diff --git a/demopal/src/DemoPAL.pde b/demopal/src/DemoPAL.pde new file mode 100755 index 0000000..52053c3 --- /dev/null +++ b/demopal/src/DemoPAL.pde @@ -0,0 +1,217 @@ +#include +#include +#include "schematic.h" +#include "TVOlogo.h" + +TVout TV; + +int zOff = 150; +int xOff = 0; +int yOff = 0; +int cSize = 50; +int view_plane = 64; +float angle = PI/60; + +float cube3d[8][3] = { + {xOff - cSize,yOff + cSize,zOff - cSize}, + {xOff + cSize,yOff + cSize,zOff - cSize}, + {xOff - cSize,yOff - cSize,zOff - cSize}, + {xOff + cSize,yOff - cSize,zOff - cSize}, + {xOff - cSize,yOff + cSize,zOff + cSize}, + {xOff + cSize,yOff + cSize,zOff + cSize}, + {xOff - cSize,yOff - cSize,zOff + cSize}, + {xOff + cSize,yOff - cSize,zOff + cSize} +}; +unsigned char cube2d[8][2]; + + +void setup() { + TV.begin(PAL,120,96); + TV.select_font(font6x8); + intro(); + TV.println("I am the TVout\nlibrary running on a freeduino\n"); + TV.delay(2500); + TV.println("I generate a PAL\nor NTSC composite video using\ninterrupts\n"); + TV.delay(2500); + TV.println("My schematic:"); + TV.delay(1500); + TV.bitmap(0,0,schematic); + TV.delay(10000); + TV.clear_screen(); + TV.println("Lets see what\nwhat I can do"); + TV.delay(2000); + + //fonts + TV.clear_screen(); + TV.println(0,0,"Multiple fonts:"); + TV.select_font(font4x6); + TV.println("4x6 font FONT"); + TV.select_font(font6x8); + TV.println("6x8 font FONT"); + TV.select_font(font8x8); + TV.println("8x8 font FONT"); + TV.select_font(font6x8); + TV.delay(2000); + + TV.clear_screen(); + TV.print(9,44,"Draw Basic Shapes"); + TV.delay(2000); + + //circles + TV.clear_screen(); + TV.draw_circle(TV.hres()/2,TV.vres()/2,TV.vres()/3,WHITE); + TV.delay(500); + TV.draw_circle(TV.hres()/2,TV.vres()/2,TV.vres()/2,WHITE,INVERT); + TV.delay(2000); + + //rectangles and lines + TV.clear_screen(); + TV.draw_rect(20,20,80,56,RED); + TV.delay(500); + TV.draw_rect(10,10,100,76,WHITE,INVERT); + TV.delay(500); + TV.draw_line(60,20,60,76,INVERT); + TV.draw_line(20,48,100,48,INVERT); + TV.delay(500); + TV.draw_line(10,10,110,86,INVERT); + TV.draw_line(10,86,110,10,INVERT); + TV.delay(2000); + + //random cube forever. + TV.clear_screen(); + TV.print(16,40,"Random Cube"); + TV.print(28,48,"Rotation"); + TV.delay(2000); + + randomSeed(analogRead(0)); +} + +void loop() { + int rsteps = random(10,60); + switch(random(6)) { + case 0: + for (int i = 0; i < rsteps; i++) { + zrotate(angle); + printcube(); + } + break; + case 1: + for (int i = 0; i < rsteps; i++) { + zrotate(2*PI - angle); + printcube(); + } + break; + case 2: + for (int i = 0; i < rsteps; i++) { + xrotate(angle); + printcube(); + } + break; + case 3: + for (int i = 0; i < rsteps; i++) { + xrotate(2*PI - angle); + printcube(); + } + break; + case 4: + for (int i = 0; i < rsteps; i++) { + yrotate(angle); + printcube(); + } + break; + case 5: + for (int i = 0; i < rsteps; i++) { + yrotate(2*PI - angle); + printcube(); + } + break; + } +} + +void intro() { +unsigned char w,l,wb; + int index; + w = pgm_read_byte(TVOlogo); + l = pgm_read_byte(TVOlogo+1); + if (w&7) + wb = w/8 + 1; + else + wb = w/8; + index = wb*(l-1) + 2; + for ( unsigned char i = 1; i < l; i++ ) { + TV.bitmap((TV.hres() - w)/2,0,TVOlogo,index,w,i); + index-= wb; + TV.delay(50); + } + for (unsigned char i = 0; i < (TV.vres() - l)/2; i++) { + TV.bitmap((TV.hres() - w)/2,i,TVOlogo); + TV.delay(50); + } + TV.delay(3000); + TV.clear_screen(); +} + +void printcube() { + //calculate 2d points + for(byte i = 0; i < 8; i++) { + cube2d[i][0] = (unsigned char)((cube3d[i][0] * view_plane / cube3d[i][2]) + (TV.hres()/2)); + cube2d[i][1] = (unsigned char)((cube3d[i][1] * view_plane / cube3d[i][2]) + (TV.vres()/2)); + } + TV.delay_frame(1); + TV.clear_screen(); + draw_cube(); +} + +void zrotate(float q) { + float tx,ty,temp; + for(byte i = 0; i < 8; i++) { + tx = cube3d[i][0] - xOff; + ty = cube3d[i][1] - yOff; + temp = tx * cos(q) - ty * sin(q); + ty = tx * sin(q) + ty * cos(q); + tx = temp; + cube3d[i][0] = tx + xOff; + cube3d[i][1] = ty + yOff; + } +} + +void yrotate(float q) { + float tx,tz,temp; + for(byte i = 0; i < 8; i++) { + tx = cube3d[i][0] - xOff; + tz = cube3d[i][2] - zOff; + temp = tz * cos(q) - tx * sin(q); + tx = tz * sin(q) + tx * cos(q); + tz = temp; + cube3d[i][0] = tx + xOff; + cube3d[i][2] = tz + zOff; + } +} + +void xrotate(float q) { + float ty,tz,temp; + for(byte i = 0; i < 8; i++) { + ty = cube3d[i][1] - yOff; + tz = cube3d[i][2] - zOff; + temp = ty * cos(q) - tz * sin(q); + tz = ty * sin(q) + tz * cos(q); + ty = temp; + cube3d[i][1] = ty + yOff; + cube3d[i][2] = tz + zOff; + } +} + +void draw_cube() { + TV.draw_line(cube2d[0][0],cube2d[0][1],cube2d[1][0],cube2d[1][1],WHITE); + TV.draw_line(cube2d[0][0],cube2d[0][1],cube2d[2][0],cube2d[2][1],RED); + TV.draw_line(cube2d[0][0],cube2d[0][1],cube2d[4][0],cube2d[4][1],WHITE); + TV.draw_line(cube2d[1][0],cube2d[1][1],cube2d[5][0],cube2d[5][1],WHITE); + TV.draw_line(cube2d[1][0],cube2d[1][1],cube2d[3][0],cube2d[3][1],BLUE); + TV.draw_line(cube2d[2][0],cube2d[2][1],cube2d[6][0],cube2d[6][1],WHITE); + TV.draw_line(cube2d[2][0],cube2d[2][1],cube2d[3][0],cube2d[3][1],WHITE); + TV.draw_line(cube2d[4][0],cube2d[4][1],cube2d[6][0],cube2d[6][1],GREEN); + TV.draw_line(cube2d[4][0],cube2d[4][1],cube2d[5][0],cube2d[5][1],WHITE); + TV.draw_line(cube2d[7][0],cube2d[7][1],cube2d[6][0],cube2d[6][1],BLACK); + TV.draw_line(cube2d[7][0],cube2d[7][1],cube2d[3][0],cube2d[3][1],YELLOW); + TV.draw_line(cube2d[7][0],cube2d[7][1],cube2d[5][0],cube2d[5][1],WHITE); +} diff --git a/demopal/src/TVOlogo.cpp b/demopal/src/TVOlogo.cpp new file mode 100755 index 0000000..6435656 --- /dev/null +++ b/demopal/src/TVOlogo.cpp @@ -0,0 +1,37 @@ +#include "TVOlogo.h" +PROGMEM const unsigned char TVOlogo[] = { +96,32, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x3F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFC,0x00, +0x03,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xC0, +0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x10,0x38, +0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x04, +0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x40,0x02, +0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0A,0x80,0x02, +0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x02, +0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xFF,0xFF,0xC2, +0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x42, +0x4F,0xFF,0x60,0x18,0x00,0x00,0x00,0x00,0x17,0xFF,0xFF,0x42, +0x4F,0xFF,0x60,0x18,0x00,0x00,0x00,0x30,0x14,0x00,0x01,0x42, +0x40,0x60,0x60,0x18,0x00,0x00,0x00,0x30,0x14,0x70,0x71,0x42, +0x40,0x60,0x30,0x30,0x00,0x00,0x00,0x30,0x14,0x88,0x89,0x42, +0x40,0x60,0x30,0x30,0x3E,0x06,0x0C,0xFE,0x15,0x05,0x25,0x42, +0x40,0x60,0x30,0x60,0xFF,0x86,0x0C,0xFE,0x15,0x72,0x75,0x42, +0x40,0x60,0x18,0x60,0xC1,0x86,0x0C,0x30,0x15,0x05,0x25,0x42, +0x40,0x60,0x18,0x61,0x80,0xC6,0x0C,0x30,0x14,0x88,0x89,0x42, +0x40,0x60,0x18,0xC1,0x80,0xC6,0x0C,0x30,0x14,0x70,0x71,0x42, +0x40,0x60,0x0C,0xC1,0x80,0xC6,0x0C,0x30,0x14,0x00,0x01,0x42, +0x40,0x60,0x0C,0xC1,0x80,0xC6,0x0C,0x30,0x17,0xFF,0xFF,0x42, +0x40,0x60,0x0F,0x81,0x80,0xC6,0x0C,0x30,0x10,0x00,0x00,0x42, +0x40,0x60,0x07,0x80,0xC1,0x87,0x1C,0x30,0x15,0x40,0x15,0x42, +0x40,0x60,0x07,0x80,0xFF,0x83,0xFC,0x3E,0x12,0x8A,0x8A,0x42, +0x40,0x60,0x03,0x00,0x3E,0x01,0xEC,0x1E,0x15,0x40,0x15,0x42, +0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x42, +0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xFF,0xFF,0xC2, +0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04, +0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38, +0x03,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xC0, +0x00,0x3F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFC,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + +}; diff --git a/demopal/src/TVOlogo.h b/demopal/src/TVOlogo.h new file mode 100755 index 0000000..3c1d56a --- /dev/null +++ b/demopal/src/TVOlogo.h @@ -0,0 +1,6 @@ +#include +#ifndef TVOLOGO_H +#define TVOLOGO_H + +extern const unsigned char TVOlogo[]; +#endif \ No newline at end of file diff --git a/demopal/src/schematic.cpp b/demopal/src/schematic.cpp new file mode 100755 index 0000000..dcf0d1d --- /dev/null +++ b/demopal/src/schematic.cpp @@ -0,0 +1,101 @@ +#include "schematic.h" + +PROGMEM const unsigned char schematic[] = { +120,96, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x0F,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFE, +0x08,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x02, +0x08,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x02, +0x0B,0x0C,0xE4,0x41,0x00,0x00,0x03,0x12,0x0E,0x22,0x61,0x80,0xB8,0x71,0x82, +0x0B,0x0D,0x94,0x41,0x00,0x00,0x05,0x14,0x11,0x22,0x61,0x80,0xA4,0xC9,0x82, +0x0A,0x95,0x04,0x41,0x00,0x00,0x01,0x14,0x11,0x22,0x52,0x80,0xA4,0x81,0x42, +0x0A,0x95,0x04,0x41,0x00,0x00,0x01,0x18,0x11,0x3E,0x52,0x80,0xB8,0x82,0x42, +0x0A,0x65,0x04,0x41,0x00,0x00,0x01,0x14,0x11,0x22,0x4C,0x80,0xA4,0x83,0xC2, +0x0A,0x65,0x94,0x41,0x00,0x00,0x01,0x12,0x11,0x22,0x4C,0x80,0xA4,0xCA,0x22, +0x0A,0x64,0xE3,0x81,0x00,0x00,0x07,0x92,0x0E,0x22,0x4C,0x80,0xA4,0x74,0x22, +0x08,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x02, +0x0F,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFE, +0x08,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x02, +0x08,0x70,0x00,0x01,0x00,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x80,0x00,0x02, +0x08,0x90,0x00,0x01,0x00,0x00,0x02,0x80,0x02,0x80,0x02,0x80,0x80,0x00,0x02, +0x08,0x84,0x5E,0x39,0x00,0x00,0x04,0x40,0x04,0x40,0x04,0x40,0x80,0x00,0x02, +0x08,0x64,0x92,0x41,0x00,0x00,0x08,0x20,0x08,0x20,0x08,0x20,0x80,0x00,0x02, +0x08,0x12,0x92,0x41,0xFF,0xFF,0xF0,0x10,0x10,0x10,0x10,0x1C,0x80,0x00,0x02, +0x08,0x92,0x92,0x41,0x00,0x00,0x00,0x08,0x20,0x08,0x20,0x04,0x80,0x00,0x02, +0x08,0xE1,0x12,0x39,0x00,0x00,0x00,0x04,0x40,0x04,0x40,0x04,0xA1,0x4F,0x02, +0x08,0x01,0x00,0x01,0x00,0x00,0x00,0x02,0x80,0x02,0x80,0x04,0xB3,0x49,0x82, +0x08,0x02,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x04,0x92,0x48,0x82, +0x08,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x92,0x48,0x82, +0x08,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x9C,0x48,0x82, +0x08,0x00,0x00,0x01,0x00,0x00,0x01,0x00,0x01,0x00,0x01,0x04,0x8C,0x49,0x82, +0x08,0x02,0x14,0xF1,0x00,0x00,0x02,0x80,0x02,0x80,0x02,0x84,0x8C,0x4F,0x02, +0x08,0x03,0x34,0x99,0x00,0x00,0x04,0x40,0x04,0x40,0x04,0x44,0x80,0x00,0x02, +0x08,0x01,0x24,0x89,0x00,0x00,0x08,0x20,0x08,0x20,0x08,0x24,0x80,0x00,0x02, +0x08,0x01,0x24,0x89,0xFF,0xFF,0xF0,0x10,0x10,0x10,0x10,0x1C,0x80,0x00,0x02, +0x08,0x01,0xC4,0x89,0x00,0x00,0x00,0x08,0x20,0x08,0x20,0x00,0x80,0x00,0x02, +0x08,0x00,0xC4,0x99,0x00,0x00,0x00,0x04,0x40,0x04,0x40,0x00,0x80,0x00,0x02, +0x08,0x00,0xC4,0xF1,0x00,0x00,0x00,0x02,0x80,0x02,0x80,0x00,0x80,0x00,0x02, +0x08,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x00,0x80,0x00,0x02, +0x08,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x02, +0x08,0x00,0x00,0x01,0x00,0x00,0x0C,0xF9,0xC1,0xC4,0x4C,0x30,0x80,0x00,0x02, +0x08,0x00,0x00,0x01,0x00,0x00,0x14,0x1A,0x42,0x24,0x4C,0x30,0x80,0x00,0x02, +0x08,0x00,0x00,0x01,0x00,0x00,0x34,0x12,0x42,0x24,0x4A,0x50,0x80,0x00,0x02, +0x08,0x00,0x00,0x01,0x00,0x00,0x24,0x32,0x42,0x27,0xCA,0x50,0x80,0x00,0x02, +0x08,0x00,0x00,0x01,0x00,0x00,0x3E,0x22,0x42,0x24,0x49,0x90,0x80,0x00,0x02, +0x08,0x00,0x00,0x01,0x00,0x00,0x04,0x62,0x42,0x24,0x49,0x90,0x80,0x00,0x02, +0x08,0x1E,0x64,0xF1,0x00,0x00,0x04,0x43,0x81,0xC4,0x49,0x90,0x9E,0x64,0xF2, +0x08,0x32,0x64,0x99,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xB2,0x64,0x9A, +0x08,0x20,0x54,0x89,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xA0,0x54,0x8A, +0x08,0x26,0x54,0x89,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xA6,0x54,0x8A, +0x08,0x22,0x4C,0x89,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xA2,0x4C,0x8A, +0x08,0x32,0x4C,0x99,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xB2,0x4C,0x9A, +0x08,0x1E,0x4C,0xF1,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x9E,0x4C,0xF2, +0x08,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x02, +0x0F,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFE, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x30,0x00,0x00,0x04,0x00,0x00,0x40,0x00,0x00,0x00,0x03,0x81,0xC6,0x04,0x00, +0x48,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x04,0x42,0x2A,0x04,0x00, +0x42,0x25,0x87,0x04,0x38,0x3C,0x48,0x8B,0xC8,0x8E,0x08,0x24,0x02,0x0A,0x00, +0x22,0x26,0x48,0x04,0x40,0x02,0x48,0x88,0x28,0x90,0x08,0x24,0x02,0x0A,0x00, +0x11,0x44,0x48,0x04,0x60,0x1E,0x45,0x51,0xE5,0x18,0x08,0x24,0x02,0x11,0x00, +0x09,0x44,0x48,0x04,0x18,0x22,0x45,0x52,0x25,0x06,0x08,0x24,0x02,0x1F,0x00, +0x48,0x84,0x48,0x04,0x08,0x22,0x42,0x22,0x22,0x02,0x04,0x42,0x22,0x20,0x80, +0x30,0x84,0x47,0x04,0x70,0x1E,0x42,0x21,0xE2,0x1C,0x03,0x81,0xCF,0xA0,0x80, +0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00, +0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x82,0x8F,0x01,0x00,0x00,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80, +0x82,0x88,0x80,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80, +0x44,0x88,0x41,0x0E,0x0F,0x02,0x03,0x8B,0x03,0xC5,0x91,0x07,0x87,0x17,0xE0, +0x44,0x88,0x41,0x10,0x08,0x82,0x04,0x4C,0x80,0x26,0x51,0x04,0x48,0x98,0x80, +0x28,0x88,0x41,0x18,0x08,0x84,0x04,0x48,0x81,0xE4,0x4A,0x04,0x48,0x90,0x80, +0x28,0x88,0x41,0x06,0x08,0x84,0x04,0x48,0x82,0x24,0x4A,0x04,0x48,0x90,0x80, +0x10,0x88,0x81,0x02,0x08,0x88,0x04,0x48,0x82,0x24,0x44,0x04,0x48,0x90,0x80, +0x10,0x8F,0x01,0x1C,0x0F,0x08,0x03,0x88,0x81,0xE4,0x44,0x07,0x87,0x10,0x60, +0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x08,0x04,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x08,0x04,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 +}; diff --git a/demopal/src/schematic.h b/demopal/src/schematic.h new file mode 100755 index 0000000..4d0b270 --- /dev/null +++ b/demopal/src/schematic.h @@ -0,0 +1,6 @@ +#include +#ifndef SHEMATIC_H +#define SHEMATIC_H + +extern const unsigned char schematic[]; +#endif diff --git a/mozzi-hello/lib/.holder b/mozzi-hello/lib/.holder new file mode 100644 index 0000000..e69de29 diff --git a/mozzi-hello/src/mozzi b/mozzi-hello/src/mozzi new file mode 120000 index 0000000..5e2d2c2 --- /dev/null +++ b/mozzi-hello/src/mozzi @@ -0,0 +1 @@ +/Users/yuval/dev/mozzi \ No newline at end of file diff --git a/mozzi-hello/src/sketch.ino b/mozzi-hello/src/sketch.ino new file mode 100644 index 0000000..64391a8 --- /dev/null +++ b/mozzi-hello/src/sketch.ino @@ -0,0 +1,23 @@ +#include // at the top of your sketch +#define CONTROL_RATE 64 // or some other power of 2 + +void setup() { + startMozzi(CONTROL_RATE); + randomSeed(analogRead(0)); +} + +void loop() { + audioHook(); // fills the audio buffer +} + +int updateAudio() { + // your audio code which returns an int + // between -244 and 243 in STANDARD mode + // or between -8192 and 8191 in HIFI mode + return randNumber = random(-244, 243); +} + +void updateControl() { + // your control code +} + diff --git a/vga-more/lib/.holder b/vga-more/lib/.holder new file mode 100644 index 0000000..e69de29 diff --git a/vga-more/src/TimerHelpers.h b/vga-more/src/TimerHelpers.h new file mode 100644 index 0000000..d436987 --- /dev/null +++ b/vga-more/src/TimerHelpers.h @@ -0,0 +1,209 @@ +/* + Timer Helpers library. + +Devised and written by Nick Gammon. +Date: 21 March 2012 +Version: 1.0 + +Licence: Released for public use. + +See: http://www.gammon.com.au/forum/?id=11504 + + Example: + + // set up Timer 1 + TCNT1 = 0; // reset counter + OCR1A = 999; // compare A register value (1000 * clock speed) + + // Mode 4: CTC, top = OCR1A + Timer1::setMode (4, Timer1::PRESCALE_1, Timer1::CLEAR_A_ON_COMPARE); + + TIFR1 |= _BV (OCF1A); // clear interrupt flag + TIMSK1 = _BV (OCIE1A); // interrupt on Compare A Match + +*/ + +#ifndef _TimerHelpers_h +#define _TimerHelpers_h + +#if defined(ARDUINO) && ARDUINO >= 100 + #include "Arduino.h" +#else + #include "WProgram.h" +#endif + +/* --------------------------------------------------------------- + Timer 0 setup + --------------------------------------------------------------- */ + +namespace Timer0 +{ + // TCCR0A, TCCR0B + const byte Modes [8] [2] = + { + + { 0, 0 }, // 0: Normal, top = 0xFF + { _BV (WGM00), 0 }, // 1: PWM, Phase-correct, top = 0xFF + { _BV (WGM01), 0 }, // 2: CTC, top = OCR0A + { _BV (WGM00) | _BV (WGM01), 0 }, // 3: Fast PWM, top = 0xFF + { 0, _BV (WGM02) }, // 4: Reserved + { _BV (WGM00), _BV (WGM02) }, // 5: PWM, Phase-correct, top = OCR0A + { _BV (WGM01), _BV (WGM02) }, // 6: Reserved + { _BV (WGM00) | _BV (WGM01), _BV (WGM02) }, // 7: Fast PWM, top = OCR0A + + }; // end of Timer0::Modes + + // Activation + // Note: T0 is pin 6, Arduino port: D4 + enum { NO_CLOCK, PRESCALE_1, PRESCALE_8, PRESCALE_64, PRESCALE_256, PRESCALE_1024, T0_FALLING, T0_RISING }; + + // what ports to toggle on timer fire + enum { NO_PORT = 0, + + // pin 12, Arduino port: D6 + TOGGLE_A_ON_COMPARE = _BV (COM0A0), + CLEAR_A_ON_COMPARE = _BV (COM0A1), + SET_A_ON_COMPARE = _BV (COM0A0) | _BV (COM0A1), + + // pin 11, Arduino port: D5 + TOGGLE_B_ON_COMPARE = _BV (COM0B0), + CLEAR_B_ON_COMPARE = _BV (COM0B1), + SET_B_ON_COMPARE = _BV (COM0B0) | _BV (COM0B1), + }; + + + // choose a timer mode, set which clock speed, and which port to toggle + void setMode (const byte mode, const byte clock, const byte port) + { + if (mode < 0 || mode > 7) // sanity check + return; + + // reset existing flags + TCCR0A = 0; + TCCR0B = 0; + + TCCR0A |= (Modes [mode] [0]) | port; + TCCR0B |= (Modes [mode] [1]) | clock; + } // end of Timer0::setMode + +} // end of namespace Timer0 + +/* --------------------------------------------------------------- + Timer 1 setup + --------------------------------------------------------------- */ + +namespace Timer1 +{ + // TCCR1A, TCCR1B + const byte Modes [16] [2] = + { + + { 0, 0 }, // 0: Normal, top = 0xFFFF + { _BV (WGM10), 0 }, // 1: PWM, Phase-correct, 8 bit, top = 0xFF + { _BV (WGM11), 0 }, // 2: PWM, Phase-correct, 9 bit, top = 0x1FF + { _BV (WGM10) | _BV (WGM11), 0 }, // 3: PWM, Phase-correct, 10 bit, top = 0x3FF + { 0, _BV (WGM12) }, // 4: CTC, top = OCR1A + { _BV (WGM10), _BV (WGM12) }, // 5: Fast PWM, 8 bit, top = 0xFF + { _BV (WGM11), _BV (WGM12) }, // 6: Fast PWM, 9 bit, top = 0x1FF + { _BV (WGM10) | _BV (WGM11), _BV (WGM12) }, // 7: Fast PWM, 10 bit, top = 0x3FF + { 0, _BV (WGM13) }, // 8: PWM, phase and frequency correct, top = ICR1 + { _BV (WGM10), _BV (WGM13) }, // 9: PWM, phase and frequency correct, top = OCR1A + { _BV (WGM11), _BV (WGM13) }, // 10: PWM, phase correct, top = ICR1A + { _BV (WGM10) | _BV (WGM11), _BV (WGM13) }, // 11: PWM, phase correct, top = OCR1A + { 0, _BV (WGM12) | _BV (WGM13) }, // 12: CTC, top = ICR1 + { _BV (WGM10), _BV (WGM12) | _BV (WGM13) }, // 13: reserved + { _BV (WGM11), _BV (WGM12) | _BV (WGM13) }, // 14: Fast PWM, TOP = ICR1 + { _BV (WGM10) | _BV (WGM11), _BV (WGM12) | _BV (WGM13) }, // 15: Fast PWM, TOP = OCR1A + + }; // end of Timer1::Modes + + // Activation + // Note: T1 is pin 11, Arduino port: D5 + enum { NO_CLOCK, PRESCALE_1, PRESCALE_8, PRESCALE_64, PRESCALE_256, PRESCALE_1024, T1_FALLING, T1_RISING }; + + // what ports to toggle on timer fire + enum { NO_PORT = 0, + + // pin 15, Arduino port: D9 + TOGGLE_A_ON_COMPARE = _BV (COM1A0), + CLEAR_A_ON_COMPARE = _BV (COM1A1), + SET_A_ON_COMPARE = _BV (COM1A0) | _BV (COM1A1), + + // pin 16, Arduino port: D10 + TOGGLE_B_ON_COMPARE = _BV (COM1B0), + CLEAR_B_ON_COMPARE = _BV (COM1B1), + SET_B_ON_COMPARE = _BV (COM1B0) | _BV (COM1B1), + }; + + // choose a timer mode, set which clock speed, and which port to toggle + void setMode (const byte mode, const byte clock, const byte port) + { + if (mode < 0 || mode > 15) // sanity check + return; + + // reset existing flags + TCCR1A = 0; + TCCR1B = 0; + + TCCR1A |= (Modes [mode] [0]) | port; + TCCR1B |= (Modes [mode] [1]) | clock; + } // end of Timer1::setMode + +} // end of namespace Timer1 + +/* --------------------------------------------------------------- + Timer 2 setup + --------------------------------------------------------------- */ + +namespace Timer2 +{ + // TCCR2A, TCCR2B + const byte Modes [8] [2] = + { + + { 0, 0 }, // 0: Normal, top = 0xFF + { _BV (WGM20), 0 }, // 1: PWM, Phase-correct, top = 0xFF + { _BV (WGM21), 0 }, // 2: CTC, top = OCR2A + { _BV (WGM20) | _BV (WGM21), 0 }, // 3: Fast PWM, top = 0xFF + { 0, _BV (WGM22) }, // 4: Reserved + { _BV (WGM20), _BV (WGM22) }, // 5: PWM, Phase-correct, top = OCR2A + { _BV (WGM21), _BV (WGM22) }, // 6: Reserved + { _BV (WGM20) | _BV (WGM21), _BV (WGM22) }, // 7: Fast PWM, top = OCR2A + + }; // end of Timer2::Modes + + // Activation + enum { NO_CLOCK, PRESCALE_1, PRESCALE_8, PRESCALE_32, PRESCALE_64, PRESCALE_128, PRESCALE_256, PRESCALE_1024 }; + + // what ports to toggle on timer fire + enum { NO_PORT = 0, + + // pin 17, Arduino port: D11 + TOGGLE_A_ON_COMPARE = _BV (COM2A0), + CLEAR_A_ON_COMPARE = _BV (COM2A1), + SET_A_ON_COMPARE = _BV (COM2A0) | _BV (COM2A1), + + // pin 5, Arduino port: D3 + TOGGLE_B_ON_COMPARE = _BV (COM2B0), + CLEAR_B_ON_COMPARE = _BV (COM2B1), + SET_B_ON_COMPARE = _BV (COM2B0) | _BV (COM2B1), + }; + + + // choose a timer mode, set which clock speed, and which port to toggle + void setMode (const byte mode, const byte clock, const byte port) + { + if (mode < 0 || mode > 7) // sanity check + return; + + // reset existing flags + TCCR2A = 0; + TCCR2B = 0; + + TCCR2A |= (Modes [mode] [0]) | port; + TCCR2B |= (Modes [mode] [1]) | clock; + } // end of Timer2::setMode + +} // end of namespace Timer2 + +#endif diff --git a/vga-more/src/screenFont.h b/vga-more/src/screenFont.h new file mode 100644 index 0000000..5279f9e --- /dev/null +++ b/vga-more/src/screenFont.h @@ -0,0 +1,160 @@ +// bit patterns for the CP437 font, ROTATED, INVERTED + +// To save rendering time, they are ordered by line (ie. line 1, line 2) and then +// indexed by character. + +byte screen_font [8] [256] PROGMEM = { +// Row 1 + { + 0xFF, 0xC0, 0xC0, 0xC9, 0xF7, 0xE3, 0xF7, 0xFF, 0x80, 0xFF, 0x80, 0xF8, 0xE1, 0xE0, 0xC0, 0xB3, + 0xBF, 0xFE, 0xF3, 0xCC, 0xC0, 0xE0, 0xFF, 0xF3, 0xF3, 0xF3, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xE7, 0xC9, 0xC9, 0xE7, 0xFF, 0xE3, 0xCF, 0xF3, 0xCF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, + 0xC1, 0xE7, 0xC3, 0xC3, 0xF1, 0x81, 0xE3, 0x81, 0xC3, 0xC3, 0xFF, 0xFF, 0xF3, 0xFF, 0xCF, 0xC3, + 0xC1, 0xE7, 0x81, 0xE1, 0x83, 0x80, 0x80, 0xE1, 0x99, 0xC3, 0xF0, 0x8C, 0x87, 0x9C, 0x9C, 0xE3, + 0x81, 0xC3, 0x81, 0xC3, 0x81, 0x99, 0x99, 0x9C, 0x9C, 0x99, 0x80, 0xC3, 0x9F, 0xC3, 0xF7, 0xFF, + 0xE7, 0xFF, 0x8F, 0xFF, 0xF1, 0xFF, 0xE3, 0xFF, 0x8F, 0xE7, 0xF9, 0x8F, 0xC7, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xF7, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF1, 0xF3, 0x8F, 0xC4, 0xFF, + 0xC3, 0xFF, 0xF1, 0xC0, 0x99, 0x8F, 0xE7, 0xFF, 0xC0, 0x99, 0x8F, 0x99, 0xC1, 0x8F, 0x9C, 0xE7, + 0xF1, 0xFF, 0xE0, 0xC3, 0xFF, 0xFF, 0xC3, 0xFF, 0xFF, 0x9E, 0x99, 0xF3, 0xE3, 0x99, 0x83, 0xF8, + 0xF1, 0xE3, 0xFF, 0xFF, 0xFF, 0x81, 0xE1, 0xE3, 0xE7, 0xFF, 0xFF, 0x9E, 0x9E, 0xF3, 0xFF, 0xFF, + 0xEE, 0xD5, 0x92, 0xF3, 0xF3, 0xF3, 0xE4, 0xFF, 0xFF, 0xE4, 0xE4, 0xFF, 0xE4, 0xE4, 0xF3, 0xFF, + 0xF3, 0xF3, 0xFF, 0xF3, 0xFF, 0xF3, 0xF3, 0xE4, 0xE4, 0xFF, 0xE4, 0xFF, 0xE4, 0xFF, 0xE4, 0xF3, + 0xE4, 0xFF, 0xFF, 0xE4, 0xF3, 0xFF, 0xFF, 0xE4, 0xF3, 0xF3, 0xFF, 0x80, 0xFF, 0x87, 0xF8, 0x80, + 0xFF, 0xFF, 0xFF, 0xFF, 0x81, 0xFF, 0xFF, 0xFF, 0x81, 0xE3, 0xE3, 0xF1, 0xFF, 0xFC, 0xE3, 0xC3, + 0xFF, 0xE7, 0xCF, 0xF3, 0xF8, 0xF3, 0xE7, 0xFF, 0xE3, 0xFF, 0xFF, 0xF8, 0xC3, 0xC7, 0xFF, 0xFF, + }, +// Row 2 + { + 0xFF, 0xBF, 0x80, 0x80, 0xE3, 0xC1, 0xF7, 0xFF, 0x80, 0xE1, 0x9E, 0xFC, 0xCC, 0xE6, 0xCE, 0xD2, + 0x8F, 0xF8, 0xE1, 0xCC, 0x92, 0xCE, 0xFF, 0xE1, 0xE1, 0xF3, 0xF3, 0xE7, 0xFF, 0xED, 0xF3, 0x80, + 0xFF, 0xC3, 0xC9, 0xC9, 0xC1, 0x9C, 0xC9, 0xCF, 0xE7, 0xE7, 0xCC, 0xE7, 0xFF, 0xFF, 0xFF, 0xF9, + 0x9C, 0xC7, 0x99, 0x99, 0xE1, 0x9F, 0xCF, 0x99, 0x99, 0x99, 0xE7, 0xE7, 0xE7, 0xFF, 0xE7, 0x99, + 0x9C, 0xC3, 0xCC, 0xCC, 0xC9, 0xCE, 0xCE, 0xCC, 0x99, 0xE7, 0xF9, 0xCC, 0xCF, 0x88, 0x8C, 0xC9, + 0xCC, 0x99, 0xCC, 0x99, 0xA5, 0x99, 0x99, 0x9C, 0x9C, 0x99, 0x9C, 0xCF, 0xCF, 0xF3, 0xE3, 0xFF, + 0xE7, 0xFF, 0xCF, 0xFF, 0xF9, 0xFF, 0xC9, 0xFF, 0xCF, 0xFF, 0xFF, 0xCF, 0xE7, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xE7, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xE7, 0xF3, 0xE7, 0x91, 0xF7, + 0x99, 0x99, 0xFF, 0x9E, 0xFF, 0xFF, 0xE7, 0xFF, 0x9E, 0xFF, 0xFF, 0xFF, 0x9C, 0xFF, 0xE3, 0xE7, + 0xFF, 0xFF, 0xC9, 0x99, 0x99, 0x8F, 0x99, 0x8F, 0x99, 0xF3, 0xFF, 0xF3, 0xC9, 0x99, 0x99, 0xF2, + 0xFF, 0xFF, 0xF1, 0xF1, 0x83, 0xFF, 0xC9, 0xC9, 0xFF, 0xFF, 0xFF, 0x9C, 0x9C, 0xF3, 0xE6, 0x99, + 0xBB, 0xAA, 0xC4, 0xF3, 0xF3, 0xF3, 0xE4, 0xFF, 0xFF, 0xE4, 0xE4, 0xFF, 0xE4, 0xE4, 0xF3, 0xFF, + 0xF3, 0xF3, 0xFF, 0xF3, 0xFF, 0xF3, 0xF3, 0xE4, 0xE4, 0xFF, 0xE4, 0xFF, 0xE4, 0xFF, 0xE4, 0xF3, + 0xE4, 0xFF, 0xFF, 0xE4, 0xF3, 0xFF, 0xFF, 0xE4, 0xF3, 0xF3, 0xFF, 0x80, 0xFF, 0x87, 0xF8, 0x80, + 0xFF, 0xC3, 0x81, 0x80, 0x99, 0xFF, 0xCC, 0xC4, 0xE7, 0xC9, 0xC9, 0xE7, 0xFF, 0xF9, 0xCF, 0x99, + 0x81, 0xE7, 0xE7, 0xE7, 0xF2, 0xF3, 0xE7, 0xC4, 0xC9, 0xFF, 0xFF, 0xF9, 0xC9, 0xF3, 0xFF, 0xFF, + }, +// Row 3 + { + 0xFF, 0xAD, 0x92, 0x80, 0xC1, 0xE3, 0xE3, 0xF3, 0x8C, 0xCC, 0xB3, 0xF8, 0xCC, 0xE0, 0xC0, 0xE1, + 0x83, 0xE0, 0xC0, 0xCC, 0x92, 0xE3, 0xFF, 0xC0, 0xC0, 0xF3, 0xF9, 0xCF, 0x9F, 0xCC, 0xE1, 0x80, + 0xFF, 0xC3, 0xC9, 0x80, 0x9F, 0x99, 0xE3, 0x9F, 0xCF, 0xF3, 0xE1, 0xE7, 0xFF, 0xFF, 0xFF, 0xF3, + 0x98, 0xE7, 0xF9, 0xF9, 0xC9, 0x83, 0x9F, 0xF9, 0x99, 0x99, 0xE7, 0xE7, 0xCF, 0x81, 0xF3, 0xF9, + 0x90, 0x99, 0xCC, 0x9F, 0xCC, 0xCB, 0xCB, 0x9F, 0x99, 0xE7, 0xF9, 0xC9, 0xCF, 0x80, 0x84, 0x9C, + 0xCC, 0x99, 0xCC, 0x8F, 0xE7, 0x99, 0x99, 0x9C, 0xC9, 0x99, 0xB9, 0xCF, 0xE7, 0xF3, 0xC9, 0xFF, + 0xF3, 0xC3, 0xCF, 0xC3, 0xF9, 0xC3, 0xCF, 0xC4, 0xC9, 0xC7, 0xF9, 0xCC, 0xE7, 0x99, 0x83, 0xC3, + 0x91, 0xC4, 0x91, 0xC1, 0xC1, 0x99, 0x99, 0x9C, 0x9C, 0x99, 0x81, 0xE7, 0xF3, 0xE7, 0xFF, 0xE3, + 0x9F, 0xFF, 0xC3, 0xE1, 0xC3, 0xC3, 0xC3, 0xC3, 0xE1, 0xC3, 0xC3, 0xC7, 0xE3, 0xC7, 0xC9, 0xFF, + 0x81, 0xC0, 0x99, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xE1, 0x99, 0xC0, 0xCD, 0xC3, 0x99, 0xF3, + 0xC3, 0xC7, 0xFF, 0xFF, 0xFF, 0x99, 0xC9, 0xC9, 0xE7, 0xFF, 0xFF, 0x99, 0x99, 0xFF, 0xCC, 0xCC, + 0xEE, 0xD5, 0x92, 0xF3, 0xF3, 0x83, 0xE4, 0xFF, 0x83, 0x84, 0xE4, 0x80, 0x84, 0xE4, 0x83, 0xFF, + 0xF3, 0xF3, 0xFF, 0xF3, 0xFF, 0xF3, 0xF0, 0xE4, 0xE4, 0xE0, 0x84, 0x80, 0xE4, 0x80, 0x84, 0x80, + 0xE4, 0x80, 0xFF, 0xE4, 0xF0, 0xF0, 0xFF, 0xE4, 0x80, 0xF3, 0xFF, 0x80, 0xFF, 0x87, 0xF8, 0x80, + 0xC4, 0x99, 0x99, 0xC9, 0xCF, 0xC0, 0xCC, 0x91, 0xC3, 0x9C, 0x9C, 0xF3, 0xC0, 0xC0, 0x9F, 0x99, + 0xFF, 0x81, 0xF3, 0xCF, 0xF2, 0xF3, 0xFF, 0x91, 0xC9, 0xFF, 0xFF, 0xF9, 0xC9, 0xE7, 0xE1, 0xFF, + }, +// Row 4 + { + 0xFF, 0xBF, 0x80, 0x80, 0x80, 0x80, 0xC1, 0xE1, 0x9E, 0xDE, 0xA1, 0xC1, 0xCC, 0xE7, 0xCE, 0x8C, + 0x80, 0x80, 0xF3, 0xCC, 0xC2, 0xC9, 0xFF, 0xF3, 0xF3, 0xF3, 0x80, 0x80, 0x9F, 0x80, 0xC0, 0xC0, + 0xFF, 0xE7, 0xFF, 0xC9, 0xC3, 0xF3, 0xC4, 0xFF, 0xCF, 0xF3, 0x80, 0x81, 0xFF, 0x81, 0xFF, 0xE7, + 0x90, 0xE7, 0xE3, 0xE3, 0x99, 0xF9, 0x83, 0xF3, 0xC3, 0xC1, 0xFF, 0xFF, 0x9F, 0xFF, 0xF9, 0xF3, + 0x90, 0x99, 0xC1, 0x9F, 0xCC, 0xC3, 0xC3, 0x9F, 0x81, 0xE7, 0xF9, 0xC3, 0xCF, 0x80, 0x90, 0x9C, + 0xC1, 0x99, 0xC1, 0xC7, 0xE7, 0x99, 0x99, 0x94, 0xE3, 0xC3, 0xF3, 0xCF, 0xF3, 0xF3, 0x9C, 0xFF, + 0xFF, 0xF9, 0xC1, 0x99, 0xC1, 0x99, 0x87, 0x99, 0xC4, 0xE7, 0xF9, 0xC9, 0xE7, 0x80, 0x99, 0x99, + 0xCC, 0x99, 0xC4, 0x9F, 0xE7, 0x99, 0x99, 0x94, 0xC9, 0x99, 0xB3, 0x8F, 0xFF, 0xF1, 0xFF, 0xC9, + 0x99, 0x99, 0x99, 0xFC, 0xF9, 0xF9, 0xF9, 0x9F, 0xCC, 0x99, 0x99, 0xE7, 0xF3, 0xE7, 0x9C, 0xC3, + 0xCF, 0xF9, 0x80, 0xC3, 0xC3, 0xC3, 0x99, 0x99, 0x99, 0xCC, 0x99, 0x9F, 0x87, 0x81, 0x82, 0xE1, + 0xF9, 0xE7, 0xC3, 0x99, 0x83, 0x89, 0xE0, 0xE3, 0xCF, 0x81, 0x81, 0x90, 0x92, 0xF3, 0x99, 0xE6, + 0xBB, 0xAA, 0x88, 0xF3, 0xF3, 0xF3, 0xE4, 0xFF, 0xF3, 0xFC, 0xE4, 0xFC, 0xFC, 0xE4, 0xF3, 0xFF, + 0xF3, 0xF3, 0xFF, 0xF3, 0xFF, 0xF3, 0xF3, 0xE4, 0xE7, 0xE7, 0xFF, 0xFF, 0xE7, 0xFF, 0xFF, 0xFF, + 0xE4, 0xFF, 0xFF, 0xE4, 0xF3, 0xF3, 0xFF, 0xE4, 0xF3, 0xF3, 0xFF, 0x80, 0xFF, 0x87, 0xF8, 0x80, + 0x91, 0x83, 0x9F, 0xC9, 0xE7, 0x93, 0xCC, 0xF3, 0x99, 0x80, 0x9C, 0xC1, 0x92, 0x92, 0x83, 0x99, + 0x81, 0xE7, 0xE7, 0xE7, 0xF3, 0xF3, 0x81, 0xFF, 0xE3, 0xF3, 0xFF, 0xF9, 0xC9, 0xCF, 0xE1, 0xFF, + }, +// Row 5 + { + 0xFF, 0xA1, 0x9E, 0xC1, 0xC1, 0x80, 0x80, 0xE1, 0x9E, 0xDE, 0xA1, 0x99, 0xE1, 0xE7, 0xCE, 0x8C, + 0x83, 0xE0, 0xF3, 0xCC, 0xF2, 0xC9, 0xC0, 0xC0, 0xF3, 0xC0, 0xF9, 0xCF, 0x9F, 0xCC, 0x80, 0xE1, + 0xFF, 0xE7, 0xFF, 0x80, 0xF9, 0xE7, 0x91, 0xFF, 0xCF, 0xF3, 0xE1, 0xE7, 0xFF, 0xFF, 0xFF, 0xCF, + 0x84, 0xE7, 0xCF, 0xF9, 0x80, 0xF9, 0x99, 0xE7, 0x99, 0xF9, 0xFF, 0xFF, 0xCF, 0xFF, 0xF3, 0xE7, + 0x90, 0x81, 0xCC, 0x9F, 0xCC, 0xCB, 0xCB, 0x98, 0x99, 0xE7, 0x99, 0xC9, 0xCE, 0x94, 0x98, 0x9C, + 0xCF, 0x91, 0xC9, 0xF1, 0xE7, 0x99, 0x99, 0x80, 0xE3, 0xE7, 0xE6, 0xCF, 0xF9, 0xF3, 0xFF, 0xFF, + 0xFF, 0xC1, 0xCC, 0x9F, 0x99, 0x81, 0xCF, 0x99, 0xCC, 0xE7, 0xF9, 0xC3, 0xE7, 0x80, 0x99, 0x99, + 0xCC, 0x99, 0xCC, 0xC3, 0xE7, 0x99, 0x99, 0x80, 0xE3, 0x99, 0xE7, 0xE7, 0xF3, 0xE7, 0xFF, 0x9C, + 0xC3, 0x99, 0x81, 0xE0, 0xC1, 0xC1, 0xC1, 0x9F, 0xC0, 0x81, 0x81, 0xE7, 0xF3, 0xE7, 0x80, 0x99, + 0xC3, 0xC0, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0xCC, 0x99, 0x9F, 0xCF, 0xE7, 0x9C, 0xF3, + 0xC1, 0xE7, 0x99, 0x99, 0x99, 0x81, 0xFF, 0xFF, 0x9F, 0x9F, 0xF9, 0xE6, 0xE4, 0xF3, 0xCC, 0xCC, + 0xEE, 0xD5, 0x92, 0xF3, 0x83, 0x83, 0x84, 0x80, 0x83, 0x84, 0xE4, 0x84, 0x80, 0x80, 0x83, 0x83, + 0xF0, 0x80, 0x80, 0xF0, 0x80, 0x80, 0xF0, 0xE4, 0xE0, 0xE4, 0x80, 0x84, 0xE4, 0x80, 0x84, 0x80, + 0x80, 0x80, 0x80, 0xE0, 0xF0, 0xF0, 0xE0, 0x80, 0x80, 0x83, 0xF0, 0x80, 0x80, 0x87, 0xF8, 0xFF, + 0x9B, 0x99, 0x9F, 0xC9, 0xCF, 0x93, 0xCC, 0xF3, 0x99, 0x9C, 0xC9, 0x99, 0x92, 0x92, 0x9F, 0x99, + 0xFF, 0xE7, 0xCF, 0xF3, 0xF3, 0xF3, 0xFF, 0xC4, 0xFF, 0xF3, 0xF3, 0x89, 0xC9, 0xC3, 0xE1, 0xFF, + }, +// Row 6 + { + 0xFF, 0xB3, 0x8C, 0xE3, 0xE3, 0xC1, 0xC1, 0xF3, 0x8C, 0xCC, 0xB3, 0x99, 0xF3, 0xC7, 0xCC, 0xE1, + 0x8F, 0xF8, 0xC0, 0xFF, 0xF2, 0xE3, 0xC0, 0xE1, 0xF3, 0xE1, 0xF3, 0xE7, 0x80, 0xED, 0x80, 0xF3, + 0xFF, 0xFF, 0xFF, 0xC9, 0x83, 0xCC, 0x99, 0xFF, 0xE7, 0xE7, 0xCC, 0xE7, 0xE7, 0xFF, 0xE7, 0x9F, + 0x8C, 0xE7, 0x99, 0x99, 0xF9, 0x99, 0x99, 0xE7, 0x99, 0xF3, 0xE7, 0xE7, 0xE7, 0x81, 0xE7, 0xFF, + 0x9F, 0x99, 0xCC, 0xCC, 0xC9, 0xCE, 0xCF, 0xCC, 0x99, 0xE7, 0x99, 0xCC, 0xCC, 0x9C, 0x9C, 0xC9, + 0xCF, 0xC3, 0xCC, 0x99, 0xE7, 0x99, 0xC3, 0x88, 0xC9, 0xE7, 0xCC, 0xCF, 0xFC, 0xF3, 0xFF, 0xFF, + 0xFF, 0x99, 0xCC, 0x99, 0x99, 0x9F, 0xCF, 0xC1, 0xCC, 0xE7, 0x99, 0xC9, 0xE7, 0x94, 0x99, 0x99, + 0xC1, 0xC1, 0xCF, 0xF9, 0xE5, 0x99, 0xC3, 0x80, 0xC9, 0xC1, 0xCD, 0xE7, 0xF3, 0xE7, 0xFF, 0x9C, + 0xF3, 0x99, 0x9F, 0xCC, 0x99, 0x99, 0x99, 0xC3, 0xCF, 0x9F, 0x9F, 0xE7, 0xF3, 0xE7, 0x9C, 0x81, + 0xCF, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0xC1, 0xE1, 0x99, 0xC0, 0x8C, 0x81, 0x98, 0xF3, + 0x99, 0xE7, 0x99, 0x99, 0x99, 0x91, 0xC0, 0xC1, 0x99, 0x9F, 0xF9, 0xCC, 0xC8, 0xF3, 0xE6, 0x99, + 0xBB, 0xAA, 0xC4, 0xF3, 0xF3, 0xF3, 0xE4, 0xE4, 0xF3, 0xE4, 0xE4, 0xE4, 0xFF, 0xFF, 0xFF, 0xF3, + 0xFF, 0xFF, 0xF3, 0xF3, 0xFF, 0xF3, 0xF3, 0xE4, 0xFF, 0xE4, 0xFF, 0xE4, 0xE4, 0xFF, 0xE4, 0xFF, + 0xFF, 0xF3, 0xE4, 0xFF, 0xFF, 0xF3, 0xE4, 0xE4, 0xF3, 0xFF, 0xF3, 0x80, 0x80, 0x87, 0xF8, 0xFF, + 0x91, 0x83, 0x9F, 0xC9, 0x99, 0x93, 0xC1, 0xF3, 0xC3, 0xC9, 0xC9, 0x99, 0xC0, 0xC0, 0xCF, 0x99, + 0x81, 0xFF, 0xFF, 0xFF, 0xF3, 0x93, 0xE7, 0x91, 0xFF, 0xFF, 0xFF, 0xC9, 0xFF, 0xFF, 0xE1, 0xFF, + }, +// Row 7 + { + 0xFF, 0xBF, 0x80, 0xF7, 0xF7, 0xE3, 0xE3, 0xFF, 0x80, 0xE1, 0x9E, 0x99, 0xC0, 0x87, 0x8C, 0xD2, + 0xBF, 0xFE, 0xE1, 0xCC, 0xF2, 0x99, 0xC0, 0xF3, 0xF3, 0xF3, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xE7, 0xFF, 0xC9, 0xE7, 0x9C, 0xC4, 0xFF, 0xF3, 0xCF, 0xFF, 0xFF, 0xE7, 0xFF, 0xE7, 0xBF, + 0xC1, 0x81, 0x81, 0xC3, 0xF0, 0xC3, 0xC3, 0xE7, 0xC3, 0xC7, 0xE7, 0xE7, 0xF3, 0xFF, 0xCF, 0xE7, + 0xC3, 0x99, 0x81, 0xE1, 0x83, 0x80, 0x87, 0xE0, 0x99, 0xC3, 0xC3, 0x8C, 0x80, 0x9C, 0x9C, 0xE3, + 0x87, 0xF1, 0x8C, 0xC3, 0xC3, 0x81, 0xE7, 0x9C, 0x9C, 0xC3, 0x80, 0xC3, 0xFE, 0xC3, 0xFF, 0xFF, + 0xFF, 0xC4, 0x91, 0xC3, 0xC4, 0xC3, 0x87, 0xF9, 0x8C, 0xC3, 0x99, 0x8C, 0xC3, 0x9C, 0x99, 0xC3, + 0xCF, 0xF9, 0x87, 0x83, 0xF3, 0xC4, 0xE7, 0xC9, 0x9C, 0xF9, 0x81, 0xF1, 0xF3, 0x8F, 0xFF, 0x80, + 0xF9, 0xC0, 0xC3, 0xE0, 0xC0, 0xC0, 0xC0, 0xF9, 0xE1, 0xC3, 0xC3, 0xC3, 0xE1, 0xC3, 0x9C, 0x99, + 0x81, 0xC0, 0x98, 0xC3, 0xC3, 0xC3, 0xC0, 0xC0, 0xF9, 0xF3, 0xC3, 0xF3, 0x81, 0xE7, 0x9C, 0x93, + 0xC0, 0xC3, 0xC3, 0xC0, 0x99, 0x99, 0xFF, 0xFF, 0xC3, 0xFF, 0xFF, 0x99, 0x98, 0xF3, 0xFF, 0xFF, + 0xEE, 0xD5, 0x92, 0xF3, 0xF3, 0xF3, 0xE4, 0xE4, 0xF3, 0xE4, 0xE4, 0xE4, 0xFF, 0xFF, 0xFF, 0xF3, + 0xFF, 0xFF, 0xF3, 0xF3, 0xFF, 0xF3, 0xF3, 0xE4, 0xFF, 0xE4, 0xFF, 0xE4, 0xE4, 0xFF, 0xE4, 0xFF, + 0xFF, 0xF3, 0xE4, 0xFF, 0xFF, 0xF3, 0xE4, 0xE4, 0xF3, 0xFF, 0xF3, 0x80, 0x80, 0x87, 0xF8, 0xFF, + 0xC4, 0x9F, 0x9F, 0xC9, 0x81, 0xC7, 0xCF, 0xF3, 0xE7, 0xE3, 0x88, 0xC3, 0xFF, 0xCF, 0xE3, 0x99, + 0xFF, 0x81, 0x81, 0x81, 0xF3, 0x93, 0xE7, 0xFF, 0xFF, 0xFF, 0xFF, 0xE1, 0xFF, 0xFF, 0xFF, 0xFF, + }, +// Row 8 + { + 0xFF, 0xC0, 0xC0, 0xFF, 0xFF, 0xC1, 0xC1, 0xFF, 0x80, 0xFF, 0x80, 0xC3, 0xF3, 0x8F, 0x9F, 0xB3, + 0xFF, 0xFF, 0xF3, 0xFF, 0xFF, 0xC3, 0xFF, 0x80, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xCF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xCF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x80, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x83, 0xFF, 0xFF, 0xC3, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x87, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x83, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xC3, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xE3, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x83, 0xFF, 0xFF, 0xF3, 0xFF, 0xE7, 0x9C, 0xC7, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF8, 0xFE, 0xFF, 0xFF, 0xFF, + 0xBB, 0xAA, 0x88, 0xF3, 0xF3, 0xF3, 0xE4, 0xE4, 0xF3, 0xE4, 0xE4, 0xE4, 0xFF, 0xFF, 0xFF, 0xF3, + 0xFF, 0xFF, 0xF3, 0xF3, 0xFF, 0xF3, 0xF3, 0xE4, 0xFF, 0xE4, 0xFF, 0xE4, 0xE4, 0xFF, 0xE4, 0xFF, + 0xFF, 0xF3, 0xE4, 0xFF, 0xFF, 0xF3, 0xE4, 0xE4, 0xF3, 0xFF, 0xF3, 0x80, 0x80, 0x87, 0xF8, 0xFF, + 0xFF, 0x9F, 0xFF, 0xFF, 0xFF, 0xFF, 0x9F, 0xFF, 0x81, 0xFF, 0xFF, 0xFF, 0xFF, 0x9F, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xF3, 0xC7, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF1, 0xFF, 0xFF, 0xFF, 0xFF, + }, + +}; // end of screen_font \ No newline at end of file diff --git a/vga-more/src/sketch.ino b/vga-more/src/sketch.ino new file mode 100644 index 0000000..a3a3c89 --- /dev/null +++ b/vga-more/src/sketch.ino @@ -0,0 +1,190 @@ +/* + VGA video generation + + Author: Nick Gammon + Date: 20th April 2012 + + Example code without I2C communications. + + Connections: + + D1 : Pixel output (180 ohms in series) (connect to R, G, B tied together) --> Pins 1, 2, 3 on DB15 socket + D3 : Horizontal Sync (68 ohms in series) --> Pin 13 on DB15 socket + D10 : Vertical Sync (68 ohms in series) --> Pin 14 on DB15 socket + + Gnd : --> Pins 5, 6, 7, 8, 10 on DB15 socket + +*/ + +#include "TimerHelpers.h" +#include +#include "screenFont.h" +#include + +#define BETA_ARDUINO ARDUINO < 100 + +const byte pixelPin = 1; // <------- Pixel data +const byte hSyncPin = 3; // <------- HSYNC +const byte MSPIM_SCK = 4; // <-- we aren't using it directly +const byte vSyncPin = 10; // <------- VSYNC + +const int horizontalBytes = 20; // 160 pixels wide +const int verticalPixels = 480; // 480 pixels high + +const byte i2cAddress = 42; + +// Timer 1 - Vertical sync + +// output OC1B pin 16 (D10) <------- VSYNC + +// Period: 16.64 mS (60 Hz) +// 1/60 * 1e6 = 16666.66 uS +// Pulse for 64 uS (2 x HSync width of 32 uS) +// Sync pulse: 2 lines +// Back porch: 33 lines +// Active video: 480 lines +// Front porch: 10 lines +// Total: 525 lines + +// Timer 2 - Horizontal sync + +// output OC2B pin 5 (D3) <------- HSYNC + +// Period: 32 uS (31.25 kHz) +// (1/60) / 525 * 1e6 = 31.74 uS +// Pulse for 4 uS (96 times 39.68 nS) +// Sync pulse: 96 pixels +// Back porch: 48 pixels +// Active video: 640 pixels +// Front porch: 16 pixels +// Total: 800 pixels + +// Pixel time = ((1/60) / 525 * 1e9) / 800 = 39.68 nS +// frequency = 1 / (((1/60) / 525 * 1e6) / 800) = 25.2 MHz + +// However in practice, it is the SPI speed, namely a period of 125 nS +// (that is 2 x system clock speed) +// giving an 8 MHz pixel frequency. Thus the characters are about 3 times too wide. +// Thus we fit 160 of "our" pixels on the screen in what usually takes 3 x 160 = 480 + +const byte screenFontHeight = 8; +const byte screenFontWidth = 8; + +const int verticalLines = verticalPixels / screenFontHeight / 2; // double-height characters +const int horizontalPixels = horizontalBytes * screenFontWidth; + +const byte verticalBackPorchLines = 35; // includes sync pulse? +const int verticalFrontPorchLines = 525 - verticalBackPorchLines; + +volatile int vLine; +volatile int messageLine; +volatile byte backPorchLinesToGo; + +char message [verticalLines] [horizontalBytes]; + +// ISR: Vsync pulse +ISR (TIMER1_OVF_vect) + { + vLine = 0; + messageLine = 0; + backPorchLinesToGo = verticalBackPorchLines; + } // end of TIMER1_OVF_vect + +// ISR: Hsync pulse ... this interrupt merely wakes us up +ISR (TIMER2_OVF_vect) + { + } // end of TIMER2_OVF_vect + +void setup() + { + + // initial message ... change to suit + for (int i = 0; i < verticalLines; i++) + sprintf (message [i], "Line %03i - hello!", i); + + // disable Timer 0 + TIMSK0 = 0; // no interrupts on Timer 0 + OCR0A = 0; // and turn it off + OCR0B = 0; + + // Timer 1 - vertical sync pulses + pinMode (vSyncPin, OUTPUT); + Timer1::setMode (15, Timer1::PRESCALE_1024, Timer1::CLEAR_B_ON_COMPARE); + OCR1A = 259; // 16666 / 64 uS = 260 (less one) + OCR1B = 0; // 64 / 64 uS = 1 (less one) + TIFR1 = _BV (TOV1); // clear overflow flag + TIMSK1 = _BV (TOIE1); // interrupt on overflow on timer 1 + + // Timer 2 - horizontal sync pulses + pinMode (hSyncPin, OUTPUT); + Timer2::setMode (7, Timer2::PRESCALE_8, Timer2::CLEAR_B_ON_COMPARE); + OCR2A = 63; // 32 / 0.5 uS = 64 (less one) + OCR2B = 7; // 4 / 0.5 uS = 8 (less one) + TIFR2 = _BV (TOV2); // clear overflow flag + TIMSK2 = _BV (TOIE2); // interrupt on overflow on timer 2 + + // Set up USART in SPI mode (MSPIM) + + // baud rate must be zero before enabling the transmitter + UBRR0 = 0; // USART Baud Rate Register + pinMode (MSPIM_SCK, OUTPUT); // set XCK pin as output to enable master mode + UCSR0B = 0; + UCSR0C = _BV (UMSEL00) | _BV (UMSEL01) | _BV (UCPHA0) | _BV (UCPOL0); // Master SPI mode + + // prepare to sleep between horizontal sync pulses + set_sleep_mode (SLEEP_MODE_IDLE); + +} // end of setup + +// draw a single scan line +void doOneScanLine () + { + + // after vsync we do the back porch + if (backPorchLinesToGo) + { + backPorchLinesToGo--; + return; + } // end still doing back porch + + // if all lines done, do the front porch + if (vLine >= verticalPixels) + return; + + // pre-load pointer for speed + const register byte * linePtr = &screen_font [ (vLine >> 1) & 0x07 ] [0]; + register char * messagePtr = & (message [messageLine] [0] ); + + // how many pixels to send + register byte i = horizontalBytes; + + // turn transmitter on + UCSR0B = _BV (TXEN0); // transmit enable (starts transmitting white) + + // blit pixel data to screen + while (i--) + UDR0 = pgm_read_byte (linePtr + (* messagePtr++)); + + // wait till done + while (!(UCSR0A & _BV(TXC0))) + {} + + // disable transmit + UCSR0B = 0; // drop back to black + + // this line done + vLine++; + + // every 16 pixels it is time to move to a new line in our text + // (because we double up the characters vertically) + if ((vLine & 0xF) == 0) + messageLine++; + + } // end of doOneScanLine + +void loop() + { + // sleep to ensure we start up in a predictable way + sleep_mode (); + doOneScanLine (); + } // end of loop diff --git a/vga-random/lib/.holder b/vga-random/lib/.holder new file mode 100644 index 0000000..e69de29 diff --git a/vga-random/src/sketch.ino b/vga-random/src/sketch.ino new file mode 100644 index 0000000..503e833 --- /dev/null +++ b/vga-random/src/sketch.ino @@ -0,0 +1,7 @@ +void setup() { + DDRD = B11111111; +} + +void loop() { + PORTD = analogRead(0); +} -- cgit v1.3.1