No catch-all in extraction cases.
Chris Pressey
a month ago
17 | 17 | extract :: Expr -> [Int] |
18 | 18 | |
19 | 19 | extract (Apply LDA_i (IntLit i)) = [0xa9, fromIntegral i] |
20 | ||
21 | extract (Apply LDA_i other) = | |
22 | error $ "invalid argument to LDA#: " ++ (show other) | |
23 | ||
24 | extract (Apply other _arg) = | |
25 | error $ "invalid application: " ++ (show other) | |
26 | ||
20 | 27 | extract TAX = [0xaa] |
21 | 28 | extract TAY = [0xa8] |
22 | 29 | extract CLC = [0x18] |
50 | 57 | in |
51 | 58 | c1 ++ [offset1] ++ f ++ c2a ++ [offset2a] ++ c2b ++ [offset2b] ++ t |
52 | 59 | |
53 | extract other = | |
54 | error $ "unsupported for extraction: " ++ show other | |
60 | extract (Bind _ident _expr _body) = error "TODO" | |
61 | extract (VarRef _ident) = error "TODO" | |
62 | ||
63 | extract Skip = [] | |
64 | ||
65 | extract t@LDA_i = | |
66 | error $ "unsupported for extraction: " ++ (show t) | |
67 | ||
68 | extract t@(IntLit _) = | |
69 | error $ "unsupported for extraction: " ++ (show t) | |
55 | 70 | |
56 | 71 | extractCond (IsSet Z) = [0xf0] -- BEQ |
57 | 72 | extractCond (IsSet N) = [0x30] -- BMI |