APLawrence.com -  Resources for Unix and Linux Systems, Bloggers and the self-employed

2003/09/13 Peek and poke


© September 2003 Tony Lawrence

Most BASIC's had these commands that let you directly access memory. When I had my TRS-80 Model I, I used these to write a very crude assembler. More often they were used to get information from system maintained areas; status of ports, that sort of thing.

I don't think I've heard anyone use either of these in this context in many a year.

Got something to add? Send me email.





(OLDER)    <- More Stuff -> (NEWER)    (NEWEST)   

Printer Friendly Version

->
-> Peek and poke

3 comments


Inexpensive and informative Apple related e-books:

Photos: A Take Control Crash Course

Take Control of OS X Server

Photos for Mac: A Take Control Crash Course

Take Control of iCloud, Fifth Edition

Are Your Bits Flipped?




More Articles by © Tony Lawrence



When the legendary(?) Commodore 64 was released in 1982, it attracted a lot of attention because of its three channel SID (sound interface device), which was capable of some amazing (at the time) audio feats. Unfortunately, the C-64's BASIC interpreter (a Microsoft "product" stolen from Dartmouth College's intellectual property) had no language primitives for driving the SID, forcing one to POKE values to the chip registers to set frequencies, configure the ADSR envelope, select the waveform, etc.

As coded in MS BASIC, POKEing was a relatively slow process, primarily because both the memory address and the value being POKEd had to undergo ASCII to floating point conversion, followed by a floating point to integer conversion—obviously, RAM addresses and contents could only be integers. The ASCII to floating point conversion was performed in "excess 128" notation (another Microsoft "innovation"), which is/was grossly inferior to the 4 byte IEEE format that is used by single precision floating point numbers in C. The end result of all this fussing with numerical formats was an inability to play music from BASIC at a tempo substantially faster than a speeding snail. You might be able to play the melody from "Yackety Sax" but you wouldn't be able to play it fast enough to recognize it as such.

The solution, of course, was to do it in 6502 machine language, which would then allow you to play Bach's "Two Part Invention in F" at least 10 times faster than old man Sebastian himself could've managed on the best harpsichords of the day. <Grin>

—BigDumbDinosaur

"C-64's BASIC interpreter (a Microsoft "product" stolen from Dartmouth College's intellectual property)"

Somewhere around there Bill wrote his famous "you are stealing my software" letter. Such chutzpah :-)

--Art

Right you are—it was around 1976, if I correctly recall. A friend of mine has a theory that Bill Gates was always getting sand kicked in his face at the beach. He sent away for Charles Atlas' muscleman program but Atlas didn't reply. How else to explain such an anal-retentive jackass?

BTW, the bootup banner on the C-64 made no mention of Microsoft, even though MS BASIC was started at boot time. However, the C-128, which was probably (here come the makings of a possible flame war) the best 8 bit design ever, included a Microsoft copyright notice in the banner, right below the CBM statement.

By then, I wasn't using BASIC at all, as the performance of pure 65xx M/L was too much to ignore and the performance of BASIC 7.0 was too feeble to tolerate. Unfortunately, a really good C compiler wasn't available at the time, so I cobbled up a "pidgin" language out of raw assembly code, bewildering macros (it bewildered me that they actually worked), various pseudo-ops, and a sizable library of display, math, string, and file I/O subroutines. So who needed Microsoft and their half-assed interpreter? And that was in 1985, before we fully understood what was in store for us by allowing Billy into our computers.

—BigDumbDinosaur



------------------------


Printer Friendly Version

Have you tried Searching this site?

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more.

Contact us


Printer Friendly Version





Today the theory of evolution is about as much open to doubt as the theory that the earth goes round the sun. (Richard Dawkins)




Linux posts

Troubleshooting posts


This post tagged:

Programming

UnixWords



Unix/Linux Consultants

Skills Tests

Unix/Linux Book Reviews

My Unix/Linux Troubleshooting Book

This site runs on Linode





SCO Unix Sales, Support, & Service

Phone:  707-SCO-UNIX (707-726-8649Toll Free: 833-SCO-UNIX (833-726-8649)
www.SCOsales.com