home *** CD-ROM | disk | FTP | other *** search
- \ BINSAVE.SEQ Save Target Binary Image by Andrew McKewan
-
- ONLY FORTH ALSO DEFINITIONS COMPILER ALSO
-
- : ?cerrors ( -- f1 )
- cerrors dup
- if cr ." \3 Image not saved \2 COMPILE ERRORS! "
- cr here-t code-start - 5 .r ." Bytes compiled" cr
- then ;
-
- : save-image.bin ( -- )
- ?cerrors ?exit
- #unres
- if cr ." \3 Image not saved \0, some symbols \2 UNRESOLVED! "
- cr here-t code-start - 5 .r ." Bytes compiled"
- else image.name targethndl $>handle
- " BIN" ">$ targethndl $>ext
- targethndl hcreate \ make image.com
- if 0 " Error while creating object file." "errmsg2
- abort
- then
- cr cr ." Created object file - " targethndl count type
- \ data-seg-fix \ adjust HERE-T and fix
- \ \ DATA segment alignment
- \ dp-set \ set targets DP
- \ code-start here-t over - dup>r
- 0 $2000 dup>r ( always write 8K )
- targethndl seg-code exhwrite r> - \ write CODE
- if 0 " Error while saving CODE to object file."
- "errmsg2 abort
- then
- cr ." Wrote " here-t code-start - ( dup>r ) 5 u.r
- ." Bytes of CODE." \ rounded up to Paragraph."
- \ data-origin here-d
- \ targethndl seg-code exhwrite here-d -
- \ if 0 " Error while saving DATA to executable file."
- \ "errmsg2 abort
- \ then
- \ cr ." Wrote " here-d data-start - 5 u.r ." Bytes of DATA, "
- \ here-d r> + 5 u.r ." Bytes total.
- then cr ;
-
- ' SAVE-IMAGE.BIN IS SAVE-IMAGE.COM
-
-
-
-