1: \ asmbasic.fs basic assebmler definitions
2:
3: \ Copyright (C) 1998,2000,2003,2007 Free Software Foundation, Inc.
4:
5: \ This file is part of Gforth.
6:
7: \ Gforth is free software; you can redistribute it and/or
8: \ modify it under the terms of the GNU General Public License
9: \ as published by the Free Software Foundation, either version 3
10: \ of the License, or (at your option) any later version.
11:
12: \ This program is distributed in the hope that it will be useful,
13: \ but WITHOUT ANY WARRANTY; without even the implied warranty of
14: \ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15: \ GNU General Public License for more details.
16:
17: \ You should have received a copy of the GNU General Public License
18: \ along with this program. If not, see http://www.gnu.org/licenses/.
19:
20: [IFUNDEF] assembler Vocabulary assembler [THEN]
21: require ./target.fs
22: [IFUNDEF] chained require chains.fs [THEN]
23:
24: \ ---------- Basic Definitions
25:
26: \ (code) and (end-code) are used from interpreter or cross-compiler
27: \ Between (code) and (end-code) must be finished cpu-instructions
28: \ asm[ ... ]asm should or can be used to interrupt assembling
29: \ mode while assembling, the words should switch off and on
30: \ the assembler vocabulary or a special pasring mode
31: \ When using ]asm asm[ a cpu instruction has not to be finished
32:
33: defer ]asm \ turns on assembler mode
34: defer asm[ \ turns off assebmler mode
35:
36: defer (code) \ starts up a assembler passage
37: defer (end-code) \ ends an assembler passage
38:
39: \ Chains
40:
41: \ Numref registers in propper8 (to reset some flags) and in
42: \ end-code8 (for resolving)
43: \ propper should be executed before at assembling start
44: \ and when an intstruction is finished.
45:
46: Variable code8 \ starts assembling
47: 0 code8 !
48:
49: Variable end-code8 \ ends assembling
50: 0 end-code8 !
51:
52: Variable propper8 \ clean up flags for new cpu instructions
53: 0 propper8 !
54:
55: : propper propper8 chainperform ;
56:
57: : ]asm-1
58: also assembler
59: get-order >r = ABORT" Assembler is activated!"
60: r> 2 - 0 ?DO drop LOOP
61: ; ' ]asm-1 IS ]asm
62:
63: : asm[-1
64: also assembler
65: get-order >r <> ABORT" Assembler isn't activated!"
66: r> 2 - 0 ?DO drop LOOP
67: previous previous ; ' asm[-1 IS asm[
68:
69: : (code)-1
70: \ the next input is assebler code witch is stored at dp
71: ]asm
72: propper
73: code8 chainperform
74: ; ' (code)-1 IS (code)
75:
76: : (end-code)-1
77: \ the next code are normal forth definitions
78: end-code8 chainperform
79: asm[ ; ' (end-code)-1 IS (end-code)
80:
81: \ for test purposes
82:
83: [IFUNDEF] there
84: : code create (code) ;
85: : end-code (end-code) ;
86: [THEN]
87:
88: also assembler also definitions forth
89:
90: variable asm-current
91:
92: : end-label (end-code) asm-current @ set-current ;
93: : end-macros previous previous asm-current @ set-current ;
94:
95: \ Macros
96:
97: : : : ;
98: : ; postpone ; ; immediate
99:
100: : label there constant ;
101: : equ constant ;
102:
103: forth definitions
104:
105: : start-macros get-current asm-current ! also forth also assembler definitions ;
106: : label (code) label ;
107:
108: previous previous
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>