Created
July 20, 2015 21:56
-
-
Save mntmn/f837db3ec3e48039cd2b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(def ofs 0) | |
(def sofs 0) | |
(def x 0) | |
(def y 0) | |
(def x1 0) | |
(def x2 0) | |
(def x3 0) | |
(def y1 0) | |
(def y2 0) | |
(def sy 0) | |
(def color 0) | |
(def fb (mmap "/framebuffer")) | |
(def f (open "/framebuffer")) | |
(def sprite [00000ff00ff000000ff00ff000000000 | |
0ff0000000000ff0000000000ff00000 | |
0ff0000000000000000000000ff00000 | |
00000ff00000000000000ff000000000 | |
00000ff00000000000000ff000000000 | |
000000000ff000000ff0000000000000 | |
0000000000000ff00000000000000000 | |
00000000000000000000000000000000]) | |
(def sprite [00000ff00ff000000ff00ff000000000 | |
0ff00ff00ff00ff00ff00ff00ff00000 | |
0ff00ff00ff00ff00ff00ff00ff00000 | |
00000ff00ff00ff00ff00ff000000000 | |
00000ff00ff00ff00ff00ff000000000 | |
000000000ff00ff00ff0000000000000 | |
0000000000000ff00000000000000000 | |
00000000000000000000000000000000]) | |
(def sprite-w 8) | |
(def line (fn x y sy (do | |
(def x1 (* 2 x)) | |
(def x2 (- (* 2 (+ x sprite-w)) 2)) | |
(def ofs (* y 3840)) | |
(def x3 (* sy 16)) | |
(while (lt x1 x2) (do | |
(def color (get32 sprite x3)) | |
(put32 fb (+ ofs x1) color) | |
(def x1 (+ x1 2)) | |
(def x3 (+ x3 2)) | |
)) ))) | |
(def blit (fn x y (do | |
(def y1 y) | |
(def y2 (+ y sprite-w)) | |
(def sy 0) | |
(while (lt y1 y2) (do | |
(line x y1 sy) | |
(def y1 (+ y1 1)) (def sy (+ sy 1)) )) | |
(gc) | |
))) | |
(def main (fn (do | |
(def x 0) | |
(def y 0) | |
(while (lt y 100) (do | |
(def x 0) | |
(while (lt x 240) (do | |
(blit (* x 8) (* y 8)) | |
(def x (+ x 2)) | |
)) | |
(print y) | |
(def y (+ y 2)))) ))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment