blob: 2e099dc29d2677c3500745bd3dd3e551cbaf071e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
module Device where
import Prelude hiding (Word)
import Data.Word (Word32, Word16, Word8)
import Machine
-------------------------------------------------------------------------------
-- Protocol Constants
-- Protocol itself is simple,
-- suem send commands to devices, they response.
-- Example communication:
-- s: h afebabe
-- d: o 07
-- s: W afebabe 1999
-- d: o
-- d: i
-- s: l afebab3
-- d: x
-- All numbers are in hex and have correct length
-- (zeroes on the left are mandatory).
-- requests
device_get_high_byte = 'h' -- <7 hexes>; 2 hexes in response
device_get_low_byte = 'l' -- <7 hexes>; 2 hexes in response
device_get_word = 'w' -- <7 hexes>; 4 hexes in response
device_set_high_byte = 'H' -- <7 hexes> <2 hexes>
device_set_low_byte = 'L' -- <7 hexes> <2 hexes>
device_set_word = 'W' -- <7 hexes> <4 hexes>
-- responses
device_interrupt = 'i' -- and nothing else
device_ok = 'o' -- maybe number in response to get (with correct size)
device_bad = 'x' -- and nothing else =)
-------------------------------------------------------------------------------
-- Memory
deviceGetByte :: Long -> Emulator Byte
deviceGetByte a | a `mod` 2 == 0 = return 0xFF
| otherwise = return 0xFF
deviceGetWord :: Long -> Emulator Word
deviceGetWord a = return 0xFFFF
deviceSetByte :: Long -> Byte -> Emulator ()
deviceSetByte a b | a `mod` 2 == 0 = return ()
| otherwise = return ()
deviceSetWord :: Long -> Word -> Emulator ()
deviceSetWord a w = return ()
-------------------------------------------------------------------------------
-- Interrupts
checkInteruptsFromDevices :: Emulator ()
checkInteruptsFromDevices = return ()
|