duskos

dusk os fork
git clone git://git.alexwennerberg.com/duskos
Log | Files | Refs | README | LICENSE

commit 3ecebfc0ff6fa29ed6e9fe36979b92610a453374
parent 971baa3ea5cf1278fb9a369948d4181127a340f0
Author: Virgil Dupras <hsoft@hardcoded.net>
Date:   Sat, 25 Jun 2022 06:32:18 -0400

Add ".free" to know about remaining "here" space

Diffstat:
Mdusk.asm | 6+++++-
Mfs/init.fs | 2+-
Mfs/lib/core.fs | 4++++
Mfs/tests/harness.fs | 2+-
4 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/dusk.asm b/dusk.asm @@ -75,7 +75,7 @@ ps_top: resd RS_SZ rs_top: herestart: resb MEMSIZE - +heremax: SECTION .data bootsrc: incbin "boot.fs" rootfspath: db "fs", 0 @@ -560,6 +560,10 @@ defword 'current', 7, word_current defword 'here', 4, word_here sysval here +defword 'heremax', 7, word_heremax + pspush heremax + ret + defword 'compiling', 9, word_compiling sysval compiling diff --git a/fs/init.fs b/fs/init.fs @@ -3,5 +3,5 @@ f<< lib/core.fs f<< lib/annotate.fs f<< sys/doc.fs f<< sys/rdln.fs -: init S" Dusk OS" stype rdln$ ; +: init S" Dusk OS" stype nl> .free rdln$ ; init diff --git a/fs/lib/core.fs b/fs/lib/core.fs @@ -122,6 +122,10 @@ create _ ," KMG" : .S ( -- ) S" SP " stype scnt .x1 spc> S" RS " stype rcnt .x1 spc> S" -- " stype stack? psdump ; +: .free + here ['] 2drop ( first word in boot.fs ) - .sz ." used " + heremax here - .sz ." free" ; + : dump ( a -- ) \ dump 8 lines of data after "a" A>r >A 8 >r begin ':' emit A> dup .x spc> ( a ) diff --git a/fs/tests/harness.fs b/fs/tests/harness.fs @@ -20,4 +20,4 @@ create _buf $100 allot : #s= ( s1 s2 -- ) 2dup s= if 2drop else swap stype ." != " stype abort then ; : testbegin 1 to fecho ; -: testend 0 to fecho scnt 0 #eq ; +: testend .S nl> .free nl> 0 to fecho scnt 0 #eq ;