From 507c2c12e7c6850c04305a2b1d55975cb65041ad Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Sat, 13 Jun 2020 17:58:42 -0400 Subject: [PATCH] 8086asm: clarify operands and fix stupidities --- blk/730 | 16 ++++++++-------- blk/751 | 4 ++-- blk/752 | 2 -- blk/753 | 8 ++++---- blk/811 | 6 +++--- blk/812 | 2 +- 6 files changed, 18 insertions(+), 20 deletions(-) diff --git a/blk/730 b/blk/730 index 903d983..56e8271 100644 --- a/blk/730 +++ b/blk/730 @@ -2,15 +2,15 @@ Work in progress. Load with "750 LOAD". +Mnemonics are followed by argument types. For example, MOVri, +moves 8-bit immediate to 8-bit register. +'r' = 8-bit register 'x' = 16-bit register +'i' = immediate, size depends on other operand. +'s' = SREG register +Mnemonics that only have one signature (for example INT,) don't +have operands letters. - - - - - - - - +For jumps, it's special. 's' is SHORT, 'n' is NEAR, 'f' is FAR. diff --git a/blk/751 b/blk/751 index 26ad59c..206a609 100644 --- a/blk/751 +++ b/blk/751 @@ -3,6 +3,6 @@ CREATE BIN( 0 , : BIN(+ BIN( @ + ; VARIABLE L1 VARIABLE L2 VARIABLE L3 VARIABLE L4 : AL 0 ; : CL 1 ; : DL 2 ; : BL 3 ; : AH 4 ; : CH 5 ; : DH 6 ; : BH 7 ; -: AX 8 ; : CX 9 ; : DX 10 ; : BX 11 ; -: SP 12 ; : BP 13 ; : SI 14 ; : DI 15 ; +: AX 0 ; : CX 1 ; : DX 2 ; : BX 3 ; +: SP 4 ; : BP 5 ; : SI 6 ; : DI 7 ; : ES 0 ; : CS 1 ; : SS 2 ; : DS 3 ; diff --git a/blk/752 b/blk/752 index ba65af0..b70ebe0 100644 --- a/blk/752 +++ b/blk/752 @@ -4,5 +4,3 @@ ; : PC H@ ORG @ - BIN( @ + ; : 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 ed9f937..3d94270 100644 --- a/blk/753 +++ b/blk/753 @@ -4,9 +4,9 @@ ( no argument, jumps with abs addrs are special ) 0xeb OP1 JMPs, 0xe9 OP1 JMPn, 0x74 OP1 JZ, : MOVri, SWAP 0xb0 OR A, A, ; -: MOVrI, SWAP 0xb0 OR A, SPLITB A, A, ; -: MOVsx, 0x8e A, SWAP MODRMrr A, ; +: MOVxi, SWAP 0xb8 OR A, SPLITB A, A, ; +: MOVsx, 0x8e A, SWAP 3 LSHIFT OR 0xc0 OR A, ; : INT, 0xcd A, A, ; : JMPr, 0xff A, 7 AND 0xe0 OR A, ; -: ORrr, 0x08 A, MODRMrr A, ; -: XORxx, 0x31 A, MODRMrr A, ; +: OPrr CREATE C, DOES> C@ A, 3 LSHIFT OR 0xc0 OR A, ; +0x31 OPrr XORxx, 0x08 OPrr ORrr, diff --git a/blk/811 b/blk/811 index 1b8d2e7..9007b24 100644 --- a/blk/811 +++ b/blk/811 @@ -3,8 +3,8 @@ JMPs, L1 FWRs ( start ) ORG @ 0x25 + HERE ! ( bypass BPB ) L1 FSET ( start ) CLI, CLD, AX AX XORxx, DS AX MOVsx, ES AX MOVsx, -SS AX MOVsx, SP 0xffff MOVrI, STI, -AH 2 MOVri, DX 0 MOVrI, CH 0 MOVri, CL 2 MOVri, AL 1 MOVri, -BX 0x8000 MOVrI, 0x13 INT, ( read 2nd sector of boot floppy ) +SS AX MOVsx, SP 0xffff MOVxi, STI, +AH 2 MOVri, DX 0 MOVxi, CH 0 MOVri, CL 2 MOVri, AL 1 MOVri, +BX 0x8000 MOVxi, 0x13 INT, ( read 2nd sector of boot floppy ) BX JMPr, ORG @ 0x1fe + HERE ! 0x55 A, 0xaa A, diff --git a/blk/812 b/blk/812 index 768fb96..a109fef 100644 --- a/blk/812 +++ b/blk/812 @@ -2,7 +2,7 @@ H@ ORG ! 0x8000 BIN( ! JMPs, L1 FWRs ( start ) L2 ( msg ) BSET ," Hello World!" 0 A, L1 FSET ( start ) -SI L2 @ ( msg ) MOVrI, AH 0x0e MOVri, ( print char ) +SI L2 @ ( msg ) MOVxi, AH 0x0e MOVri, ( print char ) L1 BSET ( loop ) LODSB, AL AL ORrr, ( end of str? ) JZ, L2 FWRs ( next ) 0x10 INT, ( print char ) JMPs, L1 ( loop ) BWR