Class Serial

  • Direct Known Subclasses:
    SE_Serial

    public abstract class Serial
    extends Interface
    Simulation of the FA6 Cassette interface.
    Author:
    "Martin Krischik" «krischik@users.sourceforge.net»
    • Field Detail

      • Is_Digit

        private static final Pattern Is_Digit

        matches a single digits (including hex digits).

      • Is_Digits

        private static final Pattern Is_Digits

        matches a string of digits (including hex digits).

      • Logger

        private static final Logger Logger

        class Logger instance

      • Parse_M

        private static final Pattern Parse_M

        Parse Memory line

      • TAG

        private static final String TAG

        class Logger tag.

      • New_Line

        public static final String New_Line
        New lines in simulated RS232 files are always written with DOS line endings.
        See Also:
        Constant Field Values
      • Owner

        private final Calculator Owner
        Calculator to which the interface is connected to
      • File_Read

        private long File_Read
        Characters read from input stream
      • Out

        @Nullable
        private Writer Out
        output stream
      • File_Name

        String File_Name

        Last file name opened. Remembered to impove error messages.

      • Home_Directory

        @Nullable
        protected @Nullable String Home_Directory
        The simulators home directory. The usual positions are:
        Windows
        "C:/Documents and Settings/user_id/FX-603P/"
        OS X
        "/User/user_id/FX-603P/"
        Unix
        "/home/user_id/FX-603P/"
        Symbian
        "D:/others/FX-603P/"
        Android
        "/mnt/sdcard/Android/data/net.sourceforge.uiq3.fx603p"
    • Constructor Detail

      • Serial

        protected Serial​(Calculator Owner)
        Parameters:
        Owner - Calculator to which the interface is connected to
    • Method Detail

      • Close

        public void Close()
                   throws Op_Error
        Close files and all streams attached to them.
        Throws:
        Op_Error - Something went wrong
      • Create

        public void Create​(@NotNull
                           Interface.File_Type Type,
                           @NotNull
                           @NotNull String File_Name)
                    throws Op_Error

        create new file for tape IO

        Parameters:
        Type - File Type.
        File_Name - file name to create
        Throws:
        Op_Error - Something went wrong
      • Create_Stream

        @Nullable
        protected abstract Writer Create_Stream​(@NotNull
                                                @NotNull String Filename)
                                         throws Op_Error
        Create a new file for output.
        Parameters:
        Filename - filename.
        Returns:
        data stream to write to.
        Throws:
        Op_Error - io error.
      • File_Size

        public abstract long File_Size()
                                throws Op_Error
        Get file Size
        Returns:
        File size
        Throws:
        Op_Error - any file io error
      • Home_Directory

        @NotNull
        public @NotNull String Home_Directory()
        The simulators home directory. The usual positions are:
        Windows
        "C:/Documents and Settings/user_id/FX-603P/"
        OS X
        "/User/user_id/FX-603P/"
        Unix
        "/home/user_id/FX-603P/"
        Symbian
        "D:/others/FX-603P/"
        Android
        "/mnt/sdcard/Android/data/net.sourceforge.uiq3.fx603p/"
        Returns:
        The home directory to be used.
      • Home_Directory

        public void Home_Directory​(@Nullable
                                   @Nullable String Home_Directory)
        The simulators home directory. The usual positions are:
        Windows
        "C:/Documents and Settings/user_id/FX-603P/"
        OS X
        "/User/user_id/FX-603P/"
        Unix
        "/home/user_id/FX-603P/"
        Symbian
        "D:/others/FX-603P/"
        Android
        "/mnt/sdcard/Android/data/net.sourceforge.uiq3.fx603p/"
        Parameters:
        Home_Directory - The home directory to be used.
      • Open

        public void Open​(@NotNull
                         Interface.File_Type Type,
                         @NotNull
                         @NotNull String File_Name)
                  throws Op_Error

        open file of given type

        Parameters:
        Type - File Type.
        File_Name - File name to open
        Throws:
        Op_Error - Something went wrong
      • Open

        @NotNull
        public Interface.File_Type Open​(@NotNull
                                        @NotNull String File_Name)
                                 throws Op_Error

        open file and return type

        Parameters:
        File_Name - File name to open
        Returns:
        the file type of the file
        Throws:
        Op_Error - Something went wrong
      • Open_Stream

        @NotNull
        protected abstract Reader Open_Stream​(@NotNull
                                              @NotNull String Filename)
                                       throws Op_Error
        Create a new file for input.
        Parameters:
        Filename - filename.
        Returns:
        data stream to read from.
        Throws:
        Op_Error - io error.
      • Parse_M

        public void Parse_M()
                     throws Op_Error

        Parse text files for memory informations.

        Throws:
        Op_Error - operation error
      • Parse_Steps

        public void Parse_Steps()
                         throws Op_Error

        Parse text files for memory informations.

        Throws:
        Op_Error - operation error
      • Print_M

        public void Print_M()
                     throws Op_Error
        Writes memory register to simulated cassette interface.
        Throws:
        Op_Error - could not write steps
      • Print_New_Line

        public void Print_New_Line()
                            throws Op_Error

        pring a new line. a public version is needed for All Text file

        Throws:
        Op_Error - on i/o errors
      • Print_Steps

        public void Print_Steps()
                         throws Op_Error
        Print program steps
        Throws:
        Op_Error - could not print the program
      • Store_Opcode

        private int Store_Opcode​(int Step_Number,
                                 short Opcode)

        store a step to steps

        Parameters:
        Step_Number - free step to store the token to
        Opcode - Opcode to store
        Returns:
        Next free step nummer
      • Store_Token

        private int Store_Token​(int Step_Number,
                                short Opcode)

        store a step to steps

        Parameters:
        Step_Number - free step to store the token to
        Opcode - Opcode to store
        Returns:
        Next free step nummer