From 2492947e1dae2a6ab35e4bf335121305b22de546 Mon Sep 17 00:00:00 2001 From: James Tauber Date: Wed, 18 Apr 2012 07:36:57 -0400 Subject: [PATCH 1/7] made applepy.py executable --- applepy.py | 2 ++ 1 file changed, 2 insertions(+) mode change 100644 => 100755 applepy.py diff --git a/applepy.py b/applepy.py old mode 100644 new mode 100755 index 0ed7736..3c932e3 --- a/applepy.py +++ b/applepy.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python + # ApplePy - an Apple ][ emulator in Python # James Tauber / http://jtauber.com/ # originally written 2001, updated 2011 From 82de64b000304fa3dbd722a1848d1dcd177e85ce Mon Sep 17 00:00:00 2001 From: James Tauber Date: Mon, 23 Jul 2012 04:14:42 -0400 Subject: [PATCH 2/7] treat README as Markdown --- README => README.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename README => README.md (100%) diff --git a/README b/README.md similarity index 100% rename from README rename to README.md From 1de396334e7b652bb09f965d7c4eebfdfd582b34 Mon Sep 17 00:00:00 2001 From: James Tauber Date: Mon, 23 Jul 2012 04:15:26 -0400 Subject: [PATCH 3/7] added MIT license --- LICENSE | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..20d59ca --- /dev/null +++ b/LICENSE @@ -0,0 +1,19 @@ +# Copyright (c) 2001-2012 James Tauber and contributors +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. \ No newline at end of file From 6a818ae8ac19fe4a942aeae477434a9f4fd37333 Mon Sep 17 00:00:00 2001 From: James Tauber Date: Mon, 23 Jul 2012 04:18:42 -0400 Subject: [PATCH 4/7] added mention of numpy requirement --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9bdd5d1..ce6c160 100644 --- a/README.md +++ b/README.md @@ -32,4 +32,5 @@ The only I/O supported is the keyboard and screen but 40-column text, LORES and HIRES graphics are all supported. ApplePy currently requires Pygame (although there is a minimal applepy_curses.py -that uses curses to display text mode only). \ No newline at end of file +that uses curses to display text mode only) and numpy (just for an array for +speaker sounds) From e9c9581857ca45199bd00831831c06a207304549 Mon Sep 17 00:00:00 2001 From: James Tauber Date: Mon, 23 Jul 2012 04:18:55 -0400 Subject: [PATCH 5/7] added explicit mention of License in README --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index ce6c160..6ffc75b 100644 --- a/README.md +++ b/README.md @@ -34,3 +34,9 @@ and HIRES graphics are all supported. ApplePy currently requires Pygame (although there is a minimal applepy_curses.py that uses curses to display text mode only) and numpy (just for an array for speaker sounds) + + +License +------- + +This code is made available under an MIT License. See LICENSE. From 0d41f951b928d6e3c08b2d78adf918d23fd01597 Mon Sep 17 00:00:00 2001 From: James Tauber Date: Fri, 8 Mar 2013 06:56:52 -0500 Subject: [PATCH 6/7] improved hires colour, fixed non-ASCII key crash, fixed to work with later pygame/numpy --- LICENSE | 2 +- applepy.py | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/LICENSE b/LICENSE index 20d59ca..d96974f 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -# Copyright (c) 2001-2012 James Tauber and contributors +# Copyright (c) 2001-2013 James Tauber and contributors # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/applepy.py b/applepy.py index 3c932e3..7754ec4 100755 --- a/applepy.py +++ b/applepy.py @@ -234,20 +234,24 @@ class Display: if xx % 2: pixels[x][y] = (0, 0, 0) # orange + pixels[x][y] = (255, 192, 0) if c else (0, 0, 0) # @@@ pixels[x + 1][y] = (255, 192, 0) if c else (0, 0, 0) else: # blue pixels[x][y] = (0, 192, 255) if c else (0, 0, 0) pixels[x + 1][y] = (0, 0, 0) + pixels[x + 1][y] = (0, 192, 255) if c else (0, 0, 0) # @@@ else: if xx % 2: pixels[x][y] = (0, 0, 0) # green + pixels[x][y] = (0, 255, 0) if c else (0, 0, 0) # @@@ pixels[x + 1][y] = (0, 255, 0) if c else (0, 0, 0) else: # violet pixels[x][y] = (255, 0, 255) if c else (0, 0, 0) pixels[x + 1][y] = (0, 0, 0) + pixels[x + 1][y] = (255, 0, 255) if c else (0, 0, 0) # @@@ pixels[x][y + 1] = (0, 0, 0) pixels[x + 1][y + 1] = (0, 0, 0) @@ -269,15 +273,15 @@ class Speaker: CHECK_INTERVAL = 1000 def __init__(self): - pygame.mixer.pre_init(44100, -16, 1) + pygame.mixer.pre_init(11025, -16, 1) pygame.init() self.reset() def toggle(self, cycle): if self.last_toggle is not None: l = (cycle - self.last_toggle) / Speaker.CPU_CYCLES_PER_SAMPLE - self.buffer.extend([0, 0.8] if self.polarity else [0, -0.8]) - self.buffer.extend((l - 2) * [0.5] if self.polarity else [-0.5]) + self.buffer.extend([0, 26000] if self.polarity else [0, -2600]) + self.buffer.extend((l - 2) * [16384] if self.polarity else [-16384]) self.polarity = not self.polarity self.last_toggle = cycle @@ -287,7 +291,7 @@ class Speaker: self.polarity = False def play(self): - sample_array = numpy.array(self.buffer) + sample_array = numpy.int16(self.buffer) sound = pygame.sndarray.make_sound(sample_array) sound.play() self.reset() @@ -419,7 +423,7 @@ class Apple2: if key: if key == 0x7F: key = 0x08 - self.softswitches.kbd = 0x80 + key + self.softswitches.kbd = 0x80 + (key & 0x7F) update_cycle += 1 if update_cycle >= 1024: From fe80bc897def9451c388c88715f599f8edbd26b8 Mon Sep 17 00:00:00 2001 From: James Tauber Date: Fri, 8 Mar 2013 07:00:00 -0500 Subject: [PATCH 7/7] added note about exact pip and brew commands I used --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 6ffc75b..3406554 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,12 @@ ApplePy currently requires Pygame (although there is a minimal applepy_curses.py that uses curses to display text mode only) and numpy (just for an array for speaker sounds) +Here's how I set up the dependencies (on Mac OS X 10.8): + + pip install numpy + brew install sdl sdl_image sdl_mixer sdl_ttf portmidi hg + pip install hg+http://bitbucket.org/pygame/pygame + License -------