[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
MLB Crack: The Lineup - Format and Rest of Boot
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 Format and Rest of Boot
Track $00 is a normal 16-sector format, but only has the few boot sectors’ worth of data on it. Tracks $01-$22 are all 4+4 encoded, each with ten sectors’ worth of data on them.
The sectors themselves are interesting, in that they have an address field with a marker of ED AD F5, followed by the sector number, and then this is followed by a data field with marker that is also ED AD F5, but is followed by Track, Sector, Byte Count, and Checksum. However, the track and sector that are in the data field marker are for the NEXT track and sector to be read; it’s a linked list. If there are no more sectors to read, then the ‘next’ sector is set to zero. The byte count is the count of bytes to read for the current sector though. More on this a bit later.
The sector number has the hi-bit set, so #$80-#$89 are sectors 0-9 (ten total, since 4+4 encoded). To make it easier to read the encoding, I jotted down a translate table.
Sector number nibble encoding:
EA AA = 80
EA AB = 81
EB AA = 82
EB AB = 83
EA AE = 84
EA AF = 85
EB AE = 86
EB AF = 87
EE AA = 88
EE AB = 89
So one thing I could see that I’d need is a routine that scans tracks $1-$22 and builds a map of the linked lists, to see what sectors are used. “Files” that are stored via this scheme are just spread out as linked sectors, but there is no catalog or VTOC; the knowledge of what’s where on the disk is custom coded in a table.
Now, back to the boot. The routine at $178 initialized the following:
$22 = drive number (1 or 2)
$24 = current track
$801 = count the number of T/S 'groups' to read
And then the boot continued at $14E, which I’ve annotated below.
14E- 0A ASL ; shift left (x2)
14F- 0A ASL ; shift left (x2), so skip 4
150- A8 TAY ; Y now skipped four byte set
151- B9 11 08 LDA $0811,Y ; load track (x2 - half tracks)
154- 85 2C STA $2C ; store track
156- B9 12 08 LDA $0812,Y ; load sector (hi-bit set)
159- 85 2E STA $2E ; store sector
15B- B9 13 08 LDA $0813,Y ; load buffer address lo
15E- 85 34 STA $34 ; store buffer address lo
160- B9 14 08 LDA $0814,Y ; load buffer address hi
163- 85 35 STA $35 ; store buffer address hi
165- 20 00 09 JSR $0900 ; go read one group
168- EE 01 08 INC $0801 ; increment T/S group count
16B- AD 01 08 LDA $0801 ; load for compare
16E- C9 05 CMP #$05 ; compare count
170- 90 DC BCC $014E ; next group if not done
172- A6 20 LDX $20 ; load the disk slot#
174- BD 88 C0 LDA $C088,X ; turn off disk
177- 60 RTS ; return