VisiCalc Reconstructed

(zserge.com)

57 points | by ingve 3 days ago

8 comments

  • airstrike 0 minutes ago
    [delayed]
  • ivanpribec 7 minutes ago
    Reminds me of spreadsheet-fortran (https://github.com/lwsinclair/spreadsheet-fortran), a project creating a VisiCalc lookalike in FORTRAN 66, which even runs on a PDP-11.
  • afandian 1 hour ago
    Quote:

      #define MAXIN 128  // max cell input length
      enum { EMPTY, NUM, LABEL, FORMULA };  // cell types
      struct cell {
        int type;
        float val;
        char text[MAXIN];  // raw user input
      };
      #define NCOL 26    // max number of columns (A..Z)
      #define NROW 50    // max number of rows
      struct grid {
        struct cell cells[NCOL][NROW];
      };
    
    I doubt that 171 KB of static allocation would fly on an Apple II! I do wonder how they did memory allocation, it must have been tricky with all the fragmentation.
    • vidarh 47 minutes ago
      According to Bob Frankston, Bricklin's co-founder[1]:

      > The basic approach was to allocate memory into fixed chunks so that we wouldn't have a problem with the kind of breakage that occurs with irregular allocation. Deallocating a cell freed up 100% of its storage. Thus a given spreadsheet would take up the same amount of space no matter how it was created. I presumed that the spreadsheet would normally be compact and in the upper left (low number rows and cells) so used a vector of rows vectors. The chunks were also called cells so I had to be careful about terminology to avoid confusion. Internally the term "cell" always meant storage cell. These cells were allocated from one direction and the vectors from the other. When they collided the program reorganized the storage. It had to do this in place since there was no room left at that point -- after all that's why we had to do the reorganization.

      > The actual representation was variable length with each element prefixed by a varying length type indicator. In order to avoid having most code parse the formula the last by was marked $ff (or 0xff in today's representation). It turned out that valid cell references at the edges of the sheet looked like this and created some interesting bugs.

      It leaves out a lot of details - if you're skimping enough you could allocate variable length row vectors, but it seems they wanted to avoid variable length allocations, in which case you could start with a 255 byte array pointing to which subsequent equal-sized chunk represents each in-use row. You'd need at most 126 bytes per row in actual use to point into the chunks representing the cell contents. But this is just guesses.

      [1] https://www.landley.net/history/mirror/apple2/implementingvi... and https://news.ycombinator.com/item?id=34303825

  • airstrike 34 minutes ago
    > Maintaining a dependency graph would give us the most efficient updates, but it’s often an overkill for a spreadsheet.

    It's not overkill at all. In fact, it's absolutely necessary for all but the simplest toy examples.

    • OliverM 5 minutes ago
      Isn’t the existence & success of visicalc a direct counter to this?
  • bonsai_spool 1 hour ago
    Are there good command-line interfaces for spreadsheets? I don't do anything super financially-important and I'd prefer to stay in the terminal for quick editing of things, especially if I can have Vi keybindings.
    • hunter4309 4 minutes ago
      Visidata[0] is a killer data swiss army knife. It's even inspired off Visicalc

      [0] https://www.visidata.org/

    • zie 47 minutes ago
      There is SC and now sc-im: https://github.com/andmarti1424/sc-im

      You can also literally run Lotus 123 if you want. Someone has binaries to make it work on linux. or under dosemu

      • freedomben 38 minutes ago
        Neat, thank you! sc-im looks amazing, and it's even in the Fedora repos (though the repo version doesn't support xlsx, so I'll compile myself and try it out)
    • rauli_ 1 hour ago
      I actually created one for some time ago. It's nothing special but it has Vi keybindings.

      https://github.com/RauliL/levite

      • vslira 1 hour ago
        This is brilliant! Thank you for creating it
    • freedomben 42 minutes ago
      Oh man, a TUI spreadsheet application that can edit ODF or XLSX format would be absolutely killer. Would love to hear if anyone knows of such a tool
      • airstrike 33 minutes ago
        Pretty sure I can build one based on code I already have. If others are interested in this, please let me know and I'll bang it out in the next couple of weeks.
        • f1shy 2 minutes ago
          I would be interested! Clixel
      • segmondy 29 minutes ago
        vibe one. ;-)
    • chungy 59 minutes ago
      Emacs with org-mode and evil-mode seems to be up your alley.
    • 0x20cowboy 44 minutes ago
      sc has been around for quite a while: https://github.com/robrohan/sc there are several versions floating around.
  • breadsniffer 28 minutes ago
    Anyone know what kind of departments/parts of business were the first adopters of visicalc?
    • SoftTalker 2 minutes ago
      All kinds of operational departments. I'm sure it was used for accounting, payroll and commissions, inventory tracking, I know that teachers used it for gradebooks as I helped set them up when I was in high school (early 1980s).

      Pretty much anything that you used to do on paper with a columnar notebook or anything that could be represented in tabular form could probably be implemented in VisiCalc, Lotus 123, and others. Spreadsheets are probably the most successful software application that was ever invented. Certainly one of the most.

  • khazhoux 9 minutes ago
    I’m genuinely worried that we’re the last generation who will study and appreciate this craft. Because now a kid learning to program will just say “Write me a terminal spreadsheet app in plain C.”
  • tracker1 1 hour ago
    Kinda cool to see... TBH, I'd be more inclined to reach for Rust and Ratatui myslf over C + ncurses. I know this would likely be a much larger executable though.

    With MS Edit resurrected similarly, I wonder how hard it would be to get a flushed out text based spreadsheet closer in function to MS Excel or Lotus 123 versions for DOS, but cross platform. Maybe even able to load/save a few different formats from CSV/TSV to XLSX (without OLE/COM embeds).