1 ;; Native x86 GNU/Linux Forth System, Direct Threaded Code
3 ;; Copyright (C) 2020 Ketmar Dark // Invisible Vector
5 ;; This program is free software: you can redistribute it and/or modify
6 ;; it under the terms of the GNU General Public License as published by
7 ;; the Free Software Foundation, version 3 of the License ONLY.
9 ;; This program is distributed in the hope that it will be useful,
10 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
11 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 ;; GNU General Public License for more details.
14 ;; You should have received a copy of the GNU General Public License
15 ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
17 ;; allocate some memory at HERE (DP or DP-TEMP), return starting address
18 urword_forth
"N-ALLOT",n_allot
19 ;; ( n -- start-addr )
20 UF dup
0less errid_negative_allot qerror
21 UF dup
0x00ffffff ugreat errid_out_of_memory qerror
;; 16MB is quite huge allocation chunk ;-)
29 ;; ( n start-addr dpaddr )
32 ;; ( n start-addr | dpaddr )
34 UF dup dpend @
32768 - ugreat errid_out_of_memory qerror
35 UF temp_pool_here
256 - ugreatequ errid_out_of_memory qerror
39 urword_forth
"(ALIGN-HERE)",par_align_here
41 if URFORTH_ALIGN_HEADERS
44 UF
4 swap
- dup n_allot swap erase
49 urword_forth
"ALLOT",allot
54 urword_code
"USED",used
57 mov TOS
,[fvar_dp_data
]
58 sub TOS
,[fconst_par_code_base_addr_data
]
62 urword_code
"UNUSED",unused
65 mov TOS
,[fvar_dpend_data
]
66 sub TOS
,[fvar_dp_data
]
67 sub TOS
,32768 ; reserved area
71 urword_code
"HERE",here
74 ld TOS
,[fvar_dp_temp_data
]
76 cmovz TOS
,[fvar_dp_data
]
80 urword_code
"REAL-HERE",real_here
90 mov TOS
,[fvar_pad_area_data
]
95 urword_forth
"C,",ccomma
101 urword_forth
"W,",wcomma
107 urword_forth
",",comma