bitmap.4th 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. \ bitmap.4th
  2. decimal
  3. also c33
  4. : get-file ( b u -- )
  5. cr r/o open-file ?dup
  6. if cr ." open error = " dec. drop exit
  7. then
  8. >r \ save fileid
  9. begin
  10. here 30 r@ read-file ?dup \ u2 ior ior?
  11. if cr ." read error = " dec. drop
  12. r> close-file drop exit
  13. else
  14. 32 allot
  15. then
  16. 0=
  17. until
  18. r> close-file drop
  19. ;
  20. : get ( -- \ <string><space> )
  21. lcd-cls s" loading..." lcd-type
  22. bl parse get-file ;
  23. variable top
  24. variable last-x
  25. variable last-y
  26. : home-page ( -- )
  27. top @ LCDC_MADD p!
  28. ;
  29. : scroll
  30. begin
  31. ctp-pos? if
  32. ctp-pos dup 0<
  33. if
  34. 2drop
  35. 0 last-x !
  36. 0 last-y !
  37. else
  38. \ x y
  39. last-y @ ?dup if
  40. swap dup last-y ! -
  41. 32 * LCDC_MADD p@ +
  42. dup top @ <
  43. if
  44. drop
  45. else
  46. \ begin
  47. \ LCDC_PS p@ $80 and
  48. \ until
  49. LCDC_MADD p!
  50. \ 30000 delay-us
  51. then
  52. else
  53. last-y !
  54. then
  55. last-x @ if
  56. >r \ x
  57. last-x @ r@ - dup abs 150 >
  58. if
  59. 0<
  60. if
  61. else
  62. home-page
  63. then
  64. r> last-x !
  65. else
  66. drop r> drop
  67. then
  68. else
  69. last-x !
  70. then
  71. then
  72. then
  73. button? if
  74. button
  75. case
  76. button-left of
  77. home-page
  78. endof
  79. button-centre of
  80. endof
  81. button-right of
  82. exit
  83. endof
  84. endcase
  85. then
  86. key? if
  87. key-flush
  88. then
  89. \ cannot suspend or LCD image will blank
  90. \ as image is in SDRAM
  91. \ wait-for-event
  92. again
  93. ;
  94. \ load image
  95. align here top !
  96. get sans.img
  97. .( scroll - using function keys L=down C=home R=up )
  98. LCDC_MADD p@
  99. top @ LCDC_MADD p!
  100. scroll
  101. LCDC_MADD p!
  102. lcd-cls