[Coco] 6809 File I/O
Derek John Evans
derek.john.evans at hotmail.com
Sat Mar 18 15:54:32 EDT 2017
Ive coded this for WinCMOC.
The basic crunch code is here:
https://sourceforge.net/p/cmoc-win32/code/HEAD/tree/src/lib/system/system_crunch.c
The BASIC execute code is here:
https://sourceforge.net/p/cmoc-win32/code/HEAD/tree/src/lib/system/system_execute.c
Higher up I have systemex()
https://sourceforge.net/p/cmoc-win32/code/HEAD/tree/src/lib/stdlib/systemex.c
The problem with calling BASIC this way, is it returns to the command line on error (exception). So, WinCMOC patches into the basic error system and implements a try/catch language extension.
The highest level is systemf(), which is really cool.
https://sourceforge.net/p/cmoc-win32/code/HEAD/tree/src/lib/stdlib/systemf.c
rename() -> systemf("RENAME\"%s\"TO\"%s\"", f1, f2);
remove() -> systemf("KILL\"%s\"", fn);
Ive managed to be able to call most of the ExBASIC comands and even Super BASIC commands.
https://sourceforge.net/p/cmoc-win32/code/HEAD/tree/src/lib/basic/
eg:
SAVEM -> systemf("SAVEM\"%s\",%u,%u,%u", fn, start, finish, exec);
LOADM -> systemf("LOADM\"%s\",%u", fn, offset);
The trick was to get around that BASIC error handling using a setjmp()/longjmp() exception catching.
________________________________
From: Coco <coco-bounces at maltedmedia.com> on behalf of Arthur Flexser <flexser at fiu.edu>
Sent: Sunday, 19 March 2017 4:26 AM
To: CoCoList for Color Computer Enthusiasts
Subject: Re: [Coco] 6809 File I/O
A technique some have used is essentially to construct a Basic line within
your assembly program like <LOAD token>+M+<"filename"> for LOADM"filename"
and point Basic's line input routine at it and have Basic execute the
command before returning to the rest of your assembly code. This avoids
compatibility problems with different disk ROM versions.
I recall that there was an article about this in one of the CoCo magazines
(Rainbow?) a very long time ago; maybe someone can supply a reference.
Art
On Sat, Mar 18, 2017 at 11:00 AM, Peter Cetinski <pete at pski.net> wrote:
> Can anyone point me to some good 6809 assembly examples of disk file i/o
> using RS-DOS? The only examples I could find are in the EDTASM+ manual but
> I haven’t been successful in getting those working. Not sure if they are
> broken or I am broken! :)
>
> Thanks
>
> --
> Coco mailing list
> Coco at maltedmedia.com
> https://pairlist5.pair.net/mailman/listinfo/coco
CoCoList for Color Computer Enthusiasts - pairlist5.pair.net<https://pairlist5.pair.net/mailman/listinfo/coco>
pairlist5.pair.net
This is a list for enthusiasts of the Color Computer in all its forms, its clones, and its software. To see the collection of prior postings to the list ...
>
--
Coco mailing list
Coco at maltedmedia.com
https://pairlist5.pair.net/mailman/listinfo/coco
CoCoList for Color Computer Enthusiasts - pairlist5.pair.net<https://pairlist5.pair.net/mailman/listinfo/coco>
pairlist5.pair.net
This is a list for enthusiasts of the Color Computer in all its forms, its clones, and its software. To see the collection of prior postings to the list ...
More information about the Coco
mailing list