\ saver.fs

0 [if]
Copyright (C) 2004 by Charles Shattuck.

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

For LGPL information:   http://www.gnu.org/copyleft/lesser.txt
For application information:   http://www.amresearch.com

[then]

include amr/bin2hex.fs

0 value bc-fid
: >hex   ( c - a l)   base @ >r hex  0 <# # # #> r> base ! ;
create 'crlf 13 c, 10 c,
create 'bl 32 c,

: save  (  - )
	0 to bc-fid   s" chip.bin" delete-file drop
	s" chip.bin" r/w create-file abort" Error creating chip.bin"
	to bc-fid target-image target-size
	bc-fid write-file abort" Error writing chip.bin"
	bc-fid close-file abort" Error closing chip.bin"
	save-chip.hex ;

