-
Notifications
You must be signed in to change notification settings - Fork 1
/
ASM.FTH
86 lines (75 loc) · 1.64 KB
/
ASM.FTH
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
( registers )
0 constant ax
1 constant cx
2 constant dx
3 constant bx
4 constant sp
5 constant bp
6 constant si
7 constant di
0 constant al
1 constant cl
2 constant dl
3 constant bl
4 constant ah
5 constant ch
6 constant dh
7 constant bh
( addressing )
0 constant [bx+si]
1 constant [bx+di]
2 constant [bp+si]
3 constant [bp+di]
4 constant [si]
5 constant [di]
6 constant [bp]
7 constant [bx]
7 constant [n]
: stosb ( -- ) 170 c, ;
: stosw ( -- ) 171 c, ;
: lodsb ( -- ) 172 c, ;
: lodsw ( -- ) 173 c, ;
: cwd ( -- ) 153 c, ;
: int ( n -- ) 205 c, c, ;
: mov16/ir ( n reg -- ) 184 + c, , ;
: mov8/ir ( n reg -- ) 176 + c, c, ;
: inc16/r 64 + c, ;
: dec16/r 72 + c, ;
: push 80 + c, ;
: pop 88 + c, ;
( 7 6 | 5 4 3 | 2 1 0 )
( mod | reg | reg/mem )
( mod=11 => reg mod=00 [reg] )
: /rr ( reg/m reg -- ) 3 lshift + 192 + c, ; ( 192 = 11000000 )
: /mr ( mem reg -- ) 3 lshift + c, ;
: /rm ( reg mem -- ) swap /mr ;
: mov16/rr 139 c, /rr ;
: add16/rr 3 c, /rr ;
: or16/rr 11 c, /rr ;
: and16/rr 35 c, /rr ;
: sub16/rr 43 c, /rr ;
: xor16/rr 51 c, /rr ;
: xor8/rr 50 c, /rr ;
: cmp16/rr 59 c, /rr ;
: cmp8/rr 58 c, /rr ;
: test16/rr 133 c, /rr ;
: add16/mr 3 c, /mr ;
: mov16/mr 139 c, /mr ;
: mov8/mr 138 c, /mr ;
: mov16/rm 137 c, /rm ;
: mov8/rm 136 c, /rm ;
: jmp/r 255 c, 4 /rr ;
: not16/r 247 c, 2 /rr ;
: neg16/r 247 c, 3 /rr ;
: idiv16/r 247 c, 7 /rr ;
: div16/r 247 c, 6 /rr ;
: imul16/r 247 c, 5 /rr ;
: shl16cl/r 211 c, 4 /rr ;
: shr16cl/r 211 c, 5 /rr ;
: 1shr16/r 209 c, 5 /rr ;
: inc8/r 254 c, 0 /rr ;
: inc8/m 254 c, c, ;
: jz 116 c, c, ;
: jnl 125 c, c, ;
: jnb 115 c, c, ;
: jbe 118 c, c, ;