PLASMA icon indicating copy to clipboard operation
PLASMA copied to clipboard

Unable to open INCLUDE from source sub-folder

Open tingtron opened this issue 2 years ago • 2 comments

It is exciting to see version 2 of PLASMA released.

I am trying to compile a PLA source HELLO.PLA using PLASM on the target machine (Apple IIc).

On a side note, it would be great to better understand how PLASM resolves the location of SYS and INC folders. Also same when on two 140k disks (SYS in Slot 6.1 and BLD in Slot 6.2). I am guessing that

  • SYS is the one and only "syspath" for modules and +apps
  • INC is resolved relative to the current folder of the CMD prompt (hence the "root" requirement, as we discuss below)

In README.md it says

Boot the PLASMA system and change the prefix to the development disk/directory.

So first, we set Prefix to the source folder:

/PLASMA.SYS/: p /PLASMA.BLD
/PLASMA.BLD/: p SAMPLES
/PLASMA.BLD/SAMPLES/:

and when running PLASM, it gives the following error:

/PLASMA.BLD/SAMPLES/:+plasm hello.pla   
PLASMA Compiler, Version 2.0            
Data+Code buffer size = 12358           
                                        
HELLO                                   
Unable to open INCLUDE file: inc/cmdsys.
plh                                     
                                        
Error:                                  
hello.pla[1]                            
INCLUDE "inc/cmdsys.plh"

It only works when backing up to the root, and specifying the full path to source:

/PLASMA.BLD/SAMPLES/: /
/PLASMA.BLD/: 
/PLASMA.BLD/:+plasm samples/hello.pla
...
Total bytes compiled: 23                

But it's a lot of typing. BTW, it would be great to reduce typing even more by having a combination of:

  • a small command history list, at least in the 128k/JIT cmd.
  • remember the last line in +ED for a few recent files
  • add a (B)uild command in +ED, calling +PLASM (if tight on memory, auto-swap +ED)

Alternatively, it also works to move any sources to the root of the BLD disk. But then the README.md might instead of "changing prefix to disk/directory", explicitly recommend using the root only. (For example, +COPY SAMPLES/HELLO.PLA = to root, and then +PLASM HELLO.PLA from the root. Which may not be a bad idea to isolate the SAMPLES storage from the work area in the root.)

⚠️ Note: prepending / to the include or removing inc/, did not help:

INCLUDE "/inc/cmdsys.plh"

⚠️ Also note: even to run +PLASM from the source sub-folder, we had to move PLASM to the /SYS folder (on the PLASMA.SYS disk), because it is not "visible" from the source folder /SAMPLES/. Or alternatively, it could also be called with a less desirable full path: +/plasma.bld/plasma hello.pla.

tingtron avatar Apr 16 '23 08:04 tingtron

Hi- thanks for all your feedback with the build procedures.

Yes, you figured out the paths for SYS and INC. The main reason I did it that way it due to the extremely tight memory constraints and trying to free up as much as possible. Every byte counts! I put the plasm compiler in the PLASMA.BLD disk because the PLASMA.SYS got full. So yeah, it does make for a cumbersome arrangement but as you discovered you are welcome to move things around to better fit your needs. I even created a single floppy build system by removing everything but the bare essentials. Hard disks make things so much easier.

Going forward I've been considering a build system much like you describe. Adding a build command to ED would be easy enough, but it would come at a memory cost. I had an integrated editor/compiler in the previous version of PLASMA that I may also revisit, but the compiler has gotten much bigger since then.

Creating a more fully featured command shell is also a possibility, but again at the cost of memory. The Apple II memory map places some annoying constraints on where thing fit nicely.

Keep the ideas and feedback coming and let me know what you come up with

dschmenk avatar Apr 16 '23 15:04 dschmenk

Thank you for confirming. I think for now the paths conventions makes sense. And maybe clarifying the docs would be sufficient.

As for Memory constraints, that's a valid concern. And it is also noticeable when a larger program is loaded from disk (like +ED or +PLASM). So maybe the coordination between them should be kept in CMD to keep each of them smaller.

Also it might be beneficial to break apart larger programs into pieces for faster loading. For example, the PLASM could be loaded in stages: Compile and Generate. If there are syntax errors, it doesn't even need Generate (unless it's single pass-through). Similarly for +ED, some advanced features could be "overlaid"-- like Find; and the file system commands (P, C etc) removed and deferred to CMD (or re-used from memory, if CMD is still loaded).

tingtron avatar Apr 16 '23 17:04 tingtron