Skip discussion and go straight to conclusion/download link
Ahh yes, back to our friend Alien Mind. As you may recall from Part 1, it's easy enough to get running, but what we'd really like is (a) slot independence, and (b) concatenating all 4 disks into one big smartport volume without any swapping (thus providing compatibility not just with CFFA3K, but also MicroDrive turbo if you dd the mess onto a partition, or any other SmartPort based solution). It took a few days of thinking, but yes, yes this is something we can do. We start by sinking tons of hours into further taking Alien Mind apart, at great risk to personal health and employment. I'm happy with the result:
Alien Mind Updated Disassembly Notes (Warning: No, Toinet, I'm never aiming for 100% accurate disassembly, this is just my working scratchpad. LOL love ya)
So what we have here are a bunch of tables of disk blocks that we load from the various disks, as well as a few routines to deal with loading them, requiring the right disk to be inserted, formatting player disks, and whatnot. Velly good, we can work wis zis.
The first thing we have to do is concatenate all 4 volumes into one big one. I popped into Sweet16, created a 5MB .2mg file, and keyed in a quick Monitor routine to dump the volumes onto it:
w_offset = 0
org $8000
clc
xce
rep #$30
lda #$0000
]r1 sta rblk
tax
clc
adc #w_offset
sta wblk
txa
pha
sec
xce
sep #$30
reader jsr $c50d
db $41
adrl rparms
bcs reader
writer jsr $c70d
db $42
adrl wparms
bcs writer
clc
xce
rep #$30
pla
inc
cmp #1600
bne ]r1
rts
rparms db 03
db 01
adrl 008200
rblk adrl 000000
wparms db 03
db 02
adrl 008200
wblk adrl 0000
... Ran it a few times with my new .2mg in S7D2 and the different disk images in s5d1, with different values of w_offset (0,1600/$640,3200/$C80,4800/$12C0), and soon enough I had a disk image containing all 4 volumes with room to spare. But now we've gotta patch the silly thing to know where all its data is, don't we? And of course we can't forget slot independence. Let's start with that.
We fiddle with a few things in Block 0000 / Block 0001 to attain slot independence. Unfortunately, because it takes a few bytes, we end up ditching the F.U.C.K.'s pretty/buggy cracktro. If it's any consolation, F.U.C.K., you guys did an amazing job, everyone still credits you for this release, and I can tell it wasn't easy translating all that low-level IWM with custom encodings to plain old $C50D smartport. But progress had to come somehow. Anyway, here's what I did on the first two blocks:
patch in a jump to changed code:
0801: 20 6C 09 - JSR $096C
remove fades because we write over them:
08A5: EA EA EA
08A8: EA EA EA
08C8: EA EA EA
08CB: EA EA EA
08CE: EA EA EA
08FD: EA EA EA
0900: EA EA EA
0903: EA EA EA
patch palette faders at 96C:
096C: 8A - TXA
096D: 4A - LSR
096E: 4A - LSR
096F: 4A - LSR
0970: 4A - LSR
0971: 09 C0 - ORA #$C0
0973: 8D 78 09 - STA $0978
0976: AD FF C5 - LDA $C5FF
0979: 1A - INC
097A: 1A - INC
097B: 1A - INC
097C: 8D 77 09 - STA $0977
097F: 18 - CLC
0980: FB - XCE
0981: C2 30 - REP #$30
0983: AD 77 09 - LDA $0977
0986: 8D 47 09 - STA $0947
0989: 4C 67 09 - JMP $0967 ; TODO could change to a branch
Okay, we could stop there, but that just patches the first and second stage loaders. We've got a whole game to patch, so let's do that, and save it far away in this enormous disk volume. Block $12F7 looks good because it's out of the way. I popped into Merlin and wrote this:
* alien mind 2016 smartport edition patcher
org $800
lda #$60
sta $202f ; return after relocation
jsr $2000 ; perform relocation/init stuff
sep #$30
lda #$a9
sta $202f ; now set it back to an LDA
* patch smartport vectors
clc
xce
rep #$30
lda $0acd ; get smartport entry
sta $b2d6
* sta $b3d9 ; player disk formatter - not needed
* sta $b3e6 ; player disk formatter - not needed
* sta $b459 ; player disk checker - not needed
* sta $b474 ; player disk checker - not needed
* sta $b4a2 ; player disk checker - not needed
* patch load tables - disk 2
ldx #$0640
pea #$0000
pea #$a0bc
pea #$a0c3
pea #$a0e9
pea #$a0f0
pea #$a116
pea #$a11d
pea #$a143
pea #$a14a
pea #$a170
pea #$a177
jsr upd2
* patch load tables - disk 3
ldx #$0C80
pea #$0000
pea #$a19d
pea #$a1a4
pea #$a1ca
pea #$a1d1
pea #$a1db
pea #$a1e8
jsr upd2
* patch misc other stuff
sep #$30
* patch Disk ID/prompter to not do anything, just return
lda #$60
sta $B346
* patch player disk checker to not do anything, jump to B481 (store/return)
lda #$81
sta $B097
* patch the other player disk checker to not do anything, jump to B481 (store/return)
sta $B08D
* patch savegame disk formatter to not do anything
lda #$60
sta $B3D8
* patch savegame writer/reader to use $12C0 offset
rep #$30
lda #$1a80 ; 80 1A - BRA $B071
sta $b055
lda #$0a0a ; 0A 0A - ASL ASL
sta $b071
lda #$6918 ; 18 69 - CLC ADC #$
sta $b073
lda #$12c0 ; $12C0
sta $b075
lda #$E180 ; 80 E1 - BRA $B05A
sta $b077
* on with the show
clc
xce
rep #$30
jmp $202f
* operate on a list in the stack
upd2 pla
sta $00
]up1 pla
cmp #$00
beq ret
jsr upd
bra ]up1
ret lda $00
pha
rts
* A = address of load table
* X = amt to add
upd sta ]l1+1
sta ]s1+1
stx ]a1+1
]l1 lda $a0bc
clc
]a1 adc #$0640
]s1 sta $a0bc
rts
Assembled this with Merlin, then saved it, then used Block Warden to Follow the file and write it to block $12F7. At this point, the only thing that's left is to update the custom block $0001 patcher that we wrote in Part 1 of this series, to make it load and execute this new patcher before kicking off the main game. Something like this:
0AB0: A9 F4 00 - LDA #$00F4
0AB3: 8D E2 22 - STA $22E2
0AB6: A9 AF 2B - LDA #$2BAF
0AB9: 8D E4 22 - STA $22E4
0ABC: A9 80 DA - LDA #$DA80
0ABF: 8D E6 22 - STA $22E6
0AC2: AD 77 09 - LDA $0977
0AC5: 8D C9 0A - STA $0ACD
0AC8: 38 - SEC
0AC9: FB - XCE
0ACA: E2 30 - REP #$30
0ACC: 20 0D C5 - JSR $C50D
0ACF: 01 - DB $01
0AD0: D5 0A - DW $0AD5
0AD2: 4C 00 08 - JMP $0800
0AD5: 03 - DB $03
0AD6: 01 - DW $01
0AD7: 00 08 - DW $0800
0AD9: F7 12 00 00 - ADRL $0012F7
... and after that, maybe I signed my name real quick to the title page. These things happen.
TL;DR
Without further ado, presenting Alien Mind 2016 Smartport Edition.
Why it matters:
- Works on ROM 3 as well as ROM 01
- No more disk swapping - it's all one volume
- Works in any slot that supports SmartPort - you can dd it over the contents of a Microdrive or SCSI hard drive if you like (oh come on, like you were using that hard drive)
- Still only requires 512KB of RAM
Successful testing on:
- Sweet16 Emulator / ROM01 / SmartPort Slot 7
- Apple IIGS / ROM 3 / CFFA3K in Slot 5
"Format Player Disk" is still present, but does nothing. Similarly, "Insert Player Disk" text is still present, but is meaningless. I thought about patching over these, but that's just more stuff to patch. Authenticity is important to me, unless I'm defacing opening title pages.
Known bugs:
- Control Panel can lock up after multiple game restores if invoked via OA-Ctrl-Esc (but this does not happen when it is invoked via Ctrl-C); confirmed this is also present in the original. So it's a bug, just not my bug. Just invoke the control panel with Ctrl-C and you'll apparently avoid this one.
- Alex Lee's saved games are still present in several savegame slots. I think they're approximately slot == level number. Maybe this isn't a bug. :)
Easter Eggs (present in original):
- From Main Menu, select Apple Mouse, Stereo Sound, Joystick, Mono Sound, Keyboard, Sound Off, then About Authors - Dance of the dead
- From Main Menu, select Sound Off, Keyboard, Mono Sound, Joystick, Stereo Sound, Apple Mouse, then About Authors - Rob wears lipstick
- From Main Menu, select Stereo Sound, Mono Sound, Sound Off, Joystick - Black screen containing an unseen message from Todd Daugherty
Special thanks to Digarok for playtesting and the original idea to put this whole game into one big volume. My original idea, of jumping into the IIGS CDA menu before invoking the Alien Mind control panel, was much dumber in hindsight. And of course thanks to F.U.C.K. for making this all possible. It's still their release.
See also:
- Alien Mind Cheat By The Baron which explains editing your savegames. Except note that since everything is on one volume, savegame 1 is at block $12C0+4, savegame 2 is at block $12C0+8, and so forth.
- Alien Mind page at What Is The Apple II GS
Download Alien Mind 2016 Smartport Edition (right-click, Save As, etc)
[ Note 5/27/2016 - Apologies for instability in the initial release caused by alteration of bytes in what turns out to be a sensitive area of RAM in the first part of block $0001 ... after some testing, this appears to be stable, even at 40+Mhz. Note, use the below email address to contact me. ]
- iigs@ballmerpeak.org