' **************************************
' ***  Public Domain by Kevin Mason  ***
' ***    GFA Basic 3.5  26 Jun 92    ***
' ***      Reserve / Malloc demo     ***
' **************************************
'
LPRINT "Command","Memory","Comments"
LPRINT
LPRINT "FRE(0)",FRE(0),"start total memory available to GFA"
LPRINT "MALLOC(-1)",MALLOC(-1),"start total memory for SYSTEM"
RESERVE 8000
LPRINT "RESERVE 8000",,"Reduce GFA memory to ~8000 bytes"
LPRINT "FRE(0)",FRE(0),"New available GFA memory"
LPRINT "MALLOC(-1)",MALLOC(-1),"Total memory released to SYSTEM"
DIM a%(200)
LPRINT "DIM a%(200)",,"make INT array in GFA memory (4*200 bytes)"
LPRINT "FRE(0)",FRE(0),"GFA memory still available"
LPRINT "MALLOC(-1)",MALLOC(-1),"SYSTEM memory remains untouched"
memblock_adr1%=MALLOC(32256)
LPRINT "adr%=MALLOC(32256)","make block SYSTEM memory of ~32K"
LPRINT "FRE(0)",FRE(0),"GFA memory remains untouched"
LPRINT "MALLOC(-1)",MALLOC(-1),"New total SYSTEM memory now available"
~MFREE(memblock_adr1%)
RESERVE
LPRINT "MFREE(adr%)",,"undo Malloc"
LPRINT "RESERVE",,"undo Reserve"
