]> gitweb.factorcode.org Git - factor.git/blob - basis/cpu/x86/assembler/assembler-docs.factor
calendar.format: make duration>human-readable more human readable
[factor.git] / basis / cpu / x86 / assembler / assembler-docs.factor
1 USING: compiler.codegen.labels cpu.x86.assembler.private help.markup
2 help.syntax kernel math sequences ;
3 IN: cpu.x86.assembler
4
5 HELP: (MOV-I)
6 { $values { "dst" "destination" } { "src" "immediate value" } }
7 { $description "MOV where 'src' is immediate. If dst is a 64-bit register and the 'src' value fits in 32 bits, then zero extension is taken advantage of by downgrading 'dst' to a 32-bit register. That way, the instruction gets a shorter encoding." } ;
8
9 HELP: 1-operand
10 { $values { "operand" "operand" } { "reg,rex.w,opcode" sequence } }
11 { $description "Used for encoding some instructions with one operand." } ;
12
13 HELP: DEC
14 { $values { "dst" "register" } }
15 { $description "Emits a DEC instruction." } ;
16
17 HELP: INC
18 { $values { "dst" "register" } }
19 { $description "Emits an INC instruction." } ;
20
21 HELP: JE
22 { $values { "dst" "destination address or " { $link label } } }
23 { $description "Emits a conditional jump instruction to the given address relative to the current code offset." }
24 { $examples
25   { $unchecked-example
26     "USING: cpu.x86.assembler make ;"
27     "[ 0x0 JE ] B{ } make disassemble"
28     "000000e9fcc71fe0: 0f8400000000  jz dword 0xe9fcc71fe6"
29   }
30 } ;
31
32 HELP: MOV
33 { $values { "dst" "destination" } { "src" "source" } }
34 { $description "Moves a value from one place to another." } ;
35
36 HELP: MOVSX
37 { $values { "dst" "destination" } { "src" "source" } }
38 { $description "Moves a value with sign extension." } ;
39
40 HELP: PEXTRB
41 { $values { "dest" "destination" } { "src" "source" } { "imm" "immediate" } }
42 { $description "Packed extract byte. This instruction copies the byte selected by 'imm' into the first eight bits of the selected register." } ;
43
44 HELP: immediate-1/4
45 { $values { "dst" "dst" } { "imm" "imm" } { "reg,rex.w,opcode" sequence } }
46 { $description "If imm is a byte, compile the opcode and the byte. Otherwise, set the 8-bit operand flag in the opcode, and compile the cell. The 'reg' is not really a register, but a value for the 'reg' field of the mod-r/m byte." } ;
47
48 HELP: zero-extendable?
49 { $values { "imm" integer } { "?" boolean } }
50 { $description "All positive 32-bit numbers are zero extendable except for 0 which is the value used for relocations." } ;
51
52 ARTICLE: "cpu.x86.assembler" "CPU x86 assembler"
53 "This vocab implements an assembler for x86 architectures."
54 $nl
55 "General instructions:"
56 { $subsections DEC INC JE MOV MOVSX }
57 "SSE instructions:"
58 { $subsections PEXTRB } ;
59
60 ABOUT: "cpu.x86.assembler"