18

I've been reading manuals for BASIC implementations and the earliest reference I can find to PEEK, POKE, and USR is in the Altair BASIC 3.2 manual, published in 1975. This morning I came across this article, in the March 31, 1976 issue of the Homebrew Computing Newsletter: "Tiny BASIC is a proper subset of Dartmouth BASIC... For the 6800, this language has been augmented to include the functions RND, USR, and PEEK and POKE, giving the user access to all his system components in the 6800 from the BASIC program." Tom Pittman writes as if he expects his readers to know what these are; now, the Homebrew club did have an early incident of software piracy, with 50 paper tape copies of Altair BASIC distributed, so he might have assumed they knew it from Altair BASIC, but not everyone had an 8080, so that seems a stretch.

What earlier usage, if any, is there of these functions in an implementation of BASIC or another language? Or were they a Microsoft invention?

3
  • 1
    en.wikipedia.org/wiki/PEEK_and_POKE
    – Tim Locke
    Aug 13, 2020 at 15:46
  • 2
    Tim, the citation doesn’t actually confirm that finding, I realized. No where in the manual does it say they created them. This is simply the earliest reference. First implemented in [[Altair BASIC]]<ref>[archive.org/stream/bitsavers_mitsMITSAl_6669937/… Altair 8800 BASIC Reference_Manual 1975], Page 68 of PDF</ref> Aug 13, 2020 at 22:43
  • To ask this in a different way: Why didn't the Wang 2200 or IBM 5100 BASIC's have PEEK/POKE? I assume for the IBM 5100, its BASIC was from System/3 (I think) -- I don't know its exact lineage of BASIC, but in any case it would probably different than TOPS or any of the others mentioned here. For the Wang 2200, maybe it just wasn't deemed necessary or useful in the context of what the system was intended for (sort of desktop publishing), and the cost of implementing any of the features (not microcode).
    – voidstar
    Sep 26, 2022 at 0:54

2 Answers 2

23

Thanks to @another-dave, I went searching in DEC manuals. The decsystem10 Monitor Calls manual has PEEK ("return the contents of a specified exec address") and POKE ("alter the specified location in the monitor"). There is no USR function. While the manual was first printed in June 1971, I can only find a March 1976 revision.

Looking for an older edition, I came across "The PEEK function allows a privileged user to examine any word location in the monitor part of memory. The user program can examine words in the BASIC-PLUS run time system." RSTS/E System Manager's Guide "First printing, October 1974" And it has: "If the user desires a byte change, he must read the word (using the PEEK function), change the desired byte, and rewrite (using the POKE call) the entire word." No USR function.

So then I went searching monitor programs in general, and found PEEK ("used to get the contents of any absolute location in memory") in UUO Manual published in December 1973, definitely pre-Altair. There is no POKE command listed.

So PEEK and POKE predated Altair BASIC and made their way there through BASIC-PLUS.

8
  • That's the SAIL UUO manual for what would later be retronymed the WAITS operating system. Did TOPS-10 have the PEEK UUO too? Aug 14, 2020 at 9:01
  • 1
    Now it's mentioned, I recall PEEK/POKE UUOs on TOPS-10. My use was mid-1970s, versions 5.07 and 6.03 if the memory hasn't paged itself out.
    – dave
    Aug 14, 2020 at 14:51
  • 1
    Assuming PEEK/POKE originated on the -10; then it got to Altair Basic because Gates and Allen were TOPS-10 users; and it got to BASIC-PLUS on RSTS-11 because the authors of that OS were using TOPS-10 as a model. (As far as I recall from the fiche, syscalls were internally called UUOs, even though the mechanism is the definitely-implemented operation EMT)
    – dave
    Aug 14, 2020 at 23:10
  • 1
    CALLI 33 "PEEK" is on page 4-5 of this 1968 manual: bitsavers.org/pdf/dec/pdp10/Monitor/… Aug 17, 2020 at 6:54
  • 1
    CALLI 114 "POKE" was apparently a later addition. See page 2-14 in this 1973 manual: bitsavers.org/pdf/dec/pdp10/TOPS10/… Aug 17, 2020 at 7:55
12

According to the book Endless Loop: The History of the BASIC Programming Language by Mark Jones Lorenzo, they are indeed a Microsoft addition. Divergences in Altair BASIC from Dartmouth BASIC were listed in Appendix H of the Altair manual. Page 75 (emphasis mine):

Among the points mentioned [in Appendix H] are difference in array subscripts, [... more differences ...]; and PEEK (returning the value of a byte to the memory) and POKE (writing the value of a byte to the memory) for direct access to memory. (The POKE keyword would, later on, acquire nefarious uses, such as employing the command to alter the contents of memory addresses in order to facilitate game cheats in 8-bit processors; note that both PEEK and POKE did not exist before Gates and Allen.)

Note that the author is confusing two things here: the MITS Altair BASIC manual does indeed have an Appendix H on porting programs from other BASICs, but it doesn't mention PEEK and POKE. They're described in the main body of the manual.

12
  • Did USR come before or after other means of invoking machine-language code? For most purposes, CALL or SYS is much more convenient.
    – supercat
    Aug 13, 2020 at 16:39
  • 1
    @supercat MS always used USR(), as a function is more versatile than a simple call. Additionally, one may even say USR() came before PEEK and POKE, as it's available with the 4k Version, while the later only come with the 8k Version
    – Raffzahn
    Aug 13, 2020 at 17:22
  • 4
    RSTS (DEC, PDP-11) had PEEK in the early 1970s, but I have not been able to pin down a date of introduction of this feature.
    – dave
    Aug 13, 2020 at 17:24
  • 1
    @supercat A) by putting up a routine there via monitor commads - keep in mind we talk a lower end Altair. B) That's what FACC (Floating Point Accumulator) is for. Works quite fine. And conversion functions have already back then been accessible trhu indirection, so both pretty independent. I suggest looking at MS manuals all the way from Altair to Dragon or MSX.
    – Raffzahn
    Aug 13, 2020 at 17:50
  • 1
    re note that both PEEK and POKE did not exist before Gates and Allen -- and both of those were acquainted with the PDP-10, which OS provided PEEK and POKE, as the answer from @JeffreyHenning shows.
    – dave
    Aug 14, 2020 at 23:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .