Issue drawing BMP Pics to LCD unless they take up screen
handermanntr
Posts: 18
I am using the sainsmart 1.8" LCD to view bmp images stored on an SD Card. Below is the code. The issue is that it works perfect when the BMP file is the same size as the screen, but does not work when the image is smaller than the screen. Here are a few photos of it working, and not working. I have already tried multiple images, so I know it is not the file. The images are the same except on is 128 * 160(the whole screen), and one is 90 x 120. I did not include the SD Classes because I know they work, essentially the BMP file is read in blocks of 512-bytes. The BMP files are a 24 bit depth, but converted to a 565(rgb) layout for the screens 16bit depth. Any help would be appreciated. Thanks!
Main Object:
Utilities:
SPILCD:
[code]{{
SPI Management Functions
Abstract:
This class is built to be a universal SPI Driver with C3 Channel select capability.
}}
CON
'Clocking settings
_clkmode = xtal1 + pll16x
_xinfreq = 5_000_000
VAR
long data[8]
{
ASM DATA:
data[0] := Data pin
data[1] := Clock pin
data[2] := Data location/data
data[3] := data type to write (no command(idle)=0, char=1, 8bit=2, 16bitrewrite=3, SetFont = 4)
data[4] := color/writes to perform for 16 bit mode
data[5] := bcolor
data[6] := x
data[7] := y
}
byte cogon
byte cog
OBJ
Utilities : "Utilities"
PUB InitSPI(spidata, spiclock) : okay
'Set Asm data
data[0] := spidata 'Data pin
data[1] := spiclock'Clock pin
data[3] := 0 'Data not present
okay := cogon := (cog := cognew(@entry,@data)) > 0
PUB WriteSPISlow(strOutBuffer) | NumBytes
NumBytes := 8
' now read the bits out
repeat 8
' drop clock
OUTA[data[1]] := 0
' place next bit on OUT (shift to right starting at MSB - 1(to get the first(msb) bit then next, and so on) then bitwise AND with 01 to get only last bit)
OUTA[data[0]] := ((strOutBuffer >> (NumBytes-- - 1)) & $01)
' raise clock
OUTA[data[1]] := 1
PUB WriteSPICLR(writes, wrdOut)
{
Purpose: Write 16 bits to SPI, but repeat sending 16 bit data for writes times
}
repeat until data[3] == 0 'Wait until cog ready
data[2] := wrdOut 'Write word to write
data[4] := writes 'Write "writes" times
data[3] := 3 'Set data type to 16 bit
repeat until data[3] == 0
PUB WriteSPICHR(x,y,char,color,bcolor)
{
Purpose: Write charachter to screen
}
repeat until data[3] == 0 'Wait until cog ready
data[2] := char
data[4] := color
data[5] := bcolor
data[6] := x
data[7] := y
data[3] := 1 'Set function to char
repeat until data[3] == 0
PUB SetFont(fontloc)
{
Purpose: Set font for ASM char writing
}
repeat until data[3] == 0 'Wait until cog ready
data[2] := fontloc
data[3] := 4 'Set function to set font
repeat until data[3] == 0
PUB WriteSPI(bytOut)
{
Purpose: Write 8 bits to SPI
}
repeat until data[3] == 0 'Wait until cog ready
data[2] := bytOut
data[3] := 2 'Set datatype to 8 bit
repeat until data[3] == 0
PUB stop
if cogon~
cogstop(cog)
DAT
org 0
entry
mov dt, par 'Get data location
rdlong spid, dt 'Get SPI data pin
add dt, #4 'Jump to next long
rdlong spic, dt 'Get SPI clk pin
mov spidmask, #1 'Get Pin Masks
mov spicmask, #1
shl spidmask, spid
shl spicmask, spic
or dira, spidmask 'Set pins to output
or dira, spicmask
add dt, #4 'Goto Data location
mov dtyploc, dt 'Get Data type location
add dtyploc, #4
mov cloc, dtyploc
add cloc, #4
mov bcloc, cloc
add bcloc, #4
mov xloc, bcloc
add xloc, #4
mov yloc, xloc
add yloc, #4
'Set Counter registers
mov ctra, spid 'Set counter A data pin
mov ctrb, spic 'Set clock pin for ctr b
movi ctra,#%0_00100_000
movi ctrb,#%0_00100_000
'
:loop
rdlong r1, dtyploc 'Get datatype
tjz r1, #:loop
movi phsb,#%000000000 'Set phase reg b
rdlong wrdt, dt 'Get data from location
cmp r1, #1 wz 'Test if char
if_z jmp #:writechar
cmp r1, #2 wz 'Test if 8 bit command
if_z jmp #:writeeight
cmp r1, #3 wz 'Test if 16 bit command
if_z jmp #:writesixtn
jmp #:setfont 'Otherwise, set font command
:writeeight
shl wrdt, #24
mov phsa, wrdt 'Write data into register
movi frqb,#%010000000 'Start counting!
:wreghtloop
shl phsa, #1 'Get next bit
shl phsa, #1
shl phsa, #1
shl phsa, #1
shl phsa, #1
shl phsa, #1
shl phsa, #1
mov frqb, #0 'Stop counting
wrlong null, dtyploc 'Clear Datatype
jmp #:loop
:writesixtn
rdlong r2, cloc 'Get times to write data
shl wrdt, #16
:wrsxtnloop
mov phsa, wrdt
movi frqb,#%010000000 'Start counting!
shl phsa, #1
shl phsa, #1
shl phsa, #1
shl phsa, #1
shl phsa, #1
shl phsa, #1
shl phsa, #1
shl phsa, #1
shl phsa, #1
shl phsa, #1
shl phsa, #1
shl phsa, #1
shl phsa, #1
shl phsa, #1
shl phsa, #1
mov frqb, #0 'Stop counting
djnz r2,#:wrsxtnloop 'If more writes start writing again
wrlong null, dtyploc 'Clear Datatype
jmp #:loop
:writechar
rdlong wrdt,dt 'Get Char
rdlong cx, xloc 'Get x
rdlong cy, yloc 'Get y
'Calculate char address
mov r1, wrdt
sub r1, foffset
mov r2, fxsize
shr r2, #3 'Divide by 8
Main Object:
{{ Name: Trevor Handermann Abstract: SS TFT 1.8" LCD Driver }} CON 'Clocking settings _clkmode = xtal1 + pll16x _xinfreq = 5_000_000 SCREEN_WIDTH = 128 SCREEN_HEIGHT = 160 TEXT_WIDTH = 5 'LCD COMMANDS COLADDRSET = $2A ROWADDRSET = $2B RAMWR = $2C RAMRD = $2E WIDTH = 128 HEIGHT = 160 SWRESET = $01 SLEEPIN = $10 SLEEPOUT = $11 FRMCTR1 = $B1 FRMCTR2 = $B2 FRMCTR3 = $B3 DISPON = $29 DISPOFF = $28 INVCTR = $B4 'Display Inversion Control PWCTR1 = $C0 'Power Control PWCTR2 = $C1 PWCTR3 = $C2 PWCTR4 = $C3 PWCTR5 = $C4 MADCTL = $36 'Memory Access Control INVOFF = $20 'Invert display off INVON = $21 COLMOD = $3A 'Color Mode NORON = $13 'Normal Display On GMCTRP1 = $E0 GMCTRN1 = $E1 VMCTR1 = $C5 'Power Control 'BBBBB_GGGGGG_RRRRR 'Colors WHITE = $FFFF BLACK = 0 RED = $F800 BLUE = $F800 GREEN = $07E0 PURPLE = $F81F YELLOW = $07FF ORANGE = %00000_100000_11111 BROWN = %01000_011000_10001 VAR byte cs, sda, scl, dc, rst 'Pins byte fxsize, fysize, foffset, font long floc byte buffer[512] byte rollover[2] long bmpimgoffset, bmpwidth, bmpheight, bmpdepth OBJ Utilities : "Utilities" SPI : "SPILCD" term : "Parallax Serial Terminal" num : "Simple_Numbers" SD : "SDFAT" PUB Start | te, tes term.Start(9600) Init(4,1,0,2,3) SetFont(0) SD.Mount(true,0,0,0,0) SD.LoadPartitions SD.LoadPartition(0) 'Term.str(num.dec(te)) SD.LoadDir(-1) 'Load root dir SPI.SetFont(@SmallFont) 'Fill screen back color FillScreen(RED) 'Utilities.DelayS(2) te := DrawBMP(string("GUN.BMP"),0,0) Term.str(num.dec(te)) repeat PUB Init( cspin, sdapin, sclpin, dcpin, rstpin) cs := cspin sda := sdapin scl := sclpin dc := dcpin rst := rstpin 'Init SPI Interface SPI.InitSPI(sda, scl) InitR PUB DrawBMP(pstr,x,y): okay | clusters,index, subind, bufind,r,g,b, col,rollcnt, curloc, r1 { Purpose: Draws BMP image with name @pstr at point x,y. File must be in currently loaded directory, and pic must fit within screen } 'Get file list index := SD.GetFileList okay := 0 r1 := Utilities.GetSubWordIndex(index, pstr,">") 'Get index in directory to load BMP file if r1 <> -1 'If file exists, then load clusters := SD.GetFileClusters(r1) 'Load Clusters for file rollcnt := 0 if clusters > 0 if ReadBMPHeader 'Test if valid BMP File curloc := 0 bufind := bmpimgoffset SetAddrWindow(x,y,x + bmpwidth - 1, y + bmpheight - 1) repeat index from 0 to bmpheight - 1 repeat subind from 0 to bmpwidth - 1 if rollcnt > 0 case rollcnt 1: b := rollover[0] g := buffer[0] r := buffer[1] bufind := 2 2: b := rollover[0] g := rollover[1] r := buffer[0] bufind := 1 rollcnt := 0 else 'Read pixel b := buffer[bufind] 'Term.str(string(" b:")) 'Term.str(num.hex(b, 2)) g := buffer[bufind + 1] 'Term.str(string(" g:")) 'Term.str(num.hex(g, 2)) r := buffer[bufind + 2] 'Term.str(string(" r:")) 'Term.str(num.hex(r, 2)) 'Term.str(string(" / ")) 'Increment buffer bufind += 3 'Convert 888 to 565 pixel depth col := ((r & $F8) << 8) | ((g & $FC) << 3) | ((b & $F8) >> 3) 'Term.str(string(" col:")) 'Term.str(num.dec(col)) 'repeat 'Push color to LCD PushColor(col) if bufind > 509 if bufind <> 512 rollcnt := 512 - bufind 'Get rollover bytes repeat col from bufind to 511 rollover[col - bufind] := buffer[col] else bufind := 0 'Read next block into buffer SD.ReadFile(++curloc,@buffer) else okay := 213 else okay := 212 else okay := 211 PRI ReadBMPHeader : okay | tmp 'Read first portion of file SD.ReadFile(0,@buffer) okay := false 'Verify header if buffer[0] == $42 and buffer[1] == $4d 'Header ok bmpimgoffset := ReverseLongBuffer(10) 'Verify width and height bmpwidth := ReverseLongBuffer(18) bmpheight := ReverseLongBuffer(22) if bmpwidth =< SCREEN_WIDTH and bmpheight =< SCREEN_HEIGHT 'Verify header if buffer[26] == 1 and buffer[27] == 0 'Header ok bmpdepth := ReverseWordBuffer(28) 'Verify Compression if ReverseLongBuffer(30)== 0 'Correct compression okay := true PRI ReverseLongBuffer(location) : value | index value := 0 repeat index from 0 to 3 value |= (buffer[location+index] << (index * 8)) PRI ReverseWordBuffer(location) : value | index value := 0 repeat index from 0 to 1 value |= (buffer[location+index] << (index * 8)) PUB WriteCommand(command) OUTA[dc]~ OUTA[cs]~ SPI.WriteSPI(command) OUTA[cs]~~ PRI WriteData(data) OUTA[dc]~~ OUTA[cs]~ SPI.WriteSPI(data) OUTA[cs]~~ PUB SetAddrWindow(x0, y0, x1, y1) WriteCommand(COLADDRSET) 'Set Column WriteData(0) WriteData(x0) 'Set XSTART WriteData(0) WriteData(x1) 'Set XEND WriteCommand(ROWADDRSET) 'Set Row WriteData(0) WriteData(y0) 'Set XSTART WriteData(0) WriteData(y1) 'Set XEND WriteCommand(RAMWR) 'Write to RAM PUB PushColor(color) OUTA[dc]~~ OUTA[cs]~ SPI.WriteSPICLR(1, color) OUTA[cs]~~ PUB SetXY(x,y) SetAddrWindow(x,y,x + 1, y + 1) PUB DrawPixel(x,y,color) if x < WIDTH and Y < HEIGHT and x => 0 and y => 0 SetAddrWindow(x,y,x+1,y+1) 'Set window to 1 pixel PushColor(color) 'Push the color to the pixel PUB FillScreen(color) | x, y SetAddrWindow(0,0,WIDTH - 1, HEIGHT -1) 'Set window to whole screen OUTA[dc]~~ OUTA[cs]~ SPI.WriteSPICLR(20_480, color) OUTA[cs]~~ PUB DrawString(x,y,pstrString,color, bcolor) | length, chr, index, space, wordlength, xbegin length := strsize(pstrString) repeat index from 0 to length - 1 if index <> 0 x += fxsize chr := byte[pstrString + index] DrawChar(x,y,chr,color,bcolor) if chr == 32 space := Utilities.IndexOf(index + 1, 32, pstrString) 'Get index of next space if space == -1 space := length - 1 wordlength := space - (index + 1) 'Get length of next word if (wordlength * fxsize) + x => WIDTH y += fysize x := 0 if (x + (2 * fxsize)) > WIDTH 'If end of screen y += fysize x := 0 PUB DrawVerticalLine(x,y,length,color) DrawHVLine(x,y,length,color,1) PUB DrawHorizontalLine(x,y,length,color) DrawHVLine(x,y,length,color,0) PRI DrawHVLine(x,y,length,color,rotflag) { Note: 1 = Verticle, 0 = horizontal } if rotflag == 1 SetAddrWindow(x,y,x,y+length) else SetAddrWindow(x,y,x+length,y+1) OUTA[dc]~~ OUTA[cs]~ SPI.WriteSPICLR(length, color) OUTA[cs]~~ PUB DrawCircle(x0,y0,r,color) | x,y,ddfx,ddfy,f f := 1 - r ddfx := 1 ddfy := -2 * r x := 0 y := r DrawPixel(x0,y0+r,color) DrawPixel(x0,y0-r,color) DrawPixel(x0+r,y0,color) DrawPixel(x0-r,y0,color) repeat while x < y if f=> 0 y-- ddfy += 2 f += ddfy x++ ddfx += 2 f += ddfx DrawPixel(x0 + x, y0 + y, color) DrawPixel(x0 - x, y0 + y, color) DrawPixel(x0 + x, y0 - y, color) DrawPixel(x0 - x, y0 - y, color) DrawPixel(x0 + y, y0 + x, color) DrawPixel(x0 - y, y0 + x, color) DrawPixel(x0 + y, y0 - x, color) DrawPixel(x0 - y, y0 - x, color) PUB FillCircle(x0,y0,r,color) | f, ddfx, ddfy, x,y f := 1 - r ddfx := 1 ddfy := -2 * r x := 0 y := r DrawVerticalLine(x0,y0-r,2*r+1,color) repeat while x < y if f => 0 y-- ddfy += 2 f += ddfy x++ ddfx += 2 f += ddfx DrawVerticalLine(x0+x, y0-y, 2*y+1, color) DrawVerticalLine(x0-x, y0-y, 2*y+1, color) DrawVerticalLine(x0+y, y0-x, 2*x+1, color) DrawVerticalLine(x0-y, y0-x, 2*x+1, color) PUB DrawRect(x,y,w,h,color) DrawHorizontalLine(x, y, w, color) DrawHorizontalLine(x, y+h-1, w, color) DrawVerticalLine(x, y, h, color) DrawVerticalLine(x+w-1, y, h, color) PUB FillRect(x,y,w,h,color) SetAddrWindow(x, y, x+w-1, y+h-1) OUTA[dc]~~ OUTA[cs]~ SPI.WriteSPICLR(w*h,color) OUTA[cs]~~ PUB DrawChar(x,y,char,color,bcolor) | index, in1, chr, line, in2,temp '50 longs per digit SetAddrWindow(x,y,x+fxsize-1,y+fysize-1) temp := ((char - foffset) * ((fxsize /8) * fysize)) repeat index from 0 to ((fxsize/8) * fysize) - 1 chr := byte[floc][temp] repeat in1 from 0 to 7 if (chr & (1<<(7-in1))) <> 0 PushColor(color) else PushColor(bcolor) temp++ PUB DrawCharNew(x,y,char,color,bcolor) | index, in1, chr, line, in2,temp '50 longs per digit SetAddrWindow(x,y,x+fxsize-1,y+fysize-1) OUTA[dc]~~ OUTA[cs]~ SPI.WriteSPICHR(x, y,char,color,bcolor) OUTA[cs]~~ PUB DrawLine(x0,y0,x1,y1, color) | steep, dx, dy, err, ystep steep := ||y1-y0 > ||x1-x0 if steep Swap(x0,y0) Swap(x1,y1) if x0 > x1 Swap(x0,x1) Swap(y0,y1) dx := x1 - x0 dy := ||y1-y0 err := dx / 2 if y0 < y1 ystep := 1 else ystep := -1 repeat while x0 =< x1 if steep DrawPixel(y0,x0,color) else DrawPixel(x0,y0,color) err -= dy if err < 0 y0 += ystep err += dx x0++ PRI Swap(a,b) | t t := a a := b b := t PRI InitR 'Set Pin Dirs DIRA[dc]~~ DIRA[cs]~~ DIRA[rst]~~ DIRA[sda]~~ DIRA[scl]~~ OUTA[cs]~ 'Reset hardware OUTA[rst]~~ Utilities.DelayMS(500) OUTA[rst]~ Utilities.DelayMS(500) OUTA[rst]~~ Utilities.DelayMS(500) 'Reset Software WriteCommand(SWRESET) Utilities.DelayMS(150) 'Disable Sleep Mode WriteCommand(SLEEPOUT) Utilities.DelayMS(500) 'Frame rate control normal WriteCommand(FRMCTR1) WriteData(1) WriteData($2C) WriteData($2D) 'Frame rate control idle WriteCommand(FRMCTR2) WriteData(1) WriteData($2C) WriteData($2D) 'Frame rate control partial WriteCommand(FRMCTR3) WriteData(1) WriteData($2C) WriteData($2D) WriteData(1) WriteData($2C) WriteData($2D) 'Display Inversion Control WriteCommand(INVCTR) WriteData($07) 'No Inversion 'Power Control Settings WriteCommand(PWCTR1) WriteData($A2) WriteData($02) ' -4.6V WriteData($84) ' AUTO mode WriteCommand(PWCTR2) ' power control WriteData($C5) ' VGH25 = 2.4C VGSEL = -10 VGH = 3 * AVDD WriteCommand(PWCTR3) ' power control WriteData($0A) ' Opamp current small WriteData($00) ' Boost frequency WriteCommand(PWCTR4) ' power control WriteData($8A) ' BCLK/2, Opamp current small & Medium low WriteData($2A) WriteCommand(PWCTR5) ' power control WriteData($8A) WriteData($EE) WriteCommand(VMCTR1) ' power control WriteData($0E) WriteCommand(INVOFF) ' don't invert display WriteCommand(MADCTL) ' memory access control (directions) WriteData($40) ' row address/col address, bottom to top refresh WriteCommand(COLMOD) ' set color mode WriteData($05) ' 16-bit color WriteCommand(COLADDRSET) ' column addr set WriteData($00) WriteData($00) ' XSTART = 0 WriteData($00) WriteData($7F) ' XEND = 127 WriteCommand(ROWADDRSET) ' row addr set WriteData($00) WriteData($00) ' XSTART = 0 WriteData($00) WriteData($9F) ' XEND = 159 WriteCommand(GMCTRP1) WriteData($0f) WriteData($1a) WriteData($0f) WriteData($18) WriteData($2f) WriteData($28) WriteData($20) WriteData($22) WriteData($1f) WriteData($1b) WriteData($23) WriteData($37) WriteData($00) WriteData($07) WriteData($02) WriteData($10) WriteCommand(GMCTRN1) WriteData($0f) WriteData($1b) WriteData($0f) WriteData($17) WriteData($33) WriteData($2c) WriteData($29) WriteData($2e) WriteData($30) WriteData($30) WriteData($39) WriteData($3f) WriteData($00) WriteData($07) WriteData($03) WriteData($10) WriteCommand(DISPON) Utilities.DelayMS(100) WriteCommand(NORON) ' normal display on Utilities.DelayMS(10) PUB SetFont(f) font := f CASE font 0: floc := @SmallFont 1: floc := @BigFont 2: floc := @SevenSegNumFont fxsize := byte[floc++] fysize := byte[floc++] foffset := byte[floc++] floc++ DAT SmallFont byte $08, $0C, $20, $5F byte $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00 ' <Space> byte $00, $00, $20, $20, $20, $20, $20, $20, $00, $20, $00, $00 ' ! byte $00, $28, $50, $50, $00, $00, $00, $00, $00, $00, $00, $00 ' " byte $00, $00, $28, $28, $FC, $28, $50, $FC, $50, $50, $00, $00 ' # byte $00, $20, $78, $A8, $A0, $60, $30, $28, $A8, $F0, $20, $00 ' $ byte $00, $00, $48, $A8, $B0, $50, $28, $34, $54, $48, $00, $00 ' % byte $00, $00, $20, $50, $50, $78, $A8, $A8, $90, $6C, $00, $00 ' & byte $00, $40, $40, $80, $00, $00, $00, $00, $00, $00, $00, $00 ' ' byte $00, $04, $08, $10, $10, $10, $10, $10, $10, $08, $04, $00 ' ( byte $00, $40, $20, $10, $10, $10, $10, $10, $10, $20, $40, $00 ' ) byte $00, $00, $00, $20, $A8, $70, $70, $A8, $20, $00, $00, $00 ' * byte $00, $00, $20, $20, $20, $F8, $20, $20, $20, $00, $00, $00 ' + byte $00, $00, $00, $00, $00, $00, $00, $00, $00, $40, $40, $80 ' , byte $00, $00, $00, $00, $00, $F8, $00, $00, $00, $00, $00, $00 ' - byte $00, $00, $00, $00, $00, $00, $00, $00, $00, $40, $00, $00 ' . byte $00, $08, $10, $10, $10, $20, $20, $40, $40, $40, $80, $00 ' / byte $00, $00, $70, $88, $88, $88, $88, $88, $88, $70, $00, $00 ' 0 byte $00, $00, $20, $60, $20, $20, $20, $20, $20, $70, $00, $00 ' 1 byte $00, $00, $70, $88, $88, $10, $20, $40, $80, $F8, $00, $00 ' 2 byte $00, $00, $70, $88, $08, $30, $08, $08, $88, $70, $00, $00 ' 3 byte $00, $00, $10, $30, $50, $50, $90, $78, $10, $18, $00, $00 ' 4 byte $00, $00, $F8, $80, $80, $F0, $08, $08, $88, $70, $00, $00 ' 5 byte $00, $00, $70, $90, $80, $F0, $88, $88, $88, $70, $00, $00 ' 6 byte $00, $00, $F8, $90, $10, $20, $20, $20, $20, $20, $00, $00 ' 7 byte $00, $00, $70, $88, $88, $70, $88, $88, $88, $70, $00, $00 ' 8 byte $00, $00, $70, $88, $88, $88, $78, $08, $48, $70, $00, $00 ' 9 byte $00, $00, $00, $00, $20, $00, $00, $00, $00, $20, $00, $00 ' : byte $00, $00, $00, $00, $00, $20, $00, $00, $00, $20, $20, $00 ' ; byte $00, $04, $08, $10, $20, $40, $20, $10, $08, $04, $00, $00 ' < byte $00, $00, $00, $00, $F8, $00, $00, $F8, $00, $00, $00, $00 ' = byte $00, $40, $20, $10, $08, $04, $08, $10, $20, $40, $00, $00 ' > byte $00, $00, $70, $88, $88, $10, $20, $20, $00, $20, $00, $00 ' ? byte $00, $00, $70, $88, $98, $A8, $A8, $B8, $80, $78, $00, $00 ' @ byte $00, $00, $20, $20, $30, $50, $50, $78, $48, $CC, $00, $00 ' A byte $00, $00, $F0, $48, $48, $70, $48, $48, $48, $F0, $00, $00 ' B byte $00, $00, $78, $88, $80, $80, $80, $80, $88, $70, $00, $00 ' C byte $00, $00, $F0, $48, $48, $48, $48, $48, $48, $F0, $00, $00 ' D byte $00, $00, $F8, $48, $50, $70, $50, $40, $48, $F8, $00, $00 ' E byte $00, $00, $F8, $48, $50, $70, $50, $40, $40, $E0, $00, $00 ' F byte $00, $00, $38, $48, $80, $80, $9C, $88, $48, $30, $00, $00 ' G byte $00, $00, $CC, $48, $48, $78, $48, $48, $48, $CC, $00, $00 ' H byte $00, $00, $F8, $20, $20, $20, $20, $20, $20, $F8, $00, $00 ' I byte $00, $00, $7C, $10, $10, $10, $10, $10, $10, $90, $E0, $00 ' J byte $00, $00, $EC, $48, $50, $60, $50, $50, $48, $EC, $00, $00 ' K byte $00, $00, $E0, $40, $40, $40, $40, $40, $44, $FC, $00, $00 ' L byte $00, $00, $D8, $D8, $D8, $D8, $A8, $A8, $A8, $A8, $00, $00 ' M byte $00, $00, $DC, $48, $68, $68, $58, $58, $48, $E8, $00, $00 ' N byte $00, $00, $70, $88, $88, $88, $88, $88, $88, $70, $00, $00 ' O byte $00, $00, $F0, $48, $48, $70, $40, $40, $40, $E0, $00, $00 ' P byte $00, $00, $70, $88, $88, $88, $88, $E8, $98, $70, $18, $00 ' Q byte $00, $00, $F0, $48, $48, $70, $50, $48, $48, $EC, $00, $00 ' R byte $00, $00, $78, $88, $80, $60, $10, $08, $88, $F0, $00, $00 ' S byte $00, $00, $F8, $A8, $20, $20, $20, $20, $20, $70, $00, $00 ' T byte $00, $00, $CC, $48, $48, $48, $48, $48, $48, $30, $00, $00 ' U byte $00, $00, $CC, $48, $48, $50, $50, $30, $20, $20, $00, $00 ' V byte $00, $00, $A8, $A8, $A8, $70, $50, $50, $50, $50, $00, $00 ' W byte $00, $00, $D8, $50, $50, $20, $20, $50, $50, $D8, $00, $00 ' X byte $00, $00, $D8, $50, $50, $20, $20, $20, $20, $70, $00, $00 ' Y byte $00, $00, $F8, $90, $10, $20, $20, $40, $48, $F8, $00, $00 ' Z byte $00, $38, $20, $20, $20, $20, $20, $20, $20, $20, $38, $00 ' [ byte $00, $40, $40, $40, $20, $20, $10, $10, $10, $08, $00, $00 ' <Backslash> byte $00, $70, $10, $10, $10, $10, $10, $10, $10, $10, $70, $00 ' ] byte $00, $20, $50, $00, $00, $00, $00, $00, $00, $00, $00, $00 ' ^ byte $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $FC ' _ byte $00, $20, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00 ' ' byte $00, $00, $00, $00, $00, $30, $48, $38, $48, $3C, $00, $00 ' a byte $00, $00, $C0, $40, $40, $70, $48, $48, $48, $70, $00, $00 ' b byte $00, $00, $00, $00, $00, $38, $48, $40, $40, $38, $00, $00 ' c byte $00, $00, $18, $08, $08, $38, $48, $48, $48, $3C, $00, $00 ' d byte $00, $00, $00, $00, $00, $30, $48, $78, $40, $38, $00, $00 ' e byte $00, $00, $1C, $20, $20, $78, $20, $20, $20, $78, $00, $00 ' f byte $00, $00, $00, $00, $00, $3C, $48, $30, $40, $78, $44, $38 ' g byte $00, $00, $C0, $40, $40, $70, $48, $48, $48, $EC, $00, $00 ' h byte $00, $00, $20, $00, $00, $60, $20, $20, $20, $70, $00, $00 ' i byte $00, $00, $10, $00, $00, $30, $10, $10, $10, $10, $10, $E0 ' j byte $00, $00, $C0, $40, $40, $5C, $50, $70, $48, $EC, $00, $00 ' k byte $00, $00, $E0, $20, $20, $20, $20, $20, $20, $F8, $00, $00 ' l byte $00, $00, $00, $00, $00, $F0, $A8, $A8, $A8, $A8, $00, $00 ' m byte $00, $00, $00, $00, $00, $F0, $48, $48, $48, $EC, $00, $00 ' n byte $00, $00, $00, $00, $00, $30, $48, $48, $48, $30, $00, $00 ' o byte $00, $00, $00, $00, $00, $F0, $48, $48, $48, $70, $40, $E0 ' p byte $00, $00, $00, $00, $00, $38, $48, $48, $48, $38, $08, $1C ' q byte $00, $00, $00, $00, $00, $D8, $60, $40, $40, $E0, $00, $00 ' r byte $00, $00, $00, $00, $00, $78, $40, $30, $08, $78, $00, $00 ' s byte $00, $00, $00, $20, $20, $70, $20, $20, $20, $18, $00, $00 ' t byte $00, $00, $00, $00, $00, $D8, $48, $48, $48, $3C, $00, $00 ' u byte $00, $00, $00, $00, $00, $EC, $48, $50, $30, $20, $00, $00 ' v byte $00, $00, $00, $00, $00, $A8, $A8, $70, $50, $50, $00, $00 ' w byte $00, $00, $00, $00, $00, $D8, $50, $20, $50, $D8, $00, $00 ' x byte $00, $00, $00, $00, $00, $EC, $48, $50, $30, $20, $20, $C0 ' y byte $00, $00, $00, $00, $00, $78, $10, $20, $20, $78, $00, $00 ' z byte $00, $18, $10, $10, $10, $20, $10, $10, $10, $10, $18, $00 ' { byte $10, $10, $10, $10, $10, $10, $10, $10, $10, $10, $10, $10 ' | byte $00, $60, $20, $20, $20, $10, $20, $20, $20, $20, $60, $00 ' } byte $40, $A4, $18, $00, $00, $00, $00, $00, $00, $00, $00, $00 ' ~ BigFont byte $10, $10, $20, $5F byte $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00 ' <Space> byte $00, $00, $00, $00, $07, $00, $0F, $80, $0F, $80, $0F, $80, $0F, $80, $0F, $80, $07, $00, $07, $00, $00, $00, $00, $00, $07, $00, $07, $00, $07, $00, $00, $00 ' ! byte $00, $00, $0E, $38, $0E, $38, $0E, $38, $0E, $38, $06, $30, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00 ' " byte $00, $00, $0C, $30, $0C, $30, $0C, $30, $7F, $FE, $7F, $FE, $0C, $30, $0C, $30, $0C, $30, $0C, $30, $7F, $FE, $7F, $FE, $0C, $30, $0C, $30, $0C, $30, $00, $00 ' # byte $00, $00, $02, $40, $02, $40, $0F, $F8, $1F, $F8, $1A, $40, $1A, $40, $1F, $F0, $0F, $F8, $02, $58, $02, $58, $1F, $F8, $1F, $F0, $02, $40, $02, $40, $00, $00 ' $ byte $00, $00, $00, $00, $00, $00, $0E, $10, $0E, $30, $0E, $70, $00, $E0, $01, $C0, $03, $80, $07, $00, $0E, $70, $0C, $70, $08, $70, $00, $00, $00, $00, $00, $00 ' % byte $00, $00, $00, $00, $0F, $00, $19, $80, $19, $80, $19, $80, $0F, $00, $0F, $08, $0F, $98, $19, $F8, $18, $F0, $18, $E0, $19, $F0, $0F, $98, $00, $00, $00, $00 ' & byte $00, $00, $00, $00, $07, $00, $07, $00, $07, $00, $0E, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00 ' ' byte $00, $00, $00, $00, $00, $F0, $01, $C0, $03, $80, $07, $00, $0E, $00, $0E, $00, $0E, $00, $0E, $00, $07, $00, $03, $80, $01, $C0, $00, $F0, $00, $00, $00, $00 ' ( byte $00, $00, $00, $00, $0F, $00, $03, $80, $01, $C0, $00, $E0, $00, $70, $00, $70, $00, $70, $00, $70, $00, $E0, $01, $C0, $03, $80, $0F, $00, $00, $00, $00, $00 ' ) byte $00, $00, $00, $00, $01, $80, $11, $88, $09, $90, $07, $E0, $07, $E0, $3F, $FC, $3F, $FC, $07, $E0, $07, $E0, $09, $90, $11, $88, $01, $80, $00, $00, $00, $00 ' * byte $00, $00, $00, $00, $00, $00, $00, $00, $01, $80, $01, $80, $01, $80, $0F, $F0, $0F, $F0, $01, $80, $01, $80, $01, $80, $00, $00, $00, $00, $00, $00, $00, $00 ' + byte $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $07, $00, $07, $00, $07, $00, $0E, $00, $00, $00 ' , byte $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $1F, $F8, $1F, $F8, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00 ' - byte $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $07, $00, $07, $00, $07, $00, $00, $00, $00, $00 ' , byte $00, $00, $00, $00, $00, $02, $00, $06, $00, $0E, $00, $1C, $00, $38, $00, $70, $00, $E0, $01, $C0, $03, $80, $07, $00, $0E, $00, $1C, $00, $00, $00, $00, $00 ' / byte $00, $00, $00, $00, $0F, $F0, $1C, $38, $1C, $78, $1C, $F8, $1C, $F8, $1D, $B8, $1D, $B8, $1F, $38, $1F, $38, $1E, $38, $1C, $38, $0F, $F0, $00, $00, $00, $00 ' 0 byte $00, $00, $00, $00, $01, $80, $01, $80, $03, $80, $1F, $80, $1F, $80, $03, $80, $03, $80, $03, $80, $03, $80, $03, $80, $03, $80, $1F, $F0, $00, $00, $00, $00 ' 1 byte $00, $00, $00, $00, $0F, $E0, $1C, $70, $1C, $38, $00, $38, $00, $70, $00, $E0, $01, $C0, $03, $80, $07, $00, $0E, $38, $1C, $38, $1F, $F8, $00, $00, $00, $00 ' 2 byte $00, $00, $00, $00, $0F, $E0, $1C, $70, $1C, $38, $00, $38, $00, $70, $03, $C0, $03, $C0, $00, $70, $00, $38, $1C, $38, $1C, $70, $0F, $E0, $00, $00, $00, $00 ' 3 byte $00, $00, $00, $00, $00, $E0, $01, $E0, $03, $E0, $06, $E0, $0C, $E0, $18, $E0, $1F, $F8, $1F, $F8, $00, $E0, $00, $E0, $00, $E0, $03, $F8, $00, $00, $00, $00 ' 4 byte $00, $00, $00, $00, $1F, $F8, $1C, $00, $1C, $00, $1C, $00, $1C, $00, $1F, $E0, $1F, $F0, $00, $78, $00, $38, $1C, $38, $1C, $70, $0F, $E0, $00, $00, $00, $00 ' 5 byte $00, $00, $00, $00, $03, $E0, $07, $00, $0E, $00, $1C, $00, $1C, $00, $1F, $F0, $1F, $F8, $1C, $38, $1C, $38, $1C, $38, $1C, $38, $0F, $F0, $00, $00, $00, $00 ' 6 byte $00, $00, $00, $00, $1F, $FC, $1C, $1C, $1C, $1C, $1C, $1C, $00, $1C, $00, $38, $00, $70, $00, $E0, $01, $C0, $03, $80, $03, $80, $03, $80, $00, $00, $00, $00 ' 7 byte $00, $00, $00, $00, $0F, $F0, $1C, $38, $1C, $38, $1C, $38, $1F, $38, $07, $E0, $07, $E0, $1C, $F8, $1C, $38, $1C, $38, $1C, $38, $0F, $F0, $00, $00, $00, $00 ' 8 byte $00, $00, $00, $00, $0F, $F0, $1C, $38, $1C, $38, $1C, $38, $1C, $38, $1F, $F8, $0F, $F8, $00, $38, $00, $38, $00, $70, $00, $E0, $07, $C0, $00, $00, $00, $00 ' 9 byte $00, $00, $00, $00, $00, $00, $00, $00, $03, $80, $03, $80, $03, $80, $00, $00, $00, $00, $03, $80, $03, $80, $03, $80, $00, $00, $00, $00, $00, $00, $00, $00 ' : byte $00, $00, $00, $00, $00, $00, $00, $00, $03, $80, $03, $80, $03, $80, $00, $00, $00, $00, $03, $80, $03, $80, $03, $80, $07, $00, $00, $00, $00, $00, $00, $00 ' ; byte $00, $00, $00, $70, $00, $E0, $01, $C0, $03, $80, $07, $00, $0E, $00, $1C, $00, $1C, $00, $0E, $00, $07, $00, $03, $80, $01, $C0, $00, $E0, $00, $70, $00, $00 ' < byte $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $3F, $FC, $3F, $FC, $00, $00, $00, $00, $3F, $FC, $3F, $FC, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00 ' = byte $00, $00, $1C, $00, $0E, $00, $07, $00, $03, $80, $01, $C0, $00, $E0, $00, $70, $00, $70, $00, $E0, $01, $C0, $03, $80, $07, $00, $0E, $00, $1C, $00, $00, $00 ' > byte $00, $00, $03, $C0, $0F, $F0, $1E, $78, $18, $38, $00, $38, $00, $70, $00, $E0, $01, $C0, $01, $C0, $00, $00, $00, $00, $01, $C0, $01, $C0, $01, $C0, $00, $00 ' ? byte $00, $00, $0F, $F8, $1C, $1C, $1C, $1C, $1C, $1C, $1C, $1C, $1C, $FC, $1C, $FC, $1C, $FC, $1C, $FC, $1C, $00, $1C, $00, $1C, $00, $1F, $F0, $07, $F8, $00, $00 ' @ byte $00, $00, $00, $00, $03, $C0, $07, $E0, $0E, $70, $1C, $38, $1C, $38, $1C, $38, $1C, $38, $1F, $F8, $1C, $38, $1C, $38, $1C, $38, $1C, $38, $00, $00, $00, $00 ' A byte $00, $00, $00, $00, $1F, $F0, $0E, $38, $0E, $38, $0E, $38, $0E, $38, $0F, $F0, $0F, $F0, $0E, $38, $0E, $38, $0E, $38, $0E, $38, $1F, $F0, $00, $00, $00, $00 ' B byte $00, $00, $00, $00, $07, $F0, $0E, $38, $1C, $38, $1C, $00, $1C, $00, $1C, $00, $1C, $00, $1C, $00, $1C, $00, $1C, $38, $0E, $38, $07, $F0, $00, $00, $00, $00 ' C byte $00, $00, $00, $00, $1F, $E0, $0E, $70, $0E, $38, $0E, $38, $0E, $38, $0E, $38, $0E, $38, $0E, $38, $0E, $38, $0E, $38, $0E, $70, $1F, $E0, $00, $00, $00, $00 ' D byte $00, $00, $00, $00, $1F, $F8, $0E, $18, $0E, $08, $0E, $00, $0E, $30, $0F, $F0, $0F, $F0, $0E, $30, $0E, $00, $0E, $08, $0E, $18, $1F, $F8, $00, $00, $00, $00 ' E byte $00, $00, $00, $00, $1F, $F8, $0E, $18, $0E, $08, $0E, $00, $0E, $30, $0F, $F0, $0F, $F0, $0E, $30, $0E, $00, $0E, $00, $0E, $00, $1F, $00, $00, $00, $00, $00 ' F byte $00, $00, $00, $00, $07, $F0, $0E, $38, $1C, $38, $1C, $38, $1C, $00, $1C, $00, $1C, $00, $1C, $F8, $1C, $38, $1C, $38, $0E, $38, $07, $F8, $00, $00, $00, $00 ' G byte $00, $00, $00, $00, $1C, $70, $1C, $70, $1C, $70, $1C, $70, $1C, $70, $1F, $F0, $1F, $F0, $1C, $70, $1C, $70, $1C, $70, $1C, $70, $1C, $70, $00, $00, $00, $00 ' H byte $00, $00, $00, $00, $0F, $E0, $03, $80, $03, $80, $03, $80, $03, $80, $03, $80, $03, $80, $03, $80, $03, $80, $03, $80, $03, $80, $0F, $E0, $00, $00, $00, $00 ' I byte $00, $00, $00, $00, $01, $FC, $00, $70, $00, $70, $00, $70, $00, $70, $00, $70, $00, $70, $38, $70, $38, $70, $38, $70, $38, $70, $0F, $E0, $00, $00, $00, $00 ' J byte $00, $00, $00, $00, $1E, $38, $0E, $38, $0E, $70, $0E, $E0, $0F, $C0, $0F, $80, $0F, $80, $0F, $C0, $0E, $E0, $0E, $70, $0E, $38, $1E, $38, $00, $00, $00, $00 ' K byte $00, $00, $00, $00, $1F, $00, $0E, $00, $0E, $00, $0E, $00, $0E, $00, $0E, $00, $0E, $00, $0E, $00, $0E, $08, $0E, $18, $0E, $38, $1F, $F8, $00, $00, $00, $00 ' L byte $00, $00, $00, $00, $1C, $1C, $1E, $3C, $1F, $7C, $1F, $FC, $1F, $FC, $1D, $DC, $1C, $9C, $1C, $1C, $1C, $1C, $1C, $1C, $1C, $1C, $1C, $1C, $00, $00, $00, $00 ' M byte $00, $00, $00, $00, $1C, $1C, $1C, $1C, $1E, $1C, $1F, $1C, $1F, $9C, $1D, $DC, $1C, $FC, $1C, $7C, $1C, $3C, $1C, $1C, $1C, $1C, $1C, $1C, $00, $00, $00, $00 ' N byte $00, $00, $00, $00, $03, $E0, $07, $F0, $0E, $38, $1C, $1C, $1C, $1C, $1C, $1C, $1C, $1C, $1C, $1C, $1C, $1C, $0E, $38, $07, $F0, $03, $E0, $00, $00, $00, $00 ' O byte $00, $00, $00, $00, $1F, $F0, $0E, $38, $0E, $38, $0E, $38, $0E, $38, $0F, $F0, $0F, $F0, $0E, $00, $0E, $00, $0E, $00, $0E, $00, $1F, $00, $00, $00, $00, $00 ' P byte $00, $00, $00, $00, $03, $E0, $0F, $78, $0E, $38, $1C, $1C, $1C, $1C, $1C, $1C, $1C, $1C, $1C, $7C, $1C, $FC, $0F, $F8, $0F, $F8, $00, $38, $00, $FC, $00, $00 ' Q byte $00, $00, $00, $00, $1F, $F0, $0E, $38, $0E, $38, $0E, $38, $0E, $38, $0F, $F0, $0F, $F0, $0E, $70, $0E, $38, $0E, $38, $0E, $38, $1E, $38, $00, $00, $00, $00 ' R byte $00, $00, $00, $00, $0F, $F0, $1C, $38, $1C, $38, $1C, $38, $1C, $00, $0F, $E0, $07, $F0, $00, $38, $1C, $38, $1C, $38, $1C, $38, $0F, $F0, $00, $00, $00, $00 ' S byte $00, $00, $00, $00, $1F, $FC, $19, $CC, $11, $C4, $01, $C0, $01, $C0, $01, $C0, $01, $C0, $01, $C0, $01, $C0, $01, $C0, $01, $C0, $07, $F0, $00, $00, $00, $00 ' T byte $00, $00, $00, $00, $1C, $70, $1C, $70, $1C, $70, $1C, $70, $1C, $70, $1C, $70, $1C, $70, $1C, $70, $1C, $70, $1C, $70, $1C, $70, $0F, $E0, $00, $00, $00, $00 ' U byte $00, $00, $00, $00, $1C, $70, $1C, $70, $1C, $70, $1C, $70, $1C, $70, $1C, $70, $1C, $70, $1C, $70, $1C, $70, $0E, $E0, $07, $C0, $03, $80, $00, $00, $00, $00 ' V byte $00, $00, $00, $00, $1C, $1C, $1C, $1C, $1C, $1C, $1C, $1C, $1C, $1C, $1C, $9C, $1C, $9C, $1C, $9C, $0F, $F8, $0F, $F8, $07, $70, $07, $70, $00, $00, $00, $00 ' W byte $00, $00, $00, $00, $1C, $70, $1C, $70, $1C, $70, $0E, $E0, $07, $C0, $03, $80, $03, $80, $07, $C0, $0E, $E0, $1C, $70, $1C, $70, $1C, $70, $00, $00, $00, $00 ' X byte $00, $00, $00, $00, $1C, $70, $1C, $70, $1C, $70, $1C, $70, $1C, $70, $0E, $E0, $07, $C0, $03, $80, $03, $80, $03, $80, $03, $80, $0F, $E0, $00, $00, $00, $00 ' Y byte $00, $00, $00, $00, $1F, $F8, $1C, $38, $18, $38, $10, $70, $00, $E0, $01, $C0, $03, $80, $07, $00, $0E, $08, $1C, $18, $1C, $38, $1F, $F8, $00, $00, $00, $00 ' Z byte $00, $00, $00, $00, $07, $F0, $07, $00, $07, $00, $07, $00, $07, $00, $07, $00, $07, $00, $07, $00, $07, $00, $07, $00, $07, $00, $07, $F0, $00, $00, $00, $00 ' [ byte $00, $00, $00, $00, $10, $00, $18, $00, $1C, $00, $0E, $00, $07, $00, $03, $80, $01, $C0, $00, $E0, $00, $70, $00, $38, $00, $1C, $00, $07, $00, $00, $00, $00 ' <Backslash> byte $00, $00, $00, $00, $07, $F0, $00, $70, $00, $70, $00, $70, $00, $70, $00, $70, $00, $70, $00, $70, $00, $70, $00, $70, $00, $70, $07, $F0, $00, $00, $00, $00 ' ] byte $00, $00, $01, $80, $03, $C0, $07, $E0, $0E, $70, $1C, $38, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00 ' ^ byte $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $7F, $FF, $7F, $FF ' _ byte $00, $00, $00, $00, $1C, $00, $1C, $00, $07, $00, $07, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00 ' ' byte $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $0F, $E0, $00, $70, $00, $70, $0F, $F0, $1C, $70, $1C, $70, $1C, $70, $0F, $D8, $00, $00, $00, $00 ' a byte $00, $00, $00, $00, $1E, $00, $0E, $00, $0E, $00, $0E, $00, $0F, $F0, $0E, $38, $0E, $38, $0E, $38, $0E, $38, $0E, $38, $0E, $38, $1B, $F0, $00, $00, $00, $00 ' b byte $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $0F, $E0, $1C, $70, $1C, $70, $1C, $00, $1C, $00, $1C, $70, $1C, $70, $0F, $E0, $00, $00, $00, $00 ' c byte $00, $00, $00, $00, $00, $F8, $00, $70, $00, $70, $00, $70, $0F, $F0, $1C, $70, $1C, $70, $1C, $70, $1C, $70, $1C, $70, $1C, $70, $0F, $D8, $00, $00, $00, $00 ' d byte $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $0F, $E0, $1C, $70, $1C, $70, $1F, $F0, $1C, $00, $1C, $70, $1C, $70, $0F, $E0, $00, $00, $00, $00 ' e byte $00, $00, $00, $00, $03, $E0, $07, $70, $07, $70, $07, $00, $07, $00, $1F, $E0, $1F, $E0, $07, $00, $07, $00, $07, $00, $07, $00, $1F, $C0, $00, $00, $00, $00 ' f byte $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $0F, $D8, $1C, $70, $1C, $70, $1C, $70, $1C, $70, $0F, $F0, $07, $F0, $00, $70, $1C, $70, $0F, $E0 ' g byte $00, $00, $00, $00, $1E, $00, $0E, $00, $0E, $00, $0E, $00, $0E, $F0, $0F, $38, $0F, $38, $0E, $38, $0E, $38, $0E, $38, $0E, $38, $1E, $38, $00, $00, $00, $00 ' h byte $00, $00, $00, $00, $01, $C0, $01, $C0, $01, $C0, $00, $00, $0F, $C0, $01, $C0, $01, $C0, $01, $C0, $01, $C0, $01, $C0, $01, $C0, $0F, $F8, $00, $00, $00, $00 ' i byte $00, $00, $00, $00, $00, $70, $00, $70, $00, $70, $00, $00, $03, $F0, $00, $70, $00, $70, $00, $70, $00, $70, $00, $70, $00, $70, $1C, $70, $0C, $F0, $07, $E0 ' j byte $00, $00, $00, $00, $1E, $00, $0E, $00, $0E, $00, $0E, $00, $0E, $38, $0E, $70, $0E, $E0, $0F, $C0, $0E, $E0, $0E, $70, $0E, $38, $1E, $38, $00, $00, $00, $00 ' k byte $00, $00, $00, $00, $0F, $C0, $01, $C0, $01, $C0, $01, $C0, $01, $C0, $01, $C0, $01, $C0, $01, $C0, $01, $C0, $01, $C0, $01, $C0, $0F, $F8, $00, $00, $00, $00 ' l byte $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $1F, $F8, $1C, $9C, $1C, $9C, $1C, $9C, $1C, $9C, $1C, $9C, $1C, $9C, $1C, $9C, $00, $00, $00, $00 ' m byte $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $1F, $E0, $1C, $70, $1C, $70, $1C, $70, $1C, $70, $1C, $70, $1C, $70, $1C, $70, $00, $00, $00, $00 ' n byte $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $0F, $E0, $1C, $70, $1C, $70, $1C, $70, $1C, $70, $1C, $70, $1C, $70, $0F, $E0, $00, $00, $00, $00 ' o byte $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $1B, $F0, $0E, $38, $0E, $38, $0E, $38, $0E, $38, $0E, $38, $0F, $F0, $0E, $00, $0E, $00, $1F, $00 ' p byte $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $1F, $B0, $38, $E0, $38, $E0, $38, $E0, $38, $E0, $38, $E0, $1F, $E0, $00, $E0, $00, $E0, $01, $F0 ' q byte $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $1E, $F0, $0F, $F8, $0F, $38, $0E, $00, $0E, $00, $0E, $00, $0E, $00, $1F, $00, $00, $00, $00, $00 ' r byte $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $0F, $E0, $1C, $30, $1C, $30, $0F, $80, $03, $E0, $18, $70, $18, $70, $0F, $E0, $00, $00, $00, $00 ' s byte $00, $00, $00, $00, $00, $00, $01, $00, $03, $00, $07, $00, $1F, $F0, $07, $00, $07, $00, $07, $00, $07, $00, $07, $70, $07, $70, $03, $E0, $00, $00, $00, $00 ' t byte $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $1C, $70, $1C, $70, $1C, $70, $1C, $70, $1C, $70, $1C, $70, $1C, $70, $0F, $D8, $00, $00, $00, $00 ' u byte $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $1C, $70, $1C, $70, $1C, $70, $1C, $70, $1C, $70, $0E, $E0, $07, $C0, $03, $80, $00, $00, $00, $00 ' v byte $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $1C, $1C, $1C, $1C, $1C, $1C, $1C, $9C, $1C, $9C, $0F, $F8, $07, $70, $07, $70, $00, $00, $00, $00 ' w byte $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $1C, $E0, $1C, $E0, $0F, $C0, $07, $80, $07, $80, $0F, $C0, $1C, $E0, $1C, $E0, $00, $00, $00, $00 ' x byte $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $0E, $38, $0E, $38, $0E, $38, $0E, $38, $0E, $38, $07, $F0, $03, $E0, $00, $E0, $01, $C0, $1F, $80 ' y byte $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $1F, $E0, $18, $E0, $11, $C0, $03, $80, $07, $00, $0E, $20, $1C, $60, $1F, $E0, $00, $00, $00, $00 ' z byte $00, $00, $00, $00, $01, $F8, $03, $80, $03, $80, $03, $80, $07, $00, $1C, $00, $1C, $00, $07, $00, $03, $80, $03, $80, $03, $80, $01, $F8, $00, $00, $00, $00 ' { byte $00, $00, $01, $C0, $01, $C0, $01, $C0, $01, $C0, $01, $C0, $01, $C0, $01, $C0, $01, $C0, $01, $C0, $01, $C0, $01, $C0, $01, $C0, $01, $C0, $01, $C0, $00, $00 ' | byte $00, $00, $00, $00, $1F, $80, $01, $C0, $01, $C0, $01, $C0, $00, $E0, $00, $38, $00, $38, $00, $E0, $01, $C0, $01, $C0, $01, $C0, $1F, $80, $00, $00, $00, $00 ' } byte $00, $00, $00, $00, $1F, $1C, $3B, $9C, $39, $DC, $38, $F8, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00 ' ~ SevenSegNumFont byte $20, $32, $30, $0A byte $00, $00, $00, $00, $00, $00, $00, $00, $00, $FF, $FE, $00, $01, $FF, $FF, $00, $03, $FF, $FF, $80, $01, $FF, $FF, $60, $0C, $FF, $FE, $F0, $1E, $00, $01, $F8, $3F byte $00, $01, $F8, $3F, $00, $01, $F8, $3F, $00, $01, $F8, $3F, $00, $01, $F8, $3F, $00, $01, $F8, $3F, $00, $01, $F8, $3F, $00, $01, $F8, $3F, $00, $01, $F8, $3F, $00 byte $01, $F8, $3F, $00, $01, $F8, $3F, $00, $01, $F8, $3F, $00, $01, $F8, $3F, $00, $01, $F8, $3E, $00, $00, $78, $38, $00, $00, $18, $20, $00, $00, $08, $00, $00, $00 byte $00, $20, $00, $00, $00, $38, $00, $00, $18, $3E, $00, $00, $78, $3F, $00, $01, $F8, $3F, $00, $01, $F8, $3F, $00, $01, $F8, $3F, $00, $01, $F8, $3F, $00, $01, $F8 byte $3F, $00, $01, $F8, $3F, $00, $01, $F8, $3F, $00, $01, $F8, $3F, $00, $01, $F8, $3F, $00, $01, $F8, $3F, $00, $01, $F8, $3F, $00, $01, $F8, $3F, $00, $01, $F8, $3F byte $00, $01, $F8, $1E, $00, $00, $F0, $0C, $FF, $FE, $60, $01, $FF, $FF, $00, $03, $FF, $FF, $80, $01, $FF, $FF, $00, $00, $FF, $FE, $00, $00, $00, $00, $00, $00, $00, $00, $00 ' 0 byte $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $60, $00, $00, $00, $F0, $00, $00, $01, $F8, $00 byte $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00 byte $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $00, $78, $00, $00, $00, $18, $00, $00, $00, $08, $00, $00, $00 byte $00, $00, $00, $00, $00, $00, $00, $00, $18, $00, $00, $00, $78, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8 byte $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00 byte $00, $01, $F8, $00, $00, $00, $F0, $00, $00, $00, $60, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00 ' 1 byte $00, $00, $00, $00, $00, $00, $00, $00, $00, $FF, $FE, $00, $01, $FF, $FF, $00, $03, $FF, $FF, $80, $01, $FF, $FF, $60, $00, $FF, $FE, $F0, $00, $00, $01, $F8, $00 byte $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00 byte $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $00, $78, $01, $FF, $FE, $18, $03, $FF, $FF, $88, $0F, $FF, $FF byte $E0, $27, $FF, $FF, $C0, $39, $FF, $FF, $00, $3E, $00, $00, $00, $3F, $00, $00, $00, $3F, $00, $00, $00, $3F, $00, $00, $00, $3F, $00, $00, $00, $3F, $00, $00, $00 byte $3F, $00, $00, $00, $3F, $00, $00, $00, $3F, $00, $00, $00, $3F, $00, $00, $00, $3F, $00, $00, $00, $3F, $00, $00, $00, $3F, $00, $00, $00, $3F, $00, $00, $00, $3F byte $00, $00, $00, $1E, $00, $00, $00, $0C, $FF, $FE, $00, $01, $FF, $FF, $00, $03, $FF, $FF, $80, $01, $FF, $FF, $00, $00, $FF, $FE, $00, $00, $00, $00, $00, $00, $00, $00, $00 ' 2 byte $00, $00, $00, $00, $00, $00, $00, $00, $00, $FF, $FE, $00, $01, $FF, $FF, $00, $03, $FF, $FF, $80, $01, $FF, $FF, $60, $00, $FF, $FE, $F0, $00, $00, $01, $F8, $00 byte $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00 byte $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $00, $78, $01, $FF, $FE, $18, $03, $FF, $FF, $88, $0F, $FF, $FF byte $E0, $07, $FF, $FF, $C0, $01, $FF, $FF, $18, $00, $00, $00, $78, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8 byte $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00 byte $00, $01, $F8, $00, $00, $00, $F0, $00, $FF, $FE, $60, $01, $FF, $FF, $00, $03, $FF, $FF, $80, $01, $FF, $FF, $00, $00, $FF, $FE, $00, $00, $00, $00, $00, $00, $00, $00, $00 ' 3 byte $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $60, $0C, $00, $00, $F0, $1E, $00, $01, $F8, $3F byte $00, $01, $F8, $3F, $00, $01, $F8, $3F, $00, $01, $F8, $3F, $00, $01, $F8, $3F, $00, $01, $F8, $3F, $00, $01, $F8, $3F, $00, $01, $F8, $3F, $00, $01, $F8, $3F, $00 byte $01, $F8, $3F, $00, $01, $F8, $3F, $00, $01, $F8, $3F, $00, $01, $F8, $3F, $00, $01, $F8, $3E, $00, $00, $78, $39, $FF, $FE, $18, $23, $FF, $FF, $88, $0F, $FF, $FF byte $E0, $07, $FF, $FF, $C0, $01, $FF, $FF, $18, $00, $00, $00, $78, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8 byte $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00 byte $00, $01, $F8, $00, $00, $00, $F0, $00, $00, $00, $60, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00 ' 4 byte $00, $00, $00, $00, $00, $00, $00, $00, $00, $FF, $FE, $00, $01, $FF, $FF, $00, $03, $FF, $FF, $80, $01, $FF, $FF, $00, $0C, $FF, $FE, $00, $1E, $00, $00, $00, $3F byte $00, $00, $00, $3F, $00, $00, $00, $3F, $00, $00, $00, $3F, $00, $00, $00, $3F, $00, $00, $00, $3F, $00, $00, $00, $3F, $00, $00, $00, $3F, $00, $00, $00, $3F, $00 byte $00, $00, $3F, $00, $00, $00, $3F, $00, $00, $00, $3F, $00, $00, $00, $3F, $00, $00, $00, $3E, $00, $00, $00, $39, $FF, $FE, $00, $23, $FF, $FF, $80, $0F, $FF, $FF byte $E0, $07, $FF, $FF, $C0, $01, $FF, $FF, $18, $00, $00, $00, $78, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8 byte $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00 byte $00, $01, $F8, $00, $00, $00, $F0, $00, $FF, $FE, $60, $01, $FF, $FF, $00, $03, $FF, $FF, $80, $01, $FF, $FF, $00, $00, $FF, $FE, $00, $00, $00, $00, $00, $00, $00, $00, $00 ' 5 byte $00, $00, $00, $00, $00, $00, $00, $00, $00, $FF, $FE, $00, $01, $FF, $FF, $00, $03, $FF, $FF, $80, $01, $FF, $FF, $00, $0C, $FF, $FE, $00, $1E, $00, $00, $00, $3F byte $00, $00, $00, $3F, $00, $00, $00, $3F, $00, $00, $00, $3F, $00, $00, $00, $3F, $00, $00, $00, $3F, $00, $00, $00, $3F, $00, $00, $00, $3F, $00, $00, $00, $3F, $00 byte $00, $00, $3F, $00, $00, $00, $3F, $00, $00, $00, $3F, $00, $00, $00, $3F, $00, $00, $00, $3E, $00, $00, $00, $39, $FF, $FE, $00, $23, $FF, $FF, $80, $0F, $FF, $FF byte $E0, $27, $FF, $FF, $C0, $39, $FF, $FF, $18, $3E, $00, $00, $78, $3F, $00, $01, $F8, $3F, $00, $01, $F8, $3F, $00, $01, $F8, $3F, $00, $01, $F8, $3F, $00, $01, $F8 byte $3F, $00, $01, $F8, $3F, $00, $01, $F8, $3F, $00, $01, $F8, $3F, $00, $01, $F8, $3F, $00, $01, $F8, $3F, $00, $01, $F8, $3F, $00, $01, $F8, $3F, $00, $01, $F8, $3F byte $00, $01, $F8, $1E, $00, $00, $F0, $0C, $FF, $FE, $60, $01, $FF, $FF, $00, $03, $FF, $FF, $80, $01, $FF, $FF, $00, $00, $FF, $FE, $00, $00, $00, $00, $00, $00, $00, $00, $00 ' 6 byte $00, $00, $00, $00, $00, $00, $00, $00, $00, $FF, $FE, $00, $01, $FF, $FF, $00, $03, $FF, $FF, $80, $01, $FF, $FF, $60, $00, $FF, $FE, $F0, $00, $00, $01, $F8, $00 byte $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00 byte $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $00, $78, $00, $00, $00, $18, $00, $00, $00, $08, $00, $00, $00 byte $00, $00, $00, $00, $00, $00, $00, $00, $18, $00, $00, $00, $78, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8 byte $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00 byte $00, $01, $F8, $00, $00, $00, $F0, $00, $00, $00, $60, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00 ' 7 byte $00, $00, $00, $00, $00, $00, $00, $00, $00, $FF, $FE, $00, $01, $FF, $FF, $00, $03, $FF, $FF, $80, $01, $FF, $FF, $60, $0C, $FF, $FE, $F0, $1E, $00, $01, $F8, $3F byte $00, $01, $F8, $3F, $00, $01, $F8, $3F, $00, $01, $F8, $3F, $00, $01, $F8, $3F, $00, $01, $F8, $3F, $00, $01, $F8, $3F, $00, $01, $F8, $3F, $00, $01, $F8, $3F, $00 byte $01, $F8, $3F, $00, $01, $F8, $3F, $00, $01, $F8, $3F, $00, $01, $F8, $3F, $00, $01, $F8, $3E, $00, $00, $78, $39, $FF, $FE, $18, $23, $FF, $FF, $88, $0F, $FF, $FF byte $E0, $27, $FF, $FF, $C0, $39, $FF, $FF, $18, $3E, $00, $00, $78, $3F, $00, $01, $F8, $3F, $00, $01, $F8, $3F, $00, $01, $F8, $3F, $00, $01, $F8, $3F, $00, $01, $F8 byte $3F, $00, $01, $F8, $3F, $00, $01, $F8, $3F, $00, $01, $F8, $3F, $00, $01, $F8, $3F, $00, $01, $F8, $3F, $00, $01, $F8, $3F, $00, $01, $F8, $3F, $00, $01, $F8, $3F byte $00, $01, $F8, $1E, $00, $00, $F0, $0C, $FF, $FE, $60, $01, $FF, $FF, $00, $03, $FF, $FF, $80, $01, $FF, $FF, $00, $00, $FF, $FE, $00, $00, $00, $00, $00, $00, $00, $00, $00 ' 8 byte $00, $00, $00, $00, $00, $00, $00, $00, $00, $FF, $FE, $00, $01, $FF, $FF, $00, $03, $FF, $FF, $80, $01, $FF, $FF, $60, $0C, $FF, $FE, $F0, $1E, $00, $01, $F8, $3F byte $00, $01, $F8, $3F, $00, $01, $F8, $3F, $00, $01, $F8, $3F, $00, $01, $F8, $3F, $00, $01, $F8, $3F, $00, $01, $F8, $3F, $00, $01, $F8, $3F, $00, $01, $F8, $3F, $00 byte $01, $F8, $3F, $00, $01, $F8, $3F, $00, $01, $F8, $3F, $00, $01, $F8, $3F, $00, $01, $F8, $3E, $00, $00, $78, $39, $FF, $FE, $18, $23, $FF, $FF, $88, $0F, $FF, $FF byte $E0, $07, $FF, $FF, $C0, $01, $FF, $FF, $18, $00, $00, $00, $78, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8 byte $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00, $00, $01, $F8, $00 byte $00, $01, $F8, $00, $00, $00, $F0, $00, $FF, $FE, $60, $01, $FF, $FF, $00, $03, $FF, $FF, $80, $01, $FF, $FF, $00, $00, $FF, $FE, $00, $00, $00, $00, $00, $00, $00, $00, $00 ' 9
Utilities:
{{ Name: Trevor Handermann Abstract: Utilities }} CON FRQSAMPLES = 64 'Samples in periods for freqin MINFREQ = 250 'Minimum frequency before considering frequency 0(must be greater than 1), 'the larger it is the longer the wait time if the frequency is lower than MINFREQ 'MINFREQ must be larger than FRQSAMPLES!! VAR long clkspus 'Frequency Variables long tstflag long frqpin long bf[2] byte cog byte cogon OBJ PUB DelayS(intSeconds) waitcnt(cnt + (clkfreq*intSeconds)) PUB DelayMS( time ) waitcnt (cnt + (time*(clkfreq/1000))) PUB DelayUS( time ) 'Assumes 80MHz for accuracy's sake(5 is the minimum!!!) if time < 5 return waitcnt (time * 80 + cnt) PUB IndexOf(begin,chrChar, pstrString) : intLocation | intIndex { Purpose: Returns the first index of chrChar in the string pstrString, returns -1 if it does not exist } intLocation := -1 repeat intIndex from begin to strsize(pstrString) if byte[pstrString][intIndex] == chrChar intLocation := intIndex quit PUB GetSubWordIndex(pstrString, pstrSubString,chrDelimiter) : del | index,subind, intlength, intsublength, sub1, sub2, match { Purpose: F } intsublength := strsize(pstrSubString) intlength := strsize(pstrString) sub1 := 0 match := false del := 0 repeat index from 0 to intlength - 1 if byte[pstrString][index] == chrDelimiter sub2 := index if (sub2 - sub1) == intsublength 'If length is correct match := true 'Compare String repeat subind from sub1 to sub2 - 1 if byte[pstrString][subind] <> byte[pstrSubString][subind - sub1] match := false quit ifnot match sub1 := sub2 + 1 del++ else quit ifnot match del := -1 PUB GetSubWord(intIndex ,pstrSubString, pstrString, delimiter) | intSpaceIndex, intLoopIndex, intSubIndex, intLength { Purpose: Get Word seperated by delimiter at index intIndex } 'Note: Assumes single space between words. intSpaceIndex := 1 intSubIndex := 0 intLength := strsize(pstrString) repeat intLoopIndex from 0 to intLength 'Space? if byte[pstrString + intLoopIndex] <> delimiter ''No if intSpaceIndex == intIndex byte[pstrSubString + intSubIndex] := byte[pstrString + intLoopIndex] intSubIndex++ else 'Yes, is a space intSpaceIndex++ PUB ClearString(pstrString) | intLength, intLoopIndex intLength := strsize(pstrString) repeat intLoopIndex FROM 0 TO intLength byte[pstrString][intLoopIndex] := 0 PUB TotalTrimString(pstrString) | intLength, intLoopIndex, intSubIndex, Flag 'Trim start and end and make all spaces one space if multiple spaces intLength := strsize(pstrString) Flag := 0 'Trim start repeat intLoopIndex from 0 to intLength 'if not a space if byte[pstrString + intLoopIndex] <> 32 'if not the first charachter if intLoopIndex > 0 'Trim Spaces StringRemove(pstrString,0,intLoopIndex) 'Renew length intLength := strsize(pstrString) quit 'Trim end repeat intLoopIndex from intLength - 1 to 0 'If not a space if byte[pstrString + intLoopIndex] <> 32 'if not the last charachter. if intLoopIndex < (intLength - 1) 'Trim Spaces StringRemove(pstrString, intLoopIndex + 1,intLength - intLoopIndex - 1) 'renew length intLength := strsize(pstrString) quit intLoopIndex := 0 if intLength <> 0 'Trim Duplicate Spaces repeat if byte[pstrString + intLoopIndex] == 32 if Flag == 1 'Duplicate space, set flag intSubIndex := intLoopIndex Flag := 2 elseif Flag <> 2 Flag := 1 elseif Flag == 2 StringRemove(pstrString,intSubIndex,intLoopIndex-intSubIndex) intLoopIndex := intSubIndex intLength := strsize(pstrString) Flag := 0 else Flag := 0 if intLoopIndex == (intLength - 1) quit intLoopIndex++ PUB CompareString(pstrone, pstrtwo,length) : eq | index eq := true repeat index from 0 to length - 1 if byte[pstrone][index] <> byte[pstrtwo][index] eq := false quit PUB StringRemove(pstrString, intBeginIndex, intRemoveLength) | intLength, intLoopIndex, intSubIndex intLength := strsize(pstrString) 'Removelength more than length? if ((intRemoveLength + intBeginIndex) =< intLength) 'No repeat intLoopIndex from 0 to intLength - intRemoveLength - 1 if intLoopIndex > intBeginIndex - 1 byte[pstrString + intLoopIndex] := byte[pstrString + intLoopIndex + intRemoveLength] else next 'Clear rest of string intSubIndex := intLoopIndex repeat intLoopIndex from intSubIndex to intLength byte[pstrString + intLoopIndex] := 0 elseif intRemoveLength > intBeginIndex ClearString(pstrString) PUB StringAppend(pstrString,pstrAppend) | intIndex, intLength, intALength intLength := strsize(pstrString) intALength := strsize(pstrAppend) intIndex := intLength repeat intALength byte [pstrString][intIndex++] := byte[pstrAppend][intIndex-intLength] PUB ClearBArray(bptr, count) | i repeat i from 0 to count - 1 byte[bptr][i] := 0 PUB ClearWArray(bptr, count) | i repeat i from 0 to count - 1 word[bptr][i] := 0 PUB ClearLArray(bptr, count) | i repeat i from 0 to count - 1 long[bptr][i] := 0 PUB toHex(value) | val if val < 256 val := value / 16 val <<= 4 val |= value // 16 return val else return 0 PUB toDec(value) | val, tmp 'Get first hex digit tmp := value val := tmp >> 4 'get second hex digit tmp -= val * 16 val *= 16 val += tmp return val PUB ValidAsciiInteger(intIn) : Valid Valid := false 'Valid ascii number? if intIn < 58 and intIn > 47 'Yes Valid := true PUB ValidAsciiPrint(In) : Valid Valid := false 'Valid ascii? if In => 32 and In =< 126 'Valid ascii printablevalue 'Yes Valid := true PUB GetPulse(state, pin) : time { returns pulse length in us } waitpeq(state << pin, |< pin, 0) time := cnt waitpne(state << pin, |< pin, 0) time := cnt - time time := time / (clkfreq/1_000_000) PUB RCTime(state, pin) : time { Returns time pin is in state in microseconds ;Returns 0 if pin is not in state } if INA[pin] == state time := cnt waitpne(state << pin, |< pin, 0) time := cnt - time 'Get count time := time / (clkfreq / 1_000_000) 'Get time in microseconds else time := 0 PUB FreqInStart { Start a cog for frequency in testing } tstflag := 0 'Start cog in waiting state cogon := (cog := cognew(@start, @tstflag)) > 0 PUB FreqIn(tstpin) | value, sum , counter, waittime { Get input frequency on pin } repeat if tstflag == 0 'Set pin to input DIRA[tstpin]~ counter := 0 waittime := 1000/(MINFREQ / FRQSAMPLES) 'Get Milliseconds to wait frqpin := |< tstpin 'Set pin mask for asm use tstflag := 1 'Tell cog to test repeat until tstflag == 0 or counter == waittime counter++ DelayMS(1) if counter == waittime 'If timed out, return 0 as frequency return 0 'Test if system clock was reset(would cause invalid frequency reading), and read again if so if bf[0] > bf[1] next sum := bf[1] - bf[0] 'Get clocks for all samples 'Get average value := sum / FRQSAMPLES 'Get freq from average clocks value := clkfreq / value quit else next return value PUB FreqInStop { Stop the frequency in cog } if cogon~ 'If cog is on, post clear cogon to zero cogstop(cog) 'Stop Cog PUB FreqOut(pin, freq, time) | count, t { Output freq out of pin for time(Sec), amount of time } 'Get clocks from freq t := clkfreq / freq 'Get count of times count := freq * time 'Set pin to output DIRA[pin]~~ repeat count !OUTA[pin] waitcnt(cnt + t) DAT org 0 start mov ptr, par 'Get Pointer mov r1, #0 wrlong r1, ptr 'Clear flag :waitloop rdlong r1, ptr 'Read flag, and test if still 0 tjz r1, #:waitloop mov bfr, ptr add bfr, #4 'Get pointer to pin rdlong frpin, bfr add bfr, #4 'Get buffer pointer mov ctr, #FRQSAMPLES mov r1, cnt wrlong r1, bfr :frqloop waitpne zero,frpin waitpeq zero, frpin 'Get counter 'Write counter to buffer 'Goto next location djnz ctr, #:frqloop add bfr, #4 mov r1, cnt wrlong r1, bfr jmp #start frpin LONG 0 zero LONG 0 r1 res 1 ctr res 1 bfr res 1 ptr res 1 fit 496
SPILCD:
[code]{{
SPI Management Functions
Abstract:
This class is built to be a universal SPI Driver with C3 Channel select capability.
}}
CON
'Clocking settings
_clkmode = xtal1 + pll16x
_xinfreq = 5_000_000
VAR
long data[8]
{
ASM DATA:
data[0] := Data pin
data[1] := Clock pin
data[2] := Data location/data
data[3] := data type to write (no command(idle)=0, char=1, 8bit=2, 16bitrewrite=3, SetFont = 4)
data[4] := color/writes to perform for 16 bit mode
data[5] := bcolor
data[6] := x
data[7] := y
}
byte cogon
byte cog
OBJ
Utilities : "Utilities"
PUB InitSPI(spidata, spiclock) : okay
'Set Asm data
data[0] := spidata 'Data pin
data[1] := spiclock'Clock pin
data[3] := 0 'Data not present
okay := cogon := (cog := cognew(@entry,@data)) > 0
PUB WriteSPISlow(strOutBuffer) | NumBytes
NumBytes := 8
' now read the bits out
repeat 8
' drop clock
OUTA[data[1]] := 0
' place next bit on OUT (shift to right starting at MSB - 1(to get the first(msb) bit then next, and so on) then bitwise AND with 01 to get only last bit)
OUTA[data[0]] := ((strOutBuffer >> (NumBytes-- - 1)) & $01)
' raise clock
OUTA[data[1]] := 1
PUB WriteSPICLR(writes, wrdOut)
{
Purpose: Write 16 bits to SPI, but repeat sending 16 bit data for writes times
}
repeat until data[3] == 0 'Wait until cog ready
data[2] := wrdOut 'Write word to write
data[4] := writes 'Write "writes" times
data[3] := 3 'Set data type to 16 bit
repeat until data[3] == 0
PUB WriteSPICHR(x,y,char,color,bcolor)
{
Purpose: Write charachter to screen
}
repeat until data[3] == 0 'Wait until cog ready
data[2] := char
data[4] := color
data[5] := bcolor
data[6] := x
data[7] := y
data[3] := 1 'Set function to char
repeat until data[3] == 0
PUB SetFont(fontloc)
{
Purpose: Set font for ASM char writing
}
repeat until data[3] == 0 'Wait until cog ready
data[2] := fontloc
data[3] := 4 'Set function to set font
repeat until data[3] == 0
PUB WriteSPI(bytOut)
{
Purpose: Write 8 bits to SPI
}
repeat until data[3] == 0 'Wait until cog ready
data[2] := bytOut
data[3] := 2 'Set datatype to 8 bit
repeat until data[3] == 0
PUB stop
if cogon~
cogstop(cog)
DAT
org 0
entry
mov dt, par 'Get data location
rdlong spid, dt 'Get SPI data pin
add dt, #4 'Jump to next long
rdlong spic, dt 'Get SPI clk pin
mov spidmask, #1 'Get Pin Masks
mov spicmask, #1
shl spidmask, spid
shl spicmask, spic
or dira, spidmask 'Set pins to output
or dira, spicmask
add dt, #4 'Goto Data location
mov dtyploc, dt 'Get Data type location
add dtyploc, #4
mov cloc, dtyploc
add cloc, #4
mov bcloc, cloc
add bcloc, #4
mov xloc, bcloc
add xloc, #4
mov yloc, xloc
add yloc, #4
'Set Counter registers
mov ctra, spid 'Set counter A data pin
mov ctrb, spic 'Set clock pin for ctr b
movi ctra,#%0_00100_000
movi ctrb,#%0_00100_000
'
:loop
rdlong r1, dtyploc 'Get datatype
tjz r1, #:loop
movi phsb,#%000000000 'Set phase reg b
rdlong wrdt, dt 'Get data from location
cmp r1, #1 wz 'Test if char
if_z jmp #:writechar
cmp r1, #2 wz 'Test if 8 bit command
if_z jmp #:writeeight
cmp r1, #3 wz 'Test if 16 bit command
if_z jmp #:writesixtn
jmp #:setfont 'Otherwise, set font command
:writeeight
shl wrdt, #24
mov phsa, wrdt 'Write data into register
movi frqb,#%010000000 'Start counting!
:wreghtloop
shl phsa, #1 'Get next bit
shl phsa, #1
shl phsa, #1
shl phsa, #1
shl phsa, #1
shl phsa, #1
shl phsa, #1
mov frqb, #0 'Stop counting
wrlong null, dtyploc 'Clear Datatype
jmp #:loop
:writesixtn
rdlong r2, cloc 'Get times to write data
shl wrdt, #16
:wrsxtnloop
mov phsa, wrdt
movi frqb,#%010000000 'Start counting!
shl phsa, #1
shl phsa, #1
shl phsa, #1
shl phsa, #1
shl phsa, #1
shl phsa, #1
shl phsa, #1
shl phsa, #1
shl phsa, #1
shl phsa, #1
shl phsa, #1
shl phsa, #1
shl phsa, #1
shl phsa, #1
shl phsa, #1
mov frqb, #0 'Stop counting
djnz r2,#:wrsxtnloop 'If more writes start writing again
wrlong null, dtyploc 'Clear Datatype
jmp #:loop
:writechar
rdlong wrdt,dt 'Get Char
rdlong cx, xloc 'Get x
rdlong cy, yloc 'Get y
'Calculate char address
mov r1, wrdt
sub r1, foffset
mov r2, fxsize
shr r2, #3 'Divide by 8
Comments
Do all LCD's use this form of mapping? How did you know this one did? Also, does that mean that anytime I set the xy coordinates that the x coordinates must be a factor of 4, or only with images? Does it do this with verticle as well?
I have no Idea how you knew that of the top of your head.........:thumb:
If it's not generated from code, perhaps it's some kind of "bleeding" of the pixels at the pixel boundary between different colors. Wonder if the black bar would happen at the bottom of the rectangle (based on the orientation in the photo) if you inverted the colors of the rectangle and background. Well, an inversion might not exhibit the line as the line might be from the specific order of the RGB sub-pixels. Looking closely, you can see how the red pixels are slightly shifted from the green. My apologies if this is caused by code (haven't looked at that). BTW, I guess that's a portrait style screen rather than a landscape one, even though the pic shows the screen in a horizontal (landscape) orientation.
You can easily display bmps that are not multiple of four, you just need extra code to handle that case. It hasn't nothing to do with the LCD.