From 210b833c71723f9b31da92413777f6fdb8fd2c0e Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Fri, 12 Jun 2020 12:07:48 -0400 Subject: [PATCH] 8086asm: begin adding MODRM-enabled ops --- blk/731 | 7 ++++++- blk/752 | 6 ++++++ blk/753 | 5 ++++- blk/754 | 3 +-- 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/blk/731 b/blk/731 index 118cab3..2373fc5 100644 --- a/blk/731 +++ b/blk/731 @@ -3,7 +3,12 @@ JMP8, L1 FWR8 ( start ) L2 BSET ( msg ) ," Hello, World!" 0 A, L1 FSET ( start ) -AH 0x42 MOVri, +CLI, +AH 0 MOVri, +AL 2 MOVri, 0x10 INT, SI L2 @ ( msg ) MOVrI, +AH 0x0e MOVri, +LODSB, +AL AL ORrr, PC ORG @ DUMP diff --git a/blk/752 b/blk/752 index 9632cf1..7bf1c28 100644 --- a/blk/752 +++ b/blk/752 @@ -1,2 +1,8 @@ +( Splits word into msb/lsb, lsb being on TOS ) +: SPLITB + 256 /MOD SWAP +; : PC H@ ORG @ - ; : A, C, ; +( dst8 src8 -- modrm ) +: MODRMrr 0x7 AND 3 LSHIFT SWAP 0x7 AND OR 0xc0 OR ; diff --git a/blk/753 b/blk/753 index 4890729..559be80 100644 --- a/blk/753 +++ b/blk/753 @@ -1,6 +1,9 @@ : MOVri, SWAP 0xb0 OR A, A, ; -: MOVrI, SWAP 0xb0 OR A, 256 /MOD A, A, ; +: MOVrI, SWAP 0xb0 OR A, SPLITB A, A, ; : INT, 0xcd A, A, ; ( no argument, flow ops are special ) : JMP8, 0xeb A, ; : JMP16, 0xe9 A, ; +: LODSB, 0xac A, ; +: CLI, 0xfa A, ; +: ORrr, 0x08 A, MODRMrr A, ; diff --git a/blk/754 b/blk/754 index f3b5237..bbfd6b3 100644 --- a/blk/754 +++ b/blk/754 @@ -10,8 +10,7 @@ : IFNC, JRC, FJR, ; ) : THEN, DUP PC ( l l pc ) - -^ ( l off ) + -^ 1- ( l off ) ( warning: l is a PC offset, not a mem addr! ) SWAP ORG @ + ( BIN( @ - ) ( off addr ) C! ; -