mescc: Produce M1 output instead of hex2.
[mes.git] / stage0 / x86.M1
1 ### Mes --- Maxwell Equations of Software
2 ### Copyright © 2017 Jan Nieuwenhuizen <janneke@gnu.org>
3 ###
4 ### This file is part of Mes.
5 ###
6 ### Mes is free software# you can redistribute it and/or modify it
7 ### under the terms of the GNU General Public License as published by
8 ### the Free Software Foundation# either version 3 of the License, or (at
9 ### your option) any later version.
10 ###
11 ### Mes is distributed in the hope that it will be useful, but
12 ### WITHOUT ANY WARRANTY# without even the implied warranty of
13 ### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 ### GNU General Public License for more details.
15 ###
16 ### You should have received a copy of the GNU General Public License
17 ### along with Mes.  If not, see <http://www.gnu.org/licenses/>.
18
19
20 DEFINE add____$i32,%eax 05
21 DEFINE add____$i8,%eax 83c0
22 DEFINE add____$i8,%edx 83c2
23 DEFINE add____$i8,%esp 83c4
24 DEFINE add____$i8,0x32 8305
25 DEFINE add____$i8,0x8(%eax) 8300
26 DEFINE add____$i8,0x8(%ebp) 8345
27 DEFINE add____%eax,%eax 01c0
28 DEFINE add____%ebp,%eax 01e8
29 DEFINE add____%edx,%eax 01d0
30 DEFINE add____%edx,%eax 01d0
31 DEFINE and____%edx,%eax 21d0
32 DEFINE call32 e8
33 DEFINE call___*%eax ffd0
34 DEFINE cmp____$i8,%eax 83f8
35 DEFINE cmp____$i8,0x8(%ebp) 83x7d
36 DEFINE cmp____%al,%dl 38c2
37 DEFINE cmp____%edx,%eax 39d0
38 DEFINE div____%ebx f7f3
39 DEFINE int____$0x80 cd80
40 DEFINE je32 0f84
41 DEFINE jg32 0f8f
42 DEFINE jge32 0f8d
43 DEFINE jmp32 e9
44 DEFINE jne32 0f85
45 DEFINE jne8 74
46 DEFINE lahf 9f
47 DEFINE lea____0x8(%ebp),%eax 8d45
48 DEFINE lea____0x8(%ebp),%edx 8d55
49 DEFINE leave c9
50 DEFINE mov____$i32,%eax b8
51 DEFINE mov____$i32,%ebx bb
52 DEFINE mov____$i32,%ecx b9
53 DEFINE mov____$i32,%edx ba
54 DEFINE mov____$i32,(%eax) c700
55 DEFINE mov____$i32,0x32 c705
56 DEFINE mov____$i32,0x8(%eax) c740
57 DEFINE mov____$i32,0x8(%ebp) c745
58 DEFINE mov____%al,(%edx) 8802 
59 DEFINE mov____%dl,(%eax) 8810
60 DEFINE mov____%dl,0x8(%eax) 8850
61 DEFINE mov____%eax,%ebx 89c3
62 DEFINE mov____%eax,%edx 89c2
63 DEFINE mov____%eax,(%edx) 8902 
64 DEFINE mov____%eax,0x32 a3
65 DEFINE mov____%eax,0x8(%ebp) 8945
66 DEFINE mov____%eax,0x8(%edx) 8942 
67 DEFINE mov____%ebp,%eax 89e8
68 DEFINE mov____%ebp,%edx 89ea
69 DEFINE mov____%ecx,%(eax) 8908
70 DEFINE mov____%edx,%(eax) 8910
71 DEFINE mov____%edx,%eax 89d0
72 DEFINE mov____%edx,%ebx 86d3
73 DEFINE mov____%edx,%ecx 89d1
74 DEFINE mov____%edx,0x8(%ebp) 8955
75 DEFINE mov____%esp,%ebp 89e5
76 DEFINE mov____(%eax),%eax 8b00
77 DEFINE mov____(%edx),%ecx 8b0a
78 DEFINE mov____0x32,%eax a1
79 DEFINE mov____0x32,%edx 8b15
80 DEFINE mov____0x8(%eax),%eax 8b40
81 DEFINE mov____0x8(%ebp),%eax 8b45
82 DEFINE mov____0x8(%ebp),%ebx 8b5d
83 DEFINE mov____0x8(%ebp),%ecx 8b4d
84 DEFINE mov____0x8(%ebp),%edx 8b55
85 DEFINE movzbl_%al,%eax 0fb6c0
86 DEFINE movzbl_(%eax),%eax 0fb600
87 DEFINE movzbl_(%eax),%edx 0fb610
88 DEFINE movzbl_0x8(%ebp),%eax 0fb645
89 DEFINE movzbl_0x8(%ebp),%edx 0fb655
90 DEFINE mul____%edx f7e2
91 DEFINE or_____%edx,%eax 09d0
92 DEFINE pop____%eax 58
93 DEFINE pop____%edx 5a
94 DEFINE push___$i32 68
95 DEFINE push___%eax 50
96 DEFINE push___%ebp 55
97 DEFINE push___%edox 52
98 DEFINE push___0x8(%ebp) ff75
99 DEFINE ret c3
100 DEFINE sahf 9e
101 DEFINE sete___%al 0f94c0
102 DEFINE setne__%al 0f95c0
103 DEFINE shl____$i8,%eax c1e0
104 DEFINE shl____%cl,%eax d3e0
105 DEFINE shr____%cl,%eax d3e8
106 DEFINE sub____%al,%dl 28d0
107 DEFINE sub____%dl,%al 28c2
108 DEFINE sub____%eax,%edx 29c2
109 DEFINE sub____%edx,%eax 29d0
110 DEFINE sub____%edx,%eax 29d0
111 DEFINE sub____%esp,$i8 83ec
112 DEFINE test___%al,%al 84c0
113 DEFINE test___%eax,%eax 85c0
114 DEFINE xchg___%dl,%bl 86d3
115 DEFINE xchg___%eax,(%esp) 870424
116 DEFINE xor____$i32,%eax 35
117 DEFINE xor____$i8,%ah 80f4
118 DEFINE xor____%eax,%eax 31c0
119 DEFINE xor____%ebx,%ebx 31db
120 DEFINE xor____%ecx,%ecx 31c9
121 DEFINE xor____%edx,%eax 31d0
122 DEFINE xor____%edx,%edx 31d2
123
124
125 DEFINE SYS_exit   01000000
126 DEFINE SYS_read   03000000
127 DEFINE SYS_write  04000000
128 DEFINE SYS_open   05000000
129 DEFINE SYS_access 21000000
130 DEFINE SYS_brk    2d000000
131 DEFINE SYS_fsync  76000000