Skip to content

Commit

Permalink
Version 1.0.8 - changes by Nick
Browse files Browse the repository at this point in the history
- implemented disk writing (only in memory, not persisted)
- added support for .2MG (2IMG) disk images, including lock flag and volume number
- support meta tag for write protect in disk filename eg: NotWritable_Meta_DW0.dsk
  • Loading branch information
sicklittlemonkey committed Aug 1, 2015
1 parent af1cec2 commit add3d41
Show file tree
Hide file tree
Showing 8 changed files with 243 additions and 174 deletions.
14 changes: 13 additions & 1 deletion Source/AppleDisplay.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* AppleIIGo
* Display processing
* (C) 2006 by Marc S. Ressl (ressl@lonetree.com)
* (C) 2006 by Marc S. Ressl (mressl@gmail.com)
* Released under the GPL
*/

Expand Down Expand Up @@ -224,6 +224,18 @@ public float getScale() {
return displayScale;
}

public int getSizeX()
{
precalcDisplay();
return displayScaledSizeX;
}

public int getSizeY()
{
precalcDisplay();
return displayScaledSizeY;
}

/**
* Set refresh rate
*
Expand Down
51 changes: 35 additions & 16 deletions Source/AppleIIGo.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,18 @@
/**
* AppleIIGo
* The Java Apple II Emulator
* Copyright 2009 by Nick Westgate ([email protected])
* Copyright 2006 by Marc S. Ressl (ressl@lonetree.com)
* Copyright 2011 by Nick Westgate ([email protected])
* Copyright 2006 by Marc S. Ressl (mressl@gmail.com)
* Released under the GNU General Public License version 2
* See http://www.gnu.org/licenses/
*
* Change list:
*
* Version 1.0.8 - changes by Nick:
* - implemented disk writing (only in memory, not persisted)
* - added support for .2MG (2IMG) disk images, including lock flag and volume number
* - support meta tag for write protect in disk filename eg: NotWritable_Meta_DW0.dsk
*
* Version 1.0.7 - changes by Nick:
* - fixed disk emulation bug (sense write protect entered write mode)
* - now honour diskWritable parameter (but writing is not implemented)
Expand Down Expand Up @@ -75,7 +80,7 @@ public class AppleIIGo extends Applet implements KeyListener, ComponentListener,

private static final long serialVersionUID = -3302282815441501352L;

final String version = "1.0.7";
final String version = "1.0.8";
final String versionString = "AppleIIGo Version " + version;
final String metaStart = "_meta_";

Expand Down Expand Up @@ -200,8 +205,6 @@ public void destroy() {
unmountDisk(0);
unmountDisk(1);
}



// Public Java interface

Expand Down Expand Up @@ -247,7 +250,6 @@ public void reset() {
debug("reset()");
apple.reset();
}


public void setSpeed(int value) {
debug("setSpeed(" + value + ")");
Expand Down Expand Up @@ -292,7 +294,8 @@ private DataInputStream openInputStream(String resource, StringBuffer OutFilenam
}

try {
URL url = new URL(getCodeBase(), resource);
URL codeBase = getCodeBase();
URL url = new URL(codeBase, resource);
debug("resource: " + url.toString());

is = url.openStream();
Expand Down Expand Up @@ -378,6 +381,7 @@ public boolean mountDisk(int drive, String resource) {
DataInputStream is = openInputStream(resource, diskname);

int diskVolumeNumber = DiskII.DEFAULT_VOLUME;
boolean diskWritableOverride = diskWritable;

// handle disk meta tag for disk volume (etc?)
// could break this out into a method, but then multiple tags ...?
Expand Down Expand Up @@ -427,14 +431,18 @@ public boolean mountDisk(int drive, String resource) {
case ('d' << 16) + 'v':
diskVolumeNumber = operand;
break;

case ('d' << 16) + 'w':
diskWritableOverride = (operand != 0);
break;
}
command = 0;
operand = 0;
}
}
}

success = disk.readDisk(drive, is, diskname.toString(), !diskWritable, diskVolumeNumber);
success = disk.readDisk(drive, is, diskname.toString(), !diskWritableOverride, diskVolumeNumber);
is.close();
showStatus("Drive " + (drive + 1) + ": " + resource);
} catch (Exception e) {
Expand All @@ -455,12 +463,13 @@ public void unmountDisk(int drive) {
if (!diskWritable)
return;

try {
OutputStream os = openOutputStream(diskDriveResource[drive]);
disk.writeDisk(drive, os);
os.close();
} catch (Exception e) {
}
// TODO: only for local disk cache when it's working
//try {
//OutputStream os = openOutputStream(diskDriveResource[drive]);
//disk.writeDisk(drive, os);
//os.close();
//} catch (Exception e) {
//}
}

/**
Expand Down Expand Up @@ -501,6 +510,16 @@ public boolean getDiskActivity() {
return (!isCpuPaused && disk.isMotorOn());
}

public int getSizeX()
{
return display.getSizeX();
}

public int getSizeY()
{
return display.getSizeY();
}

/**
* KeyListener event handling
*/
Expand Down Expand Up @@ -626,7 +645,7 @@ else if (e.getKeyLocation() == KeyEvent.KEY_LOCATION_NUMPAD)
apple.stepInstructions(128);
}
break;
case KeyEvent.VK_CANCEL: // Ctrl-Pause/Break sends this (N/A on Mac)
case KeyEvent.VK_CANCEL: // Pause/Break sends this (as Mac OS swallows Ctrl-F12)
case KeyEvent.VK_F12:
if (e.isControlDown())
reset();
Expand Down Expand Up @@ -846,5 +865,5 @@ public void paint(Graphics g) {
*/
public void update(Graphics g) {
display.paint(g);
}
}
}
2 changes: 1 addition & 1 deletion Source/AppleSpeaker.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* AppleIIGo
* Speaker processing
* (C) 2006 by Marc S. Ressl(ressl@lonetree.com)
* (C) 2006 by Marc S. Ressl(mressl@gmail.com)
* Released under the GPL
*/

Expand Down
Loading

0 comments on commit add3d41

Please sign in to comment.