[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: MLI OPEN in BASIC under P8



In article <adri0001.736795801@student.tc.umn.edu> adri0001@student.tc.umn.edu
(Jennifer A Adrian-1) writes:
>[MLI OPEN call isn't working under BASIC]
>Okay, my code is in memory that is above HIMEM and as such is marked as
>'in use' in the P8 system bit map.  That means that the data section of my
>code also resides above HIMEM and therefore is also marked as 'in use' by
>the system bit map.  I first tried to put my parameter table in my data
>section, but after getting $56 errors (an error returned when one tries to
>access memory marked as busy by the system bit map), I figured the 
>parameter table needs to be somewhere else.
>
>So, I started looking in my manuals and I remembered BASIC.SYSTEM also has
>a global page and when I did more looking, low and behold, I found parameter
>tables in the global page!  So, I located the parameter table for the OPEN
>call and filled it with all the info I needed.  I'm still having problems.

Hmm...Are you putting the open-file buffer or the pathname in a place that
ProDOS has marked as reserved (in the data area of your code, for example)?
If so, I suppose that could be causing a problem.

I've written a couple of BASIC.SYSTEM external commands, with code above
HIMEM, and never had any problem opening files in them.  I used
BASIC.SYSTEM's scratch buffer (which begins at HIMEM) for the open-file
buffer...this works just fine as long as long as BASIC.SYSTEM doesn't try
to open a file while yours is still open (this means you need to open your
file, do your work, and close it before passing control back to BASIC).

For the parameter list, I used BASIC.SYSTEM's OPEN parameter list.  For the
pathname, BASIC.SYSTEM provides a buffer at the location pointed to by
VPATH1 ($BE6C)--if you use it, you won't even need to set up the pathname
pointer in the OPEN parameter list, since it points to this buffer by
default (and if you do change the pathname pointer, you should remember to
change it back when you're done--I don't know whether or not BASIC.SYSTEM
is smart enough to re-initialize this pointer for its own use, but I
wouldn't count on it).

If you use BASIC.SYSTEM's parameter list, you don't even need to bother
setting up pointers to it to make the MLI call--just load the call number
into the A-register, and JSR $BE70.  The routine at $BE70 ("GOSYSTEM")
knows where BASIC.SYSTEM's parameter lists are in memory, and will
automatically pick the correct one.  You need to watch out for the fact
that GOSYSTEM can't perform ALLOC_INTERRUPT, DEALLOC_INTERRUPT, QUIT,
READ_BLOCK, WRITE_BLOCK, or GET_TIME, and the fact that if an error occurs,
you'll get a BASIC.SYSTEM error code rather than a MLI error code.

              - Neil Parker
--
Neil Parker                 No cute ASCII art...no cute quote...no cute
nparker@cie.uoregon.edu     disclaimer...no deposit, no return...
parker@corona.uoregon.edu   (This space intentionally left blank:           )