sorry richard the result i am seeing does not support what your are saying and the results show on the GLCD and debug terminal show the seqaunce for @ db option and @ dw to be incorrect when using readcode i have at the moment , a it gets 1 byte at a time
remember the whole goel is to
a. not change the font original data sequence of values
b. store only the font data values , and not add any other values to flash to get the data back - unlike pokecode does
try it for your self
this is font chr "0" , where the font is 24 bits wide for (X) and 30 lines (Y)high
LG font values for Common_font routine then are
Y_scan = 29 ' 30 - Y scan lines - 1 - Cos "for " starts at 1
X_scan = 3 ' 3 - X scan x 8 bits ( 24 bits)
Font_lookup = 1 ' Use LG_Font_lookup
gosub Font_Common ' not using flash chip
with poke/peek it works ok with this code
terminal should show the same data format and exact seq as the pokecode data
code to place the code on glcd and terminal - terminal should show the address and data in the same sequance as the data input hereCode:' Code for "0" Asci 48 90 real values _ pokecode $00,$00,$00,$00,$FF,$00,$03,$FF,$C0,$0F,$FF,$F0,$1F,$FF,$F8,$1F,$FF,$F8,$3F,$C3,$FC,$3F,$81,$FC,$3F,_ $81,$FC,$7F,$00,$FE,$7F,$00,$FE,$7F,$00,$FE,$7F,$00,$FE,$7F,$00,$FE,$7F,$00,$FE,$7F,$00,$FE,$7F,$00,_ $FE,$7F,$00,$FE,$7F,$00,$FE,$7F,$00,$FE,$3F,$81,$FC,$3F,$81,$FC,$3F,$C3,$FC,$1F,$FF,$F8,$1F,$FF,$F8,_ $0F,$FF,$F0,$03,$FF,$C0,$00,$FF,$00,$00,$00,$00,$00,$00,$00
Code:'=================== FONT COMMON ROUTINE - pokecode use ========================== ' Assumes gl_x, gl_y,X_scan,Y_scan,Font_lookup ' ALL FONTS MUST BE gl_x = 8 , 16 , 24 etc ' Inv_font = 0 = normal 1= inverse Font_Common: x_save = gl_x ' save the gl_x start point value y_save = gl_y ' save the gl_y start point value gl_yb = y_save + Y_scan ' number of y scans for the char from y starting point(0) gl_xb = 0 Address = 0 if Font_lookup = 1 then @ GetAddress _LG_Font_Base, _Font_Base_Address ; gets base start address of LG_font into Font_Base_Address varable Font_Index = (LG_font - 45)* (90*2) ' remove the ascii chr value 45 offset 0 * font chr length x 2 cos of RETLW INSTRUCTION for each byte read in index HSEROUT [13,10,"lg Font_Base_Address = ",hex Font_Base_Address," font index = ",dec Font_Index, 13,10] 'debug endif if Font_lookup = 2 then ' remove the offset of the first symbol $2D / 45 so start at 0 @ GetAddress _Med_Font_Base, _Font_Base_Address Font_Index = (Med_font - 45)* (40*2) ' remove the ascii chr value 45 offset * font chr length in index endif Address = Font_Base_Address + Font_Index 'gets you to the start of the glyph for gl_y = y_save to gl_yb ' y scan lines, start to finish values gl_x = x_save ' clear x position to start point (keep it an 8bit multiple) gosub gl_gaddr ' Set address for gl_xb = 1 to X_scan ' gl_x byte x X scan bytes on each line peekcode Address,gl_byte ' read the indexed byte in HSEROUT [hex Address,"- ",hex gl_byte, ","] glcd_msb = gl_byte glcd_cmd = DATA_WR_INC ' write and increment gosub send_1 ' send to glcd Address = Address+2 ' inc address here +2 cos each byte includes intruction code , as data start at 0 next gl_xb ' next byte of font next gl_y ' next scan line of font gl_y = y_save ' Restore the Y location gl_x = x_save ' Restore the X location return
to use @ db data format the poke code data is changed to this format
routine to get this data out and into the corect sequance - BUT THIS DOES NOT WORK AS THE DATA IS OUT OF SEQUANCE cos of readcode of low high readingCode:' Code for "0" Asci 48 90 real values _ @ db 0x00,0x00,0x00,0x00,0xFF,0x00,0x03,0xFF,0xC0,0x0F,0xFF,0xF0,0x1F,0xFF,0xF8,0x1F,0xFF,0xF8,0x3F,0xC3,0xFC,0x3F,0x81,0xFC,0x3F @ db 0x81,0xFC,0x7F,0x00,0xFE,0x7F,0x00,0xFE,0x7F,0x00,0xFE,0x7F,0x00,0xFE,0x7F,0x00,0xFE,0x7F,0x00,0xFE,0x7F,0x00,0xFE,0x7F,0x00 @ db 0xFE,0x7F,0x00,0xFE,0x7F,0x00,0xFE,0x7F,0x00,0xFE,0x3F,0x81,0xFC,0x3F,0x81,0xFC,0x3F,0xC3,0xFC,0x1F,0xFF,0xF8,0x1F,0xFF,0xF8 @ db 0x0F,0xFF,0xF0,0x03,0xFF,0xC0,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00
same data joined to make word values ,Code:Font_Common: x_save = gl_x ' save the gl_x start point value y_save = gl_y ' save the gl_y start point value gl_yb = y_save + Y_scan ' number of y scans for the char from y starting point(0) gl_xb = 0 Address = 0 if Font_lookup = 1 then @ GetAddress _LG_Font_Base, _Font_Base_Address ; gets base start address of LG_font into Font_Base_Address varable Font_Index = (LG_font - 45)* 90 ' remove the ascii chr value 45 offset 0 * font chr length HSEROUT [13,10,"lg Font_Base_Address = ",hex Font_Base_Address," font index = ",dec Font_Index, 13,10] 'debug endif if Font_lookup = 2 then ' remove the offset of the first symbol $2D / 45 so start at 0 @ GetAddress _Med_Font_Base, _Font_Base_Address Font_Index = (Med_font - 45)*40 ' remove the ascii chr value 45 offset * font chr length in index endif Address = Font_Base_Address + Font_Index 'gets you to the start of the glyph for gl_y = y_save to gl_yb ' y scan lines, start to finish values gl_x = x_save ' clear x position to start point (keep it an 8bit multiple) gosub gl_gaddr ' Set address for gl_xb = 1 to X_scan ' gl_xb byte x X scan bytes can be 2 or 3 on each line readcode Address,gl_byte HSEROUT [hex Address,"- ",hex gl_byte, ","] glcd_msb = gl_byte ' put in 1st byte - stored as glcd_cmd = DATA_WR_INC ' write and increment gosub send_1 ' send to glcd Address = Address + 1 ' inc address + 1 next gl_xb ' next byte of font next gl_y ' next scan line of font gl_y = y_save ' Restore the Y location gl_x = x_save ' Restore the X location return
these are stored in flash correct seq in flash as the font data shown here
recovery routine is same as above - and has the same issue readcode gets the data not in correct seq required
Code:' Code for "0" Asci 48 90 real values _ @ dw 0x0000,0x0000,0xFF00,0x03FF,0xC00F,0xFFF0,0x1FFF,0xF81F,0xFFF8,0x3FC3,0xFC3F,0x81FC ;,0x3F @ dw 0x3F81,0xFC7F,0x00FE,0x7F00,0xFE7F,0x00FE,0x7F00,0xFE7F,0x00FE,0x7F00,0xFE7F,0x00FE,0x7F00 @ dw 0xFE7F,0x00FE,0x7F00,0xFE7F,0x00FE,0x3F81,0xFC3F,0x81FC,0x3FC3,0xFC1F,0xFFF8,0x1FFF ;,0xF8 @ dw 0xF80F,0xFFF0,0x03FF,0xC000,0xFF00,0x0000,0x0000,0x0000




Bookmarks