Annotation of gforth/asm/basic.fs, revision 1.2
1.1 pazsan 1: \ asmbasic.fs basic assebmler definitions
2:
3: [IFUNDEF] assembler Vocabulary assembler [THEN]
1.2 ! pazsan 4: require ./target.fs
1.1 pazsan 5: [IFUNDEF] chained require chains.fs [THEN]
6:
7: \ ---------- Basic Definitions
8:
9: \ (code) and (end-code) are used from interpreter or cross-compiler
10: \ Between (code) and (end-code) must be finished cpu-instructions
11: \ asm[ ... ]asm should or can be used to interrupt assembling
12: \ mode while assembling, the words should switch off and on
13: \ the assembler vocabulary or a special pasring mode
14: \ When using ]asm asm[ a cpu instruction has not to be finished
15:
16: defer ]asm \ turns on assembler mode
17: defer asm[ \ turns off assebmler mode
18:
19: defer (code) \ starts up a assembler passage
20: defer (end-code) \ ends an assembler passage
21:
22: \ Chains
23:
24: \ Numref registers in propper8 (to reset some flags) and in
25: \ end-code8 (for resolving)
26: \ propper should be executed before at assembling start
27: \ and when an intstruction is finished.
28:
29: Variable code8 \ starts assembling
30: 0 code8 !
31:
32: Variable end-code8 \ ends assembling
33: 0 end-code8 !
34:
35: Variable propper8 \ clean up flags for new cpu instructions
36: 0 propper8 !
37:
38: : propper propper8 chainperform ;
39:
40: : ]asm-1
41: also assembler
42: get-order >r = ABORT" Assembler is activated!"
43: r> 2 - 0 ?DO drop LOOP
44: ; ' ]asm-1 IS ]asm
45:
46: : asm[-1
47: also assembler
48: get-order >r <> ABORT" Assembler isn't activated!"
49: r> 2 - 0 ?DO drop LOOP
50: previous previous ; ' asm[-1 IS asm[
51:
52: : (code)-1
53: \ the next input is assebler code witch is stored at dp
54: ]asm
55: propper
56: code8 chainperform
57: ; ' (code)-1 IS (code)
58:
59: : (end-code)-1
60: \ the next code are normal forth definitions
61: end-code8 chainperform
62: asm[ ; ' (end-code)-1 IS (end-code)
63:
64: \ for test purposes
65:
66: [IFUNDEF] there
67: : code create (code) ;
68: : end-code (end-code) ;
69: [THEN]
70:
71: also assembler also definitions forth
72:
73: variable asm-current
74:
75: : end-label (end-code) asm-current @ set-current ;
76: : end-macros previous previous asm-current @ set-current ;
77:
78: \ Macros
79:
80: : : : ;
81: : ; postpone ; ; immediate
82:
83: : label there constant ;
84: : equ constant ;
85:
86: forth definitions
87:
88: : start-macros get-current asm-current ! also forth also assembler definitions ;
89: : label (code) label ;
90:
91: previous previous
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>