File: isa.inc

package info (click to toggle)
gdb 16.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 237,056 kB
  • sloc: ansic: 2,134,949; asm: 375,582; exp: 206,875; cpp: 73,639; makefile: 70,467; sh: 26,103; python: 13,697; yacc: 11,341; ada: 7,358; xml: 6,098; perl: 5,077; pascal: 3,389; tcl: 2,986; f90: 2,764; lisp: 1,984; cs: 879; lex: 738; sed: 228; awk: 181; objc: 137; fortran: 57
file content (108 lines) | stat: -rw-r--r-- 1,495 bytes parent folder | download | duplicates (8)
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# Macros for the fake ISA.  Keep in sync with example-synacor/README.arch-spec.

# These .set macros will generate symbols in the output ELF, but it also allows
# use to use them as arguments to the insns below.  Oh well.
.set r0, 32768
.set r1, r0+1
.set r2, r0+2
.set r3, r0+3
.set r4, r0+4
.set r5, r0+5
.set r6, r0+6
.set r7, r0+7

# The target is little endian, so make sure we output the 16-bit words as such.
.macro _op op:req, more:vararg
	.byte \op & 0xff, (\op >> 8) & 0xff
	.ifnb \more
	_op \more
	.endif
.endm

.macro HALT
	_op 0
.endm

.macro SET a:req, b:req
	_op 1, \a, \b
.endm

.macro PUSH a:req
	_op 2, \a
.endm

.macro POP a:req
	_op 3, \a
.endm

.macro EQ a:req, b:req, c:req
	_op 4, \a, \b, \c
.endm

.macro GT a:req, b:req, c:req
	_op 5, \a, \b, \c
.endm

.macro JMP a:req
	_op 6, \a
.endm

.macro JT a:req, b:req
	_op 7, \a, \b
.endm

.macro JF a:req, b:req
	_op 8, \a, \b
.endm

.macro ADD a:req, b:req, c:req
	_op 9, \a, \b, \c
.endm

.macro MULT a:req, b:req, c:req
	_op 10, \a, \b, \c
.endm

.macro MOD a:req, b:req, c:req
	_op 11, \a, \b, \c
.endm

.macro AND a:req, b:req, c:req
	_op 12, \a, \b, \c
.endm

.macro OR a:req, b:req, c:req
	_op 13, \a, \b, \c
.endm

.macro NOT a:req, b:req
	_op 14, \a, \b
.endm

.macro RMEM a:req, b:req
	_op 15, \a, \b
.endm

.macro WMEM a:req, b:req
	_op 16, \a, \b
.endm

.macro CALL a:req
	_op 17, \a
.endm

.macro RET
	_op 18
.endm

.macro OUT a:req
	_op 19, \a
.endm

.macro IN a:req
	_op 20, \a
.endm

.macro NOOP
	_op 21
.endm