]> gitweb.factorcode.org Git - factor.git/commitdiff
cpu.x86.assember: add INC and DEC instructions to the assembler
authorBjörn Lindqvist <bjourne@gmail.com>
Sun, 8 May 2016 16:43:51 +0000 (18:43 +0200)
committerBjörn Lindqvist <bjourne@gmail.com>
Sun, 8 May 2016 16:43:51 +0000 (18:43 +0200)
basis/cpu/x86/assembler/assembler-docs.factor
basis/cpu/x86/assembler/assembler.factor

index 6c1ecb5a570beef9ea338b39bfac02ea8f43d12d..8a6228655dc7de34b5323b7fbf605678b49f6238 100644 (file)
@@ -1,7 +1,19 @@
 USING: compiler.codegen.labels cpu.x86.assembler.private help.markup
-help.syntax ;
+help.syntax sequences ;
 IN: cpu.x86.assembler
 
+HELP: 1-operand
+{ $values { "operand" "operand" } { "reg,rex.w,opcode" sequence } }
+{ $description "Used for encoding some instructions with one operand." } ;
+
+HELP: DEC
+{ $values { "dst" "register" } }
+{ $description "Emits a DEC instruction." } ;
+
+HELP: INC
+{ $values { "dst" "register" } }
+{ $description "Emits an INC instruction." } ;
+
 HELP: JE
 { $values { "dst" "destination address or " { $link label } } }
 { $description "Emits a conditional jump instruction to the given address relative to the current code offset." }
index 643306013b1af71f554581e58a0219ff4a7c5943..68f87071764b81ae185c642f7773c09fd0423b70 100644 (file)
@@ -336,6 +336,12 @@ GENERIC: SUB ( dst src -- )
 M: immediate SUB { 0b101 t 0x80 } immediate-1/4 ;
 M: operand SUB 0o050 2-operand ;
 
+: INC ( dst -- )
+    { 0b000 t 0xff } 1-operand ;
+
+: DEC ( dst -- )
+    { 0b001 t 0xff } 1-operand ;
+
 GENERIC: XOR ( dst src -- )
 M: immediate XOR { 0b110 t 0x80 } immediate-1/4 ;
 M: operand XOR 0o060 2-operand ;