diff options
| author | LLLL Colonq <llll@colonq> | 2024-04-23 21:50:15 -0400 |
|---|---|---|
| committer | LLLL Colonq <llll@colonq> | 2024-04-23 21:50:15 -0400 |
| commit | 64624b52279bd76d473aa92b072a0e5ebd516530 (patch) | |
| tree | 80e6c1a1586a42a138eb5440419a08c03797325e /fig-emulator-gb/src/Fig/Emulator/GB/Component/Serial.hs | |
| parent | 828b424422d8ba17322eb08a22ca4f3815cf0ed3 (diff) | |
Automated instruction testing using linked repo
https://github.com/adtennant/GameboyCPUTests
Diffstat (limited to 'fig-emulator-gb/src/Fig/Emulator/GB/Component/Serial.hs')
| -rw-r--r-- | fig-emulator-gb/src/Fig/Emulator/GB/Component/Serial.hs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/fig-emulator-gb/src/Fig/Emulator/GB/Component/Serial.hs b/fig-emulator-gb/src/Fig/Emulator/GB/Component/Serial.hs index 68bc477..59200f1 100644 --- a/fig-emulator-gb/src/Fig/Emulator/GB/Component/Serial.hs +++ b/fig-emulator-gb/src/Fig/Emulator/GB/Component/Serial.hs @@ -1,7 +1,8 @@ module Fig.Emulator.GB.Component.Serial where import Fig.Prelude -import Prelude (fromIntegral) + +import GHC.IO.Handle (hPutChar) import Data.Char (chr) @@ -17,8 +18,8 @@ instance Pretty SerialError where , b ] -compSerial :: (MonadIO m, MonadThrow m) => Component m -compSerial = Component +compSerial :: (MonadIO m, MonadThrow m) => Handle -> Component m +compSerial h = Component { compState = () , compMatches = (== 0xff01) , compUpdate = \s _ -> pure s @@ -26,6 +27,7 @@ compSerial = Component log $ mconcat [ "wrote serial byte: ", tshow $ chr $ fromIntegral v ] + liftIO . hPutChar h . chr $ fromIntegral v pure s , compRead = \_ _ -> pure 0x00 } |
