Live data from Hacker News

The Apple II Source Code for the LOGO Language Found

blog.adafruit.com

51–60 of 91 posts

Re: The Apple II Source Code for the LOGO Language Found

#51
I looked into this a bit and zeroed in on the implementation of sine/cosine computation, which is pretty critical for turtle graphics.

I didn't follow every last instruction, but it looks like it used a 91 (or maybe 92)-element LUT of 4-byte floats, split into 2 halves. This allows direct look-up of the SIN of every angle in the first quadrant, that is 0 to 90 degrees, plus the value for the next 1-degree angle.

It looks like after looking up the two precalculated values, linear interpolation is then performed between them.

(Also, the FP numbers are in a format that must have been easy to do software arithmetic on. Leading byte is exponent, with bias of 126; next 3 bytes are sign and mantissa, with no implied 1-bit. This has just a hair less precision than a modern 32-bit 'float'. 7A 47 7C 2D is the entry for SIN(1), and is equal to 0.017452407... while double precision SIN(1) is 0.0174524064372835...)

Next, I bodged together a version of what I assume the linear interpolation step does. In both double precision and simulated LOGO precision, the maximum relative error is about .00005 and the maximum absolute error is about .000045, which would be awful hard to detect when plotting to an entire display with about as many pixels as an application icon on your modern high-dpi telephone. On the other hand, that's only 4 correct digits.

This is an interesting contrast to the Commodore BASIC implementation of sin/cos that I'm familiar with. It used a fairly high degree polynomial, which might have gotten a few more accurate digits (5 digits for sin(1.5 degrees)!) but is sure to be quite a bit slower than 2 table lookups, a multiply, and a few add/subtracts. (plus range reduction)

    0.0261759515         Estimated Apple LOGO SIN(1.5 degrees)
           ^
    0.026176948307873153 Modern Double Precision SIN(1.5 degrees)
    0.0261769483         Commodore 64 BASIC SIN(1.5 degrees)
                ^

Re: The Apple II Source Code for the LOGO Language Found

#52
post #29

Note there were two versions of Logo for the Apple II. The other was developed by Logo Computer Systems Inc. (I was one of the staff). Our version was written first in Lisp (on Lisp Machines) then manually compiled to assembler. The Lisp development environment included a full 6502 emulator, allowing the developers to execute Logo either at the Lisp level (fast) or to drop down into the instruction level (slow). The…

Serious overkill huh?

I do have the sources for both those, but only printed not electronic media.

Re: The Apple II Source Code for the LOGO Language Found

#53
post #40

Earlier quoted context omitted.

Diving into that MACLISP file, I found this variable and explanatory comment: > SYNSTAX ... A STACK OF SYNTAX PROPERTIES If there were a "stupid-clever variable names" hall of fame, that one would certainly make the cut.

It also mentions BIBOP LISP: BIg Bag Of Pages (OR (BOUNDP 'BIBOP) (SETQ BIBOP ITS)) ;;THE TURTLE PACKAGE IS GOING TO EAT LOTS OF FLONUM SPACE, SO IN BIBOP LISP, ASSURE ;;THAT ENOUGH WILL BE AVAILABLE. (AND (MEMQ 'BIBOP (STATUS FEATURES)) (ALLOC '(FLONUM (2000. 4000. NIL) FLPDL 2000.))) https://www.saildart.org/BIBOP.RPG[UP,DOC]4 BIBOP is the dynamically expandable version of MACLISP, the SAIL standard MACLISP. Essent…

Which still lives on, after a fashion, in Chez Scheme: https://pdfs.semanticscholar.org/2ee0/8029eebdbdaf80cd70d695...

Re: The Apple II Source Code for the LOGO Language Found

#54
post #7

Wow, what a blast from the past. My introduction to programming was on an old Apple II with BASIC and LOGO. I was in the 6th grade at the time, and never did anything as complex as looping to draw spirals - I basically used LOGO like an etch-a-sketch.

I did the same in grade 7 on an Apple that was shared between two classrooms, and almost never used. I probably used it for an hour that year doing different diagrams in LOGO. Never used any of the conditionals or list processing features of the language though. For someone into computers at that age who had tinkered with BASIC, it was unforgettable.

The Apple in my classroom was also never used for the most part. And with no hard drive and no spare floppy disks, I couldn't save any of my work anyway which made it hard to learn past a very basic level. But it planted the seed, and allowed me to hit the ground running with QBasic :)

Re: The Apple II Source Code for the LOGO Language Found

#55
post #29

Note there were two versions of Logo for the Apple II. The other was developed by Logo Computer Systems Inc. (I was one of the staff). Our version was written first in Lisp (on Lisp Machines) then manually compiled to assembler. The Lisp development environment included a full 6502 emulator, allowing the developers to execute Logo either at the Lisp level (fast) or to drop down into the instruction level (slow). The…

What does "manually compiled to assembler" even mean? How is that different from "rewriting it in assembler"?

Re: The Apple II Source Code for the LOGO Language Found

#56

This is wonderful! My first paid programming job was writing a Logo Adventure program for C64 Terrapin Logo. They wanted a simple non-graphical game that showed off Logo's list processing capabilities, and I just used Logo's top level interpreter as the parser! That saved a lot of coding, but it did let you cheat (aka "learn to understand and program and debug Logo"). https://medium.com/@donhopkins/logo-adventure-for…

Thank you for these LLOGO files (they are concatenated). I have them running in Maclisp.

Re: The Apple II Source Code for the LOGO Language Found

#57
post #52
post #29

Note there were two versions of Logo for the Apple II. The other was developed by Logo Computer Systems Inc. (I was one of the staff). Our version was written first in Lisp (on Lisp Machines) then manually compiled to assembler. The Lisp development environment included a full 6502 emulator, allowing the developers to execute Logo either at the Lisp level (fast) or to drop down into the instruction level (slow). The…

Serious overkill huh? I do have the sources for both those, but only printed not electronic media.

Would it be possible to scan those in?

Re: The Apple II Source Code for the LOGO Language Found

#58

To save others time who want to actually use this, Here's the disk image: https://github.com/pneubauer/ptp2bin/raw/master/LOGO.dsk Here's a web-based emulator to run said disk image: https://www.scullinsteel.com/apple2/ Here's the manual: https://archive.org/details/Apple_Logo_II_Reference_Manual/p...

That's the manual for LCSI Logo.

Re: The Apple II Source Code for the LOGO Language Found

#59

The source code is 213 KB of ASCII, assembled on 1980-8-6. A souped-up Apple II at that time would have had 64 KB of RAM, and 140 KB of storage per floppy disk. I guess you needed a PDP-11 to do any real work in those days.

Not PDP-11. This was cross assembled from a PDP-10 running MIT's Incompatible Timesharing System.

Re: The Apple II Source Code for the LOGO Language Found

#60
post #36

The source code is 213 KB of ASCII, assembled on 1980-8-6. A souped-up Apple II at that time would have had 64 KB of RAM, and 140 KB of storage per floppy disk. I guess you needed a PDP-11 to do any real work in those days.

A PDP-11/45 or 11/70 would have much more memory, but being a 16 bit machine would still have been unable to handle this file in a conventional editor. Honestly I don't know if there were paging editors available for common environments. Certainly nothing on Unix would have worked. Per the link, the file was editted and built on a PDP-10 running ITS, which was a 36 bit machine with an 18 bit address space. Interestin…

ITS text files use 7-bit ASCII. Five characters packed per word. Some things like file names use a 6-bit ASCII subset (the range 32-95).

What have you seen from ITS?

Post reply on HN