Compare commits

...

7 Commits

Author SHA1 Message Date
Peter Ferrie
67f7232046
Merge d4d3c59b8c into 7f0b3c5d83 2024-03-24 16:47:16 -05:00
Brendan Robert
7f0b3c5d83 Remove extra debugging messages 2024-03-24 16:47:12 -05:00
Brendan Robert
2ca93fc26e Adjust behaviors during boot, also adjust joystick for Boulder Dash bugfix 2024-03-24 16:38:18 -05:00
Peter Ferrie
d4d3c59b8c defer case check to be faster 2023-09-03 15:08:16 -07:00
Peter Ferrie
c540527370 another fix 2023-09-03 14:42:51 -07:00
Peter Ferrie
3f359cf3ff fix a couple of bugs, compare a bit faster 2023-09-03 14:41:10 -07:00
Peter Ferrie
b258ed441a decompress faster 2023-09-02 11:30:15 -07:00
9 changed files with 74 additions and 58 deletions

View File

@ -63,7 +63,7 @@ public class LawlessLegends extends Application {
}
primaryStage.show();
Platform.runLater(() -> new Thread(() -> {
new Thread(() -> {
Emulator.getInstance(getParameters().getRaw());
Emulator.withComputer(c-> {
((LawlessComputer)c).initLawlessLegendsConfiguration();
@ -84,7 +84,7 @@ public class LawlessLegends extends Application {
Thread.onSpinWait();
}
bootWatchdog();
}).start());
}).start();
primaryStage.setOnCloseRequest(event -> {
Emulator.withComputer(Computer::deactivate);
Platform.exit();

View File

@ -63,7 +63,7 @@ public class Apple2e extends Computer {
static int IRQ_VECTOR = 0x003F2;
@ConfigurableField(name = "Production mode", shortName = "production")
public boolean PRODUCTION_MODE = false;
public boolean PRODUCTION_MODE = true;
@ConfigurableField(name = "Slot 1", shortName = "s1card")
public DeviceSelection<Cards> card1 = new DeviceSelection<>(Cards.class, null);
@ConfigurableField(name = "Slot 2", shortName = "s2card")

View File

@ -133,7 +133,6 @@ public abstract class Computer implements Reconfigurable {
getMotherboard().addChildDevice(video);
video.configureVideoMode();
video.reconfigure();
video.resume();
}
if (LawlessLegends.getApplication() != null) {
LawlessLegends.getApplication().reconnectUIHooks();

View File

@ -105,10 +105,6 @@ public abstract class Device implements Reconfigurable {
newDevices.stream().filter(d-> !children.contains(d)).forEach(this::addChildDevice);
}
public boolean getRunningProperty() {
return run;
}
public void addWaitCycles(int wait) {
waitCycles += wait;
}
@ -170,11 +166,19 @@ public abstract class Device implements Reconfigurable {
}
public final synchronized void setRun(boolean run) {
// if (this.run != run) {
// System.out.println(getDeviceName() + " " + (run ? "RUN" : "STOP"));
// Thread.dumpStack();
// }
this.run = run;
updateTickHandler();
}
public synchronized void setPaused(boolean paused) {
// if (this.paused != paused) {
// System.out.println(getDeviceName() + " " + (paused ? "PAUSED" : "UNPAUSED"));
// Thread.dumpStack();
// }
this.paused = paused;
updateTickHandler();
}

View File

@ -336,8 +336,8 @@ public class Joystick extends Device {
// We have to let the joystick go a little further in the positive direction
// because boulderdash is a little too sensitive!
x = Math.max(-1.0f, Math.min(1.1f, x * sensitivity));
y = Math.max(-1.0f, Math.min(1.1f, y * sensitivity));
x = Math.max(-1.0f, Math.min(1.0f, x * sensitivity));
y = Math.max(-1.0f, Math.min(1.0f, y * sensitivity));
joyX = (int) (x * 128.0 + 128.0);
joyY = (int) (y * 128.0 + 128.0);
@ -595,6 +595,14 @@ public class Joystick extends Device {
public void initJoystickRead(RAMEvent e) {
readJoystick();
xSwitch.setState(true);
// Some games just suck and don't want to read the joystick properly
// Use larger-than-necessary values to try to get around this
if (joyX >= 254) {
joyX = 280;
}
if (joyY >= 255) {
joyY = 280;
}
x = 10 + joyX * 11;
ySwitch.setState(true);
y = 10 + joyY * 11;

View File

@ -29,6 +29,7 @@ import java.util.logging.Logger;
import jace.Emulator;
import jace.apple2e.MOS65C02;
import jace.apple2e.SoftSwitches;
import jace.core.RAM;
import jace.hardware.ProdosDriver.MLI_COMMAND_TYPE;
@ -106,7 +107,7 @@ public class LargeDisk implements IDisk {
@Override
public void boot0(int slot) {
Emulator.withComputer(c->
c.getCpu().whileSuspended(()->{
c.getCpu().whilePaused(()->{
try {
// System.out.println("Loading boot0 to $800");
mliRead(0, 0x0800);
@ -117,6 +118,16 @@ public class LargeDisk implements IDisk {
// System.out.println("X = "+Integer.toHexString(slot16));
((MOS65C02) c.getCpu()).X = slot16;
RAM memory = c.getMemory();
SoftSwitches.AUXZP.getSwitch().setState(false);
SoftSwitches.LCBANK1.getSwitch().setState(false);
SoftSwitches.LCRAM.getSwitch().setState(false);
SoftSwitches.LCWRITE.getSwitch().setState(true);
SoftSwitches.RAMRD.getSwitch().setState(false);
SoftSwitches.RAMWRT.getSwitch().setState(false);
SoftSwitches.CXROM.getSwitch().setState(false);
SoftSwitches.SLOTC3ROM.getSwitch().setState(false);
SoftSwitches.INTC8ROM.getSwitch().setState(false);
memory.write(CardMassStorage.SLT16, slot16, false, false);
memory.write(MLI_COMMAND, (byte) MLI_COMMAND_TYPE.READ.intValue, false, false);
memory.write(MLI_UNITNUMBER, slot16, false, false);

View File

@ -39,7 +39,7 @@ public class LawlessComputer extends Apple2e {
this.cheatEngine.setValue(Cheats.Cheat.LawlessHacks);
}
blankTextPage1();
reconfigure();
reconfigure();
}
private void blankTextPage1() {
@ -109,9 +109,8 @@ public class LawlessComputer extends Apple2e {
Logger.getLogger(LawlessComputer.class.getName()).log(Level.SEVERE, null, ex);
}
}
getCpu().setPaused(false);
finishColdStart();
getCpu().setPaused(false);
}
private void renderWithMask(int... mask) throws InterruptedException {

View File

@ -33,8 +33,9 @@ DEBUG = 0
decomp !zone {
jsr .chkdst
ldy #0 ; In lit loop Y must be zero
sec
.fill1A jsr .getbt2
jmp .fill1B
bne .fill1B ; always taken
.incdst inc pDst+1
.chkdst ldx pDst+1
@ -174,19 +175,19 @@ decomp !zone {
bne .gshift ; always taken
; Get another 8 bits into our bit buffer. Destroys X. Preserves A. Requires Y=0.
; Carry is always set on entry, Z always clear on exit
; Alternately, use .getbt2 to preserve X and destroy A
.getbts tax
.getbt2 lda (pSrc),y
inc pSrc
beq .src3A
.src3B sec
rol
sta bits
txa
inc pSrc
beq .src3A
rts
.src3A inc pSrc+1
bne .src3B ; always taken
rts
} ; end of zone

View File

@ -364,7 +364,7 @@ export asm memcpy(pSrc, pDst, len, auxWr)#0
inc pTmp+1
bne .pglup ; always taken
.part:
cpx #0
txa
beq .done
- lda (tmp),y
sta (pTmp),y
@ -390,8 +390,8 @@ export asm memset(pDst, val, len)#0
lda evalStkL,x ; len lo
pha
lda evalStkH,x ; len hi
tax
beq +
tax
lda tmp
- sta (pTmp),y
iny
@ -420,10 +420,10 @@ export asm readAuxByte(ptr)#1
sta $10-1,y
dey
bne -
jmp $10
.rdauxb
sei ; prevent interrupts while in aux mem
sta setAuxRd
jmp $10
.rdauxb
lda (pTmp),y
sta clrAuxRd
cli
@ -462,19 +462,19 @@ end
export asm finishString(isPlural)#1
!zone {
+asmPlasmRet 1
ldy prevCSWL+ABS_OFFSET ; put the cout vector back to default
sty cswl
ldy prevCSWL+1+ABS_OFFSET ; put the cout vector back to default
sty cswh
ldy #0 ; dest offset in Y (will be incremented before store)
cpy inbuf
beq .done1 ; failsafe: handle zero-length string
tax ; test for isPlural == 0
beq +
lda #$40 ; for setting V later
+ sta tmp ; save isPlural flag
lda prevCSWL+ABS_OFFSET ; put the cout vector back to default
sta cswl
lda prevCSWL+1+ABS_OFFSET ; put the cout vector back to default
sta cswh
clv ; V flag for prev-is-alpha
ldy #0 ; dest offset in Y (will be incremented before store)
ldx #0 ; source offset in X (will be incremented before load)
cpx inbuf
beq .done ; failsafe: handle zero-length string
.fetch
inx
lda inbuf,x ; get next input char
@ -488,11 +488,11 @@ export asm finishString(isPlural)#1
dey ; undo copy of the paren
stx tmp+1 ; save position in input
dex ; needed for failsafe operation
bit tmp ; set copy flag (V) initially to same as isPlural flag
.findsl ; see if there's a slash within the parens
inx
cpx inbuf
bcs .done ; failsafe: handle missing end-paren
lda inbuf,x
ora #$80 ; normalize hi-bit for comparisons below
cmp #"/"
@ -503,11 +503,8 @@ export asm finishString(isPlural)#1
pha
plp
+ cmp #")" ; scan until ending paren
beq +
cpx inbuf
bcc .findsl ; loop to scan next char
bcs .done ; failsafe: handle missing end-paren (always taken)
+ ldx tmp+1 ; get back to start of parens
bne .findsl ; loop to scan next char
ldx tmp+1 ; get back to start of parens
; copy mode flag is now in V: if slash present, single=copy, plural=nocopy
; if no slash: single=nocopy, plural=copy
.plup
@ -541,6 +538,7 @@ export asm finishString(isPlural)#1
.done
sty inbuf ; save new length
.done1
lda #<inbuf ; return pointer to string
ldy #>inbuf
rts
@ -575,8 +573,8 @@ export asm blit(isAux, srcData, dstScreenPtr, nLines, lineSize)#0
lsr ; to carry bit
bcc +
ldy #15 ; put aux copy routine in zero page
- lda .cpaux + ABS_OFFSET,y
sta $10,y
- ldx .cpaux + ABS_OFFSET,y
stx $10,y
dey
bpl -
+ pla ; get line count
@ -694,8 +692,9 @@ export asm puts(str)#0
sta pTmp
lda #'!'
ldx #1
sty pTmp+1
tya
beq + ; safety: print '!' instead of null string
sty pTmp+1
ldy #0
lda (pTmp),y
tax
@ -913,9 +912,8 @@ export asm rawDisplayStr(pStr)#0
lda (pTmp),y
sta tmp
- cpy tmp
bcc +
rts
+ iny
bcs ++
iny
lda (pTmp),y
ora #$80
cmp #"^"
@ -929,7 +927,8 @@ export asm rawDisplayStr(pStr)#0
+ sty tmp+1
jsr DisplayChar
ldy tmp+1
bne -
bne - ; always taken
++rts
end
///////////////////////////////////////////////////////////////////////////////////////////////////
@ -991,8 +990,8 @@ export asm streqi(a, b)#1
lda evalStkL+1,x
sta pTmp
lda evalStkH+1,x
sta pTmp+1
beq .null
sta pTmp+1
ldy #0
lda (tmp),y
cmp (pTmp),y
@ -1004,21 +1003,16 @@ export asm streqi(a, b)#1
+ tax ; count up to (verified same) length of the strings
- iny
lda (tmp),y
cmp #('z'&$7F)+1 ; convert to upper case
bcs +
eor (pTmp),y
beq + ; matched
cmp #$20 ; check for case bit
bne .noteqi ; abort on alpha inequality
ora (tmp),y ; convert to lower case
cmp #('z'&$7F)+1
bcs .noteqi ; abort on inequality
cmp #'a'&$7F
bcc +
sbc #$20
+ sta ysav
lda (pTmp),y
cmp #('z'&$7F)+1 ; convert to upper case
bcs +
cmp #'a'&$7F
bcc +
sbc #$20
+ cmp ysav
bne .noteqi ; abort on inequality
dex
bcc .noteqi ; abort on inequality
+ dex
bne -
lda #1
ldy #0 ; okay, they're equal. Return 1 (not just any char; so that PLASMA when...is can work)