-- Copyright 2006 mutantlemon.com module AsciiTest01 where import Data.Char import Data.Array.IArray import RomImage import Machine romFile = "roms/Dropzone (U) (GB).gb" test01 :: IO () test01 = do romImage <- loadRomImage romFile let initialState = initialMachineState romImage let iter f x = let (r, x') = f x in r : iter f x' let l = iter updateMachineDisplayFrame initialState let clear = putStr ((chr 27) : "[H") let pixel c = case c of 0 -> " " 1 -> "~" 2 -> "=" 3 -> "@" let printRow d y = mapM_ (\x -> putStr (pixel (d!(y, x)))) [0..159] >> putStr "\n" let printRows d = clear >> mapM_ (\y -> printRow d y) [0..138] mapM_ (\d -> printRows d) (take 200 l)