A-M baby
This commit is contained in:
parent
764da6cbbb
commit
db842d013d
19005 changed files with 197040 additions and 7 deletions
10
Task/Memory-allocation/Forth/memory-allocation-1.fth
Normal file
10
Task/Memory-allocation/Forth/memory-allocation-1.fth
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
unused . \ memory available for use in dictionary
|
||||
here . \ current dictionary memory pointer
|
||||
: mem, ( addr len -- ) here over allot swap move ;
|
||||
: s, ( str len -- ) here over char+ allot place align ; \ built-in on some forths
|
||||
: ," [char] " parse s, ;
|
||||
variable num
|
||||
create array 60 cells allot
|
||||
create struct 0 , 10 , char A c, ," string"
|
||||
unused .
|
||||
here .
|
||||
5
Task/Memory-allocation/Forth/memory-allocation-2.fth
Normal file
5
Task/Memory-allocation/Forth/memory-allocation-2.fth
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
marker foo
|
||||
: temp ... ;
|
||||
create dummy 300 allot
|
||||
-150 allot \ trim the size of dummy by 150 bytes
|
||||
foo \ removes foo, temp, and dummy from the list of definitions
|
||||
3
Task/Memory-allocation/Forth/memory-allocation-3.fth
Normal file
3
Task/Memory-allocation/Forth/memory-allocation-3.fth
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
4096 allocate throw ( addr )
|
||||
dup 4096 erase
|
||||
( addr ) free throw
|
||||
Loading…
Add table
Add a link
Reference in a new issue