fl hex { 240X68dots Graphic LCD WD-G2406B-1YLYa 2013/03/08 15:05:22 PropForth5.2/5.0 Using graphic-LCD(WD-G2406B-1YLYa) Propeller WD-G2406B-1YLYa 1 FG P0 ---------- 2 DIO1(FLM) P1 ---------- 3 LP P2 ---------- 4 SCP P3 ---------- 5 FR(M) P4 ---------- 6 DI 7 Vdd 8 -Vee 9 Vss 10 Vadj P5 ---------- -9V_on } \ WD_G2406B driver 29msecnd/240X68dots lockdict create WD_G2406B forthentry $C_a_lxasm w, h148 h113 1- tuck - h9 lshift or here W@ alignl h10 lshift or l, z2WyPW1 l, zfiPZB l, z2WibJC l, zfyPW1 l, z2WibRC l, zfyPW1 l, z2WibZC l, zfyPW1 l, z2WibeC l, z2WiPZB l, z20yPW4 l, z2Wybj1 l, zfibmC l, z2WyPWV l, zfiPZB l, z1bixmC l, z1SyLI[ l, z2WyPW2 l, z2WibuB l, z2WyPc0 l, z2WyPjU l, ziQ57 l, zfyQ0O l, z20ybr1 l, z2WyPr8 l, zgyQ01 l, z1jix\6 l, z1bix\4 l, z1SybCx l, z1[ix\4 l, z1SybCx l, z3[yPvf l, z3[yPnb l, z1bix\3 l, z26VPc0 l, z1rix\2 l, z1SybCx l, z1[ix\3 l, z3[yPfa l, z26VPW2 l, z1rix\5 l, z3[yP[\ l, z1SV04[ l, z2WiQFk l, z20yQ8l l, z3ryQ80 l, z1SV000 l, 0 l, 0 l, 0 l, 0 l, 0 l, 0 l, freedict \ Character Font 8X8dots wvariable Font -2 allot h00 c, h00 c, h00 c, h00 c, h00 c, h00 c, h00 c, h00 c, \ (space) h30 c, h78 c, h78 c, h30 c, h30 c, h00 c, h30 c, h00 c, \ ! h6C c, h6C c, h28 c, h00 c, h00 c, h00 c, h00 c, h00 c, \ " " h6C c, h6C c, hFE c, h6C c, hFE c, h6C c, h6C c, h00 c, \ # h18 c, h7E c, hC0 c, h7C c, h06 c, hFC c, h18 c, h00 c, \ $ h00 c, hC6 c, hCC c, h18 c, h30 c, h66 c, hC6 c, h00 c, \ % h38 c, h6C c, h38 c, h76 c, hDC c, hCC c, h76 c, h00 c, \ & h30 c, h30 c, h60 c, h00 c, h00 c, h00 c, h00 c, h00 c, \ \ h18 c, h30 c, h60 c, h60 c, h60 c, h30 c, h18 c, h00 c, \ ( h60 c, h30 c, h18 c, h18 c, h18 c, h30 c, h60 c, h00 c, \ ) h00 c, h66 c, h3C c, hFF c, h3C c, h66 c, h00 c, h00 c, \ * h00 c, h30 c, h30 c, hFC c, h30 c, h30 c, h00 c, h00 c, \ + h00 c, h00 c, h00 c, h00 c, h00 c, h30 c, h30 c, h60 c, \ , h00 c, h00 c, h00 c, hFC c, h00 c, h00 c, h00 c, h00 c, \ - h00 c, h00 c, h00 c, h00 c, h00 c, h30 c, h30 c, h00 c, \ . h06 c, h0C c, h18 c, h30 c, h60 c, hC0 c, h80 c, h00 c, \ / h7C c, hC6 c, hC6 c, hD6 c, hC6 c, hC6 c, h7C c, h00 c, \ 0 h30 c, h70 c, h30 c, h30 c, h30 c, h30 c, hFC c, h00 c, \ 1 h78 c, hCC c, h0C c, h38 c, h60 c, hCC c, hFC c, h00 c, \ 2 h78 c, hCC c, h0C c, h38 c, h0C c, hCC c, h78 c, h00 c, \ 3 h1C c, h3C c, h6C c, hCC c, hFE c, h0C c, h1E c, h00 c, \ 4 hFC c, hC0 c, hF8 c, h0C c, h0C c, hCC c, h78 c, h00 c, \ 5 h38 c, h60 c, hC0 c, hF8 c, hCC c, hCC c, h78 c, h00 c, \ 6 hFC c, hCC c, h0C c, h18 c, h30 c, h30 c, h30 c, h00 c, \ 7 h78 c, hCC c, hCC c, h78 c, hCC c, hCC c, h78 c, h00 c, \ 8 h78 c, hCC c, hCC c, h7C c, h0C c, h18 c, h70 c, h00 c, \ 9 h00 c, h30 c, h30 c, h00 c, h00 c, h30 c, h30 c, h00 c, \ : h00 c, h30 c, h30 c, h00 c, h00 c, h30 c, h30 c, h60 c, \ ; h18 c, h30 c, h60 c, hC0 c, h60 c, h30 c, h18 c, h00 c, \ < h00 c, h00 c, hFC c, h00 c, h00 c, hFC c, h00 c, h00 c, \ = h60 c, h30 c, h18 c, h0C c, h18 c, h30 c, h60 c, h00 c, \ > h78 c, hCC c, h0C c, h18 c, h30 c, h00 c, h30 c, h00 c, \ ? h7C c, hC6 c, hDE c, hDE c, hDC c, hC0 c, h78 c, h00 c, \ @ h30 c, h78 c, hCC c, hCC c, hFC c, hCC c, hCC c, h00 c, \ A hFC c, h66 c, h66 c, h7C c, h66 c, h66 c, hFC c, h00 c, \ B h3C c, h66 c, hC0 c, hC0 c, hC0 c, h66 c, h3C c, h00 c, \ C hF8 c, h6C c, h66 c, h66 c, h66 c, h6C c, hF8 c, h00 c, \ D hFE c, h62 c, h68 c, h78 c, h68 c, h62 c, hFE c, h00 c, \ E hFE c, h62 c, h68 c, h78 c, h68 c, h60 c, hF0 c, h00 c, \ F h3C c, h66 c, hC0 c, hC0 c, hCE c, h66 c, h3E c, h00 c, \ G hCC c, hCC c, hCC c, hFC c, hCC c, hCC c, hCC c, h00 c, \ H h78 c, h30 c, h30 c, h30 c, h30 c, h30 c, h78 c, h00 c, \ I h1E c, h0C c, h0C c, h0C c, hCC c, hCC c, h78 c, h00 c, \ J hE6 c, h66 c, h6C c, h78 c, h6C c, h66 c, hE6 c, h00 c, \ K hF0 c, h60 c, h60 c, h60 c, h62 c, h66 c, hFE c, h00 c, \ L hC6 c, hEE c, hFE c, hFE c, hD6 c, hC6 c, hC6 c, h00 c, \ M hC6 c, hE6 c, hF6 c, hDE c, hCE c, hC6 c, hC6 c, h00 c, \ N h38 c, h6C c, hC6 c, hC6 c, hC6 c, h6C c, h38 c, h00 c, \ O hFC c, h66 c, h66 c, h7C c, h60 c, h60 c, hF0 c, h00 c, \ P h78 c, hCC c, hCC c, hCC c, hDC c, h78 c, h1C c, h00 c, \ Q hFC c, h66 c, h66 c, h7C c, h6C c, h66 c, hE6 c, h00 c, \ R h78 c, hCC c, hC0 c, h78 c, h0C c, hCC c, h78 c, h00 c, \ S hFC c, hB4 c, h30 c, h30 c, h30 c, h30 c, h78 c, h00 c, \ T hCC c, hCC c, hCC c, hCC c, hCC c, hCC c, hFC c, h00 c, \ U hCC c, hCC c, hCC c, hCC c, hCC c, h78 c, h30 c, h00 c, \ V hC6 c, hC6 c, hC6 c, hD6 c, hFE c, hEE c, hC6 c, h00 c, \ W hC6 c, h6C c, h38 c, h38 c, h6C c, hC6 c, hC6 c, h00 c, \ X hCC c, hCC c, hCC c, h78 c, h30 c, h30 c, h78 c, h00 c, \ Y hFE c, hC6 c, h8C c, h18 c, h32 c, h66 c, hFE c, h00 c, \ Z h78 c, h60 c, h60 c, h60 c, h60 c, h60 c, h78 c, h00 c, \ [ hC0 c, h60 c, h30 c, h18 c, h0C c, h06 c, h02 c, h00 c, \ \ h78 c, h18 c, h18 c, h18 c, h18 c, h18 c, h78 c, h00 c, \ ] h10 c, h38 c, h6C c, hC6 c, h00 c, h00 c, h00 c, h00 c, \ ^ h00 c, h00 c, h00 c, h00 c, h00 c, h00 c, h00 c, hFF c, \ _ h30 c, h18 c, h0C c, h00 c, h00 c, h00 c, h00 c, h00 c, \ ` h00 c, h00 c, h78 c, h0C c, h7C c, hCC c, h76 c, h00 c, \ a hE0 c, h60 c, h60 c, h7C c, h66 c, h66 c, hDC c, h00 c, \ b h00 c, h00 c, h78 c, hCC c, hC0 c, hCC c, h78 c, h00 c, \ c h1C c, h0C c, h0C c, h7C c, hCC c, hCC c, h76 c, h00 c, \ d h00 c, h00 c, h78 c, hCC c, hFC c, hC0 c, h78 c, h00 c, \ e h38 c, h6C c, h60 c, hF0 c, h60 c, h60 c, hF0 c, h00 c, \ f h00 c, h00 c, h76 c, hCC c, hCC c, h7C c, h0C c, hF8 c, \ g hE0 c, h60 c, h6C c, h76 c, h66 c, h66 c, hE6 c, h00 c, \ h h30 c, h00 c, h70 c, h30 c, h30 c, h30 c, h78 c, h00 c, \ i h0C c, h00 c, h0C c, h0C c, h0C c, hCC c, hCC c, h78 c, \ j hE0 c, h60 c, h66 c, h6C c, h78 c, h6C c, hE6 c, h00 c, \ k h70 c, h30 c, h30 c, h30 c, h30 c, h30 c, h78 c, h00 c, \ l h00 c, h00 c, hCC c, hFE c, hD6 c, hD6 c, hC6 c, h00 c, \ m h00 c, h00 c, hF8 c, hCC c, hCC c, hCC c, hCC c, h00 c, \ n h00 c, h00 c, h78 c, hCC c, hCC c, hCC c, h78 c, h00 c, \ o h00 c, h00 c, hDC c, h66 c, h66 c, h7C c, h60 c, hF0 c, \ p h00 c, h00 c, h76 c, hCC c, hCC c, h7C c, h0C c, h1E c, \ q h00 c, h00 c, hDC c, h76 c, h66 c, h60 c, hF0 c, h00 c, \ r h00 c, h00 c, h7C c, hC0 c, h78 c, h0C c, hF8 c, h00 c, \ s h10 c, h30 c, h7C c, h30 c, h30 c, h34 c, h18 c, h00 c, \ t h00 c, h00 c, hCC c, hCC c, hCC c, hCC c, h76 c, h00 c, \ u h00 c, h00 c, hCC c, hCC c, hCC c, h78 c, h30 c, h00 c, \ v h00 c, h00 c, hC6 c, hD6 c, hD6 c, hFE c, h6C c, h00 c, \ w h00 c, h00 c, hC6 c, h6C c, h38 c, h6C c, hC6 c, h00 c, \ x h00 c, h00 c, hCC c, hCC c, hCC c, h7C c, h0C c, hF8 c, \ y h00 c, h00 c, hFC c, h98 c, h30 c, h64 c, hFC c, h00 c, \ z h1C c, h30 c, h30 c, hE0 c, h30 c, h30 c, h1C c, h00 c, \ { h30 c, h30 c, h30 c, h30 c, h30 c, h30 c, h30 c, h00 c, \ | hE0 c, h30 c, h30 c, h1C c, h30 c, h30 c, hE0 c, h00 c, \ } h76 c, hDC c, h00 c, h00 c, h00 c, h00 c, h00 c, h00 c, \ ~ h38 c, h6C c, hC6 c, hC6 c, h6C c, h28 c, hEE c, h00 c, \ ohm wvariable vidMem d1918 allot \ 30bytes X 64bytes \ charcter position vidX=0-d29 vidY=0-7 wvariable vidX wvariable vidY \ basepin for WD-G2406B's control 0 wconstant BASE \ display character to graphicLCD ( n1 n2 n3 -- ) \ n1:character n2:x-pos n3:y-pos : grlcd_char d240 u* + vidMem + \ Get vidMem's address for (x,y) swap h20 - 8 u* Font + \ Get Font-address \ Copy character to vidMem 8 0 do 2dup C@ swap i d30 u* + C! 1+ \ Font-address + 1 loop 2drop ; \ display string to graphicLCD ( cstr -- ) \ Set charcter position(vidX=0-d29 vidY=0-7) before call : grlcd_str C@++ dup if bounds do i C@ vidX W@ vidY W@ grlcd_char \ Calculate vidX and vidY vidX W@ 1+ dup d30 = if drop 0 vidX W! vidY W@ 1+ dup 8 = if drop 0 vidY W! else vidY W! then else vidX W! then loop else 2drop then ; \ Clear vidMem \ ( n1 n2 -- ) n1:start address n2:number of word (2byte) : clear_vram 0 do dup 0 swap W! 2+ loop drop ; \ vidMem |-------------------------------| \ 63 |(0,63) (239,63)| \ | | | 64Lines X 30bytes \ | | (x,y) | = 1920bytes \ | | | \ | |(0,0) (239,0)| \ 0 ------------------------------- \ y 0 ----------------------------- 239 \ x \ Calculate GraphicMemory address from (x,y) \ ( n1 n2 -- n3 ) n1:x n2:y n3:address : GetAddr vidMem swap d63 swap - d30 u* + \ vertical direction swap 8 u/ \ horizontal direction + \ Get address ; \ Set/Clear dot at (x,y) \ ( n1 n2 n3 -- ) n1:1=putPixel 0=clearPixel n2:x n3:y : setPixel over >r \ Push x GetAddr dup >r \ Get address and push C@ \ Get byte r> r> swap >r \ pop x 8 u/mod drop h80 swap rshift \ Get bit data rot if or \ Set bit to 1 else hFF xor and \ Set bit to 0 then r> C! \ Save byte ; \ copy top 3 items on the stack \ ( n1 n2 n3 -- n1 n2 n3 n1 n2 n3 ) : 3dup dup >r over >r rot dup >r rot2 r> r> r> ; wvariable difx wvariable dify variable dx variable dy variable sx variable sy wvariable ds \ Draw straight line from (x0,y0) to (x1,y1) \ It takes 131msec from (0,0) to (239,63) \ ( n1 n2 n3 n4 n5 -- ) n1:1=putPixel 0=clearPixel n2:y0 n3:y1 n4:x0 n5:x1 : DrawLine \ X 2dup over >r \ Push x0 < if 1 else -1 then dx L! \ 1 or -1 for X-direction - abs dup 1 rshift sy L! \ error in Y-direction difx W! \ pixels in X-direction \ Y 2dup over >r \ Push y0 < if 1 else -1 then dy L! \ 1 or -1 for Y-direction - abs dup 1 rshift sx L! \ error in X-direction dify W! \ pixels in Y-direction difx W@ dify W@ min ds W! r> r> swap 3dup \ ( 1/0 x0 y0 1/0 x0 y0 -- ) difx W@ dify W@ max 1+ 0 do setPixel \ Plot current position \ X sx L@ ds W@ - dup sx L! 0 <= \ Check sx if sx L@ dify W@ + sx L! \ Increment sx by dify swap dx L@ + swap \ Move X in X-direction then \ Y sy L@ ds W@ - dup sy L! 0 <= \ Check sy if sy L@ difx W@ + sy L! \ Increment sy by difx dy L@ + \ Move Y in Y-direction then 3dup loop 3drop 3drop ; wvariable tmp 6 allot \ Draw box between (x0,y0) and (x1,y1) \ It takes 131msec between (0,0) ando (239,63) \ ( n1 n2 n3 n4 n5 -- ) n1:1=putPixel 0=clearPixel n2:y0 n3:y1 n4:x0 n5:x1 : Box tmp W! tmp 2+ W! tmp 4+ W! tmp 6 + W! dup tmp 6 + W@ tmp 6 + W@ tmp 2+ W@ tmp W@ DrawLine dup tmp 6 + W@ tmp 4+ W@ tmp W@ tmp W@ DrawLine dup tmp 4+ W@ tmp 4+ W@ tmp W@ tmp 2+ W@ DrawLine tmp 4+ W@ tmp 6 + W@ tmp 2+ W@ tmp 2+ W@ DrawLine ; variable f variable ddF_x variable ddF_y wvariable x wvariable y wvariable R \ Draw hisigata e with center on (x0,y0) radius=R \ ( n1 n2 n3 n4 -- ) n1:1=putPixel 0=clearPixel n2:x0 n3:y0 n4;radius : hisi dup dup dup 1 swap - f L! 0 ddF_x L! -2 * ddF_y L! 0 x W! y W! R W! 3dup R W@ + setPixel 3dup R W@ - setPixel 3dup swap R W@ + swap setPixel 3dup swap R W@ - swap setPixel begin f L@ 0 >= if y W@ 1- y W! ddF_y L@ 2+ ddF_y L! f L@ ddF_y L@ + f L! then x W@ 1+ x W! f L@ ddF_x 1+ + f L! 3dup swap x W@ + swap y W@ + setPixel 3dup swap x W@ - swap y W@ + setPixel 3dup swap x W@ + swap y W@ - setPixel 3dup swap x W@ - swap y W@ - setPixel 3dup swap y W@ + swap x W@ + setPixel 3dup swap y W@ - swap x W@ + setPixel 3dup swap y W@ + swap x W@ - setPixel 3dup swap y W@ - swap x W@ - setPixel x W@ y W@ < if 0 else 1 then until 3drop ; variable xx variable yy wvariable X wvariable Y \ Draw circle with center on (x0,y0) radius=R \ ( n1 n2 n3 n4 -- ) n1:1=putPixel 0=clearPixel n2:x0 n3:y0 n4;radius : circle d128 u* xx L! 0 yy L! 0 X W! 0 Y W! begin xx L@ 7 rshift X W! yy L@ 7 rshift Y W! 3dup swap X W@ + swap Y W@ + setPixel 3dup swap X W@ - swap Y W@ - setPixel 3dup swap X W@ - swap Y W@ + setPixel 3dup swap X W@ + swap Y W@ - setPixel 3dup swap Y W@ + swap X W@ + setPixel 3dup swap Y W@ - swap X W@ - setPixel 3dup swap Y W@ - swap X W@ + setPixel 3dup swap Y W@ + swap X W@ - setPixel yy L@ xx L@ 7 rshift + yy L! xx L@ yy L@ 7 rshift - xx L! yy L@ xx L@ >= if 1 else 0 then until 3drop ; \ ----------------------------------------------------------------------------- \ DEMO \ ----------------------------------------------------------------------------- \ Display 8X8 Font : demo1 BASE 5 + pinout \ Disable -9V c" vidMem BASE WD_G2406B" 0 cogx \ Drive graphicLCD vidMem d960 clear_vram BASE 5 + pinhi \ Enable -9V \ vidX= 0 to d29 vidY= 0 to 7 0 vidX W! 0 vidY W! Font \ top address for character begin d96 0 do ." number= " i . cr dup i 3 lshift + \ Get Font-address vidMem vidX W@ + vidY W@ d240 u* + \ Calculate address of vidMem swap st? \ Copy character to vidMem 8 0 do 2dup C@ dup . swap i d30 u* + dup . C! 1+ \ Font-address + 1 cr loop 2drop vidX W@ 1+ dup d30 = \ Check if vixX = 30 if drop 0 vidX W! vidY W@ 1+ dup 8 = \ Check if vixY = 8 if drop 0 vidY W! else vidY W! then else vidX W! then loop ." AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" st? fkey? swap drop until drop \ LCD-off BASE 5 + pinlo \ Disable -9V 0 cogreset ; \ Display ROM-Font(16X32dots) wvariable odd wvariable 1_row : demo2 BASE 5 + pinout \ Disable -9V c" vidMem BASE WD_G2406B" 0 cogx \ Drive graphicLCD vidMem d960 clear_vram BASE 5 + pinhi \ Enable -9V \ vidX= 0 to 15 vidY= 0 to 1 0 vidX W! 0 vidY W! 0 1_row W! h8000 \ ROM Font address begin dup hC000 = if drop h8000 then \ ROM-Font Address cr cr dup ." $" hex . cr dup 3 1 do i odd W! d32 0 do dup L@ odd W@ d16 0 do \ Get 1-row (16bits) 2dup and if 1_row W@ 1 lshift 1 else 1_row W@ 1 lshift 0 then or 1_row W! \ ---- Display ROM-Font to terminal 2dup and if h2A else bl then emit \ ------------------------------------ 2 lshift loop 2drop cr vidMem vidX W@ 2 u* + \ X for vidMem vidY W@ d960 u* + d30 i u* \ Y for vidMem + \ Calculate address of vidMem 1_row W@ dup 8 lshift swap hFF00 and 8 rshift or swap W! \ Save 16bit-data to vidMem 4 + \ Add 4 to Font-addres loop vidX W@ 1+ dup d15 = \ Check if vixX = 15 if drop 0 vidX W! vidY W@ 1+ dup 2 = \ Check if vixY = 2 if drop 0 vidY W! else vidY W! then else vidX W! then d128 - d100 delms cr cr loop drop d128 + \ next character fkey? swap drop until drop \ LCD-off BASE 5 + pinlo \ Disable -9V 0 cogreset ; \ Dusplay string, line, box, circle, hisi : demo3 BASE 5 + pinout \ Disable -9V c" vidMem BASE WD_G2406B" 0 cogx \ Drive graphicLCD vidMem d960 clear_vram BASE 5 + pinhi \ Enable -9V { cnt COG@ 1 0 d63 0 d239 DrawLine cnt COG@ swap - . } \ Display 8X8Font 0 vidX W! 0 vidY W! c" WD-G2406B" grlcd_str 0 vidX W! 1 vidY W! c" May the Forth be with you." grlcd_str d2000 delms vidMem d240 clear_vram \ Line d13 0 do 1 0 i 5 u* 0 d239 DrawLine loop d48 0 do 1 0 d63 0 d239 i 5 u* - DrawLine loop d500 delms vidMem d960 clear_vram d13 0 do 1 0 i 5 u* d239 0 DrawLine loop d48 0 do 1 0 d63 d239 i 5 u* DrawLine loop d500 delms vidMem d960 clear_vram d13 0 do 1 d63 d63 i 5 u* - 0 d239 DrawLine loop d48 0 do 1 d63 0 0 d239 i 5 u* - DrawLine loop d500 delms vidMem d960 clear_vram d13 0 do 1 d63 d63 i 5 u* - d239 0 DrawLine loop d48 0 do 1 d63 0 d239 i 5 u* DrawLine loop d1000 delms vidMem d960 clear_vram \ Box 1 0 8 0 d30 Box 9 2 do 1 0 i d8 u* 1- 0 i d30 u* 1- Box d100 delms loop d500 delms vidMem d960 clear_vram 5 0 do 1 i 5 u* d63 i 5 u* - i 20 u* d239 i 20 u* - Box loop d500 delms 5 0 do 0 i 5 u* d63 i 5 u* - i 20 u* d239 i 20 u* - Box loop d1000 delms vidMem d960 clear_vram \ Circle 7 1 do 1 d50 d30 i 5 u* circle loop \ hisi 7 1 do 1 d150 d30 i 5 u* hisi loop begin fkey? swap drop until \ LCD-off BASE 5 + pinlo \ Disable -9V 0 cogreset ; decimal { Driver for WD-G2406B-1YLYa ( n1 n2 -- ) n1:Address of vidMem n2:basepin fl build_BootOpt :rasm mov $C_treg1 , # 1 shl $C_treg1 , $C_stTOS \ Get FLM mov __flm , $C_treg1 shl $C_treg1 , # 1 \ Get LP mov __lp , $C_treg1 shl $C_treg1 , # 1 \ Get CP mov __cp , $C_treg1 shl $C_treg1 , # 1 \ Get M mov __m , $C_treg1 \ Get top of data mov $C_treg1 , $C_stTOS add $C_treg1 , # 4 mov __data , # 1 shl __data , $C_treg1 mov $C_treg1 , # h1F shl $C_treg1 , $C_stTOS \ Set pins to output or dira , $C_treg1 spop __1 mov $C_treg1 , # 2 __2 \ Get vidMem mov __vid , $C_stTOS mov $C_treg2 , # d64 __3 mov $C_treg3 , # d30 __4 \ Read vidmem rdbyte $C_treg5 , __vid shl $C_treg5 , # d24 add __vid , # 1 mov $C_treg4 , # 8 __5 \ Shift one pixel to lcd shl $C_treg5 , # 1 wc muxc outa , __data \ Set CP to High or outa , __cp jmpret __delay_ret , # __delay \ Set CP to Low andn outa , __cp jmpret __delay_ret , # __delay djnz $C_treg4 , # __5 djnz $C_treg3 , # __4 \ Set LP or outa , __lp \ Set FLM cmp $C_treg2 , # d64 wz muxz outa , __flm \ wait jmpret __delay_ret , # __delay andn outa , __lp djnz $C_treg2 , # __3 cmp $C_treg1 , # 2 wz \ Set M muxz outa , __m djnz $C_treg1 , # __2 jmp # __1 __delay mov $C_treg6 , cnt add $C_treg6 , # d50 waitcnt $C_treg6 , # 0 __delay_ret ret __flm 0 __lp 0 __cp 0 __m 0 __data 0 __vid 0 ;asm WD_G2406B }