Loading ...
Sorry, an error occurred while loading the content.

Re: How does Altair basic 3.2 and 4.0 store programs in memory

Expand Messages
  • corey986
    Martin, I did leave out one complication, I was actually hoping to not use the RS232, but the PIO. I can do both with mine, but the rs232 requires a switch
    Message 1 of 12 , Jul 13, 2013
    • 0 Attachment
      Martin,

      I did leave out one complication, I was actually hoping to not use the RS232, but the PIO. I can do both with mine, but the rs232 requires a switch since I have only one serial port.

      So my choices are use the serial with a switch and put the extra null as per the basic manual (do you find that necessary) or load directly to memory since basic only supports the ACI for loading afterwards not off the PIO.

      It is just really cool to have the tape run and finish and have basic pop up without using a switch box so I have been concentrating on the PIO trying to keep my altair internals as accurate to its original configuration as possible.

      Thanks,
      Corey


      --- In altaircomputerclub@yahoogroups.com, "mfeberhard" <eberhard@...> wrote:
      >
      > It seems like a better, more versatile solution would be to solve the speed issue with your high-speed paper tape reader. I bet your reader will respond to handshaking signals on the RS232 interface. (Mine certainly does.) With handshaking, you would no longer have to worry about whether or not Basic could keep up with the reader.
      >
      > -Martin E
      >
      > --- In altaircomputerclub@yahoogroups.com, corey986 <no_reply@> wrote:
      > >
      > > I am trying to figure out the best way to save and load programs from paper tape.
      > >
      > > I know I could redirect a list command to the punch and modifying the number of nulls at the end of a line when read in a paper tape, but was thinking the best way is to simply backup the area of memory that stores the program and reload the area using a binary loader. This would prevent issues of basic not being able to keep up with my high speed reader.
      > >
      > > Where can I figure out where basic is storing the program for each version/size of basic and how long is that area. Also is basic storing symbols or the actually "text" code?
      > >
      > > Thanks,
      > > Corey
      > >
      >
    • deramp5113
      Corey, At 600cps you d need a lot of nulls at the end of each line! 4K BASIC can keep up with 9600 baud (960 cps) as long as there is a 200-300ms delay at the
      Message 2 of 12 , Jul 13, 2013
      • 0 Attachment
        Corey,

        At 600cps you'd need a lot of nulls at the end of each line! 4K BASIC can keep up with 9600 baud (960 cps) as long as there is a 200-300ms delay at the end of each line. This delay (or equivalent time in nulls) gives BASIC time to encode and store the line in memory and ready itself to receive the next line.

        However, the CLOAD and CSAVE commands, which first appeared in 8K BASIC, do exactly what you're talking about: They save and restore programs in the encoded memory format instead of straight ASCII. I have found that CLOAD can keep up at 9600 baud with no delays whatsoever. Pretty impressive!

        You could use 8K BASIC instead of 4K, use an SIO serial board strapped at 6/7, and a serial interface to your reader, and you'll have full speed transfers with out inserted delays or nulls by using CSAVE and CLOAD.

        Or... You can use 8K BASIC and patch the CLOAD/CSAVE routines to use your PIO port instead of the cassette SIO port. That wouldn't be too hard to do. Much simpler than it was to patch Extended BASIC for the Z80!

        Mike

        --- In altaircomputerclub@yahoogroups.com, corey986 <no_reply@...> wrote:
        >
        > I am trying to figure out the best way to save and load programs from paper tape.
        >
        > I know I could redirect a list command to the punch and modifying the number of nulls at the end of a line when read in a paper tape, but was thinking the best way is to simply backup the area of memory that stores the program and reload the area using a binary loader. This would prevent issues of basic not being able to keep up with my high speed reader.
        >
        > Where can I figure out where basic is storing the program for each version/size of basic and how long is that area. Also is basic storing symbols or the actually "text" code?
        >
        > Thanks,
        > Corey
        >
      • corey986
        Mike, You ve given me a good idea. I think you have the source on your downloads at altairclone for 8k basic. What I m thinking now is taking a look at the
        Message 3 of 12 , Jul 14, 2013
        • 0 Attachment
          Mike,
          You've given me a good idea.

          I think you have the source on your downloads at altairclone for 8k basic.

          What I'm thinking now is taking a look at the code and coming up with a small program you can burn to an EPROM that you can set the basic "options" to figure out the start address of "the program" and then set using the sense switches the target/source port. This way I can use it with my sio-A or my PIO and I should be able to use 4k or 8k basic. I try to avoid 8k since I only have 12k in my system (I'm trying to keep my system as it would have been back in late 75/early 76) . I have another MITS 4k ram card but I'd have to take a card out and as it stands all 8 of my slots are full (I could temporarily remove my video card I don't use now but that slot is slated for my dazzler when I get it running as a piggyback set as per the manuals, just got another nice 1976 Sony color 9"TV for it)

          I'll start going over the 8k basic source code over the next few days and I'll try to figure out where the "program" starts. I'm guessing its stored in a memory location since that location should vary depending on the options you choose on basic startup.

          Cheers,
          Corey

          --- In altaircomputerclub@yahoogroups.com, "deramp5113" <deramp5113@...> wrote:
          >
          > Corey,
          >
          > At 600cps you'd need a lot of nulls at the end of each line! 4K BASIC can keep up with 9600 baud (960 cps) as long as there is a 200-300ms delay at the end of each line. This delay (or equivalent time in nulls) gives BASIC time to encode and store the line in memory and ready itself to receive the next line.
          >
          > However, the CLOAD and CSAVE commands, which first appeared in 8K BASIC, do exactly what you're talking about: They save and restore programs in the encoded memory format instead of straight ASCII. I have found that CLOAD can keep up at 9600 baud with no delays whatsoever. Pretty impressive!
          >
          > You could use 8K BASIC instead of 4K, use an SIO serial board strapped at 6/7, and a serial interface to your reader, and you'll have full speed transfers with out inserted delays or nulls by using CSAVE and CLOAD.
          >
          > Or... You can use 8K BASIC and patch the CLOAD/CSAVE routines to use your PIO port instead of the cassette SIO port. That wouldn't be too hard to do. Much simpler than it was to patch Extended BASIC for the Z80!
          >
          > Mike
          >
          > --- In altaircomputerclub@yahoogroups.com, corey986 <no_reply@> wrote:
          > >
          > > I am trying to figure out the best way to save and load programs from paper tape.
          > >
          > > I know I could redirect a list command to the punch and modifying the number of nulls at the end of a line when read in a paper tape, but was thinking the best way is to simply backup the area of memory that stores the program and reload the area using a binary loader. This would prevent issues of basic not being able to keep up with my high speed reader.
          > >
          > > Where can I figure out where basic is storing the program for each version/size of basic and how long is that area. Also is basic storing symbols or the actually "text" code?
          > >
          > > Thanks,
          > > Corey
          > >
          >
        • deramp5113
          Corey, I think I have this figured out for 4K BASIC 3.2. If you want, I could write a program load and program save routine at some easy to enter EPROM
          Message 4 of 12 , Jul 15, 2013
          • 0 Attachment
            Corey,

            I think I have this figured out for 4K BASIC 3.2. If you want, I could write a "program load" and "program save" routine at some easy to enter EPROM addresses (let me know what addresses you want). Also, let me know what port type/address the paper tape reader is connected to. Or, I can tell you what I think will work and you can write the code if you'd rather!

            Mike


            --- In altaircomputerclub@yahoogroups.com, corey986 <no_reply@...> wrote:
            >
            > I am trying to figure out the best way to save and load programs from paper tape.
            >
            > I know I could redirect a list command to the punch and modifying the number of nulls at the end of a line when read in a paper tape, but was thinking the best way is to simply backup the area of memory that stores the program and reload the area using a binary loader. This would prevent issues of basic not being able to keep up with my high speed reader.
            >
            > Where can I figure out where basic is storing the program for each version/size of basic and how long is that area. Also is basic storing symbols or the actually "text" code?
            >
            > Thanks,
            > Corey
            >
          • deramp5113
            Well, I couldn t leave this alone -- it sounded like too much fun to code up! I stuck two short routines in PROM, one to save a BASIC program amd one to load a
            Message 5 of 12 , Jul 15, 2013
            • 0 Attachment
              Well, I couldn't leave this alone -- it sounded like too much fun to code up! I stuck two short routines in PROM, one to save a BASIC program amd one to load a BASIC program (4K v3.2). The direct memory image is saved and restored with the two routines. After the load or save completes, the routines jump to zero which puts you right back in BASIC with an "OK" prompt. Works great at 9600 baud with no delays.

              Mike

              --- In altaircomputerclub@yahoogroups.com, "deramp5113" <deramp5113@...> wrote:
              >
              > Corey,
              >
              > I think I have this figured out for 4K BASIC 3.2. If you want, I could write a "program load" and "program save" routine at some easy to enter EPROM addresses (let me know what addresses you want). Also, let me know what port type/address the paper tape reader is connected to. Or, I can tell you what I think will work and you can write the code if you'd rather!
              >
              > Mike
              >
              >
              > --- In altaircomputerclub@yahoogroups.com, corey986 <no_reply@> wrote:
              > >
              > > I am trying to figure out the best way to save and load programs from paper tape.
              > >
              > > I know I could redirect a list command to the punch and modifying the number of nulls at the end of a line when read in a paper tape, but was thinking the best way is to simply backup the area of memory that stores the program and reload the area using a binary loader. This would prevent issues of basic not being able to keep up with my high speed reader.
              > >
              > > Where can I figure out where basic is storing the program for each version/size of basic and how long is that area. Also is basic storing symbols or the actually "text" code?
              > >
              > > Thanks,
              > > Corey
              > >
              >
            • corey986
              Mike, You beat me too it. I was traveling yesterday. So you simply save the whole ram space or did you figure out how to determine where the program starts
              Message 6 of 12 , Jul 16, 2013
              • 0 Attachment
                Mike,

                You beat me too it. I was traveling yesterday. So you simply save the whole ram space or did you figure out how to determine where the program starts and then only "save" until you see three consecutive NULLs.

                As for your code, please email it to me I'd like to take a look, I was thinking of using the sense switches for the port/card type so that you can either save/load to a PC on serial or to the punch on PIO.

                Cheers,
                Corey986

                --- In altaircomputerclub@yahoogroups.com, "deramp5113" <deramp5113@...> wrote:
                >
                > Well, I couldn't leave this alone -- it sounded like too much fun to code up! I stuck two short routines in PROM, one to save a BASIC program amd one to load a BASIC program (4K v3.2). The direct memory image is saved and restored with the two routines. After the load or save completes, the routines jump to zero which puts you right back in BASIC with an "OK" prompt. Works great at 9600 baud with no delays.
                >
                > Mike
                >
                > --- In altaircomputerclub@yahoogroups.com, "deramp5113" <deramp5113@> wrote:
                > >
                > > Corey,
                > >
                > > I think I have this figured out for 4K BASIC 3.2. If you want, I could write a "program load" and "program save" routine at some easy to enter EPROM addresses (let me know what addresses you want). Also, let me know what port type/address the paper tape reader is connected to. Or, I can tell you what I think will work and you can write the code if you'd rather!
                > >
                > > Mike
                > >
                > >
                > > --- In altaircomputerclub@yahoogroups.com, corey986 <no_reply@> wrote:
                > > >
                > > > I am trying to figure out the best way to save and load programs from paper tape.
                > > >
                > > > I know I could redirect a list command to the punch and modifying the number of nulls at the end of a line when read in a paper tape, but was thinking the best way is to simply backup the area of memory that stores the program and reload the area using a binary loader. This would prevent issues of basic not being able to keep up with my high speed reader.
                > > >
                > > > Where can I figure out where basic is storing the program for each version/size of basic and how long is that area. Also is basic storing symbols or the actually "text" code?
                > > >
                > > > Thanks,
                > > > Corey
                > > >
                > >
                >
              • deramp5113
                Corey, The following information is specific to 4K BASIC v3.2: Location 0165h contains a pointer to the start of the program in memory. Location 0167h contains
                Message 7 of 12 , Jul 16, 2013
                • 0 Attachment
                  Corey,

                  The following information is specific to 4K BASIC v3.2:

                  Location 0165h contains a pointer to the start of the program in memory. Location 0167h contains a pointer to the start of variable storage in memory. Variable storage always starts immediately after the last program byte, so 0167h can be used as a pointer to the end of the program + 1.

                  To save a program, I send three sync bytes (I used D2h because that's what CSAVE used) followed by the two byte length of the program to be saved where: length = (0167h) - (0165h). I then transmit the program bytes. After all bytes have been sent, the code jumps to address zero which returns to BASIC which then displays "OK"

                  To load a program, I wait for the three sync bytes in a row, read the two length bytes, then read the program bytes into memory starting at the address specified in 0165h. After the program is loaded, I write the address of the last program byte + 1 into 0167h, then jump to address zero.

                  4K BASIC v4.0 is different. I'll dig into that more if you want to support both versions.

                  Mike


                  --- In altaircomputerclub@yahoogroups.com, corey986 <no_reply@...> wrote:
                  >
                  >
                  >
                  >
                  >
                  > Mike,
                  >
                  > You beat me too it. I was traveling yesterday. So you simply save the whole ram space or did you figure out how to determine where the program starts and then only "save" until you see three consecutive NULLs.
                  >
                  > As for your code, please email it to me I'd like to take a look, I was thinking of using the sense switches for the port/card type so that you can either save/load to a PC on serial or to the punch on PIO.
                  >
                  > Cheers,
                  > Corey986
                  >
                  > --- In altaircomputerclub@yahoogroups.com, "deramp5113" <deramp5113@> wrote:
                  > >
                  > > Well, I couldn't leave this alone -- it sounded like too much fun to code up! I stuck two short routines in PROM, one to save a BASIC program amd one to load a BASIC program (4K v3.2). The direct memory image is saved and restored with the two routines. After the load or save completes, the routines jump to zero which puts you right back in BASIC with an "OK" prompt. Works great at 9600 baud with no delays.
                  > >
                  > > Mike
                  > >
                  > > --- In altaircomputerclub@yahoogroups.com, "deramp5113" <deramp5113@> wrote:
                  > > >
                  > > > Corey,
                  > > >
                  > > > I think I have this figured out for 4K BASIC 3.2. If you want, I could write a "program load" and "program save" routine at some easy to enter EPROM addresses (let me know what addresses you want). Also, let me know what port type/address the paper tape reader is connected to. Or, I can tell you what I think will work and you can write the code if you'd rather!
                  > > >
                  > > > Mike
                  > > >
                  > > >
                  > > > --- In altaircomputerclub@yahoogroups.com, corey986 <no_reply@> wrote:
                  > > > >
                  > > > > I am trying to figure out the best way to save and load programs from paper tape.
                  > > > >
                  > > > > I know I could redirect a list command to the punch and modifying the number of nulls at the end of a line when read in a paper tape, but was thinking the best way is to simply backup the area of memory that stores the program and reload the area using a binary loader. This would prevent issues of basic not being able to keep up with my high speed reader.
                  > > > >
                  > > > > Where can I figure out where basic is storing the program for each version/size of basic and how long is that area. Also is basic storing symbols or the actually "text" code?
                  > > > >
                  > > > > Thanks,
                  > > > > Corey
                  > > > >
                  > > >
                  > >
                  >
                • corey986
                  Mike, You seem to be enjoying the research. If you want to do 4.0 4k, then I think you ve covered just about all the versions needed. I m actually quite
                  Message 8 of 12 , Jul 16, 2013
                  • 0 Attachment
                    Mike,

                    You seem to be enjoying the research. If you want to do 4.0 4k, then I think you've covered just about all the versions needed. I'm actually quite amazed no one has done this in the past. This way you could load/save programs using a hacked modem or cassette interface or in my case a paper tape on a different port than your terminal (well 8k solved that issue with cload and csave, but still...).

                    Cheers,
                    Corey

                    --- In altaircomputerclub@yahoogroups.com, "deramp5113" <deramp5113@...> wrote:
                    >
                    > Corey,
                    >
                    > The following information is specific to 4K BASIC v3.2:
                    >
                    > Location 0165h contains a pointer to the start of the program in memory. Location 0167h contains a pointer to the start of variable storage in memory. Variable storage always starts immediately after the last program byte, so 0167h can be used as a pointer to the end of the program + 1.
                    >
                    > To save a program, I send three sync bytes (I used D2h because that's what CSAVE used) followed by the two byte length of the program to be saved where: length = (0167h) - (0165h). I then transmit the program bytes. After all bytes have been sent, the code jumps to address zero which returns to BASIC which then displays "OK"
                    >
                    > To load a program, I wait for the three sync bytes in a row, read the two length bytes, then read the program bytes into memory starting at the address specified in 0165h. After the program is loaded, I write the address of the last program byte + 1 into 0167h, then jump to address zero.
                    >
                    > 4K BASIC v4.0 is different. I'll dig into that more if you want to support both versions.
                    >
                    > Mike
                    >
                    >
                    > --- In altaircomputerclub@yahoogroups.com, corey986 <no_reply@> wrote:
                    > >
                    > >
                    > >
                    > >
                    > >
                    > > Mike,
                    > >
                    > > You beat me too it. I was traveling yesterday. So you simply save the whole ram space or did you figure out how to determine where the program starts and then only "save" until you see three consecutive NULLs.
                    > >
                    > > As for your code, please email it to me I'd like to take a look, I was thinking of using the sense switches for the port/card type so that you can either save/load to a PC on serial or to the punch on PIO.
                    > >
                    > > Cheers,
                    > > Corey986
                    > >
                    > > --- In altaircomputerclub@yahoogroups.com, "deramp5113" <deramp5113@> wrote:
                    > > >
                    > > > Well, I couldn't leave this alone -- it sounded like too much fun to code up! I stuck two short routines in PROM, one to save a BASIC program amd one to load a BASIC program (4K v3.2). The direct memory image is saved and restored with the two routines. After the load or save completes, the routines jump to zero which puts you right back in BASIC with an "OK" prompt. Works great at 9600 baud with no delays.
                    > > >
                    > > > Mike
                    > > >
                    > > > --- In altaircomputerclub@yahoogroups.com, "deramp5113" <deramp5113@> wrote:
                    > > > >
                    > > > > Corey,
                    > > > >
                    > > > > I think I have this figured out for 4K BASIC 3.2. If you want, I could write a "program load" and "program save" routine at some easy to enter EPROM addresses (let me know what addresses you want). Also, let me know what port type/address the paper tape reader is connected to. Or, I can tell you what I think will work and you can write the code if you'd rather!
                    > > > >
                    > > > > Mike
                    > > > >
                    > > > >
                    > > > > --- In altaircomputerclub@yahoogroups.com, corey986 <no_reply@> wrote:
                    > > > > >
                    > > > > > I am trying to figure out the best way to save and load programs from paper tape.
                    > > > > >
                    > > > > > I know I could redirect a list command to the punch and modifying the number of nulls at the end of a line when read in a paper tape, but was thinking the best way is to simply backup the area of memory that stores the program and reload the area using a binary loader. This would prevent issues of basic not being able to keep up with my high speed reader.
                    > > > > >
                    > > > > > Where can I figure out where basic is storing the program for each version/size of basic and how long is that area. Also is basic storing symbols or the actually "text" code?
                    > > > > >
                    > > > > > Thanks,
                    > > > > > Corey
                    > > > > >
                    > > > >
                    > > >
                    > >
                    >
                  • deramp5113
                    A stand alone routine to save/load for 4K v3.2 is not difficult. A stand alone routine save/load for 4K v4.0 is not difficult. However, this means choosing the
                    Message 9 of 12 , Jul 17, 2013
                    • 0 Attachment
                      A stand alone routine to save/load for 4K v3.2 is not difficult. A stand alone routine save/load for 4K v4.0 is not difficult. However, this means choosing the proper save/load routine from PROM (3.2 or 4.0) and also keeping separate versions of every program for v3.2 and v4.0. Not a great solution.

                      Unless v4.0 added or changed keyword code assignments, then a single routine to automatically handle all combinations is possible. However, it becomes a more complicated program.

                      The program must first determine if it is running under 3.2 or 4.0. Second, the save routine would need to modify the linked-list address chain to be relative addresses instead of fixed addresses as the program is written to the save device. Conversely, when the program is read back in, the relative linked list must be restored to a fixed address linked list as the program is read back into memory. Finally, the program has to handle the slight difference in the way the first line in a program is stored for 3.2 vs 4.0.

                      Mike




                      --- In altaircomputerclub@yahoogroups.com, "deramp5113" <deramp5113@...> wrote:
                      >
                      > Corey,
                      >
                      > I think I have this figured out for 4K BASIC 3.2. If you want, I could write a "program load" and "program save" routine at some easy to enter EPROM addresses (let me know what addresses you want). Also, let me know what port type/address the paper tape reader is connected to. Or, I can tell you what I think will work and you can write the code if you'd rather!
                      >
                      > Mike
                      >
                      >
                      > --- In altaircomputerclub@yahoogroups.com, corey986 <no_reply@> wrote:
                      > >
                      > > I am trying to figure out the best way to save and load programs from paper tape.
                      > >
                      > > I know I could redirect a list command to the punch and modifying the number of nulls at the end of a line when read in a paper tape, but was thinking the best way is to simply backup the area of memory that stores the program and reload the area using a binary loader. This would prevent issues of basic not being able to keep up with my high speed reader.
                      > >
                      > > Where can I figure out where basic is storing the program for each version/size of basic and how long is that area. Also is basic storing symbols or the actually "text" code?
                      > >
                      > > Thanks,
                      > > Corey
                      > >
                      >
                    • deramp5113
                      Corey (or anyone else who cares!), I ve written a robust version of a program you can run from EPROM to save/load programs from 4K BASIC v3.2 or v4.0 in binary
                      Message 10 of 12 , Jul 19, 2013
                      • 0 Attachment
                        Corey (or anyone else who cares!),

                        I've written a robust version of a program you can run from EPROM to save/load programs from 4K BASIC v3.2 or v4.0 in binary format. BASIC can keep up with program loads at a full 9600 baud (960cps) without delays. After a load or save is performed, BASIC is given back control and its "OK" prompt is displayed.

                        The same routine is run for either 3.2 or 4.0 -- the program figures out which version of BASIC is in memory. The program also figures out whether you want to do a save or a restore based on whether there is a program in memory (do a save), or no program in memory (do a load).

                        During a save, the program converts all absolute addresses into relative addresses so that absolute addresses can be regenerated when loading the program. This is necessary since the starting address of a program is not the same between v3.2 and v4.0, and even within the same BASIC version, the program load address can change based on how you answer the "Want SIN" initialization questions.

                        Mike




                        --- In altaircomputerclub@yahoogroups.com, "deramp5113" <deramp5113@...> wrote:
                        >
                        > A stand alone routine to save/load for 4K v3.2 is not difficult. A stand alone routine save/load for 4K v4.0 is not difficult. However, this means choosing the proper save/load routine from PROM (3.2 or 4.0) and also keeping separate versions of every program for v3.2 and v4.0. Not a great solution.
                        >
                        > Unless v4.0 added or changed keyword code assignments, then a single routine to automatically handle all combinations is possible. However, it becomes a more complicated program.
                        >
                        > The program must first determine if it is running under 3.2 or 4.0. Second, the save routine would need to modify the linked-list address chain to be relative addresses instead of fixed addresses as the program is written to the save device. Conversely, when the program is read back in, the relative linked list must be restored to a fixed address linked list as the program is read back into memory. Finally, the program has to handle the slight difference in the way the first line in a program is stored for 3.2 vs 4.0.
                        >
                        > Mike
                        >
                        >
                        >
                        >
                        > --- In altaircomputerclub@yahoogroups.com, "deramp5113" <deramp5113@> wrote:
                        > >
                        > > Corey,
                        > >
                        > > I think I have this figured out for 4K BASIC 3.2. If you want, I could write a "program load" and "program save" routine at some easy to enter EPROM addresses (let me know what addresses you want). Also, let me know what port type/address the paper tape reader is connected to. Or, I can tell you what I think will work and you can write the code if you'd rather!
                        > >
                        > > Mike
                        > >
                        > >
                        > > --- In altaircomputerclub@yahoogroups.com, corey986 <no_reply@> wrote:
                        > > >
                        > > > I am trying to figure out the best way to save and load programs from paper tape.
                        > > >
                        > > > I know I could redirect a list command to the punch and modifying the number of nulls at the end of a line when read in a paper tape, but was thinking the best way is to simply backup the area of memory that stores the program and reload the area using a binary loader. This would prevent issues of basic not being able to keep up with my high speed reader.
                        > > >
                        > > > Where can I figure out where basic is storing the program for each version/size of basic and how long is that area. Also is basic storing symbols or the actually "text" code?
                        > > >
                        > > > Thanks,
                        > > > Corey
                        > > >
                        > >
                        >
                      Your message has been successfully submitted and would be delivered to recipients shortly.