|
Pong in Forth for the Mac
English
Español
Français
Home of PLForth for the Mac
Pong in Forth for the Mac
This page was http://members.aol.com/plforth/ofpong/index.html sometime after Thursday, November 18, 2004 began.
Incidentally, I'm looking for work, near
http://members.aol.com/plscsi/resume
See also blog plavarre ofpong issues
Hi. We say a Command+Option+O+F `boot` of 20020313/ofpong.txt should let two
play Pong, using the A Z ' / Esc Delete keys.
For example, a classic Bondi Blue iMac running Pong looks like this:
What Is Pong?
Pong is a classic video arcade game. (Was it the first to
reach a mass audience?).
Pong is a rough simulation of table tennis. One player moves a
paddle up and down at the left of the screen, another moves the
paddle at right, in order to bounce a ball back and forth. Every
time you miss the ball your opponent gets a point. The first
player to get 15 points wins.
Who On Earth Plays Pong?
People who have kindly reported to us that indeed they can run
our Pong under flags.html
around the world include:
Cube -
gnarlodious
iMac - flat-panel - Chris Mertens
iMac - G5 1.8 GHz - Florian Painke
iMac - G5 1.8 GHz 20" - Clive Hayward
iMac - DV SE 400MHz - Roelf Toxopeus
iMac - classic Bondi Blue - Pat LaVarre
PowerMac - G4 QuickSilver Dual 800MHz - Shane Moss
PowerMac - G5 1.6 GHz - Benn Oshrin
Aluminium PowerBook - 1.5 GHz - bifferbodkins
iBook - 600 M8600LL/A - Uuter von Vimon
iBook - SE 500MHz - dual USB - Anders Bornas
iBook - 1.07 GHz G4 boot ROM 4.8.5f0
- Bluetooth keyboard - Kyle Dean
TiBook -
gnarlodious
PowerBook - G3 Pismo - Tommy Knowlton
PowerBook - 550 MHz G4 - Robert Heinrich
If you have a Mac of a kind not listed here, or if you can
help us more clearly distinguish your Mac from the Mac's we do
have listed here, then please do try running our Pong on your
Mac. You can then write us at mailto:p.lavarre@ieee.org
to tell us how well our Pong works for you. Just for
trying something new, or just for running Pong under a new flag,
we'd be honoured to publish your name and/or email
address here, if you think that's fun.
By the way, we're NOT the only people working to help grow the OFPong community.
See also:
http://homepage.mac.com/potswa/source/
http://www.google.com/search?q=ofpong
How Do I Play?
Run our Pong. Then, while
playing, to control the game, you hold down
different keys on the keyboard:
A = left player paddle up
Z = left player paddle down
' = right player paddle up
/ = right player paddle down
Escape = end one game and start another
Delete = stop playing
But HOW Do I Run Pong?
In short, `boot` a copy of 20020313/ofpong.txt
.
In four or more steps:
- Get an Apple iMac, iBook, PowerMac, or PowerBook,
from the Apple Store
or elsewhere. To run our Pong, you need a Mac. If you
don't have a Mac, uou can run a lesser
Pong, but you're missing out.
- Store a copy of the most recent
ofpong.txt in the hd whose contents MacOF shows
below in response to `dir hd:\`. Often, in MacOS, what
was the MacOF hd is the root folder of your boot
"Macintosh HD". You need store a file of
"plain text" that begins with an x5C \
backslash and an x20 blank, else the `boot` command will
refuse to run your code. To refuse, MacOF will say
something like "unrecognized Client Program
format" or "LOAD-SIZE is
too small". (Complaints like "MAC-PARTS:
specified partition is not valid" and "DISK-LABEL: LOAD
(noninterposed) not supported" indicate deeper
confusion.)
- Start up your Mac with the four keys Command+Option+O+F
held down together. See a black on white screen
spit out a few lines of gobbledygook including a string
like "Open Firmware" buried in it somewhere.
See the mouse does not work. See scrolling is horribly,
horribly slow on newer Mac's.
- Then try entering such commands as:
dir hd:\
boot hd:\ofpong.txt
bye
See macofx5c.html if you
have a keyboard that cannot type the x5C \ backslash
char. (We've been told only Mac's shipped outside of the
USA, and of those only the earliest iMac's, had this
problem.)
- If the `dir hd:\` doesn't show you downloaded a copy of
`ofpong.txt`, then ask yourself if you may have
downloaded a copy of `ofpong.txt` to a partition that
MacOF doesn't understand is your main hd.
If so, then enter `bye` to get back to MacOS, make a copy
of `ofpong.txt` in the root folder of every partition,
and then try again. Alternatively, you could try entering
`dir hd:1,\` and then `dir hd:2,\` and so on til you do
find the `ofpong.txt` you downloaded. If, for example,
you find `ofpong.txt` in `dir hd:10,\`, then the command
to run it from there is `boot hd:10,\ofpong.txt`.
We know the command `dir cd:\` works and we therefore
believe the command `boot cd:\ofpong.txt` would work, if
you happened to have a copy of ofpong.txt on a Cd-rom
disk.
- Once you are playing Pong, to get a chance to enter that
`bye` command, try pressing Delete to stop playing, else
try Ctrl+Z if Delete doesn't work.
Entering the `bye` command says go ahead
and finish booting into MacOS. If you'd rather just `shut-down`,
then you can use that command instead. Or you can enter
the `pong` command to play again.
Will Our OFPong Get Better Real Soon Now?
We know we wish we could say:
- Click here to see a screen shot.
- You can hear the ball bounce against the paddles and fly
thru the air. You can hear the paddles move and you can
hear the score increase.
- If you press Command+Shift+3, you hear the sound of a
camera shutter clicking while Pong saves a screenshot of
the current game to the root folder of your boot hard
drive in a file named Picture1, Picture2, etc.
- You may press the S X ; . keys rather than the A Z ' /
keys (especially if you find that pressing Z key to move
the left paddle down crashes the game and makes you enter
the `pong` command to play again.) (The experimental 20020317/ofpong.txt
version lets you do this by way of learning to react to
every key on the keyboard in some way, except for the
Shift, Control, Option, and Command keys..)
- With just one mouse you can move both paddles together.
- You can plug in two mice if you want one mouse to move
the left paddle and the other mouse to control the right
paddle.
- You can enter the command `pong 1` to play a person
against the computer, instead of one person against
another.
- You can enter the command `pong 0` to play the computer
against itself.
As yet, we've done little to none of this, and we think we can
even claim to know how to do much less than all of it.
Who Wrote This Code?
To construct our ofpong.txt file, we made a copy of the 1.0d1 MacHack
'98 release of OFPong.of found at ftp://ftp.machack.com/Hacks98/ofpong.sit
for those of you who have browsers than can follow Ftp links.
OFPong is a two colour (white on black by default), two player
Pong that shows the score on screen.
We made six technical changes:
- Begin a file of plain text with \ commentary, like `boot`
wants to see.
- Comment out the `dl` command, guessing that has something
to do with running this game over a serial or Usb
connection, as opposed to using `boot` to run this from a
file system.
- End with a `pong` command so that `boot` runs the game.
- Use `dev keyboard` where `dev kbd` is unavailable, and
accordingly adjust which bits of the key-map to poll to
see the keys A Z ' / Esc Delete held down.
- Use [ s" dev keyboard get-key-map 0 to
active-package" evaluate ] in place of [ "
get-key-map" ... $call-method ] because [ s"
keyboard" open-dev ] crashes a classic iMac hard.
- Draw with the background-color and erase with the
foreground-color, rather than with colors -1 and 0,
because on a flat-panel iMac the color -1 is black or
transparent, not visibly different from the black
background color 0.
Yes, clearly, we don't yet
know what we're doing.
At least the following four technical mysteries confuse
us greatly:
- We don't know how we should distinguish one Mac
than can run Pong from another.
Most of all, we'd like to know precisely which Mac's are
tn2001 `boot` capable. Maybe all the tn1167 "New
World" Mac's? Ok then, which are those? Are they
precisely all the Mac's that shipped with Usb built-in?
How many distinct flavours of the MacOF of iMac/ iBook/
PowerBook/ PowerMac did ship?
And how can we display again for emphasis the version
stamp (e.g. ... 3.0.f8 ...8/06/98 12:04:16) that appears
by default when MacOF launches?
- We have no idea how to discover which MacOS hard
drive icon corresponds to the `dir hd:\` of MacOF, except
by having you recognise the names of your files.
Systems shipped fresh from Apple seem to run Pong fine,
but people who have partitioned their hard drive and
changed their choice of startup disk have to choose the
Low Tech Solution (put a copy of ofpong.txt into the root
folder of every hard drive) or the High Tech Solution
(hunt thru `dir hd:1,\`, `dir hd:2,\`, ... `dir hd:15,\`
... and correspondingly think to type `boot
hd:5,\ofpong.txt` rather than just `boot hd:\ofpong.txt`)
or ...
- We're not clear if and when pressing the Z key
crashes Pong.
We think Ctrl+Z is supposed to crash the game, because we
think Ctrl+Z is the Ctrl+Break terminal interrupt key of
MacOF, but we think we see that pressing Z alone
sometimes has the same effect.
Please write to tell us if you play enough Pong to see
that pressing Z sometimes does crash the game, making you
enter the `pong` command to start playing again. We'd
like to learn how to turn this feature off.
- We don't know how alike all Mac keyboards are or
are not.
How does your Mac keyboard differ from the Mac
keyboards we have? We have no idea. We think we care
because Pong has to see when keys are released, not just
when they are pressed. That is, Pong has to look at [
get-key-map ] scan codes we found by trial & error,
not just standard Ascii [ key ] pressed codes.
How portable is the existing source for recognising key
codes? Can it be improved? We know MacOF itself must
solve this problem somehow, in order to make sense of
what you type at the keyboard. We wish we knew how to ask
MacOF which bit patterns mean which keys.
We have seen get-key-map differ between a classic iMac
and an iBook in small ways. In particular, on an iBook,
we saw the same scan code for the key -_ as for the key
mM, and the same code for the key 8* as for the key ]}.
See Here:
The most recent release of OFPong (Wednesday,
March 13, 2002)
20020313/ofpong.txt
Our screenshot of OFPong
http://members.aol.com/plforth/ofpong/20020317/ofpongthumb.jpg
(shown already above)
http://members.aol.com/plforth/ofpong/20020317/ofpongnail.jpg
(shrunk to icon size)
Pong in Forth for the Mac, the original (expanded from .sit,
then names changed by removing blanks and adding .txt):
OFPong1.0d1/OFPongReadMe.txt
OFPong1.0d1/OFPong.of.txt
Tools for Porting Pong to more Mac's
20020317/ofpong.txt
(experimental: each key of the keyboard has an effect, except for
the shift keys)
20020317/ofport.txt (tools for
polling the keyboard)
20020302/ofport.txt (tools for
polling the keyboard that crash hard if run on a classic iMac)
See Elsewhere:
The Forth of the Mac
http://members.aol.com/plforth/moforth/index.html
Pong in Forth for the Mac - the original, in its original
format:
http://www.machack.com/Hack98.html
ftp://ftp.machack.com/Hacks98/ofpong.sit
Pong in Forth for the Mac - updated differently:
http://homepage.mac.com/potswa/source/
http://homepage.mac.com/potswa/source/OFPong1.1.sit
Lesser Pong's, online - ordered roughly
from most to least classic
http://javaboutique.internet.com/tutorials/Java_Game_Programming/
write the first great Java Pong yourself
http://www.serve.com/wizjd/java/pong/two_player_pong/two_player_pong.html
- paddles may be slow
http://javaboutique.internet.com/PingPong/
- two player only if you have two mice
http://www.freefungames.com/applets/pongs/open.shtml
http://javaboutique.internet.com/SimplePong/
http://www.ability.org.uk/ping2.html
- hands touch if your four arrow keys are close together
http://javaboutique.internet.com/ping2/
http://www.vietfun.com/games/ping2/
http://www.xnet.se/javaTest/jPong/jPong.html
single player
http://javaboutique.internet.com/StreetHockey/
not quite Pong
(By "classic" Pong we mean in particular two player,
white on black, with sound, using the same font for score, ball,
and paddles.)
Usenet on Mac Open Firmware
http://groups.google.com/groups?group=comp.lang.forth.mac
http://groups.google.com/groups?group=comp.sys.mac.hardware
http://groups.google.com/groups?group=uk.comp.sys.mac
Yahoo on Classic Arcade Games
http://dir.yahoo.com/Recreation/Games/Video_Games/Classic_Arcade_Games/
Yahoo on Pong (no two player Pong's yet appear on the web?)
http://dir.yahoo.com/Recreation/Games/Video_Games/Classic_Arcade_Games/Titles/Pong/
Thanks:
To the MacHack folk who first had this idea and then
volunteered to do nearly all the work.
To the folk of news:comp.lang.forth.mac
who taught us MacOF `sifting dev`, `sifting color`, and more.
Finally:
We don't like leaving our Pong code here this broken,
but it works here at our desks and elsewhere. More
specifically, at #Who we list whose Mac's can
run our Pong and at flags.html we say
where Mac's are running our Pong).
Indeed, we've been told a port to the Open Firmware of Sun workstations is possible.
Wanna try?
(We don't have a Sun workstation. (Wanna donate one?))
To fix this code, we need you to share with us more info about
where this game doesn't just plain work how, if anywhere in any
way. We're posting this code on the principle "given
enough eyeballs, all bugs are shallow". We're hoping to
provoke folk of comp.lang.forth.mac
to help us out here real
soon now.
At mailto:p.lavarre@ieee.org
we await your comments and questions.
Home of PLForth for the
Mac
|