mirror of
https://github.com/hsoft/collapseos.git
synced 2024-12-25 16:18:06 +11:00
8086asm: add 8-bit JMP, MOVrI, INT,
Verified against nasm with equivalent code.
This commit is contained in:
parent
405444d630
commit
749fdf1b18
9
blk/731
9
blk/731
@ -1,2 +1,9 @@
|
||||
H@ ORG !
|
||||
JMP8, L1 FWR8 ( start )
|
||||
L2 BSET ( msg )
|
||||
," Hello, World!" 0 A,
|
||||
L1 FSET ( start )
|
||||
AH 0x42 MOVri,
|
||||
8 H@ 2 - DUMP
|
||||
0x10 INT,
|
||||
SI L2 @ ( msg ) MOVrI,
|
||||
PC ORG @ DUMP
|
||||
|
1
blk/751
1
blk/751
@ -1,4 +1,5 @@
|
||||
VARIABLE ORG
|
||||
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 ;
|
||||
|
5
blk/753
5
blk/753
@ -1 +1,6 @@
|
||||
: MOVri, SWAP 0xb0 OR A, A, ;
|
||||
: MOVrI, SWAP 0xb0 OR A, 256 /MOD A, A, ;
|
||||
: INT, 0xcd A, A, ;
|
||||
( no argument, flow ops are special )
|
||||
: JMP8, 0xeb A, ;
|
||||
: JMP16, 0xe9 A, ;
|
||||
|
17
blk/754
Normal file
17
blk/754
Normal file
@ -0,0 +1,17 @@
|
||||
( Place BEGIN, where you want to jump back and AGAIN after
|
||||
a relative jump operator. Just like BSET and BWR. )
|
||||
: BEGIN, PC ;
|
||||
: BSET PC SWAP ! ;
|
||||
( same as BSET, but we need to write a placeholder )
|
||||
( : FJR, PC 0 A, ;
|
||||
: IFZ, JRNZ, FJR, ;
|
||||
: IFNZ, JRZ, FJR, ;
|
||||
: IFC, JRNC, FJR, ;
|
||||
: IFNC, JRC, FJR, ; )
|
||||
: THEN,
|
||||
DUP PC ( l l pc )
|
||||
-^ ( l off )
|
||||
( warning: l is a PC offset, not a mem addr! )
|
||||
SWAP ORG @ + ( BIN( @ - ) ( off addr )
|
||||
C! ;
|
||||
|
Loading…
Reference in New Issue
Block a user