[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

MLB Crack: The Boot (or, you had me at EOR…)



On Thursday, October 18, 2012 6:56:07 PM UTC-5, Hot Rod wrote:
> Hi,
> 
> I'm going to be adding a series of posts here describing my most recent retro computing project - a crack of the Micro League Baseball Box Score/Stat Compiler disk.
> 
> 
> 
> ]HR

The Boot (or, you had me at EOR…)

The boot0 starts out like this:
0801-   86 20       STX   $20
0803-   A2 00       LDX   #$00
0805-   5D 00 08    EOR   $0800,X
0808-   9D 00 01    STA   $0100,X
080B-   E8          INX   
080C-   D0 F7       BNE   $0805
080E-   AA          TAX   
080F-   9A          TXS   
0810-   60          RTS   

$800 contains a #$04, so basically everything loads right away ($800-$BFF).  This lovely little routine then decodes itself down onto the stack, sets the stack pointer, and then begins a series of returns to control program flow.  Neat.

Stack return addresses that control the rest of the boot flow start at $1ED, based on the final value left in the accumulator.  (I saved the decoded version out at $1100 in my work disk image, so it’s moved up to $11ED in saved file.)

Following the list of return addresses on the stack, the rest of the boot sequence then is:

a) $1B4 - this decodes (EOR) the code at $800-$BFF
b) $184 - checks if 64K memory or not (and fails if not, although this has a bug in it).  If yes, leaves upper RAM open for loading.  The bug is an incorrect “jump to self” address, which I went ahead and fixed in the crack.
c) $178 - stores #$01 at $22 and #$00 at $24 and $801 (which initializes for next reads)
d) $14E - this reads in a batch of five T/S list groups (see map later on)
e) $A700 - Main program. Play a game, See or print stats, Delete a team from disk are the only options.  If the ‘P’ option is chosen (to play a game), then the next stack return address is used to continue back from here.

f) $141 - turns the drive back on, stores a #$0B at $016F, loads A-reg from $0801 and falls through to $014E. This will read the next batch of six T/S list groups, however this is AFTER prompting to insert the MLB game disk (and checking it).  So this next batch of six is for the Game Disk. 

g) $A700 - Start of Game disk (play, demo, etc)
h) $6000 - Start of game

The last two steps are actually running the code from the Game disk itself, although these last few stack returns are from the original Box Score/Stat disk boot.  An interesting crossover twist (and one that presented a slight challenge to the crack – more on that later).

]HR