1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-12-26 04:48:05 +11:00

8086asm: tidy up a bit

This commit is contained in:
Virgil Dupras 2020-06-13 16:21:56 -04:00
parent 374932fa4d
commit 5033f17be2
4 changed files with 10 additions and 10 deletions

10
blk/753
View File

@ -1,12 +1,12 @@
: OP1 CREATE C, DOES> C@ A, ;
0xac OP1 LODSB, 0xfa OP1 CLI, 0xfb OP1 STI,
0xf4 OP1 HLT, 0xfc OP1 CLD, 0xfd OP1 STD,
( 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, A, ;
: MOVrI, SWAP 0xb0 OR A, SPLITB A, A, ; : MOVrI, SWAP 0xb0 OR A, SPLITB A, A, ;
: MOVsx, 0x8e A, SWAP MODRMrr A, ; : MOVsx, 0x8e A, SWAP MODRMrr A, ;
: INT, 0xcd A, A, ; : INT, 0xcd A, A, ;
( no argument, flow ops are special )
: JMP8, 0xeb A, ; : JMP16, 0xe9 A, ; : JZ, 0x74 A, ;
: JMPr, 0xff A, 7 AND 0xe0 OR A, ; : JMPr, 0xff A, 7 AND 0xe0 OR A, ;
: LODSB, 0xac A, ; : CLI, 0xfa A, ; : HLT, 0xf4 A, ;
: STI, 0xfb A, ;
: ORrr, 0x08 A, MODRMrr A, ; : ORrr, 0x08 A, MODRMrr A, ;
: XORxx, 0x31 A, MODRMrr A, ; : XORxx, 0x31 A, MODRMrr A, ;
: CLD, 0xfc A, ; : STD, 0xfd A, ;

View File

@ -1,4 +1,4 @@
: FWR8 BSET 0 A, ; : FWRs BSET 0 A, ;
: FSET @ THEN, ; : FSET @ THEN, ;
( : BREAK, FJR, 0x8000 OR ; ( : BREAK, FJR, 0x8000 OR ;
: BREAK?, DUP 0x8000 AND IF : BREAK?, DUP 0x8000 AND IF

View File

@ -1,5 +1,5 @@
H@ ORG ! 0x7c00 BIN( ! ( BIOS loads boot bin at 0x7c00 ) H@ ORG ! 0x7c00 BIN( ! ( BIOS loads boot bin at 0x7c00 )
JMP8, L1 FWR8 ( start ) JMPs, L1 FWRs ( start )
ORG @ 0x25 + HERE ! ( bypass BPB ) ORG @ 0x25 + HERE ! ( bypass BPB )
L1 FSET ( start ) L1 FSET ( start )
CLI, CLD, AX AX XORxx, DS AX MOVsx, ES AX MOVsx, CLI, CLD, AX AX XORxx, DS AX MOVsx, ES AX MOVsx,

View File

@ -1,10 +1,10 @@
H@ ORG ! 0x8000 BIN( ! H@ ORG ! 0x8000 BIN( !
JMP8, L1 FWR8 ( start ) JMPs, L1 FWRs ( start )
L2 ( msg ) BSET ," Hello World!" 0 A, L2 ( msg ) BSET ," Hello World!" 0 A,
L1 FSET ( start ) L1 FSET ( start )
SI L2 @ ( msg ) MOVrI, AH 0x0e MOVri, ( print char ) SI L2 @ ( msg ) MOVrI, AH 0x0e MOVri, ( print char )
L1 BSET ( loop ) LODSB, AL AL ORrr, ( end of str? ) L1 BSET ( loop ) LODSB, AL AL ORrr, ( end of str? )
JZ, L2 FWR8 ( next ) 0x10 INT, ( print char ) JZ, L2 FWRs ( next ) 0x10 INT, ( print char )
JMP8, L1 ( loop ) BWR JMPs, L1 ( loop ) BWR
L2 FSET ( next ) AH 0 MOVri, 0x16 INT, ( read kbd ) L2 FSET ( next ) AH 0 MOVri, 0x16 INT, ( read kbd )
AH 0x0e MOVri, 0x10 INT, ( spit read char ) HLT, ( done ) AH 0x0e MOVri, 0x10 INT, ( spit read char ) HLT, ( done )