-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathFCODE.ASM
More file actions
101 lines (77 loc) · 2.61 KB
/
FCODE.ASM
File metadata and controls
101 lines (77 loc) · 2.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
; ---------------------------------------------------------------------------
; The enviromment for the F-Code programs' execution
; Version 1.0
; Copyright (c) by Alexander Demin
; ---------------------------------------------------------------------------
.model tiny
.386
.code
DataStkSize equ 1024
RetStkSize equ 256
include Macros.inc
include ExpConds.inc
IfNDef DEBUG ; COM-file mode ?
org 100h
Endif
.StartUp
IfDef DEBUG ; Debug EXE-file mode ?
push cs cs
pop ds es
Endif
lea sp, DataStack-2
mov RP$, offset RetStack
mov IP$, offset Program
next
IP$ dw 0 ; Instruction Pointer
RP$ dw 0 ; Ret-stack Pointer
Tmp$ dw 0
Registers label word
emDI dw 0
emSI dw 0
emBP dw 0
emSP dw 0
emBX dw 0
emDX dw 0
emCX dw 0
emAX dw 0
emFlags dw 0
; ===========================================================================
; F-Code Address Interpreter
; Get next link
GetNext$: cld
mov si, IP$
lodsw
mov IP$, si
retn
; Execute CALL-intruction
CALLR$: add RP$, 2
mov bp, RP$
mov ax, IP$
mov [bp], ax
pop word ptr IP$
next
; Execute RET-intruction
RETR$: mov bp, RP$
mov ax, [bp]
mov IP$, ax
sub RP$, 2
next
; Execute next link
NEXT$: call GetNext$
jmp ax
; Push the next link in the data-stack
osPush$: call GetNext$
push ax
next
; ===========================================================================
Include Asmes.inc ; Assembler's routines
Include FProc.inc ; F-Code routines
Include FTest.Pre ; User's program
RetStack label word
org $+RetStkSize*2
StackLimit label word
org $+(DataStkSize-1)*2
DataStack label word
org $+2
Buffer label byte
end