From f5a951801eb86a3a388aaa299734dae9ecd55239 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Tue, 18 May 2010 17:10:32 -0400 Subject: [PATCH] cpu.x86.assembler: AH CH DH BH register operands now work properly --- .../cpu/x86/assembler/assembler-tests.factor | 10 +++++++++- basis/cpu/x86/assembler/assembler.factor | 8 +++++++- .../x86/assembler/operands/operands.factor | 5 +---- basis/cpu/x86/assembler/syntax/syntax.factor | 20 ++++++++++++------- 4 files changed, 30 insertions(+), 13 deletions(-) diff --git a/basis/cpu/x86/assembler/assembler-tests.factor b/basis/cpu/x86/assembler/assembler-tests.factor index 8711c4d28f..1c9d2422a2 100644 --- a/basis/cpu/x86/assembler/assembler-tests.factor +++ b/basis/cpu/x86/assembler/assembler-tests.factor @@ -2,6 +2,15 @@ USING: cpu.x86.assembler cpu.x86.assembler.operands kernel tools.test namespaces make layouts ; IN: cpu.x86.assembler.tests +! small registers +[ { 128 192 12 } ] [ [ AL 12 ADD ] { } make ] unit-test +[ { 128 196 12 } ] [ [ AH 12 ADD ] { } make ] unit-test +[ { 176 12 } ] [ [ AL 12 MOV ] { } make ] unit-test +[ { 180 12 } ] [ [ AH 12 MOV ] { } make ] unit-test +[ { 198 0 12 } ] [ [ EAX [] 12 MOV ] { } make ] unit-test +[ { 0 235 } ] [ [ BL CH ADD ] { } make ] unit-test +[ { 136 235 } ] [ [ BL CH MOV ] { } make ] unit-test + ! immediate operands cell 4 = [ [ { HEX: b9 HEX: 01 HEX: 00 HEX: 00 HEX: 00 } ] [ [ ECX 1 MOV ] { } make ] unit-test @@ -205,7 +214,6 @@ cell 4 = [ [ { HEX: 0f HEX: a3 HEX: 18 } ] [ [ EAX [] EBX BT ] { } make ] unit-test ! x87 instructions - [ { HEX: D8 HEX: C5 } ] [ [ ST0 ST5 FADD ] { } make ] unit-test [ { HEX: DC HEX: C5 } ] [ [ ST5 ST0 FADD ] { } make ] unit-test [ { HEX: D8 HEX: 00 } ] [ [ ST0 EAX [] FADD ] { } make ] unit-test diff --git a/basis/cpu/x86/assembler/assembler.factor b/basis/cpu/x86/assembler/assembler.factor index 1cb8f67aa6..b34ffeedd3 100644 --- a/basis/cpu/x86/assembler/assembler.factor +++ b/basis/cpu/x86/assembler/assembler.factor @@ -214,7 +214,13 @@ M: operand POP { BIN: 000 f HEX: 8f } 1-operand ;