Shop OBEX P1 Docs P2 Docs Learn Events
SED - The Simple Sector Editor for TAQOZ - Page 2 — Parallax Forums

SED - The Simple Sector Editor for TAQOZ

2»

Comments

  • ErNaErNa Posts: 1,752

    @"Peter Jakacki" said:

    EDIT: You know what, maybe I will make OPEN-FILE a runtime pub function and leave FOPEN as a terminal command.
    Ok, I changed it so that FOPEN is an immediate word and also returns with console messages, whereas OPEN-FILE returns with the sector handle where 0 is false.
    I could do the same with some other words too. However I could make [C] also compile a [G] by default.

    So, @"Peter Jakacki" you say, you already changed it? Where to find?

  • ErNaErNa Posts: 1,752
    edited 2021-03-16 21:51

    I made some progress, still very little, but progress. The nice thing with Tachyon TAQOZ is interactive working. I tried to finally understand that [G] grab-thing. First I have to understand pre vs. pri etc.
    In interactive mode tokens are entered separated by BLANK or RETURN. Every token is compiled (compared to a dictionary (word) or rule(number)). Preemptive words are executed immediately. That means, they take control of the processor, the routine "runs". The immediate execution can be switched off by a leading [C].
    In the case of SED the command is followed by a control parameter that can name a file or data source like RAM, FLASH, SECTOR. But a stack machine expects parameters on the stack before and not after invocation of the operation. When invoking SED the first few commands are executed, including [G] grab and [C] compile only so the following FOPEN is delayed until a next token arrives. This token is "grabbed" and placed on TOS. Now FOPEN is executed and can react to the grabbed token.

    The file handle is not returned on the stack but in the variable filesect and it retriven by @FILE.

    So far, so good, now again a surprise:
    --- File Open using name in stream - use @FILE to return file sector handle which is 0 if not open pre FOPEN ( <name> -- ) --- execute any preceding code which may be permissions or options, then get string from console [G] GET$ SPACE FOPEN$ ?DUP IF PRINT" Opened @ " .L ELSE PRINT" not found " THEN ;
    As I look to FOPEN I find [G] too, but no [C]. Thinking about the reason: FOPEN handles opening of a file and prints "not found" else. But that's enough for this evening. Maybe that's the q&d side!

    Now I don't understand your last EDIT with the OPEN-FIlE

    Question: how to make a line break in the CODE markdown?

  • [C] was used to force FOPEN to be compiled because it is normally an interactive command defined as "pre FOPEN". Now though with the latest change OPEN-FILE is no longer an alias for FOPEN but the plain jane pub definition that just reads in the file name and tries to open it and return with the sector where 0 = fail. So OPEN-FILE will always compile, no need to force it.

    I took [G] away from OPEN-FILE because it should only be used in pre definitions and I had forgotten to add, but then added [G] to FOPEN because we may be typing in system permissions such as RWC FOPEN NEWFILE.TXT

    Here's the latest code:
    (I think you used quotes for the code in your last post which is why it is not formatted correctly)

    --- Get the file name and try to open it, return with sector
    pub OPEN-FILE ( <name> -- filesect )
        GET$ SPACE FOPEN$ ;
    
    pre FOPEN ( <name> -- )
    --- grab parameters and permissions then open-file
        [G] OPEN-FILE ?DUP
        IF PRINT" Opened @ " .L
        ELSE PRINT" not found " THEN
        ;
    
    

    BTW - DropBox will always have my latest bleeding edge files and every once in a while I will update PCloud when I think it is stable .

  • ErNaErNa Posts: 1,752

    I can't get access to your dropbox, I understood you abandoned dropbox and the Link in the link LINKS LINKS doesn't work anymore

  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2021-03-17 12:09

    I had some trouble with sharing Dropbox a while back but I thought I was still sharing it. However, here's the link again and if no one has any problems with it I will add it back into my sig links.

    That didn't work...... I will try something else.
    @$#!^%$#@! I don't have permissions - even other folders etc

    I've updated the PCloud now - I use FreeFileSynch to check and process updates

  • ErNaErNa Posts: 1,752
    edited 2021-03-17 12:26

    forget, didn't read your post before clicking the link, you missed [C] in your post to not preempt "here's the link again" ;-)

Sign In or Register to comment.