On Mon, Aug 15, 2022 at 2:04 PM John R. Hogerhuis <[email protected]> wrote:

> In fact if you don't CLEAR before load or launch the CO it will fail no
> matter what, error BEEP and show the Load, Length and EXE address.
>

The hint about the error BEEP was exactly right.

I just tried SAVEM "FOO.CO", 0, 0 on my Tandy 200 and it created a seven
byte file which gives an Out of Memory error when LOADMed. Presuming the
error behaviour is the same on the other platforms, I think setting the
Load Address to 0 is perfect for preventing people from accidentally
running a data file as code.



> I'm trying to avoid duplicating the file in memory. Has anybody ever tried
>> first creating a .DO file of the correct size in BASIC and then twiddling
>> the RAM Directory's attribute byte so that it is a binary file?
>>
>
> You cannot do that. The BA, DO and CO regions are separate contiguous
> blocks. You'd have to move the file bytes if you changed its type. Which is
> a whole thing.
>

Thanks for explaining that to me. I'll start with a .CO file.



> To create a CO file:
> First,  CLEAR space at some location. [...]
> After you have a safe area, you can poke your data to it.
> Then you can SAVE it as a file. This command is different on different
> BASICs.
>

Wouldn't clearing space and poking data before creating the file require
twice as much RAM? Couldn't I do it in reverse?

   1. SAVEM "FOO", 0, 16383
   2. Get address of "FOO.CO" from Ram Directory
   3. POKE data directly into RAM

I'm guessing there's a reason people don't do it that way that I'm just not
seeing.


As to having one program run on M100, T200 and NEC... be advised that is
> tricky if it's even possible. Their BASICs are different, and there ROMs
> are different and their RAM offsets are different.
>

Thanks for the warning. I'm hopeful this program will be the exception. I
solved the PRINT@ / LOCATE problem using Esc Y, the program doesn't use ROM
calls, and I've found the Ram Directory offsets for all Tandys and NECs.

My current cross-platform problem is the seemingly simple question of how
to find the year from BASIC in a way that works with both American
(MM/DD/YY) and European (YY/MM/DD) style DATE$. If anybody happens to know
the standard best practice for that, I'd love to hear it. I had been trying
to associate the value from PEEK(1) with the YEAR location in RAM, but the
NEC 8300 has foiled that as it is not the same address as the 8201/8201A.
If nobody knows a better solution, I'll probably switch back to LEFT$/RIGHT$
based on PEEK(1), but that might cause problems with the Tandy 102 UK.


>
> In particular the SAVE/LOAD commands are different between NEC and Tandy.
>

It looks like the NEC uses BSAVE instead of SAVEM which might be a problem,
but — on my Tandy 200 at least — BASIC doesn't complain about unrecognized
commands if they are never run. For example, this doesn't give any errors:

10 ID=PEEK(1)
20 IF (ID=148) THEN BSAVE "FOO.CO", 0, 16383: ELSE SAVEM "FOO.CO", 0, 16383

Was there another issue with the SAVE/LOAD commands? For example, if NEC's
.CO files are in a different format, that would certainly throw a monkey
wrench in the works.

Thanks for all the help!

—b9

Reply via email to