variable buffer 1fc allot \ buffer 512byte fl wvariable buff_ptr wvariable x wvariable y wvariable tmp : Display_Nokia 4 rshift swap f0 and or swap 4 rshift \ [B(8)][G(8)][R(8)] --- [G(upper4)R(lower4)][0(upper4][B(lower4)] 100 or value W! 9 shift_out cs_out 100 or value W! 9 shift_out cs_out ; : clear_x 0 x W! ; : clear_y 0 y W! ; : clear_buff_ptr buffer buff_ptr W! ; : x+1 x W@ 1+ x W! ; : y+1 y W@ 1+ y W! ; : buff_ptr+1 buff_ptr W@ 1+ buff_ptr W! ; : buff_ptr+2 buff_ptr W@ 2+ buff_ptr W! ; : push_1byte buff_ptr W@ dup C@ swap 1+ buff_ptr W! ; : 1_Block_Read clear_buff_ptr 200 0 do sd_shift_in buff_ptr W@ C! buff_ptr+1 loop begin sd_shift_in ff = until \ drop crc dummy clear_buff_ptr ; : push_BGR_Block buff_ptr W@ dup dup tmp W! 1 - swap 200 swap buffer - - 0 do 1+ dup W@ C@ swap loop drop 1_Block_Read tmp W@ buffer - 200 swap - 1 = if push_1byte push_1byte else push_1byte then ; : push_BGR push_1byte push_1byte push_1byte ; : Check_buffer_end? buff_ptr W@ buffer - 200 = if 1_Block_Read then ; : zero_skip_Block 1_Block_Read buff_ptr+1 ; : nokia3300_demo nokia3300_init _nokia_cs_l \ CS = Low bc value W! \ DATCTL change stary-point to bottom 9 shift_out cs_out 100 value W! 9 shift_out cs_out 101 value W! 9 shift_out cs_out 104 value W! 9 shift_out cs_out 75 value W! \ PASET 9 shift_out cs_out 100 value W! 9 shift_out cs_out 181 value W! 9 shift_out cs_out 15 value W! \ CASET 9 shift_out cs_out 100 value W! 9 shift_out cs_out 181 value W! 9 shift_out cs_out 5c value W! \ RAMWR 9 shift_out cs_out clear_x clear_y sd_init _sd_cs_out_l 52 sd_shift_out \ CMD18 Multi Block read 0 sd_shift_out 5 sd_shift_out 0 sd_shift_out 0 sd_shift_out 1 sd_shift_out \ CRC begin sd_shift_in 0= until dummy begin sd_shift_in fe = until \ start-byte for data token \ copy 1 Block(512byte) from sd to buffer 1_Block_Read buffer 36 + buff_ptr W! begin begin buff_ptr W@ buffer - 1fd > if push_BGR_Block else push_BGR then Display_Nokia x+1 Check_buffer_end? x W@ 82 = until clear_x buff_ptr W@ buffer - 1fe > if zero_skip_Block else buff_ptr+2 then y+1 Check_buffer_end? y W@ 82 = until 52 sd_shift_out \ CMD12 Transfer Stop 0 4 0 do dup sd_shift_out loop drop 1 sd_shift_out \ CRC begin sd_shift_in 0= until \ response begin sd_shift_in ff = until \ check H-level dummy _sd_cs_out_h _nokia_cs_h \ CS = High ;