cpu.x86.assember: add INC and DEC instructions to the assembler

locals-and-roots
Björn Lindqvist 2016-05-08 18:43:51 +02:00
parent 156fcbb48b
commit 5a2e1c953e
2 changed files with 19 additions and 1 deletions

View 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." }

View 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 ;