8086asm: clarify operands and fix stupidities
This commit is contained in:
parent
5033f17be2
commit
507c2c12e7
16
blk/730
16
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.
|
||||
|
||||
|
4
blk/751
4
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 ;
|
||||
|
2
blk/752
2
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 ;
|
||||
|
8
blk/753
8
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,
|
||||
|
6
blk/811
6
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,
|
||||
|
2
blk/812
2
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
|
||||
|
Loading…
Reference in New Issue
Block a user