Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

mem() function to run gc and return free heap

  • Loading branch information...
commit 4d146fc5bd43fce63cc011b225229eb25c2084f2 1 parent f9f0b47
orlof authored
Showing with 19 additions and 0 deletions.
  1. +1 −0  data.dasm16
  2. +18 −0 parser.dasm16
View
1  data.dasm16
@@ -273,6 +273,7 @@
;----------------------------------------------------------------
:built_in_functions
dat 3, "id", built_in_id
+ dat 4, "mem", built_in_mem
dat 4, "rnd", built_in_rnd
dat 4, "int", built_in_int
dat 4, "str", built_in_str
View
18 parser.dasm16
@@ -2298,6 +2298,24 @@
set pc, postamble
;----------------------------------------------------------------
+:built_in_mem
+;----------------------------------------------------------------
+ jsr built_in_params
+ ifn i, 0
+ jsr recover
+
+ jsr mark
+ jsr compact
+
+ set a, [heap_handle_start]
+ sub a, [heap_free_start]
+
+ set push, a
+ jsr uint16_to_int
+
+ set pc, postamble
+
+;----------------------------------------------------------------
:built_in_locals
;----------------------------------------------------------------
jsr built_in_params
Please sign in to comment.
Something went wrong with that request. Please try again.